gamevar qav_tile 0 1
gamevar qav_x 0 1
gamevar qav_y 0 1
gamevar qav_sh 0 1
gamevar qav_pal 0 1
gamevar qav_zoom 0 1 
gamevar qav_ang 0 1
gamevar qav_tpf 0 1
gamevar qav_count 0 1
gamevar qav_frame 0 1
gamevar qav_maxframes 0 1

state hudcoordfix
addvarvar xweapon weapon_xoffset
subvarvar xweapon looking_angSR1
addvarvar xweapon HUDsx
addvar xweapon 10
addvarvar yweapon looking_arc
subvarvar yweapon gun_pos
addvarvar yweapon HUDsy
addvarvar yweapon 17
ifvare hudtype 0 { subvar yweapon 22 }
ends

state qav2tc_state
addvarvar tilenumweapon 5120
setvarvar qav_tile tilenumweapon
state hudcoordfix
addvar xweapon 160
setvarvar qav_x xweapon
addvar yweapon 198
addvar yweapon 65 //hudcoordfix
setvarvar qav_y yweapon
mulvarvar weapon_zoom 65536
divvarvar weapon_zoom 10000
setvarvar qav_zoom weapon_zoom
getsector[THISACTOR].floorshade shade
addvarvar shade qav_sh
ifvarl shade -127 setvar shade -127
ifvare invisible 1 
{
	ifvarg INVISTIME 676
	{
		ifvarg INVISTIME 676 ifvarl INVISTIME 689 nullop else
		ifvarg INVISTIME 689 ifvarl INVISTIME 702 orvar orientationweapon 33 else
		ifvarg INVISTIME 702 ifvarl INVISTIME 715 nullop else
		ifvarg INVISTIME 715 ifvarl INVISTIME 728 orvar orientationweapon 33 else
		ifvarg INVISTIME 728 ifvarl INVISTIME 741 nullop else
		ifvarg INVISTIME 741 ifvarl INVISTIME 754 orvar orientationweapon 33 else
		ifvarg INVISTIME 754 ifvarl INVISTIME 767 nullop else
		ifvarg INVISTIME 767 orvar orientationweapon 33
	} else orvar orientationweapon 33
}
ifvare QUAKEACTIVE 1
{
	randvar quake_rand 1
	addvarvar qav_x quake_rand
}
ifvare QUAKEACTIVE 2
{
	randvar quake_rand 2
	ifrnd 128 mulvar quake_rand -1
	addvarvar qav_x quake_rand
	randvar quake_rand 1
	addvarvar qav_y quake_rand
}
ifvarg qav_y 320 setvar qav_y 320
ifvarl qav_y -100 setvar qav_y -100
rotatesprite qav_x qav_y qav_zoom qav_ang qav_tile shade qav_pal orientationweapon 0 0 xdim ydim
ends


/* Template for animation

setvar qav_maxframes
setvar qav_tpf
state qav_initframes

	switch qav_frame
	case

setvar tilenumweapon
setvar orientationweapon
setvar xweapon
setvar yweapon
setvar qav_sh
setvar qav_pal
setvar weapon_zoom
setvar qav_ang
state qav2tc_state
break

*/



