diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index ed5dcaaa2..ab656f528 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -582,17 +582,17 @@ struct PLAYER union { vec3_t __int_ppos; - //vec3_t pos; + vec3_t pos; }; union { vec3_t __int_popos; - //vec3_t opos; + vec3_t opos; }; union { vec3_t __int_poldpos; - //vec3_t oldpos; + vec3_t oldpos; }; const vec3_t int_ppos() const { diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index f05d37c63..cc1fa4a71 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -612,7 +612,7 @@ void JS_DrawCameras(PLAYER* pp, int tx, int ty, int tz, double smoothratio) // If player is dead still then update at MoveSkip4 // rate. - if (pp->int_ppos().X == pp->__int_popos.X && pp->int_ppos().Y == pp->__int_popos.Y && pp->int_ppos().Z == pp->__int_popos.Z) + if (pp->pos.X == pp->opos.X && pp->pos.Y == pp->opos.Y && pp->pos.Z == pp->opos.Z) DoCam = true; diff --git a/source/games/sw/src/osdcmds.cpp b/source/games/sw/src/osdcmds.cpp index 721fae91b..3dff06875 100644 --- a/source/games/sw/src/osdcmds.cpp +++ b/source/games/sw/src/osdcmds.cpp @@ -51,7 +51,8 @@ BEGIN_SW_NS void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { Player->set_int_ppos({x,y,z}); - Player->__int_popos = Player->int_ppos(); + + Player->opos = Player->pos; if (ang != INT_MIN) { diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 40a7ab44f..42e1455ad 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1271,14 +1271,18 @@ void DoPlayerTeleportPause(PLAYER* pp) void DoPlayerTeleportToSprite(PLAYER* pp, vec3_t* pos, int ang) { pp->angle.ang = pp->angle.oang = DAngle::fromBuild(ang); - pp->__int_ppos.X = pp->__int_popos.X = pp->__int_poldpos.X = pos->X; - pp->__int_ppos.Y = pp->__int_popos.Y = pp->__int_poldpos.Y = pos->Y; + pp->__int_ppos.X = pos->X; + pp->__int_ppos.Y = pos->Y; - //getzsofslopeptr(actor->sector(), pp->posx, pp->posy, &cz, &fz); + pp->oldpos.XY() = pp->opos.XY() = pp->pos.XY(); + + + //getzsofslopeptr(actor->s + // ector(), pp->posx, pp->posy, &cz, &fz); //pp->posz = pp->oposz = fz - PLAYER_HEIGHT; pp->set_int_ppos_Z(pos->Z - PLAYER_HEIGHT); - pp->__int_popos.Z = pp->int_ppos().Z; + pp->opos.Z = pp->pos.Z; updatesector(pp->int_ppos().X, pp->int_ppos().Y, &pp->cursector); pp->Flags2 |= (PF2_TELEPORTED); @@ -1286,8 +1290,7 @@ void DoPlayerTeleportToSprite(PLAYER* pp, vec3_t* pos, int ang) void DoPlayerTeleportToOffset(PLAYER* pp) { - pp->__int_popos.X = pp->__int_poldpos.X = pp->int_ppos().X; - pp->__int_popos.Y = pp->__int_poldpos.Y = pp->int_ppos().Y; + pp->oldpos.XY() = pp->opos.XY() = pp->pos.XY(); updatesector(pp->int_ppos().X, pp->int_ppos().Y, &pp->cursector); pp->Flags2 |= (PF2_TELEPORTED); @@ -1932,7 +1935,7 @@ void PlayerCheckValidMove(PLAYER* pp) { if (!pp->insector()) { - pp->__int_ppos = pp->__int_poldpos; + pp->pos = pp->oldpos; pp->cursector = pp->lastcursector; } } @@ -1988,7 +1991,7 @@ void DoPlayerMove(PLAYER* pp) DoPlayerTurn(pp, pp->input.avel, 1); } - pp->__int_poldpos = pp->int_ppos(); + pp->oldpos = pp->pos; pp->lastcursector = pp->cursector; if (PLAYER_MOVING(pp) == 0) @@ -2036,7 +2039,7 @@ void DoPlayerMove(PLAYER* pp) auto sect = pp->cursector; if (interpolate_ride) { - pp->__int_popos.XY() = pp->int_ppos().XY(); + pp->opos.XY() = pp->pos.XY(); } pp->add_int_ppos_XY({ pp->vect.X >> 14, pp->vect.Y >> 14 }); updatesector(pp->int_ppos().X, pp->int_ppos().Y, §); @@ -2061,7 +2064,7 @@ void DoPlayerMove(PLAYER* pp) if (interpolate_ride) { - pp->__int_popos.XY() = pp->int_ppos().XY(); + pp->opos.XY() = pp->pos.XY(); } auto save_cstat = actor->spr.cstat; @@ -2090,7 +2093,7 @@ void DoPlayerMove(PLAYER* pp) if (interpolate_ride) { - pp->__int_popos.Z = pp->int_ppos().Z; + pp->opos.Z = pp->pos.Z; pp->angle.backup(); } @@ -3532,7 +3535,7 @@ void PlayerWarpUpdatePos(PLAYER* pp) if (Prediction) return; - pp->__int_popos = pp->int_ppos(); + pp->opos = pp->pos; DoPlayerZrange(pp); UpdatePlayerSprite(pp); } @@ -4035,7 +4038,7 @@ void DoPlayerWarpToUnderwater(PLAYER* pp) pp->set_int_ppos_Z(under_act->sector()->int_ceilingz() + Z(6)); - pp->__int_popos = pp->int_ppos(); + pp->opos = pp->pos; DoPlayerZrange(pp); return; @@ -4105,7 +4108,7 @@ void DoPlayerWarpToSurface(PLAYER* pp) pp->add_int_ppos_Z(-Z(pp->WadeDepth)); - pp->__int_popos = pp->int_ppos(); + pp->opos = pp->pos; return; } @@ -6346,7 +6349,7 @@ void MoveSkipSavePos(void) { pp = Player + pnum; - pp->__int_popos = pp->int_ppos(); + pp->opos = pp->pos; pp->obob_z = pp->bob_z; pp->angle.backup(); pp->horizon.backup(); @@ -6676,7 +6679,7 @@ void InitAllPlayers(void) // Initialize all [MAX_SW_PLAYERS] arrays here! for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++) { - pp->__int_ppos = pp->__int_popos = pfirst->int_ppos(); + pp->pos = pp->opos = pfirst->pos; pp->angle.ang = pp->angle.oang = pfirst->angle.ang; pp->horizon.horiz = pp->horizon.ohoriz = pfirst->horizon.horiz; pp->cursector = pfirst->cursector; @@ -6685,8 +6688,8 @@ void InitAllPlayers(void) //pp->MaxHealth = 100; - pp->__int_poldpos.X = 0; - pp->__int_poldpos.Y = 0; + pp->oldpos.X = 0; + pp->oldpos.Y = 0; pp->climb_ndx = 10; pp->KillerActor = nullptr; pp->Kills = 0; @@ -6824,7 +6827,8 @@ void PlayerSpawnPosition(PLAYER* pp) ASSERT(spawn_sprite != nullptr); - pp->__int_ppos = pp->__int_popos = spawn_sprite->int_pos(); + pp->__int_ppos = spawn_sprite->int_pos(); + pp->opos = pp->pos; pp->angle.ang = pp->angle.oang = spawn_sprite->spr.angle; pp->setcursector(spawn_sprite->sector()); @@ -6833,7 +6837,7 @@ void PlayerSpawnPosition(PLAYER* pp) if (pp->int_ppos().Z > fz - PLAYER_HEIGHT) { pp->set_int_ppos_Z(fz - PLAYER_HEIGHT); - pp->__int_popos.Z = pp->int_ppos().Z; + pp->opos.Z = pp->pos.Z; } } diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index 0ff9ae39a..4da461949 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -436,9 +436,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER* { if (arc.BeginObject(keyname)) { - arc("x", w.__int_ppos.X) - ("y", w.__int_ppos.Y) - ("z", w.__int_ppos.Z) + arc("x", w.pos.X) + ("y", w.pos.Y) + ("z", w.pos.Z) ("lv_sectnum", w.lv_sector) ("lv_x", w.lv.X) ("lv_y", w.lv.Y) @@ -489,9 +489,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER* ("recoil_ndx", w.recoil_ndx) ("recoil_horizoff", w.recoil_horizoff) ("recoil_ohorizoff", w.recoil_ohorizoff) - ("oldposx", w.__int_poldpos.X) - ("oldposy", w.__int_poldpos.Y) - ("oldposz", w.__int_poldpos.Z) + ("oldposx", w.oldpos.X) + ("oldposy", w.oldpos.Y) + ("oldposz", w.oldpos.Z) ("revolvex", w.Revolve.X) ("revolvey", w.Revolve.Y) ("RevolveDeltaAng", w.RevolveDeltaAng) @@ -580,7 +580,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER* } if (arc.isReading()) { - w.__int_popos = w.__int_ppos; + w.opos = w.pos; w.oz_speed = w.z_speed; w.ovect.X = w.vect.X; w.ovect.Y = w.vect.Y; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index b3ffbf45f..2dd11b6fd 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1470,8 +1470,7 @@ void PreMapCombineFloors(void) if (itsect == dasect) { pp->add_int_ppos_XY({ dx, dy }); - pp->__int_popos.X = pp->__int_poldpos.X = pp->__int_ppos.X; - pp->__int_popos.Y = pp->__int_poldpos.Y = pp->__int_ppos.Y; + pp->opos.XY() = pp->oldpos.XY() = pp->pos.XY(); break; } }