From b36c6af6cd6ad165ef0635b1f2cf13f94cf40a71 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 4 Oct 2023 11:21:29 +1100 Subject: [PATCH] - Duke: Clean up player/actor accesses in `moveclouds()`. --- source/games/duke/src/sectors.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 6f757c60b..62b2b33a0 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1544,11 +1544,12 @@ void moveclouds(double interpfrac) int myclock = interpfrac < 0.5 ? PlayClock-2 : PlayClock; if (myclock > cloudclock || myclock < (cloudclock - 7)) { + const auto pact = getPlayer(screenpeek)->GetActor(); cloudclock = myclock + 6; // cloudx/y were an array, but all entries were always having the same value so a single pair is enough. - cloudx += (float)getPlayer(screenpeek)->GetActor()->spr.Angles.Yaw.Cos() * 0.5f; - cloudy += (float)getPlayer(screenpeek)->GetActor()->spr.Angles.Yaw.Sin() * 0.5f; + cloudx += (float)pact->spr.Angles.Yaw.Cos() * 0.5f; + cloudy += (float)pact->spr.Angles.Yaw.Sin() * 0.5f; for (int i = 0; i < numclouds; i++) { // no clamping here!