ifvare Plight 1
{
spawn 3747
setvar Plight 2
}

ifvare other 1
{
stopsound 407
stopsound 418
soundonce 463
addvar countvar 1
ifvare countvar 512
{
setvar other 20
setvar countvar 0
}
}

ifvare other 20
{
soundonce 469
setvar other 0
}

ifvare slowmotion 1
{
addvar countvar3 1
inittimer 40
ifvare countvar3 128
{
setvar slowmotion 0
setvar countvar3 0
}
}

ifvare slowmotion 2
{
addvar countvar3 1
inittimer 40
palfrom 50 63 63 63
soundonce 493
ifvare countvar3 50
{
setvar slowmotion 0
setvar countvar3 0
}
}

ifvare slowmotion 0
{
inittimer 120
}

ifinwater
{
ifvarg OX 0
{
setplayer[THISACTOR].scuba_amount 2
soundonce 465
addvar countvar2 1
ifvare countvar2 50
{
subvar OX 1
setvar countvar2 0
}
getplayer[THISACTOR].scuba_amount temp
ifvarn temp 2
{
setplayer[THISACTOR].scuba_amount 2
}
}
else
ifvarl OX 1
{
ifvarl energy 40
ifvarg energy 10
{
addvarvar OX energy 
setvar energy 0
}
else
ifvarl energy 1
{
setplayer[THISACTOR].scuba_amount -1
}
else
ifvarg energy 40
{
subvar energy 40
setvar OX 40
}
}
}

getplayer[THISACTOR].cursectnum mysector
getsector[mysector].lotag temp5
ifvare temp5 50
{ 
{
ifvarg OX 0
{
setplayer[THISACTOR].scuba_amount 2
soundonce 465
addvar countvar2 1
ifvare countvar2 50
{
subvar OX 1
setvar countvar2 0
}
getplayer[THISACTOR].scuba_amount temp
ifvarn temp 2
{
setplayer[THISACTOR].scuba_amount 2
}
}
else
ifvarl OX 1
{
ifvarl energy 40
ifvarg energy 10
{
addvarvar OX energy 
setvar energy 0
}
else
ifvarl energy 1
{
setplayer[THISACTOR].scuba_amount -1
addvar countvar 1
ifvare countvar 12
{
addphealth -10
setvar countvar 0
}
}
else
ifvarg energy 40
{
subvar energy 40
setvar OX 40
}
}
}
}

ifvare VOLUME 0 {
ifvare LEVEL 1 {
ifvare reseti 0 {
sound 449
palfrom 100
setvar countvar 0
setvar tmp3 0
setvar testc 0
setvar tmp2 0
setvar energy 0
setvar chapter1 1
resetcount
setvar reseti 1
}
}
}
ifvare curweap 0 { ifvare chain 1 {
soundonce 439 } }
ifvare curweap 0 { ifvare chain 0 { setplayer[THISACTOR].weapon_pos -9 } }
state gunwork
ifvare DNSUIT 2 {
soundonce DUKE_JETPACK_IDLE
}

ifvare chapter1 1 { addvar countvar 1 ifvare countvar 150 { setvar chapter1 0 setvar countvar 0 } }
ifvare testc 1 {
ifvare tmp2 1 {
soundonce REACTOR_ON } }
ifvare testc 1 { ifvare DNSUIT 0 { addphealth -1000 } else { setvar tmp2 1 addvar countvar 1 ifvare countvar 512 { setvar testc 2 } } }
ifvare testc 2 {
setvar testc 3 }
ifvare testc 3 {
ifcount 30 { sound RPG_EXPLODE quake 50 addvar tmp3 1 resetcount }
ifvare tmp3 1 { setvar countvar 0 }
ifvare tmp3 3 { palfrom 10 63 63 63 }
ifvare tmp3 4 { palfrom 20 63 63 63 }
ifvare tmp3 5 { palfrom 30 63 63 63 }
ifvare tmp3 6 { palfrom 40 63 63 63 }
ifvare tmp3 7 { palfrom 50 63 63 63 }
ifvare tmp3 8 { palfrom 60 63 63 63 }
ifvare tmp3 9 { palfrom 70 63 63 63 }
ifvare tmp3 10 { palfrom 80 63 63 63 }
ifvare tmp3 11 { palfrom 90 63 63 63 }
ifvarg tmp3 12 { palfrom 100 63 63 63 }
ifvarg tmp3 14 { startlevel VOLUME 1 } 
}
ifvare DNSUIT 0 
{ 
setplayer[THISACTOR].weapon_pos -9 
}
ifvare putdn 1 { ifcount 72 {
palfrom 100 100 100 100
palfrom 100 100 100 100
palfrom 100 100 100 100
resetcount
setvar putdn 3 } }
ifvare putdn 3 { ifcount 32 {
setvar DNSUIT 1
stopsound REACTOR_ON
ifcount 128 {
resetcount
setvar putdn 2
}
}
}

