From a78d976352c8d7f67864005874704c5287af0ec2 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 15 Nov 2022 19:27:07 +1100 Subject: [PATCH] - Duke: Remove `player_struct::backupxyz()` in lieu of actor variant. --- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 4 ++-- source/games/duke/src/ccmds.cpp | 2 +- source/games/duke/src/gameexec.cpp | 2 +- source/games/duke/src/player_d.cpp | 2 +- source/games/duke/src/player_r.cpp | 2 +- source/games/duke/src/premap.cpp | 2 +- source/games/duke/src/savegame.cpp | 2 +- source/games/duke/src/types.h | 5 ----- source/games/duke/src/vmexports.cpp | 2 +- 10 files changed, 10 insertions(+), 15 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 3ceec1382..96db826e6 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1346,7 +1346,7 @@ void movetransports_d(void) } ps[p].posSet(Owner->spr.pos.plusZ(-gs.playerheight)); - ps[p].backupxyz(); + ps[p].GetActor()->backuppos(); ps[p].setbobpos(); ChangeActorSect(act2, Owner->sector()); diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 01882e5ec..d89ffedb0 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1234,7 +1234,7 @@ void movetransports_r(void) } ps[p].posSet(Owner->spr.pos.plusZ(-gs.playerheight + 4)); - ps[p].backupxyz(); + ps[p].GetActor()->backuppos(); ps[p].setbobpos(); ChangeActorSect(act2, Owner->sector()); @@ -2050,7 +2050,7 @@ void rr_specialstats() { ps[p].angle.ang = act2->spr.angle; ps[p].posSet(act2->spr.pos.plusZ(-36)); - ps[p].backupxyz(); + ps[p].GetActor()->backuppos(); ps[p].setbobpos(); auto pact = ps[p].GetActor(); ChangeActorSect(pact, act2->sector()); diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 255ecca63..656fff52e 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -116,7 +116,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang) player_struct* p = &ps[myconnectindex]; p->posSet(DVector3(x, y, z)); - p->backupxyz(); + p->GetActor()->backuppos(); if (ang != DAngle::fromDeg(INT_MIN)) { diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index f587cbdf8..71db86191 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2231,7 +2231,7 @@ int ParseState::parse(void) // I am not convinced this is even remotely smart to be executed from here.. pickrandomspot(g_p); g_ac->spr.pos = ps[g_p].posGet(); - ps[g_p].backupxyz(); + ps[g_p].GetActor()->backuppos(); ps[g_p].setbobpos(); g_ac->backuppos(); updatesector(ps[g_p].posGet(), &ps[g_p].cursector); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 48b9eadb7..736376887 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -3102,7 +3102,7 @@ HORIZONLY: if (!retry++) { p->posSet(oldpos); - p->backupxyz(); + p->GetActor()->backuppos(); continue; } quickkill(p); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 481fbdedd..d6e69817d 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3889,7 +3889,7 @@ HORIZONLY: if (!retry++) { p->posSet(oldpos); - p->backupxyz(); + p->GetActor()->backuppos(); continue; } quickkill(p); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 71f0a5863..1e1bde2dd 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -70,7 +70,7 @@ void pickrandomspot(int snum) else i = snum; p->GetActor()->spr.pos = po[i].opos; - p->backupxyz(); + p->GetActor()->backuppos(); p->setbobpos(); p->angle.oang = p->angle.ang = po[i].oa; p->setCursector(po[i].os); diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 67da17942..d30d34d10 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -243,7 +243,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, .EndObject(); w.invdisptime = 0; - w.backupxyz(); + w.GetActor()->backuppos(); w.opyoff = w.pyoff; w.backupweapon(); w.sync.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve. diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 768bd21c4..e7295303e 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -330,11 +330,6 @@ struct player_struct return cursector != nullptr; } - void backupxyz() - { - GetActor()->opos = GetActor()->spr.pos; - } - void restorexyz() { GetActor()->spr.pos = GetActor()->opos; diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index 686c63b5f..61bebda32 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -690,7 +690,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, backuppos, dukeplayer_backuppos) void dukeplayer_backupxyz(player_struct* self) { - self->backupxyz(); + self->GetActor()->backuppos(); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, backupxyz, dukeplayer_backupxyz)