spritenoshade STAFFPROJ
defineprojectile STAFFPROJ PROJ_WORKSLIKE 65538
defineprojectile STAFFPROJ PROJ_HITRADIUS 1024
defineprojectile STAFFPROJ PROJ_VEL 200
defineprojectile STAFFPROJ PROJ_VEL_MULT 6
defineprojectile STAFFPROJ PROJ_SPAWNS EXPLOSION6
defineprojectile STAFFPROJ PROJ_ISOUND EXPLODFS
defineprojectile STAFFPROJ PROJ_SXREPEAT 32
defineprojectile STAFFPROJ PROJ_SYREPEAT 32
defineprojectile STAFFPROJ PROJ_XREPEAT 48
defineprojectile STAFFPROJ PROJ_YREPEAT 48
defineprojectile STAFFPROJ PROJ_CSTAT 130

spritenoshade STAFFALTPROJ

defineprojectile STAFFALTPROJ PROJ_WORKSLIKE 32770 //36866
defineprojectile STAFFALTPROJ PROJ_EXTRA 10 
defineprojectile STAFFALTPROJ PROJ_ISOUND EXPLODUS
defineprojectile STAFFALTPROJ PROJ_HITRADIUS 0
defineprojectile STAFFALTPROJ PROJ_SPAWNS -1
defineprojectile STAFFALTPROJ PROJ_VEL 200
defineprojectile STAFFALTPROJ PROJ_VEL_MULT 6
defineprojectile STAFFALTPROJ PROJ_CLIPDIST 32
defineprojectile STAFFALTPROJ PROJ_XREPEAT 4
defineprojectile STAFFALTPROJ PROJ_YREPEAT 4
defineprojectile STAFFALTPROJ PROJ_CSTAT 130

gamevar WEAPON8_WORKSLIKE 11 1
gamevar WEAPON8_FIREDELAY 81 1
gamevar WEAPON8_FLAGS 65536 1
gamevar WEAPON8_SHOOTS -1 1

state qav_initframes8
setvarvar WEAPON8_TOTALTIME qav_maxframes
mulvarvar WEAPON8_TOTALTIME qav_tpf
divvarvar WEAPON8_TOTALTIME 4
setvarvar qav_frame player[THISACTOR].kickback_pic
mulvarvar qav_frame 4
divvarvar qav_frame qav_tpf
ends

state weaponhellstaffgame
ifactor HELLSTAFF
{
	getactor[THISACTOR].hitag HITAGSAVED
	ifvare HITAGSAVED 1
	{
		getactor[THISACTOR].htextra htextra
		getactor[THISACTOR].htang htang
		ifvarg htextra 0 
		{
			subvarvar hellextra htextra
			setvarvar in1 htang 
			setvarvar in2 htextra 
			mulvarvar in2 32
			setvarvar in3 0
			
			state physics_start
			state phys_reset_vel
			state phys_add_vel_ang
			state physics_end		
			
			setactorvar[THISACTOR].phys_air_damping_x 1350
			setactorvar[THISACTOR].phys_air_damping_y 1350
			setactorvar[THISACTOR].phys_air_damping_z 1350	

			setactorvar[THISACTOR].phys_wall_damping_x 1350 
			setactorvar[THISACTOR].phys_wall_damping_y 1350
			setactorvar[THISACTOR].phys_wall_damping_z 1350 		
			
			setactorvar[THISACTOR].phys_gravity_x 0 
			setactorvar[THISACTOR].phys_gravity_y 0
			randvar tmp 200
			addvar tmp 400
			setactorvar[THISACTOR].phys_gravity_z tmp
			setactor[THISACTOR].htextra 0
		}
		
		state physics_start
		state physics_interact_air
		state physics_move
		state physics_interact_walls
		state physics_end
	}
}

ifactor STAFFPROJ 
{ 
	getactor[THISACTOR].mdflags  tmp
	orvar  tmp 16
	setactor[THISACTOR].mdflags  tmp

	ifrnd 128 state newfirestate 
}
ifactor STAFFALTPROJ
{
	getactor[THISACTOR].mdflags  tmp
	orvar  tmp 16
	setactor[THISACTOR].mdflags  tmp
	state sparkstate state sparkstate
}
ends

