A_FireOldBFG Beta BFG Emulation

Moderator: GZDoom Developers

User avatar
Doom A Holic
Posts: 60
Joined: Fri Jun 03, 2005 4:03 pm

A_FireOldBFG Beta BFG Emulation

Post by Doom A Holic »

I would really like A_FireOldBFG added as a command for DECORATE weapons. This first appeared in Marine's Best Friend as a way to use the BFG from the press-release beta of Doom. I found the code in the MBF source and I would love to see it added so people could make a decorate lump that replaces the BFG with the beta BFG or makes the beta BFG a completely seperate weapon so you have a choice between BFGs for single player or deathmatch games.

Code: Select all

void A_FireOldBFG();      // killough 7/19/98: classic BFG firing function

Code: Select all

// killough 7/11/98: beta BFG begins here
  // S_OLDBFG1

#define BFGDELAY 1
#define OLDBFG_1FRAMES(x) {SPR_BFGG,1,BFGDELAY,A_FireOldBFG,x+S_OLDBFG1+2},
#define OLDBFG_2FRAMES(x) OLDBFG_1FRAMES(x) OLDBFG_1FRAMES(x+1)
#define OLDBFG_4FRAMES(x) OLDBFG_2FRAMES(x) OLDBFG_2FRAMES(x+2)
#define OLDBFG_8FRAMES(x) OLDBFG_4FRAMES(x) OLDBFG_4FRAMES(x+4)
  {SPR_BFGG,0,10,A_BFGsound,S_OLDBFG1+1},  // S_OLDBFG1

  OLDBFG_8FRAMES(0)
  OLDBFG_8FRAMES(8)
  OLDBFG_8FRAMES(16) 
  OLDBFG_8FRAMES(24)
  OLDBFG_8FRAMES(32)

  {SPR_BFGG,1,0,A_Light0,S_OLDBFG43}, // S_OLDBFG42
  {SPR_BFGG,1,20,A_ReFire,S_BFG},   // S_OLDBFG43

  // killough 7/11/98: end of beta BFG

Code: Select all

//
// 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.

void A_FireOldBFG(player_t *player, pspdef_t *psp)
{
#ifdef BETA
  int type = MT_PLASMA1;

  if (weapon_recoil && !(player->mo->flags & MF_NOCLIP))
    P_Thrust(player, ANG180 + player->mo->angle,
	     512*recoil_values[wp_plasma]);

  player->ammo[weaponinfo[player->readyweapon].ammo]--;

  player->extralight = 2;

  do
    {
      mobj_t *th, *mo = player->mo;
      angle_t an = mo->angle;
      angle_t an1 = ((P_Random(pr_bfg)&127) - 64) * (ANG90/768) + an;
      angle_t an2 = ((P_Random(pr_bfg)&127) - 64) * (ANG90/640) + ANG90;
      extern int autoaim;

      if (autoaim || !beta_emulation)
	{
	  // killough 8/2/98: make autoaiming prefer enemies
	  int mask = MF_FRIEND;
	  fixed_t slope;
	  do
	    {
	      slope = P_AimLineAttack(mo, an, 16*64*FRACUNIT, mask);
	      if (!linetarget)
		slope = P_AimLineAttack(mo, an += 1<<26, 16*64*FRACUNIT, mask);
	      if (!linetarget)
		slope = P_AimLineAttack(mo, an -= 2<<26, 16*64*FRACUNIT, mask);
	      if (!linetarget)
		slope = 0, an = mo->angle;
	    }
	  while (mask && (mask=0, !linetarget));     // killough 8/2/98
	  an1 += an - mo->angle;
	  an2 += tantoangle[slope >> DBITS];
	}

      th = P_SpawnMobj(mo->x, mo->y,
		       mo->z + 62*FRACUNIT - player->psprites[ps_weapon].sy,
		       type);
      P_SetTarget(&th->target, mo);
      th->angle = an1;
      th->momx = finecosine[an1>>ANGLETOFINESHIFT] * 25;
      th->momy = finesine[an1>>ANGLETOFINESHIFT] * 25;
      th->momz = finetangent[an2>>ANGLETOFINESHIFT] * 25;
      P_CheckMissileSpawn(th);
    }
  while ((type != MT_PLASMA2) && (type = MT_PLASMA2)); //killough: obfuscated!
#endif
}
I have also used DeuTex to extract the sprites and put them into a wad. You can download the wad here.

This code was released to the public by Lee himself so you should be able to use it for ZDoom.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

All I can say is 'why not'?

One other thing this code reminds me of:

MBF doesn't autoaim at friends if an enemy can be targetet. ZDoom should do that as well!
User avatar
Doom A Holic
Posts: 60
Joined: Fri Jun 03, 2005 4:03 pm

Post by Doom A Holic »

I can't wait until this is added into ZDoom, it will be great!
User avatar
Doom A Holic
Posts: 60
Joined: Fri Jun 03, 2005 4:03 pm

Post by Doom A Holic »

Can you please please put this in the community build?
User avatar
HobbsTiger1
Posts: 1235
Joined: Fri Jan 07, 2005 7:29 pm
Location: #DMClub

Post by HobbsTiger1 »

Seeing as that appears to be from the Boom Source (because it looks like killough overcommented code) could you point me into the direction of the document that has that. I have about 5 copies of the Boom source on my PC, one the original, so I dont need the download unless I'm wrong about where that bit of code came from (I'd also like to know why we dont see it in Boom).
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Post by solarsnowfall »

Good luck finding Killough's comments on the net.
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Post by TheDarkArchon »

HobbsTiger1 wrote:Seeing as that appears to be from the Boom Source (because it looks like killough overcommented code).
It's the MBF source which Killough developed on his own, IIRC. Boom didn't have the BFG 2704.
User avatar
Inuyasha_989
Posts: 612
Joined: Thu Oct 16, 2003 2:51 pm
Location: Player Connector

Post by Inuyasha_989 »

Yea... and if it helps, i made the best code for it I could scrounge up in decorate, check the Weapons Resource Wad for BFG 2704 that i made
User avatar
Lexus Alyus
Posts: 4220
Joined: Tue Jul 15, 2003 5:07 pm
Location: Nottingham, UK

Post by Lexus Alyus »

Heh, a BFG 404 :D (AKA: The page not found gun :D). Heh, you culd also have the Roland BFG 909... its a classic drum machine from 2050 used predominantly in dance music :D.

:twisted:
User avatar
Doom A Holic
Posts: 60
Joined: Fri Jun 03, 2005 4:03 pm

Post by Doom A Holic »

Inuyasha_989 wrote:Yea... and if it helps, i made the best code for it I could scrounge up in decorate, check the Weapons Resource Wad for BFG 2704 that i made
Your code is really good but the shots need to be widened vertically a lot more.

2 Weeks ago I saw the PERFECT BFG2704 in an edge wad. And then I wished there was an edge to decorate comverter.
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Post by TheDarkArchon »

Wouldn't work anyway: ZDoom can't handle vertically spreading projectiles.
User avatar
Inuyasha_989
Posts: 612
Joined: Thu Oct 16, 2003 2:51 pm
Location: Player Connector

Post by Inuyasha_989 »

yea, cant they add that tho, we have vertical spread for bullet hitscans, so we should have it work for projectiles..
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Post by TheDarkArchon »

You're telling me: It'd come in handy for one of the weapons in Tainted Decorum.

Return to “Closed Feature Suggestions [GZDoom]”