ifvare shootdyna 1 { shoot 3698 setvar shootdyna 0 }
ifvarg shotgam 32 { setvar shotgam 32 }
ifvarg pistol_ammo 180 { setvar pistol_ammo 180 }
ifvarg mammo 600 { setvar mammo 600 }

ifvare medkitbegin 0 {
spawn FIRSTAID setvar medkitbegin 1
}

getactor[THISACTOR].extra health

ifvarl health 30 { soundonce 398 }
ifvare health 0 { stopsound 398 soundonce 404 }

getplayer[THISACTOR].firstaid_amount medkit

getactor[THISACTOR].htextra temp
ifvarg temp 0 {
getuserdef[THISACTOR].god tmp3 ifvare tmp3 1 nullop else
{
getplayer[THISACTOR].shield_amount armor
ifvarg  armor 0 {
subvarvar armor temp
setplayer[THISACTOR].shield_amount armor
setactor[THISACTOR].htextra 0
ifvarl armor 0 {
getactor[THISACTOR].extra tmp2
addvarvar tmp2 armor
setactor[THISACTOR].extra tmp2
setplayer[THISACTOR].shield_amount 0
}
}
}
} 
ifvare recharge 1 {
ifvarn energy 100 { ifcount 80 { addvar energy 1 resetcount } } }
ifvarg energy 100 { setvar recharge 0 }
ifvare energy 100 { setvar recharge 0 }
ifvare recharge 0 { ifvarl energy 0 { setvar recharge 1 } }
ifvare curweap 9 { getplayer[THISACTOR].ammo_amount 9 egon2 ifvarg egon2 30  { getinput[THISACTOR].bits tmp ifvarand tmp 8192 {
ifcount 16 { subvar egon2 30 setplayer[THISACTOR].ammo_amount 9 egon2 shoot 3682 sound CAT_FIRE resetcount } } } }
ifvare recharge 0 { getplayer[THISACTOR].shield_amount tmp2 ifvarl tmp2 100 { ifcount 128 { addvar tmp2 5 setplayer[THISACTOR].shield_amount tmp2 subvar energy 3 resetcount } } }
ifvare recharge 0 { ifvarg energy 14 {  getplayer[THISACTOR].jumping_counter tmp ifvarg tmp 0 { setplayer[THISACTOR].poszv -11000 setvar temp6 1 ifcount 16 { subvar energy 10 sound 414 resetcount } } } }

*/

ifvare curweap 5
{
getplayer[THISACTOR].ammo_amount 5 dyna ifvarg dyna 0 { getinput[THISACTOR].bits tmp ifvarand tmp 8192 {
ifcount 16 { subvar dyna 1 setplayer[THISACTOR].ammo_amount 5 dyna espawn 3707 quote 140 resetcount } } } }



ifvare temp6 1
{
getplayer[THISACTOR].poszv tmp4 ifvarg tmp4 1000 {  setplayer[THISACTOR].poszv 100 ifcount 56 { setvar temp6 0 resetcount  } } }

ifvarg mp5k_ammo 210 { setvar mp5k_ammo 210 }