state hellstaffaltstate
ifvare CURRWEAP 8
{
	ifvare player[THISACTOR].weapon_pos 0
	ifp palive
	{
		getplayer[THISACTOR].kickback_pic temp
		ifvare temp 0
		{
			espawn HELLSTAFF
			setvarvar HELLSTAFFID RETURN
			sound TNTTOSS
			setactor[RETURN].cstat 257
			setactor[RETURN].hitag 1
			getplayer[THISACTOR].i r0
			setactorvar[RETURN].friend_id r0
			getplayer[THISACTOR].ammo_amount 8 tmp
			ifvarl tmp 25
			{
			sound PLAY1106 
			setvar tmp2 25
			subvarvar tmp2 tmp
			mulvar tmp2 2
			getactor[r0].extra extra
			subvarvar extra tmp2
			setactor[r0].extra extra
			setactorvar[RETURN].hell_ammo 25
			} else { setactorvar[RETURN].hell_ammo tmp }
			setvar changeweappos 5
			
			ifvare savelastweap 8 setvar savelastweap 0
			setplayer[THISACTOR].weapon_pos -1 
			setplayer[THISACTOR].ammo_amount 8 0
			setplayer[THISACTOR].gotweapon 8 0
		}
	}
}
ends

state lifeleechdisplay
setvarvar qav_maxframes 36
setvar qav_tpf 8
state qav_initframes8

