Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Scene Specific Checks to Dirt Path Fixes #2907

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions soh/soh/Enhancements/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,24 @@ void RegisterBonkDamage() {
});
}

void UpdateDirtPathFixState(int32_t sceneNum) {
switch (sceneNum) {
case SCENE_SPOT00:
case SCENE_SPOT04:
case SCENE_SPOT15:
CVarSetInteger("gDirtPathFix", CVarGetInteger("gSceneSpecificDirtPathFix", 0));
return;
default:
CVarClear("gDirtPathFix");
}
}

void RegisterMenuPathFix() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnTransitionEnd>([](int32_t sceneNum) {
UpdateDirtPathFixState(sceneNum);
});
}

void InitMods() {
RegisterTTS();
RegisterInfiniteMoney();
Expand All @@ -504,4 +522,5 @@ void InitMods() {
RegisterRupeeDash();
RegisterHyperBosses();
RegisterBonkDamage();
RegisterMenuPathFix();
}
3 changes: 3 additions & 0 deletions soh/soh/Enhancements/mods.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include <stdint.h>

#ifndef MODS_H
#define MODS_H

#ifdef __cplusplus
extern "C" {
#endif

void UpdateDirtPathFixState(int32_t sceneNum);
void InitMods();

#ifdef __cplusplus
Expand Down
7 changes: 6 additions & 1 deletion soh/soh/GameMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "soh/SaveManager.h"
#include "OTRGlobals.h"
#include "soh/Enhancements/presets.h"
#include "soh/Enhancements/mods.h"
#include "soh/resource/type/Skeleton.h"

#ifdef ENABLE_CROWD_CONTROL
Expand All @@ -46,6 +47,8 @@ extern "C" {
void disableBetaQuest() { isBetaQuestEnabled = false; }
}

extern "C" PlayState* gPlayState;

enum SeqPlayers {
/* 0 */ SEQ_BGM_MAIN,
/* 1 */ SEQ_FANFARE,
Expand Down Expand Up @@ -860,7 +863,9 @@ namespace GameMenuBar {
ImGui::EndMenu();
}
UIWidgets::PaddedText("Fix Vanishing Paths", true, false);
UIWidgets::EnhancementCombobox("gDirtPathFix", zFightingOptions, 0);
if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", zFightingOptions, 0) && gPlayState != NULL) {
UpdateDirtPathFixState(gPlayState->sceneNum);
}
UIWidgets::Tooltip("Disabled: Paths vanish more the higher the resolution (Z-fighting is based on resolution)\n"
"Consistent: Certain paths vanish the same way in all resolutions\n"
"No Vanish: Paths do not vanish, Link seems to sink in to some paths\n"
Expand Down