
gamevar saveoption YES 0
gamevar completed 0 0
gamevar completed2 0 0
gamevar completed3 0 0
gamevar completed4 0 0
gamevar recentmaps 0 0
gamevar recentmaps2 0 0
gamevar recentmaps3 0 0
gamevar recentmaps4 0 0
gamevar truevolume 0 0
gamevar newlevel -1 0 // next level number to be loaded
gamevar newvolume -1 0 // next volume number to be loaded
// 1 means LEVEL 0 completed, 2 means LEVEL 1, 4 = LEVEL 3, etc.
gamevar firstmap 0 0
// 0 = game not started yet
// 1 = random game started
// 2 = random game finished; allow boss ending
gamevar truelevel 0 0

define MAXSPRITES 13500

// LODHACK IS CURRENTLY DISABLED, PENDING AN OPTIMIZATION
define ALT_CHAINGUN NO // if yes, the game replaces the chaingun with a MP5, complete with reloading ability
define ALT_RPG NO

define PISTOLSPREAD 32
define SHOTGUNSPREAD 32
define CHAINGUNSPREAD 32
// THE NORMAL SPREAD FOR ALL WEAPONS IS 32
// THE BIGGER THE VALUE, THE GREATER THE SPREAD
// 4 OR LESS MEANS THERE IS NO SPREAD AT ALL, PERFECT ACCURACY
define KNOCKBACK 10
// KNOCKBACK is the distance monsters are knocked back by the shotgun and other high damage weapons
// 13 is a reasonable KNOCKBACK value; it gets silly at higher numbers

define STOREHEALTH YES // HEALTH PICKUPS WILL BE ADDED TO MEDKIT IF PLAYER HAS MAX HEALTH
define FIRSTAID_MAX MAXPLAYERHEALTH // THE MAX STORAGE FOR FIRST AID KIT; CAN BE SET HIGHER THAN 100
define HOLODUKEBOT YES // MONSTERS ARE ELECTROCUTED BY THE HOLODUKE HOLOGRAM
define RANDOM 0
// FOR A GAME WITH RANDOMIZED MONSTERS AND WEATHER, change the value of RANDOM to a number between 1 and 50 
// keep RANDOM below 10 for best results
gamevar randomstart 7 0 // do not change this


// THE FOLLOWING DEFINES DETERMINE THE DEFAULT PROPERTIES OF MONSTERS
// CHANGING THE DEFAULT FLAGS AND DROPS OF MONSTERS WORKS JUST LIKE...
// SETTING EXTRA AND XVEL ON THE SPRITES IN BUILD AS DESCRIBED IN THE DOCUMENTATION

define EGG_FLAGS 0
define EGG_DROPS 0
define LIZTROOP_FLAGS 0
define LIZTROOP_DROPS 0
define OCTABRAIN_FLAGS 0
define OCTABRAIN_DROPS 0
define DRONE_FLAGS 0
define DRONE_DROPS 0
define COMMANDER_FLAGS 0
define COMMANDER_DROPS 0
define TANK_FLAGS 0
define TANK_DROPS 0
define PIGCOP_FLAGS 0
define PIGCOP_DROPS 0
define LIZMAN_FLAGS 0
define LIZMAN_DROPS 0
define ROTATEGUN_FLAGS 0
define ROTATEGUN_DROPS 0
define BOSS1_FLAGS 0
define BOSS1_DROPS 0
define BOSS2_FLAGS 0
define BOSS2_DROPS 0
define BOSS3_FLAGS 0
define BOSS3_DROPS 0
define NEWBEAST_FLAGS 0
define NEWBEAST_DROPS 0
define BOSS4_FLAGS 0
define BOSS4_DROPS 0
define SHARK_FLAGS 0
define SHARK_DROPS 0
define RECONDP_FLAGS 0 // does not affect normal RECON
define RECONDP_DROPS 0 // does not affect normal RECON

define TROOPVAL 100
define EGGVAL 20
define PIGVAL 200
define LIZVAL 250
define RECONVAL 400
define COMMVAL 500
define OCTAVAL 175
define DRONEVAL 150
define TURRVAL 150
define BEASTVAL 300
define BOTVAL 600
define TANKVAL 600
define BOSSVAL 4000
define BOSSPALVAL 1000


// STUFF BELOW THIS POINT SHOULD NOT BE ALTERED BY CASUAL USERS!!
// ***************************************************************

// VARIABLE DECLARATIONS

// ATTRITION VARS


gamevar weaptotal 0 1 // total number of gained weapon levels
gamevar savweaptotal 0 1

gamevar nukes 0 1

gamevar weaplev0 0 1
gamevar weaplev1 0 1
gamevar weaplev2 0 1
gamevar weaplev3 0 1
gamevar weaplev4 0 1
gamevar weaplev5 0 1
gamevar weaplev6 0 1
gamevar weaplev7 0 1
gamevar weaplev8 0 1
gamevar weaplev9 0 1
gamevar weaplev10 0 1 // laser pistol
gamevar weaplev11 0 1


// these are bitfields which store which upgrades the player has attained for each weapon
// they are used for generating the lists of quotes describing the upgrades
gamevar weapup0 0 1
gamevar weapup1 0 1
gamevar weapup2 0 1
gamevar weapup3 0 1
gamevar weapup4 0 1
gamevar weapup5 0 1
gamevar weapup6 0 1
gamevar weapup7 0 1
gamevar weapup8 0 1
gamevar weapup9 0 1
gamevar weapup10 0 1 // laser pistol
gamevar weapup11 0 1

gamevar weapxp0 0 1
gamevar weapxp1 0 1
gamevar weapxp2 0 1
gamevar weapxp3 0 1
gamevar weapxp4 0 1
gamevar weapxp5 0 1
gamevar weapxp6 0 1
gamevar weapxp7 0 1
gamevar weapxp8 0 1
gamevar weapxp9 0 1
gamevar weapxp10 0 1 // laser pistol
gamevar weapxp11 0 1

gamevar savweaplev0 0 1
gamevar savweaplev1 0 1
gamevar savweaplev2 0 1
gamevar savweaplev3 0 1
gamevar savweaplev4 0 1
gamevar savweaplev5 0 1
gamevar savweaplev6 0 1
gamevar savweaplev7 0 1
gamevar savweaplev8 0 1
gamevar savweaplev9 0 1
gamevar savweaplev10 0 1 // laser pistol
gamevar savweaplev11 0 1

gamevar savweapup0 0 1
gamevar savweapup1 0 1
gamevar savweapup2 0 1
gamevar savweapup3 0 1
gamevar savweapup4 0 1
gamevar savweapup5 0 1
gamevar savweapup6 0 1
gamevar savweapup7 0 1
gamevar savweapup8 0 1
gamevar savweapup9 0 1
gamevar savweapup10 0 1 // laser pistol
gamevar savweapup11 0 1

