From c8bbfbc8368d6ad036e0c810d4695ca13cc0998f Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Tue, 7 Apr 2026 15:41:56 +0200 Subject: [PATCH] Fix Argorok Peahat camera init race condition Fixes #264 --- src/d/actor/d_a_e_ph.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/d/actor/d_a_e_ph.cpp b/src/d/actor/d_a_e_ph.cpp index dc20cb2361..df22c6cb66 100644 --- a/src/d/actor/d_a_e_ph.cpp +++ b/src/d/actor/d_a_e_ph.cpp @@ -1154,6 +1154,18 @@ int daE_PH_c::create() { int phase_state = dComIfG_resLoad(&mPhase, "E_PH"); if (phase_state == cPhs_COMPLEATE_e) { + +#if TARGET_PC + // Due to our loads being so much faster, peahats can initialize *before* the camera. + // This breaks the peahat used for camera focus during transition to phase 2 of Argorok. + // as it caches incorrect camera parameters in its init. + if (auto cam = dComIfGp_getCamera(0)) { + if (cam->phase_request.mpHandlerTable != nullptr) { + return cPhs_INIT_e; + } + } +#endif + mAction = fopAcM_GetParam(this) & 0xF; if (dComIfGs_isZoneSwitch(2, fopAcM_GetRoomNo(this)) && mAction == 4) { @@ -1256,6 +1268,10 @@ int daE_PH_c::create() { if (mAction == 5) { dCamera_c* camera_p = dCam_getBody(); mCamFovY = camera_p->Fovy(); + if (mCamFovY < 1) { + OSReport("GUH"); + mCamFovY = 10; + } mCamCenter = camera_p->Center(); mCamCenterTarget = mCamCenter;