- added 'damageonland' property to terrain definition

This property helps to replicate vanilla Hexen behavior of damaging player right after touching lava floor

https://forum.zdoom.org/viewtopic.php?t=66512
This commit is contained in:
alexey.lysiuk 2019-11-29 15:49:45 +02:00 committed by Christoph Oelckers
parent bf8305062a
commit 1a19dbb52f
5 changed files with 13 additions and 0 deletions

View file

@ -185,6 +185,7 @@ static const char *TerrainKeywords[] =
"liquid",
"friction",
"allowprotection",
"damageonland",
NULL
};
@ -220,6 +221,7 @@ static FGenericParse TerrainParser[] =
{ GEN_Bool, {myoffsetof(FTerrainDef, IsLiquid)} },
{ GEN_Custom, {(size_t)ParseFriction} },
{ GEN_Bool, {myoffsetof(FTerrainDef, AllowProtection)} },
{ GEN_Bool, {myoffsetof(FTerrainDef, DamageOnLand)} },
};
@ -734,5 +736,6 @@ DEFINE_FIELD(FTerrainDef, LeftStepSound)
DEFINE_FIELD(FTerrainDef, RightStepSound)
DEFINE_FIELD(FTerrainDef, IsLiquid)
DEFINE_FIELD(FTerrainDef, AllowProtection)
DEFINE_FIELD(FTerrainDef, DamageOnLand)
DEFINE_FIELD(FTerrainDef, Friction)
DEFINE_FIELD(FTerrainDef, MoveFactor)

View file

@ -115,6 +115,7 @@ struct FTerrainDef
FSoundID RightStepSound;
bool IsLiquid;
bool AllowProtection;
bool DamageOnLand;
double Friction;
double MoveFactor;
};

View file

@ -6043,6 +6043,13 @@ foundone:
if (splashnum == -1)
return Terrains[terrainnum].IsLiquid;
const bool dealDamageOnLand = thing->player
&& Terrains[terrainnum].DamageOnLand
&& Terrains[terrainnum].DamageAmount
&& (thing->Level->time & Terrains[terrainnum].DamageTimeMask);
if (dealDamageOnLand)
P_DamageMobj(thing, nullptr, nullptr, Terrains[terrainnum].DamageAmount, Terrains[terrainnum].DamageMOD);
// don't splash when touching an underwater floor
if (thing->waterlevel >= 1 && pos.Z <= thing->floorz) return Terrains[terrainnum].IsLiquid;

View file

@ -143,6 +143,7 @@ terrain Lava
damageamount 5
damagetype lava
damagetimemask 31
damageonland
}
terrain Ice

View file

@ -895,6 +895,7 @@ struct TerrainDef native
native Sound RightStepSound;
native bool IsLiquid;
native bool AllowProtection;
native bool DamageOnLand;
native double Friction;
native double MoveFactor;
};