From 2327e08acb4f3122ff4e00fab18cb25259483bb7 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 2 Oct 2023 14:22:46 +1100 Subject: [PATCH] - SW: Replace remaining `Player +` pointer arithmetic with array accesses. --- source/games/sw/src/draw.cpp | 2 +- source/games/sw/src/game.cpp | 2 +- source/games/sw/src/ninja.cpp | 2 +- source/games/sw/src/panel.cpp | 4 ++-- source/games/sw/src/player.cpp | 2 +- source/games/sw/src/save.cpp | 6 +++--- source/games/sw/src/sounds.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 954b02513..b0458b886 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1369,7 +1369,7 @@ void drawscreen(SWPlayer* pp, double interpfrac, bool sceneonly) bool GameInterface::GenerateSavePic() { - drawscreen(Player + myconnectindex, 65536, true); + drawscreen(&Player[myconnectindex], 65536, true); return true; } diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index dbebe6ec7..2aef95532 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -720,7 +720,7 @@ void GameInterface::Render() { drawtime.Reset(); drawtime.Clock(); - drawscreen(Player + screenpeek, paused || !cl_interpolate || cl_capfps ? 1. : I_GetTimeFrac(), false); + drawscreen(&Player[screenpeek], paused || !cl_interpolate || cl_capfps ? 1. : I_GetTimeFrac(), false); drawtime.Unclock(); } diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 054f6fee3..659f22f60 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2109,7 +2109,7 @@ void InitAllPlayerSprites(const DVector3& spawnpos, const DAngle startang) TRAVERSE_CONNECT(i) { - InitPlayerSprite(Player + i, spawnpos, startang); + InitPlayerSprite(&Player[i], spawnpos, startang); } } diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 6e079c845..399f4e109 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -7784,7 +7784,7 @@ void UpdatePanel(double interpfrac) TRAVERSE_CONNECT(pnum) { if (pnum == screenpeek) - pDisplaySprites(Player + pnum, interpfrac); + pDisplaySprites(&Player[pnum], interpfrac); } } @@ -7803,7 +7803,7 @@ void PreUpdatePanel(double interpfrac) TRAVERSE_CONNECT(pnum) { if (pnum == screenpeek) - pDisplaySprites(Player + pnum, interpfrac); + pDisplaySprites(&Player[pnum], interpfrac); } DrawBeforeView = false; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index b4984f839..7799212ec 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -5467,7 +5467,7 @@ void DoPlayerDeathMessage(SWPlayer* pp, SWPlayer* killer) } else // I am being killed - if (killer == Player + myconnectindex) + if (killer == &Player[myconnectindex]) { sprintf(ds,"%s",KilledPlayerMessage(pp,killer)); SEND_OK = true; diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index 4e7a15612..77878856a 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -421,7 +421,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SWPlayer*& w, SWPl { int ndx = w ? int(w - Player) : -1; arc(keyname, ndx); - w = ndx == -1 ? nullptr : Player + ndx; + w = ndx == -1 ? nullptr : &Player[ndx]; return arc; } @@ -1162,8 +1162,8 @@ void GameInterface::SerializeGameState(FSerializer& arc) // this is not a new game ShadowWarrior::NewGame = false; - DoPlayerDivePalette(Player + myconnectindex); - DoPlayerNightVisionPalette(Player + myconnectindex); + DoPlayerDivePalette(&Player[myconnectindex]); + DoPlayerNightVisionPalette(&Player[myconnectindex]); InitLevelGlobals(); } } diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 8df44af4e..80575d956 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -199,7 +199,7 @@ void InitAmbient(int num, DSWActor* actor) if (num != -1) // skip message for -1 to allow using it for silencing buggy ambient sound sprites (there is one in SW level 9.) { sprintf(ds, "Invalid or out of range ambient sound number %d\n", num); - PutStringInfo(Player + screenpeek, ds); + PutStringInfo(&Player[screenpeek], ds); } return; }