Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | Rem * Title : The Room Demo |
2 | Rem * Author : DBS-LB |
||
3 | Rem * Date : 1st September 99 |
||
4 | rem ******************************************** |
||
5 | rem * ROOM * |
||
6 | rem ******************************************** |
||
7 | rem * AUTHOR: Lee Bamber DATE: 1st Sep 1999 * |
||
8 | rem ******************************************** |
||
9 | |||
10 | rem Setup environment |
||
11 | hide mouse |
||
12 | autocam off |
||
13 | sync on |
||
14 | |||
15 | rem Set up Scene |
||
16 | setup_room() |
||
17 | |||
18 | rem Activate forcefeedback |
||
19 | forceactive=setup_forcefeedback() |
||
20 | |||
21 | rem Set up Data |
||
22 | gosub _setupglobals |
||
23 | |||
24 | rem Init player position |
||
25 | a#=90.0 |
||
26 | x#=150.0 |
||
27 | |||
28 | rem Begin main loop |
||
29 | backdrop off |
||
30 | do |
||
31 | |||
32 | rem Handle Control Keys |
||
33 | mainaction=0 : subaction=0 |
||
34 | if upkey()=1 then mainaction=1 |
||
35 | if downkey()=1 then mainaction=2 |
||
36 | if leftkey()=1 then subaction=3 : a#=wrapvalue(a#-6.0) |
||
37 | if rightkey()=1 then subaction=4 : a#=wrapvalue(a#+6.0) |
||
38 | |||
39 | rem Handle Control Stick |
||
40 | if control device y()<-500 then mainaction=1 |
||
41 | if control device y()>500 then mainaction=2 |
||
42 | if control device x()<-300 then subaction=3 : a#=wrapvalue(a#-6.0) |
||
43 | if control device x()>300 then subaction=4 : a#=wrapvalue(a#+6.0) |
||
44 | |||
45 | rem Handle Player Position |
||
46 | s#=handle_player_speed(s#,mainaction) |
||
47 | if mainaction>=1 and mainaction<=4 |
||
48 | |||
49 | rem Update Player position |
||
50 | oldx#=x# |
||
51 | oldz#=z# |
||
52 | if mainaction=1 |
||
53 | x#=newxvalue(x#,a#,s#) |
||
54 | z#=newzvalue(z#,a#,s#) |
||
55 | endif |
||
56 | if mainaction=2 |
||
57 | x#=newxvalue(x#,a#,s#*-1.0) |
||
58 | z#=newzvalue(z#,a#,s#*-1.0) |
||
59 | endif |
||
60 | |||
61 | rem Make sure player not colliding with room (obj1) |
||
62 | position object 102,x#,-150,z# |
||
63 | if object collision(102,5)=1 |
||
64 | position object 102,x#,-150,oldz# |
||
65 | if object collision(102,5)=0 |
||
66 | z#=oldz# |
||
67 | else |
||
68 | position object 102,oldx#,-150,z# |
||
69 | if object collision(102,5)=0 |
||
70 | x#=oldx# |
||
71 | else |
||
72 | x#=oldx# |
||
73 | z#=oldz# |
||
74 | endif |
||
75 | endif |
||
76 | endif |
||
77 | |||
78 | endif |
||
79 | |||
80 | rem Generate ripples when move |
||
81 | if mainaction>0 or subaction>0 then gosub _make_ripple |
||
82 | |||
83 | rem Handle Player |
||
84 | handle_player(x#,z#,a#,mainaction,subaction) |
||
85 | handle_camera(x#,z#,a#) |
||
86 | |||
87 | rem Handle Misc Effects |
||
88 | handle_player_shadow(x#,z#,a#) |
||
89 | handle_effects() |
||
90 | gosub _handle_bouncer |
||
91 | gosub _handle_rainforce |
||
92 | gosub _handle_face_fading |
||
93 | gosub _handle_drips |
||
94 | gosub _handle_facedecals |
||
95 | gosub _handle_ambience |
||
96 | gosub _handle_ripple_control |
||
97 | |||
98 | rem Update screen |
||
99 | sync |
||
100 | |||
101 | loop |
||
102 | |||
103 | rem Subroutines |
||
104 | _setupglobals: |
||
105 | |||
106 | dim ripple#(10) |
||
107 | for r=1 to 10 : ripple#(r)=0.0 : next r |
||
108 | |||
109 | dim drip(3) |
||
110 | for d=1 to 3 : drip(d)=0 : next d |
||
111 | |||
112 | return |
||
113 | |||
114 | _handle_bouncer: |
||
115 | |||
116 | rem scroll variable value |
||
117 | wh#=wrapvalue(wh#+8.0) |
||
118 | |||
119 | rem trigger bounce |
||
120 | position object 102,x#,-300,z# |
||
121 | col=object collision(21,0) |
||
122 | if col=102 |
||
123 | by#=3.0+(s#/5.0) |
||
124 | ix#=(object position x(21)-x#)/((35.0-s#)/1.5) |
||
125 | iz#=(object position z(21)-z#)/((35.0-s#)/1.5) |
||
126 | benergy=5 |
||
127 | play sound 3 |
||
128 | set sound volume 3,95-(benergy*2) |
||
129 | endif |
||
130 | if col=5 |
||
131 | ba#=wrapvalue(atanfull(bx#,bz#)+180.0) |
||
132 | is#=sqrt((ix#*ix#)+(iz#*iz#))/1.5 |
||
133 | ix#=sin(ba#)*is# |
||
134 | iz#=cos(ba#)*is# |
||
135 | by#=by#+2.0 |
||
136 | benergy=benergy+1 |
||
137 | play sound 3 |
||
138 | vol=95-(benergy*2) |
||
139 | if vol<1 then vol=0 |
||
140 | if vol>100 then vol=100 |
||
141 | set sound volume 3,vol |
||
142 | endif |
||
143 | |||
144 | rem manage bounce |
||
145 | bx#=object position x(21) |
||
146 | bz#=object position z(21) |
||
147 | if benergy>0 |
||
148 | bx#=bx#+ix# |
||
149 | bz#=bz#+iz# |
||
150 | ix#=ix#*0.95 |
||
151 | iz#=iz#*0.95 |
||
152 | position object 21,bx#,object position y(21)+by#,bz# |
||
153 | position object 22,bx#,-280.0,bz# |
||
154 | position sound 3,bx#,0,bz# |
||
155 | by#=by#-1.0 |
||
156 | if by#<((benergy*2.0)*-1.0) then by#=((benergy*2.0)*-1.0) |
||
157 | if object position y(21)<-250.0 |
||
158 | by#=(by#*0.75)*-1.0 |
||
159 | benergy=benergy-1 |
||
160 | play sound 3 |
||
161 | svol=95-(benergy*2) |
||
162 | if svol<0 then svol=0 |
||
163 | if svol>100 then svol=100 |
||
164 | set sound volume 3,svol |
||
165 | if benergy=0 |
||
166 | bfloat#=object position y(21) |
||
167 | endif |
||
168 | endif |
||
169 | else |
||
170 | diff#=((-250+(cos(wh#)*9.0))-bfloat#)/12.0 |
||
171 | bfloat#=bfloat#+diff# |
||
172 | position object 21,bx#,bfloat#,bz# |
||
173 | position object 22,bx#,-280.0,bz# |
||
174 | by#=0.0 |
||
175 | endif |
||
176 | |||
177 | rem ripple from ball (9) |
||
178 | r=9 |
||
179 | if ripple#(r)=0.0 and object position y(21)<-210.0 |
||
180 | position object 10+r,bx#,-225,bz# |
||
181 | texture object 10+r,17 |
||
182 | show object 10+r |
||
183 | ripple#(r)=1.0 |
||
184 | endif |
||
185 | |||
186 | rem scale ball based on vertical inertia |
||
187 | diff#=(by#-boing#)/6.0 |
||
188 | boing#=boing#+diff# |
||
189 | scale object 21,100,90+(boing#*4.0),100 |
||
190 | scale object 22,90-(boing#*2.0)+(cos(wh#)*9.0),90-(boing#*2.0)+(cos(wh#)*9.0),100 |
||
191 | ` |
||
192 | return |
||
193 | |||
194 | _handle_rainforce: |
||
195 | |||
196 | rem rain force |
||
197 | dist#=sqrt((x#*x#)+(z#*z#)) |
||
198 | if forceactive=1 and dist#<400 |
||
199 | force angle 10-((9.0/400.0)*dist#),rnd(359),5 |
||
200 | endif |
||
201 | |||
202 | return |
||
203 | |||
204 | _handle_face_fading: |
||
205 | |||
206 | rem handle wrapping rotation |
||
207 | sl#=wrapvalue(sl#+16.0) |
||
208 | rotate object 203,90,0,sl# |
||
209 | |||
210 | rem handle in-out fading |
||
211 | if lf=0 |
||
212 | fd=fd+1 |
||
213 | fade object 203,80 |
||
214 | if fd=10 then lf=1 |
||
215 | else |
||
216 | fd=fd-1 |
||
217 | fade object 203,125 |
||
218 | if fd=0 then lf=0 |
||
219 | endif |
||
220 | |||
221 | rem twirl force |
||
222 | dx#=x#-800.0 |
||
223 | dist#=sqrt((dx#*dx#)+(z#*z#)) |
||
224 | if forceactive=1 and dist#<200.0 |
||
225 | str#=((99.0/200.0)*dist#) |
||
226 | force angle 100-str#,wrapvalue(270.0-sl#),50 |
||
227 | a#=wrapvalue(a#-5.0*(str#/99.0)) |
||
228 | endif |
||
229 | |||
230 | rem Proximity to face opens door, else closes it |
||
231 | if dist#<400.0 |
||
232 | position object 36,-1290,object position y(36)+5.0,0 |
||
233 | if object position y(36)>500.0 |
||
234 | position object 36,-1290,500.0,0 |
||
235 | stop sound 4 : chl=0 |
||
236 | else |
||
237 | if chl=0 then loop sound 4 : set sound speed 4,12000 : chl=1 |
||
238 | endif |
||
239 | else |
||
240 | position object 36,-1290,object position y(36)-10.0,0 |
||
241 | if object position y(36)<160.0 |
||
242 | position object 36,-1290,160.0,0 |
||
243 | stop sound 4 : chl=0 |
||
244 | else |
||
245 | if chl=0 then loop sound 4 : set sound speed 4,15000 : chl=1 |
||
246 | endif |
||
247 | endif |
||
248 | |||
249 | return |
||
250 | |||
251 | _handle_drips: |
||
252 | |||
253 | rem loop through all drip elements |
||
254 | for d=1 to 3 |
||
255 | if drip(d)=0 and rnd(20)=0 |
||
256 | |||
257 | rem start drip |
||
258 | drip(d)=1 |
||
259 | position object 7+d,-700+rnd(1400),1000,-700+rnd(1400) |
||
260 | show object 7+d |
||
261 | |||
262 | else |
||
263 | if drip(d)=1 |
||
264 | position object 7+d,object position x(7+d),object position y(7+d)-100,object position z(7+d) |
||
265 | if object position y(7+d)<-300 |
||
266 | |||
267 | rem end drip |
||
268 | drip(d)=0 |
||
269 | hide object 7+d |
||
270 | |||
271 | rem ripple from drips (6-8) |
||
272 | r=5+d |
||
273 | position object 10+r,object position x(7+d),-225,object position z(7+d) |
||
274 | texture object 10+r,17 |
||
275 | show object 10+r |
||
276 | ripple#(r)=1.0 |
||
277 | |||
278 | endif |
||
279 | endif |
||
280 | endif |
||
281 | next d |
||
282 | |||
283 | return |
||
284 | |||
285 | _handle_facedecals: |
||
286 | |||
287 | rem Point faces towards camera position |
||
288 | dx#=camera position x() |
||
289 | dz#=camera position z() |
||
290 | fa#=wrapvalue(atanfull(dx#,dz#)+180.0) |
||
291 | yrotate object 7,wrapvalue(fa#) |
||
292 | |||
293 | return |
||
294 | |||
295 | _handle_ambience: |
||
296 | |||
297 | rem controls strength of shadow |
||
298 | dist#=sqrt(abs(x#*x#)+abs(z#*z#)) |
||
299 | set ambient light 20+(dist#/40.0) |
||
300 | |||
301 | return |
||
302 | |||
303 | _make_ripple: |
||
304 | |||
305 | rem spare ripple object? |
||
306 | r=1 : while ripple#(r)>0 and r<5 : r=r+1 : endwhile |
||
307 | if r<=5 |
||
308 | oz#=-48.0 |
||
309 | ox#=-70.0 |
||
310 | oz#=oz#+(rnd(2)*50.0) |
||
311 | ox#=ox#+(rnd(1)*140.0) |
||
312 | tx#=(cos(a#)*ox#)+(sin(a#)*oz#) |
||
313 | tz#=(cos(a#)*oz#)-(sin(a#)*ox#) |
||
314 | rx#=x#+tx# |
||
315 | rz#=z#+tz# |
||
316 | position object 10+r,rx#,-225,rz# |
||
317 | yrotate object 10+r,a# |
||
318 | texture object 10+r,17 |
||
319 | show object 10+r |
||
320 | ripple#(r)=1.0 |
||
321 | endif |
||
322 | |||
323 | return |
||
324 | |||
325 | _handle_ripple_control: |
||
326 | |||
327 | rem loops through all ripple elements |
||
328 | for r=1 to 10 |
||
329 | if object visible(10+r)=1 |
||
330 | texture object 10+r,16+ripple#(r) |
||
331 | ripple#(r)=ripple#(r)+0.5 |
||
332 | if ripple#(r)>=4.4 |
||
333 | ripple#(r)=0.0 |
||
334 | hide object 10+r |
||
335 | endif |
||
336 | endif |
||
337 | |||
338 | position object 10+r,object position x(10+r),-250+(cos(wh#)*9.0),object position z(10+r) |
||
339 | |||
340 | next r |
||
341 | |||
342 | return |
||
343 | |||
344 | rem Functions |
||
345 | function handle_player_speed(speed#,actionmode) |
||
346 | |||
347 | rem Handle Speed control |
||
348 | if actionmode=1 or actionmode=2 |
||
349 | speed#=speed#+5.0 |
||
350 | if actionmode=1 and speed#>30.0 then speed#=30.0 |
||
351 | if actionmode=2 and speed#>30.0 then speed#=30.0 |
||
352 | else |
||
353 | speed#=speed#-5.0 |
||
354 | if speed#<0.0 then speed#=0.0 |
||
355 | endif |
||
356 | |||
357 | endfunction speed# |
||
358 | |||
359 | function handle_player(px#,pz#,pa#,actionmode,subaction) |
||
360 | |||
361 | rem Handle player animation |
||
362 | handle_player_anim(actionmode,subaction) |
||
363 | |||
364 | rem Set Player Position and angle |
||
365 | position object 101,px#,0,pz# |
||
366 | yrotate object 101,pa# |
||
367 | |||
368 | rem Position listener at player |
||
369 | position listener px#/100.0,0,pz#/100.0 |
||
370 | rotate listener 0,wrapvalue(360.0-pa#),0 |
||
371 | |||
372 | rem Set players collision sphere |
||
373 | position object 102,px#,-150,pz# |
||
374 | |||
375 | endfunction |
||
376 | |||
377 | function handle_player_anim(actionmode,subactionmode) |
||
378 | |||
379 | if smoothing=0 |
||
380 | if actionmode>0 or subactionmode>0 |
||
381 | |||
382 | rem Switch to Walk |
||
383 | if object frame(101)<100 or object frame(101)>115 |
||
384 | start=100 |
||
385 | newanim=2 |
||
386 | smoothing=4 |
||
387 | loop sound 2 |
||
388 | set sound speed 2,8500+rnd(1500) |
||
389 | endif |
||
390 | if rnd(4)=0 then set sound speed 2,8500+rnd(1500) |
||
391 | |||
392 | else |
||
393 | |||
394 | rem Switch to Idle |
||
395 | if object frame(101)>25 |
||
396 | start=0 |
||
397 | newanim=1 |
||
398 | smoothing=4 |
||
399 | endif |
||
400 | |||
401 | endif |
||
402 | |||
403 | rem Activate smoothing |
||
404 | if smoothing>0 |
||
405 | |||
406 | rem Begin smoothing transition |
||
407 | stop object 101 |
||
408 | set object interpolation 101,25 |
||
409 | set object frame 101,start |
||
410 | |||
411 | rem Duplicate for shadow |
||
412 | stop object 4 |
||
413 | set object interpolation 4,25 |
||
414 | set object frame 4,start |
||
415 | |||
416 | endif |
||
417 | endif |
||
418 | |||
419 | rem Switch to new animation |
||
420 | if newanim>0 |
||
421 | if smoothing=0 |
||
422 | |||
423 | rem Trigger New Anim |
||
424 | if newanim=1 then length=20 : speed=10 |
||
425 | if newanim=2 then length=15 : speed=50 |
||
426 | |||
427 | rem Set Animation |
||
428 | set object interpolation 101,100 |
||
429 | set object frame 101,start |
||
430 | loop object 101,start,start+length |
||
431 | set object speed 101,speed |
||
432 | |||
433 | rem Duplicate for shadow |
||
434 | set object interpolation 4,100 |
||
435 | set object frame 4,start |
||
436 | loop object 4,start,start+length |
||
437 | set object speed 4,speed |
||
438 | |||
439 | rem Choose sound |
||
440 | if newanim=2 |
||
441 | loop sound 2 |
||
442 | else |
||
443 | play sound 2 |
||
444 | set sound speed 2,8400 |
||
445 | endif |
||
446 | |||
447 | rem Reset flag |
||
448 | newanim=0 |
||
449 | |||
450 | else |
||
451 | smoothing=smoothing-1 |
||
452 | endif |
||
453 | endif |
||
454 | |||
455 | endfunction |
||
456 | |||
457 | function handle_camera(px#,pz#,pa#) |
||
458 | |||
459 | rem Calc camera position and angle |
||
460 | ca#=wrapvalue(pa#+180.0) |
||
461 | cx#=newxvalue(px#,ca#,scdis#) |
||
462 | cz#=newzvalue(pz#,ca#,scdis#) |
||
463 | |||
464 | rem Record camera coords |
||
465 | oldx#=scx# |
||
466 | oldz#=scz# |
||
467 | |||
468 | rem Calc smoothed camera position and angle |
||
469 | diff#=(scx#-cx#)/6.0 |
||
470 | scx#=scx#-diff# |
||
471 | diff#=(scz#-cz#)/6.0 |
||
472 | scz#=scz#-diff# |
||
473 | sca#=curveangle(pa#,sca#,6.0) |
||
474 | |||
475 | rem Restrict camera if collide with walls |
||
476 | position object 103,scx#,-50,scz# |
||
477 | if object collision(103,5)=1 |
||
478 | if object hit(103,5)=1 then cdis#=100.0 |
||
479 | position object 103,scx#,-50,oldz# |
||
480 | if object collision(103,5)=0 |
||
481 | scx#=oldx# |
||
482 | else |
||
483 | position object 103,oldx#,-50,scz# |
||
484 | if object collision(103,5)=0 |
||
485 | scz#=oldz# |
||
486 | else |
||
487 | scx#=oldx# |
||
488 | scz#=oldz# |
||
489 | endif |
||
490 | endif |
||
491 | else |
||
492 | if cdis#<500.0 |
||
493 | cdis#=cdis#+50.0 |
||
494 | if cdis#>500.0 then cdis#=500.0 |
||
495 | endif |
||
496 | endif |
||
497 | |||
498 | rem Smooth camera distance for next cycle |
||
499 | diff#=(scdis#-cdis#)/6.0 |
||
500 | scdis#=scdis#-diff# |
||
501 | |||
502 | rem Set camera |
||
503 | position camera scx#,-50,scz# |
||
504 | point camera object position x(101),object position y(101)-100,object position z(101) |
||
505 | |||
506 | endfunction |
||
507 | |||
508 | function handle_effects() |
||
509 | |||
510 | rem Scroll rain texture |
||
511 | scroll object texture 2,0,-0.02 |
||
512 | |||
513 | rem Simple rotate of water |
||
514 | wr#=wrapvalue(wr#+1.0) |
||
515 | yrotate object 3,wr# |
||
516 | wh#=wrapvalue(wh#+8.0) |
||
517 | position object 3,0,-250+(cos(wh#)*9.0),0 |
||
518 | |||
519 | endfunction |
||
520 | |||
521 | function handle_player_shadow(px#,pz#,pa#) |
||
522 | |||
523 | rem Shadow follows player |
||
524 | position object 4,px#,-280.0,pz# |
||
525 | yrotate object 4,pa# |
||
526 | |||
527 | endfunction |
||
528 | |||
529 | function setup_forcefeedback() |
||
530 | |||
531 | rem Check for FF device |
||
532 | perform checklist for control devices |
||
533 | if checklist quantity()>0 |
||
534 | for f=1 to checklist quantity() |
||
535 | if checklist value a(f)=1 |
||
536 | set control device checklist string$(f) |
||
537 | force water effect 100,0 |
||
538 | forceactive=1 |
||
539 | endif |
||
540 | next f |
||
541 | else |
||
542 | forceactive=0 |
||
543 | endif |
||
544 | |||
545 | endfunction forceactive |
||
546 | |||
547 | function setup_room() |
||
548 | |||
549 | rem Blacken Scene |
||
550 | if fog available()=1 then fog on : fog color 0 : fog distance 0 |
||
551 | point camera 0,1000,0 |
||
552 | set ambient light 0 |
||
553 | |||
554 | rem Create bitmaps for room |
||
555 | load_image("bmp\floor.bmp",1) |
||
556 | load_image("bmp\roof.bmp",2) |
||
557 | load_image("bmp\wall1.bmp",3) |
||
558 | load_image("bmp\wall2.bmp",4) |
||
559 | load_image("bmp\wall3.bmp",5) |
||
560 | load_image("bmp\door.bmp",6) |
||
561 | load_image("bmp\portal.bmp",7) |
||
562 | |||
563 | rem Create special effects bitmaps |
||
564 | load_image("bmp\force.bmp",11) |
||
565 | load_image("bmp\water.bmp",12) |
||
566 | load_image("bmp\black.bmp",13) |
||
567 | ` load_image("bmp\spray.bmp",14) |
||
568 | ` load_image("bmp\spray.bmp",15) |
||
569 | load_image("bmp\ripple.bmp",16) |
||
570 | load_image("bmp\face.bmp",21) |
||
571 | ` load_image("bmp\stattext.bmp",31) |
||
572 | load_image("bmp\shadow.bmp",32) |
||
573 | load_image("bmp\logo.bmp",33) |
||
574 | |||
575 | rem Create room (but hide the gate) |
||
576 | load object "obj\dome.x",1 |
||
577 | set object collision off 1 |
||
578 | texture limb 1,0,2 |
||
579 | texture limb 1,1,2 |
||
580 | texture limb 1,2,4 |
||
581 | texture limb 1,3,3 |
||
582 | texture limb 1,4,5 |
||
583 | texture limb 1,5,5 |
||
584 | texture limb 1,6,6 |
||
585 | texture limb 1,7,4 |
||
586 | hide limb 1,6 |
||
587 | hide limb 1,8 |
||
588 | |||
589 | rem Reload room (showing only the gate) |
||
590 | load object "obj\dome.x",200 |
||
591 | set object collision off 200 |
||
592 | set object 200,1,0,0 |
||
593 | hide limb 200,1 |
||
594 | hide limb 200,2 |
||
595 | hide limb 200,3 |
||
596 | hide limb 200,4 |
||
597 | hide limb 200,5 |
||
598 | hide limb 200,7 |
||
599 | texture limb 200,6,6 |
||
600 | hide limb 200,8 |
||
601 | |||
602 | rem Create floor |
||
603 | make matrix 1,3200.0,2400.0,4,3 |
||
604 | position matrix 1,-2000.0,-290.0,-1200.0 |
||
605 | prepare matrix texture 1,1,2,2 |
||
606 | set matrix tile 1,1,1,3 |
||
607 | set matrix tile 1,3,1,2 |
||
608 | set matrix tile 1,2,1,4 |
||
609 | update matrix 1 |
||
610 | |||
611 | rem Create Shaft of light |
||
612 | make object cone 2,300 |
||
613 | scale object 2,200,800,200 |
||
614 | position object 2,0,600,0 |
||
615 | texture object 2,11 |
||
616 | set object 2,1,0,0 |
||
617 | ghost object on 2 |
||
618 | set object collision off 2 |
||
619 | if alphablending available()=0 then hide object 2 |
||
620 | |||
621 | rem Create water on floor |
||
622 | make object plain 3,2900,2900 |
||
623 | xrotate object 3,90 |
||
624 | fix object pivot 3 |
||
625 | texture object 3,12 |
||
626 | ghost object on 3 |
||
627 | set object collision off 3 |
||
628 | |||
629 | rem Create Shadow for player |
||
630 | load object "obj\scorpidle.x",4 |
||
631 | append object "obj\scorpwalk.x",4,100 |
||
632 | yrotate object 4,180 |
||
633 | fix object pivot 4 |
||
634 | scale object 4,100,1,100 |
||
635 | hide limb 4,1 : hide limb 4,2 : hide limb 4,3 |
||
636 | hide limb 4,5 : hide limb 4,6 : hide limb 4,7 |
||
637 | hide limb 4,12 : hide limb 4,13 : hide limb 4,14 |
||
638 | hide limb 4,15 : hide limb 4,16 : hide limb 4,17 |
||
639 | hide limb 4,18 : hide limb 4,19 : hide limb 4,20 |
||
640 | texture object 4,13 |
||
641 | set object collision off 4 |
||
642 | |||
643 | rem Create collision walls |
||
644 | make object plain 5,1200,800 |
||
645 | make mesh from object 1,5 |
||
646 | position object 5,0,0,1200 |
||
647 | for w=1 to 7 : add limb 5,w,1 : next w |
||
648 | w=1 : offset limb 5,w,-800,0,-350 : rotate limb 5,w,0,135,0 |
||
649 | w=2 : offset limb 5,w,800,0,-350 : rotate limb 5,w,0,45,0 |
||
650 | w=3 : offset limb 5,w,-1200,0,-1200 : rotate limb 5,w,0,270,0 |
||
651 | w=4 : offset limb 5,w,1200,0,-1200 : rotate limb 5,w,0,90,0 |
||
652 | w=5 : offset limb 5,w,-800,0,-2050 : rotate limb 5,w,0,45,0 |
||
653 | w=6 : offset limb 5,w,800,0,-2050 : rotate limb 5,w,0,135,0 |
||
654 | w=7 : offset limb 5,w,0,0,-2400 : rotate limb 5,w,0,180,0 |
||
655 | hide object 5 |
||
656 | |||
657 | rem Create Center Spray |
||
658 | make object cone 6,540 |
||
659 | scale object 6,100,1,100 |
||
660 | position object 6,0,-290,0 |
||
661 | xrotate object 6,180 |
||
662 | color object 6,rgb(235,235,255) |
||
663 | ghost object on 6 |
||
664 | fade object 6,0 |
||
665 | set object collision off 6 |
||
666 | |||
667 | rem Create Logo |
||
668 | make object plain 7,400,300 |
||
669 | texture object 7,33 |
||
670 | position object 7,0,230,0 |
||
671 | ghost object on 7 |
||
672 | set object 7,1,0,1 |
||
673 | set object collision off 7 |
||
674 | |||
675 | rem Create drips |
||
676 | make object cylinder 8,2 |
||
677 | scale object 8,100,1000,100 |
||
678 | ghost object on 8 |
||
679 | hide object 8 |
||
680 | set object collision off 8 |
||
681 | make object cylinder 9,2 |
||
682 | scale object 9,100,1000,100 |
||
683 | ghost object on 9 |
||
684 | hide object 9 |
||
685 | set object collision off 9 |
||
686 | make object cylinder 10,2 |
||
687 | scale object 10,100,1000,100 |
||
688 | ghost object on 10 |
||
689 | hide object 10 |
||
690 | set object collision off 10 |
||
691 | |||
692 | rem Create ripple objects |
||
693 | for r=1 to 10 |
||
694 | make object plain 10+r,100,100 |
||
695 | xrotate object 10+r,90 |
||
696 | fix object pivot 10+r |
||
697 | ghost object on 10+r |
||
698 | set object 10+r,1,0,1 |
||
699 | hide object 10+r |
||
700 | set object collision off 10+r |
||
701 | next r |
||
702 | |||
703 | rem Slightly rescale ball ripple |
||
704 | scale object 10+9,150,150,100 |
||
705 | |||
706 | rem Create bouncing ball |
||
707 | make object sphere 21,100 |
||
708 | position object 21,0,0,0 |
||
709 | texture object 21,2 |
||
710 | |||
711 | rem Create ball shadow |
||
712 | make object plain 22,100,100 |
||
713 | xrotate object 22,90 |
||
714 | fix object pivot 22 |
||
715 | texture object 22,32 |
||
716 | set object 22,1,0,0 |
||
717 | set object collision off 22 |
||
718 | |||
719 | rem Create Effective Door |
||
720 | make object plain 31,1000,1000 |
||
721 | position object 31,-1400,100,0 |
||
722 | yrotate object 31,90 |
||
723 | texture object 31,3 |
||
724 | fade object 31,0 |
||
725 | set object collision off 31 |
||
726 | make object plain 32,1000,1000 |
||
727 | position object 32,-1320,100,900 |
||
728 | yrotate object 32,100 |
||
729 | texture object 32,3 |
||
730 | set object collision off 32 |
||
731 | make object plain 33,1000,1000 |
||
732 | position object 33,-1320,100,-900 |
||
733 | yrotate object 33,80 |
||
734 | texture object 33,3 |
||
735 | set object collision off 33 |
||
736 | |||
737 | rem Create Door Portal |
||
738 | make object plain 36,1050,900 |
||
739 | texture object 36,7 |
||
740 | position object 36,-1290,100,0 |
||
741 | set object 36,1,0,0 |
||
742 | yrotate object 36,90 |
||
743 | set object collision off 36 |
||
744 | |||
745 | rem Create Character |
||
746 | load object "obj\scorpidle.x",101 |
||
747 | append object "obj\scorpwalk.x",101,100 |
||
748 | yrotate object 101,180 |
||
749 | fix object pivot 101 |
||
750 | loop object 101,0,20 |
||
751 | hide limb 101,1 |
||
752 | set object collision off 101 |
||
753 | |||
754 | rem Collision Sphere for Character |
||
755 | make object sphere 102,300 |
||
756 | scale object 102,100,60,100 |
||
757 | hide object 102 |
||
758 | |||
759 | rem Collision Sphere for Camera |
||
760 | make object sphere 103,150 |
||
761 | hide object 103 |
||
762 | |||
763 | rem Create spinning face |
||
764 | make object plain 203,400,400 |
||
765 | position object 203,800,-280,0 |
||
766 | texture object 203,21 |
||
767 | ghost object on 203 |
||
768 | xrotate object 203,90 |
||
769 | set object collision off 203 |
||
770 | |||
771 | rem Create ripple textures |
||
772 | create bitmap 2,256,64 |
||
773 | paste image 16,0,0 |
||
774 | get image 17,0,0,64,64 |
||
775 | get image 18,64,0,64+64,64 |
||
776 | get image 19,128,0,128+64,64 |
||
777 | get image 20,192,0,192+64,64 |
||
778 | delete bitmap 2 |
||
779 | |||
780 | rem Create bitmap for effects (force) |
||
781 | create bitmap 2,256,256 |
||
782 | set current bitmap 0 |
||
783 | |||
784 | rem Create Sounds |
||
785 | load 3dsound "snd\rain.wav",1 |
||
786 | position sound 1,0,10,0 |
||
787 | set sound speed 1,3500 |
||
788 | loop sound 1 |
||
789 | load sound "snd\splash.wav",2 : set sound speed 2,7000 : set sound volume 2,85 |
||
790 | load 3dsound "snd\bang.wav",3 : set sound volume 3,95 |
||
791 | load 3dsound "snd\chain.wav",4 : set sound volume 4,90 |
||
792 | position sound 4,-1200,0,0 |
||
793 | |||
794 | rem Create Fog (show scene) |
||
795 | if fog available()=1 then fog on : fog color 0 : fog distance 3000 |
||
796 | set ambient light 30 |
||
797 | |||
798 | endfunction |
||
799 | |||
800 | function load_image(file$,imagenumber) |
||
801 | |||
802 | load bitmap file$,1 |
||
803 | width=bitmap width(1) |
||
804 | height=bitmap height(1) |
||
805 | get image imagenumber,0,0,width,height |
||
806 | delete bitmap 1 |
||
807 | |||
808 | endfunction |