diff --git a/source/games/exhumed/src/ramses.cpp b/source/games/exhumed/src/ramses.cpp index baf16cd26..45b30000f 100644 --- a/source/games/exhumed/src/ramses.cpp +++ b/source/games/exhumed/src/ramses.cpp @@ -65,9 +65,10 @@ short nTalkTime = 0; void InitSpiritHead() { nPixels = 0; + auto pSpiritSprite = &sprite[nSpiritSprite]; - nSpiritRepeatX = sprite[nSpiritSprite].xrepeat; - nSpiritRepeatY = sprite[nSpiritSprite].yrepeat; + nSpiritRepeatX = pSpiritSprite->xrepeat; + nSpiritRepeatY = pSpiritSprite->yrepeat; tileLoad(kTileRamsesNormal); // Ramses Normal Head @@ -115,16 +116,16 @@ void InitSpiritHead() } - sprite[nSpiritSprite].yrepeat = 140; - sprite[nSpiritSprite].xrepeat = 140; - sprite[nSpiritSprite].picnum = kTileRamsesWorkTile; + pSpiritSprite->yrepeat = 140; + pSpiritSprite->xrepeat = 140; + pSpiritSprite->picnum = kTileRamsesWorkTile; nHeadStage = 0; // work tile is twice as big as the normal head size Worktile = TileFiles.tileCreate(kTileRamsesWorkTile, kSpiritY * 2, kSpiritX * 2); - sprite[nSpiritSprite].cstat &= 0x7FFF; + pSpiritSprite->cstat &= 0x7FFF; nHeadTimeStart = PlayClock; @@ -196,6 +197,7 @@ void CopyHeadToWorkTile(short nTile) void DoSpiritHead() { static short dimSectCount = 0; + auto pSpiritSprite = &sprite[nSpiritSprite]; sPlayerInput[0].actions |= SB_CENTERVIEW; TileFiles.InvalidateTile(kTileRamsesWorkTile); @@ -295,11 +297,11 @@ void DoSpiritHead() case 1: case 2: UpdateSwirlies(); - if (sprite[nSpiritSprite].shade > -127) - sprite[nSpiritSprite].shade--; + if (pSpiritSprite->shade > -127) + pSpiritSprite->shade--; if (--dimSectCount < 0) { - DimSector(sprite[nSpiritSprite].sectnum); + DimSector(pSpiritSprite->sectnum); dimSectCount = 5; } @@ -379,17 +381,17 @@ void DoSpiritHead() if (nHeadStage == 1) { - if (sprite[nSpiritSprite].xrepeat > nSpiritRepeatX) + if (pSpiritSprite->xrepeat > nSpiritRepeatX) { - sprite[nSpiritSprite].xrepeat -= 2; - if (sprite[nSpiritSprite].xrepeat < nSpiritRepeatX) - sprite[nSpiritSprite].xrepeat = (uint8_t)nSpiritRepeatX; + pSpiritSprite->xrepeat -= 2; + if (pSpiritSprite->xrepeat < nSpiritRepeatX) + pSpiritSprite->xrepeat = (uint8_t)nSpiritRepeatX; } - if (sprite[nSpiritSprite].yrepeat > nSpiritRepeatY) + if (pSpiritSprite->yrepeat > nSpiritRepeatY) { - sprite[nSpiritSprite].yrepeat -= 2; - if (sprite[nSpiritSprite].yrepeat < nSpiritRepeatY) - sprite[nSpiritSprite].yrepeat = (uint8_t)nSpiritRepeatY; + pSpiritSprite->yrepeat -= 2; + if (pSpiritSprite->yrepeat < nSpiritRepeatY) + pSpiritSprite->yrepeat = (uint8_t)nSpiritRepeatY; } int nCount = 0; @@ -425,9 +427,9 @@ void DoSpiritHead() if (nCount < (15 * nPixels) / 16) { SoundBigEntrance(); - AddGlow(sprite[nSpiritSprite].sectnum, 20); - AddFlash(sprite[nSpiritSprite].sectnum, sprite[nSpiritSprite].x, sprite[nSpiritSprite].y, - sprite[nSpiritSprite].z, 128); + AddGlow(pSpiritSprite->sectnum, 20); + AddFlash(pSpiritSprite->sectnum, pSpiritSprite->x, pSpiritSprite->y, + pSpiritSprite->z, 128); nHeadStage = 3; TintPalette(255, 255, 255); CopyHeadToWorkTile(kTileRamsesNormal); diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index a449c5991..c863bdd06 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -150,7 +150,8 @@ void BuildSet(short nSprite, int x, int y, int z, short nSector, short nAngle, i void BuildSoul(int nSet) { int nSetSprite = SetList[nSet].nSprite; - int nSprite = insertsprite(sprite[nSetSprite].sectnum, 0); + auto pSetSprite = &sprite[nSetSprite]; + int nSprite = insertsprite(pSetSprite->sectnum, 0); auto pSprite = &sprite[nSprite]; assert(nSprite >= 0 && nSprite < kMaxSprites); @@ -168,8 +169,8 @@ void BuildSoul(int nSet) pSprite->xvel = 0; pSprite->yvel = 0; pSprite->zvel = (-256) - RandomSize(10); - pSprite->x = sprite[nSetSprite].x; - pSprite->y = sprite[nSetSprite].y; + pSprite->x = pSetSprite->x; + pSprite->y = pSetSprite->y; short nSector = pSprite->sectnum; pSprite->z = (RandomSize(8) << 8) + 8192 + sector[nSector].ceilingz - GetSpriteHeight(nSprite); @@ -205,14 +206,15 @@ void AISoul::Tick(RunListEvent* ev) { int nSet = pSprite->hitag; int nSetSprite = SetList[nSet].nSprite; + auto pSetSprite = &sprite[nSetSprite]; pSprite->cstat = 0; pSprite->yrepeat = 1; pSprite->xrepeat = 1; - pSprite->x = sprite[nSetSprite].x; - pSprite->y = sprite[nSetSprite].y; - pSprite->z = sprite[nSetSprite].z - (GetSpriteHeight(nSetSprite) >> 1); - mychangespritesect(nSprite, sprite[nSetSprite].sectnum); + pSprite->x = pSetSprite->x; + pSprite->y = pSetSprite->y; + pSprite->z = pSetSprite->z - (GetSpriteHeight(nSetSprite) >> 1); + mychangespritesect(nSprite, pSetSprite->sectnum); return; } } diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index 56aca35bb..fb46ec3ac 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -121,13 +121,14 @@ void BuildSnake(short nPlayer, short zVal) zVal -= 1280; short nPlayerSprite = PlayerList[nPlayer].nSprite; + auto pPlayerSprite = &sprite[nPlayerSprite]; short nViewSect = nPlayerViewSect[nPlayer]; short nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0); - int x = sprite[nPlayerSprite].x; - int y = sprite[nPlayerSprite].y; - int z = (sprite[nPlayerSprite].z + zVal) - 2560; - short nAngle = sprite[nPlayerSprite].ang; + int x = pPlayerSprite->x; + int y = pPlayerSprite->y; + int z = (pPlayerSprite->z + zVal) - 2560; + short nAngle = pPlayerSprite->ang; short hitsect, hitsprite; int hitx, hity, hitz; @@ -136,7 +137,7 @@ void BuildSnake(short nPlayer, short zVal) vec3_t pos = { x, y, z }; hitdata_t hitData; - hitscan(&pos, sprite[nPlayerSprite].sectnum, bcos(nAngle), bsin(nAngle), 0, &hitData, CLIPMASK1); + hitscan(&pos, pPlayerSprite->sectnum, bcos(nAngle), bsin(nAngle), 0, &hitData, CLIPMASK1); hitx = hitData.pos.x; hity = hitData.pos.y; @@ -199,9 +200,9 @@ void BuildSnake(short nPlayer, short zVal) if (i == 0) { - pSprite->x = sprite[nPlayerSprite].x; - pSprite->y = sprite[nPlayerSprite].y; - pSprite->z = sprite[nPlayerSprite].z + zVal; + pSprite->x = pPlayerSprite->x; + pSprite->y = pPlayerSprite->y; + pSprite->z = pPlayerSprite->z + zVal; pSprite->xrepeat = 32; pSprite->yrepeat = 32; nViewSect = pSprite->sectnum; @@ -222,7 +223,7 @@ void BuildSnake(short nPlayer, short zVal) pSprite->pal = 0; pSprite->xoffset = 0; pSprite->yoffset = 0; - pSprite->ang = sprite[nPlayerSprite].ang; + pSprite->ang = pPlayerSprite->ang; pSprite->xvel = 0; pSprite->yvel = 0; pSprite->zvel = 0;