Fix issue where skipping clock tower cutscene would not return you correctly (#618)

This commit is contained in:
Garrett Cox
2024-05-30 23:21:18 -05:00
committed by GitHub
parent 877d7f732b
commit 57d4e62ed0
3 changed files with 27 additions and 7 deletions
@@ -5,18 +5,34 @@ extern "C" {
#include "z64.h"
void Flags_SetWeekEventReg(s32 flag);
extern SaveContext gSaveContext;
extern PlayState* gPlayState;
}
void RegisterSkipClockTowerOpen() {
// This will handle skipping if you are around the Clock Town area, but not directly in south clock town
REGISTER_VB_SHOULD(GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE, {
if (CVarGetInteger("gEnhancements.Cutscenes.SkipStoryCutscenes", 0)) {
*should = false;
}
});
// This will handle skipping if you are directly in South Clock Town
REGISTER_VB_SHOULD(GI_VB_PLAY_TRANSITION_CS, {
// Cutscene where clock tower opens. Will only show if the player is in Clock Town
if (gSaveContext.save.entrance == ENTRANCE(SOUTH_CLOCK_TOWN, 0) && gSaveContext.save.cutsceneIndex == 0xFFF1 &&
if ((gSaveContext.save.entrance == ENTRANCE(SOUTH_CLOCK_TOWN, 0) ||
gSaveContext.save.entrance == ENTRANCE(TERMINA_FIELD, 0)) &&
gSaveContext.save.cutsceneIndex == 0xFFF1 &&
CVarGetInteger("gEnhancements.Cutscenes.SkipStoryCutscenes", 0)) {
// Setting the respawn flag to 2 will respawn the player where they were before the cutscene, consistent
// with the normal behavior
gSaveContext.respawnFlag = 2;
gSaveContext.save.cutsceneIndex = 0;
// Copied from ObjTokeidai_TowerOpening_EndCutscene
SET_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED);
gSaveContext.save.cutsceneIndex = 0;
gSaveContext.respawnFlag = 2;
gSaveContext.save.entrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance;
if (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams ==
PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE)) {
gSaveContext.nextTransitionType = TRANS_TYPE_CIRCLE;
} else {
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
}
});
}
@@ -51,6 +51,7 @@ typedef enum {
GI_VB_TATL_INTERUPT_MSG6,
GI_VB_ITEM_BE_RESTRICTED,
GI_VB_FLIP_HOP_VARIABLE,
GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE,
} GIVanillaBehavior;
typedef enum {
@@ -8,6 +8,7 @@
#include "z64horse.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_100000)
@@ -443,7 +444,9 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
if (CURRENT_DAY == 3) {
if ((this->nextBellTime == CLOCK_TIME(0, 0)) &&
((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) ||
(GameInteractor_Should(GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE,
gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE,
this) ||
(play->sceneId == SCENE_CLOCKTOWER))) {
s32 playerParams;
u32 entrance = gSaveContext.save.entrance;