- Added damage factors that allows to make monsters more or less resistant

to specific damage types.
- Changed Dehacked parser to use the DECORATE symbol tables for code pointers
  instead of creating its own ones.
- Removed the HandleNoSector hack and changed A_Look so that it uses the sector's
  sound target for actors with MF_NOSECTOR regardless of compatibility settings.
- Moved initialization of weapon slots after the actor initialization.
  With default weapons exported to DECORATE it can't be done earlier.
- Converted Doom weapons to DECORATE.
- Changed backpack definition so that Doom's backpack is no longer the base
  class that implements its functionality. Now there is an abstract base class
  all backpack-like items derive from. Also moved the actual definition of Doom's
  backpack to DECORATE.


SVN r519 (trunk)
This commit is contained in:
Christoph Oelckers 2007-04-28 09:06:32 +00:00
parent 8e229fa2b6
commit ea4f160e35
29 changed files with 786 additions and 736 deletions

View file

@ -1,3 +1,20 @@
April 27, 2007 (Changes by Graf Zahl)
- Added damage factors that allows to make monsters more or less resistant
to specific damage types.
- Changed Dehacked parser to use the DECORATE symbol tables for code pointers
instead of creating its own ones.
April 26, 2007 (Changes by Graf Zahl)
- Removed the HandleNoSector hack and changed A_Look so that it uses the sector's
sound target for actors with MF_NOSECTOR regardless of compatibility settings.
- Moved initialization of weapon slots after the actor initialization.
With default weapons exported to DECORATE it can't be done earlier.
- Converted Doom weapons to DECORATE.
- Changed backpack definition so that Doom's backpack is no longer the base
class that implements its functionality. Now there is an abstract base class
all backpack-like items derive from. Also moved the actual definition of Doom's
backpack to DECORATE.
April 22, 2007 (Changes by Graf Zahl)
- added a CANUSEWALLS flag which allows a monster to activate 'use' specials
like doors. This flag is on by default for any monster which was the

View file

@ -109,3 +109,57 @@ FArchive &operator<< (FArchive &arc, botskill_t &skill)
{
return arc << skill.aiming << skill.perfection << skill.reaction << skill.isp;
}
// set the bot specific weapon information
// This is intentionally not in the weapon definition anymore.
AT_GAME_SET(BotStuff)
{
AWeapon * w;
AActor * a;
w = (AWeapon*)GetDefaultByName ("Pistol");
if (w != NULL)
{
w->MoveCombatDist=25000000;
}
w = (AWeapon*)GetDefaultByName ("Shotgun");
if (w != NULL)
{
w->MoveCombatDist=24000000;
}
w = (AWeapon*)GetDefaultByName ("SuperShotgun");
if (w != NULL)
{
w->MoveCombatDist=15000000;
}
w = (AWeapon*)GetDefaultByName ("Chaingun");
if (w != NULL)
{
w->MoveCombatDist=27000000;
}
w = (AWeapon*)GetDefaultByName ("RocketLauncher");
if (w != NULL)
{
w->MoveCombatDist=18350080;
w->WeaponFlags|=WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE;
w->ProjectileType=PClass::FindClass("Rocket");
}
w = (AWeapon*)GetDefaultByName ("PlasmaRifle");
if (w != NULL)
{
w->MoveCombatDist=27000000;
w->ProjectileType=PClass::FindClass("PlasmaBall");
}
a = GetDefaultByName ("PlasmaBall");
if (a != NULL)
{
a->flags3|=MF3_WARNBOT;
}
w = (AWeapon*)GetDefaultByName ("BFG9000");
if (w != NULL)
{
w->MoveCombatDist=10000000;
w->WeaponFlags|=WIF_BOT_REACTION_SKILL_THING|WIF_BOT_BFG;
w->ProjectileType=PClass::FindClass("BFGBall");
}
}

View file

@ -523,7 +523,7 @@ angle_t DCajunMaster::FireRox (AActor *bot, AActor *enemy, ticcmd_t *cmd)
if (dist < SAFE_SELF_MISDIST)
return 0;
//Predict.
m = (((dist+1)/FRACUNIT) / GetDefault<ARocket>()->Speed);
m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->Speed);
SetBodyAt (enemy->x + FixedMul (enemy->momx, (m+2*FRACUNIT)),
enemy->y + FixedMul(enemy->momy, (m+2*FRACUNIT)), ONFLOORZ, 1);

View file

@ -65,6 +65,7 @@
#include "a_sharedglobal.h"
#include "thingdef.h"
#include "vectors.h"
#include "dobject.h"
// [SO] Just the way Randy said to do it :)
// [RH] Made this CVAR_SERVERINFO
@ -82,20 +83,7 @@ struct CodePtrMap
static CodePtrMap *CodePtrNames;
static int NumCodePtrs;
// Prototype the dehacked code pointers
#define WEAPON(x) void A_##x(AActor*);
#define ACTOR(x) void A_##x(AActor*);
#include "d_dehackedactions.h"
// Declare the dehacked code pointers
static const actionf_p CodePtrs[] =
{
NULL,
#define WEAPON(x) A_##x,
#define ACTOR(x) A_##x,
#include "d_dehackedactions.h"
};
static PSymbol ** CodePtrSymbols;
static const char *const AmmoNames[12] =
{
@ -1498,6 +1486,31 @@ static int PatchWeapon (int weapNum)
return result;
}
static void SetPointer(FState *state, PSymbol *sym)
{
if (sym==NULL)
{
state->Action = NULL;
state->ParameterIndex=0;
}
else switch (sym->SymbolType)
{
case SYM_ActionFunction:
state->Action = static_cast<PSymbolActionFunction*>(sym)->Function;
state->ParameterIndex=0; // No parameters for patched code pointers
break;
/*
case SYM_ExternalFunction:
state->Action = A_CallExtFunction;
state->ParameterIndex = static_cast<PSymbolExternalFunction*>(sym->Data);
break;
*/
default:
state->Action = NULL;
state->ParameterIndex=0;
}
}
static int PatchPointer (int ptrNum)
{
int result;
@ -1516,12 +1529,13 @@ static int PatchPointer (int ptrNum)
FState *state = FindState (CodePConv[ptrNum]);
if (state)
{
if ((unsigned)(atoi (Line2)) >= (unsigned)NumActions)
int index = atoi(Line2);
if ((unsigned)(index) >= (unsigned)NumActions)
state->Action = NULL;
else
state->Action = CodePtrs[ActionList[atoi (Line2)]];
state->ParameterIndex=0; // No parameters for patched code pointers
{
SetPointer(state, CodePtrSymbols[ActionList[index]]);
}
}
else
{
@ -1845,10 +1859,9 @@ static int PatchCodePtrs (int dummy)
}
else
{
state->Action = CodePtrs[CodePtrNames[mid].num];
SetPointer(state, CodePtrSymbols[CodePtrNames[mid].num]);
DPrintf ("Frame %d set to %s\n", frame, GetName (CodePtrNames[mid].name));
}
state->ParameterIndex=0; // No parameters for patched code pointers
}
}
}
@ -2333,6 +2346,11 @@ static void UnloadDehSupp ()
DehUseCount = 0;
delete[] DehSuppLump;
DehSuppLump = NULL;
if (CodePtrSymbols != NULL)
{
delete[] CodePtrSymbols;
CodePtrSymbols = NULL;
}
if (OrgSprNames != NULL)
{
delete[] OrgSprNames[0];
@ -2427,13 +2445,16 @@ static bool LoadDehSupp ()
else if (CompareLabel ("ACTF", supp))
{
NumCodePtrs = GetWord (supp + 4);
if ((unsigned)NumCodePtrs != countof(CodePtrs))
{
Printf ("DEHSUPP defines %d code pointers, but there should be %d\n",
NumCodePtrs, countof(CodePtrs));
return false;
}
CodePtrNames = (CodePtrMap *)GetWordSpace (supp + 6, NumCodePtrs*2);
CodePtrSymbols = new PSymbol*[NumCodePtrs];
for(int i=0;i<NumCodePtrs;i++)
{
// all relevant code pointers are either defined in AInventory
// or AActor so this will find all of them.
FString name = "A_";
name << GetName(CodePtrNames[i].name);
CodePtrSymbols[CodePtrNames[i].num] = RUNTIME_CLASS(AInventory)->Symbols.FindSymbol(name, true);
}
supp += 6 + NumCodePtrs * 4;
}
else if (CompareLabel ("ACTM", supp))
@ -2611,43 +2632,6 @@ void FinishDehPatch ()
}
}
void HandleNoSector()
{
// MF_NOSECTOR is causing problems with monsters so remap it to RF_INVISIBLE
// which in most cases is what this is used for anyway.
// Do this for all actors touched by DEHACKED actors except the teleport spot.
unsigned int touchedIndex;
for (touchedIndex = 0; touchedIndex < TouchedActors.Size(); ++touchedIndex)
{
PClass *ti = TouchedActors[touchedIndex];
if (ti!=NULL && ti->ActorInfo!=NULL && !ti->IsDescendantOf(RUNTIME_CLASS(ATeleportDest)))
{
AActor * def = GetDefaultByType(ti);
if (def->flags&MF_NOSECTOR)
{
def->flags&=~MF_NOSECTOR;
def->renderflags|=RF_INVISIBLE;
}
}
}
// The BossEye must be handled even without any Dehacked interference
// because otherwise it would not react to sound.
const PClass * ti = PClass::FindClass("BossEye");
if (ti!=NULL)
{
AActor * def = GetDefaultByType(ti);
if (def->flags&MF_NOSECTOR)
{
def->flags&=~MF_NOSECTOR;
def->renderflags|=RF_INVISIBLE;
}
}
}
void A_SpawnDehackedPickup (AActor *actor)
{
if ((size_t)actor->health < DehackedPickups.Size())

View file

@ -36,6 +36,5 @@
void DoDehPatch (const char *patchfile, bool autoloading);
void FinishDehPatch ();
void HandleNoSector();
#endif //__D_DEHACK_H__

View file

@ -2238,6 +2238,9 @@ void D_DoomMain (void)
FActorInfo::StaticInit ();
// Now that all actors have been defined we can finally set up the weapon slots
GameConfig->DoWeaponSetup (GameNames[gameinfo.gametype]);
// [GRB] Initialize player class list
SetupPlayerClasses ();
@ -2287,8 +2290,6 @@ void D_DoomMain (void)
DoDehPatch (NULL, true); // See if there's a patch in a PWAD
FinishDehPatch (); // Create replacements for dehacked pickups
}
HandleNoSector (); // clear NOSECTOR flag off all actors modified by Dehacked and the BossEye.
FActorInfo::StaticSetActorNums ();

