Clear Cutscene Pointer Button/Cheat (#2837)

* clear custcene pointer button

* now use RawAction for button

* add button to new menu bar
This commit is contained in:
inspectredc 2023-10-02 15:28:27 +01:00 committed by GitHub
parent ebfd14974f
commit 82d87ff680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -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()) {

View File

@ -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();
}