From 89816f45828f3166f14687abddc6b19e5067b078 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 6 Oct 2022 20:44:52 +0200 Subject: [PATCH] - dumped broken and useless xyrand function. Didn't work, wasn't used anywhere else, so a properly done local inline is preferable. --- source/games/duke/src/actors.cpp | 9 +++++---- source/games/duke/src/funct.h | 5 ----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 32d561688..bc122c122 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -5230,15 +5230,16 @@ void movefta(void) { if (badguy(act)) { - double px = ps[p].opos.X - xyrand(64); - double py = ps[p].opos.Y - xyrand(64); + auto xyrand = []() -> double { return (64 - (krand() & 127)) * maptoworld; }; + double px = ps[p].opos.X - xyrand(); + double py = ps[p].opos.Y - xyrand(); updatesector(DVector3(px, py, 0), &psect); if (psect == nullptr) { continue; } - double sx = act->spr.pos.X - xyrand(64); - double sy = act->spr.pos.Y - xyrand(64); + double sx = act->spr.pos.X - xyrand(); + double sy = act->spr.pos.Y - xyrand(); // The second updatesector call here used px and py again and was redundant as coded. // SFLAG_MOVEFTA_CHECKSEE is set for all actors in Duke. diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index b7b752f62..abf1c48e3 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -251,9 +251,4 @@ inline double zrand(int spread) return r * zmaptoworld; } -inline double xyrand(int mask) -{ - return ((krand() % mask) - (mask << 1) - 1) * maptoworld; -} - END_DUKE_NS