View file

@ -184,7 +184,7 @@ void A_BrainPain (AActor *self)
static void BrainishExplosion (fixed_t x, fixed_t y, fixed_t z)
{
AActor *boom = Spawn<ARocket> (x, y, z, NO_REPLACE);
AActor *boom = Spawn("Rocket", x, y, z, NO_REPLACE);
if (boom != NULL)
{
boom->momz = pr_brainscream() << 9;

View file

@ -10,22 +10,6 @@ class ABossBrain : public AActor
DECLARE_ACTOR (ABossBrain, AActor)
};
class ARocket : public AActor
{
DECLARE_ACTOR (ARocket, AActor)
public:
};
class APlasmaBall : public AActor
{
DECLARE_ACTOR (APlasmaBall, AActor)
};
class ABFGBall : public AActor
{
DECLARE_ACTOR (ABFGBall, AActor)
};
class AScriptedMarine : public AActor
{
DECLARE_ACTOR (AScriptedMarine, AActor)

View file

@ -20,46 +20,6 @@ static FRandom pr_fireplasma ("FirePlasma");
static FRandom pr_firerail ("FireRail");
static FRandom pr_bfgspray ("BFGSpray");
// Fist ---------------------------------------------------------------------
void A_Punch (AActor *);
class AFist : public AWeapon
{
DECLARE_ACTOR (AFist, AWeapon)
};
FState AFist::States[] =
{
#define S_PUNCH 0
S_NORMAL (PUNG, 'A', 1, A_WeaponReady , &States[S_PUNCH]),
#define S_PUNCHDOWN (S_PUNCH+1)
S_NORMAL (PUNG, 'A', 1, A_Lower , &States[S_PUNCHDOWN]),
#define S_PUNCHUP (S_PUNCHDOWN+1)
S_NORMAL (PUNG, 'A', 1, A_Raise , &States[S_PUNCHUP]),
#define S_PUNCH1 (S_PUNCHUP+1)
S_NORMAL (PUNG, 'B', 4, NULL , &States[S_PUNCH1+1]),
S_NORMAL (PUNG, 'C', 4, A_Punch , &States[S_PUNCH1+2]),
S_NORMAL (PUNG, 'D', 5, NULL , &States[S_PUNCH1+3]),
S_NORMAL (PUNG, 'C', 4, NULL , &States[S_PUNCH1+4]),
S_NORMAL (PUNG, 'B', 5, A_ReFire , &States[S_PUNCH])
};
IMPLEMENT_ACTOR (AFist, Doom, -1, 0)
PROP_Weapon_SelectionOrder (3700)
PROP_Weapon_Flags (WIF_WIMPY_WEAPON|WIF_BOT_MELEE)
PROP_Weapon_UpState (S_PUNCHUP)
PROP_Weapon_DownState (S_PUNCHDOWN)
PROP_Weapon_ReadyState (S_PUNCH)
PROP_Weapon_AtkState (S_PUNCH1)
PROP_Weapon_Kickback (100)
PROP_Obituary("$OB_MPFIST")
END_DEFAULTS
//
// A_Punch
//
@ -101,57 +61,6 @@ void A_Punch (AActor *actor)
}
}
// Pistol -------------------------------------------------------------------
void A_FirePistol (AActor *);
class APistol : public AWeapon
{
DECLARE_ACTOR (APistol, AWeapon)
};
FState APistol::States[] =
{
#define S_PISTOL 0
S_NORMAL (PISG, 'A', 1, A_WeaponReady , &States[S_PISTOL]),
#define S_PISTOLDOWN (S_PISTOL+1)
S_NORMAL (PISG, 'A', 1, A_Lower , &States[S_PISTOLDOWN]),
#define S_PISTOLUP (S_PISTOLDOWN+1)
S_NORMAL (PISG, 'A', 1, A_Raise , &States[S_PISTOLUP]),
#define S_PISTOL1 (S_PISTOLUP+1)
S_NORMAL (PISG, 'A', 4, NULL , &States[S_PISTOL1+1]),
S_NORMAL (PISG, 'B', 6, A_FirePistol , &States[S_PISTOL1+2]),
S_NORMAL (PISG, 'C', 4, NULL , &States[S_PISTOL1+3]),
S_NORMAL (PISG, 'B', 5, A_ReFire , &States[S_PISTOL]),
#define S_PISTOLFLASH (S_PISTOL1+4)
S_BRIGHT (PISF, 'A', 7, A_Light1 , &AWeapon::States[S_LIGHTDONE]),
// This next state is here just in case people want to shoot plasma balls or railguns
// with the pistol using Dehacked.
S_BRIGHT (PISF, 'A', 7, A_Light1 , &AWeapon::States[S_LIGHTDONE])
};
IMPLEMENT_ACTOR (APistol, Doom, -1, 0)
PROP_Weapon_SelectionOrder (1900)
PROP_Weapon_Flags (WIF_WIMPY_WEAPON)
PROP_Weapon_AmmoUse1 (1)
PROP_Weapon_AmmoGive1 (20)
PROP_Weapon_UpState (S_PISTOLUP)
PROP_Weapon_DownState (S_PISTOLDOWN)
PROP_Weapon_ReadyState (S_PISTOL)
PROP_Weapon_AtkState (S_PISTOL1)
PROP_Weapon_FlashState (S_PISTOLFLASH)
PROP_Weapon_Kickback (100)
PROP_Weapon_MoveCombatDist (25000000)
PROP_Weapon_AmmoType1 ("Clip")
PROP_Obituary("$OB_MPPISTOL")
END_DEFAULTS
//
// A_FirePistol
//
@ -184,54 +93,6 @@ void A_FirePistol (AActor *actor)
P_GunShot (actor, accurate, PClass::FindClass(NAME_BulletPuff));
}
// Chainsaw -----------------------------------------------------------------
void A_Saw (AActor *);
class AChainsaw : public AWeapon
{
DECLARE_ACTOR (AChainsaw, AWeapon)
};
FState AChainsaw::States[] =
{
#define S_SAW 0
S_NORMAL (SAWG, 'C', 4, A_WeaponReady , &States[S_SAW+1]),
S_NORMAL (SAWG, 'D', 4, A_WeaponReady , &States[S_SAW+0]),
#define S_SAWDOWN (S_SAW+2)
S_NORMAL (SAWG, 'C', 1, A_Lower , &States[S_SAWDOWN]),
#define S_SAWUP (S_SAWDOWN+1)
S_NORMAL (SAWG, 'C', 1, A_Raise , &States[S_SAWUP]),
#define S_SAW1 (S_SAWUP+1)
S_NORMAL (SAWG, 'A', 4, A_Saw , &States[S_SAW1+1]),
S_NORMAL (SAWG, 'B', 4, A_Saw , &States[S_SAW1+2]),
S_NORMAL (SAWG, 'B', 0, A_ReFire , &States[S_SAW]),
#define S_CSAW (S_SAW1+3)
S_NORMAL (CSAW, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (AChainsaw, Doom, 2005, 32)
PROP_RadiusFixed (20)
PROP_HeightFixed (16)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (S_CSAW)
PROP_Weapon_SelectionOrder (2200)
PROP_Weapon_Flags (WIF_BOT_MELEE)
PROP_Weapon_UpState (S_SAWUP)
PROP_Weapon_DownState (S_SAWDOWN)
PROP_Weapon_ReadyState (S_SAW)
PROP_Weapon_AtkState (S_SAW1)
PROP_Weapon_UpSound ("weapons/sawup")
PROP_Weapon_ReadySound ("weapons/sawidle")
PROP_Obituary("$OB_MPCHAINSAW")
PROP_Inventory_PickupMessage("$GOTCHAINSAW")
END_DEFAULTS
//
// A_Saw
//
@ -309,66 +170,6 @@ void A_Saw (AActor *actor)
actor->flags |= MF_JUSTATTACKED;
}
// Shotgun ------------------------------------------------------------------
void A_FireShotgun (AActor *);
class AShotgun : public AWeapon
{
DECLARE_ACTOR (AShotgun, AWeapon)
};
FState AShotgun::States[] =
{
#define S_SGUN 0
S_NORMAL (SHTG, 'A', 1, A_WeaponReady , &States[S_SGUN]),
#define S_SGUNDOWN (S_SGUN+1)
S_NORMAL (SHTG, 'A', 1, A_Lower , &States[S_SGUNDOWN]),
#define S_SGUNUP (S_SGUNDOWN+1)
S_NORMAL (SHTG, 'A', 1, A_Raise , &States[S_SGUNUP]),
#define S_SGUN1 (S_SGUNUP+1)
S_NORMAL (SHTG, 'A', 3, NULL , &States[S_SGUN1+1]),
S_NORMAL (SHTG, 'A', 7, A_FireShotgun , &States[S_SGUN1+2]),
S_NORMAL (SHTG, 'B', 5, NULL , &States[S_SGUN1+3]),
S_NORMAL (SHTG, 'C', 5, NULL , &States[S_SGUN1+4]),
S_NORMAL (SHTG, 'D', 4, NULL , &States[S_SGUN1+5]),
S_NORMAL (SHTG, 'C', 5, NULL , &States[S_SGUN1+6]),
S_NORMAL (SHTG, 'B', 5, NULL , &States[S_SGUN1+7]),
S_NORMAL (SHTG, 'A', 3, NULL , &States[S_SGUN1+8]),
S_NORMAL (SHTG, 'A', 7, A_ReFire , &States[S_SGUN]),
#define S_SGUNFLASH (S_SGUN1+9)
S_BRIGHT (SHTF, 'A', 4, A_Light1 , &States[S_SGUNFLASH+1]),
S_BRIGHT (SHTF, 'B', 3, A_Light2 , &AWeapon::States[S_LIGHTDONE]),
#define S_SHOT (S_SGUNFLASH+2)
S_NORMAL (SHOT, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (AShotgun, Doom, 2001, 27)
PROP_RadiusFixed (20)
PROP_HeightFixed (16)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (S_SHOT)
PROP_Weapon_SelectionOrder (1300)
PROP_Weapon_AmmoUse1 (1)
PROP_Weapon_AmmoGive1 (8)
PROP_Weapon_UpState (S_SGUNUP)
PROP_Weapon_DownState (S_SGUNDOWN)
PROP_Weapon_ReadyState (S_SGUN)
PROP_Weapon_AtkState (S_SGUN1)
PROP_Weapon_FlashState (S_SGUNFLASH)
PROP_Weapon_Kickback (100)
PROP_Weapon_MoveCombatDist (24000000)
PROP_Weapon_AmmoType1 ("Shell")
PROP_Obituary("$OB_MPSHOTGUN")
PROP_Inventory_PickupMessage("$GOTSHOTGUN")
END_DEFAULTS
//
// A_FireShotgun
//
@ -398,74 +199,6 @@ void A_FireShotgun (AActor *actor)
P_GunShot (actor, false, PClass::FindClass(NAME_BulletPuff));
}
// Super Shotgun ------------------------------------------------------------
void A_FireShotgun2 (AActor *actor);
void A_OpenShotgun2 (AActor *actor);
void A_LoadShotgun2 (AActor *actor);
void A_CloseShotgun2 (AActor *actor);
class ASuperShotgun : public AWeapon
{
DECLARE_ACTOR (ASuperShotgun, AWeapon)
};
FState ASuperShotgun::States[] =
{
#define S_DSGUN 0
S_NORMAL (SHT2, 'A', 1, A_WeaponReady , &States[S_DSGUN]),
#define S_DSGUNDOWN (S_DSGUN+1)
S_NORMAL (SHT2, 'A', 1, A_Lower , &States[S_DSGUNDOWN]),
#define S_DSGUNUP (S_DSGUNDOWN+1)
S_NORMAL (SHT2, 'A', 1, A_Raise , &States[S_DSGUNUP]),
#define S_DSGUN1 (S_DSGUNUP+1)
S_NORMAL (SHT2, 'A', 3, NULL , &States[S_DSGUN1+1]),
S_NORMAL (SHT2, 'A', 7, A_FireShotgun2 , &States[S_DSGUN1+2]),
S_NORMAL (SHT2, 'B', 7, NULL , &States[S_DSGUN1+3]),
S_NORMAL (SHT2, 'C', 7, A_CheckReload , &States[S_DSGUN1+4]),
S_NORMAL (SHT2, 'D', 7, A_OpenShotgun2 , &States[S_DSGUN1+5]),
S_NORMAL (SHT2, 'E', 7, NULL , &States[S_DSGUN1+6]),
S_NORMAL (SHT2, 'F', 7, A_LoadShotgun2 , &States[S_DSGUN1+7]),
S_NORMAL (SHT2, 'G', 6, NULL , &States[S_DSGUN1+8]),
S_NORMAL (SHT2, 'H', 6, A_CloseShotgun2 , &States[S_DSGUN1+9]),
S_NORMAL (SHT2, 'A', 5, A_ReFire , &States[S_DSGUN]),
#define S_DSNR (S_DSGUN1+10)
S_NORMAL (SHT2, 'B', 7, NULL , &States[S_DSNR+1]),
S_NORMAL (SHT2, 'A', 3, NULL , &States[S_DSGUNDOWN]),
#define S_DSGUNFLASH (S_DSNR+2)
S_BRIGHT (SHT2, 'I', 4, A_Light1 , &States[S_DSGUNFLASH+1]),
S_BRIGHT (SHT2, 'J', 3, A_Light2 , &AWeapon::States[S_LIGHTDONE]),
#define S_SHOT2 (S_DSGUNFLASH+2)
S_NORMAL (SGN2, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (ASuperShotgun, Doom, 82, 33)
PROP_RadiusFixed (20)
PROP_HeightFixed (16)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (S_SHOT2)
PROP_Weapon_SelectionOrder (400)
PROP_Weapon_AmmoUse1 (2)
PROP_Weapon_AmmoGive1 (8)
PROP_Weapon_UpState (S_DSGUNUP)
PROP_Weapon_DownState (S_DSGUNDOWN)
PROP_Weapon_ReadyState (S_DSGUN)
PROP_Weapon_AtkState (S_DSGUN1)
PROP_Weapon_FlashState (S_DSGUNFLASH)
PROP_Weapon_Kickback (100)
PROP_Weapon_MoveCombatDist (15000000)
PROP_Weapon_AmmoType1 ("Shell")
PROP_Obituary("$OB_MPSSHOTGUN")
PROP_Inventory_PickupMessage("$GOTSHOTGUN2")
END_DEFAULTS
//
// A_FireShotgun2
//
@ -530,59 +263,50 @@ void A_CloseShotgun2 (AActor *actor)
A_ReFire (actor);
}
// Chaingun -----------------------------------------------------------------
void A_FireCGun (AActor *);
//------------------------------------------------------------------------------------
//
// Setting a random flash like some of Doom's weapons can easily crash when the
// definition is overridden incorrectly so let's check that the state actually exists.
// Be aware though that this will not catch all DEHACKED related problems. But it will
// find all DECORATE related ones.
//
//------------------------------------------------------------------------------------
class AChaingun : public AWeapon
void P_SetSafeFlash(AWeapon * weapon, player_t * player, FState * flashstate, int index)
{
DECLARE_ACTOR (AChaingun, AWeapon)
};
FState AChaingun::States[] =
{
#define S_CHAIN 0
S_NORMAL (CHGG, 'A', 1, A_WeaponReady , &States[S_CHAIN]),
#define S_CHAINDOWN (S_CHAIN+1)
S_NORMAL (CHGG, 'A', 1, A_Lower , &States[S_CHAINDOWN]),
#define S_CHAINUP (S_CHAINDOWN+1)
S_NORMAL (CHGG, 'A', 1, A_Raise , &States[S_CHAINUP]),
#define S_CHAIN1 (S_CHAINUP+1)
S_NORMAL (CHGG, 'A', 4, A_FireCGun , &States[S_CHAIN1+1]),
S_NORMAL (CHGG, 'B', 4, A_FireCGun , &States[S_CHAIN1+2]),
S_NORMAL (CHGG, 'B', 0, A_ReFire , &States[S_CHAIN]),
#define S_CHAINFLASH (S_CHAIN1+3)
S_BRIGHT (CHGF, 'A', 5, A_Light1 , &AWeapon::States[S_LIGHTDONE]),
S_BRIGHT (CHGF, 'B', 5, A_Light2 , &AWeapon::States[S_LIGHTDONE]),
#define S_MGUN (S_CHAINFLASH+2)
S_NORMAL (MGUN, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (AChaingun, Doom, 2002, 28)
PROP_RadiusFixed (20)
PROP_HeightFixed (16)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (S_MGUN)
PROP_Weapon_SelectionOrder (700)
PROP_Weapon_AmmoUse1 (1)
PROP_Weapon_AmmoGive1 (20)
PROP_Weapon_UpState (S_CHAINUP)
PROP_Weapon_DownState (S_CHAINDOWN)
PROP_Weapon_ReadyState (S_CHAIN)
PROP_Weapon_AtkState (S_CHAIN1)
PROP_Weapon_FlashState (S_CHAINFLASH)
PROP_Weapon_Kickback (100)
PROP_Weapon_MoveCombatDist (27000000)
PROP_Weapon_AmmoType1 ("Clip")
PROP_Obituary("$OB_MPCHAINGUN")
PROP_Inventory_PickupMessage("$GOTCHAINGUN")
END_DEFAULTS
const PClass * cls = weapon->GetClass();
while (cls != RUNTIME_CLASS(AWeapon))
{
FActorInfo * info = cls->ActorInfo;
if (flashstate >= info->OwnedStates && flashstate < info->OwnedStates + info->NumOwnedStates)
{
// The flash state belongs to this class.
// Now let's check if the actually wanted state does also
if (flashstate+index < info->OwnedStates + info->NumOwnedStates)
{
// we're ok so set the state
P_SetPsprite (player, ps_flash, flashstate + index);
return;
}
else
{
// oh, no! The state is beyond the end of the state table so use the original flash state.
P_SetPsprite (player, ps_flash, flashstate);
return;
}
}
// try again with parent class
cls = cls->ParentClass;
}
// if we get here the state doesn't seem to belong to any class in the inheritance chain
// This can happen with Dehacked if the flash states are remapped.
// The only way to check this would be to go through all Dehacked modifiable actors and
// find the correct one.
// For now let's assume that it will work.
P_SetPsprite (player, ps_flash, flashstate + index);
}
//
// A_FireCGun
@ -617,7 +341,7 @@ void A_FireCGun (AActor *actor)
theflash = 0;
}
P_SetPsprite (player, ps_flash, flash + theflash);
P_SetSafeFlash (weapon, player, flash, theflash);
}
}
@ -627,94 +351,6 @@ void A_FireCGun (AActor *actor)
P_GunShot (actor, !player->refire, PClass::FindClass(NAME_BulletPuff));
}
// Rocket launcher ---------------------------------------------------------
void A_FireMissile (AActor *);
void A_Explode (AActor *);
class ARocketLauncher : public AWeapon
{
DECLARE_ACTOR (ARocketLauncher, AWeapon)
};
FState ARocketLauncher::States[] =
{
#define S_MISSILE 0
S_NORMAL (MISG, 'A', 1, A_WeaponReady , &States[S_MISSILE]),
#define S_MISSILEDOWN (S_MISSILE+1)
S_NORMAL (MISG, 'A', 1, A_Lower , &States[S_MISSILEDOWN]),
#define S_MISSILEUP (S_MISSILEDOWN+1)
S_NORMAL (MISG, 'A', 1, A_Raise , &States[S_MISSILEUP]),
#define S_MISSILE1 (S_MISSILEUP+1)
S_NORMAL (MISG, 'B', 8, A_GunFlash , &States[S_MISSILE1+1]),
S_NORMAL (MISG, 'B', 12, A_FireMissile , &States[S_MISSILE1+2]),
S_NORMAL (MISG, 'B', 0, A_ReFire , &States[S_MISSILE]),
#define S_MISSILEFLASH (S_MISSILE1+3)
S_BRIGHT (MISF, 'A', 3, A_Light1 , &States[S_MISSILEFLASH+1]),
S_BRIGHT (MISF, 'B', 4, NULL , &States[S_MISSILEFLASH+2]),
S_BRIGHT (MISF, 'C', 4, A_Light2 , &States[S_MISSILEFLASH+3]),
S_BRIGHT (MISF, 'D', 4, A_Light2 , &AWeapon::States[S_LIGHTDONE]),
#define S_LAUN (S_MISSILEFLASH+4)
S_NORMAL (LAUN, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (ARocketLauncher, Doom, 2003, 29)
PROP_RadiusFixed (20)
PROP_HeightFixed (16)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (S_LAUN)
PROP_Weapon_SelectionOrder (2500)
PROP_Weapon_Flags (WIF_NOAUTOFIRE|WIF_BOT_REACTION_SKILL_THING|WIF_BOT_EXPLOSIVE)
PROP_Weapon_AmmoUse1 (1)
PROP_Weapon_AmmoGive1 (2)
PROP_Weapon_UpState (S_MISSILEUP)
PROP_Weapon_DownState (S_MISSILEDOWN)
PROP_Weapon_ReadyState (S_MISSILE)
PROP_Weapon_AtkState (S_MISSILE1)
PROP_Weapon_FlashState (S_MISSILEFLASH)
PROP_Weapon_Kickback (100)
PROP_Weapon_MoveCombatDist (18350080)
PROP_Weapon_AmmoType1 ("RocketAmmo")
PROP_Weapon_ProjectileType ("Rocket")
PROP_Inventory_PickupMessage("$GOTLAUNCHER")
END_DEFAULTS
FState ARocket::States[] =
{
#define S_ROCKET 0
S_BRIGHT (MISL, 'A', 1, NULL , &States[S_ROCKET]),
#define S_EXPLODE (S_ROCKET+1)
S_BRIGHT (MISL, 'B', 8, A_Explode , &States[S_EXPLODE+1]),
S_BRIGHT (MISL, 'C', 6, NULL , &States[S_EXPLODE+2]),
S_BRIGHT (MISL, 'D', 4, NULL , NULL)
};
IMPLEMENT_ACTOR (ARocket, Doom, -1, 127)
PROP_RadiusFixed (11)
PROP_HeightFixed (8)
PROP_SpeedFixed (20)
PROP_Damage (20)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY)
PROP_Flags2 (MF2_PCROSS|MF2_IMPACT|MF2_NOTELEPORT)
PROP_Flags4 (MF4_RANDOMIZE)
PROP_Flags5 (MF5_DEHEXPLOSION)
PROP_FXFlags (FX_ROCKET)
PROP_SpawnState (S_ROCKET)
PROP_DeathState (S_EXPLODE)
PROP_SeeSound ("weapons/rocklf")
PROP_DeathSound ("weapons/rocklx")
PROP_Obituary("$OB_MPROCKET")
END_DEFAULTS
//
// A_FireMissile
//
@ -732,96 +368,9 @@ void A_FireMissile (AActor *actor)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ARocket));
P_SpawnPlayerMissile (actor, PClass::FindClass("Rocket"));
}
// Plasma rifle ------------------------------------------------------------
void A_FirePlasma (AActor *);
class APlasmaRifle : public AWeapon
{
DECLARE_ACTOR (APlasmaRifle, AWeapon)
};
FState APlasmaRifle::States[] =
{
#define S_PLASMA 0
S_NORMAL (PLSG, 'A', 1, A_WeaponReady , &States[S_PLASMA]),
#define S_PLASMADOWN (S_PLASMA+1)
S_NORMAL (PLSG, 'A', 1, A_Lower , &States[S_PLASMADOWN]),
#define S_PLASMAUP (S_PLASMADOWN+1)
S_NORMAL (PLSG, 'A', 1, A_Raise , &States[S_PLASMAUP]),
#define S_PLASMA1 (S_PLASMAUP+1)
S_NORMAL (PLSG, 'A', 3, A_FirePlasma , &States[S_PLASMA1+1]),
S_NORMAL (PLSG, 'B', 20, A_ReFire , &States[S_PLASMA]),
#define S_PLASMAFLASH (S_PLASMA1+2)
S_BRIGHT (PLSF, 'A', 4, A_Light1 , &AWeapon::States[S_LIGHTDONE]),
S_BRIGHT (PLSF, 'B', 4, A_Light1 , &AWeapon::States[S_LIGHTDONE]),
#define S_PLAS (S_PLASMAFLASH+2)
S_NORMAL (PLAS, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (APlasmaRifle, Doom, 2004, 30)
PROP_RadiusFixed (20)
PROP_HeightFixed (16)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (S_PLAS)
PROP_Weapon_SelectionOrder (100)
PROP_Weapon_AmmoUse1 (1)
PROP_Weapon_AmmoGive1 (40)
PROP_Weapon_UpState (S_PLASMAUP)
PROP_Weapon_DownState (S_PLASMADOWN)
PROP_Weapon_ReadyState (S_PLASMA)
PROP_Weapon_AtkState (S_PLASMA1)
PROP_Weapon_FlashState (S_PLASMAFLASH)
PROP_Weapon_Kickback (100)
PROP_Weapon_MoveCombatDist (27000000)
PROP_Weapon_ProjectileType ("PlasmaBall")
PROP_Weapon_AmmoType1 ("Cell")
PROP_Inventory_PickupMessage("$GOTPLASMA")
END_DEFAULTS
FState APlasmaBall::States[] =
{
#define S_PLASBALL 0
S_BRIGHT (PLSS, 'A', 6, NULL , &States[S_PLASBALL+1]),
S_BRIGHT (PLSS, 'B', 6, NULL , &States[S_PLASBALL]),
#define S_PLASEXP (S_PLASBALL+2)
S_BRIGHT (PLSE, 'A', 4, NULL , &States[S_PLASEXP+1]),
S_BRIGHT (PLSE, 'B', 4, NULL , &States[S_PLASEXP+2]),
S_BRIGHT (PLSE, 'C', 4, NULL , &States[S_PLASEXP+3]),
S_BRIGHT (PLSE, 'D', 4, NULL , &States[S_PLASEXP+4]),
S_BRIGHT (PLSE, 'E', 4, NULL , NULL)
};
IMPLEMENT_ACTOR (APlasmaBall, Doom, -1, 51)
PROP_RadiusFixed (13)
PROP_HeightFixed (8)
PROP_SpeedFixed (25)
PROP_Damage (5)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY)
PROP_Flags2 (MF2_PCROSS|MF2_IMPACT|MF2_NOTELEPORT)
PROP_Flags3 (MF3_WARNBOT)
PROP_Flags4 (MF4_RANDOMIZE)
PROP_RenderStyle (STYLE_Add)
PROP_Alpha (TRANSLUC75)
PROP_SpawnState (S_PLASBALL)
PROP_DeathState (S_PLASEXP)
PROP_SeeSound ("weapons/plasmaf")
PROP_DeathSound ("weapons/plasmax")
PROP_Obituary("$OB_MPPLASMARIFLE")
END_DEFAULTS
//
// A_FirePlasma
//
@ -842,11 +391,11 @@ void A_FirePlasma (AActor *actor)
FState *flash = weapon->FindState(NAME_Flash);
if (flash != NULL)
{
P_SetPsprite (player, ps_flash, flash + (pr_fireplasma()&1));
P_SetSafeFlash(weapon, player, flash, (pr_fireplasma()&1));
}
}
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(APlasmaBall));
P_SpawnPlayerMissile (actor, PClass::FindClass("PlasmaBall"));
}
//
@ -873,7 +422,7 @@ void A_FireRailgun (AActor *actor)
FState *flash = weapon->FindState(NAME_Flash);
if (flash != NULL)
{
P_SetPsprite (player, ps_flash, flash + (pr_firerail()&1));
P_SetSafeFlash(weapon, player, flash, (pr_firerail()&1));
}
}
@ -900,118 +449,6 @@ void A_RailWait (AActor *actor)
// Okay, this was stupid. Just use a NULL function instead of this.
}
// BFG 9000 -----------------------------------------------------------------
void A_FireBFG (AActor *);
void A_BFGSpray (AActor *);
void A_BFGsound (AActor *);
class ABFG9000 : public AWeapon
{
DECLARE_ACTOR (ABFG9000, AWeapon)
};
class ABFGExtra : public AActor
{
DECLARE_ACTOR (ABFGExtra, AActor)
};
FState ABFG9000::States[] =
{
#define S_BFG 0
S_NORMAL (BFGG, 'A', 1, A_WeaponReady , &States[S_BFG]),
#define S_BFGDOWN (S_BFG+1)
S_NORMAL (BFGG, 'A', 1, A_Lower , &States[S_BFGDOWN]),
#define S_BFGUP (S_BFGDOWN+1)
S_NORMAL (BFGG, 'A', 1, A_Raise , &States[S_BFGUP]),
#define S_BFG1 (S_BFGUP+1)
S_NORMAL (BFGG, 'A', 20, A_BFGsound , &States[S_BFG1+1]),
S_NORMAL (BFGG, 'B', 10, A_GunFlash , &States[S_BFG1+2]),
S_NORMAL (BFGG, 'B', 10, A_FireBFG , &States[S_BFG1+3]),
S_NORMAL (BFGG, 'B', 20, A_ReFire , &States[S_BFG]),
#define S_BFGFLASH (S_BFG1+4)
S_BRIGHT (BFGF, 'A', 11, A_Light1 , &States[S_BFGFLASH+1]),
S_BRIGHT (BFGF, 'B', 6, A_Light2 , &AWeapon::States[S_LIGHTDONE]),
#define S_BFUG (S_BFGFLASH+2)
S_NORMAL (BFUG, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (ABFG9000, Doom, 2006, 31)
PROP_RadiusFixed (20)
PROP_HeightFixed (20)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (S_BFUG)
PROP_Weapon_Flags (WIF_NOAUTOFIRE|WIF_BOT_REACTION_SKILL_THING|WIF_BOT_BFG)
PROP_Weapon_SelectionOrder (2800)
PROP_Weapon_AmmoUse1 (40)
PROP_Weapon_AmmoGive1 (40)
PROP_Weapon_UpState (S_BFGUP)
PROP_Weapon_DownState (S_BFGDOWN)
PROP_Weapon_ReadyState (S_BFG)
PROP_Weapon_AtkState (S_BFG1)
PROP_Weapon_FlashState (S_BFGFLASH)
PROP_Weapon_Kickback (100)
PROP_Weapon_MoveCombatDist (10000000)
PROP_Weapon_AmmoType1 ("Cell")
PROP_Weapon_ProjectileType ("BFGBall")
PROP_Inventory_PickupMessage("$GOTBFG9000")
END_DEFAULTS
FState ABFGBall::States[] =
{
#define S_BFGSHOT 0
S_BRIGHT (BFS1, 'A', 4, NULL , &States[S_BFGSHOT+1]),
S_BRIGHT (BFS1, 'B', 4, NULL , &States[S_BFGSHOT]),
#define S_BFGLAND (S_BFGSHOT+2)
S_BRIGHT (BFE1, 'A', 8, NULL , &States[S_BFGLAND+1]),
S_BRIGHT (BFE1, 'B', 8, NULL , &States[S_BFGLAND+2]),
S_BRIGHT (BFE1, 'C', 8, A_BFGSpray , &States[S_BFGLAND+3]),
S_BRIGHT (BFE1, 'D', 8, NULL , &States[S_BFGLAND+4]),
S_BRIGHT (BFE1, 'E', 8, NULL , &States[S_BFGLAND+5]),
S_BRIGHT (BFE1, 'F', 8, NULL , NULL)
};
IMPLEMENT_ACTOR (ABFGBall, Doom, -1, 128)
PROP_RadiusFixed (13)
PROP_HeightFixed (8)
PROP_SpeedFixed (25)
PROP_Damage (100)
PROP_Flags (MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY)
PROP_Flags2 (MF2_PCROSS|MF2_IMPACT|MF2_NOTELEPORT)
PROP_Flags4 (MF4_RANDOMIZE)
PROP_RenderStyle (STYLE_Add)
PROP_Alpha (TRANSLUC75)
PROP_SpawnState (S_BFGSHOT)
PROP_DeathState (S_BFGLAND)
PROP_DeathSound ("weapons/bfgx")
PROP_Obituary("$OB_MPBFG_BOOM")
END_DEFAULTS
FState ABFGExtra::States[] =
{
S_BRIGHT (BFE2, 'A', 8, NULL , &States[1]),
S_BRIGHT (BFE2, 'B', 8, NULL , &States[2]),
S_BRIGHT (BFE2, 'C', 8, NULL , &States[3]),
S_BRIGHT (BFE2, 'D', 8, NULL , NULL)
};
IMPLEMENT_ACTOR (ABFGExtra, Doom, -1, 0)
PROP_Flags (MF_NOBLOCKMAP|MF_NOGRAVITY)
PROP_RenderStyle (STYLE_Add)
PROP_Alpha (TRANSLUC75)
PROP_SpawnState (0)
END_DEFAULTS
//
// A_FireBFG
//
@ -1040,7 +477,7 @@ void A_FireBFG (AActor *actor)
actor->pitch = 0;
player->userinfo.aimdist = ANGLE_1*35;
}
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ABFGBall));
P_SpawnPlayerMissile (actor, PClass::FindClass("BFGBall"));
actor->pitch = storedpitch;
player->userinfo.aimdist = storedaimdist;
}
@ -1073,7 +510,7 @@ void A_BFGSpray (AActor *mo)
}
if (spraytype == NULL)
{
spraytype = RUNTIME_CLASS(ABFGExtra);
spraytype = PClass::FindClass("BFGExtra");
}
// [RH] Don't crash if no target

