mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- 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:
parent
c2e155bb9f
commit
93c12cf259
3 changed files with 28 additions and 3 deletions
|
@ -109,6 +109,7 @@ static FCompatOption Options[] =
|
|||
{ "rebuildnodes", BCOMPATF_REBUILDNODES, SLOT_BCOMPAT },
|
||||
{ "linkfrozenprops", BCOMPATF_LINKFROZENPROPS, SLOT_BCOMPAT },
|
||||
{ "disablepushwindowcheck", BCOMPATF_NOWINDOWCHECK, SLOT_BCOMPAT },
|
||||
{ "floatbob", BCOMPATF_FLOATBOB, SLOT_BCOMPAT },
|
||||
|
||||
// list copied from g_mapinfo.cpp
|
||||
{ "shorttex", COMPATF_SHORTTEX, SLOT_COMPAT },
|
||||
|
@ -434,6 +435,11 @@ void CheckCompatibility(MapData *map)
|
|||
// Reset i_compatflags
|
||||
compatflags.Callback();
|
||||
compatflags2.Callback();
|
||||
// Set floatbob compatibility for all maps with an original Hexen MAPINFO.
|
||||
if (level.flags2 & LEVEL2_HEXENHACK)
|
||||
{
|
||||
ib_compatflags |= BCOMPATF_FLOATBOB;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -354,6 +354,7 @@ enum
|
|||
BCOMPATF_REBUILDNODES = 1 << 5, // Force node rebuild
|
||||
BCOMPATF_LINKFROZENPROPS = 1 << 6, // Clearing PROP_TOTALLYFROZEN or PROP_FROZEN also clears the other
|
||||
BCOMPATF_NOWINDOWCHECK = 1 << 7, // Disable the window check in CheckForPushSpecial()
|
||||
BCOMPATF_FLOATBOB = 1 << 8, // Use Hexen's original method of preventing floatbobbing items from falling down
|
||||
};
|
||||
|
||||
// phares 3/20/98:
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue