mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 21:20:54 +00:00
Merge branch 'udmf-fixmapthingheight' into 'next'
UDMF: Fix mapthing spawn height scaling improperly with the object scale; only special… See merge request STJr/SRB2!1096
This commit is contained in:
commit
a31c8d12b4
2 changed files with 17 additions and 16 deletions
31
src/p_mobj.c
31
src/p_mobj.c
|
@ -11614,7 +11614,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
mapthing_t *huntemeralds[MAXHUNTEMERALDS];
|
||||
INT32 numhuntemeralds;
|
||||
|
||||
fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip, const fixed_t scale)
|
||||
fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t dz, const fixed_t offset, const boolean flip, const fixed_t scale)
|
||||
{
|
||||
const subsector_t *ss = R_PointInSubsector(x, y);
|
||||
|
||||
|
@ -11624,14 +11624,15 @@ fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const f
|
|||
|
||||
// Establish height.
|
||||
if (flip)
|
||||
return P_GetSectorCeilingZAt(ss->sector, x, y) - FixedMul(scale, offset + mobjinfo[mobjtype].height);
|
||||
return P_GetSectorCeilingZAt(ss->sector, x, y) - dz - FixedMul(scale, offset + mobjinfo[mobjtype].height);
|
||||
else
|
||||
return P_GetSectorFloorZAt(ss->sector, x, y) + FixedMul(scale, offset);
|
||||
return P_GetSectorFloorZAt(ss->sector, x, y) + dz + FixedMul(scale, offset);
|
||||
}
|
||||
|
||||
fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)
|
||||
{
|
||||
fixed_t offset = mthing->z << FRACBITS;
|
||||
fixed_t dz = mthing->z << FRACBITS; // Base offset from the floor.
|
||||
fixed_t offset = 0; // Specific scaling object offset.
|
||||
boolean flip = (!!(mobjinfo[mobjtype].flags & MF_SPAWNCEILING) ^ !!(mthing->options & MTF_OBJECTFLIP));
|
||||
|
||||
switch (mobjtype)
|
||||
|
@ -11647,17 +11648,17 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt
|
|||
case MT_JETTBOMBER:
|
||||
case MT_JETTGUNNER:
|
||||
case MT_EGGMOBILE2:
|
||||
if (!offset)
|
||||
offset = 33*FRACUNIT;
|
||||
if (!dz)
|
||||
dz = 33*FRACUNIT;
|
||||
break;
|
||||
case MT_EGGMOBILE:
|
||||
if (!offset)
|
||||
offset = 128*FRACUNIT;
|
||||
if (!dz)
|
||||
dz = 128*FRACUNIT;
|
||||
break;
|
||||
case MT_GOLDBUZZ:
|
||||
case MT_REDBUZZ:
|
||||
if (!offset)
|
||||
offset = 288*FRACUNIT;
|
||||
if (!dz)
|
||||
dz = 288*FRACUNIT;
|
||||
break;
|
||||
|
||||
// Horizontal springs, may float additional units with MTF_AMBUSH.
|
||||
|
@ -11690,7 +11691,7 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt
|
|||
offset += mthing->options & MTF_AMBUSH ? 24*FRACUNIT : 0;
|
||||
}
|
||||
|
||||
if (!offset) // Snap to the surfaces when there's no offset set.
|
||||
if (!(dz + offset)) // Snap to the surfaces when there's no offset set.
|
||||
{
|
||||
if (flip)
|
||||
return ONCEILINGZ;
|
||||
|
@ -11698,7 +11699,7 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt
|
|||
return ONFLOORZ;
|
||||
}
|
||||
|
||||
return P_GetMobjSpawnHeight(mobjtype, x, y, offset, flip, mthing->scale);
|
||||
return P_GetMobjSpawnHeight(mobjtype, x, y, dz, offset, flip, mthing->scale);
|
||||
}
|
||||
|
||||
static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing)
|
||||
|
@ -13187,7 +13188,7 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
|
|||
TVector v, *res;
|
||||
fixed_t x = mthing->x << FRACBITS;
|
||||
fixed_t y = mthing->y << FRACBITS;
|
||||
fixed_t z = P_GetMobjSpawnHeight(MT_HOOP, x, y, mthing->z << FRACBITS, false, mthing->scale);
|
||||
fixed_t z = P_GetMobjSpawnHeight(MT_HOOP, x, y, mthing->z << FRACBITS, 0, false, mthing->scale);
|
||||
|
||||
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
||||
hoopcenter->spawnpoint = mthing;
|
||||
|
@ -13332,7 +13333,7 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t* itemtypes, UINT8 numi
|
|||
itemtypes[r] = P_GetMobjtypeSubstitute(&dummything, itemtypes[r]);
|
||||
}
|
||||
}
|
||||
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, mthing->options & MTF_OBJECTFLIP, mthing->scale);
|
||||
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, 0, mthing->options & MTF_OBJECTFLIP, mthing->scale);
|
||||
|
||||
for (r = 0; r < numitems; r++)
|
||||
{
|
||||
|
@ -13390,7 +13391,7 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n
|
|||
itemtypes[i] = P_GetMobjtypeSubstitute(&dummything, itemtypes[i]);
|
||||
}
|
||||
}
|
||||
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, false, mthing->scale);
|
||||
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, 0, false, mthing->scale);
|
||||
|
||||
for (i = 0; i < numitems; i++)
|
||||
{
|
||||
|
|
|
@ -452,7 +452,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing);
|
|||
void P_MovePlayerToStarpost(INT32 playernum);
|
||||
void P_AfterPlayerSpawn(INT32 playernum);
|
||||
|
||||
fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip, const fixed_t scale);
|
||||
fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t dz, const fixed_t offset, const boolean flip, const fixed_t scale);
|
||||
fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y);
|
||||
|
||||
mobj_t *P_SpawnMapThing(mapthing_t *mthing);
|
||||
|
|
Loading…
Reference in a new issue