Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | rem The Dark Night |
2 | rem by Daniel Marschall |
||
3 | |||
4 | rem ToDo: |
||
5 | rem Nebel-Himmel-Problem (NHP) |
||
6 | |||
7 | rem Setup & Startbildschirm |
||
8 | if check display mode( 800, 600, screen depth() ) then set display mode 800, 600, screen depth() |
||
9 | rem if check display mode( 1024, 768, screen depth() ) then set display mode 1024, 768, screen depth() |
||
10 | hide mouse |
||
11 | Sync On |
||
12 | Sync Rate 30 |
||
13 | |||
14 | rem gosub _startgame |
||
15 | |||
16 | load bitmap "bitmap\title.bmp" |
||
17 | |||
18 | rem Menü? |
||
19 | sleep 3000 |
||
20 | load bitmap "bitmap\title2.bmp" |
||
21 | rem show mouse |
||
22 | |||
23 | set text font "times" |
||
24 | set text size 27 |
||
25 | fade = 230 |
||
26 | pos = 1 |
||
27 | menu = 1 |
||
28 | sound = 1 |
||
29 | rem music = 1 |
||
30 | do |
||
31 | gosub _fademenu |
||
32 | if ( downkey() = 1 and pos < 4 and menu = 1 ) or ( downkey() = 1 and pos < 3 and menu = 3 ) |
||
33 | inc pos |
||
34 | while downkey() = 1 |
||
35 | gosub _fademenu |
||
36 | endwhile |
||
37 | endif |
||
38 | if upkey() = 1 and pos > 1 |
||
39 | dec pos |
||
40 | while upkey() = 1 |
||
41 | gosub _fademenu |
||
42 | endwhile |
||
43 | endif |
||
44 | if returnkey() = 1 |
||
45 | if menu = 1 |
||
46 | if pos = 1 then gosub _startgame |
||
47 | if pos = 2 |
||
48 | rem load bitmap "bitmap\Titel2.bmp" |
||
49 | rem menu = 2 |
||
50 | rem pos = 1 |
||
51 | endif |
||
52 | if pos = 3 |
||
53 | load bitmap "bitmap\title2.bmp" |
||
54 | menu = 3 |
||
55 | pos = 1 |
||
56 | endif |
||
57 | if pos = 4 then break |
||
58 | else |
||
59 | if menu = 3 |
||
60 | if pos = 1 |
||
61 | if sound = 1 |
||
62 | sound = 0 |
||
63 | else |
||
64 | sound = 1 |
||
65 | endif |
||
66 | load bitmap "bitmap\title2.bmp" |
||
67 | endif |
||
68 | if pos = 2 |
||
69 | if music = 1 |
||
70 | music = 0 |
||
71 | else |
||
72 | music = 1 |
||
73 | endif |
||
74 | load bitmap "bitmap\title2.bmp" |
||
75 | endif |
||
76 | if pos = 3 |
||
77 | load bitmap "bitmap\title2.bmp" |
||
78 | menu = 1 |
||
79 | pos = 1 |
||
80 | endif |
||
81 | endif |
||
82 | endif |
||
83 | while returnkey() = 1 |
||
84 | gosub _fademenu |
||
85 | endwhile |
||
86 | endif |
||
87 | loop |
||
88 | |||
89 | _startgame: |
||
90 | ink rgb(255, 230, 0), 0 |
||
91 | load bitmap "bitmap\title.bmp" |
||
92 | text 50, 550, "Level wird geladen..." |
||
93 | rem hide mouse |
||
94 | |||
95 | sync |
||
96 | |||
97 | rem Setup |
||
98 | Backdrop on |
||
99 | Set camera range 1, 5000 |
||
100 | Autocam off |
||
101 | |||
102 | rem Boden |
||
103 | Make matrix 1, 10000, 10000, 20, 20 |
||
104 | Load image "bitmap\grass.bmp", 1 |
||
105 | Prepare matrix texture 1, 1, 1, 1 |
||
106 | Fill matrix 1, 0, 1 |
||
107 | randomize matrix 1, 125 |
||
108 | |||
109 | rem Himmel |
||
110 | load image "bitmap\sky.bmp", 2 |
||
111 | make object sphere 2, (landsize * 2) - 500 |
||
112 | set object collision off 2 |
||
113 | rem scale object 2, 2000, 1800, 2000 |
||
114 | rem scale object 2, 2000, 1000, 2000 |
||
115 | scale object 2, 2000, 1300, 2000 |
||
116 | set object 2, 1, 1, 0 |
||
117 | texture object 2, 2 |
||
118 | fade object 2, 0 |
||
119 | backdrop off |
||
120 | |||
121 | rem Level einlesen - Bäume |
||
122 | rem open to read 1, "map\001-tree.map" |
||
123 | load image "bitmap\tree.bmp", 4 |
||
124 | make object plain 52, 200, 400 |
||
125 | make mesh from object 52, 52 |
||
126 | add limb 52, 1, 52 |
||
127 | rotate limb 52, 1, 0, 90, 0 |
||
128 | make mesh from object 52, 52 |
||
129 | delete object 52 |
||
130 | make object 52, 52, 0 |
||
131 | remstart |
||
132 | while file end(1) = 0 |
||
133 | inc t |
||
134 | read string 1, rx$ |
||
135 | read string 1, rz$ |
||
136 | add limb 52, t, 52 |
||
137 | offset limb 52, t, val(rx$), get ground height(1, val(rx$), val(rz$)), val(rz$) |
||
138 | endwhile |
||
139 | remend |
||
140 | for t = 1 to 199 |
||
141 | rx = rnd(10000) |
||
142 | rz = rnd(10000) |
||
143 | add limb 52, t, 52 |
||
144 | offset limb 52, t, rx, get ground height(1, rx, rz), rz |
||
145 | next t |
||
146 | make mesh from object 52, 52 |
||
147 | delete object 52 |
||
148 | make object 52, 52, 4 |
||
149 | rem position object 52, xxx, 190, xxx |
||
150 | position object 52, 0, 190, 0 |
||
151 | set object 52, 1, 0, 0 |
||
152 | rem close file 1 |
||
153 | |||
154 | load object "Morningside.x",95 |
||
155 | position object 95, 2000, get ground height(1, 2000, 2000), 2000 |
||
156 | |||
157 | rem Karte |
||
158 | load image "map\zone001.bmp", 5 |
||
159 | make object plain 51, 256, 256 |
||
160 | lock object on 51 |
||
161 | position object 51, -490, -340, 800 |
||
162 | ghost object on 51 |
||
163 | texture object 51, 5 |
||
164 | |||
165 | rem Bildschirm neu aufbauen |
||
166 | cls |
||
167 | sync |
||
168 | |||
169 | Rem Musik |
||
170 | if music = 1 |
||
171 | load music "music\music.mid", 1 |
||
172 | loop music 1 |
||
173 | endif |
||
174 | |||
175 | rem Radar vorbereiten |
||
176 | radarpointcolor = 150 |
||
177 | |||
178 | rem Scorpion |
||
179 | remstart |
||
180 | Load object "obj\idle.x", 50 |
||
181 | rem append object "obj\walk.x",50,100 |
||
182 | Loop object 50 |
||
183 | position object 50, 500, Get Ground Height(1, 500, 500) + 265, 500 |
||
184 | fix object pivot 50 |
||
185 | loop object 50, 0, 20 |
||
186 | rem Stachel verstecken |
||
187 | hide limb 50, 1 |
||
188 | set object collision on 50 |
||
189 | remend |
||
190 | |||
191 | rem Hauptschleife |
||
192 | Do |
||
193 | |||
194 | rem Wetter |
||
195 | set ambient light 40 |
||
196 | if fog available() = 1 |
||
197 | fog on |
||
198 | rem fog distance 7500 |
||
199 | fog distance 4500 |
||
200 | fog color rgb(135, 119, 99) |
||
201 | endif |
||
202 | |||
203 | set cursor 0, 0 |
||
204 | oldcAY# = cAY# |
||
205 | oldcAX# = cAX# |
||
206 | |||
207 | cAY# = WrapValue(cAY# + MousemoveX() * 0.2) |
||
208 | cAX# = WrapValue(cAX# - MousemoveY() * 0.2) |
||
209 | caZ# = Camera angle Z() |
||
210 | |||
211 | rem Sprungroutine |
||
212 | if sprungdelay > 0 then dec sprungdelay |
||
213 | if MouseClick() = 2 and sprung = 0 and sprungrev = 0 and sprungdelay = 0 then inc sprung, 4 |
||
214 | if sprung > 0 |
||
215 | if sprungrev = 0 |
||
216 | inc sprung, 4 |
||
217 | if sprung = 60 then sprungrev = 1 |
||
218 | else |
||
219 | if sprungrev = 1 |
||
220 | dec sprung, 5 |
||
221 | if sprung = 0 |
||
222 | sprungrev = 0 |
||
223 | sprungdelay = 15 |
||
224 | endif |
||
225 | endif |
||
226 | endif |
||
227 | endif |
||
228 | |||
229 | rem Laufen |
||
230 | rem Spiellogik (Geschwindigkeit): Vor = +2 / Zurück = -2 |
||
231 | if Upkey() = 1 |
||
232 | XTest# = Newxvalue(X#, cAY#, 7) |
||
233 | ZTest# = Newzvalue(Z#, cAY#, 7) |
||
234 | if XTest# > 0 and XTest# < 10000 and ZTest# > 0 and ZTest# < 10000 |
||
235 | X# = XTest# |
||
236 | Z# = ZTest# |
||
237 | endif |
||
238 | endif |
||
239 | if Downkey() = 1 |
||
240 | XTest# = Newxvalue(X#, Wrapvalue(cAY# - 180), 3) |
||
241 | ZTest# = Newzvalue(Z#, Wrapvalue(cAY# - 180), 5) |
||
242 | if XTest# > 0 and XTest# < 10000 and ZTest# > 0 and ZTest# < 10000 |
||
243 | X# = XTest# |
||
244 | Z# = ZTest# |
||
245 | endif |
||
246 | endif |
||
247 | if Leftkey() = 1 |
||
248 | XTest# = Newxvalue(X#, Wrapvalue(cAY# - 90), 5) |
||
249 | ZTest# = Newzvalue(Z#, Wrapvalue(cAY# - 90), 5) |
||
250 | if XTest# > 0 and XTest# < 10000 and ZTest# > 0 and ZTest# < 10000 |
||
251 | X# = XTest# |
||
252 | Z# = ZTest# |
||
253 | endif |
||
254 | endif |
||
255 | if Rightkey() = 1 |
||
256 | XTest# = Newxvalue(X#, Wrapvalue(cAY# + 90), 5) |
||
257 | ZTest# = Newzvalue(Z#, Wrapvalue(cAY# + 90), 5) |
||
258 | if XTest# > 0 and XTest# < 10000 and ZTest# > 0 and ZTest# < 10000 |
||
259 | X# = XTest# |
||
260 | Z# = ZTest# |
||
261 | endif |
||
262 | endif |
||
263 | |||
264 | Rem Rotate camera |
||
265 | cTestX# = WrapValue(cAX# - 180) |
||
266 | if cTestX# > 225 then cAX# = 45 |
||
267 | if cTestX# < 135 then cAX# = 315 |
||
268 | YRotate camera CurveAngle(cAY#, oldcAY#, 24) |
||
269 | XRotate camera CurveAngle(cAX#, oldcAX#, 24) |
||
270 | |||
271 | Rem Position Camera |
||
272 | Y# = Get ground height(1, X#, Z#) + 85 + sprung |
||
273 | Position Camera X#, Y#, Z# |
||
274 | |||
275 | Rem Position Listener |
||
276 | Position Listener X#, Y#, Z# |
||
277 | Rotate Listener 0, cAY#, 0 |
||
278 | |||
279 | rem Himmel bewegt sich... |
||
280 | rem zu schnell: 0.0005 |
||
281 | scroll object texture 2, 0.0004, 0 |
||
282 | fade object 2, 0 |
||
283 | position object 2, x#, 0, z# |
||
284 | |||
285 | rem Radar |
||
286 | xx = X# / 62.5 |
||
287 | zz = Z# / 62.5 |
||
288 | z = zz * -1 |
||
289 | if radarpointrev = 0 |
||
290 | inc radarpointcolor, 3 |
||
291 | else |
||
292 | dec radarpointcolor, 3 |
||
293 | endif |
||
294 | if radarpointcolor > 255 |
||
295 | radarpointrev = 1 |
||
296 | radarpointcolor = 254 |
||
297 | endif |
||
298 | if radarpointcolor < 150 |
||
299 | radarpointrev = 0 |
||
300 | radarpointcolor = 149 |
||
301 | endif |
||
302 | ink rgb(radarpointcolor, 0, 0), 0 |
||
303 | circle xx + 15, z + 592, 1 |
||
304 | circle xx + 15, z + 592, 0 |
||
305 | |||
306 | rem Scorpion bewegen |
||
307 | rem Position Object 50, Object Position X(50), Object Position Y(50), Object Position Z(50) |
||
308 | |||
309 | Rem Bild erneuern |
||
310 | Sync |
||
311 | Loop |
||
312 | |||
313 | function lcd(rich$, x, y, r, g, b) |
||
314 | a = len(rich$) + 1 |
||
315 | i = 0 |
||
316 | s = 16 |
||
317 | set text font "Courier" |
||
318 | repeat |
||
319 | sprite 1, s, y, 1 |
||
320 | set cursor x * 8, y |
||
321 | x$ = mid$(rich$, x) |
||
322 | repeat |
||
323 | if r = 1 then ink rgb(i, 0, 0), 0 |
||
324 | if g = 1 then ink rgb(0, i, 0), 0 |
||
325 | if b = 1 then ink rgb(0, 0, i), 0 |
||
326 | if r = 1 and g = 1 then ink rgb(i, i, 0), 0 |
||
327 | if r = 1 and b = 1 then ink rgb(i, 0, i), 0 |
||
328 | if g = 1 and b = 1 then ink rgb(0, i, i), 0 |
||
329 | if b = 1 and g = 1 and b = 1 then ink rgb(i, i, i), 0 |
||
330 | text x * 8, y, x$ |
||
331 | inc i, 35 |
||
332 | sync |
||
333 | until i => 255 |
||
334 | inc x |
||
335 | inc s, 8 |
||
336 | i = 0 |
||
337 | play sound 1 |
||
338 | until x = a |
||
339 | endfunction |
||
340 | |||
341 | _fademenu: |
||
342 | if fade > 200 then fadedir = 0 |
||
343 | if fade < 100 then fadedir = 1 |
||
344 | if fadedir = 1 |
||
345 | inc fade, 5 |
||
346 | else |
||
347 | dec fade, 5 |
||
348 | endif |
||
349 | rem Beleuchtet |
||
350 | ink rgb(255, fade, 0), 0 |
||
351 | if menu = 1 |
||
352 | if pos = 1 then text 260, 255, "Neues Spiel starten" |
||
353 | if pos = 2 then text 260, 285, "Spiel laden" |
||
354 | if pos = 3 then text 260, 315, "Einstellungen" |
||
355 | if pos = 4 then text 260, 345, "Spiel beenden" |
||
356 | endif |
||
357 | if menu = 3 |
||
358 | if pos = 1 |
||
359 | if sound = 1 then text 260, 255, "Ton: An" |
||
360 | if sound = 0 then text 260, 255, "Ton: Aus" |
||
361 | endif |
||
362 | if pos = 2 |
||
363 | if music = 1 then text 260, 285, "Musik: An" |
||
364 | if music = 0 then text 260, 285, "Musik: Aus" |
||
365 | endif |
||
366 | if pos = 3 then text 260, 315, "Hauptmenü" |
||
367 | endif |
||
368 | rem Normal |
||
369 | ink rgb(255, 230, 0), 0 |
||
370 | if menu = 1 |
||
371 | if pos <> 1 then text 260, 255, "Neues Spiel starten" |
||
372 | if pos <> 2 then text 260, 285, "Spiel laden" |
||
373 | if pos <> 3 then text 260, 315, "Einstellungen" |
||
374 | if pos <> 4 then text 260, 345, "Spiel beenden" |
||
375 | endif |
||
376 | if menu = 3 |
||
377 | if pos <> 1 |
||
378 | if sound = 1 then text 260, 255, "Ton: An" |
||
379 | if sound = 0 then text 260, 255, "Ton: Aus" |
||
380 | endif |
||
381 | if pos <> 2 |
||
382 | if music = 1 then text 260, 285, "Musik: An" |
||
383 | if music = 0 then text 260, 285, "Musik: Aus" |
||
384 | endif |
||
385 | if pos <> 3 then text 260, 315, "Hauptmenü" |
||
386 | endif |
||
387 | sync |
||
388 | return |
||
389 |