defineprojectile KNEE PROJ_WORKSLIKE 4097
defineprojectile KNEE PROJ_SPAWNS -1 //SMALLSMOKE1
defineprojectile KNEE PROJ_EXTRA 4
defineprojectile KNEE PROJ_EXTRA_RAND 2
defineprojectile KNEE PROJ_XREPEAT 3
defineprojectile KNEE PROJ_YREPEAT 3
defineprojectile KNEE PROJ_DECAL -1
defineprojectile KNEE PROJ_RANGE 1024

gamevar WEAPON0_FLAGS 65824 1 //256	Using does NOT cause player to flash the level (clear visibility)
gamevar WEAPON0_SHOOTS KNEE 1 
gamevar WEAPON0_FIREDELAY 7 1 
gamevar WEAPON0_TOTALTIME 16 1
gamevar WEAPON0_SHOTSPERBURST 0 1
gamevar WEAPON0_FIRESOUND 0 1

state kneegame
ifactor SHOTSPARK1
{
	ifspawnedby APLAYER
	{
		getactor[THISACTOR].htg_t 6 wallid
		ifvarg wallid -1
		{
			setactorvar[THISACTOR].sparkanim 1
		}
		else
		{
			getactor[THISACTOR].htg_t 7 tmp
			ifvarn tmp -1
			{
				getactor[THISACTOR].htg_t 8 tmp //sprite hit
				ifvarn tmp -1
				{
					getactor[tmp].picnum picnum
					switch picnum
					case IMP
					case SOLDIER
					setactorvar[THISACTOR].sparkanim 2
					break
					default 
					setactorvar[THISACTOR].sparkanim 1
					break
					endswitch
				}
			}
		}
	}
}
ends

state displayknee
 switch weaponcount
    case 0
    setvar xweapon 230
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 259
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon KNEE1
    addvar tilenumweapon 0
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon        
    break
    case 1
    case 2
    case 3
    case 4
    setvar xweapon 70
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 259
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon KNEE1
    addvar tilenumweapon 1
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon      
    break 
    case 5
    case 6
    case 7
    case 8
    case 13
    case 14
    case 15
    case 16
    setvar xweapon 70
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 259
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon KNEE1
    addvar tilenumweapon 2
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon        
    break
    case 9
    case 10
    case 11
    case 12
    setvar xweapon 70
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 259
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon KNEE1
    addvar tilenumweapon 3
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon        
    break
 endswitch
ends