mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +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.x = startpos->x << FRACBITS;
|
||||||
camera.y = startpos->y << FRACBITS;
|
camera.y = startpos->y << FRACBITS;
|
||||||
camera.subsector = R_PointInSubsector(camera.x, camera.y);
|
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.angle = (startpos->angle % 360)*ANG1;
|
||||||
camera.aiming = 0;
|
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);
|
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.
|
{ // 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 z,f,c;
|
||||||
|
fixed_t offset = mthing->z << FRACBITS;
|
||||||
gh->mo = P_SpawnMobj(mthing->x << FRACBITS, mthing->y << FRACBITS, 0, MT_GHOST);
|
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;
|
f = gh->mo->floorz;
|
||||||
c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height;
|
c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height;
|
||||||
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
||||||
{
|
{
|
||||||
z = c;
|
z = c - offset;
|
||||||
if (mthing->options >> ZSHIFT)
|
|
||||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
|
||||||
if (z < f)
|
if (z < f)
|
||||||
z = f;
|
z = f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = f;
|
z = f + offset;
|
||||||
if (mthing->options >> ZSHIFT)
|
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
|
||||||
if (z > c)
|
if (z > c)
|
||||||
z = c;
|
z = c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,6 +517,7 @@ void Command_Teleport_f(void)
|
||||||
if (!starpostnum) // spawnpoints...
|
if (!starpostnum) // spawnpoints...
|
||||||
{
|
{
|
||||||
mapthing_t *mt;
|
mapthing_t *mt;
|
||||||
|
fixed_t offset;
|
||||||
|
|
||||||
if (starpostpath >= numcoopstarts)
|
if (starpostpath >= numcoopstarts)
|
||||||
{
|
{
|
||||||
|
@ -527,6 +528,7 @@ void Command_Teleport_f(void)
|
||||||
mt = playerstarts[starpostpath]; // Given above check, should never be NULL.
|
mt = playerstarts[starpostpath]; // Given above check, should never be NULL.
|
||||||
intx = mt->x<<FRACBITS;
|
intx = mt->x<<FRACBITS;
|
||||||
inty = mt->y<<FRACBITS;
|
inty = mt->y<<FRACBITS;
|
||||||
|
offset = mt->z<<FRACBITS;
|
||||||
|
|
||||||
ss = R_IsPointInSubsector(intx, inty);
|
ss = R_IsPointInSubsector(intx, inty);
|
||||||
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
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
|
// Flagging a player's ambush will make them start on the ceiling
|
||||||
// Objectflip inverts
|
// Objectflip inverts
|
||||||
if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP))
|
if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP))
|
||||||
{
|
intz = ss->sector->ceilingheight - p->mo->height - offset;
|
||||||
intz = ss->sector->ceilingheight - p->mo->height;
|
|
||||||
if (mt->options >> ZSHIFT)
|
|
||||||
intz -= ((mt->options >> ZSHIFT) << FRACBITS);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
intz = ss->sector->floorheight + offset;
|
||||||
intz = ss->sector->floorheight;
|
|
||||||
if (mt->options >> ZSHIFT)
|
|
||||||
intz += ((mt->options >> ZSHIFT) << FRACBITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mt->options & MTF_OBJECTFLIP) // flip the player!
|
if (mt->options & MTF_OBJECTFLIP) // flip the player!
|
||||||
{
|
{
|
||||||
|
@ -1193,14 +1187,14 @@ void OP_NightsObjectplace(player_t *player)
|
||||||
if (cmd->buttons & BT_TOSSFLAG)
|
if (cmd->buttons & BT_TOSSFLAG)
|
||||||
{
|
{
|
||||||
UINT16 vertangle = (UINT16)(player->anotherflyangle % 360);
|
UINT16 vertangle = (UINT16)(player->anotherflyangle % 360);
|
||||||
UINT16 newflags, newz;
|
UINT16 newflags;
|
||||||
|
|
||||||
player->pflags |= PF_ATTACKDOWN;
|
player->pflags |= PF_ATTACKDOWN;
|
||||||
if (!OP_HeightOkay(player, false))
|
if (!OP_HeightOkay(player, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false);
|
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
|
// height offset: from P_TouchSpecialThing case MT_NIGHTSBUMPER
|
||||||
|
|
||||||
// clockwise
|
// clockwise
|
||||||
|
@ -1231,7 +1225,7 @@ void OP_NightsObjectplace(player_t *player)
|
||||||
else // forward
|
else // forward
|
||||||
newflags = 0;
|
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
|
// 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.
|
// displays correctly. Backwards movement via the Thing flags is unaffected.
|
||||||
|
@ -1439,7 +1433,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||||
else
|
else
|
||||||
P_SpawnMapThing(mt);
|
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;
|
x = mobj->spawnpoint->x << FRACBITS;
|
||||||
y = mobj->spawnpoint->y << FRACBITS;
|
y = mobj->spawnpoint->y << FRACBITS;
|
||||||
|
z = mobj->spawnpoint->z << FRACBITS;
|
||||||
ss = R_PointInSubsector(x, y);
|
ss = R_PointInSubsector(x, y);
|
||||||
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
||||||
{
|
z = ss->sector->ceilingheight - mobjinfo[mobj->type].height - z;
|
||||||
z = ss->sector->ceilingheight - mobjinfo[mobj->type].height;
|
|
||||||
if (mobj->spawnpoint->options >> ZSHIFT)
|
|
||||||
z -= (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
z = ss->sector->floorheight + z;
|
||||||
z = ss->sector->floorheight;
|
|
||||||
if (mobj->spawnpoint->options >> ZSHIFT)
|
|
||||||
z += (mobj->spawnpoint->options >> ZSHIFT) << FRACBITS;
|
|
||||||
}
|
|
||||||
flagmo = P_SpawnMobj(x, y, z, mobj->type);
|
flagmo = P_SpawnMobj(x, y, z, mobj->type);
|
||||||
flagmo->spawnpoint = mobj->spawnpoint;
|
flagmo->spawnpoint = mobj->spawnpoint;
|
||||||
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
if (mobj->spawnpoint->options & MTF_OBJECTFLIP)
|
||||||
|
@ -11289,9 +11282,6 @@ static mobjtype_t P_GetMobjtype(UINT16 mthingtype)
|
||||||
//
|
//
|
||||||
void P_RespawnSpecials(void)
|
void P_RespawnSpecials(void)
|
||||||
{
|
{
|
||||||
fixed_t x, y, z;
|
|
||||||
subsector_t *ss;
|
|
||||||
mobj_t *mo = NULL;
|
|
||||||
mapthing_t *mthing = NULL;
|
mapthing_t *mthing = NULL;
|
||||||
|
|
||||||
// only respawn items when cv_itemrespawn is on
|
// only respawn items when cv_itemrespawn is on
|
||||||
|
@ -11321,63 +11311,8 @@ void P_RespawnSpecials(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mthing)
|
if (mthing)
|
||||||
{
|
P_SpawnMapThing(mthing);
|
||||||
mobjtype_t i = P_GetMobjtype(mthing->type);
|
|
||||||
x = mthing->x << FRACBITS;
|
|
||||||
y = mthing->y << FRACBITS;
|
|
||||||
ss = R_PointInSubsector(x, y);
|
|
||||||
|
|
||||||
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
|
// pull it from the que
|
||||||
iquetail = (iquetail+1)&(ITEMQUESIZE-1);
|
iquetail = (iquetail+1)&(ITEMQUESIZE-1);
|
||||||
}
|
}
|
||||||
|
@ -11563,7 +11498,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
||||||
|
|
||||||
fixed_t z;
|
fixed_t z;
|
||||||
sector_t *sector;
|
sector_t *sector;
|
||||||
fixed_t floor, ceiling;
|
fixed_t floor, ceiling, ceilingspawn;
|
||||||
|
|
||||||
player_t *p = &players[playernum];
|
player_t *p = &players[playernum];
|
||||||
mobj_t *mobj = p->mo;
|
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) :
|
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
|
||||||
#endif
|
#endif
|
||||||
sector->ceilingheight;
|
sector->ceilingheight;
|
||||||
|
ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height;
|
||||||
|
|
||||||
if (mthing)
|
if (mthing)
|
||||||
{
|
{
|
||||||
|
fixed_t offset = mthing->z << FRACBITS;
|
||||||
|
|
||||||
// Flagging a player's ambush will make them start on the ceiling
|
// Flagging a player's ambush will make them start on the ceiling
|
||||||
// Objectflip inverts
|
// Objectflip inverts
|
||||||
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
||||||
{
|
z = ceilingspawn - offset;
|
||||||
z = ceiling - mobjinfo[MT_PLAYER].height;
|
|
||||||
if (mthing->options >> ZSHIFT)
|
|
||||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
z = floor + offset;
|
||||||
z = floor;
|
|
||||||
if (mthing->options >> ZSHIFT)
|
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mthing->options & MTF_OBJECTFLIP) // flip the player!
|
if (mthing->options & MTF_OBJECTFLIP) // flip the player!
|
||||||
{
|
{
|
||||||
|
@ -11623,8 +11553,8 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
||||||
|
|
||||||
if (z < floor)
|
if (z < floor)
|
||||||
z = floor;
|
z = floor;
|
||||||
else if (z > ceiling - mobjinfo[MT_PLAYER].height)
|
else if (z > ceilingspawn)
|
||||||
z = ceiling - mobjinfo[MT_PLAYER].height;
|
z = ceilingspawn;
|
||||||
|
|
||||||
mobj->floorz = floor;
|
mobj->floorz = floor;
|
||||||
mobj->ceilingz = ceiling;
|
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 = (sides[lines[line].sidenum[1]].textureoffset >> FRACBITS)) < 1)
|
||||||
ticcount = 3;
|
ticcount = 3;
|
||||||
|
|
||||||
numdivisions = (mthing->options >> ZSHIFT);
|
numdivisions = mthing->z;
|
||||||
|
|
||||||
if (numdivisions)
|
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);
|
I_Error("MakeViaMapthings: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
|
||||||
vx[i].x = mt->x << FRACBITS;
|
vx[i].x = mt->x << FRACBITS;
|
||||||
vx[i].y = mt->y << FRACBITS;
|
vx[i].y = mt->y << FRACBITS;
|
||||||
if (mt->extrainfo)
|
vx[i].z = mt->z << FRACBITS;
|
||||||
vx[i].z = mt->options << FRACBITS;
|
if (!mt->extrainfo)
|
||||||
else
|
vx[i].z += R_PointInSubsector(vx[i].x, vx[i].y)->sector->floorheight;
|
||||||
vx[i].z = (R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector->floorheight) + ((mt->options >> ZSHIFT) << FRACBITS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReconfigureViaVertexes(ret, vx[0], vx[1], vx[2]);
|
ReconfigureViaVertexes(ret, vx[0], vx[1], vx[2]);
|
||||||
|
|
Loading…
Reference in a new issue