gamevar savmaxammo1 180 1
gamevar savmaxammo2 30 1
gamevar savmaxammo3 180 1
gamevar savmaxammo4 30 1
gamevar savmaxammo5 30 1
gamevar savmaxammo6 30 1
gamevar savmaxammo7 80 1
gamevar savmaxammo8 10 1
gamevar savmaxammo9 80 1
gamevar savmaxammo11 50 1


gamevar savweapxp0 0 1
gamevar savweapxp1 0 1
gamevar savweapxp2 0 1
gamevar savweapxp3 0 1
gamevar savweapxp4 0 1
gamevar savweapxp5 0 1
gamevar savweapxp6 0 1
gamevar savweapxp7 0 1
gamevar savweapxp8 0 1
gamevar savweapxp9 0 1
gamevar savweapxp10 0 1 // laser pistol
gamevar savweapxp11 0 1
gamevar savscore 0 1
gamevar savfirstaid_amount 0 1
gamevar savholoduke_amount 0 1
gamevar savnukes 0 1
gamevar savheat_amount 0 1
gamevar savboot_amount 0 1
gamevar savshield_amount 0 1
gamevar savscuba_amount 0 1
gamevar savsteroids_amount 0 1
gamevar savmaxplayerhealth 100 1
gamevar savmaxshield 100 1
gamevar savmaxmedkit 100 1
gamevar botlevel 0 1
gamevar savbotlevel 0 1
gamevar gogglevel 0 1
gamevar savgogglevel 0 1
gamevar nukelevel 0 1
gamevar savnukelevel 0 1
gamevar steroidlevel 0 1
gamevar savsteroidlevel 0 1

gamearray xpcaps0 10
gamearray xpcaps1 10
gamearray xpcaps2 10
gamearray xpcaps3 10
gamearray xpcaps4 10
gamearray xpcaps5 10
gamearray xpcaps6 10
gamearray xpcaps7 10
gamearray xpcaps8 10
gamearray xpcaps9 10
gamearray xpcaps10 10 // laser pistol
gamearray xpcaps11 10

gamearray attscores 70
gamearray gameids 70
// elements 0-9 are scores for episode 1
// elements 10-19 are scores for episode 2
// etc.

gamevar score 0 0
gamevar scoresaved 0 0
gamevar gameid 0 0
gamevar finished 0 0 // bitfield for finished episodes


gamevar mval 0 2
gamevar stun 0 2


gamevar hudcolor 0 1
define FULLRAGE 300
gamevar rage FULLRAGE 1
gamevar rageang 0 1
gamevar stealth 3072 1

// MAP MIRRORING AND DOUBLESIZED MAPS
gamevar mirrored NO 0
gamevar DONE 0 0
gamevar A 0 0
gamevar B 0 0
gamevar C 0 0
gamevar D 0 0
gamevar E 0 0
gamevar I 0 0
gamevar J 0 0
gamevar K 0 0
gamevar L 0 0
gamevar M 0 0

gamearray SWAPWALLS 16384
gamevar NEXTWALL1 0 0
gamevar NEXTSECTOR1 0 0
gamevar NEXTWALL2 0 0
gamevar NEXTSECTOR2 0 0

gamevar menutoggle 0 1
gamevar lastinput 0 1 // time of last menu input
gamevar cursorx 160 1
gamevar cursory 100 1
gamevar cursorang 0 1


gamevar tripbombing 0 1 // countdown timer to enable registering tripbomb damage for XP
gamevar triphack -1 1 // used for the alt-fire tripbomb
gamevar tripz 0 1

gamevar smartmonsters NO 0
gamevar storehealth STOREHEALTH 0
gamevar maxmedkit FIRSTAID_MAX 0
gamevar holodukebot HOLODUKEBOT 0
gamevar infighting 20 0 // % chance of monster in-fighting after friendly fire incident
gamevar dpsounds YES 0 // replaces some standard sounds
gamevar moretalk YES 0 // extra taunts and shit
gamevar taunt 0 1
gamevar tauntcount 0 1
gamevar stepcount 0 1

gamevar pdamage 100 0 // percent of normal damage inflicted

gamevar WEAPON1_RELOAD 0 1
gamevar PISTOLRELOAD 0 1
gamevar WEAPON4_TOTALTIME 26 1
gamevar WEAPON1_FIRESOUND PISTOL3 1

gamevar debugvar 0 0
 
gamevar randomize 1 0
gamevar tempscore 0 0 // randomize increases by 1 each time this reaches a certain number, then it resets


// TEMPORARY STORAGE
gamevar xvel 0 0
gamevar yvel 0 0
gamevar zvel 0 0
gamevar temp 0 0
gamevar tempb 0 0
gamevar tempc 0 0
gamevar tempd 0 0
gamevar tempe 0 0
gamevar picnum 0 0
gamevar spriteid 0 0
gamevar zdist 0 0
gamevar mx 0 0
gamevar my 0 0
gamevar mz 0 0
gamevar xydist 0 0
gamevar xydist2 0 0
gamevar angvar 0 0


// MISCELLANEOUS PER-ACTOR VARS

gamevar NOCODE 0 2
gamevar pal 0 2
gamevar hitag 0 2
gamevar lotag 0 2
gamevar droptile 0 2
gamevar monstflags 0 2
gamevar countvar 0 2
gamevar countvarb 0 2
gamevar mysector -1 2
gamevar peractor1 0 2
gamevar peractor3 0 2
gamevar peractor4 0 2
gamevar peractor5 0 2
gamevar peractor6 0 2
gamevar motionblur 0 2
gamevar burning 0 2
gamevar bleeding 0 2
gamevar x 0 2
gamevar y 0 2
gamevar z 0 2
gamevar initx 0 2
gamevar inity 0 2
gamevar initz 0 2
gamevar mtype 0 2
gamevar monstatus 0 2
gamevar playerally 0 2
gamevar allyhp 0 0 // total hit points of allied monsters player is controlling; herd will be culled if this gets too high
gamevar allymax 0 0
gamevar monallies 0 1 // countdown var set if there are active monster allies
gamevar target -1 2
gamevar myspawner -1 2
gamevar teleported 0 2
gamevar hp 0 2
gamevar inithp 0 2
gamevar weap 0 2
gamevar weapcount 0 2
gamevar botclip 0 2
gamevar ammo 200 2
gamevar target2 -1 2
gamevar targetlock 0 2
gamevar traillock 0 2
gamevar bouncesound -1 2
gamevar myshield -1 2
gamevar canseeplayer 0 2
gamevar canshootplayer 0 2

// new freezer vars
gamevar lastang 0 2
gamevar htg0 -1 2
gamevar htg1 -1 2
gamevar htg2 -1 2
gamevar htg3 -1 2
gamevar htg4 -1 2
gamevar htg5 -1 2
// htg_t
// 0 count
// 1 move
// 2 actioncount
// 3 animspeed
// 4 action
// 5 ai

gamevar locatorids -1 1026
gamevar position 0 2


