diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 9f7d8b12d..4cdab30c4 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -428,16 +428,18 @@ void GameInterface::Ticker() thinktime.Reset(); thinktime.Clock(); - DBloodPlayer* pPlayer = getPlayer(myconnectindex); + const auto mciPlayer = getPlayer(myconnectindex); + const auto mciActor = mciPlayer->GetActor(); // disable synchronised input if set by game. gameInput.ResetInputSync(); for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - getPlayer(i)->resetCameraAngles(); - viewBackupView(i); - playerProcess(getPlayer(i)); + const auto pPlayer = getPlayer(i); + pPlayer->resetCameraAngles(); + viewBackupView(pPlayer); + playerProcess(pPlayer); } trProcessBusy(); @@ -452,25 +454,25 @@ void GameInterface::Ticker() actortime.Unclock(); viewCorrectPrediction(); - ambProcess(pPlayer); - viewUpdateDelirium(pPlayer); + ambProcess(mciPlayer); + viewUpdateDelirium(mciPlayer); gi->UpdateSounds(); - if (pPlayer->hand == 1) + if (mciPlayer->hand == 1) { - const int CHOKERATE = 8; - const int COUNTRATE = 30; + static constexpr int CHOKERATE = 8; + static constexpr int COUNTRATE = 30; gChokeCounter += CHOKERATE; while (gChokeCounter >= COUNTRATE) { - gChoke.callback(pPlayer); + gChoke.callback(mciPlayer); gChokeCounter -= COUNTRATE; } } thinktime.Unclock(); // update console player's viewzoffset at the end of the tic. - pPlayer->GetActor()->oviewzoffset = pPlayer->GetActor()->viewzoffset; - pPlayer->GetActor()->viewzoffset = pPlayer->zView - pPlayer->GetActor()->spr.pos.Z; + mciActor->oviewzoffset = mciActor->viewzoffset; + mciActor->viewzoffset = mciPlayer->zView - mciActor->spr.pos.Z; gFrameCount++; PlayClock += kTicsPerFrame; diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 045b1dd27..c72f5d5f2 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -716,7 +716,7 @@ void playerResetInertia(DBloodPlayer* pPlayer) pPlayer->zView = pPlayer->GetActor()->spr.pos.Z - pPosture->eyeAboveZ; pPlayer->zWeapon = pPlayer->GetActor()->spr.pos.Z - pPosture->weaponAboveZ; pPlayer->GetActor()->oviewzoffset = pPlayer->GetActor()->viewzoffset = pPlayer->zView - pPlayer->GetActor()->spr.pos.Z; - viewBackupView(pPlayer->pnum); + viewBackupView(pPlayer); } void playerCorrectInertia(DBloodPlayer* pPlayer, const DVector3& oldpos) diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 9efd8c078..72f24ee26 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -56,17 +56,17 @@ int gViewIndex; // //--------------------------------------------------------------------------- -void viewBackupView(int nPlayer) +void viewBackupView(DBloodPlayer* pPlayer) { - DBloodPlayer* pPlayer = getPlayer(nPlayer); + const auto pActor = pPlayer->GetActor(); pPlayer->ozView = pPlayer->zView; pPlayer->ozWeapon = pPlayer->zWeapon - pPlayer->zView - 12; pPlayer->obobHeight = pPlayer->bobHeight; pPlayer->obobWidth = pPlayer->bobWidth; pPlayer->oswayHeight = pPlayer->swayHeight; pPlayer->oswayWidth = pPlayer->swayWidth; - pPlayer->GetActor()->backuploc(); - pPlayer->GetActor()->interpolated = true; + pActor->backuploc(); + pActor->interpolated = true; } //--------------------------------------------------------------------------- diff --git a/source/games/blood/src/view.h b/source/games/blood/src/view.h index d5afbea9b..fe2bc84dc 100644 --- a/source/games/blood/src/view.h +++ b/source/games/blood/src/view.h @@ -77,7 +77,7 @@ void hudDraw(DBloodPlayer* pPlayer, sectortype* pSector, double bobx, double bob void viewInitializePrediction(void); void viewUpdatePrediction(InputPacket* pInput); void viewCorrectPrediction(void); -void viewBackupView(int nPlayer); +void viewBackupView(DBloodPlayer* pPlayer); void InitStatusBar(void); void UpdateStatusBar(DBloodPlayer* pPlayer); void viewInit(void);