- Added the ACS commands

ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
      optional bool not_mid, optional bool not_upper, optional bool not_floor,
      optional bool not_ceiling); and
  SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
      str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
  correction. When this is enabled, the only display ratio available is 4:3
  (and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
  through decorate. Just enclose it within parentheses, and the expression
  will be evaluated exactly as-is without the normal Doom damage calculation.
  So if you want something that does exactly 6 damage, use a "Damage (6)"
  property. To deal normal Doom missile damage, you can use
  "Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
  maintained by ObtainInventory.


SVN r288 (trunk)
This commit is contained in:
Randy Heit 2006-08-12 02:30:57 +00:00
parent 55e299e4b3
commit b25c7722f3
30 changed files with 369 additions and 180 deletions

View file

@ -1,3 +1,22 @@
August 11, 2006
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
August 10, 2006 (Changes by Graf Zahl)
- Gave Strife's PhosphorousFire the MF2_NODMGTHRUST flag so that its
damage is truly thrustless. The 'thrustless' parameter disabled all

View file

@ -590,6 +590,9 @@ public:
return (flags & MF_COUNTKILL) && !(flags & MF_FRIENDLY);
}
// Calculate amount of missile damage
virtual int GetMissileDamage(int mask, int add);
// info for drawing
// NOTE: The first member variable *must* be x.
fixed_t x,y,z;
@ -621,7 +624,7 @@ public:
fixed_t momx, momy, momz; // momentums
SDWORD tics; // state tic counter
FState *state;
SDWORD damage; // For missiles and monster railgun
SDWORD Damage; // For missiles and monster railgun
DWORD flags;
DWORD flags2; // Heretic flags
DWORD flags3; // [RH] Hexen/Heretic actor-dependant behavior made flaggable

View file