gamearray ptrails 100
gamevar ptrailtimer 0 1

// bot following vars
gamevar prevsectstartx 0 1
gamevar prevsectstarty 0 1
gamevar prevsectstartz 0 1
gamevar lastsectstartx 0 1
gamevar lastsectstarty 0 1
gamevar lastsectstartz 0 1
gamevar cursectstartx 0 1
gamevar cursectstarty 0 1
gamevar cursectstartz 0 1
gamevar command -1 2

// player's last known location, used by monsters' advanced AI
gamevar lastseenx 0 1
gamevar lastseeny 0 1

gamevar lasttrail 99 2 // saves position of trail array that was last checked by the actor
// this allows them to check one position per tic, rather than doing it all at once
  
// hitscan vars
gamevar mysin 0 1  // The sine of the angle of the actor using hitscan
gamevar mycos 0 1
gamevar hitsector 0 1  // The sector that gets hit by the hitscan
gamevar hitwall 0 1   // The wall that gets hit by the hitscan
gamevar hitwall2 0 1
gamevar hitsprite -1 1 // The sprite that gets hit by the hitscan
gamevar scannedsprite -1 1
gamevar hitx 0 2  // The x,y,z coordinates that get hit by the hitscan
gamevar hity 0 2
gamevar hitz 0 2
gamevar clipmask 4294901808 0

gamevar bits 0 1
gamevar extbits 0 1
gamevar fpress 0 1
gamevar bpress 0 1

gamevar oposxv 0 1 // velocities from last tick
gamevar oposyv 0 1
gamevar oposzv 0 1


// dodging vars
gamevar dodge 0 1
gamevar botdodge 0 2
gamevar dodgeang 0 1
gamevar ftap 0 1
gamevar fpresstime 0 1
gamevar btap 0 1
gamevar bpresstime 0 1
gamevar ltap 0 1
gamevar lpresstime 0 1
gamevar rtap 0 1
gamevar rpresstime 0 1
gamevar fhold 0 1
gamevar bhold 0 1
gamevar lhold 0 1
gamevar rhold 0 1


// Misc. global vars
gamevar smokecount 0 0
gamevar activemonsters 0 0
gamevar timer 0 0
gamevar clearlocators 0 0
gamevar locators -1 0 // the highest locator lotag in the map

gamevar kickasscount 0 1
gamevar lastspeechtime 0 1
gamevar headsound 0 1





// WEATHER VARS
gamevar rainstart 0 0 // only set if a weather sprite is in the map
gamevar raining 0 0 // number of rain or snow sprites spawned per tick, negative when snowing
gamevar rainpal 13 0
gamevar raincstat 2 0
gamevar rainradius 32768 0
gamevar snowceiling 65536 0

// DISPLAY AND WEAPON VARS

gamevar invicon 1 1
gamevar invmsg 0 1
gamevar helmflash 0 1
gamevar bootsinuse 0 1
gamevar lastbootamount 0 1

gamevar upmsg 0 1 // bitfield
gamevar statmsg 0 1

// 1  			1007       + RATE OF FIRE
// 2			1008       CAUSES BLEEDING WOUNDS
// 4			1009	   + DAMAGE
// 8			1010       AKIMBO ABILITY
// 16			1011       STUNS
// 32			1012       + DISTANCE
// 64			1013       + KICK ENERGY
// 128			1014	   KNOCKBACK ENEMIES
// 256			1015       TIGHTER SPREAD
// 512			1016	   + PROJECTILES
// 1024		1017	   PIERCING
// 2048		1018	   + RUNNING SPEED
// 4096		1019	   + PROJECTILE SPEED
// 8192		1020	   BURNS ENEMIES
// 16384		1021	   + SECONDARY EXPLOSIONS
// 32768		1022	   + BOMBLETS
// 65536		1023	   BOMBLETS TRACK ENEMIES
// 131072		1024	   + SHRINKING POWER
// 262144		1025	   + SHRINKING TIME
// 524288 		1026	   + SHRINKING RADIUS
// 1048576		1027	   SEEKING ROCKETS
// 2097152		1028	   + BLINDING FLASHES
// 4194304		1029	   + FREEZE SPARKS ON IMPACT
// 8388608		1030	   ALTFIRE MODE
// 16777216	1031	   SHOOTS BEAM
// 33554432	1032	   ACID WOUNDS
// 67108864	1033	   + EXTRA CLONE
// 134217728	1034	 CHARGED SHOT ALTFIRE  
// 268435456	1035	   POWBALL ALTFIRE
// 536870912	1036	   + CLONING POWER
// 1073741824	1037	   COMBINATIONS 
// 2147483648   1038	   VORTEX OF DOOM

gamevar upmsgtime 0 1
gamevar upweap 0 1 // last weapon upgraded 0-12

gamevar digx 0 1
gamevar digy 0 1
gamevar digz 0 1
gamevar orientation 0 1
gamevar shade 0 1
gamevar knockdist KNOCKBACK 0
gamevar weapswitch 0 1
gamevar akimbo -1 1 
// -1 = you don't have two pistols, 0 = you have two, but you are only using one, > 0 = akimbo
gamevar useakimbo NO 0
gamevar leech 0 1 // counter for determining when a weapon leeches
gamevar regen 0 1 // regeneration counter
gamevar mybot -1 1

gamevar ttime 0 0
gamevar quotestyle 0 1 // 0 = dp style 1 = classic; 2 = mini
gamevar fta 0 1
gamevar ftq 0 1


gamevar chainsparksprite -1 1
gamevar quikpipe 0 1

gamevar superkicking 0 1
gamevar superkickdone 0 1
gamevar spinkick 0 1
gamevar reversekick 0 1
gamevar kicktarg -1 1
gamevar kickimpact 0 1 // set when the kick hits an enemy, so it only hits them once
define KENERGY 780 //650
gamevar kickenergy KENERGY 1


// various dp weapon vars
gamevar pipethrow YES 0
gamevar altshrinker 0 0
gamevar usemindblast NO 0
gamevar devshotty 1 1
gamevar gunparts 0 1
gamevar beamhit 0 1

gamevar altfreeze NO 0 // alt freezer
gamevar shotpitch 0 2
gamevar pipecontrol 1 1
gamevar dbpicnum -1 1 // used for double barreled shotgun
gamevar CURRWEAP 0 1
gamevar KICKBACKPIC 0 1
gamevar ALTCHAINGUN 0 1
// bitfield:  1 you have minigun, 2 minigun is selected, 4 in the process of switching
// 8 you have regular chaingun or mp5
gamevar MINIGUNAMMO 0 1 // saves ammo amount of either minigun or regular chaingun weapon while other is in use
gamevar grenadecounter 0 1
gamevar miniguncount 0 1
gamevar gunframe 6208 1
gamevar lastdispframe 0 1 // used for a trick to allow gun animation to be faster than tick rate
// minigun defines
define MINIFIRECOUNT 14 // The minigun begins to fire when it has spun up for this count
define MINISPEEDCOUNT 46 // The minigun fires more rapidly at this count
define MAXSPIN 52 // The maximum amount of spin build up (making this higher makes it take longer to spin down)

