mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Less flags, more generic properties
This commit is contained in:
parent
580094a792
commit
4cac599b88
7 changed files with 147 additions and 58 deletions
|
@ -873,6 +873,7 @@ public:
|
||||||
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
||||||
fixed_t SpawnPoint[3]; // For nightmare respawn
|
fixed_t SpawnPoint[3]; // For nightmare respawn
|
||||||
WORD SpawnAngle;
|
WORD SpawnAngle;
|
||||||
|
int StartHealth;
|
||||||
BYTE WeaveIndexXY; // Separated from special2 because it's used by globally accessible functions.
|
BYTE WeaveIndexXY; // Separated from special2 because it's used by globally accessible functions.
|
||||||
BYTE WeaveIndexZ;
|
BYTE WeaveIndexZ;
|
||||||
int skillrespawncount;
|
int skillrespawncount;
|
||||||
|
|
|
@ -345,6 +345,15 @@ struct FMapThing
|
||||||
int args[5];
|
int args[5];
|
||||||
int Conversation;
|
int Conversation;
|
||||||
fixed_t gravity;
|
fixed_t gravity;
|
||||||
|
fixed_t alpha;
|
||||||
|
DWORD fillcolor;
|
||||||
|
fixed_t scaleX;
|
||||||
|
fixed_t scaleY;
|
||||||
|
int health;
|
||||||
|
int score;
|
||||||
|
short pitch;
|
||||||
|
short roll;
|
||||||
|
DWORD RenderStyle;
|
||||||
|
|
||||||
void Serialize (FArchive &);
|
void Serialize (FArchive &);
|
||||||
};
|
};
|
||||||
|
@ -387,14 +396,6 @@ enum EMapThingFlags
|
||||||
MTF_SECRET = 0x080000, // Secret pickup
|
MTF_SECRET = 0x080000, // Secret pickup
|
||||||
MTF_NOINFIGHTING = 0x100000,
|
MTF_NOINFIGHTING = 0x100000,
|
||||||
|
|
||||||
// PSX Doom and Doom 64 effects
|
|
||||||
|
|
||||||
MTF_TRANS = 0x200000, // 50% alpha
|
|
||||||
MTF_ADD = 0x400000, // 100% additive
|
|
||||||
MTF_SUBTRACT = 0x800000, // 100% subtractive
|
|
||||||
MTF_SPECTRE = 0x1000000, // 25% additive
|
|
||||||
MTF_DOUBLEHEALTH = 0x2000000, // Double hit points
|
|
||||||
|
|
||||||
// BOOM and DOOM compatible versions of some of the above
|
// BOOM and DOOM compatible versions of some of the above
|
||||||
|
|
||||||
BTF_NOTSINGLE = 0x0010, // (TF_COOPERATIVE|TF_DEATHMATCH)
|
BTF_NOTSINGLE = 0x0010, // (TF_COOPERATIVE|TF_DEATHMATCH)
|
||||||
|
|
|
@ -31,6 +31,18 @@ xx(Fuzzy)
|
||||||
xx(Opaque)
|
xx(Opaque)
|
||||||
xx(Stencil)
|
xx(Stencil)
|
||||||
|
|
||||||
|
// Render styles
|
||||||
|
xx(Normal)
|
||||||
|
xx(SoulTrans)
|
||||||
|
xx(OptFuzzy)
|
||||||
|
xx(Add)
|
||||||
|
xx(Shaded)
|
||||||
|
xx(TranslucentStencil)
|
||||||
|
xx(Shadow)
|
||||||
|
xx(Subtract)
|
||||||
|
xx(Subtractive)
|
||||||
|
xx(FillColor)
|
||||||
|
|
||||||
// Healingradius types
|
// Healingradius types
|
||||||
xx(Mana)
|
xx(Mana)
|
||||||
xx(Armor)
|
xx(Armor)
|
||||||
|
@ -373,11 +385,11 @@ xx(Friend)
|
||||||
xx(Strifeally)
|
xx(Strifeally)
|
||||||
xx(Standing)
|
xx(Standing)
|
||||||
xx(Countsecret)
|
xx(Countsecret)
|
||||||
//xx(Transparent) defined below for linedefs
|
xx(Score)
|
||||||
//xx(Additive) already defined for invisibility types
|
xx(Roll)
|
||||||
xx(Subtractive)
|
xx(Scale)
|
||||||
xx(Spectre)
|
xx(ScaleX)
|
||||||
xx(Doublehealth)
|
xx(ScaleY)
|
||||||
|
|
||||||
xx(Blocking)
|
xx(Blocking)
|
||||||
xx(Blockmonsters)
|
xx(Blockmonsters)
|
||||||
|
|
|
@ -2648,7 +2648,7 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
|
||||||
corpsehit->flags5 = info->flags5;
|
corpsehit->flags5 = info->flags5;
|
||||||
corpsehit->flags6 = info->flags6;
|
corpsehit->flags6 = info->flags6;
|
||||||
corpsehit->flags7 = info->flags7;
|
corpsehit->flags7 = info->flags7;
|
||||||
corpsehit->health = info->health;
|
corpsehit->health = corpsehit->SpawnHealth();
|
||||||
corpsehit->target = NULL;
|
corpsehit->target = NULL;
|
||||||
corpsehit->lastenemy = NULL;
|
corpsehit->lastenemy = NULL;
|
||||||
|
|
||||||
|
|
|
@ -219,8 +219,12 @@ void AActor::Serialize (FArchive &arc)
|
||||||
<< threshold
|
<< threshold
|
||||||
<< player
|
<< player
|
||||||
<< SpawnPoint[0] << SpawnPoint[1] << SpawnPoint[2]
|
<< SpawnPoint[0] << SpawnPoint[1] << SpawnPoint[2]
|
||||||
<< SpawnAngle
|
<< SpawnAngle;
|
||||||
<< skillrespawncount
|
if (SaveVersion >= 4506)
|
||||||
|
{
|
||||||
|
arc << StartHealth;
|
||||||
|
}
|
||||||
|
arc << skillrespawncount
|
||||||
<< tracer
|
<< tracer
|
||||||
<< floorclip
|
<< floorclip
|
||||||
<< tid
|
<< tid
|
||||||
|
@ -4022,24 +4026,6 @@ void AActor::HandleSpawnFlags ()
|
||||||
RenderStyle = STYLE_Translucent;
|
RenderStyle = STYLE_Translucent;
|
||||||
alpha = TRANSLUC25;
|
alpha = TRANSLUC25;
|
||||||
}
|
}
|
||||||
else if (SpawnFlags & MTF_TRANS)
|
|
||||||
{
|
|
||||||
RenderStyle = STYLE_Translucent;
|
|
||||||
alpha = TRANSLUC50;
|
|
||||||
}
|
|
||||||
else if (SpawnFlags & MTF_ADD)
|
|
||||||
{
|
|
||||||
RenderStyle = STYLE_Add;
|
|
||||||
}
|
|
||||||
else if (SpawnFlags & MTF_SUBTRACT)
|
|
||||||
{
|
|
||||||
RenderStyle = STYLE_Subtract;
|
|
||||||
}
|
|
||||||
else if (SpawnFlags & MTF_SPECTRE)
|
|
||||||
{
|
|
||||||
RenderStyle = STYLE_Add;
|
|
||||||
alpha = TRANSLUC25;
|
|
||||||
}
|
|
||||||
else if (SpawnFlags & MTF_ALTSHADOW)
|
else if (SpawnFlags & MTF_ALTSHADOW)
|
||||||
{
|
{
|
||||||
RenderStyle = STYLE_None;
|
RenderStyle = STYLE_None;
|
||||||
|
@ -4053,10 +4039,6 @@ void AActor::HandleSpawnFlags ()
|
||||||
level.total_secrets++;
|
level.total_secrets++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SpawnFlags & MTF_DOUBLEHEALTH)
|
|
||||||
{
|
|
||||||
health *= 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AActor::BeginPlay ()
|
void AActor::BeginPlay ()
|
||||||
|
@ -4811,11 +4793,42 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set various UDMF options
|
||||||
|
if (mthing->alpha != -1)
|
||||||
|
{
|
||||||
|
DPrintf("Setting alpha to %f", FIXED2FLOAT(mthing->alpha));
|
||||||
|
mobj->alpha = mthing->alpha;
|
||||||
|
}
|
||||||
|
if (mthing->RenderStyle != STYLE_Count)
|
||||||
|
mobj->RenderStyle = (ERenderStyle)mthing->RenderStyle;
|
||||||
|
if (mthing->scaleX)
|
||||||
|
mobj->scaleX = FixedMul(mthing->scaleX, mobj->scaleX);
|
||||||
|
if (mthing->scaleY)
|
||||||
|
mobj->scaleY = FixedMul(mthing->scaleY, mobj->scaleY);
|
||||||
|
if (mthing->pitch)
|
||||||
|
mobj->pitch = ANGLE_1 * mthing->pitch;
|
||||||
|
if (mthing->roll)
|
||||||
|
mobj->roll = ANGLE_1 * mthing->roll;
|
||||||
|
if (mthing->score)
|
||||||
|
mobj->Score = mthing->score;
|
||||||
|
if (mthing->fillcolor)
|
||||||
|
mobj->fillcolor = mthing->fillcolor;
|
||||||
|
|
||||||
mobj->BeginPlay ();
|
mobj->BeginPlay ();
|
||||||
if (!(mobj->ObjectFlags & OF_EuthanizeMe))
|
if (!(mobj->ObjectFlags & OF_EuthanizeMe))
|
||||||
{
|
{
|
||||||
mobj->LevelSpawned ();
|
mobj->LevelSpawned ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mthing->health > 0)
|
||||||
|
mobj->health *= mthing->health;
|
||||||
|
else
|
||||||
|
mobj->health = -mthing->health;
|
||||||
|
if (mthing->health == 0)
|
||||||
|
mobj->Die(NULL, NULL);
|
||||||
|
else if (mthing->health != 1)
|
||||||
|
mobj->StartHealth = mobj->health;
|
||||||
|
|
||||||
return mobj;
|
return mobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6038,18 +6051,19 @@ void AActor::SetIdle()
|
||||||
|
|
||||||
int AActor::SpawnHealth()
|
int AActor::SpawnHealth()
|
||||||
{
|
{
|
||||||
if (!(flags3 & MF3_ISMONSTER) || GetDefault()->health == 0)
|
int defhealth = StartHealth ? StartHealth : GetDefault()->health;
|
||||||
|
if (!(flags3 & MF3_ISMONSTER) || defhealth == 0)
|
||||||
{
|
{
|
||||||
return GetDefault()->health;
|
return defhealth;
|
||||||
}
|
}
|
||||||
else if (flags & MF_FRIENDLY)
|
else if (flags & MF_FRIENDLY)
|
||||||
{
|
{
|
||||||
int adj = FixedMul(GetDefault()->health, G_SkillProperty(SKILLP_FriendlyHealth));
|
int adj = FixedMul(defhealth, G_SkillProperty(SKILLP_FriendlyHealth));
|
||||||
return (adj <= 0) ? 1 : adj;
|
return (adj <= 0) ? 1 : adj;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int adj = FixedMul(GetDefault()->health, G_SkillProperty(SKILLP_MonsterHealth));
|
int adj = FixedMul(defhealth, G_SkillProperty(SKILLP_MonsterHealth));
|
||||||
return (adj <= 0) ? 1 : adj;
|
return (adj <= 0) ? 1 : adj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,6 +476,9 @@ public:
|
||||||
|
|
||||||
memset(th, 0, sizeof(*th));
|
memset(th, 0, sizeof(*th));
|
||||||
th->gravity = FRACUNIT;
|
th->gravity = FRACUNIT;
|
||||||
|
th->RenderStyle = STYLE_Count;
|
||||||
|
th->alpha = -1;
|
||||||
|
th->health = 1;
|
||||||
sc.MustGetToken('{');
|
sc.MustGetToken('{');
|
||||||
while (!sc.CheckToken('}'))
|
while (!sc.CheckToken('}'))
|
||||||
{
|
{
|
||||||
|
@ -632,29 +635,87 @@ public:
|
||||||
Flag(th->flags, MTF_SECRET, key);
|
Flag(th->flags, MTF_SECRET, key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Transparent:
|
case NAME_Renderstyle:
|
||||||
CHECK_N(Zd | Zdt)
|
{
|
||||||
Flag(th->flags, MTF_TRANS, key);
|
FName style = CheckString(key);
|
||||||
|
switch (style)
|
||||||
|
{
|
||||||
|
case NAME_None:
|
||||||
|
th->RenderStyle = STYLE_None;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case NAME_Normal:
|
||||||
|
th->RenderStyle = STYLE_Normal;
|
||||||
|
break;
|
||||||
|
case NAME_Fuzzy:
|
||||||
|
th->RenderStyle = STYLE_Fuzzy;
|
||||||
|
break;
|
||||||
|
case NAME_SoulTrans:
|
||||||
|
th->RenderStyle = STYLE_SoulTrans;
|
||||||
|
break;
|
||||||
|
case NAME_OptFuzzy:
|
||||||
|
th->RenderStyle = STYLE_OptFuzzy;
|
||||||
|
break;
|
||||||
|
case NAME_Stencil:
|
||||||
|
th->RenderStyle = STYLE_Stencil;
|
||||||
|
break;
|
||||||
|
case NAME_Translucent:
|
||||||
|
th->RenderStyle = STYLE_Translucent;
|
||||||
|
break;
|
||||||
|
case NAME_Add:
|
||||||
|
case NAME_Additive:
|
||||||
|
th->RenderStyle = STYLE_Add;
|
||||||
|
break;
|
||||||
|
case NAME_Shaded:
|
||||||
|
th->RenderStyle = STYLE_Shaded;
|
||||||
|
break;
|
||||||
|
case NAME_TranslucentStencil:
|
||||||
|
th->RenderStyle = STYLE_TranslucentStencil;
|
||||||
|
break;
|
||||||
|
case NAME_Shadow:
|
||||||
|
th->RenderStyle = STYLE_Shadow;
|
||||||
|
break;
|
||||||
|
case NAME_Subtract:
|
||||||
|
case NAME_Subtractive:
|
||||||
|
th->RenderStyle = STYLE_Subtract;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Additive:
|
case NAME_Alpha:
|
||||||
CHECK_N(Zd | Zdt)
|
th->alpha = CheckFixed(key);
|
||||||
Flag(th->flags, MTF_ADD, key);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Subtractive:
|
case NAME_FillColor:
|
||||||
CHECK_N(Zd | Zdt)
|
th->fillcolor = CheckInt(key);
|
||||||
Flag(th->flags, MTF_SUBTRACT, key);
|
|
||||||
|
case NAME_Health:
|
||||||
|
th->health = CheckInt(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Spectre:
|
case NAME_Score:
|
||||||
CHECK_N(Zd | Zdt)
|
th->score = CheckInt(key);
|
||||||
Flag(th->flags, MTF_SPECTRE, key);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Doublehealth:
|
case NAME_Pitch:
|
||||||
CHECK_N(Zd | Zdt)
|
th->pitch = (short)CheckInt(key);
|
||||||
Flag(th->flags, MTF_DOUBLEHEALTH, key);
|
break;
|
||||||
|
|
||||||
|
case NAME_Roll:
|
||||||
|
th->roll = (short)CheckInt(key);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NAME_ScaleX:
|
||||||
|
th->scaleX = CheckFixed(key);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NAME_ScaleY:
|
||||||
|
th->scaleY = CheckFixed(key);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NAME_Scale:
|
||||||
|
th->scaleX = th->scaleY = CheckFixed(key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -76,7 +76,7 @@ const char *GetVersionString();
|
||||||
|
|
||||||
// Use 4500 as the base git save version, since it's higher than the
|
// Use 4500 as the base git save version, since it's higher than the
|
||||||
// SVN revision ever got.
|
// SVN revision ever got.
|
||||||
#define SAVEVER 4505
|
#define SAVEVER 4506
|
||||||
|
|
||||||
#define SAVEVERSTRINGIFY2(x) #x
|
#define SAVEVERSTRINGIFY2(x) #x
|
||||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||||
|
|
Loading…
Reference in a new issue