gamevar WEAPON5_FLAGS 65536 1
gamevar WEAPON5_WORKSLIKE 11 1
gamevar WEAPON5_TOTALTIME 6 1

defineprojectile PLASMA PROJ_WORKSLIKE 32770
defineprojectile PLASMA PROJ_HITRADIUS 0
defineprojectile PLASMA PROJ_VEL 800
defineprojectile PLASMA PROJ_XREPEAT 32
defineprojectile PLASMA PROJ_YREPEAT 32
defineprojectile PLASMA PROJ_OFFSET -2048
defineprojectile PLASMA PROJ_EXTRA 23
defineprojectile PLASMA PROJ_SPAWNS PLASMAWALL

action PLASMAWALL_FRAMES 0 4 1 1 4
useractor notenemy PLASMAWALL
sizeat 32 32
ifaction 0 { action PLASMAWALL_FRAMES }
ifactioncount 4 { killit }
enda

state plasmagame
ifvare CURWEAP 5
ifvare player[THISACTOR].kickback_pic 0 {
ifvarl plasmaweapcount 30 { addvar plasmaweapcount 1 setvar plasmareload 1 } else setvar plasmareload 0 } else
ifvare player[THISACTOR].kickback_pic 5 setvar plasmaweapcount 0
ends

state displayplasma
    switch weaponcount
    case 0
    setvar xweapon 143
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 248
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon PLASMAGUN
	ifvare plasmareload 1 addvar tilenumweapon 1
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon            
    break
    case 1
    setvar xweapon 143
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 248
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon PLASMAGUN
    addvar tilenumweapon 2
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon           
    break 
    case 2
    case 3
    setvar xweapon 143
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 248
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon PLASMAGUN
    addvar tilenumweapon 3
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon        
    break
    case 4
    setvar xweapon 143
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 248
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon PLASMAGUN
    addvar tilenumweapon 2
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon           
    break 
    case 5
    setvar xweapon 143
    addvarvar xweapon weapon_xoffset
    subvarvar xweapon looking_angSR1
    setvar yweapon 248
    ifvare hudtype 0 { subvarvar yweapon 31 }
    addvarvar yweapon looking_arc
    subvarvar yweapon gun_pos
    setvar tilenumweapon PLASMAGUN
    addvar tilenumweapon 3
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon         
    break
    endswitch
ends
