And the rest:
rem Camera for START / WINNING / LOSE
if gamemode=2
if filmfunction=0
m_2=126
m_3=129
endif
if filmfunction=1
m_2=126
m_3=129
endif
if filmfunction=2
m_2=130
m_3=127
endif
if filmfunction=3
m_2=126
m_3=129
endif
arrowx=500 : m_2s=1 : m_3s=1 : m_4s=0
if menumoveflag=0
if ionaboobs=0
if upkey()=1 then dec menuchoice : wraper#=0 : wrapergrav#=1.5 : menumoveflag=1
if downkey()=1 then inc menuchoice : wraper#=0 : wrapergrav#=1.5 : menumoveflag=1
if joystick up()=1 then dec menuchoice : wraper#=0 : wrapergrav#=1.5 : menumoveflag=1
if joystick down()=1 then inc menuchoice : wraper#=0 : wrapergrav#=1.5 : menumoveflag=1
endif
endif
if menuchoice=2 then menuchoice=0
if menuchoice=-1 then menuchoice=1
if upkey()=0 : if joystick up()=0 : if joystick down()=0
if downkey()=0 then menumoveflag=0 : ionaboobs=0
endif : endif : endif
rem Retry or race or whatever
IF MENUCHOICE=0
ARROWY=400
rem RACE! at beginning
if filmfunction=0
if l3x=0
if returnkey()=1
dxSCROLLY=300
whiteout=150 : gamemode=0
endif : endif
endif
rem Time Out
if filmfunction=1
if l3x=0
if returnkey()=1
dxSCROLLY=300
whiteout=150 : gamemode=0 : goto restart
endif : endif
endif
rem You're winner!
if filmfunction=2
if l3x=0
if returnkey()=1
END
endif : endif
endif
rem You're loser!
if filmfunction=3
if l3x=0
if returnkey()=1
dxSCROLLY=300
whiteout=150 : gamemode=0 : goto restart
endif : endif
endif
endif
rem Quit in all instances except for replay
IF MENUCHOICE=1
ARROWY=420
if l3x=0
if returnkey()=1
if filmfunction=2
rem Call replay
whiteout=150
gosub coindisplay : cls : enemyAI=0 : gamemode=1
else
end
endif
endif
endif
endif
sprite 10,(arrowx)+L2X,arrowy+2,128 : show sprite 10
IF L3x=0
inc wraper#,wrapergrav# : dec wrapergrav#,0.08 : if wraper#=<0 then wraper#=0 : wrapergrav#=2
ENDIF
rem Bouncing text etc...
if arrowy=400
line2x=wraper#
else
line2x=0
endif
if arrowy=420
line3x=wraper#
else
line3x=0
endif
sprite 2,(520+line2x)+L2x,400,m_2 : set sprite 2,0,1 : show sprite 2
sprite 3,(520+line3x)+L3x,420,m_3 : stretch sprite 3,100,100 : show sprite 3
REM GLOBAL GLOBAL GLOBAL BLACK BOX
ink rgb(5,5,5),1
box 500+L1x,148,508+L1x,381-8
box 772+L1x,148,780+L1x,381-8
box 508+L1x,140,772+L1x,148
box 508+L1x,381-8,772+L1x,381
box 508+L1x,148,772+L1x,381-8
sprite 13,500+L1x,140,118 : show sprite 13
sprite 14,772+L1x,140,119 : show sprite 14
sprite 15,500+L1x,381-8,120 : show sprite 15
sprite 16,772+L1x,381-8,121 : show sprite 16
set camera aspect 2.22222222222222
SET CAMERA VIEW 0,120+dxSCROLLY,800,480-dxSCROLLY
rxa#=wrapvalue(rxa#+0.8)
rem Begin with
if filmfunction=0
reading$="Grand Prix Stage 1"
writerx=520+L1x : writery=160 : gosub drawword
reading$="Beat the other racers"
writerx=520+L1x : writery=200 : gosub drawword
reading$="and the clock to win!"
writerx=520+L1x : writery=220 : gosub drawword
cx#=newxvalue(OBJECT POSITION X(player_obj),rxa#,200)
cz#=newzvalue(OBJECT POSITION z(player_obj),rxa#,200)
cy2#=OBJECT POSITION y(player_obj)+92
position camera cx#, cy2#, cz#
point camera object position x(player_obj),object position y(player_obj)+10,object position z(player_obj)
set camera fov 33
endif
rem Out of time
if filmfunction=1
reading$="Out of time!"
writerx=520+L1x : writery=160 : gosub drawword
reading$="You've got to be quicker"
writerx=520+L1x : writery=200 : gosub drawword
reading$="than that to win!"
writerx=520+L1x : writery=220 : gosub drawword
cx#=newxvalue(OBJECT POSITION X(player_obj),rxa#,200)
cz#=newzvalue(OBJECT POSITION z(player_obj),rxa#,200)
cy2#=OBJECT POSITION y(player_obj)+92
position camera cx#, cy2#, cz#
point camera object position x(player_obj),object position y(player_obj)+10,object position z(player_obj)
set camera fov 33
endif
rem Winner
if filmfunction=2
reading$="You won!"
writerx=520+L1x : writery=160 : gosub drawword
reading$="Great work! That was"
writerx=520+L1x : writery=200 : gosub drawword
reading$="some great driving!"
writerx=520+L1x : writery=220 : gosub drawword
cx#=newxvalue(OBJECT POSITION X(player_obj),rxa#,200)
cz#=newzvalue(OBJECT POSITION z(player_obj),rxa#,200)
cy2#=OBJECT POSITION y(player_obj)+92
position camera cx#, cy2#, cz#
point camera object position x(player_obj),object position y(player_obj)+10,object position z(player_obj)
set camera fov 33
endif
rem Loser
if filmfunction=3
reading$="You lost!"
writerx=520+L1x : writery=160 : gosub drawword
reading$="You bet the clock but"
writerx=520+L1x : writery=200 : gosub drawword
reading$="not the other racers."
writerx=520+L1x : writery=220 : gosub drawword
reading$="Try again."
writerx=520+L1x : writery=240 : gosub drawword
cx#=newxvalue(OBJECT POSITION X(player_obj),rxa#,200)
cz#=newzvalue(OBJECT POSITION z(player_obj),rxa#,200)
cy2#=OBJECT POSITION y(player_obj)+92
position camera cx#, cy2#, cz#
point camera object position x(player_obj),object position y(player_obj)+10,object position z(player_obj)
set camera fov 33
endif
endif
rem Handle tires turning
scroll limb texture player_obj+2,2,-0.007*speed#,-0.007*speed#
scroll limb texture player_obj+2,3,-0.007*speed#,-0.007*speed#
scroll limb texture player_obj+2,11,-0.007*speed#,-0.007*speed#
scroll limb texture player_obj+2,13,-0.007*speed#,-0.007*speed#
rem Sun
gosub sun
rem Handle water splash
handle_explosion()
handle_explosion2()
gosub part_rotate
rem Sky and water etc...
yrotate object 97,object angle y(97)-0.1
position object 97,camera position x(),60,camera position z()
position object 98,camera position x(),2,camera position z()
position object 99,camera position x(),camera position y()-120,camera position z()
rem 2D, right at end
gosub 2dkarts
rem Whiteout
fade object 94,whiteout
if whiteout=>0 then dec whiteout,6
if whiteout=<10 then hide object 94
if whiteout=>10 then show object 94
if clsrota=3 then clsrota=0
if clsrota=2 then cls : clsrota=3
if clsrota=1 then cls : clsrota=2
if clsrota=0 then fastsync
loop
rem Tile Squeal Smoke / Grass out back
tiresmoke:
rem Grass from behind
grass1x#=newxvalue(OBJECT POSITION X(player_obj),wrapvalue(object angle y(player_obj)+130),-24)
grass1z#=newzvalue(OBJECT POSITION z(player_obj),wrapvalue(object angle y(player_obj)+130),-24)
grass2x#=newxvalue(OBJECT POSITION X(player_obj),wrapvalue(object angle y(player_obj)-130),-24)
grass2z#=newzvalue(OBJECT POSITION z(player_obj),wrapvalue(object angle y(player_obj)-130),-24)
if ongrass=1
if speed#=>2
bugfix#=rnd(150)
scale object 148,50+bugfix#,50+bugfix#,50+bugfix#
bugfix#=rnd(150)
scale object 149,50+bugfix#,50+bugfix#,50+bugfix#
fade object 148,200
fade object 149,200
position object 148,grass1x#,playery#,grass1z#
position object 149,grass2x#,playery#,grass2z#
show object 148
show object 149
else
hide object 148
hide object 149
endif
else
hide object 148
hide object 149
endif
for smoke=0 to 20
fade object smoke+100,(200-smokescale#(smoke))-smokefader#
smokescale#(smoke)=smokescale#(smoke)+6+rnd(1)
position object smoke+100,object position x(smoke+100),playery#+(0.6+rnd(0.7)),object position z(smoke+100)
if smokescale#(smoke)=>50+rnd(160)
if smoke=<10
gayx#=newxvalue(OBJECT POSITION X(player_obj),wrapvalue(object angle y(player_obj)+130),-24)
gayz#=newzvalue(OBJECT POSITION z(player_obj),wrapvalue(object angle y(player_obj)+130),-24)
else
gayx#=newxvalue(OBJECT POSITION X(player_obj),wrapvalue(object angle y(player_obj)-130),-24)
gayz#=newzvalue(OBJECT POSITION z(player_obj),wrapvalue(object angle y(player_obj)-130),-24)
endif
if smoking=1
smokescale#(smoke)=(40-(smokefader#/5))+rnd(20) : position object smoke+100,gayx#,playery#,gayz#
if ongrass=0
show object smoke+100
else
hide object smoke+100
endif
else
hide object smoke+100
endif
endif
rotate object smoke+100,camera angle x(),camera angle y(),camera angle z()
scale object smoke+100,smokescale#(smoke),smokescale#(smoke),smokescale#(smoke)
next smoke
ongrass=0
return
rem Sunflare
sun:
defadesun=0
if camera angle y()=>290 : if camera angle y()=<340
defadesun=1
if sfade=<98 then inc sfade,2
fade object 96,sfade
endif : endif
if defadesun=0
if sfade=>2 then dec sfade,2
fade object 96,sfade
endif
scale object 95,50+(sfade/2),50+(sfade/2),50+(sfade/2)
position object 95,camera position x()-350,camera position y()+40,camera position z()+350
rotate object 95,camera angle x(),camera angle y(),camera angle z()
return
rem Make scenery
rem -----------------------------------------------------------------
scenerymake:
load array "data/k1/sc11",scenerytype(0)
load array "data/k1/sc21",sceneryX(0)
load array "data/k1/sc31",sceneryY(0)
load array "data/k1/sc41",sceneryZ(0)
scenery=1700
for make=1700 to 1900
if object exist(make)=1 then delete object make
next make
rem SCENERY!
for makeXX=0 to 50
if scenerytype(makeXX)=>1
rem Tree
if scenerytype(makeXX)=1
LOAD OBJECT "3D/TREE.X",scenery : SCALE OBJECT scenery,5000,5000,5000
readscenenum(makeXX)=scenery
POSITION OBJECT scenery,sceneryX(makeXX),sceneryY(makeXX)+40,sceneryZ(makeXX)
endif
rem Grass
if scenerytype(makeXX)=2
LOAD OBJECT "3D/grass.X",scenery : SCALE OBJECT scenery,700,700,700 : yrotate object scenery,rnd(360)
readscenenum(makeXX)=scenery
POSITION OBJECT scenery,sceneryX(makeXX)+10,sceneryY(makeXX),sceneryZ(makeXX)
endif
rem Rock
if scenerytype(makeXX)=3
LOAD OBJECT "3D/rock.X",scenery : SCALE OBJECT scenery,1500,1500,1500
readscenenum(makeXX)=scenery
POSITION OBJECT scenery,sceneryX(makeXX),sceneryY(makeXX)-10,sceneryZ(makeXX)
endif
rem Bee
if scenerytype(makeXX)=4
LOAD OBJECT "3D/BEE.X",scenery : SCALE OBJECT scenery,75000,75000,75000
readscenenum(makeXX)=scenery
POSITION OBJECT scenery,sceneryX(makeXX),sceneryY(makeXX)+50,sceneryZ(makeXX)
endif
rem Waterfall
if scenerytype(makeXX)=5
make object plain scenery,270,150
POSITION OBJECT scenery,sceneryX(makeXX)-10,70,(sceneryZ(makeXX)-67)
texture object scenery,109 : ghost object on scenery
xrotate object scenery,45
scroll object texture scenery,0.0,0.03
readscenenum(makeXX)=scenery
set object scenery,1,0,0,1,1,0,1
inc scenery
LOAD OBJECT "3D/WATERFALL.X",scenery : SCALE OBJECT scenery,8000,9000,13000
YROTATE OBJECT SCENERY,180 : GHOST OBJECT ON SCENERY
POSITION OBJECT scenery,sceneryX(makeXX),sceneryY(makeXX)+51,sceneryZ(makeXX)
set object scenery,1,0,0,1,1,0,1
set object specular scenery,0
set object transparency scenery,1
inc scenery
make object plain scenery,500,500
YROTATE OBJECT SCENERY,270 : GHOST OBJECT ON SCENERY
POSITION OBJECT scenery,sceneryX(makeXX),sceneryY(makeXX)+300,sceneryZ(makeXX)-100
texture object scenery,110 : disable object zread scenery
fade object scenery,38
ENDIF
rem Tulips patch
if scenerytype(makeXX)=6
LOAD OBJECT "3D/tulip.X",scenery : SCALE OBJECT scenery,10000,7500,10000
set object scenery,1,0,0,1,1,0,1
readscenenum(makeXX)=scenery
POSITION OBJECT scenery,(sceneryX(makeXX)-25)+rnd(50),sceneryY(makeXX)+(5+rnd(5)),(sceneryZ(makeXX)-25)+rnd(50)
set object scenery,1,0,0,1,1,0,1
inc scenery
LOAD OBJECT "3D/tulip.X",scenery : SCALE OBJECT scenery,10000,7000,10000
POSITION OBJECT scenery,(sceneryX(makeXX)-25)+rnd(50),sceneryY(makeXX)+(5+rnd(5)),(sceneryZ(makeXX)-25)+rnd(50)
set object scenery,1,0,0,1,1,0,1
inc scenery
LOAD OBJECT "3D/tulip.X",scenery : SCALE OBJECT scenery,10000,8000,10000
POSITION OBJECT scenery,(sceneryX(makeXX)-25)+rnd(50),sceneryY(makeXX)+(5+rnd(5)),(sceneryZ(makeXX)-25)+rnd(50)
set object scenery,1,0,0,1,1,0,1
inc scenery
LOAD OBJECT "3D/tulip.X",scenery : SCALE OBJECT scenery,10000,7000,10000
POSITION OBJECT scenery,(sceneryX(makeXX)-25)+rnd(50),sceneryY(makeXX)+(5+rnd(5)),(sceneryZ(makeXX)-25)+rnd(50)
set object scenery,1,0,0,1,1,0,1
inc scenery
LOAD OBJECT "3D/tulip.X",scenery : SCALE OBJECT scenery,10000,8000,10000
POSITION OBJECT scenery,(sceneryX(makeXX)-25)+rnd(50),sceneryY(makeXX)+(5+rnd(5)),(sceneryZ(makeXX)-25)+rnd(50)
set object scenery,1,0,0,1,1,0,1
endif
rem Schmumps
if scenerytype(makeXX)=8
readscenestate(makeXX)=0
readscenenum(makeXX)=scenery
make object plain scenery,30,30 : texture object scenery,111
xrotate object scenery,90 : fix object pivot scenery
SET OBJECT FILTER scenery,0 : set object fog scenery,0
SET OBJECT TRANSPARENCY scenery,1 : ghost object on scenery,1
position object scenery,sceneryX(makeXX),sceneryY(makeXX)+0.3,sceneryZ(makeXX)
inc scenery
load object "3d/slave.x",scenery : scale object scenery,550,550,550
set object scenery,1,1,0,1,1,0,1
append object "3d/slavethank.x",scenery,12 : set object speed scenery,5
position object scenery,sceneryX(makeXX),sceneryY(makeXX),sceneryZ(makeXX)
if rnd(1)=1 then loop object scenery,12,20
endif
if scenerytype(makeXX)=7 then goto bugfix82
if scenerytype(makeXX)=8 then goto bugfix82
if scenerytype(makeXX)=10 then goto bugfix82
if scenerytype(makeXX)=11 then goto bugfix82
if scenerytype(makeXX)=12 then goto bugfix82
if scenerytype(makeXX)=13 then goto bugfix82
if scenerytype(makeXX)=14 then goto bugfix82
if scenerytype(makeXX)=15 then goto bugfix82
if scenerytype(makeXX)=16 then goto bugfix82
if scenerytype(makeXX)=17 then goto bugfix82
if scenerytype(makeXX)=19 then goto bugfix82
if scenerytype(makeXX)=20 then goto bugfix82
if scenerytype(makeXX)=21 then goto bugfix82
if scenerytype(makeXX)=22 then goto bugfix82
if scenerytype(makeXX)=23 then goto bugfix82
if scenerytype(makeXX)=24 then goto bugfix82
if scenerytype(makeXX)=25 then goto bugfix82
if scenerytype(makeXX)=26 then goto bugfix82
if object exist(scenery)=1
set object scenery,1,0,0,1,1,0,1
set object specular scenery,0
set object transparency scenery,1
endif
bugfix82:
inc scenery
endif
next makeXX
rem Platforms
load array "data/k1/platformmode",platformtype(1)
load array "data/k1/platformxpos",platformx(1)
load array "data/k1/platformypos",platformy(1)
load array "data/k1/platformzpos",platformz(1)
make=1000
for object =1000 to 1100
if object exist(object)=1 then delete object object
next object
for array=0 to 100
rem Regular Type
if platformtype(array)=1
LOAD OBJECT "3D/platform1.X",make
scale object make,950,1000,950
position object make,platformx(array),platformy(array),platformz(array)
set object make,1,1,0,1,1,0,1
inc make
endif
rem Blue Type
if platformtype(array)=2
LOAD OBJECT "3D/platform2.X",make
scale object make,950,500,950
position object make,platformx(array),platformy(array),platformz(array)
ghost object on make
set object make,1,1,0,1,1,0,1
inc make
endif
rem Button type blue
if platformtype(array)=3
LOAD OBJECT "3D/greenp.X",make
scale object make,3100,3180,3100
yrotate object make,45 : fix object pivot make
position object make,platformx(array),platformy(array)-50,platformz(array)
set object make,1,1,0,1,1,0,1
hide limb make,0
inc make
endif
next array
rem Coins
load array "data/k1/g1",gemtype(0)
load array "data/k1/g2",gemX(0)
load array "data/k1/g3",gemY(0)
load array "data/k1/g4",gemZ(0)
dim gemnum(50)
coinlimit=0
gosub COINDISPLAY
rem Sparkle
make object plain 199,250,250
texture object 199,114 : ghost object on 199
set object 199,1,0,0,1,0,0
disable object zread 199
rem Schmumps walking around
rem ----------------------------------------------
dim slavetype(5)
dim slavex(5)
dim slavey(5)
dim slavez(5)
dim slavepoints(5)
dim slavepointsX(8,5)
dim slavepointsZ(8,5)
dim slavepointsTYPE(8,5)
dim readslavestate(5)
dim readslavenumber(5)
dim readslavetag5#(5)
dim readslavetag7(5)
dim readslavetag6(5)
dim readslavetag4#(5)
dim readslavetag3(5)
dim readslaveCHECKfocus(5)
dim readslavechoice(5)
dim readslavespeed#(5)
load array "data/k1/slavetype",slavetype(0)
load array "data/k1/slavex",slavex(0)
load array "data/k1/slavey",slavey(0)
load array "data/k1/slavez",slavez(0)
load array "data/k1/slaveCHECKpoints",slavepoints(0)
load array "data/k1/slaveCHECKtype",slavepointsTYPE(0)
load array "data/k1/slaveCHECKx",slavepointsX(0)
load array "data/k1/slaveCHECKz",slavepointsZ(0)
gosub slavesdisplay
return
rem Particles rotation
part_rotate:
for t=1 to emax(1)
rotate object 121+t,camera angle x(),camera angle y(),camera angle z()
next t
for t=132 to 146
rotate object t,camera angle x(),camera angle y(),camera angle z()
next t
for t=0 to 50
if gemtype(t)=1
yrotate object gemnum(t),coinrr#
yrotate object gemnum(t)+1,coinrr#
endif
next t
for t=1 to max(1)
rotate object 200+t,camera angle x(),camera angle y(),camera angle z()
next t
rotate object 148,camera angle x(),camera angle y(),camera angle z()
rotate object 149,camera angle x(),camera angle y(),camera angle z()
rotate object 199,camera angle x(),camera angle y(),camera angle z()
return
rem Scenery Maintain
SCENERY:
for scene=0 to 50
rem Schmumps maintain
if scenerytype(scene)=8
if readscenestate(scene)=0
point object readscenenum(scene)+1,object position x(player_obj),object position y(readscenenum(scene)+1),object position z(player_obj)
endif
endif
rem Scroll waterfall texture
if scenerytype(scene)=5
scroll object texture readscenenum(scene)+1,0.0,-0.01
endif
next scene
rem Coin update
coinrr#=wrapvalue(coinrr#+(2))
for coin=0 to 40
if gemnum(coin)=>1
if object exist(gemnum(coin))=1
if object position x(player_obj)=>object position x(gemnum(coin))-25
if object position x(player_obj)=<object position x(gemnum(coin))+25
if object position z(player_obj)=>object position z(gemnum(coin))-25
if object position z(player_obj)=<object position z(gemnum(coin))+25
bx#=object position x(gemnum(coin))
by#=object position y(gemnum(coin))
bz#=object position z(gemnum(coin))
play sound 5
position object gemnum(coin),-99999,0,0
position object gemnum(coin)+1,-99999,0,0
request_explosion(bx#,by#,bz#,max(1),inten#,13)
endif
endif
endif
endif
endif
endif
next coin
rem Schmumps walking around
rem ---------------------------------------------------------------------------------
for readx=0 to 5
slave=readslavenumber(readx)
rem slave exists?
IF slavetype(readx)=>1
if readslavespeed#(readx)=<2 then readslavespeed#(readx)=2
if readslavespeed#(readx)=>2 then readslavespeed#(readx)=readslavespeed#(readx)-0.01
bugfix275=object angle y(readslavenumber(readx))
readslavetag7(readx)=0
rem ---------------------------------------------- POINT AT NEXT CHECKPOINT ----
if readslavestate(readx)=0
` Increase Checkpoint
bugfix=readslaveCHECKfocus(readx) : inc bugfix : readslaveCHECKfocus(readx)=bugfix
` Return to Checkpoint 1
if readslaveCHECKfocus(readx)=>slavepoints(readx)+1 then readslaveCHECKfocus(readx)=1
` Point and Setup
point object slave,slavepointsX(readslaveCHECKfocus(readx),readx),object position y(slave),slavepointsZ(readslaveCHECKfocus(readx),readx)
readslavestate(readx)=1
endif
rem ---------------------------------------------- MOVE BETWEEN CHECKPOINTS ----
if readslavestate(readx)=1
` Move slave and animate
move object slave,readslavespeed#(readx)
readslavetag7(readx)=1
point object slave,slavepointsX(readslaveCHECKfocus(readx),readx),object position y(slave),slavepointsZ(readslaveCHECKfocus(readx),readx)
` Hit it? What to do?
if object position x(slave)=>slavepointsX(readslaveCHECKfocus(readx),readx)-10
if object position x(slave)=<slavepointsX(readslaveCHECKfocus(readx),readx)+10
if object position z(slave)=>slavepointsZ(readslaveCHECKfocus(readx),readx)-10
if object position z(slave)=<slavepointsZ(readslaveCHECKfocus(readx),readx)+10
` Point at next
if slavepointsTYPE(readslaveCHECKfocus(readx),readx)=1 then readslavestate(readx)=0
` Rest
if slavepointsTYPE(readslaveCHECKfocus(readx),readx)=2 then readslavestate(readx)=2 : readslavetag6(readx)=0
endif : endif : endif : endif
endif
rem ---------------------------------------------- WAIT AT WAIT POINT ----
if readslavestate(readx)=2
rem Maintain
readslavetag7(readx)=0
` Increase waitout
bugfix=readslavetag6(readx)
inc bugfix
readslavetag6(readx)=bugfix
if readslavespeed#(readx)=>2.5 then readslavestate(readx)=0
if readslavetag6(readx)=>190 then readslavestate(readx)=0
endif
rem ANIMATION COMMANDS
IF readslavetag7(readx)=0 then stop object slave : set object frame slave,0
if readslavetag7(readx)=1 then set object speed slave,20*readslavespeed#(readx) : loop object slave,0.1,8
studexa#=wrapvalue(curveangle(object angle y(slave),bugfix275,3))
yrotate object slave,studexa#
position object slave+1,object position x(slave),object position y(slave+1),object position z(slave)
endif
next readx
rem Sparkle calculation
if sparkle=0
inc sparklepos,2
if object exist(sparklepos)=0 then sparklepos=150
position object 199,object position x(sparklepos),object position y(sparklepos),object position z(sparklepos)
sparkle=1 : sparkletime=0
endif
if sparkle=1
scale object 199,100-sparkletime,100-sparkletime,100-sparkletime
inc sparkletime,10
if sparkletime=>100 then sparkle=0
endif
return
function request_explosion(ex#,ey#,ez#,particles,intensity#,life)
t=0:p=0
repeat
t=t+1
if partlife(t)=0
p=p+1 : partlife(t)=life + rnd(life/5)
partx#(t)=ex# : party#(t)=ey# : partz#(t)=ez#
partyvel#(t)=rnd(intensity#)-(intensity#/2) : partxvel#(t)=rnd(intensity#)-(intensity#/2)
partzvel#(t)=rnd(intensity#)-(intensity#/2)
show object (200+t)
endif
if p>=particles then exit
until t>=max(1)
endfunction
function handle_explosion()
for t=1 to max(1)
if partlife(t)>1
partlife(t) = partlife(t) - 1 : position object 200+t,partx#(t),party#(t),partz#(t)
scale object 200+t,partlife(t)*10,partlife(t)*10,partlife(t)*10
partxvel#(t)=partxvel#(t)*0.95 : partyvel#(t)=partyvel#(t)*0.95
partzvel#(t)=partzvel#(t)*0.95 : partyvel#(t)=partyvel#(t)+0.5
partx#(t) = partx#(t) + (partxvel#(t)) : party#(t) = party#(t)+((partyvel#(t)/2))
partz#(t) = partz#(t) + (partzvel#(t))
if party#(t)<=0 then partyvel#(t)=partyvel#(t)-1
endif
if partlife(t)=1
partlife(t)=0 : hide object 200+t
endif
next t
endfunction
function request_explosion2(ex2#,ey2#,ez2#,particles2,intensity2#,life2)
t2=0:p2=0
repeat : t2=t2+1
if epartlife(t2)=0
p2=p2+1
epartlife(t2)=life2 + rnd(life2/5) : epartx#(t2)=ex2# : eparty#(t2)=ey2#
epartz#(t2)=ez2# : epartyvel#(t2)=rnd(intensity2#*2)-(intensity2#/2)
epartxvel#(t2)=rnd(intensity2#)-(intensity2#/2) : epartzvel#(t2)=rnd(intensity2#)-(intensity2#/2)
show object (121+t2)
endif
if p2>=particles2 then exit
until t2>=emax(1)
endfunction
function handle_explosion2()
for t2=1 to emax(1)
if epartlife(t2)>1
epartlife(t2) = epartlife(t2) - 1
position object 121+t2,epartx#(t2),eparty#(t2),epartz#(t2)
fade object 121+t2,epartlife(t2)*2
scale object 121+t2,epartlife(t2)*2,epartlife(t2)*2,epartlife(t2)*2
epartxvel#(t2)=epartxvel#(t2)*0.95 : epartyvel#(t2)=epartyvel#(t2)*0.95
epartzvel#(t2)=epartzvel#(t2)*0.95 : epartyvel#(t2)=epartyvel#(t2)-0.1
epartx#(t2) = epartx#(t2) + (epartxvel#(t2)) : eparty#(t2) = eparty#(t2) + (epartyvel#(t2))
epartz#(t2) = epartz#(t2) + (epartzvel#(t2)) : endif
if epartlife(t2)=1
epartlife(t2)=0
hide object 121+t2 : endif
next t2
endfunction
drawword:
for character=1 to len(reading$)
individual$=mid$(reading$,character)
asciinum=asc(individual$)
if asciinum=32 then inc writerx,4 : goto spacechar
superscript=0
if asciinum=48 then superscript=4
if asciinum=49 then superscript=4
if asciinum=50 then superscript=4
if asciinum=51 then superscript=4
if asciinum=52 then superscript=4
if asciinum=53 then superscript=4
if asciinum=54 then superscript=4
if asciinum=55 then superscript=4
if asciinum=56 then superscript=4
if asciinum=57 then superscript=4
sprite spritenumber,writerx,writery-superscript,asciinum+fontimagebump : show sprite spritenumber
inc writerx,fontwidth(asciinum)
inc spritenumber
spacechar:
next character
return
COINDISPLAY:
load array "data/k1/g1",gemtype(0)
load array "data/k1/g2",gemX(0)
load array "data/k1/g3",gemY(0)
load array "data/k1/g4",gemZ(0)
for make=150 to 198
if object exist(make)=1 then delete object make
next make
make=150
for readx=0 to 40
if gemtype(readx)=1
inc coinlimit
load object "3d/coin.x",make
scale object make,275,275,275
set object make,1,0,0,1,1,0,1
xrotate object make,270 : fix object pivot make
yrotate object make,rnd(70)
position object make,gemx(readx),gemy(readx)+20,gemz(readx)
gemnum(readx)=make
inc make
make object plain make,24,5
xrotate object make,90 : fix object pivot make
texture object make,113
ghost object on make,1
SET OBJECT TRANSPARENCY make,1
SET OBJECT FILTER make,0
position object make,gemx(readx),gemy(readx)+0.3,gemz(readx)
inc make
endif
next readx
RETURN
2dkarts:
rem 2D STUFF
rem -------------------------------------------------------------------------
rem Action replay display for replays
if gamemode=1
inc tickereplay
if tickereplay=<20
reading$="Action replay!"
writerx=656 : writery=140 : gosub drawword
endif
if tickereplay=40 then tickereplay=0
endif
rem Position and position
IF GAMEMODE=0
IF PLAYERPOSITION#=1 THEN reading$="Position - 1st"
IF PLAYERPOSITION#=2 THEN reading$="Position - 2nd"
IF PLAYERPOSITION#=3 THEN reading$="Position - 3rd"
IF PLAYERPOSITION#=4 THEN reading$="Position - 4th"
writerx=20-dxSCROLLY*2 : writery=20 : gosub drawword
rem Display Laps
showlap#=lap#
if showlap#=<0 then showlap#=0
reading$="Lap - "+str$(showlap#)+" of 2"
writerx=20-dxSCROLLY*2 : writery=50 : gosub drawword
rem F1 Key
if keystate(59)=1
ink rgb(5,5,5),0
box 28,415-6+60,252,572
box 20,415-6+60,28,572
box 252,415-6+60,260,572
box 28,407-6+60,252,415+60
box 28,572-6,252,580
sprite 13,20,407-6+60,118 : show sprite 13
sprite 14,252,407-6+60,119 : show sprite 14
sprite 15,20,572,120 : show sprite 15
sprite 16,252,572,121 : show sprite 16
reading$="UPKEY - accelerate"
writerx=40 : writery=480 : gosub drawword
reading$="DOWNKEY - brake"
writerx=40 : writery=500 : gosub drawword
reading$="LEFT - steer left"
writerx=40 : writery=520 : gosub drawword
reading$="RIGHT - steer right"
writerx=40 : writery=540 : gosub drawword
endif
rem Speedometer
sprite 9,774+dxSCROLLY*2,574,122
rotate sprite 9,180+(speed#*10)
rem Something to say...
if displaytext=<150
IF STARTIMER=0
inc displaytext
ink rgb(5,5,5),1
box 268,401+60,532,398+121
box 260,348+121,268,390+121
box 532,348+121,540,390+121
sprite 17,260,340+121,118 : show sprite 17
sprite 18,532,340+121,119 : show sprite 18
sprite 19,260,390+121,120 : show sprite 19
sprite 20,532,390+121,121 : show sprite 20
reading$=displaytext$
writerx=280 : writery=360+121 : gosub drawword
endif
ENDIF
rem SPEED
displayspeed=speed#*10
reading$=""+str$(displayspeed/10)+"mph"
writerx=590+dxSCROLLY*2 : writery=522 : gosub drawword
rem Timer at top
ink rgb(5,5,5),1
box 268+80,23-DXSCROLLY*2,532-80,65-DXSCROLLY*2
box 260+80,31-DXSCROLLY*2,268+80,57-DXSCROLLY*2
box 532-80,31-DXSCROLLY*2,540-80,57-DXSCROLLY*2
reading$="0"+str$(timemin#)+""
writerx=357 : writery=34-DXSCROLLY*2 : gosub drawword
reading$=":"
writerx=398 : writery=34-DXSCROLLY*2 : gosub drawword
if timesec#=>10
reading$=""+str$(timesec#)+""
else
reading$="0"+str$(timesec#)+""
endif
writerx=409 : writery=34-DXSCROLLY*2 : gosub drawword
sprite 21,260+80,23-DXSCROLLY*2,118 : show sprite 21
sprite 22,532-80,23-DXSCROLLY*2,119 : show sprite 22
sprite 23,260+80,57-DXSCROLLY*2,120 : show sprite 23
sprite 24,532-80,57-DXSCROLLY*2,121 : show sprite 24
IF STARTIMER=0
inc timemilli#
endif
if timemilli#=>60 then dec timesec# : timemilli#=0
if timesec#=-1 then timesec#=59 : dec timemin#
if timesec#=>60 then dec timesec#,60 : inc timemin#,1
ENDIF
if gamemode=>1
ink rgb(0,0,0),1
box 0,0,800,120+DXSCROLLY
box 0,480-DXSCROLLY,800,600
endif
if gamemode=0
IF STARTIMER=>1
ink rgb(5,5,5),1
box 268+60,401+60+DXSCROLLY*2,532-60,398+121+DXSCROLLY*2
box 260+60,348+121+DXSCROLLY*2,268+60,390+121+DXSCROLLY*2
box 532-60,348+121+DXSCROLLY*2,540-60,390+121+DXSCROLLY*2
sprite 17,260+60,340+121+DXSCROLLY*2,118 : show sprite 17
sprite 18,532-60,340+121+DXSCROLLY*2,119 : show sprite 18
sprite 19,260+60,390+121+DXSCROLLY*2,120 : show sprite 19
sprite 20,532-60,390+121+DXSCROLLY*2,121 : show sprite 20
rem GO!!!
IF STARTIMER=<50
SPRITE 31,344,350+123+DXSCROLLY*2,125 : SHOW SPRITE 31
SPRITE 32,384,350+123+DXSCROLLY*2,125 : SHOW SPRITE 32
sPRITE 33,424,350+123+DXSCROLLY*2,125 : SHOW SPRITE 33
ENDIF
rem TWO LIGHTS
IF STARTIMER=>50
IF STARTIMER=<100
SPRITE 31,344,350+123+DXSCROLLY*2,124 : SHOW SPRITE 31
SPRITE 32,384,350+123+DXSCROLLY*2,124 : SHOW SPRITE 32
ENDIF
ENDIF
rem ONE LIGHT
IF STARTIMER=<150
IF STARTIMER=>100
SPRITE 31,344,350+123+DXSCROLLY*2,124 : SHOW SPRITE 31
ENDIF
ENDIF
ENDIF
endif
return
slavesdisplay:
for object=1601 to 1640
if object exist(object)=1 then delete object object
next object
create=1601 : readxwrite=0
for readxX=0 to 5
if slavetype(readxX)=1
load object "3d/slave.x",create : scale object create,550,550,550 : set object create,1,1,0,1,1,0,1
append object "3d/slavethank.x",create,12 : set object speed create,5
position object create,slavex(readxX),slavey(readxX)-1,slavez(readxX)
readslavestate(readxX)=0
readslavenumber(readxX)=create
inc create
make object plain create,30,30 : texture object create,111
xrotate object create,90 : fix object pivot create
SET OBJECT FILTER create,0 : set object fog create,0
SET OBJECT TRANSPARENCY create,1 : ghost object on create,1
position object create,slavex(readxX),slavey(readxX)+0.3,slavez(readxX)
inc create
endif
if slavetype(readxX)=2
load object "3d/dumbow.x",create : scale object create,550,550,550 : set object create,1,1,0,1,1,0,1
set object speed create,5
position object create,slavex(readxX),slavey(readxX)-1,slavez(readxX)
readslavestate(readxX)=0
readslavenumber(readxX)=create
inc create
make object plain create,30,30 : texture object create,111
xrotate object create,90 : fix object pivot create
SET OBJECT FILTER create,0 : set object fog create,0
SET OBJECT TRANSPARENCY create,1 : ghost object on create,1
position object create,slavex(readxX),slavey(readxX)+0.3,slavez(readxX)
inc create
endif
next readxX
return
You can maybe have a browse through that and see how it all goes together. You should see the main D&C code - it's a mission. P.S: my coding sucks. But hey, I seem to get things done so it doesn't really matter...