/[james]/archive/heeheehee/LevelDes
ViewVC logotype

Annotation of /archive/heeheehee/LevelDes

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14 - (hide annotations) (download)
Mon Feb 10 22:41:48 2003 UTC (21 years, 8 months ago) by james
File size: 7920 byte(s)
Initial import.

1 james 14 REM > !LevelDes.!RunImage
2    
3     LIBRARY"<Obey$Dir>.^.!HeeHeeHee.GameLib"
4    
5     ON ERROR MODE 12: PROCGameLib_Error
6     MODE 27
7     *ScreenLoad <Obey$Dir>.Sprites
8     OFF
9    
10     DIM DroidX%(100), DroidY%(100)
11    
12     VDU 28, 1, 58, 78, 53
13     SYS"Wimp_TextColour", 0+128
14     SYS"Wimp_TextColour", 7
15     CLS
16    
17     VDU 29, 35; 128;
18     VDU 24, 0; 0; 1200; 800;
19     SYS"Wimp_SetColour", 7+128
20     CLG
21    
22     SYS"OS_Byte", 4, 1
23    
24     *Pointer
25    
26     MOUSE RECTANGLE 0, 0, 1200, 800
27    
28     REPEAT
29     CLS
30     PRINT"Choose an option..."'
31     PRINT"1 Create new level"
32     PRINT"2 Load a level"
33     PRINT"3 Quit"
34     REPEAT: a% = GET - 48: UNTIL (a% > 0) AND (a% < 5)
35    
36     CASE a% OF
37     WHEN 1: CLS
38     INPUT"Name of level: "Level$
39     INPUT"Width of level: "Wide%
40     INPUT"Height of level: "High%
41     PROCCreate
42     WHEN 2: CLS
43     INPUT"Level name: "Level$
44     PROCLoad
45     WHEN 3: SYS"Wimp_CommandWindow", -1: END
46     ENDCASE
47     UNTIL 0
48    
49     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
50    
51     DEF PROCCreate
52     LOCAL Tile%()
53    
54     f% = OPENIN("<Obey$Dir>.^.!HeeHeeHee.Levels."+Level$+".Data")
55     IF f% <> 0 THEN
56     CLOSE#f%
57     VDU7
58     PRINT'"A level called �"+Level$+"‘ already exists!"
59     IF INKEY(200)
60     ENDPROC
61     ENDIF
62    
63     DIM Tile%(Wide% - 1, High% - 1)
64     Tile%() = 0
65    
66     Droids% = 0
67    
68     PROCEdit(Tile%())
69     ENDPROC
70    
71     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
72    
73     DEF PROCLoad
74     LOCAL Tile%()
75    
76     File% = OPENIN("<Obey$Dir>.^.!HeeHeeHee.Levels."+Level$+".Data")
77     IF File% = 0 THEN
78     VDU7
79     PRINT'"Could not load the level �"+Level$+"‘!"
80     IF INKEY(200)
81     ENDPROC
82     ENDIF
83     PRINT'"Loading..."
84    
85     Wide% = VAL(GET$#File%)
86     High% = VAL(GET$#File%)
87     DIM Tile%(Wide%, High%)
88    
89     X% = 0
90     Y% = High% - 1
91    
92     REPEAT
93     Tile% = BGET#File%
94    
95     CASE Tile% OF
96     WHEN 10 : Y% -= 1: X% = 0
97     WHEN ASC" ": X% += 1
98     WHEN ASC"P": Tile%(X%, Y%) += 1: X% += 1
99     WHEN ASC"L": Tile%(X%, Y%) += 2: X% += 1
100     WHEN ASC"W": Tile%(X%, Y%) += 4: X% += 1
101     WHEN ASC"*": Tile%(X%, Y%) += 8: X% += 1
102     WHEN ASC"S": Tile%(X%, Y%) += 16
103     WHEN ASC"F": Tile%(X%, Y%) += 32
104     ENDCASE
105    
106     UNTIL Y% = -1
107     CLOSE#File%
108    
109     File% = OPENIN("<Obey$Dir>.^.!HeeHeeHee.Levels."+Level$+".Droids")
110     IF File% = 0 THEN
111     VDU7
112     PRINT'"Could not load the level �"+Level$+"‘!"
113     IF INKEY(200)
114     ENDPROC
115     ENDIF
116    
117     Droids% = 0
118     WHILE NOT EOF#File%
119     Droids% += 1
120     DroidX%(Droids%) = VAL(GET$#File%)
121     DroidY%(Droids%) = High% - VAL(GET$#File%)
122     ENDWHILE
123    
124     CLOSE#File%
125    
126     PROCEdit(Tile%())
127     ENDPROC
128    
129     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
130    
131     DEF PROCSave(Tile%())
132     OSCLI"CDir <Obey$Dir>.^.!HeeHeeHee.Levels."+Level$
133     File% = OPENOUT("<Obey$Dir>.^.!HeeHeeHee.Levels."+Level$+".Data")
134     IF File% = 0 THEN
135     VDU7
136     PRINT'"Could not save the level �"+Level$+"‘"
137     IF INKEY(200)
138     ENDPROC
139     ENDIF
140     PRINT''"Saving..."
141    
142     BPUT#File%, STR$Wide%
143     BPUT#File%, STR$High%
144    
145     FOR Y% = High% - 1 TO 0 STEP -1
146     FOR X% = 0 TO Wide% - 1
147    
148     Tile% = Tile%(X%, Y%)
149    
150     IF Tile% AND 1 THEN BPUT#File%, "P";
151     IF Tile% AND 2 THEN BPUT#File%, "L";
152     IF Tile% AND 4 THEN BPUT#File%, "W";
153     IF Tile% AND 8 THEN BPUT#File%, "*";
154     IF Tile% AND 16 THEN BPUT#File%, "S";
155     IF Tile% AND 32 THEN BPUT#File%, "F";
156     IF (Tile% AND %1111) = 0 THEN BPUT#File%, " ";
157    
158     NEXT
159     BPUT#File%, ""
160     NEXT
161     CLOSE#File%
162    
163     File% = OPENOUT("<Obey$Dir>.^.!HeeHeeHee.Levels."+Level$+".Droids")
164     IF File% = 0 THEN
165     VDU7
166     PRINT'"Could not save the level �"+Level$+"‘"
167     IF INKEY(200)
168     ENDPROC
169     ENDIF
170    
171     IF Droids% THEN
172     FOR Droid% = 1 TO Droids%
173     BPUT#File%, STR$(DroidX%(Droid%))
174     BPUT#File%, STR$(High% - DroidY%(Droid%))
175     NEXT
176     ENDIF
177     CLOSE#File%
178    
179     ENDPROC
180    
181     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
182    
183     DEF PROCEdit(Tile%())
184     XOff% = 0
185     YOff% = 0
186     REPEAT
187     CLG
188     VDU 29, 35 - (XOff% * 16); 128 - (YOff% * 16);
189     FOR Y% = YOff% + 50 TO YOff% STEP -1
190     FOR X% = XOff% TO XOff% + 75
191     IF (X% < Wide%) AND (Y% < High%) THEN PROCTile(X%, Y%)
192     NEXT
193     NEXT
194     CLS
195     PRINT"Choose item to place by pressing key and click left mouse to place it"
196     PRINT"Click right button to clear square"
197     PRINT "P Platform L Ladder W Walls (blue)"
198     PRINT "R Deadly star (red) S Start (yellow) F Finish (green)"
199     PRINT "X Save & Exit D Droids"
200     PRINT "arrows scroll position";
201     Type% = 1
202     Scroll% = FALSE
203     Finish% = FALSE
204     REPEAT
205     a$ = INKEY$(0)
206     CASE a$ OF
207     WHEN "P","p": Type% = 1
208     WHEN "L","l": Type% = 2
209     WHEN "W","w": Type% = 4
210     WHEN "R","r": Type% = 8
211     WHEN "S","s": Type% = 16
212     WHEN "F","f": Type% = 32
213     WHEN "X","x": Finish% = TRUE
214     WHEN "D","d": PROCDroids
215     Scroll% = TRUE
216     WHEN "ˆ": IF XOff% = 0 THEN
217     VDU7
218     ELSE
219     XOff% -= 25
220     Scroll% = TRUE
221     ENDIF
222     WHEN "‰": IF XOff% + 75 > Wide% THEN
223     VDU7
224     ELSE
225     XOff% += 25
226     Scroll% = TRUE
227     ENDIF
228     WHEN "Š": IF YOff% = 0 THEN
229     VDU7
230     ELSE
231     YOff% -= 25
232     Scroll% = TRUE
233     ENDIF
234     WHEN "‹": IF YOff% + 50 > High% THEN
235     VDU7
236     ELSE
237     YOff% += 25
238     Scroll% = TRUE
239     ENDIF
240     ENDCASE
241     MOUSE x%, y%, z%
242     x% = x% / 16
243     y% = y% / 16
244     IF z% > 0 THEN
245     IF (x% > (Wide% - 1)) OR (y% > (High% - 1)) THEN
246     VDU7
247     z% = 0
248     ENDIF
249     ENDIF
250     IF z% = 4 THEN
251     IF Type% <= 8 THEN
252     Tile%(x%, y%) = Type%
253     ELSE
254     Tile%(x%, y%) = Tile%(x%, y%) OR Type%
255     ENDIF
256     PROCTile(x%, y%)
257     ENDIF
258     IF z% = 1 THEN
259     Tile%(x%, y%) = 0
260     PROCTile(x%, y%)
261     ENDIF
262     UNTIL Finish% OR Scroll%
263     UNTIL Finish%
264    
265     PROCSave(Tile%())
266     ENDPROC
267    
268     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
269    
270     DEF PROCTile(x%, y%)
271     Tile% = Tile%(x%, y%)
272     IF Tile% = 0 THEN RECTANGLE FILL x%*16, y%*16, 14
273     IF Tile% AND 1 THEN OSCLI"SChoose P": PLOT &ED, x%*16, y%*16
274     IF Tile% AND 2 THEN OSCLI"SChoose L": PLOT &ED, x%*16, y%*16
275     IF Tile% AND 4 THEN OSCLI"SChoose W": PLOT &ED, x%*16, y%*16
276     IF Tile% AND 8 THEN OSCLI"SChoose *": PLOT &ED, x%*16+4, y%*16+4
277     IF Tile% AND 16 THEN OSCLI"SChoose S": PLOT &ED, x%*16+4, y%*16+4
278     IF Tile% AND 32 THEN OSCLI"SChoose F": PLOT &ED, x%*16+4, y%*16+4
279     ENDPROC
280    
281     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
282    
283     DEF PROCDroids
284     OSCLI"SChoose D"
285     IF Droids% > 0 THEN
286     FOR Droid% = 1 TO Droids%
287     PLOT &ED, DroidX%(Droid%)*16, DroidY%(Droid%)*16
288     NEXT
289     ENDIF
290     CLS
291     PRINT"Click left button to add a droid"
292     PRINT"Click right button to remove a droid"
293     PRINT"Press F when finished"
294     REPEAT
295     CASE INKEY$(0) OF
296     WHEN "F","f": ENDPROC
297     ENDCASE
298     MOUSE x%,y%,z%
299     x% = x% / 16
300     y% = y% / 16
301     IF z% > 0 THEN
302     IF (x% > (Wide% - 1)) OR (y% > (High% - 1)) THEN
303     VDU7
304     z% = 0
305     ENDIF
306     ENDIF
307     CASE z% OF
308     WHEN 4: IF Droids% = 100 THEN
309     VDU7
310     PRINT"Maximum number of droids reached"
311     IF INKEY(200)
312     ELSE
313     Droids% += 1
314     DroidX%(Droids%) = x%
315     DroidY%(Droids%) = y%
316     OSCLI"SChoose D"
317     PLOT &ED, DroidX%(Droids%)*16, DroidY%(Droids%)*16
318     ENDIF
319     PRINT"Droid added at ";x%;", ";y%
320     IF INKEY(100)
321     WHEN 1: IF Droids% <> 0 THEN
322     Droid% = 0
323     REPEAT
324     Droid% += 1
325     UNTIL ((DroidX%(Droid%) = x%) AND (DroidY%(Droid%) = y%)) OR (Droid% >= Droids%)
326     IF ((DroidX%(Droid%) = x%) AND (DroidY%(Droid%) = y%)) THEN
327     PROCTile(x%, y%)
328     FOR d% = Droid% TO Droids%-1
329     DroidX%(d%) = DroidX%(d%+1)
330     DroidY%(d%) = DroidY%(d%+1)
331     NEXT
332     Droids% -= 1
333     PRINT"Droid removed"
334     ELSE
335     VDU7
336     ENDIF
337     ENDIF
338     ENDCASE
339     UNTIL 0
340     ENDPROC

  ViewVC Help
Powered by ViewVC 1.1.26