switch qav_frame
case 0
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -90
setvar yweapon -50
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 1
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -90
setvar yweapon -50
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 2
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -72
setvar yweapon -46
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 24
state qav2tc_state
break
case 3
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -43
setvar yweapon -32
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 64
state qav2tc_state
break
case 4
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -8
setvar yweapon -12
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 80
state qav2tc_state
break
case 5
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon 0
setvar yweapon -16
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 128
state qav2tc_state
break
case 6
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -17
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 7
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon 2
setvar yweapon -19
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon -13
setvar yweapon -70
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon -13
setvar yweapon -70
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 9375
setvar qav_ang 0
state qav2tc_state
break
case 8
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -21
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -23
setvar yweapon -82
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 0
state qav2tc_state
break
case 9
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -7
setvar yweapon -17
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -30
setvar yweapon -82
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 128
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon 10
setvar yweapon -70
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 11
setvar yweapon -72
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 9375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon -17
setvar yweapon -67
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
break
case 10
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -15
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -30
setvar yweapon -77
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 92
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 22
setvar yweapon -75
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -29
setvar yweapon -67
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
break
case 11
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -15
setvar yweapon -76
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon 1
setvar yweapon -17
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 35
setvar yweapon -82
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon -7
setvar yweapon -68
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon 19
setvar yweapon -67
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750 //6000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -31
setvar yweapon -63
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125 //5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon -8
setvar yweapon -68
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 11875 //13000
setvar qav_ang 0
state qav2tc_state
break
case 12
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -1
setvar yweapon -19
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 22
setvar yweapon -91
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125 //5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -20
setvar yweapon -68
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375 //7000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 30
setvar yweapon -69
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750 //6000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -31
setvar yweapon -58
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500 //4000
setvar qav_ang 0
state qav2tc_state
break
case 13
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -17
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 5
setvar yweapon -96
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -30
setvar yweapon -65
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 40
setvar yweapon -63
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -33
setvar yweapon -53
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon 13
setvar yweapon -69
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 12
setvar yweapon -69
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 12500
setvar qav_ang 0
state qav2tc_state
break
case 14
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 28
setvar yweapon -71
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -7
setvar yweapon -18
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -10
setvar yweapon -99
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -41
setvar yweapon -61
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 40
setvar yweapon -59
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 8
setvar yweapon -68
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 8
setvar yweapon -69
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 8125
setvar qav_ang 0
state qav2tc_state
break
case 15
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -5
setvar yweapon -19
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 38
setvar yweapon -73
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -22
setvar yweapon -101
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -37
setvar yweapon -61
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 37
setvar yweapon -56
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 5
setvar yweapon -67
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 11250
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 6
setvar yweapon -65
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 0
state qav2tc_state
break
case 16
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon 0
setvar yweapon -18
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 32
setvar yweapon -79
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 1936
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -22
setvar yweapon -101
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -6
setvar yweapon -57
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6250
setvar qav_ang 0
state qav2tc_state
break
case 17
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -2
setvar yweapon -15
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon 2
setvar yweapon -87
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 1920
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -11
setvar yweapon -104
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 45
setvar yweapon -27
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -23
setvar yweapon -40
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6250
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 2
setvar yweapon -86
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 12500
setvar qav_ang 0
state qav2tc_state
break
case 18
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -8
setvar yweapon -16
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -27
setvar yweapon -87
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 1988
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 4
setvar yweapon -110
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 33
setvar yweapon -56
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 51
setvar yweapon -27
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon -37
setvar yweapon -26
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon -38
setvar yweapon -28
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 12500
setvar qav_ang 0
state qav2tc_state
break
case 19
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -6
setvar yweapon -19
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -31
setvar yweapon -87
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 1920
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 10
setvar yweapon -112
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 37
setvar yweapon -54
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -38
setvar yweapon -53
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 55
setvar yweapon -30
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -43
setvar yweapon -18
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
break
case 20
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -17
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -13
setvar yweapon -87
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 16
setvar yweapon -113
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 36
setvar yweapon -48
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -39
setvar yweapon -54
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 57
setvar yweapon -31
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -42
setvar yweapon -13
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 0
state qav2tc_state
break
case 21
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -14
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 11
setvar yweapon -92
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3125
setvar qav_ang 52
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 13
setvar yweapon -113
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 31
setvar yweapon -41
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -35
setvar yweapon -60
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 52
setvar yweapon -31
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -36
setvar yweapon -6
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 31
setvar yweapon -42
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 22
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -11
setvar yweapon -16
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 15
setvar yweapon -103
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 4375
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 3
setvar yweapon -113
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon 14
setvar yweapon -39
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -32
setvar yweapon -66
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 41
setvar yweapon -28
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 12
setvar yweapon -39
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 13125
setvar qav_ang 0
state qav2tc_state
break
case 23
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -12
setvar yweapon -22
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 11
setvar yweapon -115
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6250
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -10
setvar yweapon -113
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -5
setvar yweapon -39
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon -13
setvar yweapon -74
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6250
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 30
setvar yweapon -23
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon -13
setvar yweapon -74
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 12500
setvar qav_ang 0
state qav2tc_state
break
case 24
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -1
setvar yweapon -22
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -131
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 7500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -15
setvar yweapon -117
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -30
setvar yweapon -32
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 15
setvar yweapon -72
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6250
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 18
setvar yweapon -9
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6250
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon -3
setvar yweapon -132
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 11875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 15
setvar yweapon -73
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 15625
setvar qav_ang 0
state qav2tc_state
break
case 25
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon 3
setvar yweapon -17
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -25
setvar yweapon -139
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -13
setvar yweapon -124
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -40
setvar yweapon -32
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 40
setvar yweapon -62
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5625
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 40
setvar yweapon -63
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 9375
setvar qav_ang 0
state qav2tc_state
break
case 26
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -9
setvar yweapon -21
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -35
setvar yweapon -150
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -4
setvar yweapon -129
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -45
setvar yweapon -32
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 46
setvar yweapon -57
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 5000
setvar qav_ang 0
state qav2tc_state
break
case 27
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -11
setvar yweapon -18
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -22
setvar yweapon -162
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 8
setvar yweapon -130
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6250
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 46
setvar yweapon -57
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 3750
setvar qav_ang 0
state qav2tc_state
break
case 28
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -13
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon -10
setvar yweapon -175
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 1875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 0
setvar xweapon 17
setvar yweapon -130
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 6875
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 33
setvar xweapon 16
setvar yweapon -131
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 13125
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 2446
setvar orientationweapon 1
setvar xweapon 42
setvar yweapon -57
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 2500
setvar qav_ang 0
state qav2tc_state
break
case 29
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -25
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3129
setvar orientationweapon 0
setvar xweapon -47
setvar yweapon -148
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3130
setvar orientationweapon 0
setvar xweapon 39
setvar yweapon -150
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 30
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -22
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3129
setvar orientationweapon 1
setvar xweapon -47
setvar yweapon -146
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3130
setvar orientationweapon 1
setvar xweapon 39
setvar yweapon -148
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 31
setvar tilenumweapon 3319
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -19
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3129
setvar orientationweapon 33
setvar xweapon -47
setvar yweapon -141
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
setvar tilenumweapon 3130
setvar orientationweapon 33
setvar xweapon 39
setvar yweapon -145
setvar qav_sh -128
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 32
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -3
setvar yweapon -17
setvar qav_sh -20
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 33
setvar tilenumweapon 3318
setvar orientationweapon 0
setvar xweapon -11
setvar yweapon -20
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 1996
state qav2tc_state
break
case 34
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -18
setvar yweapon -32
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 80
state qav2tc_state
break
case 35
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -56
setvar yweapon -43
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 44
state qav2tc_state
break
case 36
setvar tilenumweapon 3317
setvar orientationweapon 0
setvar xweapon -90
setvar yweapon -50
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
endswitch