@ -301,13 +301,13 @@ CCMD (hxvisit)
CCMD (changemap)
{
if (m_Instigator == NULL)
if (who == NULL)
{
Printf ("Use the map command when not in a game.\n");
return;
}
if (m_Instigator->player - players != Net_Arbitrator && multiplayer)
if (who->player - players != Net_Arbitrator && multiplayer)
{
Printf ("Only player %d can change the map.\n", Net_Arbitrator+1);
return;
@ -540,8 +540,7 @@ CCMD (dir)
CCMD (fov)
{
player_t *player = m_Instigator ? m_Instigator->player
: &players[consoleplayer];
player_t *player = who ? who->player : &players[consoleplayer];
if (argv.argc() != 2)
{

View file

@ -839,9 +839,9 @@ FConsoleCommand::~FConsoleCommand ()
delete[] m_Name;
}
void FConsoleCommand::Run (FCommandLine &argv, AActor *instigator, int key)
void FConsoleCommand::Run (FCommandLine &argv, APlayerPawn *who, int key)
{
m_RunFunc (argv, instigator, key);
m_RunFunc (argv, who, key);
}
FConsoleAlias::FConsoleAlias (const char *name, const char *command, bool noSave)
@ -1097,7 +1097,7 @@ bool FConsoleAlias::IsAlias ()
return true;
}
void FConsoleAlias::Run (FCommandLine &args, AActor *m_Instigator, int key)
void FConsoleAlias::Run (FCommandLine &args, APlayerPawn *who, int key)
{
if (bRunning)
{

View file

@ -37,6 +37,7 @@
#include "dobject.h"
class FConfigFile;
class APlayerPawn;
void C_ExecCmdLineParams ();
@ -76,7 +77,7 @@ private:
long argsize;
};
typedef void (*CCmdRun) (FCommandLine &argv, AActor *instigator, int key);
typedef void (*CCmdRun) (FCommandLine &argv, APlayerPawn *instigator, int key);
class FConsoleCommand
{
@ -86,7 +87,7 @@ public:
virtual bool IsAlias ();
void PrintCommand () { Printf ("%s\n", m_Name); }
virtual void Run (FCommandLine &args, AActor *instigator, int key);
virtual void Run (FCommandLine &args, APlayerPawn *instigator, int key);
FConsoleCommand *m_Next, **m_Prev;
char *m_Name;
@ -102,9 +103,9 @@ protected:
};
#define CCMD(n) \
void Cmd_##n (FCommandLine &, AActor *, int key); \
FConsoleCommand Cmd_##n##_ (#n, Cmd_##n); \
void Cmd_##n (FCommandLine &argv, AActor *m_Instigator, int key)
void Cmd_##n (FCommandLine &, APlayerPawn *, int key); \
FConsoleCommand Cmd_##n##_Ref (#n, Cmd_##n); \
void Cmd_##n (FCommandLine &argv, APlayerPawn *who, int key)
const int KEY_DBLCLICKED = 0x8000;
@ -113,7 +114,7 @@ class FConsoleAlias : public FConsoleCommand
public:
FConsoleAlias (const char *name, const char *command, bool noSave);
~FConsoleAlias ();
void Run (FCommandLine &args, AActor *Instigator, int key);
void Run (FCommandLine &args, APlayerPawn *Instigator, int key);
bool IsAlias ();
void PrintAlias ();
void Archive (FConfigFile *f);

View file

@ -778,7 +778,7 @@ static int PatchThing (int thingy)
}
else if (linelen == 14 && stricmp (Line1, "Missile damage") == 0)
{
info->damage = val;
info->Damage = val;
}
else if (linelen == 5)
{

View file

@ -59,6 +59,7 @@ class player_s;
class APlayerPawn : public AActor
{
DECLARE_STATELESS_ACTOR (APlayerPawn, AActor)
HAS_OBJECT_POINTERS
public:
virtual void Serialize (FArchive &arc);
@ -99,6 +100,8 @@ public:
int crouchsprite;
int MaxHealth;
AInventory *InvFirst; // first inventory item displayed on inventory bar
AInventory *InvSel; // selected inventory item
// [GRB] Player class properties
fixed_t JumpZ;
@ -212,8 +215,6 @@ public:
int health; // only used between levels, mo->health
// is used during levels
AInventory *InvFirst; // first inventory item displayed on inventory bar
AInventory *InvSel; // selected inventory item
int inventorytics;
BYTE CurrentPlayerClass; // class # for this player instance
int pieces; // Fourth Weapon pieces

View file

@ -721,7 +721,7 @@ static void ParseInsideDecoration (FActorInfo *info, AActor *defaults,
else if (def == DEF_Projectile && SC_Compare ("Damage"))
{
SC_MustGetNumber ();
defaults->damage = sc_Number;
defaults->Damage = sc_Number;
}
else if (def == DEF_Projectile && SC_Compare ("DamageType"))
{

View file

@ -124,18 +124,17 @@ void PClass::InsertIntoHash ()
// Find a type, passed the name as a string
const PClass *PClass::FindClass (const char *zaname)
{
FName namename (zaname, true);
if (namename == NAME_None)
{
return NULL;
}
return FindClass (namename);
return FindClass (FName (zaname, true));
}
// Find a type, passed the name as a name
const PClass *PClass::FindClass (FName zaname)
{
if (zaname == NAME_None)
{
return NULL;
}
PClass *cls = TypeHash[zaname % HASH_SIZE];
while (cls != 0)

View file

@ -246,7 +246,7 @@ void A_FatAttack3 (AActor *self)
void A_Mushroom (AActor *actor)
{
int i, j, n = actor->damage;
int i, j, n = actor->GetMissileDamage (0, 1);
const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL);
@ -255,7 +255,7 @@ void A_Mushroom (AActor *actor)
spawntype = PClass::FindClass((ENamedName)StateParameters[index]);
n = EvalExpressionI (StateParameters[index+1], actor);
if (n == 0)
n = actor->damage;
n = actor->GetMissileDamage (0, 1);
}
if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot);

View file

@ -460,23 +460,23 @@ private:
FaceRefresh = screen->GetPageCount ();
OldFaceIndex = FaceIndex;
}
if (FaceRefresh || (CPlayer->InvSel != NULL && !(level.flags & LEVEL_NOINVENTORYBAR)))
if (FaceRefresh || (CPlayer->mo->InvSel != NULL && !(level.flags & LEVEL_NOINVENTORYBAR)))
{
if (FaceRefresh)
{
FaceRefresh--;
}
DrawPartialImage (&StatusBarTex, 142, 37);
if (CPlayer->InvSel == NULL || (level.flags & LEVEL_NOINVENTORYBAR))
if (CPlayer->mo->InvSel == NULL || (level.flags & LEVEL_NOINVENTORYBAR))
{
DrawImage (Faces[FaceIndex], 143, 0);
}
else
{
DrawImage (TexMan(CPlayer->InvSel->Icon), 144, 0);
if (CPlayer->InvSel->Amount != 1)
DrawImage (TexMan(CPlayer->mo->InvSel->Icon), 144, 0);
if (CPlayer->mo->InvSel->Amount != 1)
{
DrSmallNumber (CPlayer->InvSel->Amount, 165, 24);
DrSmallNumber (CPlayer->mo->InvSel->Amount, 165, 24);
}
OldFaceIndex = -1;
}
@ -553,10 +553,10 @@ private:
int i;
// If the player has no artifacts, don't draw the bar
CPlayer->InvFirst = ValidateInvFirst (7);
if (CPlayer->InvFirst != NULL)
CPlayer->mo->InvFirst = ValidateInvFirst (7);
if (CPlayer->mo->InvFirst != NULL)
{
for (item = CPlayer->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i)
for (item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i)
{
DrawImage (Images[imgARTIBOX], 50+i*31, 2);
DrawImage (TexMan(item->Icon), 50+i*31, 2);
@ -564,7 +564,7 @@ private:
{
DrSmallNumber (item->Amount, 66+i*31, 24);
}
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
DrawImage (Images[imgSELECTBOX], 50+i*31, 2);
}
@ -574,7 +574,7 @@ private:
DrawImage (Images[imgARTIBOX], 50+i*31, 2);
}
// Is there something to the left?
if (CPlayer->mo->FirstInv() != CPlayer->InvFirst)
if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{
DrawImage (Images[!(gametic & 4) ?
imgINVLFGEM1 : imgINVLFGEM2], 38, 2);
@ -697,22 +697,22 @@ private:
{
if (CPlayer->inventorytics == 0)
{
if (CPlayer->InvSel != NULL)
if (CPlayer->mo->InvSel != NULL)
{
screen->DrawTexture (TexMan(CPlayer->InvSel->Icon), -14, ammotop - 1/*-24*/,
screen->DrawTexture (TexMan(CPlayer->mo->InvSel->Icon), -14, ammotop - 1/*-24*/,
DTA_HUDRules, HUD_Normal,
DTA_CenterBottomOffset, true,
TAG_DONE);
DrBNumberOuter (CPlayer->InvSel->Amount, -68, ammotop - 18/*-41*/);
DrBNumberOuter (CPlayer->mo->InvSel->Amount, -68, ammotop - 18/*-41*/);
}
}
else
{
CPlayer->InvFirst = ValidateInvFirst (7);
CPlayer->mo->InvFirst = ValidateInvFirst (7);
i = 0;
if (CPlayer->InvFirst != NULL)
if (CPlayer->mo->InvFirst != NULL)
{
for (item = CPlayer->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i)
for (item = CPlayer->mo->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i)
{
screen->DrawTexture (Images[imgARTIBOX], -106+i*31, -32,
DTA_HUDRules, HUD_HorizCenter,
@ -725,7 +725,7 @@ private:
{
DrSmallNumberOuter (item->Amount, -90+i*31, -10, true);
}
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
screen->DrawTexture (Images[imgSELECTBOX], -91+i*31, -3,
DTA_HUDRules, HUD_HorizCenter,
@ -741,7 +741,7 @@ private:
TAG_DONE);
}
// Is there something to the left?
if (CPlayer->mo->FirstInv() != CPlayer->InvFirst)
if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{
screen->DrawTexture (Images[!(gametic & 4) ?
imgINVLFGEM1 : imgINVLFGEM2], -118, -33,

View file

@ -308,56 +308,56 @@ CCMD (invnext)
{
AInventory *next;
if (m_Instigator == NULL)
if (who == NULL)
return;
if (m_Instigator->player->InvSel != NULL)
if (who->InvSel != NULL)
{
if ((next = m_Instigator->player->InvSel->NextInv()) != NULL)
if ((next = who->InvSel->NextInv()) != NULL)
{
m_Instigator->player->InvSel = next;
who->InvSel = next;
}
else
{
// Select the first item in the inventory
if (!(m_Instigator->Inventory->ItemFlags & IF_INVBAR))
if (!(who->Inventory->ItemFlags & IF_INVBAR))
{
m_Instigator->player->InvSel = m_Instigator->Inventory->NextInv();
who->InvSel = who->Inventory->NextInv();
}
else
{
m_Instigator->player->InvSel = m_Instigator->Inventory;
who->InvSel = who->Inventory;
}
}
}
m_Instigator->player->inventorytics = 5*TICRATE;
who->player->inventorytics = 5*TICRATE;
}
CCMD (invprev)
{
AInventory *item, *newitem;
if (m_Instigator == NULL)
if (who == NULL)
return;
if (m_Instigator->player->InvSel != NULL)
if (who->InvSel != NULL)
{
if ((item = m_Instigator->player->InvSel->PrevInv()) != NULL)
if ((item = who->InvSel->PrevInv()) != NULL)
{
m_Instigator->player->InvSel = item;
who->InvSel = item;
}
else
{
// Select the last item in the inventory
item = m_Instigator->player->InvSel;
item = who->InvSel;
while ((newitem = item->NextInv()) != NULL)
{
item = newitem;
}
m_Instigator->player->InvSel = item;
who->InvSel = item;
}
}
m_Instigator->player->inventorytics = 5*TICRATE;
who->player->inventorytics = 5*TICRATE;
}
CCMD (invuseall)
@ -369,29 +369,29 @@ CCMD (invuse)
{
if (players[consoleplayer].inventorytics == 0 || gameinfo.gametype == GAME_Strife)
{
SendItemUse = players[consoleplayer].InvSel;
SendItemUse = players[consoleplayer].mo->InvSel;
}
players[consoleplayer].inventorytics = 0;
}
CCMD (use)
{
if (argv.argc() > 1 && m_Instigator != NULL)
if (argv.argc() > 1 && who != NULL)
{
SendItemUse = m_Instigator->FindInventory (PClass::FindClass (argv[1]));
SendItemUse = who->FindInventory (PClass::FindClass (argv[1]));
}
}
CCMD (invdrop)
{
SendItemDrop = players[consoleplayer].InvSel;
SendItemDrop = players[consoleplayer].mo->InvSel;
}
CCMD (drop)
{
if (argv.argc() > 1 && m_Instigator != NULL)
if (argv.argc() > 1 && who != NULL)
{
SendItemDrop = m_Instigator->FindInventory (PClass::FindClass (argv[1]));
SendItemDrop = who->FindInventory (PClass::FindClass (argv[1]));
}
}
@ -405,12 +405,12 @@ CCMD (useflechette)
};
int i, j;
if (m_Instigator == NULL)
if (who == NULL)
return;
if (m_Instigator->IsKindOf (PClass::FindClass (NAME_ClericPlayer)))
if (who->IsKindOf (PClass::FindClass (NAME_ClericPlayer)))
i = 0;
else if (m_Instigator->IsKindOf (PClass::FindClass (NAME_MagePlayer)))
else if (who->IsKindOf (PClass::FindClass (NAME_MagePlayer)))
i = 1;
else
i = 2;
@ -419,7 +419,7 @@ CCMD (useflechette)
{
const PClass *type = PClass::FindClass (bagnames[(i+j)%3]);
AInventory *item;
if (type != NULL && (item = m_Instigator->FindInventory (type)))
if (type != NULL && (item = who->FindInventory (type)))
{
SendItemUse = item;
break;
@ -431,13 +431,13 @@ CCMD (select)
{
if (argv.argc() > 1)
{
AInventory *item = m_Instigator->FindInventory (PClass::FindClass (argv[1]));
AInventory *item = who->FindInventory (PClass::FindClass (argv[1]));
if (item != NULL)
{
m_Instigator->player->InvSel = item;
who->InvSel = item;
}
}
m_Instigator->player->inventorytics = 5*TICRATE;
who->player->inventorytics = 5*TICRATE;
}
//

View file

@ -331,7 +331,7 @@ void A_LichAttack (AActor *actor)
fire->momx = baseFire->momx;
fire->momy = baseFire->momy;
fire->momz = baseFire->momz;
fire->damage = 0;
fire->Damage = 0;
fire->health = (i+1) * 2;
P_CheckMissileSpawn (fire);
}
@ -418,7 +418,7 @@ void A_LichFireGrow (AActor *fire)
fire->z += 9*FRACUNIT;
if (fire->health == 0)
{
fire->damage = fire->GetDefault()->damage;
fire->Damage = fire->GetDefault()->Damage;
fire->SetState (&AHeadFX3::States[S_HEADFX3+3]);
}
}

View file

@ -310,10 +310,10 @@ private:
DrawImage (Images[imgUSEARTIA + ArtifactFlash], 182, 3);
oldarti = NULL; // so that the correct artifact fills in after the flash
}
else if (oldarti != CPlayer->InvSel
else if (oldarti != CPlayer->mo->InvSel
|| (oldarti != NULL && oldartiCount != oldarti->Amount))
{
oldarti = CPlayer->InvSel;
oldarti = CPlayer->mo->InvSel;
oldartiCount = oldarti != NULL ? oldarti->Amount : 0;
ArtiRefresh = screen->GetPageCount ();
}
@ -478,23 +478,23 @@ private:
int i;
DrawImage (Images[imgINVBAR], 34, 2);
CPlayer->InvFirst = ValidateInvFirst (7);
if (CPlayer->InvFirst != NULL)
CPlayer->mo->InvFirst = ValidateInvFirst (7);
if (CPlayer->mo->InvFirst != NULL)
{
for (item = CPlayer->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i)
for (item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i)
{
DrawImage (TexMan(item->Icon), 50+i*31, 2);
if (item->Amount != 1)
{
DrSmallNumber (item->Amount, 65+i*31, 24);
}
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
DrawImage (Images[imgSELECTBOX], 50+i*31, 31);
}
}
// Is there something to the left?
if (CPlayer->mo->FirstInv() != CPlayer->InvFirst)
if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{
DrawImage (Images[!(gametic & 4) ?
imgINVLFGEM1 : imgINVLFGEM2], 38, 1);
@ -630,28 +630,28 @@ private:
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
else if (CPlayer->InvSel != NULL)
else if (CPlayer->mo->InvSel != NULL)
{
screen->DrawTexture (Images[imgARTIBOX], -61, -31,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, TRANSLUC50,
TAG_DONE);
screen->DrawTexture (TexMan(CPlayer->InvSel->Icon), -61, -31,
screen->DrawTexture (TexMan(CPlayer->mo->InvSel->Icon), -61, -31,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
if (CPlayer->InvSel->Amount != 1)
if (CPlayer->mo->InvSel->Amount != 1)
{
DrSmallNumberOuter (CPlayer->InvSel->Amount, -46, -9, false);
DrSmallNumberOuter (CPlayer->mo->InvSel->Amount, -46, -9, false);
}
}
}
else
{
CPlayer->InvFirst = ValidateInvFirst (7);
CPlayer->mo->InvFirst = ValidateInvFirst (7);
i = 0;
if (CPlayer->InvFirst != NULL)
if (CPlayer->mo->InvFirst != NULL)
{
for (item = CPlayer->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i)
for (item = CPlayer->mo->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i)
{
screen->DrawTexture (Images[imgARTIBOX], -100+i*31, -32,
DTA_HUDRules, HUD_HorizCenter,
@ -664,7 +664,7 @@ private:
{
DrSmallNumberOuter (item->Amount, -84+i*31, -10, true);
}
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
screen->DrawTexture (Images[imgSELECTBOX], -100+i*31, -3,
DTA_HUDRules, HUD_HorizCenter,
@ -672,7 +672,7 @@ private:
}
}
// Is there something to the left?
if (CPlayer->mo->FirstInv() != CPlayer->InvFirst)
if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{
screen->DrawTexture (Images[!(gametic & 4) ?
imgINVLFGEM1 : imgINVLFGEM2], -112, -33,

View file

@ -559,7 +559,7 @@ void A_LastZap (AActor *actor)
{
mo->SetState (&ALightningZap::States[S_LIGHTNING_ZAP_X1]);
mo->momz = 40*FRACUNIT;
mo->damage = 0;
mo->Damage = 0;
}
}

View file

@ -389,10 +389,10 @@ private:
DrawImage (Images[imgUSEARTIA + ArtifactFlash], 148, 2);
oldarti = NULL; // so that the correct artifact fills in after the flash
}
else if (oldarti != CPlayer->InvSel
else if (oldarti != CPlayer->mo->InvSel
|| (oldarti != NULL && oldartiCount != oldarti->Amount))
{
oldarti = CPlayer->InvSel;
oldarti = CPlayer->mo->InvSel;
oldartiCount = oldarti != NULL ? oldarti->Amount : 0;
ArtiRefresh = screen->GetPageCount ();
}
@ -708,23 +708,23 @@ private:
int i;
DrawImage (Images[imgINVBAR], 38, 0);
CPlayer->InvFirst = ValidateInvFirst (7);
if (CPlayer->InvFirst != NULL)
CPlayer->mo->InvFirst = ValidateInvFirst (7);
if (CPlayer->mo->InvFirst != NULL)
{
for (item = CPlayer->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i)
for (item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < 7; item = item->NextInv(), ++i)
{
DrawImage (TexMan(item->Icon), 50+i*31, 1);
if (item->Amount != 1)
{
DrSmallNumber (item->Amount, 68+i*31, 23);
}
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
DrawImage (Images[imgSELECTBOX], 51+i*31, 1);
}
}
// Is there something to the left?
if (CPlayer->mo->FirstInv() != CPlayer->InvFirst)
if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{
DrawImage (Images[!(gametic & 4) ?
imgINVLFGEM1 : imgINVLFGEM2], 42, 1);
@ -904,28 +904,28 @@ private:
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
else if (CPlayer->InvSel != NULL)
else if (CPlayer->mo->InvSel != NULL)
{
screen->DrawTexture (Images[imgARTIBOX], -80, -30,
DTA_HUDRules, HUD_Normal,
DTA_Alpha, HX_SHADOW,
TAG_DONE);
screen->DrawTexture (TexMan(CPlayer->InvSel->Icon), -82, -31,
screen->DrawTexture (TexMan(CPlayer->mo->InvSel->Icon), -82, -31,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
if (CPlayer->InvSel->Amount != 1)
if (CPlayer->mo->InvSel->Amount != 1)
{
DrSmallNumberOuter (CPlayer->InvSel->Amount, -64, -8, false);
DrSmallNumberOuter (CPlayer->mo->InvSel->Amount, -64, -8, false);
}
}
}
else
{
CPlayer->InvFirst = ValidateInvFirst (7);
CPlayer->mo->InvFirst = ValidateInvFirst (7);
i = 0;
if (CPlayer->InvFirst != NULL)
if (CPlayer->mo->InvFirst != NULL)
{
for (item = CPlayer->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i)
for (item = CPlayer->mo->InvFirst; item != NULL && i < 7; item = item->NextInv(), ++i)
{
screen->DrawTexture (Images[imgARTIBOX], -106+i*31, -32,
DTA_HUDRules, HUD_HorizCenter,
@ -938,7 +938,7 @@ private:
{
DrSmallNumberOuter (item->Amount, -90+i*31, -11, true);
}
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
screen->DrawTexture (Images[imgSELECTBOX], -107+i*31, -33,
DTA_HUDRules, HUD_HorizCenter,
@ -946,7 +946,7 @@ private:
}
}
// Is there something to the left?
if (CPlayer->mo->FirstInv() != CPlayer->InvFirst)
if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{
screen->DrawTexture (Images[!(gametic & 4) ?
imgINVLFGEM1 : imgINVLFGEM2], -118, -33,

View file

@ -690,7 +690,7 @@ CCMD (countdecalsreal)
CCMD (spray)
{
if (argv.argc() < 2 || m_Instigator == NULL)
if (who == NULL || argv.argc() < 2)
{
Printf ("Usage: spray <decal>\n");
return;

View file

@ -1484,60 +1484,60 @@ AInventory *FBaseStatusBar::ValidateInvFirst (int numVisible) const
AInventory *item;
int i;
if (CPlayer->InvFirst == NULL)
if (CPlayer->mo->InvFirst == NULL)
{
CPlayer->InvFirst = CPlayer->mo->FirstInv();
if (CPlayer->InvFirst == NULL)
CPlayer->mo->InvFirst = CPlayer->mo->FirstInv();
if (CPlayer->mo->InvFirst == NULL)
{ // Nothing to show
return NULL;
}
}
assert (CPlayer->InvFirst->Owner == CPlayer->mo);
assert (CPlayer->mo->InvFirst->Owner == CPlayer->mo);
// If there are fewer than numVisible items shown, see if we can shift the
// view left to show more.
for (i = 0, item = CPlayer->InvFirst; item != NULL && i < numVisible; ++i, item = item->NextInv())
for (i = 0, item = CPlayer->mo->InvFirst; item != NULL && i < numVisible; ++i, item = item->NextInv())
{ }
while (i < numVisible)
{
item = CPlayer->InvFirst->PrevInv ();
item = CPlayer->mo->InvFirst->PrevInv ();
if (item == NULL)
{
break;
}
else
{
CPlayer->InvFirst = item;
CPlayer->mo->InvFirst = item;
++i;
}
}
if (CPlayer->InvSel == NULL)
if (CPlayer->mo->InvSel == NULL)
{
// Nothing selected, so don't move the view.
return CPlayer->InvFirst == NULL ? CPlayer->mo->Inventory : CPlayer->InvFirst;
return CPlayer->mo->InvFirst == NULL ? CPlayer->mo->Inventory : CPlayer->mo->InvFirst;
}
else
{
// Check if InvSel is already visible
for (item = CPlayer->InvFirst, i = numVisible;
for (item = CPlayer->mo->InvFirst, i = numVisible;
item != NULL && i != 0;
item = item->NextInv(), --i)
{
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
return CPlayer->InvFirst;
return CPlayer->mo->InvFirst;
}
}
// Check if InvSel is to the right of the visible range
for (i = 1; item != NULL; item = item->NextInv(), ++i)
{
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
// Found it. Now advance InvFirst
for (item = CPlayer->InvFirst; i != 0; --i)
for (item = CPlayer->mo->InvFirst; i != 0; --i)
{
item = item->NextInv();
}
@ -1546,7 +1546,7 @@ AInventory *FBaseStatusBar::ValidateInvFirst (int numVisible) const
}
// Check if InvSel is to the left of the visible range
for (item = CPlayer->mo->Inventory;
item != CPlayer->InvSel;
item != CPlayer->mo->InvSel;
item = item->NextInv())
{ }
if (item != NULL)
@ -1557,7 +1557,7 @@ AInventory *FBaseStatusBar::ValidateInvFirst (int numVisible) const
// Didn't find the selected item, so don't move the view.
// This should never happen, so let debug builds assert.
assert (item != NULL);
return CPlayer->InvFirst;
return CPlayer->mo->InvFirst;
}
}

View file

@ -425,10 +425,10 @@ private:
}
// Inventory
CPlayer->InvFirst = ValidateInvFirst (6);
for (item = CPlayer->InvFirst, i = 0; item != NULL && i < 6; item = item->NextInv(), ++i)
CPlayer->mo->InvFirst = ValidateInvFirst (6);
for (item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < 6; item = item->NextInv(), ++i)
{
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
screen->DrawTexture (Images[CursorImage],
42 + 35*i + ST_X, 12 + ST_Y,
@ -496,7 +496,7 @@ private:
// Draw inventory
if (CPlayer->inventorytics == 0)
{
if (CPlayer->InvSel != 0)
if (CPlayer->mo->InvSel != 0)
{
if (ItemFlash > 0)
{
@ -508,8 +508,8 @@ private:
DTA_Alpha, ItemFlash,
TAG_DONE);
}
DrINumberOuter (CPlayer->InvSel->Amount, -51, -10, false, 7);
screen->DrawTexture (TexMan(CPlayer->InvSel->Icon), -42, -17,
DrINumberOuter (CPlayer->mo->InvSel->Amount, -51, -10, false, 7);
screen->DrawTexture (TexMan(CPlayer->mo->InvSel->Icon), -42, -17,
DTA_HUDRules, HUD_Normal,
DTA_CenterBottomOffset, true,
TAG_DONE);
@ -517,14 +517,14 @@ private:
}
else
{
CPlayer->InvFirst = ValidateInvFirst (6);
CPlayer->mo->InvFirst = ValidateInvFirst (6);
int i = 0;
AInventory *item;
if (CPlayer->InvFirst != NULL)
if (CPlayer->mo->InvFirst != NULL)
{
for (item = CPlayer->InvFirst; item != NULL && i < 6; item = item->NextInv(), ++i)
for (item = CPlayer->mo->InvFirst; item != NULL && i < 6; item = item->NextInv(), ++i)
{
if (item == CPlayer->InvSel)
if (item == CPlayer->mo->InvSel)
{
screen->DrawTexture (Images[CursorImage], -100+i*35, -21,
DTA_HUDRules, HUD_HorizCenter,

View file

@ -202,7 +202,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
case ADEF_Radius: actor->radius = dataint; break;
case ADEF_Height: actor->height = dataint; break;
case ADEF_Mass: actor->Mass = dataint; break;
case ADEF_Damage: actor->damage = dataint; break;
case ADEF_Damage: actor->Damage = dataint; break;
case ADEF_DamageType: actor->DamageType = dataint; break;
case ADEF_Flags: actor->flags = dataint; break;
case ADEF_Flags2: actor->flags2 = dataint; break;

View file

@ -891,7 +891,7 @@ menu_t ModesMenu =
ModesItems,
};
CUSTOM_CVAR (Bool, vid_tft, false, CVAR_ARCHIVE)
CUSTOM_CVAR (Bool, vid_tft, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self)
{

View file

@ -1845,6 +1845,44 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
}
}
void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, BOOL not_lower, BOOL not_mid, BOOL not_upper, BOOL not_floor, BOOL not_ceil)
{
const char *fromname = FBehavior::StaticLookupString (fromnamei);
const char *toname = FBehavior::StaticLookupString (tonamei);
int picnum1, picnum2;
if (fromname == NULL)
return;
if (!(not_lower | not_mid | not_upper))
{
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
for (int i = 0; i < numsides; ++i)
{
side_t *wal = &sides[i];
if (!not_lower && wal->bottomtexture == picnum1) wal->bottomtexture = picnum2;
if (!not_mid && wal->midtexture == picnum1) wal->midtexture = picnum2;
if (!not_upper && wal->toptexture == picnum1) wal->toptexture = picnum2;
}
}
if (!(not_floor | not_ceil))
{
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
for (int i = 0; i < numsectors; ++i)
{
sector_t *sec = &sectors[i];
if (!not_floor && sec->floorpic == picnum1) sec->floorpic = picnum2;
if (!not_ceil && sec->ceilingpic == picnum1) sec->ceilingpic = picnum2;
}
}
}
int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle)
{
const PClass *info = PClass::FindClass (FBehavior::StaticLookupString (type));
@ -2084,7 +2122,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break;
case APROP_Damage:
actor->damage = value;
actor->Damage = value;
break;
case APROP_Alpha:
@ -2169,7 +2207,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
{
case APROP_Health: return actor->health;
case APROP_Speed: return actor->Speed;
case APROP_Damage: return actor->damage;
case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead?
case APROP_Alpha: return actor->alpha;
case APROP_RenderStyle: return actor->RenderStyle;
case APROP_Ambush: return !!(actor->flags & MF_AMBUSH);
@ -3973,6 +4011,11 @@ int DLevelScript::RunScript ()
sp -= 4;
break;
case PCD_REPLACETEXTURES:
ReplaceTextures (STACK(7), STACK(6), STACK(5), STACK(4), STACK(3), STACK(2), STACK(1));
sp -= 7;
break;
case PCD_SETLINEBLOCKING:
{
int line = -1;
@ -4900,6 +4943,73 @@ int DLevelScript::RunScript ()
}
break;
case PCD_SECTORDAMAGE:
{
int tag = STACK(7);
int amount = STACK(6);
FName type = FBehavior::StaticLookupString(STACK(5));
BOOL playersOnly = STACK(4);
BOOL inAirToo = STACK(3);
FName protection = FName (FBehavior::StaticLookupString(STACK(2)), true);
const PClass *protectClass = PClass::FindClass (protection);
BOOL subclassesOkay = STACK(1);
sp -= 7;
// Oh, give me custom damage types! :-)
int modtype;
switch (type)
{
case NAME_Fire: modtype = MOD_FIRE; break;
case NAME_Ice: modtype = MOD_ICE; break;
default: modtype = MOD_UNKNOWN; break;
}
int secnum = -1;
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
{
AActor *actor, *next;
sector_t *sec = &sectors[secnum];
for (actor = sec->thinglist; actor != NULL; actor = next)
{
next = actor->snext;
if (!(actor->flags & MF_SHOOTABLE))
continue;
if (playersOnly && actor->player == NULL)
continue;
if (!inAirToo && actor->z != sec->floorplane.ZatPoint (actor->x, actor->y) && !actor->waterlevel)
continue;
if (protectClass != NULL)
{
if (!subclassesOkay)
{
if (actor->FindInventory (protectClass))
continue;
}
else
{
AInventory *item;
for (item = actor->Inventory; item != NULL; item = item->Inventory)
{
if (item->IsKindOf (protectClass))
break;
}
if (item != NULL)
continue;
}
}
P_DamageMobj (actor, NULL, NULL, amount, modtype);
}
}
}
}
}

View file

@ -533,6 +533,8 @@ public:
//[MW] end my p-codes
PCD_GETPLAYERINFO, // [GRB]
PCD_CHANGELEVEL,
PCD_SECTORDAMAGE,
PCD_REPLACETEXTURES,
PCODE_COMMAND_COUNT
};
@ -656,6 +658,7 @@ protected:
static void ChangeFlat (int tag, int name, bool floorOrCeiling);
static int CountPlayers ();
static void SetLineTexture (int lineid, int side, int position, int name);
static void ReplaceTextures (int fromname, int toname, BOOL notUpper, BOOL notMid, BOOL notLower, BOOL notFloor, BOOL notCeil);
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle);
static int DoSpawnSpot (int type, int spot, int tid, int angle);
static int DoSpawnSpotFacing (int type, int spot, int tid);

View file

@ -2140,7 +2140,7 @@ void A_MonsterRail (AActor *actor)
actor->angle += pr_railface.Random2() << 21;
}
P_RailAttack (actor, actor->damage, 0);
P_RailAttack (actor, actor->GetMissileDamage (0, 1), 0);
}
void A_Scream (AActor *actor)
@ -2306,8 +2306,9 @@ void A_Die (AActor *actor)
void A_Detonate (AActor *mo)
{
P_RadiusAttack (mo, mo->target, mo->damage, mo->damage, mo->DamageType, true);
if (mo->z <= mo->floorz + (mo->damage<<FRACBITS))
int damage = mo->GetMissileDamage (0, 1);
P_RadiusAttack (mo, mo->target, damage, damage, mo->DamageType, true);
if (mo->z <= mo->floorz + (damage << FRACBITS))
{
P_HitFloor (mo);
}

View file

@ -918,7 +918,7 @@ BOOL PIT_CheckThing (AActor *thing)
if (tmthing->flags2 & MF2_BOUNCE2)
{
if (tmthing->damage == 0)
if (tmthing->Damage == 0)
{
return (tmthing->target == thing || !(thing->flags & MF_SOLID));
}
@ -1023,7 +1023,7 @@ BOOL PIT_CheckThing (AActor *thing)
P_RipperBlood (tmthing, thing);
}
S_Sound (tmthing, CHAN_BODY, "misc/ripslop", 1, ATTN_IDLE);
damage = ((pr_checkthing()&3)+2)*tmthing->damage;
damage = tmthing->GetMissileDamage (3, 2);
P_DamageMobj (thing, tmthing, tmthing->target, damage, tmthing->DamageType);
if (!(tmthing->flags3 & MF3_BLOODLESSIMPACT))
{
@ -1040,16 +1040,7 @@ BOOL PIT_CheckThing (AActor *thing)
return true;
}
// Do damage
damage = pr_checkthing();
if (tmthing->flags4 & MF4_STRIFEDAMAGE)
{
damage &= 3;
}
else
{
damage &= 7;
}
damage = (damage + 1) * tmthing->damage;
damage = tmthing->GetMissileDamage ((tmthing->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1);
if (damage > 0)
{
P_DamageMobj (thing, tmthing, tmthing->target, damage, tmthing->DamageType);

View file

@ -95,6 +95,7 @@ static FRandom pr_ripperblood ("RipperBlood");
static FRandom pr_chunk ("Chunk");
static FRandom pr_checkmissilespawn ("CheckMissileSpawn");
static FRandom pr_spawnmissile ("SpawnMissile");
static FRandom pr_missiledamage ("MissileDamage");
FRandom pr_slam ("SkullSlam");
static FRandom pr_multiclasschoice ("MultiClassChoice");
@ -256,7 +257,7 @@ void AActor::Serialize (FArchive &arc)
<< momz
<< tics
<< state
<< damage
<< Damage
<< flags
<< flags2
<< flags3
@ -884,6 +885,16 @@ void AActor::ObtainInventory (AActor *other)
other->Inventory = NULL;
other->InventoryID = 0;
if (other->IsKindOf(RUNTIME_CLASS(APlayerPawn)) && this->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
{
APlayerPawn *you = static_cast<APlayerPawn *>(other);
APlayerPawn *me = static_cast<APlayerPawn *>(this);
me->InvFirst = you->InvFirst;
me->InvSel = you->InvSel;
you->InvFirst = NULL;
you->InvSel = NULL;
}
AInventory *item = Inventory;
while (item != NULL)
{
@ -2198,9 +2209,6 @@ void P_NightmareRespawn (AActor *mobj)
}
//
// [RH] Some new functions to work with Thing IDs. ------->
//
AActor *AActor::TIDHash[128];
//
@ -2265,8 +2273,6 @@ void AActor::RemoveFromHash ()
tid = 0;
}
// <------- [RH] End new functions
angle_t AActor::AngleIncrements ()
{
return ANGLE_45;
@ -2280,6 +2286,35 @@ void AActor::GetExplodeParms (int &damage, int &dist, bool &hurtSource)
{
}
//==========================================================================
//
// AActor :: GetMissileDamage
//
// If the actor's damage amount is an expression, evaluate it and return
// the result. Otherwise, return ((random() & mask) + add) * damage.
//
//==========================================================================
int AActor::GetMissileDamage (int mask, int add)
{
if ((Damage & 0xC0000000) == 0x40000000)
{
return EvalExpressionI (Damage & 0x3FFFFFFF, this);
}
if (Damage == 0)
{
return 0;
}
else if (mask == 0)
{
return add * Damage;
}
else
{
return ((pr_missiledamage() & mask) + add) * Damage;
}
}
void AActor::Howl ()
{
}
@ -2304,7 +2339,7 @@ void AActor::HitFloor ()
bool AActor::Slam (AActor *thing)
{
int dam = ((pr_slam()%8)+1) * damage;
int dam = GetMissileDamage (7, 1);
P_DamageMobj (thing, this, this, dam, MOD_HIT);
P_TraceBleed (dam, thing, this);
flags &= ~MF_SKULLFLY;
@ -2747,7 +2782,7 @@ void AActor::Tick ()
// won't hurt anything. Don't do this if damage is 0! That way, you can
// still have missiles that go straight up and down through actors without
// damaging anything.
if ((flags & MF_MISSILE) && (momx|momy) == 0 && damage != 0)
if ((flags & MF_MISSILE) && (momx|momy) == 0 && Damage != 0)
{
momx = 1;
}

View file

@ -217,8 +217,6 @@ player_s::player_s()
oldbuttons(0),
attackdown(0),
health(0),
InvFirst(0),
InvSel(0),
inventorytics(0),
CurrentPlayerClass(0),
pieces(0),
@ -363,7 +361,12 @@ int player_t::GetSpawnClass()
//
//===========================================================================
IMPLEMENT_STATELESS_ACTOR (APlayerPawn, Any, -1, 0)
IMPLEMENT_POINTY_CLASS (APlayerPawn)
DECLARE_POINTER(InvFirst)
DECLARE_POINTER(InvSel)
END_POINTERS
BEGIN_STATELESS_DEFAULTS (APlayerPawn, Any, -1, 0)
PROP_SpawnHealth (100)
PROP_RadiusFixed (16)
PROP_HeightFixed (56)
@ -394,7 +397,9 @@ void APlayerPawn::Serialize (FArchive &arc)
<< ForwardMove2
<< SideMove1
<< SideMove2
<< ScoreIcon;
<< ScoreIcon
<< InvFirst
<< InvSel;
}
//===========================================================================
@ -478,9 +483,9 @@ void APlayerPawn::AddInventory (AInventory *item)
Super::AddInventory (item);
// If nothing is selected, select this item.
if (player != NULL && player->InvSel == NULL && (item->ItemFlags & IF_INVBAR))
if (InvSel == NULL && (item->ItemFlags & IF_INVBAR))
{
player->InvSel = item;
InvSel = item;
}
}
@ -501,20 +506,20 @@ void APlayerPawn::RemoveInventory (AInventory *item)
// item, if there is one, or the previous item.
if (player != NULL)
{
if (player->InvSel == item)
if (InvSel == item)
{
player->InvSel = item->NextInv ();
if (player->InvSel == NULL)
InvSel = item->NextInv ();
if (InvSel == NULL)
{
player->InvSel = item->PrevInv ();
InvSel = item->PrevInv ();
}
}
if (player->InvFirst == item)
if (InvFirst == item)
{
player->InvFirst = item->NextInv ();
if (player->InvFirst == NULL)
InvFirst = item->NextInv ();
if (InvFirst == NULL)
{
player->InvFirst = item->PrevInv ();
InvFirst = item->PrevInv ();
}
}
if (item == player->PendingWeapon)
@ -2087,7 +2092,6 @@ void player_s::Serialize (FArchive &arc)
<< centering
<< health
<< inventorytics
<< InvFirst << InvSel
<< pieces
<< backpack
<< fragcount

View file

@ -2365,8 +2365,22 @@ static void ActorPainChance (AActor *defaults, Baggage &bag)
//==========================================================================
static void ActorDamage (AActor *defaults, Baggage &bag)
{
SC_MustGetNumber();
defaults->damage=sc_Number;
// Damage can either be a single number, in which case it is subject
// to the original damage calculation rules. Or, it can be an expression
// and will be calculated as-is, ignoring the original rules. For
// compatibility reasons, expressions must be enclosed within
// parentheses.
if (SC_CheckString ("("))
{
SC_UnGet();
defaults->Damage = 0x40000000 | ParseExpression (false);
}
else
{
SC_MustGetNumber ();
defaults->Damage = sc_Number;
}
}
//==========================================================================

View file

@ -318,7 +318,7 @@ void A_BulletAttack (AActor *self)
slope = P_AimLineAttack (self, bangle, MISSILERANGE);
S_SoundID (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
for (i=0 ; i<self->damage ; i++)
for (i = self->GetMissileDamage (0, 1); i > 0; --i)
{
int angle = bangle + (pr_cabullet.Random2() << 20);
int damage = ((pr_cabullet()%5)+1)*3;

View file

@ -949,6 +949,7 @@ void V_Shutdown()
}
EXTERN_CVAR (Bool, vid_tft)
CVAR (Bool, vid_nowidescreen, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
// Tries to guess the physical dimensions of the screen based on the
// screen's pixel dimensions. Can return:
@ -958,6 +959,14 @@ EXTERN_CVAR (Bool, vid_tft)
// 4: 5:4
int CheckRatio (int width, int height)
{
if (vid_nowidescreen)
{
if (!vid_tft)
{
return 0;
}
return (height * 5/4 == width) ? 4 : 0;
}
// If the size is approximately 16:9, consider it so.
if (abs (height * 16/9 - width) < 10)
{