snake_x86
15-09-2006, 10:14 AM
لن اقول شيء ..... فقط سأرفق سورس اللعبة و قرر بنفسك
hide mouse
sync on
sync rate 60
autocam off
remstart
if fontexist()= 0
load image "images\fonterror.jpg",1,1
do
paste image 1,0,0,1
if scancode() > 0 then end
sync
loop
else
set text font "ALW Cool Andalus."
endif
remend
load image "images\warning.jpg",1,1
do
paste image 1,0,0,1
if scancode() > 0 then goto sak
sync
loop
sak:
delete image 1
backdrop on
color backdrop RGB(0,0,0)
remstart
load image "images\screen.jpg",1
for i = 0 to 255 step 1
sprite 1,0,0,1
size sprite 1,screen width(),screen height()
set sprite alpha 1,i
sync
wait 10
next i
wait 5000
for i = 255 to 0 step -1
sprite 1,0,0,1
size sprite 1,screen width(),screen height()
set sprite alpha 1,i
sync
next i
delete image 1
remend
remstart
load animation "videos\logo5.mpg",1
for i = 0 to 100
sync
next
play animation 1,0,0,800,600
do
if animation playing(1) = 0 then goto contttt
sync
loop
contttt:
delete animation 1
remend
playmovie1()
`global fpsm as integer
global lights as integer
global medpacks as integer
medpacks = 1
global tmp01 as integer
global tmp02 as integer
global tmp03 as integer
global tmp04 as integer
global tmp05 as integer
global itsok as integer
itsok = 0
Global OldTime As Integer
OldTime = Timer()
global currentmap as string
global gunstat as integer
global gunhole as integer
global guncam as integer
global guntar as integer
global gunhand as integer
global pyrm as integer
global totalactivelimbs as integer
global totalhotspots as integer
global dim texts(50) as string
global monsters as integer
global health as float
health = 100.0
loadtexts()
`set text font "ALW Cool Andalus."
set text size 20
load image "images\hm.png",1,1
load image "images\healthbar.jpg",2,1
load image "images\signal.bmp",4,1
load image "images\or.bmp",5,1
load image "images\loading.jpg",6,1
`here
load image "images\riddle.jpg",8,1
type hotspots
objnum as integer
id as string
enabled as boolean
endtype
type activelimb
limbnum as integer
id as string
endtype
type monstert
objnum as integer
id as string
active as integer
mode as integer
gg as float
hp as integer
tmp as integer
tmp2 as integer
tmp3 as integer
xx as integer
yy as integer
zz as integer
endtype
global dim hotspot(100) as hotspots
global dim activelimb(100) as activelimb
global dim monster(20) as monstert
global level as integer
global hero as integer
global scroller# = 0
global attacking = 0
global aangle# = 0
global ddist# = 0
global hheight# = 0
global speed#= 0.8
global gravity#=0.02
global animspeed = 60
jump#=0.7
camdist#=30
global loadedobjects as integer
loadedobjects = 0
global last11 as integer`for the included file
global last1 as integer`for the included file
global mousetemp as integer
rem setup the world
`set global collision off
hide mouse
level=1
hero=2
load sound "sounds\gunfire.wav",1
load sound "sounds\rep\hit.wav",2
load sound "sounds\rep\gothit.wav",3
load sound "sounds\step.wav",4
load sound "sounds\rep\step.wav",5
load sound "sounds\rep\rstrike.wav",6
load sound "sounds\rep\rdie.wav",7
load sound "sounds\gothit.wav",8
load sound "sounds\die.wav",9
load sound "sounds\switch.wav",10
load sound "sounds\opendoor.wav",11
load sound "sounds\closedoor.wav",12
load sound "sounds\fall.wav",13
load sound "sounds\jump.wav",14
load sound "sounds\opendoor2.wav",15
load sound "sounds\hdooropen.wav",16
load sound "sounds\hdoorclose.wav",17
load sound "sounds\doorlocked.wav",18
load sound "sounds\mechanics.wav",19
load sound "sounds\waterdrink.wav",20
load sound "sounds\gunmetal.wav",21
load sound "sounds\auto.wav",22
load sound "sounds\fall2.wav",23
load sound "sounds\trap2.wav",24
load music "sounds\bgm.mp3",1
set music volume 1,70
loop music 1
`load music "sounds\explore.mp3",2
load music "sounds\matk.mp3",2
teleport("levels\ruins")
make fire particles 1,5,100,limb position x(hero,gunhole),limb position y(hero,gunhole),limb position z(hero,gunhole),1,1,1
ghost particles on 1,5
hide particles 1
do `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If SecondTimer(8) = 1 and itsok = 0 then itsok = 1
if health <1
play sound 9
set object speed hero,20
play object hero,42,80
do
if object playing(hero) = 0
teleport(currentmap)
health = 100
goto continue
endif
point camera object position x(hero),object position y(hero),object position z(hero)
sync
loop
endif
continue:
checkhotspots()
control_monsters()
position particles 1,limb position x(hero,gunhole),limb position y(hero,gunhole),limb position z(hero,gunhole)
if controlkey() = 1
fpsm = 1
else
fpsm = 0
fpscam = 0
endif
rem rotate the box
`hheight#=wrapvalue(hheight#+mousemovey()/6)
ry#=wrapvalue(ry#+mousemovex()/2)
rotate object hero,rx#,ry#,0
rem move the box horizontally
if (itsok = 1)
if fpsm = 0
hide particles 1
if keystate(17)=1
position object hero,newxvalue(x#,ry#,speed#),y#,newzvalue(z#,ry#,speed#)
if (sound playing(4) = 0) then play sound 4
set object speed hero,animspeed
loop object hero,10,29
else
if (scancode() = 0)
set object speed hero,5
loop object hero,0,10
endif
endif
endif
if fpsm = 0
if keystate(31)=1
position object hero,newxvalue(x#,ry#+180,speed#/2),y#,newzvalue(z#,ry#+180,speed#/1.5)
if (sound playing(4) = 0) then play sound 4
set object speed hero,animspeed
loop object hero,10,29
endif
endif
if fpsm = 0
if keystate(32)=1
position object hero,newxvalue(x#,ry#+90,speed#/2),y#,newzvalue(z#,ry#+90,speed#/2)
if (sound playing(4) = 0) then play sound 4
set object speed hero,animspeed
loop object hero,10,29
endif
endif
if fpsm = 0
if keystate(30)=1
position object hero,newxvalue(x#,ry#-90,speed#/2),y#,newzvalue(z#,ry#-90,speed#/2)
if (sound playing(4) = 0) then play sound 4
set object speed hero,animspeed
loop object hero,10,29
endif
endif
endif
if fpsm = 1
set object speed hero,20
if (object frame(hero) <30) then play object hero,30,35
if object frame(hero) >34.9 then fpscam = 1
endif
if fpscam = 1
if object playing(hero) = 0 then hide particles 1
rrr#=wrapvalue(rrr#+mousemovey()/2)
if rrr# < 150 and rrr# > 60 then rrr# = 60
if rrr# > 150 and rrr# < 300 then rrr# = 300
`if rrr# >80 rrr# = 80
`rotate object hero,object angle x(hero),object angle y(hero),rrr#
rotate object hero, rrr#,object angle y(hero),0
gunstat = 0
if mpress(1) = 1
if object playing(hero) = 0
set object speed hero,50
play sound 1
play object hero,35,39
show particles 1
gunstat = 1
endif
endif
endif
updatehorizontalcollision(hero)
x#=object position x(hero)
y#=object position y(hero)
z#=object position z(hero)
rem move the box vertically
inc g#,gravity#
if getverticalstate(hero)=1 then g#=gravity#
if getverticalstate(hero)=-1 then g#=0
if kpress(57)=1 and getverticalstate(hero) = 1
play sound 14
g#=0-jump#
ck# = ck# + jump#
endif
position object hero,x#,y#-g#,z#
updateverticalcollision(hero)
x#=object position x(hero)
y#=object position y(hero)
z#=object position z(hero)
`control first person mode.......
rem rotate the camera
if upkey()=1 then inc ddist#,1
if downkey()=1 then dec ddist#,1
if rightkey()=1
inc aangle#,0.3
endif
if leftkey()=1
dec aangle#,0.3
endif
`position camera camdist#*cos(cx#)*sin(cy#)+x#,camdist#*sin(cx#)+y#+20,camdist#*cos(cx#)*cos(cy#)+z#
`point camera x#,y#+10,z#
if (fpscam = 0)
if camera angle x() <> 0 or camera angle z() <> 0 then rotate camera 0,object angle y(hero),0
set camera to follow x#,y#+3,z#,object angle y(hero)+ aangle#,20+ddist#,10+hheight#,50,1
else
paste image 4,(screen width()/2) - 22,(screen height()/2) - 21,1
position camera limb position x(hero,guncam),limb position y(hero,guncam),limb position z(hero,guncam)
point camera limb position x(hero,guntar),limb position y(hero,guntar),limb position z(hero,guntar)
endif
rem print outputs
set cursor 0,2
`print " gravity: "+str$(g#)
`print " vertical collision state: "+str$(getverticalstate(hero))
`print " vertical collision slope: "+str$(getverticalslope(hero))
`print " vertical collision object: "+str$(getverticalobject(hero))
`===========WATER Controller============
if (waterison = 1)
inc scroller#,0.000004
if scroller# > 3 then scroller# = 0
scroll limb texture level,waterlimb,0,-scroller#
endif
healthmen(10,10)
sync
loop
function clearhotspots()
for i = 0 to 100
hotspot(i).objnum = 0
hotspot(i).id = ""
hotspot(i).enabled = 0
next i
endfunction
function clearactivelimbs()
for i = 0 to 100
activelimb(i).limbnum = 0
activelimb(i).id = ""
next i
endfunction
function findlimb(idd$)
ret = 0
for i = 0 to totalactivelimbs
if idd$ = activelimb(i).id
ret = i
goto skip22
endif
next i
skip22:
endfunction ret
function findlimbobj(idd$)
ret = 0
for i = 0 to totalactivelimbs
if idd$ = activelimb(i).id
ret = activelimb(i).limbnum
goto skip23
endif
next i
skip23:
endfunction ret
function findhotspot(idd$)
ret = 0
for i = 0 to totalhotspots
if idd$ = hotspot(i).id
ret = i
goto skip11
endif
skip11:
next i
endfunction ret
function checkhotspots()
`ret = 0
for i = 1 to totalhotspots
if object collision(hero,hotspot(i).objnum)=1 and hotspot(i).enabled = 1
runhotspot(hotspot(i).id)
goto skip123
endif
next i
skip123:
endfunction
function findlmb(objn,name$)
perform checklist for object limbs objn
total = checklist quantity()
for i = 0 to total-1
lname$ = limb name$(objn,i)
if lname$ = name$
ret = i
goto endthisshit
endif
next i
endthisshit:
endfunction ret
function healthmen(mx,my)
sprite 1,mx,my,1
sprite 2,mx+103,my+39,2
stretch sprite 2,health,100
`paste image 7,screen width()-50,screen height()-50,1
`ink RGB(255,0,0),RGB(0,0,0)
`text screen width()-50,screen height()-50 ,str$(medpacks)
`ink RGB(255,255,255),RGB(255,255,255)
endfunction
function playmovie1()
load image "images\after.jpg",2,1
load image "images\mission.jpg",1,1
load music "sounds\sc1.mp3",1
wait 1000
loop music 1
load object "3dmovies\intro\tt\intro.x",1
`load object "3dmovies\intro\intro.x",2
`load object "models\hero\hero.x",2
cam = findlmb(1,"_cam")
hide limb 1,cam
heroo = findlmb(1,"_hero")
tar = findlmb(1,"_tar")
hide limb 1,tar
`rotate object 2,0,180,0
`position object 2,limb position x(1,heroo),limb position y(1,heroo),limb position z(1,heroo)
set object speed 1,15
play object 1
`loop object 2,1,20
do
if int(object frame(1)) = 70 and ev1 = 0
ev1 = 1
cont = object frame(1)
stop object 1
msgboxy("Oh i got a new mail!")
msgboxy("Its from the stupid boss")
msgboxy("Oh no not another mission!")
msgboxy("its been 2 days since i got back")
msgboxy("from a deadly mission!")
do
paste image 1,0,0,0
if mpress(2) = 1 then goto sasa
sync
loop
sasa:
play object 1,cont
endif
if int(object frame(1)) = 87 and ev2 = 0
ev2 = 1
cont = object frame(1)
stop object 1
msgboxy("Guess i have to take it")
msgboxy("i'll ask for big reward ")
msgboxy("since iam in a vacation")
msgboxy("Now lets get things ready..")
msgboxy("I'll call mike")
play object 1,cont
endif
if int(object frame(1)) = 110 and ev3 = 0
ev3 = 1
cont = object frame(1)
stop object 1
msgboxy("Hello mike")
msgboxy("listen i need a favor")
msgboxy("Yeah its another mission")
msgboxy("i need a plane to take me to africa")
msgboxy("i'll tell them to send cash")
msgboxy("Dont worry!")
msgboxy("see ya")
play object 1,cont
endif
`et object frame 1,70
position camera limb position x(1,cam),limb position y(1,cam),limb position z(1,cam)
point camera limb position x(1,tar),limb position y(1,tar),limb position z(1,tar)
if int(object frame(1)) = 114 then goto exitanim
sync
loop
exitanim:
do
paste image 2,0,0,0
if mpress(2) = 1 then goto sasan
sync
loop
sasan:
delete object 1
stop music 1
delete music 1
delete image 1
delete image 2
endfunction
global lights as integer
global waterison as integer
global waterlimb as integer
function setupmap(objnum)
totalhotspots = 0
totalactivelimbs = 0
perform checklist for object limbs objnum
total = checklist quantity()
for i = 0 to total-1
lname$ = limb name$(objnum,i)
cmd$ = left$(lname$,5)
param$ = right$(lname$,4)
if (cmd$ = "_hide")
hide limb objnum,i
endif
if cmd$ = "_hero"
position object hero,limb position x(objnum,i),limb position y(objnum,i),limb position z(objnum,i)
rotate object hero,limb direction x(objnum,i),limb direction y(objnum,i),limb direction z(objnum,i)
offset limb objnum,i,limb offset x(objnum,i),limb offset y(objnum,i)-500,limb offset z(objnum,i)
hide limb objnum,i
endif
if cmd$ = "_back"
if param$ = "blak" then color backdrop 0,rgb(0,0,0)
if param$ = "skyb" then color backdrop 0,rgb(230,230,255)
if param$ = "dblu" then color backdrop 0,rgb(0,0,10)
endif
if cmd$ = "_watr"
waterison = 1
waterlimb = i
endif
if cmd$ = "_htsp"
inc totalhotspots,1
make object from limb totalhotspots + 200,objnum,i
position object totalhotspots + 200,limb position x(objnum,i),limb position y(objnum,i),limb position z(objnum,i)
offset limb objnum,i,limb offset x(objnum,i),limb offset y(objnum,i)-500,limb offset z(objnum,i)
hide limb objnum,i
hide object totalhotspots + 200
set object collision on totalhotspots + 200
set object collision to boxes totalhotspots + 200
hotspot(totalhotspots).id = param$
hotspot(totalhotspots).objnum = totalhotspots + 200
hotspot(totalhotspots).enabled = 1
endif
if (cmd$= "_almb")
inc totalactivelimbs,1
activelimb(totalactivelimbs).id = param$
activelimb(totalactivelimbs).limbnum = i
endif
if (cmd$= "_mons")
hide limb objnum,i
inc monsters,1
curmon = monsters + 10
monster(monsters).id = param$
monster(monsters).objnum = curmon
monster(monsters).mode = 0
monster(monsters).active = 1
monster(monsters).tmp = 0
monster(monsters).tmp2 = 0
monster(monsters).xx = 0
monster(monsters).yy = 0
monster(monsters).zz = 0
if (param$ = "rept")
load object "models\reptile\reptile.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
rotate object curmon,0,rnd(359),0
`make object box curmon,5,5,5
monster(monsters).hp = 10
endif
if (param$ = "trap")
load object "models\reptile\reptile.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
rotate object curmon,0,rnd(359),0
`make object box curmon,5,5,5
monster(monsters).hp = 25
hide object curmon
endif
if (param$ = "rrpt")
load object "models\redreptile\rrept.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
rotate object curmon,0,rnd(359),0
`make object box curmon,5,5,5
monster(monsters).hp = 80
endif
if (param$ = "wing")
load object "models\demon\wings.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
monster(monsters).hp = 10
endif
if (param$ = "head")
load object "models\demon\head.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
monster(monsters).hp = 10
endif
if (param$ = "lleg")
load object "models\demon\lleg.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
monster(monsters).hp = 10
endif
if (param$ = "rleg")
load object "models\demon\rleg.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
monster(monsters).hp = 10
endif
if (param$ = "lhnd")
load object "models\demon\lefthand.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
monster(monsters).hp = 10
endif
if (param$ = "rhnd")
load object "models\demon\righthand.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
monster(monsters).hp = 10
endif
if (param$ = "body")
load object "models\demon\body.x",curmon
rotate object curmon,0,180,0
fix object pivot curmon
monster(monsters).hp = 10
endif
position object curmon,limb position x(objnum,i),limb position y(objnum,i) +5,limb position z(objnum,i)
offset limb objnum,i,limb offset x(objnum,i),limb offset y(objnum,i)-1000,limb offset z(objnum,i)
`fixpivot(curmon)
endif
if cmd$ = "_lite"
inc lights,1
make light lights
position light lights,limb position x(objnum,i),limb position y(objnum,i),limb position z(objnum,i)
set point light lights,limb position x(objnum,i),limb position y(objnum,i),limb position z(objnum,i)
set light range lights,10
offset limb objnum,i,limb offset x(objnum,i),limb offset y(objnum,i)-500,limb offset z(objnum,i)
hide limb objnum,i
endif
next i
endfunction
function runhotspot(nme$)
kk = mpress(2)
if nme$ = "d001" and krel(15) = 1 and hotspot(findhotspot("d001")).enabled = 1
obj = findlimbobj("d001")
rotate limb level,obj,limb angle x(level,obj),limb angle y(level,obj),limb angle z(level,obj) + 90
hotspot(findhotspot("d001")).enabled = 0
setupcomplexobject level,0,2
endif
if nme$ = "msg1" and hotspot(findhotspot("msg1")).enabled = 1
hotspot(findhotspot("msg1")).enabled = 0
msgbox("I Guess i have to go down")
endif
if nme$ = "h001" and kk = 1
`snd = findsound()
play sound 10
obj = findlimbobj("s001")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)-6,limb offset z(level,obj)
hotspot(findhotspot("h001")).enabled = 0
obj = findlimbobj("d001")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)+ 35,limb offset z(level,obj)
setupcomplexobject level,0,2
`delete sound snd
endif
if nme$ = "h002" and kk = 1
`snd = findsound()
play sound 10
obj = findlimbobj("cc01")
`offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj),limb offset z(level,obj + 30)
hotspot(findhotspot("h002")).enabled = 0
obj = findlimbobj("d002")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)+ 35,limb offset z(level,obj)
setupcomplexobject level,0,2
`delete sound snd
endif
if nme$ = "outt"
hotspot(findhotspot("outt")).enabled = 0
if (pyrm = 0)
msgbox("Its locked tight!")
else
msgbox("Its unlocked")
wait 1000
end
endif
endif
if nme$ = "x001" and kk =1
hotspot(findhotspot("h001")).enabled = 0
hotspot(findhotspot("outt")).enabled = 1
msgbox("i have a bad feeling about this")
hide limb level,findlimbobj("itm1")
pyrm = 1
endif
if nme$ = "strt"
hotspot(findhotspot("strt")).enabled = 0
msgbox(",ld]gh I`i :gd>kjg hv;a")
msgbox(" folgh Lvigh ]h[d! :dgu")
msgbox(" hki }g!M],ugh , Mvfrlgh I`i Dt")
endif
if nme$ = "tel1" and kk = 1
msgbox("i think i have to jump down")
teleport("levels\r2")
endif
if nme$ = "h003" and kk = 1
play sound 15
teleport("levels\r3")
play sound 12
endif
if nme$ = "h004" and kk = 1
play sound 11
changemusic("sounds\k9.mp3")
teleport("levels\r4")
play sound 12
endif
if nme$ = "h005" and kk = 1
if tmp01 = 0
play sound 18
msgbox("Its locked tight!")
else
play sound 16
teleport("levels\r5")
play sound 17
endif
endif
if nme$ = "h006" and kk = 1
PLAY SOUND 10
obj = findlimbobj("c002")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj),limb offset z(level,obj) + 5
loop object 3
tmp01 = 1
loop sound 19
hotspot(findhotspot("h006")).enabled = 0
endif
if nme$ = "h007" and kk = 1
play sound 16
changemusic("sounds\explore.mp3")
teleport("levels\r6")
play sound 17
endif
if nme$ = "h008" and kk = 1
if tmp02 = 1
play sound 16
changemusic("sounds\l7.mp3")
teleport("levels\r7")
play sound 17
else
play sound 18
msgbox("Its locked")
msgbox("looks like its locked mechanicaly")
endif
endif
if nme$ = "h010" and kk = 1
PLAY SOUND 10
obj = findlimbobj("sw01")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)+3,limb offset z(level,obj)
obj = findlimbobj("z001")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)+20,limb offset z(level,obj)
setupcomplexobject level,0,2
hotspot(findhotspot("h010")).enabled = 0
endif
if nme$ = "h011" and kk = 1
PLAY SOUND 10
obj = findlimbobj("sw02")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)+2,limb offset z(level,obj)
obj = findlimbobj("z002")
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)+20,limb offset z(level,obj)
setupcomplexobject level,0,2
hotspot(findhotspot("h010")).enabled = 0
endif
if nme$ = "med1" and kk = 1
inc medpacks,1
obj = findlimbobj("med1")
hide limb level,obj
offset limb level,obj,limb offset x(level,obj),limb offset y(level,obj)-500,limb offset z(level,obj)
setupcomplexobject level,0,2
hotspot(findhotspot("med1")).enabled = 0
endif
if nme$ = "trap"
if tmp02 = 1
tmp03 = 1
hotspot(findhotspot("trap")).enabled = 0
endif
endif
if nme$ = "info" and kk = 1
msgbox("There is something writen here...")
hide sprite 1
hide sprite 2
do
paste image 8,0,0,0
if mpress(2) then goto kissmyass
sync
loop
kissmyass:
show sprite 1
show sprite 2
endif
if nme$ = "kill"
play sound 13
health = 0
endif
if nme$ = "trp2"
tmp03 = 1
hotspot(findhotspot("trap")).enabled = 0
play sound 24
set object speed 3,300
play object 3
disable("trp2")
endif
if nme$ = "tl01" and kk = 1
play sound 16
changemusic("sounds\k2.mp3")
teleport("levels\r8")
play sound 17
endif
if (nme$ = "poww") and kk = 1
msgbox("I think this is the power source")
msgbox("the boss told me about")
msgbox("i'll take it and get away from here")
load animation "videos\boss.mpg",1
stop music 1
for i = 0 to 100
sync
next i
play animation 1,0,0,800,600
do
if animation playing(1) = 0 then goto cont
sync
loop
cont:
stop animation 1
delete animation 1
disable("poww")
changemusic("sounds\boss.mp3")
teleport("levels\boss")
endif
endfunction
function disable(nn$)
hotspot(findhotspot(nn$)).enabled = 0
endfunction
type collision
enabled as boolean
object as integer
hradius as float
vradius as float
checks as integer
anglesize as float
slope as float
oldy as float
vstate as integer
vobject as integer
vslope as float
endtype
Function SecondTimer(SecondsToCount)
If Timer() < OldTime+(1000*SecondsToCount) Then ExitFunction 0
OldTime = Timer()
EndFunction 1
function void()
if memblock exist(1)=1 then delete memblock 1
endfunction
function setupcollisionsystem()
global dim collision() as collision
endfunction
function destroycollisionsystem()
undim collision()
endfunction
function setupcollision(object,slope#,radius#,checks)
array insert at bottom collision(0)
number=array count(collision(0))
collision(number).oldy=object position y(object)
collision(number).object=object
collision(number).hradius=radius#
collision(number).vradius=radius#*tan(slope#)
collision(number).slope=slope#
collision(number).checks=checks
collision(number).anglesize=360/checks
endfunction
function destroycollision(object)
array delete element collision(0),findobject(object)
endfunction
function setcollisionon(object)
collision(findobject(object)).enabled=1
endfunction
function setcollisionoff(object)
collision(findobject(object)).enabled=0
endfunction
function getverticalobject(object)
returnobject=collision(findobject(object)).vobject
endfunction returnobject
function getverticalstate(object)
onground=collision(findobject(object)).vstate
endfunction onground
function getverticalslope(object)
slope#=collision(findobject(object)).vslope
endfunction slope#
function updatehorizontalcollision(object)
number=findobject(object)
x#=object position x(collision(number).object)
y#=object position y(collision(number).object)
z#=object position z(collision(number).object)
if collision(number).enabled
cd#=collision(number).hradius*2
for x=0 to collision(number).checks-1
a#=x*collision(number).anglesize
if intersectobject(0,0,x#,y#,z#,newxvalue(x#,a#,collision(number).hradius),y#,newzvalue(z#,a#,collision (number).hradius),0)>0
d#=getcollisiondistance()
if d#<cd#
cd#=d# : ca#=a#
cx#=getstaticcollisionx()
cz#=getstaticcollisionz()
endif
endif
next x
if cd#<collision(number).hradius
ta#=wrapvalue(ca#-180)
position object collision(number).object,newxvalue(cx#,ta#,collision(number).hradius),y#,newzvalue(cz#,ta#,collision (number).hradius)
endif
endif
endfunction
function updateverticalcollision(object)
number=findobject(object)
oy#=collision(number).oldy
x#=object position x(collision(number).object)
y#=object position y(collision(number).object)
z#=object position z(collision(number).object)
if collision(number).enabled
if oy#-y#>=0
if intersectobject(0,0,x#,oy#,z#,x#,y#-collision(number).vradius,z#,0)>0
cy#=getstaticcollisiony()
collision(number).vslope=acos(getcollisionnormaly())
if collision(number).vslope<collision(number).slope
collision(number).vobject=getobjecthit()
collision(number).vstate=1
else
collision(number).vobject=0
collision(number).vstate=0
endif
position object collision(number).object,x#,cy#+collision(number).vradius,z#
else
collision(number).vobject=0
collision(number).vslope=0
collision(number).vstate=0
endif
else
if intersectobject(0,0,x#,oy#,z#,x#,y#+collision(number).vradius,z#,0)>0
cy#=getstaticcollisiony()
collision(number).vslope=acos(getcollisionnormaly())
if collision(number).vslope>180-collision(number).slope
collision(number).vobject=getobjecthit()
collision(number).vstate=-1
else
collision(number).vobject=0
collision(number).vstate=0
endif
position object collision(number).object,x#,cy#-collision(number).vradius,z#
else
collision(number).vobject=0
collision(number).vslope=0
collision(number).vstate=0
endif
endif
endif
collision(number).oldy=object position y(collision(number).object)
endfunction
function findobject(object)
for x=0 to array count(collision(0))
if collision(x).object=object then number=x
next x
endfunction number
`key release.... check
function krel(scancody)
chkk = keystate(scancody)
if (chkk = 0 and last1 = 1) then ret0000 = 1 else ret0000 = 0
if chkk = 1 then last1 = 1 else last1 = 0
endfunction ret0000
function kpress(scancody)
chkk = keystate(scancody)
if chkk = 1 and last11 = 0 then ret = 1 else ret = 0
last11 = chkk
endfunction ret
function mpress(bot)
chkk = mouseclick()
if chkk = bot and mousetemp = 0 then ret = 1 else ret = 0
mousetemp = chkk
endfunction ret
function msgbox(msg$)
hero = 2
if image exist(3) = 0 then load image "images\textbox.bmp",3,1
if object exist(hero)
set object speed hero,5
loop object hero,0,10
endif
xx= 140
yy = screen height() - 120
ink RGB(128,0,128),1
do
if mpress(2) = 1 then goto skip44
`krel is key release function
paste image 3,xx,yy,1
center text xx+150,yy+40,msg$
sync
loop
skip44:
attacking = 0
endfunction
function loadtexts()
open to read 2,"data\scripts.dat"
for i = 0 to 100
if file end(2) then goto skipreading
read string 2,texts(i)
next i
skipreading:
close file 2
endfunction
function findsound()
for i = 1 to 30
if sound exist(i) = 0
snd = i
goto skipsnd
endif
next i
skipsnd:
endfunction snd
function fixpivot(objnum)
rotate object objnum,object angle x(objnum),object angle y(objnum)+180,object angle z(objnum)
fix object pivot objnum
endfunction
function scale(objnum,scl)
scale object objnum,scl,scl,scl
endfunction
FUNCTION distance(xpos#,ypos#,zpos#,objnum)
nx#=object position x(objnum)-xpos#
ny#=object position y(objnum)-ypos#
nz#=object position z(objnum)-zpos#
distance#=sqrt((nx#*nx#)+(ny#*ny#)+(nz#*nz#))
ENDFUNCTION distance#
function control_monsters()
for i = 1 to monsters
obj = monster(i).objnum
if monster(i).id = "rept" and monster(i).active = 1
dx#=object position x(hero)-object position x(obj)
dy#=object position y(hero)-object position y(obj)
dz#=object position z(hero)-object position z(obj)
dist#=abs(sqrt(abs(dx#*dx#)+abs(dy#*dy#)+abs(dz#*dz#)))
angl#=wrapvalue(atanfull(dx#,dz#))
obja#=wrapvalue(object angle y(obj))
if angl#>180 then angl#=angl#-360
if obja#>180 then obja#=obja#-360
if dist#>80
set object speed obj,2
loop object obj,65,75
monster(i).mode = 1
else
monster(i).mode = 0
updatemostercollision(i)
endif
if monster(i).mode <> 1
if monster(i).tmp2 = 1
if monster(i).tmp >1
play sound 3
play object obj,35,49
set object speed obj,10
endif
monster(i).tmp = 0
if object playing(obj) = 0 then monster(i).tmp2 = 0
`goto skipall
endif
rotate object obj,0,angl#,0
if monster(i).tmp2 = 0
if dist# > 18
if not sound playing(5) then play sound 5
move object obj,0.2
set object speed obj,20
loop object obj,0,20
else
health = health - 0.1
if not sound playing(8) then play sound 8
if not sound playing(6) then play sound 6
set object speed obj,20
loop object obj,20,34
endif
endif
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
play sound 2
monster(i).hp = monster(i).hp - 1
monster(i).tmp = monster(i).tmp + 1
if monster(i).tmp = 3 then monster(i).tmp2 = 1
if monster(i).hp <1
play sound 7
set object speed obj,10
play object obj,49,63
monster(i).active = 0
endif
endif
skipall:
endif
endif
`-------------------------------------------------------------------------------------------------
if monster(i).id = "rrpt" and monster(i).active = 1
if monster(i).tmp3 = 1
if object playing(obj) = 0
load animation "videos\end.mpg",1
stop music 1
for i = 0 to 100
sync
next i
play animation 1,0,0,800,600
do
if animation playing(1) = 0 then goto contf
sync
loop
contf:
load image "images\thank.jpg",14,1
do
paste image 14,0,0,0
if mpress(2) = 1 then goto ecit
sync
loop
ecit:
delete image 14
end
endif
goto skipall
endif
updatemostercollision(i)
dx#=object position x(hero)-object position x(obj)
dy#=object position y(hero)-object position y(obj)
dz#=object position z(hero)-object position z(obj)
dist#=abs(sqrt(abs(dx#*dx#)+abs(dy#*dy#)+abs(dz#*dz#)))
angl#=wrapvalue(atanfull(dx#,dz#))
obja#=wrapvalue(object angle y(obj))
if angl#>180 then angl#=angl#-360
if obja#>180 then obja#=obja#-360
if dist#>500
set object speed obj,2
loop object obj,65,75
monster(i).mode = 1
else
monster(i).mode = 0
endif
if monster(i).mode <> 1
if monster(i).tmp2 = 1
if monster(i).tmp >1
play sound 3
play object obj,35,49
set object speed obj,10
endif
monster(i).tmp = 0
if object playing(obj) = 0 then monster(i).tmp2 = 0
`goto skipall
endif
rotate object obj,0,angl#,0
if monster(i).tmp2 = 0
if dist# > 18
if not sound playing(5) then play sound 5
move object obj,0.5
set object speed obj,20
loop object obj,0,20
else
health = health - 0.5
if not sound playing(8) then play sound 8
if not sound playing(6) then play sound 6
set object speed obj,20
loop object obj,20,34
endif
endif
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
play sound 2
monster(i).hp = monster(i).hp - 1
monster(i).tmp = monster(i).tmp + 1
if monster(i).tmp = 6 then monster(i).tmp2 = 1
if monster(i).hp <0.8
play sound 7
set object speed obj,10
play object obj,49,63
monster(i).tmp3 = 1
`monster(i).active = 0
endif
endif
skipall:
endif
endif
`---------------------------------------------------------------
if monster(i).id = "trap" and monster(i).active = 1
if tmp03 = 1
stop music 1
loop music 2
show object obj
tmp03 = 2
play sound 3
endif
if tmp03 = 2
position object obj,object position x(obj), object position y(obj) - 1, object position z(obj)
updatemostercollision(i)
if getverticalstate(obj)=1
tmp03 = 3
play sound 23
endif
endif
if tmp03 = 3
dx#=object position x(hero)-object position x(obj)
dy#=object position y(hero)-object position y(obj)
dz#=object position z(hero)-object position z(obj)
dist#=abs(sqrt(abs(dx#*dx#)+abs(dy#*dy#)+abs(dz#*dz#)))
angl#=wrapvalue(atanfull(dx#,dz#))
obja#=wrapvalue(object angle y(obj))
if angl#>180 then angl#=angl#-360
if obja#>180 then obja#=obja#-360
if dist#>150
set object speed obj,2
loop object obj,65,75
monster(i).mode = 1
else
monster(i).mode = 0
updatemostercollision(i)
endif
if monster(i).mode <> 1
if monster(i).tmp2 = 1
if monster(i).tmp >1
play sound 3
play object obj,35,49
set object speed obj,10
endif
monster(i).tmp = 0
if object playing(obj) = 0 then monster(i).tmp2 = 0
`goto skipall
endif
rotate object obj,0,angl#,0
if monster(i).tmp2 = 0
if dist# > 18
if not sound playing(5) then play sound 5
move object obj,0.2
set object speed obj,20
loop object obj,0,20
else
health = health - 0.2
if not sound playing(8) then play sound 8
if not sound playing(6) then play sound 6
set object speed obj,20
loop object obj,20,34
endif
endif
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
play sound 2
monster(i).hp = monster(i).hp - 1
monster(i).tmp = monster(i).tmp + 1
if monster(i).tmp = 7 then monster(i).tmp2 = 1
if monster(i).hp <1
play sound 7
set object speed obj,10
play object obj,49,63
stop music 2
loop music 1
monster(i).active = 0
endif
endif
skipall:
endif
endif
endif
`-------------------------------------------------------------------------------------------------
if monster(i).id = "wing"
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
play sound 21
if tmp02 = 0 then tmp01 = 1
endif
endif
if monster(i).id = "lhnd"
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
if tmp01 = 4 then tmp01 = 5 else tmp01 = 0
play sound 21
endif
endif
if monster(i).id = "rhnd"
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
if tmp01 = 3 then tmp01 = 4 else tmp01 = 0
play sound 21
endif
endif
if monster(i).id = "head"
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
if tmp01 = 5
play sound 22
tmp02 = 1
endif
play sound 21
endif
endif
if monster(i).id = "body"
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
play sound 21
endif
endif
if monster(i).id = "lleg"
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
if tmp01 = 2 then tmp01 = 3 else tmp01 = 0
play sound 21
endif
endif
if monster(i).id = "rleg"
guned = pick object(screen width()/2,screen height()/2,monster(i).objnum,monster(i).objnum)
if guned = monster(i).objnum and gunstat = 1
if tmp01 = 1 then tmp01 = 2 else tmp01 = 0
play sound 21
endif
endif
next i
endfunction
function anglexy(x1#,y1#,x2#,y2#)
ret# = WRaPVALUE(atanfull(x2# - x1# , y2#-y1#))
endfunction ret#
function updatemostercollision(monsternum)
objnum = monster(monsternum).objnum
g# = monster(monsternum).gg
updatehorizontalcollision(objnum)
x#=object position x(objnum)
y#=object position y(objnum)
z#=object position z(objnum)
rem move the box vertically
inc g#,gravity#
if getverticalstate(objnum)=1 then g#=gravity#
if getverticalstate(objnum)=-1 then g#=0
position object objnum,x#,y#-g#,z#
updateverticalcollision(objnum)
monster(monsternum).gg = g#
endfunction
function installfont()
copy file "2COOLAND.TTF","C:\windows\fonts"
execute file "dat/fontinst.exe","/f 2COOLAND.TTF",""
endfunction
function fontexist()
gotit = 0
perform checklist for fonts
for i = 1 to checklist quantity()
if checklist string$(i) = "ALW Cool Andalus." then gotit = 1
next i
endfunction gotit
function msgboxy(msg$)
if image exist(3) = 0 then load image "images\textbox.bmp",3
xx= 140
yy = screen height() - 120
ink RGB(128,0,128),1
set text size 20
do
if mpress(2) = 1 then goto skip44
`krel is key release function
paste image 3,xx,yy,1
center text xx+150,yy+40,msg$
sync
loop
endfunction
function teleport(mappath$)
hide all sprites
sprite 3,0,0,6
set sprite 3,0,0
show sprite 3
sync
sync
for i = 2 to 10
if music exist(i) then if music playing(i) then stop music i
next i
`stop all sounds:
`for i = 1 to 30
`if sound exist(i) then if sound playing(i) then stop sound i
`next i
if sound playing(19) then stop sound 19
`first remove everything
clearhotspots()
clearactivelimbs()
for i = 1 to 500
if object exist(i) = 1
delete object i
endif
next i
pyrm = 0
totalactivelimbs = 0
totalhotspots = 0
monsters = 0
scroller# = 0
attacking = 0
aangle# = 0
ddist# = 0
hheight# = 0
`speed#=0.5
gravity#=0.02
jump#=0.7
camdist#=30
loadedobjects = 0
tmp01 = 0
tmp02 = 0
tmp03 = 0
tmp04 = 0
tmp05 = 0
set camera range 0.001,5000
`position camera 0,30,0
set normalization on
set ambient light 0
position light 0,0,200,0
level=1
`load object "models\hero\hero.x",hero
load object "models\hero\hero.x",hero
fixpivot(hero)
load object mappath$ + "\dat.x",level
load object mappath$ + "\det.x",3
`set object cull 3,0
color backdrop 0,rgb(230,230,255)
position object level,0,1,0
position object 3,0,1,0
scale object level,100,100,100
setupmap(level)
setupcomplexobject level,0,2
set object speed level,3
`set object cull level,1
set object transparency 3,4
position camera object position x(hero) + 20,object position y(hero) + 20,object position z(hero)
scl# = 17
scale object hero,scl#,scl#,scl#
`set shadow shading on hero
rem setup collision
setupcollisionsystem()
setupcollision(hero,45,3.0,16)
setcollisionon(hero)
if monsters > 0
for i = 1 to monsters
setupcollision(monster(i).objnum,45,3.0,16)
setcollisionon(monster(i).objnum)
next i
endif
set object collision on hero
set object collision to spheres hero
set object speed hero,5
set object radius hero, 20
neenee = 0
set ambient light 30
`get Gun camera limbs:
perform checklist for object limbs hero
total = checklist quantity()
for i = 0 to total-1
lname$ = limb name$(hero,i)
if lname$ = "_camera"
guncam = i
hide limb hero,i
endif
if lname$ = "_target"
guntar = i
hide limb hero,i
endif
if lname$ = "_hole"
gunhole = i
hide limb hero,i
endif
if lname$ = "_gunhand" then gunhand = i
next i
currentmap = mappath$
show all sprites
hide sprite 3
itsok = 0
endfunction
function changemusic(filename$)
stop music 1
delete music 1
load music filename$,1
loop music 1
endfunction
جميع حقوق برمجة vBulletin محفوظة ©2025 ,لدى مؤسسة Jelsoft المحدودة.
جميع المواضيع و المشاركات المطروحة من الاعضاء لا تعبر بالضرورة عن رأي أصحاب شبكة المنتدى .