gamevar LASERAMMO 0 1 // laser replaces mighty boot when > 0
gamevar LASERFIRE 0 1 // counter that acts as a fake weaponcount/kickback_pic for the laser gun
gamevar LASERCHARGE 0 1

state redefinequotes
redefinequote  2        ACTIVATED
redefinequote  3        ^8PORTABLE MEDKIT
redefinequote  4        LOCKED
redefinequote  6        ^8BOOTS
redefinequote 12        ^23USED STEROIDS
redefinequote 14        ^2AMMO FOR DEVASTATOR
redefinequote 19        ^8ATOMIC HEALTH!
redefinequote 37        ^8STEROIDS
redefinequote 38        ^8ARMOR
redefinequote 39        ^8SCUBA GEAR
redefinequote 41        ^8JETPACK
redefinequote 47        ^23HOLODUKE ON
redefinequote 48        ^23HOLODUKE OFF
redefinequote 51        ^8HOLODUKE
redefinequote 52        ^23JETPACK ON
redefinequote 53        ^23JETPACK OFF
redefinequote 54        ^7CHAINGUN CANNON!
redefinequote 55        ^2PIPEBOMB!
redefinequote 56        ^7ROCKET LAUNCHER!
redefinequote 57        ^7SHOTGUN
redefinequote 58        ^2LASER TRIPBOMB!
redefinequote 59        ^7FREEZETHROWER!
redefinequote 60        ^7GOT SHRINKER/EXPANDER!
redefinequote 61        ^8SMALL MEDKIT
redefinequote 62        ^8LARGE MEDKIT
redefinequote 63        ^2AMMO FOR CHAINGUN CANNON!
redefinequote 64        ^2AMMO FOR RPG!
redefinequote 65        ^2AMMO FOR PISTOL!
redefinequote 66        ^2AMMO FOR FREEZETHROWER!
redefinequote 69        ^2AMMO FOR SHOTGUN
redefinequote 70        ^1BLUE ACCESS CARD REQUIRED
redefinequote 71        ^10RED ACCESS CARD REQUIRED
redefinequote 72        ^7YELLOW ACCESS CARD REQUIRED
redefinequote 75        ^23PROTECTIVE BOOTS ON
redefinequote 76        ^23SCUBA GEAR ON
redefinequote 78        ^2AMMO FOR SHRINKER
redefinequote 87        ^7DEVASTATOR WEAPON
redefinequote 88        ^8JET PACK
redefinequote 89        ^8AIRTANK
redefinequote 90        ^8STEROIDS
redefinequote 91        ^8HOLODUKE
redefinequote 101       ^8INVISI-GOGGLES
redefinequote 104       ^8GOT USED ARMOR
redefinequote 106       ^23INVISI-GOGGLES ON
redefinequote 107       ^23INVISI-GOGGLES OFF
redefinequote 123       ^2AMMO FOR EXPANDER
ends

definequote 1000       ^8PLAYER HEALED BY MEDIC
definequote 1001       ^8DUKEBOT HEALED BY MEDIC
definequote 1002       A DUKEBOT HAS DIED
definequote 1003       ^8NUKES
definequote 1004       A DUKEBOT WAS SQUISHED!
definequote 1005       UPGRADES
definequote 1006       
definequote 1007       ^7+ RATE OF FIRE
definequote 1008       ^10BLEEDING WOUNDS
definequote	1009	   ^21+ DAMAGE
definequote	1010       ^11AKIMBO ABILITY
definequote	1011       STUNS
definequote	1012       ^7+ DISTANCE
definequote	1013       ^7+ KICK ENERGY
definequote	1014	   ^14KNOCKBACK
definequote	1015       ^7TIGHTER SPREAD
definequote	1016	   ^21+ PROJECTILES
definequote	1017	   ^11PIERCING
definequote	1018	   ^7+ RUNNING SPEED
definequote	1019	   ^11+ SHOT SPEED
definequote	1020	   ^21BURNS ENEMIES
definequote	1021	   ^21+ EXPLOSIONS
definequote	1022	   + BOMBLETS
definequote	1023	   BOMBLETS SEEK
definequote	1024	   ^8+ SHRINK POWER
definequote	1025	   ^8+ SHRINK TIME
definequote 1026	   ^8+ SHRINK RADIUS
definequote	1027	   ^11ROCKETS SEEK
definequote	1028	   BLINDING FLASH
definequote	1029	   ^1+ FREEZE SPARKS
definequote	1030	   ^11ALTFIRE MODE
definequote	1031	   ^16SHOOTS BEAM
definequote	1032	   ^8ACID WOUNDS
definequote	1033	   + EXTRA CLONE
definequote	1034	   ^6CHARGED ALTFIRE
definequote	1035	   ^6POWBALL ALTFIRE
definequote	1036	   + CLONING POWER
definequote	1037	   ^15COMBINATIONS
definequote 1038	   VORTEX OF DOOM
definequote 1039	  
definequote 1040	   
definequote 1041	   
definequote 1042	   
definequote 1043	   
definequote 1044	
definequote 1045	
definequote 1046	
definequote 1047	
definequote 1048	^6INCREASED CLOAK POWER!
definequote 1049	^6INCREASED NUKE POWER
definequote 1050	^8+1 MAX HEALTH!
definequote 1051	^8+2 MAX ARMOR!
definequote 1052	^8+ MAX AMMO!
definequote 1053	^8+ MEDICAL SKILL
definequote 1054	^6NUKE ENERGY!
definequote 1055	^10DUKEBOT UPGRADED!
definequote 1056	^8STEROIDS UPGRADED!
definequote 1057    DEATH RAGE
definequote 1058	^11GAME AUTOSAVED SLOT 10
definequote 1059	^10 DUKEBOT ENERGY!
definequote 1060	^8BACKBACK CONTAINED AMMO
definequote 1061    HIGH SCORES
definequote 1062    RESTART MISSION
definequote 1063	< PRESS %s TO RESUME GAME >
definequote 1064	< PRESS %s TO ACCESS MENU >
// leave 1065, 1066 blank
definequote 1065	
definequote 1066	
definequote 1067	INVENTORY UPGRADES
definequote 1068	ATTSCORES
definequote 1069	WEAPON MASTERY BONUS
definequote 1070	FAST WEAPON SWITCHING
definequote 1071	LIFE LEECH
definequote 1072    ULTIMATE NUKE POWER
definequote 1073    IMPROVED LIFE LEECH
definequote 1074    AUTOSAVE:  YES
definequote 1075    AUTOSAVE:  NO
definequote 1076	TIMER MODE
definequote 1077	TRIGGER MODE
definequote 1078	SHRINKER MODE
definequote 1079	MIND BLAST MODE
definequote 1080    
definequote 1081    
definequote 1082    
definequote 1083    SHOTGUN DEVASTATOR
definequote 1084    ROCKET DEVASTATOR
definequote 1085    
definequote 1086    
definequote 1087    
definequote 1088    MONSTER CAPTURED!
definequote 1089    ^8GOT EMPTY MONCAPSULE!
definequote 1090    ^2GOT LOADED MONCAPSULE
definequote 1091    MONCAPSULE
definequote 1092    EMPTY
definequote 1093    STRENGTH
definequote 1094    ^7CAPTURE STRENGTH INCREASED!
definequote 1095    MISSION ONE
definequote 1096    MISSION TWO
definequote 1097    MISSION THREE
definequote 1098    MISSION FOUR
definequote 1099    MISSION FIVE
definequote 1100    MISSION SIX
definequote 1101    MISSION SEVEN
definequote 1102    MISSION EIGHT
definequote 1103    MISSION NINE
definequote 1104    MISSION TEN
definequote 1105    MISSION ELEVEN
definequote 1106    MISSION TWELVE
definequote 1107    MISSION THIRTEEN
definequote 1108    MISSION FOURTEEN
definequote 1109    MISSION FIFTEEN
definequote 1110    MISSION SIXTEEN
definequote 1111    MISSION SEVENTEEN
definequote 1112    MISSION EIGHTEEN
definequote 1113    MISSION NINETEEN
definequote 1114    MISSION TWENTY
definequote 1115    
definequote 1116    
definequote 1117    
definequote 1118    ^7GOT PISTOL!
definequote 1119    
definequote 1120    
definequote 1121    
definequote 1122    
definequote 1123    KICK ENERGY
definequote 1124    RANDOM MISSIONS
definequote 1125    RANDOM MISSIONS 2
definequote 1126    RANDOM MISSIONS 3
definequote 1127    RANDOM MISSIONS 4
definequote 1128    ORIGINAL LEVELS PART ONE
definequote 1129    ORIGINAL LEVELS PART TWO
definequote 1130    
definequote 1131    
definequote 1132    
definequote 1133    
definequote 1134    
definequote 1135    
definequote 1136    
definequote 1137    
definequote 1138    
definequote 1139    
definequote 1140    
definequote 1141    
definequote 1142    
definequote 1143    
definequote 1144    
definequote 1145    
definequote 1146    CHARGE
definequote 1147    BATTERY
definequote 1148    GOT LASER PISTOL!
definequote 1149    
definequote 1150    
definequote 1151    
definequote 1152    
definequote 1153    
definequote 1154    
definequote 1155    
definequote 1156    
definequote 1157    
definequote 1158    
definequote 1159    
definequote 1160    
definequote 1161    
definequote 1162    
definequote 1164    
definequote 1165    ^7BATTLELORD AUTO CANNON!
definequote 1166    ^2AUTO CANNON AMMO!