View file

@ -676,7 +676,7 @@ void A_M_FireMissile (AActor *self)
else
{
A_FaceTarget (self);
P_SpawnMissile (self, self->target, RUNTIME_CLASS(ARocket));
P_SpawnMissile (self, self->target, PClass::FindClass("Rocket"));
}
}
@ -707,7 +707,7 @@ void A_M_FirePlasma (AActor *self)
return;
A_FaceTarget (self);
P_SpawnMissile (self, self->target, RUNTIME_CLASS(APlasmaBall));
P_SpawnMissile (self, self->target, PClass::FindClass("PlasmaBall"));
self->special1 = level.maptime + 20;
}
@ -747,7 +747,7 @@ void A_M_FireBFG (AActor *self)
return;
A_FaceTarget (self);
P_SpawnMissile (self, self->target, RUNTIME_CLASS(ABFGBall));
P_SpawnMissile (self, self->target, PClass::FindClass("BFGBall"));
self->special1 = level.maptime + 30;
self->PainChance = MARINE_PAIN_CHANCE;
}

View file

@ -1435,11 +1435,11 @@ bool AHealthPickup::Use (bool pickup)
//===========================================================================
//
// ABackpack :: Serialize
// ABackpackItem :: Serialize
//
//===========================================================================
void ABackpack::Serialize (FArchive &arc)
void ABackpackItem::Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << bDepleted;
@ -1447,14 +1447,14 @@ void ABackpack::Serialize (FArchive &arc)
//===========================================================================
//
// ABackpack :: CreateCopy
// ABackpackItem :: CreateCopy
//
// A backpack is being added to a player who doesn't yet have one. Give them
// every kind of ammo, and increase their max amounts.
//
//===========================================================================
AInventory *ABackpack::CreateCopy (AActor *other)
AInventory *ABackpackItem::CreateCopy (AActor *other)
{
// Find every unique type of ammo. Give it to the player if
// he doesn't have it already, and double it's maximum capacity.
@ -1504,19 +1504,19 @@ AInventory *ABackpack::CreateCopy (AActor *other)
//===========================================================================
//
// ABackpack :: HandlePickup
// ABackpackItem :: HandlePickup
//
// When the player picks up another backpack, just give them more ammo.
//
//===========================================================================
bool ABackpack::HandlePickup (AInventory *item)
bool ABackpackItem::HandlePickup (AInventory *item)
{
// Since you already have a backpack, that means you already have every
// kind of ammo in your inventory, so we don't need to look at the
// entire PClass list to discover what kinds of ammo exist, and we don't
// have to alter the MaxAmount either.
if (item->IsKindOf (RUNTIME_CLASS(ABackpack)))
if (item->IsKindOf (RUNTIME_CLASS(ABackpackItem)))
{
for (AInventory *probe = Owner->Inventory; probe != NULL; probe = probe->Inventory)
{
@ -1557,27 +1557,27 @@ bool ABackpack::HandlePickup (AInventory *item)
//===========================================================================
//
// ABackpack :: CreateTossable
// ABackpackItem :: CreateTossable
//
// The tossed backpack must not give out any more ammo, otherwise a player
// could cheat by dropping their backpack and picking it up for more ammo.
//
//===========================================================================
AInventory *ABackpack::CreateTossable ()
AInventory *ABackpackItem::CreateTossable ()
{
ABackpack *pack = static_cast<ABackpack *>(Super::CreateTossable());
ABackpackItem *pack = static_cast<ABackpackItem *>(Super::CreateTossable());
pack->bDepleted = true;
return pack;
}
//===========================================================================
//
// ABackpack :: DetachFromOwner
// ABackpackItem :: DetachFromOwner
//
//===========================================================================
void ABackpack::DetachFromOwner ()
void ABackpackItem::DetachFromOwner ()
{
// When removing a backpack, drop the player's ammo maximums to normal
AInventory *item;
@ -1602,17 +1602,7 @@ void ABackpack::DetachFromOwner ()
//
//===========================================================================
FState ABackpack::States[] =
{
S_NORMAL (BPAK, 'A', -1, NULL , NULL)
};
IMPLEMENT_ACTOR (ABackpack, Doom, 8, 144)
PROP_HeightFixed (26)
PROP_Flags (MF_SPECIAL)
PROP_SpawnState (0)
PROP_Inventory_PickupMessage("$GOTBACKPACK")
END_DEFAULTS
IMPLEMENT_ABSTRACT_ACTOR(ABackpackItem)
IMPLEMENT_ABSTRACT_ACTOR (AMapRevealer)

View file

@ -396,9 +396,9 @@ public:
// A backpack gives you one clip of each ammo and doubles your
// normal maximum ammo amounts.
class ABackpack : public AInventory
class ABackpackItem : public AInventory
{
DECLARE_ACTOR (ABackpack, AInventory)
DECLARE_ACTOR (ABackpackItem, AInventory)
public:
void Serialize (FArchive &arc);
bool HandlePickup (AInventory *item);

View file

@ -394,8 +394,13 @@ void FGameConfigFile::DoGameSetup (const char *gamename)
}
}
}
}
// Separated from DoGameSetup because it needs all the weapons properly defined
void FGameConfigFile::DoWeaponSetup (const char *gamename)
{
strcpy (subsection, "WeaponSlots");
if (!SetSection (section) || !LocalWeapons.RestoreSlots (*this))
{
SetupWeaponList (gamename);

View file

@ -46,6 +46,7 @@ public:
void DoGlobalSetup ();
void DoGameSetup (const char *gamename);
void DoWeaponSetup (const char *gamename);
void ArchiveGlobalData ();
void ArchiveGameData (const char *gamename);
void AddAutoexec (DArgs *list, const char *gamename);
@ -70,5 +71,6 @@ private:
};
extern FString WeaponSection;
extern FGameConfigFile *GameConfig;
#endif //__GAMECONFIGFILE_H__

View file

@ -376,6 +376,8 @@ enum
#pragma warning(disable:4200)
#endif
typedef TMap<FName, fixed_t> DmgFactors;
struct FActorInfo
{
static void StaticInit ();
@ -405,6 +407,7 @@ struct FActorInfo
BYTE SpawnID;
SWORD DoomEdNum;
FStateLabels * StateList;
DmgFactors *DamageFactors;
#if _MSC_VER
// A 0-terminated list of default properties

View file

@ -80,7 +80,7 @@ typedef void (*voidfunc_)();
FActorInfo actor##ActorInfo = {
#define BEGIN_DEFAULTS_POST(actor,game,ednum,id) \
GAME_##game, id, ednum, NULL,
GAME_##game, id, ednum, NULL, NULL,
#ifdef WORDS_BIGENDIAN
#define END_DEFAULTS "\xED\x5E" };
@ -133,7 +133,7 @@ extern void ApplyActorDefault (int defnum, int dataint);
FActorInfo actor##ActorInfo = {
#define BEGIN_DEFAULTS_POST(actor,game,ednum,id) \
GAME_##game, id, ednum, NULL, actor##DefaultsConstructor }; \
GAME_##game, id, ednum, NULL, NULL, actor##DefaultsConstructor }; \
void actor##DefaultsConstructor() { \
#define END_DEFAULTS }

View file

@ -1570,7 +1570,8 @@ void A_Look (AActor *actor)
}
else
{
targ = (i_compatflags & COMPATF_SOUNDTARGET)? actor->Sector->SoundTarget : actor->LastHeard;
targ = (i_compatflags & COMPATF_SOUNDTARGET || actor->flags & MF_NOSECTOR)?
actor->Sector->SoundTarget : actor->LastHeard;
// [RH] If the soundtarget is dead, don't chase it
if (targ != NULL && targ->health <= 0)

View file

@ -885,10 +885,26 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
return;
}
}
// to be removed and replaced by an actual damage factor
// once the actors using it are converted to DECORATE.
if (mod == NAME_Fire && target->flags4 & MF4_FIRERESIST)
{
damage /= 2;
}
else
{
DmgFactors * df = target->GetClass()->ActorInfo->DamageFactors;
if (df != NULL)
{
fixed_t * pdf = df->CheckKey(mod);
if (pdf != NULL)
{
damage = FixedMul(damage, *pdf);
if (damage <= 0) return;
}
}
}
damage = inflictor->DoSpecialDamage (target, damage);
if (damage == -1)
{

View file

@ -1173,6 +1173,13 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag)
bag->Info = info;
info->DoomEdNum = -1;
if (parent->ActorInfo->DamageFactors != NULL)
{
// copy damage factors from parent
info->DamageFactors = new DmgFactors;
*info->DamageFactors = *parent->ActorInfo->DamageFactors;
}
else info->DamageFactors = NULL;
// Check for "replaces"
SC_MustGetString ();
@ -1290,15 +1297,15 @@ bool DoSpecialFunctions(FState & state, bool multistate, int * statecount, Bagga
StateParameters[paramindex]=spec->Special;
// Make this consistent with all other parameter parsing
if (SC_CheckString("("))
if (SC_CheckToken('('))
{
for (i = 0; i < 5;)
{
StateParameters[paramindex+i+1]=ParseExpression (false, bag.Info->Class);
i++;
if (!SC_CheckString (",")) break;
if (!SC_CheckToken (',')) break;
}
SC_MustGetStringName (")");
SC_MustGetToken (')');
}
else i=0;
@ -1378,14 +1385,12 @@ static FString ParseStateString()
if (SC_CheckString("::"))
{
SC_MustGetString ();
statestring += "::";
statestring += sc_String;
statestring << "::" << sc_String;
}
while (SC_CheckString ("."))
{
SC_MustGetString ();
statestring += ".";
statestring += sc_String;
statestring << "." << sc_String;
}
return statestring;
}
@ -3175,6 +3180,23 @@ static void ActorDamageType (AActor *defaults, Baggage &bag)
else defaults->DamageType=sc_String;
}
//==========================================================================
//
//==========================================================================
static void ActorDamageFactor (AActor *defaults, Baggage &bag)
{
SC_MustGetString ();
if (bag.Info->DamageFactors == NULL) bag.Info->DamageFactors=new DmgFactors;
FName dmgType;
if (SC_Compare("Normal")) dmgType = NAME_None;
else dmgType=sc_String;
SC_MustGetToken(',');
SC_MustGetFloat();
bag.Info->DamageFactors[dmgType]=(fixed_t)(sc_Float*FRACUNIT);
}
//==========================================================================
//
//==========================================================================
@ -4127,6 +4149,7 @@ static const ActorProps props[] =
{ "crash", ActorCrashState, RUNTIME_CLASS(AActor) },
{ "crush", ActorCrushState, RUNTIME_CLASS(AActor) },
{ "damage", ActorDamage, RUNTIME_CLASS(AActor) },
{ "damagefactor", ActorDamageFactor, RUNTIME_CLASS(AActor) },
{ "damagetype", ActorDamageType, RUNTIME_CLASS(AActor) },
{ "death", ActorDeathState, RUNTIME_CLASS(AActor) },
{ "deathheight", ActorDeathHeight, RUNTIME_CLASS(AActor) },
@ -4377,6 +4400,7 @@ void FinishThingdef()
sprintf(fmt, "QuestItem%d", i+1);
QuestItemClasses[i]=PClass::FindClass(fmt);
}
}
//==========================================================================
@ -4433,3 +4457,13 @@ void ParseClass()
SC_MustGetAnyToken();
}
}
void ParseActionFunction()
{
// for now only void functions with no parameters
SC_MustGetToken(TK_Void);
SC_MustGetString();
FName funcname = sc_String;
SC_MustGetToken('(');
SC_MustGetToken(')');
}

