From f992ec92212dc2ffccad33bc198bc87c1367ddfb Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 2 Oct 2023 20:39:03 +1100 Subject: [PATCH] - Duke: Clean up player/actor accesses in `handle_se00()`. --- source/games/duke/src/actors.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 07f9bae7b..2ee886e60 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1629,20 +1629,20 @@ void handle_se00(DDukeActor* actor) if (direction && (sect->floorstat & CSTAT_SECTOR_ALIGN)) { - int p; - for (p = connecthead; p >= 0; p = connectpoint2[p]) + for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - if (getPlayer(p)->cursector == actor->sector() && getPlayer(p)->on_ground == 1) + const auto p = getPlayer(i); + + if (p->cursector == actor->sector() && p->on_ground == 1) { - getPlayer(p)->GetActor()->spr.Angles.Yaw += ang_amount * direction; + const auto pact = p->GetActor(); - getPlayer(p)->GetActor()->spr.pos.Z += zchange; + pact->spr.Angles.Yaw += ang_amount * direction; + pact->spr.pos.Z += zchange; - auto result = rotatepoint(Owner->spr.pos, getPlayer(p)->GetActor()->spr.pos.XY(), ang_amount * direction); - - getPlayer(p)->bobpos += (result - getPlayer(p)->GetActor()->spr.pos.XY()); - - getPlayer(p)->GetActor()->spr.pos.XY() = result; + auto result = rotatepoint(Owner->spr.pos, pact->spr.pos.XY(), ang_amount * direction); + p->bobpos += (result - pact->spr.pos.XY()); + pact->spr.pos.XY() = result; } } DukeSectIterator itp(actor->sector());