move SPARKMOVE 192
move SLOWSPARK 96
move SPARKUP 96 -96
move SPARKDOWN 96 96
useractor notenemy SPARKPROJ 0
ifcount 9 killit
enda

useractor notenemy SPARK2 0
ifmove 0
{
	getactor[THISACTOR].ang angvar
	addvar angvar 512
	randvar temp 1024
	addvarvar angvar temp
	setactor[THISACTOR].ang angvar
	cstat 128
	sizeat 8 8
	ifrnd 85
	move SPARKUP geth
	else
	ifrnd 128
	move SPARKUP getv geth
	else
	move SPARKDOWN getv geth
}
sizeto 0 0
//sizeto 0 0
//sizeto 0 0
//sizeto 0 0
enda

useractor notenemy SPARK3 0
ifmove 0
{
	move SPARKMOVE randomangle
	sizeat 96 96
}
ifcount 1
{
	sizeto 0 0
	sizeto 0 0
}
enda

action LIGHTNINGFRAME 3491 1 1 1 1
//action ELECTROFRAMES -2 1 1 1 2

useractor notenemy ELECTROSPAWN 0 LIGHTNINGFRAME

ifmove 0
{
	move INIT
	sizeat 32 64
	ifrnd 128 cstator 4
	cstator 128
	sound 351
	
	ifvare countvar 0
	{
		whilevarn countvar 3
		{
			addvar countvar 1
			espawn ELECTROSPAWN
			setactorvar[RETURN].countvar countvar
		}
	}
}
getactor[THISACTOR].x x
getactor[THISACTOR].y y
randvar temp 256
ifrnd 128 addvarvar x temp else subvarvar x temp
randvar temp 256
ifrnd 128 addvarvar y temp else subvarvar y temp
setactor[THISACTOR].x x
setactor[THISACTOR].y y

ifactioncount 12 killit

ifrnd 64
	hitradius 640 10 10 10 10

enda

spritenoshade RAILTRAIL
action RAILTRAILFRAMES -6629 6 1 1 4
useractor notenemy RAILTRAIL TOUGH RAILTRAILFRAMES

ifvare countvar 0
{
	cstator 130
	ifrnd 128 cstator 4
	ifrnd 128 cstator 8
	sizeat 3 3
	setvar countvar 1
}

ifactioncount 6 killit

enda


spritenoshade RAILHIT
action RAILHITFRAMES -6628 6 1 1 6
useractor notenemy RAILHIT TOUGH RAILHITFRAMES

ifvare countvar 0
{
	setvar countvar 1
	cstator 130
	ifrnd 128 cstator 4
	ifrnd 128 cstator 8
	sizeat 24 24
	spritepal 19
	ifcansee flash
}


ifactioncount 6 killit

enda

// 0 DEFAULT
// 1 WOOD
// 2 TIN
// 3 GRATE
// 4 GRASS
// 5 TILE
// 6 CARPET
// 7 CONCRETE
// 8 SNOW
// 9 WATER
// 10 ELECTRONIC
// 11 ORGANIC

gamevar STEPSOUNDFX 0 1
gamevar FLOORTEX 0 1
gamevar FOOTSTEPCOUNT 0 1

state CHECKSTEPS

setvar STEPSOUNDFX 0

switch FLOORTEX

case 0 setvar STEPSOUNDFX 0 break

case 70 case 370 case 735 case 745 case 749 case 821 case 822 case 879 case 880 case 884
case 1188 case 1200 case 1201 case 4110 case 4111 case 4303 case 4428 case 1170
// DC steps
case 3684 case 3685 case 3691

setvar STEPSOUNDFX 1 break

