From b0c95f69c53ddc1de1617715ec65720a74c545f0 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 15 Nov 2022 18:45:47 +1100 Subject: [PATCH] - Duke: Wrap calls that get `player_struct::PlayerOldPosition`. --- source/games/duke/src/actors.cpp | 4 ++-- source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/game_misc.cpp | 2 +- source/games/duke/src/player_d.cpp | 2 +- source/games/duke/src/player_r.cpp | 2 +- source/games/duke/src/render.cpp | 2 +- source/games/duke/src/sectors.cpp | 6 +++--- source/games/duke/src/sectors_d.cpp | 2 +- source/games/duke/src/sectors_r.cpp | 2 +- source/games/duke/src/types.h | 4 ++++ 11 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index d62c016dd..e8c9ec963 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -400,7 +400,7 @@ void moveplayers(void) { if (p->newOwner != nullptr) //Looking thru the camera { - act->spr.pos = p->PlayerOldPosition.plusZ(gs.playerheight); + act->spr.pos = p->posoldGet().plusZ(gs.playerheight); act->backupz(); act->spr.angle = p->angle.oang; SetActor(act, act->spr.pos); @@ -4444,7 +4444,7 @@ void movefta(void) { int r1 = krand(); int r2 = krand(); - canseeme = cansee(act->spr.pos.plusZ(-(r2 & 31)), act->sector(), ps[p].PlayerOldPosition.plusZ(-(r1 & 31)), ps[p].cursector); + canseeme = cansee(act->spr.pos.plusZ(-(r2 & 31)), act->sector(), ps[p].posoldGet().plusZ(-(r1 & 31)), ps[p].cursector); } diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 1dbe73562..c8ae17304 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -165,7 +165,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi auto pp = &ps[h->PlayerIndex()]; if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner()) { - t->pos = interpolatedvalue(pp->PlayerOldPosition, pp->posGet(), interpfrac).plusZ(gs.playerheight); + t->pos = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).plusZ(gs.playerheight); } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) { diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 51ebfbabf..4d3dd5764 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -144,7 +144,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi auto pp = &ps[h->PlayerIndex()]; if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner()) { - t->pos = interpolatedvalue(pp->PlayerOldPosition, pp->posGet(), interpfrac).plusZ(gs.playerheight); + t->pos = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).plusZ(gs.playerheight); h->spr.scale = DVector2(0.375, 0.265625); } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index fe2c97439..506fa986f 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -271,7 +271,7 @@ void drawoverlays(double interpfrac) } else { - cposxy = interpolatedvalue(pp->PlayerOldPosition, pp->posGet(), interpfrac).XY(); + cposxy = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).XY(); cang = !SyncInput() ? pp->angle.ang : interpolatedvalue(pp->angle.oang, pp->angle.ang, interpfrac); } } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 665be39af..48b9eadb7 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2860,7 +2860,7 @@ void processinput_d(int snum) checklook(snum,actions); double iif = 2.5; - auto oldpos = p->PlayerOldPosition; + auto oldpos = p->posoldGet(); if (p->on_crane != nullptr) goto HORIZONLY; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 3d55f9da7..481fbdedd 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3525,7 +3525,7 @@ void processinput_r(int snum) checklook(snum, actions); p->apply_seasick(1); - auto oldpos = p->PlayerOldPosition; + auto oldpos = p->posoldGet(); if (p->on_crane != nullptr) goto HORIZONLY; diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index eef8a9905..574588528 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -290,7 +290,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) } else { - cpos = interpolatedvalue(p->PlayerOldPosition, p->posGet(), interpfrac); + cpos = interpolatedvalue(p->posoldGet(), p->posGet(), interpfrac); if (SyncInput()) { diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 739cbfe70..bbff190aa 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -226,7 +226,7 @@ int findplayer(const DDukeActor* actor, double* d) if (ud.multimode < 2) { - if (d) *d = (ps[myconnectindex].PlayerOldPosition - s).plusZ(28).Sum(); + if (d) *d = (ps[myconnectindex].posoldGet() - s).plusZ(28).Sum(); return myconnectindex; } @@ -235,7 +235,7 @@ int findplayer(const DDukeActor* actor, double* d) for (j = connecthead; j >= 0; j = connectpoint2[j]) { - double x = (ps[j].PlayerOldPosition - s).plusZ(28).Sum(); + double x = (ps[j].posoldGet() - s).plusZ(28).Sum(); if (x < closest && ps[j].GetActor()->spr.extra > 0) { closest_player = j; @@ -263,7 +263,7 @@ int findotherplayer(int p, double* d) for (j = connecthead; j >= 0; j = connectpoint2[j]) if (p != j && ps[j].GetActor()->spr.extra > 0) { - double x = (ps[j].PlayerOldPosition - ps[p].posGet()).Sum(); + double x = (ps[j].posoldGet() - ps[p].posGet()).Sum(); if (x < closest) { diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 3e2757e20..813171c19 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1516,7 +1516,7 @@ void checksectors_d(int snum) return; } if (p->newOwner != nullptr) - neartag(p->PlayerOldPosition, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); + neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); else { neartag(p->posGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index f237bab63..2dc04f075 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2466,7 +2466,7 @@ void checksectors_r(int snum) } if (p->newOwner != nullptr) - neartag(p->PlayerOldPosition, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); + neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); else { neartag(p->posGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag); diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 378b98e07..9cc820676 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -427,6 +427,10 @@ struct player_struct { PlayerOldPosition += val; } + DVector3 posoldGet() + { + return PlayerOldPosition; + } }; struct Cycler