ends

state hellstaffaltunit
ifvare HITAGSAVED 1 // Alt-fire hellstaff
{
	ifspritepal 0 { setvar hellextra 500 spritepal 30 }
	ifp palive
	ifpdistl RETRIEVEDISTANCE
	ifp pfacing
	ifhitspace
	ifcansee
	{
		getactorvar[THISACTOR].hell_ammo tmp
		addweapon 8 0
		getplayer[THISACTOR].ammo_amount 8 ammo
		addvarvar ammo tmp
		ifvarg ammo 100
			setvar ammo 100
		setplayer[THISACTOR].ammo_amount 8 ammo
		killit
	}
	

	setvar sectorid 0
	setvar minimum 16777216
	setvar targetid -1
	whilevarvarn sectorid NUMSECTORS 
	{
		headspritesect spriteid sectorid
		whilevarn spriteid -1 
		{
			getactor[spriteid].picnum picnum
			switch picnum
				case ZOMBIE
				case HERETIC
				case FISH
				case SPIDER
				case BEAST
				//case PHANTASM
				case POD
				case TENTACLE
				case HELLDOG
				case GILLBEAST
				case GARGOYLE
				case BUTCHER
				case FATRAT
				case EVILHAND
				case BOSSSPIDER
				case BAT
				case APLAYER
				case CERBERUS
				case CIVILIAN
				case TCHERNOBOG

				getactor[THISACTOR].z z
				subvarvar z 8192
				setactor[THISACTOR].z z
				canseespr THISACTOR spriteid see
				addvarvar z 8192
				setactor[THISACTOR].z z
		
				getactor[spriteid].extra extra
				ifvare see 1
				ifvarg extra 0
				ifvarvarn spriteid friend_id
				ifvarn actorvar[spriteid].zombie_lay 1
				{
					
					dist xydist THISACTOR spriteid
					ifvarvarl xydist STAFFDIST 
					ifvarvarl xydist minimum
					{
						setvarvar minimum xydist
						setvarvar targetid spriteid
					} 
				}
				break
			endswitch
			nextspritesect spriteid spriteid
		}
		addvar sectorid 1
	}

	ifvarn targetid -1
	{
		getactor[THISACTOR].z z
		subvarvar z 8192
		setactor[THISACTOR].z z
		canseespr THISACTOR targetid see
		addvarvar z 8192
		setactor[THISACTOR].z z
		
		ifvarg sprite[targetid].extra 0
		ifvare see 1
	    ifvarn actorvar[targetid].zombie_lay 1
		{
			getactor[targetid].x mx
			getactor[targetid].y my
			getactor[targetid].z mz
			ifvare sprite[targetid].picnum CIVILIAN
				addvarvar mz actorvar[targetid].height
			ifvare sprite[targetid].picnum ZOMBIE
				addvarvar mz actorvar[targetid].height
			ifvare sprite[targetid].picnum BEAST
				addvarvar mz actorvar[targetid].height
			ifvare 	sprite[targetid].picnum SPIDER 
				addvarvar mz 6144
			ifvare 	sprite[targetid].picnum BOSSSPIDER 
				addvarvar mz 6144
			ifvare 	sprite[targetid].picnum FATRAT 
				addvarvar mz 6144
			ifvare 	sprite[targetid].picnum EVILHAND 
				addvarvar mz 6144
			ifvare 	sprite[targetid].picnum POD 
				addvarvar mz 6144
			ifvare 	sprite[targetid].picnum TENTACLE 
				addvarvar mz 6144
			ifvare 	sprite[targetid].picnum HELLDOG
				addvarvar mz 6144
			ifvare 	sprite[targetid].picnum FISH
				addvarvar mz 6144

			getactor[THISACTOR].x x
			getactor[THISACTOR].y y
			getactor[THISACTOR].z z
			subvarvar mx x
			subvarvar my y
			getangle t_ang mx my
			setactor[THISACTOR].ang t_ang
			getactor[targetid].picnum picnum
			subvar mz 2048
			subvarvar mz z
			setvarvar zdist mz
			getactorvar[THISACTOR].hell_ammo hell_ammo
			ifvarg hell_ammo 0
			{
				ifcount 10 { 
					ldist xydist THISACTOR targetid
					ifvarg xydist 0 { mulvar zdist 200 divvarvar zdist xydist }
					subvarvar hell_ammo 1
					ifvarl hell_ammo 0 setvar hell_ammo 0
					setactorvar[THISACTOR].hell_ammo hell_ammo
					ezshootvar zdist STAFFALTPROJ
					setactor[RETURN].ang sprite[THISACTOR].ang
					resetcount 
				}	
			}
			else
			{
				ifcount 3
				{ 
					ldist xydist THISACTOR targetid
					ifvarg xydist 0 { mulvar zdist 200 divvarvar zdist xydist }
					ezshootvar zdist STAFFALTPROJ
					setactor[RETURN].ang sprite[THISACTOR].ang
					resetcount 
				}
			}	
		}
	}

	ifvarl hellextra 0 
	{ 
		setvar in1 8
		setvar in2 SPARK3
		state spawn_multiply
		setvar in1 8
		setvar in2 SPARK5
		state spawn_multiply		
		killit 
	}	
}
ends