View file

@ -410,7 +410,7 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
Printf("%s%s", dot, JumpParameters[offset+2+i].GetChars());
dot = ".";
}
Printf("not found in %s\n", self->GetClass()->TypeName.GetChars());
Printf("' not found in %s\n", self->GetClass()->TypeName.GetChars());
}
return jumpto;
}

View file

@ -34,6 +34,7 @@
#include "actors/doom/doomkeys.txt"
#include "actors/doom/doommisc.txt"
#include "actors/doom/doomdecorations.txt"
#include "actors/doom/doomweapons.txt"
#include "actors/doom/stealthmonsters.txt"
#include "actors/raven/artiegg.txt"

View file

@ -142,3 +142,19 @@ ACTOR ShellBox : Shell 2049
}
}
// Backpack ---------------------------------------------------------------
ACTOR Backpack : BackpackItem 8
{
Game Doom
SpawnID 144
Height 26
Inventory.PickupMessage "$GOTBACKPACK"
States
{
Spawn:
BPAK A -1
Stop
}
}

View file

@ -0,0 +1,500 @@
// --------------------------------------------------------------------------
//
// Doom weapon base class
//
// --------------------------------------------------------------------------
ACTOR DoomWeapon : Weapon
{
Weapon.Kickback 100
States
{
LightDone:
SHTG E 0 A_Light0
Stop
Ready: // get around the consistency checks
Deselect:
Select:
Fire:
TNT1 A 0
Stop
}
}
// --------------------------------------------------------------------------
//
// Fist
//
// --------------------------------------------------------------------------
ACTOR Fist : Weapon
{
Weapon.SelectionOrder 3700
Weapon.Kickback 100
Obituary "$OB_MPFIST"
+WEAPON.WIMPY_WEAPON
+WEAPON.MELEEWEAPON
States
{
Ready:
PUNG A 1 A_WeaponReady
Loop
Deselect:
PUNG A 1 A_Lower
Loop
Select:
PUNG A 1 A_Raise
Loop
Fire:
PUNG B 4
PUNG C 4 A_Punch
PUNG D 5
PUNG C 4
PUNG B 5 A_ReFire
Goto Ready
}
}
// --------------------------------------------------------------------------
//
// Fist
//
// --------------------------------------------------------------------------
ACTOR Pistol : DoomWeapon
{
Weapon.SelectionOrder 1900
Weapon.AmmoUse 1
Weapon.AmmoGive 20
Weapon.AmmoType "Clip"
Obituary "$OB_MPPISTOL"
+WEAPON.WIMPY_WEAPON
States
{
Ready:
PISG A 1 A_WeaponReady
Loop
Deselect:
PISG A 1 A_Lower
Loop
Select:
PISG A 1 A_Raise
Loop
Fire:
PISG A 4
PISG B 6 A_FirePistol
PISG C 4
PISG B 5 A_ReFire
Goto Ready
Flash:
PISF A 7 Bright A_Light1
Goto LightDone
PISF A 7 Bright A_Light1
Goto LightDone
}
}
// --------------------------------------------------------------------------
//
// Chainsaw
//
// --------------------------------------------------------------------------
ACTOR Chainsaw : Weapon 2005
{
Game Doom
SpawnID 32
Weapon.SelectionOrder 2200
Weapon.UpSound "weapons/sawup"
Weapon.ReadySound "weapons/sawidle"
Inventory.PickupMessage "$GOTCHAINSAW"
Obituary "$OB_MPCHAINSAW"
+WEAPON.MELEEWEAPON
States
{
Ready:
SAWG CD 4 A_WeaponReady
Loop
Deselect:
SAWG C 1 A_Lower
Loop
Select:
SAWG C 1 A_Raise
Loop
Fire:
SAWG AB 4 A_Saw
SAWG B 0 A_ReFire
Goto Ready
Spawn:
CSAW A -1
Stop
}
}
// --------------------------------------------------------------------------
//
// Shotgun
//
// --------------------------------------------------------------------------
ACTOR Shotgun : DoomWeapon 2001
{
Game Doom
SpawnID 21
Weapon.SelectionOrder 1300
Weapon.AmmoUse 1
Weapon.AmmoGive 8
Weapon.AmmoType "Shell"
Inventory.PickupMessage "$GOTSHOTGUN"
Obituary "OB_MPSHOTGUN"
States
{
Ready:
SHTG A 1 A_WeaponReady
Loop
Deselect:
SHTG A 1 A_Lower
Loop
Select:
SHTG A 1 A_Raise
Loop
Fire:
SHTG A 3
SHTG A 7 A_FireShotgun
SHTG BC 5
SHTG D 4
SHTG CB 5
SHTG A 3
SHTG A 7 A_ReFire
Goto Ready
Flash:
SHTF A 4 Bright A_Light1
SHTF B 3 Bright A_Light2
Goto LightDone
Spawn:
SHOT A -1
Stop
}
}
// --------------------------------------------------------------------------
//
// Shotgun
//
// --------------------------------------------------------------------------
ACTOR SuperShotgun : DoomWeapon 82
{
Game Doom
SpawnID 33
Weapon.SelectionOrder 400
Weapon.AmmoUse 2
Weapon.AmmoGive 8
Weapon.AmmoType "Shell"
Inventory.PickupMessage "$GOTSHOTGUN2"
Obituary "OB_MPSSHOTGUN"
States
{
Ready:
SHT2 A 1 A_WeaponReady
Loop
Deselect:
SHT2 A 1 A_Lower
Loop
Select:
SHT2 A 1 A_Raise
Loop
Fire:
SHT2 A 3
SHT2 A 7 A_FireShotgun2
SHT2 B 7
SHT2 C 7 A_CheckReload
SHT2 D 7 A_OpenShotgun2
SHT2 E 7
SHT2 F 7 A_LoadShotgun2
SHT2 G 6
SHT2 H 6 A_CloseShotgun2
SHT2 A 5 A_ReFire
Goto Ready
// unused states
SHT2 B 7
SHT2 A 3
Goto Deselect
Flash:
SHT2 I 4 Bright A_Light1
SHT2 J 3 Bright A_Light2
Goto LightDone
Spawn:
SGN2 A -1
Stop
}
}
// --------------------------------------------------------------------------
//
// Chaingun
//
// --------------------------------------------------------------------------
ACTOR Chaingun : DoomWeapon 2002
{
Game Doom
SpawnID 28
Weapon.SelectionOrder 700
Weapon.AmmoUse 1
Weapon.AmmoGive 20
Weapon.AmmoType "Clip"
Inventory.PickupMessage "$GOTCHAINGUN"
Obituary "OB_MPCHAINGUN"
States
{
Ready:
CHGG A 1 A_WeaponReady
Loop
Deselect:
CHGG A 1 A_Lower
Loop
Select:
CHGG A 1 A_Raise
Loop
Fire:
CHGG AB 4 A_FireCGun
CHGG B 0 A_ReFire
Goto Ready
Flash:
CHGF A 5 Bright A_Light1
Goto LightDone
CHGF B 5 Bright A_Light1
Goto LightDone
Spawn:
MGUN A -1
Stop
}
}
// --------------------------------------------------------------------------
//
// Rocket launcher
//
// --------------------------------------------------------------------------
ACTOR RocketLauncher : DoomWeapon 2003
{
Game Doom
SpawnID 29
Weapon.SelectionOrder 2500
Weapon.AmmoUse 1
Weapon.AmmoGive 2
Weapon.AmmoType "RocketAmmo"
+WEAPON.NOAUTOFIRE
Inventory.PickupMessage "$GOTLAUNCHER"
States
{
Ready:
MISG A 1 A_WeaponReady
Loop
Deselect:
MISG A 1 A_Lower
Loop
Select:
MISG A 1 A_Raise
Loop
Fire:
MISG B 8 A_GunFlash
MISG B 12 A_FireMissile
MISG B 0 A_ReFire
Goto Ready
Flash:
MISF A 3 Bright A_Light1
MISF B 4 Bright
MISF CD 4 Bright A_Light2
Goto LightDone
Spawn:
LAUN A -1
Stop
}
}
ACTOR Rocket
{
Game Doom
SpawnID 127
Radius 11
Height 8
Speed 20
Damage 20
Projectile
+RANDOMIZE
+DEHEXPLOSION
+ROCKETTRAIL
SeeSound "weapons/rocklf"
DeathSound "weapons/rocklx"
Obituary "$OB_MPROCKET"
States
{
Spawn:
MISL A 1 Bright
Loop
Death:
MISL B 8 Bright A_Explode
MISL C 6 Bright
MISL D 4 Bright
Stop
}
}
// --------------------------------------------------------------------------
//
// Plasma rifle
//
// --------------------------------------------------------------------------
ACTOR PlasmaRifle : DoomWeapon 2004
{
Game Doom
SpawnID 30
Weapon.SelectionOrder 100
Weapon.AmmoUse 1
Weapon.AmmoGive 40
Weapon.AmmoType "Cell"
Inventory.PickupMessage "$GOTPLASMA"
States
{
Ready:
PLSG A 1 A_WeaponReady
Loop
Deselect:
PLSG A 1 A_Lower
Loop
Select:
PLSG A 1 A_Raise
Loop
Fire:
PLSG A 3 A_FirePlasma
PLSG B 20 A_ReFire
Goto Ready
Flash:
PLSF A 4 Bright A_Light1
Goto LightDone
PLSF B 4 Bright A_Light1
Goto LightDone
Spawn:
PLAS A -1
Stop
}
}
ACTOR PlasmaBall
{
Radius 13
Height 8
Speed 25
Damage 5
Projectile
+RANDOMIZE
RenderStyle Add
Alpha 0.75
SeeSound "weapons/plasmaf"
DeathSound "weapons/plasmax"
Obituary "$OB_MPPLASMARIFLE"
States
{
Spawn:
PLSS AB 6 Bright
Loop
Death:
PLSE ABCDE 4 Bright
Stop
}
}
// --------------------------------------------------------------------------
//
// BFG 9000
//
// --------------------------------------------------------------------------
ACTOR BFG9000 : DoomWeapon 2006
{
Game Doom
Height 20
SpawnID 31
Weapon.SelectionOrder 2800
Weapon.AmmoUse 40
Weapon.AmmoGive 40
Weapon.AmmoType "Cell"
+WEAPON.NOAUTOFIRE
Inventory.PickupMessage "$GOTBFG9000"
States
{
Ready:
BFGG A 1 A_WeaponReady
Loop
Deselect:
BFGG A 1 A_Lower
Loop
Select:
BFGG A 1 A_Raise
Loop
Fire:
BFGG A 20 A_BFGsound
BFGG B 10 A_GunFlash
BFGG B 10 A_FireBFG
BFGG B 20 A_ReFire
Goto Ready
Flash:
BFGF A 11 Bright A_Light1
BFGF B 6 Bright A_Light2
Goto LightDone
Spawn:
BFUG A -1
Stop
}
}
ACTOR BFGBall
{
Game Doom
SpawnID 128
Radius 13
Height 8
Speed 25
Damage 100
Projectile
+RANDOMIZE
RenderStyle Add
Alpha 0.75
DeathSound "weapons/bfgx"
Obituary "$OB_MPBFG_BOOM"
States
{
Spawn:
BFS1 AB 4 Bright
Loop
Death:
BFE1 AB 8 Bright
BFE1 C 8 Bright A_BFGSpray
BFE1 EF 8 Bright
Stop
}
}
ACTOR BFGExtra
{
+NOBLOCKMAP
+NOGRAVITY
RenderStyle Add
Alpha 0.75
States
{
Spawn:
BFE2 ABCD 8 Bright
Stop
}
}