getinput[THISACTOR].bits temp
ifvarand temp 64 {
ifvare curweap 1 {
ifvare weapon_1 0 {
ifvarvare DEAGLEMAG pistol_ammo { break }
ifvare DEAGLEMAG 18 { break }
setplayer[THISACTOR].reloading 1
setplayer[THISACTOR].kickback_pic 4
ifvarl pistol_ammo 1 { break }
ifvarvarg pistol_ammo DEAGLEMAG {
addvarvar DEAGLEMAG pistol_ammo
setvar pistol_ammo 0
setvarvar tmp2 DEAGLEMAG
subvar tmp2 18
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar pistol_ammo tmp2 setvar DEAGLEMAG 18 } } else ifvarvarl pistol_ammo DEAGLEMAG {
addvarvar DEAGLEMAG pistol_ammo
setvar pistol_ammo 0
setvarvar tmp2 DEAGLEMAG
subvar tmp2 18
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar pistol_ammo tmp2 setvar DEAGLEMAG 18 }
}
}
else ifvare weapon_1 1 {
ifvarvare MP5KMAG mp5k_ammo { break }
ifvare MP5KMAG 30 { break }
setplayer[THISACTOR].reloading 1
setplayer[THISACTOR].kickback_pic 4
ifvarl mp5k_ammo 1 { break }
ifvarvarg mp5k_ammo MP5KMAG {
addvarvar MP5KMAG mp5k_ammo
setvar mp5k_ammo 0
setvarvar tmp2 MP5KMAG
subvar tmp2 30
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar mp5k_ammo tmp2 setvar MP5KMAG 30 } } else ifvarvarl mp5k_ammo MP5KMAG {
addvarvar MP5KMAG mp5k_ammo
setvar mp5k_ammo 0
setvarvar tmp2 MP5KMAG
subvar tmp2 30
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar mp5k_ammo tmp2 setvar MP5KMAG 30 }
}
}
}
else
ifvare curweap 2 { 
getplayer[THISACTOR].ammo_amount 2 temp
ifvarvare RIFLE12MAG shotgam { break }
ifvare RIFLE12MAG 8 { break }
setplayer[THISACTOR].reloading 1
setplayer[THISACTOR].kickback_pic 9
ifvarl shotgam 1 { break }
ifvarvarg shotgam RIFLE12MAG {
addvarvar RIFLE12MAG shotgam
setvar shotgam 0
setvarvar tmp2 RIFLE12MAG
subvar tmp2 8
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar shotgam tmp2 setvar RIFLE12MAG 8 } } else ifvarvarl shotgam RIFLE12MAG {
addvarvar RIFLE12MAG shotgam
setvar shotgam 0
setvarvar tmp2 RIFLE12MAG
subvar tmp2 8
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar shotgam tmp2 setvar RIFLE12MAG 8 } }
}
ifvare curweap 3 {
ifvarvare mmag mammo { break }
ifvare mmag 30 { break }
ifvarl mammo 1 { break }
setplayer[THISACTOR].reloading 1
setplayer[THISACTOR].kickback_pic 9
ifvarvarg mammo mmag {
addvarvar mmag mammo
setvar mammo 0
setvarvar tmp2 mmag
subvar tmp2 30
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar mammo tmp2 setvar mmag 30 } } else ifvarvarl mammo mmag {
addvarvar mmag mammo
setvar mammo 0
setvarvar tmp2 mmag
subvar tmp2 30
ifvarl tmp2 1 { nullop } else
ifvarg tmp2 0 { addvarvar mammo tmp2 setvar mmag 30 } } }
else { break }
}

getplayer[THISACTOR].curr_weapon curweap

ifp pdead nullop else
state stepsoundstuff
else
ifp pjumping state STOPSTEPSOUNDS
else
ifp pfalling state STOPSTEPSOUNDS else
ifinwater state STOPSTEPSOUNDS

//ifvare TRACK 1 { soundonce 418 stopsound 407 }
//ifvare TRACK 2 { soundonce 407 stopsound 418 }
//ifvare TRACK 3 { soundonce 466 }

getuserdef[THISACTOR].team team
ifvare team 0 { spritepal 7 } else ifvare team 1 { spritepal 2 } else ifvare team 2 { spritepal 8 } else ifvare team 3 { nullop }

useractor notenemy 3743
cstator 32768
ifcount 72 { sound 420
randvar angvar 512
setactor[THISACTOR].ang angvar
randvar z 256
mulvar z -1
ezshoot z 3742
randvar angvar 512
setactor[THISACTOR].ang angvar
randvar z 512
mulvar z -1
ezshoot z 3742
randvar angvar 512
setactor[THISACTOR].ang angvar
randvar z 128
mulvar z -1
ezshoot z 3742
resetcount
}
enda