case 150 case 151 case 152 case 153 case 154 case 155 case 156 case 157 case 158 case 159
case 182 case 195 case 196 case 216 case 218 case 220 case 221 case 222 case 223 case 224
case 226 case 227 case 231 case 232 case 242 case 243 case 244 case 257 case 258 case 259
case 278 case 283 case 284 case 285 case 286 case 287 case 288 case 289 case 290 case 291
case 292 case 294 case 295 case 296 case 300 case 302 case 303 case 309 case 311 case 312 
case 313 case 314 case 315 case 317 case 318 case 319 case 322 case 325 case 327 case 342 case 344 
case 345 case 346 case 347 case 348 case 350 case 354 case 365 case 366 case 369 case 378 
case 379 case 380 case 381 case 382 case 383 case 384 case 385 case 392 case 393 case 394 
case 395 case 396 case 397 case 399 case 400 case 412 case 413 case 418 case 419 case 420 
case 441 case 442 case 447 case 448 case 449 case 450 case 451 case 452 case 453 case 454 
case 455 case 456 case 457 case 458 case 459 case 460 case 467 case 469 case 470 case 471 
case 513 case 514 case 515 case 609 case 665 case 709 case 711 case 715 case 717 case 736 
case 737 case 738 case 739 case 754 case 755 case 756 case 767 case 795 case 797 case 798 
case 829 case 843 case 883 case 886 case 913 case 962 case 946 case 947 case 948 
case 1024 case 1097 case 1098 case 1099 case 1102 case 1103
case 1107 case 1108 case 1109 case 1110 case 1117 case 1118 case 1119 case 1120 case 1124
case 1144 case 1173 case 1178 case 1179 case 1187 case 1190 case 4097 case 4098
case 4099 case 4105 case 4106 case 4108 case 4109 case 4117 case 4118 case 4119 case 4162
case 4163 case 4164 case 4165 case 4168 case 4201 case 4202 case 4206 case 4276 case 4277
case 4278 case 4279 case 4282 case 4283 case 4284 case 4285 case 4286 case 4287 case 4288
case 4300 case 4301 case 4302 case 4304 case 4305 case 4308 case 4309 case 4310 case 4330
case 4331 case 4334 case 4335 case 4349 case 4350

// DC steps
case 3693 case 3694 case 3727 case 3779

setvar STEPSOUNDFX 2 break

case 183 case 710 case 915 case 4154 case 4155
// DC steps
case 3712 case 3732

setvar STEPSOUNDFX 3 break

case 803 setvar STEPSOUNDFX 4 break

case 186 case 187 case 188 case 189 case 190 case 191 case 192 case 332 case 720 case 857 case 4102
case 246
// DC steps
case 3692

setvar STEPSOUNDFX 5 break

case 1219 // could be grass or carpet
getsector[THISACTOR].floorpal temp
ifvare temp 0
ifoutside setvar STEPSOUNDFX 4
else setvar STEPSOUNDFX 6
break

case 331 
case 545 case 898 case 899 case 900 case 1218
// DC steps
case 3604 case 3612 case 3613 case 3614 case 3615 case 3616

setvar STEPSOUNDFX 6 break

case 181 case 184 case 197 case 207 case 209 case 236 case 237 
case 238 case 239 case 240 case 251 case 252
case 334 case 335 case 349 case 367 case 368 case 372 
case 376 case 377 case 414 case 417 case 429 case 430 case 431 case 432 
case 433 case 434 case 435 case 437 case 461 case 465 case 466 case 468 
case 478 case 718 case 723 case 724 case 725 case 734 case 742 
case 743 case 747 case 748 case 750 case 757 case 759 case 760 
case 761 case 763 case 764 case 770 case 772 case 773 case 775 case 780 
case 781 case 782 case 783 case 790 case 793 case 794 case 796 case 799 case 800 
case 801 case 802 case 804 case 805 case 812 case 814 case 815 case 816 
case 817 case 818 case 819 case 823 case 824 case 825 case 827 case 828 
case 852 case 853 case 859 case 876 case 887 case 893 case 894 
case 895 case 1169 case 1171 case 1182 case 1183 case 1184 case 1185 
case 1186 case 1189 case 1191 case 1193 case 1204 case 1205 case 1279 case 2922 
case 3381 case 3384 case 3385 case 3386 case 3387 case 3394 case 3395 case 3396 
case 3398 case 3407 case 4112 case 4151 case 4152 case 4190 case 4208 
case 4210 case 4211 case 4212 case 4213 case 4214 case 4215 case 4216 case 4217 
case 4218 case 4219 case 4220 case 4221 case 4222 case 4223 case 4234 case 4235 
case 4236 case 4255 case 4259 case 4319 case 4320 case 4321 
case 4322 case 4323 case 4332 case 4333 case 5065 case 5066 case 5067 case 5068 
case 5069 case 5070 case 5071 case 5072 case 5073 case 5074 case 5075 case 5076 
case 5077 case 5078 case 5083

setvar STEPSOUNDFX 7 break

case 3416
getsector[THISACTOR].floorpal temp
ifvare temp 0
setvar STEPSOUNDFX 8
else ifvare temp 6 setvar STEPSOUNDFX 4
else setvar STEPSOUNDFX 7
break

case 241
ifvare sector[THISACTOR].floorpal 0
ifvarl sector[THISACTOR].floorshade 10
ifoutside
setvar STEPSOUNDFX 8
else ifvare temp 6 setvar STEPSOUNDFX 4
else setvar STEPSOUNDFX 7
break

case 336 case 337 case 338 case 889 case 890 case 891 case 892

setvar STEPSOUNDFX 9 break

case 203 case 268 case 269 case 270 case 271 case 272 case 273 case 274
case 293 case 297 case 298 case 299 case 357 case 358 case 359 
case 360 case 361 case 362 case 363 case 426 case 427 case 428
case 806 case 4127 case 4130 case 4131 case 4132 case 4133 case 4134
case 4135 case 4136 case 4137 case 4138 case 4139 case 4140
case 4141 case 4142 case 4143 case 4144 case 4145 case 4146 case 4147
case 4924 case 4932

ifactor BULLETHOLE setvar STEPSOUNDFX 10 else
ifactor SHOTSPARK1 setvar STEPSOUNDFX 10 else
ifactor 1 setvar STEPSOUNDFX 10 else
ifactor 2 setvar STEPSOUNDFX 10 else
setvar STEPSOUNDFX 7

break

case 1116 case 1130 case 1131 case 1137 case 1139 case 1140 case 1141
case 5079 case 5080 case 5099 case 5102
setvar STEPSOUNDFX 11

break
default break
endswitch

ends

state STOPSTEPSOUNDS
stopsound DUKE_LAND
stopsound STEP1
stopsound STEP2
stopsound STEP3
stopsound STEP4
stopsound WOOD1
stopsound WOOD2
stopsound WOOD3
stopsound WOOD4
stopsound TIN1
stopsound TIN2
stopsound TIN3
stopsound TIN4
stopsound GRATES1
stopsound GRATE2
stopsound GRATE3
stopsound GRATE4
stopsound GRASS1
stopsound GRASS2
stopsound GRASS3
stopsound GRASS4
stopsound TILE1
stopsound TILE2
stopsound TILE3
stopsound TILE4
stopsound CARPET1
stopsound CARPET2
stopsound CARPET3
stopsound CARPET4
stopsound SNOW1
stopsound SNOW2
stopsound SNOW3
stopsound SNOW4
ends