state hellstaffplayerstate

ifvare CURRWEAP 8
ifp palive
ifvarn EOL_VAR 1 ifvarn EOG_VAR 1 
{
	getplayer[THISACTOR].kickback_pic temp
	ifvare temp 1 { globalsound LALTFR1 }
	ifvarg temp 9 ifvarl temp 62
	{
		ifvarand temp 3 { modvar temp 3 }
		ifvare temp 1
		{ 
			getplayer[THISACTOR].ammo_amount 8 tmp
			ifvarg tmp 0
			ifvarn tmp 1
			{ 
				subvar tmp 1
				setplayer[THISACTOR].ammo_amount 8 tmp
				eshoot STAFFPROJ
				getplayer[THISACTOR].ang temp
				randvar tmp 32
				ifrnd 128  addvarvar temp tmp else subvarvar temp tmp
				setactor[RETURN].ang temp
				getactor[RETURN].zvel zvel
				subvar zvel 128
				setvar tmp 0
				randvar tmp 256
				addvarvar zvel tmp
				setactor[RETURN].zvel zvel
			} 
			else
			{
				getactor[r0].extra extra
				subvar extra 1
				setactor[r0].extra extra
				getplayer[THISACTOR].ammo_amount 8 tmp
				subvar tmp 1
				setplayer[THISACTOR].ammo_amount 8 tmp
				eshoot STAFFPROJ
				getplayer[THISACTOR].ang temp
				randvar tmp 32
				ifrnd 128  addvarvar temp tmp else subvarvar temp tmp
				setactor[RETURN].ang temp
				getactor[RETURN].zvel zvel
				subvar zvel 128
				setvar tmp 0
				randvar tmp 256
				addvarvar zvel tmp
				setactor[RETURN].zvel zvel
			}
		} 
	}
	getplayer[THISACTOR].ammo_amount 8 temp
	ifvare temp 0 { setplayer[THISACTOR].ammo_amount 8 1 }
}
ends