- addressed the problem that prompted setting NOGRAVITY for all floatbobbing items for real:

Hexen uses the spawn height value from the mapthing_t structure to offset the item when floatbobbing. With proper gravity handling enabled this method doesn't really work so as a workaround ZDoom will now enable a hidden compatibility option when playing any map with a Hexen format MAPINFO so that any positive value in this field will make P_ZMovement revert to the original method of setting the items height (excluding the floatbob offset, of course.)

This also removes some code from P_NightmareRespawn that originate from the original Hexen method for floatbobbing which aren't needed anymore
This commit is contained in:
Christoph Oelckers 2015-02-12 18:57:06 +01:00
commit 93c12cf259
3 changed files with 28 additions and 3 deletions

View file

@ -2314,6 +2314,16 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
}
}
// Hexen compatibility handling for floatbobbing. Ugh...
// Hexen yanked all items to the floor, except those being spawned at map start in the air.
// Those were kept at their original height.
// Do this only if the item was actually spawned by the map above ground to avoid problems.
if (mo->special1 > 0 && (mo->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB))
{
mo->z = mo->floorz + mo->special1;
}
//
// adjust height
//
@ -2616,8 +2626,6 @@ void P_NightmareRespawn (AActor *mobj)
z = ONCEILINGZ;
else if (info->flags2 & MF2_SPAWNFLOAT)
z = FLOATRANDZ;
else if (info->flags2 & MF2_FLOATBOB)
z = mobj->SpawnPoint[2];
else
z = ONFLOORZ;
@ -4869,7 +4877,13 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj = AActor::StaticSpawn (i, x, y, z, NO_REPLACE, true);
if (z == ONFLOORZ)
{
mobj->z += mthing->z;
if ((mobj->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB))
{
mobj->special1 = mthing->z;
}
}
else if (z == ONCEILINGZ)
mobj->z -= mthing->z;
@ -4882,7 +4896,11 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity);
else mobj->flags &= ~MF_NOGRAVITY;
P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
// For Hexen floatbob 'compatibility' we do not really want to alter the floorz.
if (mobj->special1 == 0 || !(mobj->flags2 & MF2_FLOATBOB) || !(ib_compatflags & BCOMPATF_FLOATBOB))
{
P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
}
if (!(mobj->flags2 & MF2_ARGSDEFINED))
{