state getfloorz
   getactor[THISACTOR].x x
   getactor[THISACTOR].y y
   updatesector x y mysector
   ifvare mysector -1 getsector[THISACTOR].floorz z
   else
   getflorzofslope mysector x y z
ends


state landsounds
ifvare STEPSOUNDFX 1 { soundonce LANDWOOD  } else
ifvare STEPSOUNDFX 2 { soundonce LANDMETAL  } else
ifvare STEPSOUNDFX 3 { soundonce LANDMETAL  } else
ifvare STEPSOUNDFX 4 { soundonce LANDDIRT } else
ifvare STEPSOUNDFX 7 { soundonce LANDNORMAL  } else
ifvare STEPSOUNDFX 8 { soundonce LANDSNOW  } else
ifvare STEPSOUNDFX 9 { soundonce LANDWATER  } else
ifvare STEPSOUNDFX 11 { soundonce JIBLAND  } else
{  soundonce LANDNORMAL  }
ends

state stepsounds

randvar FOOTSTEPCOUNT 3
switch STEPSOUNDFX	
		case 0
		case 7
		ifvare FOOTSTEPCOUNT 0 sound STEP1 else
		ifvare FOOTSTEPCOUNT 1 sound STEP2 else
		ifvare FOOTSTEPCOUNT 2 sound STEP3 else
		ifvare FOOTSTEPCOUNT 3 sound STEP4
		break
		
		case 1
		ifvare FOOTSTEPCOUNT 0 sound WOOD1 else
		ifvare FOOTSTEPCOUNT 1 sound WOOD2 else
		ifvare FOOTSTEPCOUNT 2 sound WOOD3 else
		ifvare FOOTSTEPCOUNT 3 sound WOOD4
		break
		
		case 2
		ifvare FOOTSTEPCOUNT 0 sound TIN1 else
		ifvare FOOTSTEPCOUNT 1 sound TIN2 else
		ifvare FOOTSTEPCOUNT 2 sound TIN3 else
		ifvare FOOTSTEPCOUNT 3 sound TIN4
		break
		
		case 3
		ifvare FOOTSTEPCOUNT 0 sound GRATES1 else
		ifvare FOOTSTEPCOUNT 1 sound GRATE2 else
		ifvare FOOTSTEPCOUNT 2 sound GRATE3 else
		ifvare FOOTSTEPCOUNT 3 sound GRATE4
		break
		
		case 4
		ifvare FOOTSTEPCOUNT 0 sound GRASS1 else
		ifvare FOOTSTEPCOUNT 1 sound GRASS2 else
		ifvare FOOTSTEPCOUNT 2 sound GRASS3 else
		ifvare FOOTSTEPCOUNT 3 sound GRASS4
		break
		
		case 5
		ifvare FOOTSTEPCOUNT 0 sound TILE1 else
		ifvare FOOTSTEPCOUNT 1 sound TILE2 else
		ifvare FOOTSTEPCOUNT 2 sound TILE3 else
		ifvare FOOTSTEPCOUNT 3 sound TILE4
		break
		
		case 6
		ifvare FOOTSTEPCOUNT 0 sound CARPET1 else
		ifvare FOOTSTEPCOUNT 1 sound CARPET2 else
		ifvare FOOTSTEPCOUNT 2 sound CARPET3 else
		ifvare FOOTSTEPCOUNT 3 sound CARPET4
		break
		
		case 8
		ifvare FOOTSTEPCOUNT 0 sound SNOW1 else
		ifvare FOOTSTEPCOUNT 1 sound SNOW2 else
		ifvare FOOTSTEPCOUNT 2 sound SNOW3 else
		ifvare FOOTSTEPCOUNT 3 sound SNOW4
		ifactor APLAYER
		{
			  setplayer[THISACTOR].footprintcount 2
			  setplayer[THISACTOR].footprintpal 13
			  setplayer[THISACTOR].footprintshade 0
		}
		break
		
		case 9 
		// soundonce DUKE_ONWATER
		break // STEPSOUNDFX 9 IS FOR WATER
		
		default 
		ifvare FOOTSTEPCOUNT 0 sound STEP1 else
		ifvare FOOTSTEPCOUNT 1 sound STEP2 else
		ifvare FOOTSTEPCOUNT 2 sound STEP3 else
		ifvare FOOTSTEPCOUNT 3 sound STEP4
		break	
		endswitch	
	resetactioncount
ends

state stepsoundstuff

getsector[THISACTOR].floorpicnum FLOORTEX

ifinwater break
ifonwater break
ifp pfalling break

ifp pjetpack break
ifvarn dodge 0 break

state CHECKSTEPS // CHECKS THE STEP DEFINES

ifp pducking break
ifp pstanding { setvar stepcount 32000 break }

// ifactioncount 2 nullop else break

// setvar temp 0
// ifp prunning setvar temp 1
// ifp pwalking setvar temp 1
// ifp pducking setvar temp 0

// ifvare temp 1

getplayer[THISACTOR].posxv mx
divvar mx 644
mulvarvar mx mx
getplayer[THISACTOR].posyv my
divvar my 644
mulvarvar my my
addvarvar mx my
sqrt mx mx
addvarvar stepcount mx

ifvarg stepcount 32768
{
	subvar stepcount 32768
	getplayer[THISACTOR].spritebridge temp // IF THE PLAYER IS ON A FLAT SPRITE
	ifvare temp 1 
	{ 
		getplayer[THISACTOR].sbs tempb // GET THE FLATSPRITE'S ID TAG
		getactor[tempb].picnum temp // CHECK IT'S TEXTURE
		setvarvar FLOORTEX temp // SET THE VARIABLE FLOORTEX TO IT'S TEXTURE
		
	}
	
	
	state stepsounds
}

ends

state HITMETALSOUND

randvar temp 4
switch temp
case 0
	sound HITMETAL break
case 1
	sound HITMETAL2 break
case 2
	sound HITMETAL3 break
case 3
	sound HITMETAL4 break
case 4
	sound HITMETAL5 break
default break
endswitch


ends

state HITSTONESOUND

randvar temp 4
switch temp
case 0
	sound HITSTONE break
case 1
	sound HITSTONE2 break
case 2
	sound HITSTONE3 break
case 3
	sound HITSTONE4 break
case 4
	sound HITSTONE5 break
default break	
endswitch

ends

state WOODHITSOUND

randvar temp 4
switch temp
case 0
	sound HITWOOD break
case 1
	sound HITWOOD2 break
case 2
	sound HITWOOD3 break
case 3
	sound HITWOOD4 break
case 4
	sound HITWOOD5 break
default break
endswitch


ends

state HITDIRTSOUND

randvar temp 2
switch temp
case 0
	sound HITDIRT break
case 1
	sound HITDIRT2 break
case 2
	sound HITDIRT3 break
default break
endswitch


ends

state HITWATERSOUND