View file

@ -214,7 +214,7 @@ ACTOR PhoenixRodHefty : PhoenixRodAmmo 23
// --- Bag of holding -------------------------------------------------------
ACTOR BagOfHolding : Backpack 8
ACTOR BagOfHolding : BackpackItem 8
{
Game Heretic
SpawnID 136

View file

@ -197,6 +197,10 @@ class Inventory extends Actor
action native A_FireCGun();
action native A_FireMissile();
action native A_FirePlasma();
action native A_FireRailgun();
action native A_FireRailgunLeft();
action native A_FireRailgunRight();
action native A_RailWait();
action native A_BFGsound();
action native A_FireBFG();
action native A_ReFire();
@ -204,3 +208,4 @@ class Inventory extends Actor
action native A_GunFlash();
action native A_Saw(optional coerce sound fullsound, optional coerce sound hitsound, optional eval int damage, optional class<Actor> pufftype);
}

View file

@ -212,7 +212,7 @@ ACTOR ElectricBolts : Ammo 114
// Ammo Satchel -------------------------------------------------------------
ACTOR AmmoSatchel : Backpack 183
ACTOR AmmoSatchel : BackpackItem 183
{
Game Strife
SpawnID 144

Binary file not shown.

View file

@ -329,7 +329,7 @@ OrgSprNames
StateMap
{
// S_NULL is implicit
Weapon, FirstState, 1, // S_LIGHTDONE
DoomWeapon, FirstState, 1, // S_LIGHTDONE
Fist, FirstState, 8, // S_PUNCH - S_PUNCH5
Pistol, FirstState, 8, // S_PISTOL - S_PISTOLFLASH
Shotgun, FirstState, 14, // S_SGUN - S_SGUNFLASH2

View file

@ -278,6 +278,7 @@ actors/doom/doomhealth.txt decorate/doom/doomhealth.txt
actors/doom/doomkeys.txt decorate/doom/doomkeys.txt
actors/doom/doommisc.txt decorate/doom/doommisc.txt
actors/doom/doomdecorations.txt decorate/doom/doomdecorations.txt
actors/doom/doomweapons.txt decorate/doom/doomweapons.txt
actors/doom/stealthmonsters.txt decorate/doom/stealthmonsters.txt
actors/raven/artiegg.txt decorate/raven/artiegg.txt