Because I feel bad for making you guys wait for another demo, here is the game's main source code. However, it would be quite difficult to post the whole thing as lots of the libraries are installed in my autoit, and I've added a few things to the au3Irrlicht2 library. In other words, this code will NOT work alone. But, it's for anyone who's interested. (Ignore the first part in the comments, this is just so I can run the level without having to start the game's menu)
;#comments-start
#include <au3Irrlicht2au3Irrlicht2.au3>
#include <Sound.au3>
#include <Misc.au3>
Global $driver = 2
Global $shadowy = 0
Global $pname = "TESTING"
LEVEL1
()
;#comments-end
Func LEVEL1
()
Local $l_driver = $driver
Local $l_shadows = $shadowy
Local $keydll = DllOpen("user32.dll")
Local $Wkey = 57, $Skey = 53, $AKey = 41, $Dkey = 44, $ESCkey = "1B", $LMouse = 01, $RMouse = 02, $EnterKey = "0D", $Rkey = "52"
Local $IsPaused = 0
Local $IsSnipeMode = 0
Local $eventtimer
Local $controlsActive = 0
Local $finalresult = 0
Switch $l_driver
Case 0
$l_driver = $IRR_EDT_OPENGL
Case 1
$l_driver = $IRR_EDT_DIRECT3D8
Case 2
$l_driver = $IRR_EDT_DIRECT3D9
EndSwitch
Switch $l_shadows
Case 0
$l_shadows = $IRR_SHADOWS
Case 1
$l_shadows = $IRR_NO_SHADOWS
EndSwitch
_IrrStart
($l_driver, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_FULLSCREEN, $l_shadows)
_IrrSetWindowCaption
($pname)
_IrrDisplayMouse
(False)
_IrrAddZipFile
("data.dat", $IRR_IGNORE_CASE, $IRR_IGNORE_PATHS)
Local $screens[4] ;0 = Loading 1 = Pause, 2 = Victory, 3 = Fail
$screens[0] = _IrrGetTexture
("loadingScreen.jpg")
_IrrBeginScene
(0,0,0)
_IrrDraw2DImage
($screens[0], 0, 0)
_IrrEndScene
()
$screens[1] = _IrrGetTexture
("pauseScreen.jpg")
$screens[2] = _IrrGetTexture
("victoryScreen.jpg")
$screens[3] = _IrrGetTexture
("failureScreen.jpg")
Local $texturebank[8] ;0 = Airport Building, 1 = Cement, 2 = Sniper Texture, 3 = Airport Tower Texture, 4 = ClipTexture, 5 = PlaneTexture, 6 = Black Texture, 7 = Bullet Texture
$texturebank[0] = _IrrGetTexture
("airportbuildingTxt1.jpg")
$texturebank[1] = _IrrGetTexture
("cement.jpg")
$texturebank[2] = _IrrGetTexture
("sniperTxt.jpg")
$texturebank[3] = _IrrGetTexture
("airportTowerTxt.jpg")
$texturebank[4] = _IrrGetTexture
("clipB.jpg")
$texturebank[5] = _IrrGetTexture
("planeTxt.jpg")
$texturebank[6] = _IrrGetTexture
("blackTxt.jpg")
$texturebank[7] = _IrrGetTexture
("bullettxt.png")
Local $skydometxt = _IrrGetTexture
("DayDome.jpg")
Local $particletxt[6]
$particletxt[0] = _IrrGetTexture
("blood1.png")
$particletxt[1] = _IrrGetTexture
("blood2.png")
$particletxt[2] = _IrrGetTexture
("blood3.png")
$particletxt[3] = _IrrGetTexture
("blood4.png")
$particletxt[4] = _IrrGetTexture
("blood5.png")
$particletxt[5] = _IrrGetTexture
("smoke.bmp")
Local $guitxt[5] ;0 = Crosshair, 1 = Scope, 2 = SniperIcon, 3 = Mission Text , 4 = Font
$guitxt[0] = _IrrGetTexture
("cHair.png")
$guitxt[1] = _IrrGetTexture
("scope.png")
$guitxt[2] = _IrrGetTexture
("snipericon.png")
$guitxt[3] = _IrrGetTexture
("m1obj.png")
$guitxt[4] = _IrrGetFont
("Bitmapfont.xml")
Local $meshes[11]
$meshes[0] = _IrrGetMesh
("airPlane.obj") ; Airplane
$meshes[1] = _IrrGetMesh
("airportBuilding.obj") ; Airport Building
$meshes[2] = _IrrGetMesh
("airportTower.obj") ; Airport Tower
$meshes[3] = _IrrGetMesh
("bulletShell.obj") ; Bullet Shell
$meshes[4] = _IrrGetMesh
("ground1.obj") ; The ground
$meshes[5] = _IrrGetMesh
("humanTarget.ms3d") ; Human Target
$meshes[6] = _IrrGetMesh
("playerArms.ms3d") ; Player Arms
$meshes[7] = _IrrGetMesh
("playerBody.ms3d") ; Player Body
$meshes[8] = _IrrGetMesh
("playerHead.obj") ; Player Head
$meshes[9] = _IrrGetMesh
("sniper.obj") ; Sniper
$meshes[10] = _IrrGetMesh
("sniperClip.obj") ; Sniper's Clip
Local $sounds[12]
$sounds[0] = ".otherdatablood1.wav"
$sounds[1] = ".otherdatablood2.wav"
$sounds[2] = ".otherdatablood3.wav"
$sounds[3] = ".otherdataclipSnap.wav"
$sounds[4] = ".otherdatamanDie.wav"
$sounds[5] = ".otherdatasnipe1.wav"
$sounds[6] = ".otherdatasnipe2.wav"
$sounds[7] = ".otherdatasnipe3.wav"
$sounds[8] = ".otherdatastep1.wav"
$sounds[9] = ".otherdatastep2.wav"
$sounds[10] = ".otherdatatrafficAmbience.mp3"
$sounds[11] = ".otherdataplaneext.wav"
;LOAD LEVEL
Local $nodebank[20]
Local $playernodes[5]
Local $bulletshell
Local $bulleteject
Local $barrelsmoke
Local $cameras[2]
Local $lights
Local $skydomenode
Local $bgsound
Local $objective[2]
Local $collidebank[2]
Local $walkspeed = 0.5
Local $animswitch = 0
Local $animsoundswitch = 0
Local $rotatespeed = 100
Local $rdif[2]
Local $camfix = 0
Local $guinodes[3]
Local $zoom = 0
Local $zoomswitch = 0
Local $gunanimstate = 0 ; 0 = Idle, 1 = Fire, 2 = Reload, 3 = (Hold Anim)
Local $recoilmove = 0
Local $camfromvector[3]
Local $camtovector[3]
Local $camvectorresult[3]
Local $raytarg
Local $mapcollisiongroup = _IrrCreateCombinedCollisionGroup
()
Local $ammo[2], $goal[2], $maxclip = 5
$ammo[0] = 5
$ammo[1] = 10
$goal[0] = 0
$goal[1] = 10
$cameras[0] = _IrrAddCamera
(0, 120, 500, 10, 100, 0) ;Revolving
_IrrAddFlyCircleAnimator
($cameras[0], -10, 100, 0, 500, -0.0001)
$cameras[1] = _IrrAddFPSCamera
("", $rotatespeed, 0)
_IrrSetCameraTarget
($cameras[1], 100, 150, 20)
_IrrSetActiveCamera
($cameras[0])
$skydomenode = _IrrAddSkyDomeToScene
($skydometxt, 10, 16, 1, 1.1, 1000)
$lights = _IrrAddLight
($IRR_NO_PARENT, 0, 5000, 0, 255, 255, 255, 10000)
_IrrSetAmbientLight
(.5, .5, .5)
$nodebank[0] = _IrrAddMeshToScene
($meshes[4]) ;Ground
_IrrSetNodeMaterialTexture
($nodebank[0], $texturebank[1], 0)
_IrrSetNodeMaterialFlag
($nodebank[0], $IRR_EMF_NORMALIZE_NORMALS, $IRR_ON)
_IrrSetNodePosition
($nodebank[0], 0,-10,0)
_IrrSetNodeScale
($nodebank[0], 30, 1, 30)
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[4], $nodebank[0], 0))
$nodebank[1] = _IrrAddMeshToScene
($meshes[2]) ;Sniper tower
_IrrSetNodeMaterialTexture
($nodebank[1], $texturebank[3], 0)
_IrrSetNodePosition
($nodebank[1], -10,50,0)
_IrrSetNodeScale
($nodebank[1], 1, 1, 1)
$collidebank[0] = _IrrGetCollisionGroupFromMesh
($meshes[2], $nodebank[1], 0)
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, $collidebank[0])
$nodebank[2] = _IrrAddMeshToScene
($meshes[1]) ;Airport Buildings
_IrrSetNodeMaterialTexture
($nodebank[2], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[2], 2000,30,500)
_IrrAddNodeShadow
($nodebank[2])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[2], 0))
$nodebank[3] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[3], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[3], 1800,30,500)
_IrrAddNodeShadow
($nodebank[3])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[3], 0))
$nodebank[4] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[4], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[4], 1600,30,500)
_IrrAddNodeShadow
($nodebank[4])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[4], 0))
$nodebank[5] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[5], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[5], 1400,30,500)
_IrrAddNodeShadow
($nodebank[5])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[5], 0))
$nodebank[6] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[6], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[6], 1200,30,500)
_IrrAddNodeShadow
($nodebank[6])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[6], 0))
$nodebank[7] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[7], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[7], 2000,30,-500)
_IrrAddNodeShadow
($nodebank[7])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[7], 0))
$nodebank[8] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[8], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[8], 1800,30,-500)
_IrrAddNodeShadow
($nodebank[8])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[8], 0))
$nodebank[9] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[9], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[9], 1600,30,-500)
_IrrAddNodeShadow
($nodebank[9])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[9], 0))
$nodebank[10] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[10], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[10], 1400,30,-500)
_IrrAddNodeShadow
($nodebank[10])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[10], 0))
$nodebank[11] = _IrrAddMeshToScene
($meshes[1])
_IrrSetNodeMaterialTexture
($nodebank[11], $texturebank[0], 0)
_IrrSetNodePosition
($nodebank[11], 1200,30,-500)
_IrrAddNodeShadow
($nodebank[11])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[1], $nodebank[11], 0))
$nodebank[12] = _IrrAddMeshToScene
($meshes[0]) ;Airplanes
_IrrSetNodeMaterialTexture
($nodebank[12], $texturebank[5], 0)
_IrrSetNodePosition
($nodebank[12], 700,40,270)
_IrrSetNodeRotation
($nodebank[12], 0, 200, 0)
_IrrAddNodeShadow
($nodebank[12])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[0], $nodebank[12], 0))
$nodebank[13] = _IrrAddMeshToScene
($meshes[0])
_IrrSetNodeMaterialTexture
($nodebank[13], $texturebank[5], 0)
_IrrSetNodePosition
($nodebank[13], 2500,40,-320)
_IrrSetNodeRotation
($nodebank[13], 0, 0, 0)
_IrrAddNodeShadow
($nodebank[13])
_IrrAddCollisionGroupToCombination
($mapcollisiongroup, _IrrGetCollisionGroupFromMesh
($meshes[0], $nodebank[13], 0))
$nodebank[14] = _IrrAddMeshToScene
($meshes[0]) ;Flying Airplane
_IrrSetNodeMaterialTexture
($nodebank[14], $texturebank[5], 0)
_IrrSetNodePosition
($nodebank[14], 2000, 1000, -2000)
_IrrSetNodeRotation
($nodebank[14], 0, 0, 0)
_IrrSetNodeScale
($nodebank[14], 0.3, 0.3, 0.3)
_IrrAddNodeShadow
($nodebank[14])
Local $psoundloop = 2800
;BEGIN PLAYER SETUP
Local $playerjoints[4]
$playernodes[0] = _IrrAddMeshToScene
($meshes[8]) ;HEAD
_IrrSetNodeMaterialTexture
($playernodes[0], $texturebank[6], 0)
_IrrSetNodeMaterialFlag
($playernodes[0], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale
($playernodes[0], 0.45, 0.45, 0.45)
_IrrSetNodePosition
($playernodes[0], 0, 0, 0)
_IrrSetNodeRotation
($playernodes[0], 0, 0, 0)
$raytarg = _IrrAddSphereSceneNode
(0.0000001, 3)
_IrrAddChildToParent
($raytarg, $cameras[1])
_IrrSetNodePosition
($raytarg, 60,-60,3000)
$playernodes[1] = _IrrAddMeshToScene
($meshes[7]) ;BODY
_IrrSetNodeMaterialTexture
($playernodes[1], $texturebank[6], 0)
_IrrSetNodeMaterialFlag
($playernodes[1], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale
($playernodes[1], 0.45, 0.45, 0.45)
_IrrSetNodePosition
($playernodes[1], -10, 115, 20)
_IrrSetNodeRotation
($playernodes[1], 0, -90, 0)
_IrrAddNodeShadow
($playernodes[1])
_IrrSetNodeAnimationRange
($playernodes[1], 0, 0)
_IrrSetNodeAnimationSpeed
($playernodes[1], 0)
_IrrSetTransitionTime
($playernodes[1], 0.05)
$playerjoints[0] = _IrrGetJointNode
($playernodes[1], "headjoint")
$playerjoints[1] = _IrrGetJointNode
($playernodes[1], "upperback")
$collidebank[1] = _IrrAddCollisionAnimator
($collidebank[0], $playernodes[1], 3, 1, 3, 0, -9.8, 0, 0, -5.5, 0)
$playernodes[2] = _IrrAddMeshToScene
($meshes[6]) ;ARMS
_IrrSetNodeMaterialTexture
($playernodes[2], $texturebank[6], 0)
_IrrSetNodeMaterialFlag
($playernodes[2], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale
($playernodes[2], 0.3, 0.3, 0.3)
_IrrSetNodePosition
($playernodes[2], 0, -7, 0)
_IrrSetNodeRotation
($playernodes[2], 0, 180, 0)
_IrrSetNodeAnimationRange
($playernodes[2], 0, 2)
_IrrSetNodeAnimationSpeed
($playernodes[2], 2)
_IrrSetTransitionTime
($playernodes[2], 0.000005)
$playerjoints[2] = _IrrGetJointNode
($playernodes[2], "lowerrightarm")
$playerjoints[3] = _IrrGetJointNode
($playernodes[2], "lowerleftarm")
$playernodes[3] = _IrrAddMeshToScene
($meshes[9]) ;SNIPER
_IrrSetNodeMaterialTexture
($playernodes[3], $texturebank[2], 0)
_IrrSetNodeMaterialFlag
($playernodes[3], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale
($playernodes[3], 0.8, 0.8, 0.8)
_IrrSetNodeRotation
($playernodes[3], 0, 180, -90)
_IrrSetNodePosition
($playernodes[3], 7, 0, -40)
$bulleteject = _IrrAddSphereSceneNode
(5, 3)
_IrrAddChildToParent
($bulleteject, $playernodes[3])
_IrrSetNodePosition
($bulleteject, 5,0,-35)
_IrrSetNodeVisibility
($bulleteject, False)
$barrelsmoke = _IrrAddSphereSceneNode
(0.0001, 3)
_IrrAddChildToParent
($barrelsmoke, $playernodes[3])
_IrrSetNodePosition
($barrelsmoke, -1,0,11)
$playernodes[4] = _IrrAddMeshToScene
($meshes[10]) ;SNIPER CLIP
_IrrSetNodeMaterialTexture
($playernodes[4], $texturebank[4], 0)
_IrrSetNodeMaterialFlag
($playernodes[4], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale
($playernodes[4], 0.8, 0.8, 0.8)
_IrrSetNodeRotation
($playernodes[4], 0, 0, 0)
_IrrSetNodePosition
($playernodes[4], 0, -3, -35)
_IrrAddChildToParent
($playernodes[2], $playernodes[1])
_IrrSetNodePosition
($cameras[1], 0,0,0)
_IrrAddChildToParent
($playernodes[3], $playerjoints[2])
_IrrAddChildToParent
($playernodes[4], $playernodes[3])
;END PLAYER SETUP
$bgsound = _GEng
_Sound
_Load
($sounds[10], 1)
_GEng
_Sound
_Play
($bgsound)
$eventtimer = TimerInit()
While _IrrRunning
()
;HANDLEPLANE START
if TimerDiff($psoundloop) >= 2800 Then
$psoundloop = TimerInit()
$i = _IrrGetNodePosition
($nodebank[14])
if $IsSnipeMode = 0 Then
_IEA
_3Dsound
($cameras[0], $i[0], $i[1], $i[2], $sounds[11], 3000)
Else
_IEA
_3Dsound
($cameras[1], $i[0], $i[1], $i[2], $sounds[11], 3000)
endif
endif
$i = _IrrGetNodePosition
($nodebank[14])
_IrrSetNodePosition
($nodebank[14], $i[0], $i[1], $i[2] + 0.5)
if $i[2] >= 3500 Then
$j = Random(1000, 3000)
_IrrSetNodePosition
($nodebank[14], $j, $i[1], -5000)
endif
;HANDLEPLANE END
if TimerDiff($eventtimer) >= 3000 AND $IsSnipeMode = 0 Then
if $objective[1] = 0 Then
$objective[0] = _IrrAddBillBoardToScene
(991, 121)
_IrrSetNodeMaterialTexture
($objective[0], $guitxt[3], 0)
_IrrSetNodeMaterialFlag
($objective[0], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrAddChildToParent
($objective[0], $playernodes[1])
_IrrSetNodePosition
($objective[0], 0, 500, -60)
_IrrSetNodeMaterialType
($objective[0], $IRR_EMT_TRANSPARENT_ALPHA_CHANNEL)
$objective[1] = 1
endif
if _IsPressed($EnterKey, $keydll) = 1 Then
$IsSnipeMode = 1
$controlsactive = 1
_IrrRemoveNode
($objective[0])
_IrrSetActiveCamera
($cameras[1])
_IrrAddChildToParent
($playernodes[2], $cameras[1])
$guinodes[0] = _IrrAddImage
($guitxt[2], 650, 510, $IRR_USE_ALPHA, 0)
$i = _IrrGetNodePosition
($playernodes[3])
_IEA
_3Dsound
($cameras[1], $i[0], $i[1], $i[2], $sounds[3], 300)
EndIf
endif
;Controls
if $controlsactive = 1 Then
if _IsPressed($RMouse, $keydll) = 1 AND $zoomswitch = 0 Then
if $zoom = 0 Then
$zoom = 1
else
$zoom = 0
EndIf
$zoomswitch = 1
EndIf
if _IsPressed($RMouse, $keydll) = 0 Then
$zoomswitch = 0
endif
if _IsPressed($LMouse, $keydll) = 1 Then
if $ammo[0] > 0 Then
$gunanimstate = 1
$controlsactive = 2
$ammo[0] -= 1
$j = Round(Random(0, 2))
$i = _IrrGetNodePosition
($cameras[0])
if $j = 0 Then
_IEA
_3Dsound
($cameras[1], $i[0], $i[1], $i[2], $sounds[5], 1000)
elseif $j = 1 Then
_IEA
_3Dsound
($cameras[1], $i[0], $i[1], $i[2], $sounds[6], 1000)
elseif $j = 2 Then
_IEA
_3Dsound
($cameras[1], $i[0], $i[1], $i[2], $sounds[7], 1000)
endif
$camfromvector = _IrrGetNodeAbsolutePosition
($cameras[1])
$camtovector = _IrrGetNodeAbsolutePosition
($raytarg)
$camvectorresult = ""
if _IrrGetCollisionPoint
($camfromvector, $camtovector, $mapcollisiongroup, $camvectorresult) Then
endif
endif
endif
if _IsPressed($Rkey, $keydll) = 1 Then
if $ammo[0] <> $maxclip AND $ammo[1] > 0 Then
$gunanimstate = 2
$controlsactive = 2
$zoom = 0
EndIf
endif
endif
if $controlsactive = 1 OR $controlsactive = 2 Then
if _IsPressed($Wkey, $keydll) = 1 Then
if $animswitch = 0 Then
_IrrSetNodeAnimationRange
($playernodes[1], 4, 17)
_IrrSetNodeAnimationSpeed
($playernodes[1], 15)
$animswitch = 1
endif
$i = _IrrGetNodeRotation
($playernodes[1])
$i2 = _IrrGetNodePosition
($playernodes[1])
$xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
$zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
_IrrSetNodePosition
($playernodes[1], $i2[0] - $xxx, $i2[1], $i2[2] - $zzz)
$s = _IrrGetNodeAnimationFrame
($playernodes[1])
$i2 = _IrrGetNodePosition
($cameras[1])
if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
if Round(Random(0,1)) = 0 Then
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
$animsoundswitch = 1
Else
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
$animsoundswitch = 1
EndIf
Else
$animsoundswitch = 0
endif
endif
if _IsPressed($Skey, $keydll) = 1 Then
if $animswitch = 0 Then
_IrrSetNodeAnimationRange
($playernodes[1], 4, 17)
_IrrSetNodeAnimationSpeed
($playernodes[1], -15)
$animswitch = 1
endif
$i = _IrrGetNodeRotation
($playernodes[1])
$i2 = _IrrGetNodePosition
($playernodes[1])
$xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
$zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
_IrrSetNodePosition
($playernodes[1], $i2[0] + $xxx, $i2[1], $i2[2] + $zzz)
$s = _IrrGetNodeAnimationFrame
($playernodes[1])
$i2 = _IrrGetNodePosition
($cameras[1])
if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
if Round(Random(0,1)) = 0 Then
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
$animsoundswitch = 1
Else
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
$animsoundswitch = 1
EndIf
Else
$animsoundswitch = 0
endif
endif
if _IsPressed($Akey, $keydll) = 1 Then
if $animswitch = 0 Then
_IrrSetNodeAnimationRange
($playernodes[1], 4, 17)
_IrrSetNodeAnimationSpeed
($playernodes[1], -15)
$animswitch = 1
endif
$i = _IrrGetNodeRotation
($playernodes[1])
$i[1] = $i[1] + 90
$i2 = _IrrGetNodePosition
($playernodes[1])
$xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
$zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
_IrrSetNodePosition
($playernodes[1], $i2[0] + $xxx, $i2[1], $i2[2] + $zzz)
$s = _IrrGetNodeAnimationFrame
($playernodes[1])
$i2 = _IrrGetNodePosition
($cameras[1])
if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
if Round(Random(0,1)) = 0 Then
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
$animsoundswitch = 1
Else
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
$animsoundswitch = 1
EndIf
Else
$animsoundswitch = 0
endif
endif
if _IsPressed($Dkey, $keydll) = 1 Then
if $animswitch = 0 Then
_IrrSetNodeAnimationRange
($playernodes[1], 4, 17)
_IrrSetNodeAnimationSpeed
($playernodes[1], -15)
$animswitch = 1
endif
$i = _IrrGetNodeRotation
($playernodes[1])
$i[1] = $i[1] + 90
$i2 = _IrrGetNodePosition
($playernodes[1])
$xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
$zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
_IrrSetNodePosition
($playernodes[1], $i2[0] - $xxx, $i2[1], $i2[2] - $zzz)
$s = _IrrGetNodeAnimationFrame
($playernodes[1])
$i2 = _IrrGetNodePosition
($cameras[1])
if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
if Round(Random(0,1)) = 0 Then
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
$animsoundswitch = 1
Else
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
$animsoundswitch = 1
EndIf
Else
$animsoundswitch = 0
endif
endif
if _IsPressed($Wkey, $keydll) = 0 AND _IsPressed($Skey, $keydll) = 0 AND _IsPressed($Akey, $keydll) = 0 AND _IsPressed($Dkey, $keydll) = 0 Then
if $animswitch = 1 Then
_IrrSetNodeAnimationRange
($playernodes[1], 0, 0)
_IrrSetNodeAnimationSpeed
($playernodes[1], 0)
$animswitch = 0
EndIf
endif
endif
;Handle Animations
if $gunanimstate = 1 Then
$gunanimstate = 3
_IrrSetNodeAnimationRange
($playernodes[2], 6, 14)
_IrrSetNodeAnimationSpeed
($playernodes[2], 12)
EndIf
if $gunanimstate = 2 Then
$gunanimstate = 3
_IrrSetNodeAnimationRange
($playernodes[2], 20, 39)
_IrrSetNodeAnimationSpeed
($playernodes[2], 6)
endif
if _IrrGetNodeAnimationFrame
($playernodes[2]) = 22 Then
_IrrSetNodeAnimationFrame
($playernodes[2], _IrrGetNodeAnimationFrame
($playernodes[2]) + 1)
$i2 = _IrrGetNodePosition
($cameras[1])
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[3], 1000)
$ammo[0] = 0
_IrrSetNodePosition
($playernodes[4], -3,-3,0)
_IrrSetNodeRotation
($playernodes[4], 0, 90, 0)
_IrrAddChildToParent
($playernodes[4], $playerjoints[3])
EndIf
if _IrrGetNodeAnimationFrame
($playernodes[2]) = 38 Then
_IrrSetNodeAnimationFrame
($playernodes[2], _IrrGetNodeAnimationFrame
($playernodes[2]) + 1)
$i2 = _IrrGetNodePosition
($cameras[1])
_IEA
_3Dsound
($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[3], 1000)
if $ammo[1] < $maxclip Then
$ammo[0] = $ammo[1]
$ammo[1] = 0
else
$ammo[0] = $maxclip
$ammo[1] -= $maxclip
endif
_IrrAddChildToParent
($playernodes[4], $playernodes[3])
_IrrSetNodePosition
($playernodes[4], 0, -3, -35)
_IrrSetNodeRotation
($playernodes[4], 0, 0, 0)
$gunanimstate = 0
_IrrSetNodeAnimationRange
($playernodes[2], 0, 2)
_IrrSetNodeAnimationSpeed
($playernodes[2], 2)
$controlsactive = 1
EndIf
if _IrrGetNodeAnimationFrame
($playernodes[2]) = 10 Then ; BULLET SHELL
if $bulletshell = "" Then
$bulletshell = _IrrAddMeshToScene
($meshes[3])
$i2 = _IrrGetNodeAbsolutePosition
($bulleteject)
_IrrSetNodeMaterialTexture
($bulletshell, $texturebank[7], 0)
_IrrSetNodePosition
($bulletshell, $i2[0], $i2[1], $i2[2])
_IrrAddRotationAnimator
($bulletshell, 0, 5, 0)
_IrrSetNodeScale
($bulletshell, .2, .2, .2)
_IrrAddCollisionAnimator
($collidebank[0], $bulletshell, 1,1,1, 0, -9.8, 0, 0,0,0)
_IrrAddFadeAnimator
($bulletshell, 2000, 0)
endif
endif
if _IrrGetNodeAnimationFrame
($playernodes[2]) = 13 Then
$gunanimstate = 0
_IrrSetNodeAnimationRange
($playernodes[2], 0, 2)
_IrrSetNodeAnimationSpeed
($playernodes[2], 2)
$controlsactive = 1
$bulletshell = ""
endif
if _IrrGetNodeAnimationFrame
($playernodes[2]) = 6 AND $zoom = 1 Then
$recoilmove = 1
EndIf
if _IrrGetNodeAnimationFrame
($playernodes[2]) = 8 AND $zoom = 1 Then
$recoilmove = 2
EndIf
if _IrrGetNodeAnimationFrame
($playernodes[2]) = 11 AND $zoom = 1 Then
$recoilmove = 0
endif
;End Handle Animations
if $recoilmove = 1 Then
$i = _IrrGetCameraTarget
($cameras[1])
_IrrSetCameraTarget
($cameras[1], $i[0], $i[1] + 1, $i[2])
elseif $recoilmove = 2 Then
$i = _IrrGetCameraTarget
($cameras[1])
_IrrSetCameraTarget
($cameras[1], $i[0], $i[1] - 0.5, $i[2])
endif
$i = _IrrGetNodePosition
($playernodes[1])
$i2 = _IrrGetNodeRotation
($playernodes[1])
_IrrSetNodePosition
($playernodes[0], $i[0], $i[1] + 35, $i[2])
_IrrSetNodePosition
($cameras[1], $i[0], $i[1] + 30, $i[2])
if $IsSnipeMode = 1 Then
$i3 = _IrrGetNodeRotation
($cameras[1])
$rdif[0] = $i3[1] - $rdif[1]
_IrrSetNodeRotation
($playernodes[1], $i2[0], $i2[1] + $rdif[0], $i2[2])
$rdif[1] = $i3[1]
endif
if _IsPressed($ESCKey, $keydll) = 1 Then
$IsPaused = 1
Sleep(100)
endif
if $IsPaused = 1 Then
$controlsactive = 0
_IrrBeginScene
(0,0,0)
_IrrDraw2DImage
($screens[1], 0, 0)
_IrrEndScene
()
if _IsPressed($Enterkey, $keydll) = 1 Then
$finalresult = 0
ExitLoop
EndIf
if _IsPressed($ESCkey, $keydll) = 1 Then
$IsPaused = 0
if $IsSnipeMode = 1 Then
$controlsactive = 1
endif
Sleep(100)
EndIf
endif
if $IsPaused = 0 Then
_IrrBeginScene
(180,255,255)
_IrrAnimateJoints
($playernodes[1])
_IrrAnimateJoints
($playernodes[2])
_IrrDrawScene
()
if $zoom = 1 Then
_IrrSetCameraFOV
($cameras[1], 3.14 / 20.5)
_IrrDraw2DImageElement
($guitxt[1], -110, -100, 0, 0, 1000, 1000, $IRR_USE_ALPHA)
_IrrSetNodeVisibility
($playernodes[3], False)
_IrrSetNodePosition
($raytarg, 0,0,3000)
Else
_IrrSetCameraFov
($cameras[1], 3.14 / 2.5)
_IrrSetNodeVisibility
($playernodes[3], True)
_IrrSetNodePosition
($raytarg, 60,-60,3000)
endif
_IrrDrawGUI
()
if $IsSnipeMode = 1 Then
_Irr2DFontDraw
($guitxt[4],$ammo[0] &"/"& $ammo[1] ,680, 550, 750, 780)
_Irr2DFontDraw
($guitxt[4], $goal[0] &"/"& $goal[1], 5, 10, 100, 100)
_IrrDraw2DImageElement
($guitxt[0], @DesktopWidth / 2, @DesktopHeight / 2, 0, 0, 18, 16, $IRR_USE_ALPHA)
endif
if $camfix = 0 AND $i2[1] = 0 Then
_IrrSetNodeRotation
($playernodes[1], 0, -90, 0)
$camfix = 1
endif
_IrrEndScene
()
EndIf
WEnd
Return $finalresult
EndFunc