randvar temp 2
switch temp
case 0
	sound HITWATER break
case 1
	sound HITWATER2 break
case 2
	sound HITWATER3 break
default break
endswitch


ends

state shootscrap

getactor[THISACTOR].picnum x
cactor ROTATEGUN
getactor[THISACTOR].ang angvar
addvar angvar 1024
randvar temp 480
ifrnd 128 mulvar temp -1
addvarvar angvar temp
setactor[THISACTOR].ang angvar
randvar zdist 2048
ifrnd 128 mulvar zdist -1
subvar zdist 1024
ezshootvar zdist monstflags
randvar temp 24
ifvare monstflags NEWSCRAP3 addvar temp 12
setthisprojectile[RETURN].vel temp
ifvare monstflags NEWSCRAP3
{
	setactor[RETURN].xrepeat 18
	setactor[RETURN].yrepeat 12	
}
else ifvare monstflags NEWSCRAP4
{
	setactor[RETURN].xrepeat 24
	setactor[RETURN].yrepeat 16
}

setactor[THISACTOR].picnum x
ends

spritenoshade SPARKFALL
move DRIFT 64

useractor notenemy SPARKFALL 0

ifmove 0
{
	move DRIFT geth
	ifspawnedby SHOTSPARK1 sizeat 2 2 else
	sizeat 3 3
	setactor[THISACTOR].shade -127
	randvar mtype 512
	subvar mtype 1024
}

movesprite THISACTOR 0 0 mtype CLIPMASK0 RETURN
iffloordistl 8
{
	ifvare peractor1 1 killit
	ifrnd 128 killit else
	{
		setvar peractor1 1
		getactor[THISACTOR].z z
		subvar z 1024
		setactor[THISACTOR].z z
		setactor[THISACTOR].zvel -1024
		setvar mtype 0
	}
}
addvar mtype 160
ifvarg mtype 3072 ifrnd 16 killit
ifcount 6 sizeat 2 2
ifcount 13 sizeat 1 1
ifnotmoving ifcount 3 { resetcount move SLOWSPARK randomangle ifrnd 64 killit }

enda

state sparkstate

randvar monstatus 2
addvar monstatus 1
setvar hp 0
getactor[THISACTOR].picnum x
cactor ROTATEGUN
getactor[THISACTOR].ang peractor1
whilevarvarn hp monstatus
{
	addvar hp 1
	ifvare x SHOTSPARK1
	{
		setvarvar angvar peractor1
		addvar angvar 512
		randvar temp 1024
		addvarvar angvar temp
		setactor[THISACTOR].ang angvar
	}
	else
	{
		randvar angvar 2047
		setactor[THISACTOR].ang angvar
	}
	randvar zdist 3072
	// ifrnd 128 
	mulvar zdist -1
	//zshoot zdist SPARKPROJ
	espawn SPARKFALL
	setactor[RETURN].zvel zdist
	setactor[RETURN].htpicnum x
}
setactor[THISACTOR].ang peractor1	
setactor[THISACTOR].picnum x
ends

state BULLETHITSOUNDS

switch STEPSOUNDFX
case 0
break

case 1
case 5
	state WOODHITSOUND
	setvar monstflags NEWSCRAP4
	ifrnd 128 state shootscrap
	break
case 2
case 3
	state HITMETALSOUND
	state sparkstate
	break
	
case 4
case 8
	state HITDIRTSOUND
 break

case 7
	state HITSTONESOUND
	setvar monstflags NEWSCRAP3
	ifrnd 128 state shootscrap 
	break
case 9
	state HITWATERSOUND break
case 10
	state HITSTONESOUND
	state sparkstate
	break
case 11
    sound HITFLESH 
    spritepal 6
    espawn JIBS6
	setactor[RETURN].xrepeat 32
	setactor[RETURN].yrepeat 32
	setactor[RETURN].zvel 0
	//guts JIBS6 1
    break
default break
endswitch

ends

state pythagoras
// next code gets distance between (x,y) and (hitx,hity), puts result in xydist

setvarvar xydist x
subvarvar xydist hitx
mulvarvar xydist xydist
setvarvar tempb y
subvarvar tempb hity
mulvarvar tempb tempb
addvarvar xydist tempb
sqrt xydist xydist

ends


state movespriteprep

changespritestat THISACTOR 1
getplayer[THISACTOR].posx mx
getplayer[THISACTOR].posy my
getactor[THISACTOR].x x
getactor[THISACTOR].y y
subvarvar mx x
subvarvar my y
getangle angvar mx my
cos xvel angvar
sin yvel angvar

ends

spritenoshade NEWBLOOD1
spritenoshade NEWBLOOD2
spritenoshade NEWBLOOD3
spritenoshade NEWBLOOD4
spritenoshade NEWBLOOD5


move ITEMFLY 384
move ITEMFLY2 480
move ITEMSHOOT 1536 //2048

state moveitem

setactor[THISACTOR].htcgg 0

ifmove 0
	 move INIT

ifvarg peractor4 0 
{
	getactor[THISACTOR].clipdist temp
	ifvarl temp 48 clipdist 48
	ifactor 1769 ifrnd 16 spawn NEWBLOOD1
	ifactor 2202 ifrnd 16 spawn NEWBLOOD1
	ifmove ITEMFLY nullop else ifmove ITEMSHOOT nullop else ifmove ITEMFLY2 nullop else
	{
		
		ifvare peractor4 13 move ITEMFLY geth else
		move ITEMFLY2 geth
		spriteflags 16
		ifvare peractor4 13 // for when thrown by an enemy
		{
			setactor[THISACTOR].zvel -1024
		}
		
	}
	
	getactor[THISACTOR].htmovflag RETURN	
	ifvare RETURN 0
	{
		findnearactorz SHOOTME 480 10240 spriteid 
		ifvarn spriteid -1 { getactorvar[spriteid].myspawner RETURN subvar RETURN 16384 }
	}
	ifvarn RETURN 0 
	{
		// hit something
		addvar RETURN 16384
        ifvarl RETURN 16384
        

	    ifmove ITEMFLY2 move ITEMFLY geth 
	    else
	    {
		    getactor[THISACTOR].owner spriteid
		    ifvarvarn RETURN spriteid
	    	ifvarg peractor4 1 setvar peractor4 1
    	}
	}
	iffloordistl 4 
	{
		ifvarg peractor4 6
		{
			subvar peractor4 2
			ifvarn bouncesound -1 soundvar bouncesound
			getactor[THISACTOR].z z
			subvar z 1024
			setactor[THISACTOR].z z
			setvarvar temp peractor4
			mulvar temp -64
			setactor[THISACTOR].zvel temp
		}
	}
	subvar peractor4 1
	iffloordistl 2 nullop else 
	ifvarn sprite[THISACTOR].picnum ATOMICHEALTH
	ifvare peractor4 0 setvar peractor4 1
	ifvare peractor4 0
		move INIT
	
}

ends