Skip to content

Commit

Permalink
- SW: Remove last PLAYER::posSet() calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr4077au committed Nov 26, 2022
1 parent a58f36a commit 92ae5fc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
4 changes: 0 additions & 4 deletions source/games/sw/src/game.h
Expand Up @@ -1891,10 +1891,6 @@ struct PLAYER
}


void posSet(const DVector3& val)
{
actor->spr.pos = val.plusZ(-actor->viewzoffset);
}
void posAdd(const DVector2& val)
{
actor->spr.pos += val;
Expand Down
2 changes: 1 addition & 1 deletion source/games/sw/src/misc.h
Expand Up @@ -20,7 +20,7 @@ int32_t CONFIG_ReadSetup(void);

bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp);
DSWActor* Warp(DVector3& pos, sectortype** sect);
DSWActor* WarpPlane(DVector3& pos, sectortype** sect);
DSWActor* WarpPlane(DVector3& pos, sectortype** sect, double testz = DBL_MAX);



Expand Down
18 changes: 3 additions & 15 deletions source/games/sw/src/player.cpp
Expand Up @@ -1402,11 +1402,7 @@ void DoPlayerWarpTeleporter(PLAYER* pp)
TAG 5 to 8 = random match locations
#endif

auto pos = pp->posGet();
act_warp = Warp(pos, &pp->cursector);
pp->posSet(pos);

if (act_warp == nullptr)
if ((act_warp = Warp(ppActor->spr.pos, &pp->cursector)) == nullptr)
{
return;
}
Expand Down Expand Up @@ -2197,11 +2193,7 @@ void DoPlayerMove(PLAYER* pp)
}

// check for warp - probably can remove from CeilingHit
auto pos = pp->posGet();
auto res = WarpPlane(pos, &pp->cursector);
pp->posSet(pos);

if (res)
if (WarpPlane(actor->spr.pos, &pp->cursector, actor->getOffsetZ()))
{
PlayerWarpUpdatePos(pp);
}
Expand Down Expand Up @@ -3405,11 +3397,7 @@ void DoPlayerClimb(PLAYER* pp)
LadderUpdate = true;
}

auto pos = pp->posGet();
auto res = WarpPlane(pos, &pp->cursector);
pp->posSet(pos);

if (res)
if (WarpPlane(pp->actor->spr.pos, &pp->cursector, pp->actor->getOffsetZ()))
{
PlayerWarpUpdatePos(pp);
LadderUpdate = true;
Expand Down
4 changes: 3 additions & 1 deletion source/games/sw/src/warp.cpp
Expand Up @@ -81,10 +81,12 @@ bool WarpPlaneSectorInfo(sectortype* sect, DSWActor** sp_ceiling, DSWActor** sp_
//
//---------------------------------------------------------------------------

DSWActor* WarpPlane(DVector3& pos, sectortype** sect)
DSWActor* WarpPlane(DVector3& pos, sectortype** sect, double testz)
{
DSWActor* sp_floor,* sp_ceiling;

if (testz == DBL_MAX) testz = pos.Z;

if (Prediction)
return nullptr;

Expand Down

0 comments on commit 92ae5fc

Please sign in to comment.