diff options
| author | inspectredc <78732756+inspectredc@users.noreply.github.com> | 2023-10-02 15:28:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-02 14:28:27 +0000 |
| commit | 82d87ff680d0933c6dbd2fd083b69ac31c92c14e (patch) | |
| tree | 565ed46144c0a0604b714453c651895306968859 | |
| parent | ebfd14974fef83b44a50b38a5ddc20abb66779c1 (diff) | |
Clear Cutscene Pointer Button/Cheat (#2837)
* clear custcene pointer button
* now use RawAction for button
* add button to new menu bar
| -rw-r--r-- | soh/soh/Enhancements/game-interactor/GameInteractor.h | 1 | ||||
| -rw-r--r-- | soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp | 7 | ||||
| -rw-r--r-- | soh/soh/SohMenuBar.cpp | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 04f021983..e49c99d22 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -229,6 +229,7 @@ public: static void EmulateRandomButtonPress(uint32_t chancePercentage = 100); static void SetRandomWind(bool active); static void SetPlayerInvincibility(bool active); + static void ClearCutscenePointer(); static GameInteractionEffectQueryResult SpawnEnemyWithOffset(uint32_t enemyId, int32_t enemyParams); static GameInteractionEffectQueryResult SpawnActor(uint32_t actorId, int32_t actorParams); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index 864eef427..1dedc3fa1 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -542,6 +542,13 @@ void GameInteractor::RawAction::SetPlayerInvincibility(bool active) { } } +/// Clears the cutscene pointer to a value safe for wrong warps. +void GameInteractor::RawAction::ClearCutscenePointer() { + if (!gPlayState) return; + static uint32_t null_cs[] = {0, 0}; + gPlayState->csCtx.segment = &null_cs; +} + GameInteractionEffectQueryResult GameInteractor::RawAction::SpawnEnemyWithOffset(uint32_t enemyId, int32_t enemyParams) { if (!GameInteractor::CanSpawnActor()) { diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index f129e0118..ec663c6b4 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1354,7 +1354,12 @@ void DrawCheatsMenu() { if (ImGui::Button("Change Age")) { CVarSetInteger("gSwitchAge", 1); } - UIWidgets::Tooltip("Switches Link's age and reloads the area."); + UIWidgets::Tooltip("Switches Link's age and reloads the area."); + + if (ImGui::Button("Clear Cutscene Pointer")) { + GameInteractor::RawAction::ClearCutscenePointer(); + } + UIWidgets::Tooltip("Clears the cutscene pointer to a value safe for wrong warps."); ImGui::EndMenu(); } |
