Skip to content

Add commonly GZDoom-specific properties to DEHACKED #3062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 66 additions & 3 deletions src/gamedata/d_dehacked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,8 @@ static int PatchThing (int thingy, int flags)
AActor *info;
uint8_t dummy[sizeof(AActor)];
bool hadHeight = false;
bool hadProjHeight = false;
bool hadPhysHeight = false;
bool hadTranslucency = false;
bool hadStyle = false;
FStateDefinitions statedef;
Expand Down Expand Up @@ -1262,8 +1264,17 @@ static int PatchThing (int thingy, int flags)
}
else if (linelen == 6 && stricmp (Line1, "Height") == 0)
{
info->Height = DEHToDouble(val);
info->projectilepassheight = 0; // needs to be disabled
// [XA] This is a bit more complex now, since projectilepassheight
// and "physical height" now both exist. if either of these are
// defined, then override the Height field accordingly.
if(!hadPhysHeight)
{
info->Height = DEHToDouble(val);
}
if(!hadProjHeight)
{
info->projectilepassheight = 0; // needs to be disabled
}
hadHeight = true;
}
else if (linelen == 14 && stricmp (Line1, "Missile damage") == 0)
Expand Down Expand Up @@ -1459,6 +1470,47 @@ static int PatchThing (int thingy, int flags)
info->missilechancemult = DEHToDouble(val);
}

// [XA] Fields for common GZDoom-specific values that
// are desirable to set in a cross-port DEHACKED mod.
// adding these prevents users from having to reimplement
// actors in zscript just to define these few fields.
else if (!stricmp(Line1, "Projectile pass height"))
{
info->projectilepassheight = DEHToDouble(val);
hadProjHeight = true;
}
else if (!stricmp(Line1, "Physical height"))
{
// [XA] This is a synonym for Height that is intended
// to be ignored in any ports that don't support
// projectilepassheight -- this is needed because
// other ports' "Height x" is actually equivalent
// to Zdoom's "ProjectilePassHeight x; Height y",
// i.e. the definition of the Height var is different.
info->Height = DEHToDouble(val);
hadPhysHeight = true;
}
else if (!stricmp(Line1, "Tag"))
{
stripwhite(Line2);
info->SetTag(Line2);
}
else if (!stricmp(Line1, "Obituary"))
{
stripwhite(Line2);
info->StringVar(NAME_Obituary) = Line2;
}
else if (!stricmp(Line1, "Melee obituary"))
{
stripwhite(Line2);
info->StringVar(NAME_HitObituary) = Line2;
}
else if (!stricmp(Line1, "Self obituary"))
{
stripwhite(Line2);
info->StringVar(NAME_SelfObituary) = Line2;
}

else if (linelen > 6)
{
if (stricmp (Line1 + linelen - 6, " frame") == 0)
Expand Down Expand Up @@ -1727,12 +1779,23 @@ static int PatchThing (int thingy, int flags)
else Printf (unknown_str, Line1, "Thing", thingy);
}

// [XA] sanity check: to avoid ambiguity, an actor that defines
// ProjectilePassHeight must also define PhysicalHeight, and vice-versa.
if(hadPhysHeight && !hadProjHeight)
{
I_Error("Thing %d: DEHACKED actors that set 'Physical height' must also set 'Projectile pass height'\n", thingy);
}
else if(!hadPhysHeight && hadProjHeight)
{
I_Error("Thing %d: DEHACKED actors that set 'Projectile pass height' must also set 'Physical height'\n", thingy);
}

if (info != (AActor *)&dummy)
{
// Reset heights for things hanging from the ceiling that
// don't specify a new height.
if (info->flags & MF_SPAWNCEILING &&
!hadHeight &&
!hadHeight && !hadPhysHeight &&
thingy <= (int)OrgHeights.Size() && thingy > 0)
{
info->Height = OrgHeights[thingy - 1];
Expand Down
3 changes: 3 additions & 0 deletions src/namedef_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ xx(PowerupType)
xx(PlayerPawn)
xx(RipSound)
xx(Archvile)
xx(Obituary)
xx(HitObituary)
xx(SelfObituary)

xx(ResolveState)

Expand Down