Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions soh/soh/Enhancements/Graphics/DisableFixedCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ static const std::set<SceneID> fixedCameraSceneList = {
SCENE_KAKARIKO_CENTER_GUEST_HOUSE,
SCENE_CARPENTERS_TENT,
SCENE_GRAVEKEEPERS_HUT,
SCENE_KOKIRI_SHOP,
SCENE_GORON_SHOP,
SCENE_ZORA_SHOP,
SCENE_POTION_SHOP_KAKARIKO,
SCENE_POTION_SHOP_MARKET,
SCENE_BOMBCHU_SHOP,
SCENE_HAPPY_MASK_SHOP,
SCENE_BAZAAR,
};

static int16_t sSetNormalCam = -1;
Expand All @@ -51,6 +59,8 @@ static s16 sStoreLastCamType = -1;
static bool sWasEnabled = false;
static bool sWaitForSceneChange = false;

static Camera sShopCamera;

extern "C" void DisableFixedCamera_CheckCameraState(PlayState* play);

struct CamDataBackup {
Expand All @@ -69,6 +79,7 @@ static void DisableFixedCamera_ResetState() {
sStoreLastCamType = -1;
sWasEnabled = false;
sWaitForSceneChange = false;
sShopCamera = {};
}

static void DisableFixedCamera_RestoreAllCameraData() {
Expand Down Expand Up @@ -178,6 +189,7 @@ extern "C" void DisableFixedCamera_CheckCameraState(PlayState* play) {
// Only compute player state if we're in a relevant scene
const bool isInFixedCameraScene = fixedCameraSceneList.contains(static_cast<SceneID>(play->sceneNum));
if (!isInFixedCameraScene) {
sShopCamera = {};
bool sceneChanged = play->sceneNum != sSetNormalCam;
if (sceneChanged) {
sSetNormalCam = play->sceneNum;
Expand All @@ -190,6 +202,14 @@ extern "C" void DisableFixedCamera_CheckCameraState(PlayState* play) {
return;
}

Camera& camera = play->mainCamera;
if (camera.setting == CAM_SET_NORMAL0 && camera.prevSetting == CAM_SET_PIVOT_SHOP_BROWSING &&
sShopCamera.play != nullptr) {
camera = sShopCamera;
} else if (camera.setting == CAM_SET_NORMAL0) {
sShopCamera = camera;
}

bool sceneChanged = play->sceneNum != sSetNormalCam;
bool itemCamChanged = false;

Expand Down
Loading