mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Merge branch 'kill-zshift' into 'next'
Eliminate all unnecessary uses of ZSHIFT See merge request STJr/SRB2!580
This commit is contained in:
commit
bb9093ff57
5 changed files with 29 additions and 109 deletions
|
@ -2493,7 +2493,7 @@ void F_StartTitleScreen(void)
|
|||
camera.x = startpos->x << FRACBITS;
|
||||
camera.y = startpos->y << FRACBITS;
|
||||
camera.subsector = R_PointInSubsector(camera.x, camera.y);
|
||||
camera.z = camera.subsector->sector->floorheight + ((startpos->options >> ZSHIFT) << FRACBITS);
|
||||
camera.z = camera.subsector->sector->floorheight + (startpos->z << FRACBITS);
|
||||
camera.angle = (startpos->angle % 360)*ANG1;
|
||||
camera.aiming = 0;
|
||||
}
|
||||
|
|
11
src/g_game.c
11
src/g_game.c
|
@ -6873,23 +6873,20 @@ void G_AddGhost(char *defdemoname)
|
|||
I_Assert(mthing);
|
||||
{ // A bit more complex than P_SpawnPlayer because ghosts aren't solid and won't just push themselves out of the ceiling.
|
||||
fixed_t z,f,c;
|
||||
fixed_t offset = mthing->z << FRACBITS;
|
||||
gh->mo = P_SpawnMobj(mthing->x << FRACBITS, mthing->y << FRACBITS, 0, MT_GHOST);
|
||||
gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||
gh->mo->angle = FixedAngle(mthing->angle << FRACBITS);
|
||||
f = gh->mo->floorz;
|
||||
c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height;
|
||||
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
||||
{
|
||||
z = c;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
z = c - offset;
|
||||
if (z < f)
|
||||
z = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
z = f;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
z = f + offset;
|
||||
if (z > c)
|
||||
z = c;
|
||||
}
|
||||
|
|
|
@ -517,6 +517,7 @@ void Command_Teleport_f(void)
|
|||
if (!starpostnum) // spawnpoints...
|
||||
{
|
||||
mapthing_t *mt;
|
||||
fixed_t offset;
|
||||
|
||||
if (starpostpath >= numcoopstarts)
|
||||
{
|
||||
|
@ -527,6 +528,7 @@ void Command_Teleport_f(void)
|
|||
mt = playerstarts[starpostpath]; // Given above check, should never be NULL.
|
||||
intx = mt->x<<FRACBITS;
|
||||
inty = mt->y<<FRACBITS;
|
||||
offset = mt->z<<FRACBITS;
|
||||
|
||||
ss = R_IsPointInSubsector(intx, inty);
|
||||
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
||||
|
@ -538,17 +540,9 @@ void Command_Teleport_f(void)
|
|||
// Flagging a player's ambush will make them start on the ceiling
|
||||
// Objectflip inverts
|
||||
if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP))
|
||||
{
|
||||
intz = ss->sector->ceilingheight - p->mo->height;
|
||||
if (mt->options >> ZSHIFT)
|
||||
intz -= ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
intz = ss->sector->ceilingheight - p->mo->height - offset;
|
||||
else
|
||||
{
|
||||
intz = ss->sector->floorheight;
|
||||
if (mt->options >> ZSHIFT)
|
||||
intz += ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
intz = ss->sector->floorheight + offset;
|
||||
|
||||
if (mt->options & MTF_OBJECTFLIP) // flip the player!
|
||||
{
|
||||
|
@ -1193,14 +1187,14 @@ void OP_NightsObjectplace(player_t *player)
|
|||
if (cmd->buttons & BT_TOSSFLAG)
|
||||
{
|
||||
UINT16 vertangle = (UINT16)(player->anotherflyangle % 360);
|
||||
UINT16 newflags, newz;
|
||||
UINT16 newflags;
|
||||
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
if (!OP_HeightOkay(player, false))
|
||||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false);
|
||||
newz = min((mt->options >> ZSHIFT) - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0);
|
||||
mt->z = min(mt->z - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0);
|
||||
// height offset: from P_TouchSpecialThing case MT_NIGHTSBUMPER
|
||||
|
||||
// clockwise
|
||||
|
@ -1231,7 +1225,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
else // forward
|
||||
newflags = 0;
|
||||
|
||||
mt->options = (newz << ZSHIFT) | newflags;
|
||||
mt->options = (mt->z << ZSHIFT) | newflags;
|
||||
|
||||
// if NiGHTS is facing backwards, orient the Thing angle forwards so that the sprite angle
|
||||
// displays correctly. Backwards movement via the Thing flags is unaffected.
|
||||
|
@ -1439,7 +1433,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
else
|
||||
P_SpawnMapThing(mt);
|
||||
|
||||
CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->options>>ZSHIFT, mt->angle);
|
||||
CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->z, mt->angle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
96
src/p_mobj.c
96
src/p_mobj.c
|
@ -9903,19 +9903,12 @@ static void P_FlagFuseThink(mobj_t *mobj)
|
|||
|
||||
x = mobj->spawnpoint->x << FRACBITS;
|
||||
y = mobj->spawnpoint->y << FRACBITS;
|
||||
z = mobj->spawnpoint->z << FRACBITS;
|
||||
ss = R_PointInSubsector(x, y);
|
||||
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = ss->sector->ceilingheight - mobjinfo[mobj->type].height;
|
||||
if (mobj->spawnpoint->options >> ZSHIFT)
|
||||
z -= (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS;
|
||||
}
|
||||
z = ss->sector->ceilingheight - mobjinfo[mobj->type].height - z;
|
||||
else
|
||||
{
|
||||
z = ss->sector->floorheight;
|
||||
if (mobj->spawnpoint->options >> ZSHIFT)
|
||||
z += (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS;
|
||||
}
|
||||
z = ss->sector->floorheight + z;
|
||||
flagmo = P_SpawnMobj(x, y, z, mobj->type);
|
||||
flagmo->spawnpoint = mobj->spawnpoint;
|
||||
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
||||
|
@ -11289,9 +11282,6 @@ static mobjtype_t P_GetMobjtype(UINT16 mthingtype)
|
|||
//
|
||||
void P_RespawnSpecials(void)
|
||||
{
|
||||
fixed_t x, y, z;
|
||||
subsector_t *ss;
|
||||
mobj_t *mo = NULL;
|
||||
mapthing_t *mthing = NULL;
|
||||
|
||||
// only respawn items when cv_itemrespawn is on
|
||||
|
@ -11321,63 +11311,8 @@ void P_RespawnSpecials(void)
|
|||
#endif
|
||||
|
||||
if (mthing)
|
||||
{
|
||||
mobjtype_t i = P_GetMobjtype(mthing->type);
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
ss = R_PointInSubsector(x, y);
|
||||
P_SpawnMapThing(mthing);
|
||||
|
||||
if (i == MT_UNKNOWN) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
|
||||
{
|
||||
// 3D Mode start Thing is unlikely to be added to the que,
|
||||
// so don't bother checking for that specific type
|
||||
CONS_Alert(CONS_WARNING, M_GetText("P_RespawnSpecials: Unknown thing type %d attempted to respawn at (%d, %d)\n"), mthing->type, mthing->x, mthing->y);
|
||||
// pull it from the que
|
||||
iquetail = (iquetail+1)&(ITEMQUESIZE-1);
|
||||
return;
|
||||
}
|
||||
|
||||
//CTF rings should continue to respawn as normal rings outside of CTF.
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
{
|
||||
if (i == MT_REDTEAMRING || i == MT_BLUETEAMRING)
|
||||
i = MT_RING;
|
||||
}
|
||||
|
||||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->ceilingheight) - (mthing->options >> ZSHIFT) * FRACUNIT;
|
||||
if (mthing->options & MTF_AMBUSH
|
||||
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || i == MT_NIGHTSSTAR || P_WeaponOrPanel(i)))
|
||||
z -= 24*FRACUNIT;
|
||||
z -= mobjinfo[i].height; // Don't forget the height!
|
||||
}
|
||||
else
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->floorheight) + (mthing->options >> ZSHIFT) * FRACUNIT;
|
||||
if (mthing->options & MTF_AMBUSH
|
||||
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || i == MT_NIGHTSSTAR || P_WeaponOrPanel(i)))
|
||||
z += 24*FRACUNIT;
|
||||
}
|
||||
|
||||
mo = P_SpawnMobj(x, y, z, i);
|
||||
mo->spawnpoint = mthing;
|
||||
mo->angle = ANGLE_45 * (mthing->angle/45);
|
||||
|
||||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
mo->eflags |= MFE_VERTICALFLIP;
|
||||
mo->flags2 |= MF2_OBJECTFLIP;
|
||||
}
|
||||
}
|
||||
// pull it from the que
|
||||
iquetail = (iquetail+1)&(ITEMQUESIZE-1);
|
||||
}
|
||||
|
@ -11563,7 +11498,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
|||
|
||||
fixed_t z;
|
||||
sector_t *sector;
|
||||
fixed_t floor, ceiling;
|
||||
fixed_t floor, ceiling, ceilingspawn;
|
||||
|
||||
player_t *p = &players[playernum];
|
||||
mobj_t *mobj = p->mo;
|
||||
|
@ -11590,23 +11525,18 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
|||
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
|
||||
#endif
|
||||
sector->ceilingheight;
|
||||
ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height;
|
||||
|
||||
if (mthing)
|
||||
{
|
||||
fixed_t offset = mthing->z << FRACBITS;
|
||||
|
||||
// Flagging a player's ambush will make them start on the ceiling
|
||||
// Objectflip inverts
|
||||
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
||||
{
|
||||
z = ceiling - mobjinfo[MT_PLAYER].height;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
z = ceilingspawn - offset;
|
||||
else
|
||||
{
|
||||
z = floor;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
z = floor + offset;
|
||||
|
||||
if (mthing->options & MTF_OBJECTFLIP) // flip the player!
|
||||
{
|
||||
|
@ -11623,8 +11553,8 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
|||
|
||||
if (z < floor)
|
||||
z = floor;
|
||||
else if (z > ceiling - mobjinfo[MT_PLAYER].height)
|
||||
z = ceiling - mobjinfo[MT_PLAYER].height;
|
||||
else if (z > ceilingspawn)
|
||||
z = ceilingspawn;
|
||||
|
||||
mobj->floorz = floor;
|
||||
mobj->ceilingz = ceiling;
|
||||
|
@ -12465,7 +12395,7 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj)
|
|||
|| (ticcount = (sides[lines[line].sidenum[1]].textureoffset >> FRACBITS)) < 1)
|
||||
ticcount = 3;
|
||||
|
||||
numdivisions = (mthing->options >> ZSHIFT);
|
||||
numdivisions = mthing->z;
|
||||
|
||||
if (numdivisions)
|
||||
{
|
||||
|
|
|
@ -445,10 +445,9 @@ static pslope_t *MakeViaMapthings(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
|||
I_Error("MakeViaMapthings: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
|
||||
vx[i].x = mt->x << FRACBITS;
|
||||
vx[i].y = mt->y << FRACBITS;
|
||||
if (mt->extrainfo)
|
||||
vx[i].z = mt->options << FRACBITS;
|
||||
else
|
||||
vx[i].z = (R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector->floorheight) + ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
vx[i].z = mt->z << FRACBITS;
|
||||
if (!mt->extrainfo)
|
||||
vx[i].z += R_PointInSubsector(vx[i].x, vx[i].y)->sector->floorheight;
|
||||
}
|
||||
|
||||
ReconfigureViaVertexes(ret, vx[0], vx[1], vx[2]);
|
||||
|
|
Loading…
Reference in a new issue