A_FireOldBFG
Jump to navigation
Jump to search
action void A_FireOldBFG()
Usage
Performs the BFG9000's attack from the Doom press-release beta version. Each call of the function fires two plasma projectiles, one is green and the other is red, with a slight random spread. The BFG calls this function 40 times costing 40 points of ammunition with 1-tic interval between each call.
Examples
The beta BFG9000 firing sequence is defined within the BFG9000 class itself:
OldFire:
BFGG A 10 A_BFGsound;
BFGG BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 1 A_FireOldBFG;
BFGG B 0 A_Light0;
BFGG B 20 A_ReFire;
Goto Ready;
ZScript definition
| Note: The ZScript definition below is for reference and may be different in the current version of UZDoom. The most up-to-date version of this code can be found on UZDoom GitHub. |
//
// A_FireOldBFG
//
// This function emulates Doom's Pre-Beta BFG
// By Lee Killough 6/6/98, 7/11/98, 7/19/98, 8/20/98
//
// This code may not be used in other mods without appropriate credit given.
// Code leeches will be telefragged.
action void A_FireOldBFG()
{
bool doesautoaim = false;
if (player == null)
{
return;
}
Weapon weap = player.ReadyWeapon;
if (invoker != weap || stateinfo == null || stateinfo.mStateType != STATE_Psprite) weap = null;
if (weap != null)
{
if (!weap.DepleteAmmo (weap.bAltFire, true, 1))
return;
doesautoaim = weap.bNoAutoaim;
weap.bNoAutoaim = true;
}
player.extralight = 2;
// Save values temporarily
double SavedPlayerAngle = angle;
double SavedPlayerPitch = pitch;
for (int i = 0; i < 2; i++) // Spawn two plasma balls in sequence
{
angle += random[OldBFG](-64, 63) * (90./768);
pitch += random[OldBFG](-64, 63) * (90./640);
SpawnPlayerMissile (i == 0? (class<Actor>)("PlasmaBall1") : (class<Actor>)("PlasmaBall2"));
// Restore saved values
angle = SavedPlayerAngle;
pitch = SavedPlayerPitch;
}
// Restore autoaim setting
if (weap != null) weap.bNoAutoaim = doesautoaim;
}