gamevar WEAPON6_TOTALTIME 48 1
gamevar WEAPON6_FIREDELAY 35 1
//gamevar WEAPON6_SHOOTS BFG 1
gamevar WEAPON6_INITIALSOUND DSBFG 1

state displaybfg
 switch weaponcount
    case 0
    setvar xweapon 149
    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 BFG9000
    addvar tilenumweapon 0
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon  
    break
    case 1
    case 2
    case 3
    case 4
    case 5
    case 6
    case 7
    case 8
    case 9
    case 10
    case 11
    case 12
    case 13
    case 14
    case 15
    case 16
    case 17
    case 18
    case 19
    case 20
    case 21
    case 22
    case 23
    case 24
    setvar xweapon 149
    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 BFG9000
    addvar tilenumweapon 0
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon        
    break
    case 25
    setvar xweapon 149
    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 BFG9000
    addvar tilenumweapon 1
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon        
    break
    case 26
    case 27
    case 28
    case 29 
    case 30
    case 31
    case 32
    case 33
    case 34
    case 35
    setvar xweapon 149
    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 BFG9000
    addvar tilenumweapon 1
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon    
		ifvarl weaponcount 38
		{
		 setvar xweapon 148
   		 addvarvar xweapon weapon_xoffset
   		 subvarvar xweapon looking_angSR1
   		 setvar yweapon 208
		 ifvare hudtype 0 { subvarvar yweapon 31 }
   		 addvarvar yweapon looking_arc
   		 subvarvar yweapon gun_pos
   		 setvar tilenumweapon BFG9000
   		 addvar tilenumweapon 3
   		 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon
		}      
    break
    case 36
    case 37
    case 38
    case 39 
    case 40
    case 41
    setvar xweapon 149
    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 BFG9000
    addvar tilenumweapon 1
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon
		ifvarl weaponcount 44
		{
		 setvar xweapon 148
   		 addvarvar xweapon weapon_xoffset
   		 subvarvar xweapon looking_angSR1
   		 setvar yweapon 200
		 ifvare hudtype 0 { subvarvar yweapon 31 }
   		 addvarvar yweapon looking_arc
   		 subvarvar yweapon gun_pos
   		 setvar tilenumweapon BFG9000
   		 addvar tilenumweapon 4
   		 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon
		}          
    break
    case 42
    case 43
    case 44
    case 45
    case 46
    case 48
    case 49
    setvar xweapon 149
    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 BFG9000
    addvar tilenumweapon 1
    myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon        
    break
 endswitch
ends

state bfggameevent
ifvare CURWEAP 6
{
getplayer[THISACTOR].ammo_amount 5 TEMP
getplayer[THISACTOR].ammo_amount 6 TEMP2
subvarvar TEMP2 TEMP
ifvare TEMP2 -1 { getplayer[THISACTOR].ammo_amount 6 TEMP
setplayer[THISACTOR].ammo_amount 5 TEMP } else setplayer[THISACTOR].ammo_amount 6 TEMP
}
ends