Compare commits

..

2 Commits

Author SHA1 Message Date
danielryb
1cf6554e0e
Merge a05aac8b34 into 07cfe51010 2024-06-18 19:46:00 +02:00
danielryb
a05aac8b34 add better double SoT 2024-06-18 19:45:16 +02:00
12 changed files with 328 additions and 279 deletions

View File

@ -268,7 +268,7 @@
data-checked="analog_camera_invert_mode"
value="InvertNone"
id="analog_camera_inversion_none"
style="nav-up: #analog_cam_enabled; nav-down: #dsot_enabled"
style="nav-up: #analog_cam_enabled;"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_none">None</label>
@ -280,7 +280,7 @@
data-checked="analog_camera_invert_mode"
value="InvertX"
id="analog_camera_inversion_x"
style="nav-up: #analog_cam_disabled; nav-down: #dsot_disabled"
style="nav-up: #analog_cam_disabled;"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_x">Invert X</label>
@ -292,7 +292,7 @@
data-checked="analog_camera_invert_mode"
value="InvertY"
id="analog_camera_inversion_y"
style="nav-up: #analog_cam_disabled; nav-down: #dsot_disabled"
style="nav-up: #analog_cam_disabled;"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_y">Invert Y</label>
@ -304,40 +304,11 @@
data-checked="analog_camera_invert_mode"
value="InvertBoth"
id="analog_camera_inversion_both"
style="nav-up: #analog_cam_disabled; nav-down: #dsot_disabled"
style="nav-up: #analog_cam_disabled;"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_both">Invert Both</label>
</div>
</div>
<!-- better double song of time -->
<div class="config-option" data-event-mouseover="set_cur_config_index(10)">
<label class="config-option__title">Better Double Song of Time</label>
<div class="config-option__list">
<input
type="radio"
data-event-blur="set_cur_config_index(-1)"
data-event-focus="set_cur_config_index(10)"
name="dsot_mode"
data-checked="dsot_mode"
value="On"
id="dsot_enabled"
style="nav-up: #analog_camera_inversion_none"
/>
<label class="config-option__tab-label" for="dsot_enabled">On</label>
<input
type="radio"
data-event-blur="set_cur_config_index(-1)"
data-event-focus="set_cur_config_index(10)"
name="dsot_mode"
data-checked="dsot_mode"
value="Off"
id="dsot_disabled"
style="nav-up: #analog_camera_inversion_x"
/>
<label class="config-option__tab-label" for="dsot_disabled">Off</label>
</div>
</div>
</div>
<!-- Descriptions -->
<div class="config__wrapper">
@ -391,12 +362,6 @@
<p data-if="cur_config_index == 9">
Inverts the camera controls for the analog camera if it's enabled. <b>None</b> is the default.
</p>
<p data-if="cur_config_index == 10">
Enables hour selection for Double Song of Time.
<br/>
<br/>
To select an hour move the left analog stick in horizontal axis.
</p>
</div>
</div>
</form>

View File

@ -79,17 +79,6 @@ namespace zelda64 {
{zelda64::AnalogCamMode::Off, "Off"}
});
enum class DsotMode {
On,
Off,
OptionCount
};
NLOHMANN_JSON_SERIALIZE_ENUM(zelda64::DsotMode, {
{zelda64::DsotMode::On, "On"},
{zelda64::DsotMode::Off, "Off"}
});
AutosaveMode get_autosave_mode();
void set_autosave_mode(AutosaveMode mode);
@ -97,9 +86,6 @@ namespace zelda64 {
void set_analog_cam_mode(AnalogCamMode mode);
void open_quit_game_prompt();
DsotMode get_dsot_mode();
void set_dsot_mode(DsotMode mode);
};
#endif

View File

@ -3,16 +3,7 @@
void dsot_load_day_number_texture(PlayState* play, s32 day);
void dsot_actor_fixes(PlayState* play);
bool dsot_on;
void dsot_determine_enabled(void) {
dsot_on = recomp_dsot_enabled();
}
bool dsot_enabled(void) {
return dsot_on;
}
bool dsot_used = false;
u8 choiceHour;
void dsot_init_hour_selection(PlayState* play) {
@ -108,6 +99,7 @@ void dsot_cancel_hour_selection(PlayState* play) {
void dsot_advance_hour(PlayState* play) {
gSaveContext.save.time = CLOCK_TIME(choiceHour, 0);
gSaveContext.skyboxTime = CURRENT_TIME;
dsot_used = true;
// Instantly enable/disable rain on day 2.
if ((CURRENT_DAY == 2) && (Environment_GetStormState(play) != STORM_STATE_OFF)) {
@ -127,16 +119,14 @@ void dsot_advance_hour(PlayState* play) {
}
// Play music/ambience.
play->envCtx.timeSeqState = TIMESEQ_FADE_DAY_BGM;
if ((CURRENT_TIME >= CLOCK_TIME(18, 0)) || (CURRENT_TIME <= CLOCK_TIME(6,0))) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
play->envCtx.timeSeqState = TIMESEQ_NIGHT_BEGIN_SFX;
} else if (CURRENT_TIME > CLOCK_TIME(17, 10)) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 240);
play->envCtx.timeSeqState = TIMESEQ_NIGHT_BEGIN_SFX;
}
play->envCtx.timeSeqState = TIMESEQ_NIGHT_BEGIN_SFX;
if ((CURRENT_TIME >= CLOCK_TIME(18, 0)) || (CURRENT_TIME <= CLOCK_TIME(6, 0))) {
Audio_PlayAmbience(play->sequenceCtx.ambienceId);
Audio_SetAmbienceChannelIO(AMBIENCE_CHANNEL_CRITTER_0, 1, 1);
@ -158,7 +148,7 @@ void dsot_advance_hour(PlayState* play) {
dsot_actor_fixes(play);
}
// Loads day number texture from week_static for the three-day clock.
// Loads day number texture from week_static for the three-day clock
void dsot_load_day_number_texture(PlayState* play, s32 day) {
s16 i = day - 1;
@ -174,7 +164,7 @@ void dsot_load_day_number_texture(PlayState* play, s32 day) {
void Interface_DrawClock(PlayState* play);
// Wrapper for Interface_DrawClock to display selected hour.
// Wrapper for Interface_DrawClock to display selected hour
void dsot_draw_clock(PlayState* play) {
MessageContext *msgCtx = &play->msgCtx;
@ -215,15 +205,13 @@ void dsot_draw_clock(PlayState* play) {
}
#include "overlays/actors/ovl_En_Test4/z_en_test4.h"
#include "overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.h"
#include "overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h"
#include "overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.h"
void dsot_ObjEnTest4_fix(EnTest4* this, PlayState* play);
void dsot_ObjTokeiStep_fix(ObjTokeiStep* this, PlayState* play);
void dsot_ObjTokeidai_fix(ObjTokeidai* this, PlayState* play);
void dsot_ObjTokeiStep_fix(ObjTokeiStep* this, PlayState* play);
// Calls actor specific fixes.
// Calls actor specific fixes
void dsot_actor_fixes(PlayState* play) {
s32 category;
Actor* actor;
@ -238,70 +226,35 @@ void dsot_actor_fixes(PlayState* play) {
actor = entry->first;
for (actor = entry->first; actor != NULL; actor = actor->next) {
switch(actor->id) {
case ACTOR_EN_TEST4:
dsot_ObjEnTest4_fix(actor, play);
case ACTOR_OBJ_TOKEIDAI:
dsot_ObjTokeidai_fix(actor, play);
break;
case ACTOR_OBJ_TOKEI_STEP:
dsot_ObjTokeiStep_fix(actor, play);
break;
case ACTOR_OBJ_TOKEIDAI:
dsot_ObjTokeidai_fix(actor, play);
break;
}
}
}
}
#define PAST_MIDNIGHT ((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0)) && (CURRENT_TIME > CLOCK_TIME(0, 0)))
// z_obj_en_test_4
void func_80A42198(EnTest4* this); // EnTest4_GetBellTimeOnDay3
void dsot_ObjEnTest4_fix(EnTest4* this, PlayState* play) {
this->prevTime = CURRENT_TIME;
this->prevBellTime = CURRENT_TIME;
// Change daytime to night manually if necessary.
if ((this->daytimeIndex = THREEDAY_DAYTIME_DAY) && (CURRENT_TIME > CLOCK_TIME(18, 0)) || (CURRENT_TIME <= CLOCK_TIME(6, 0))) {
this->daytimeIndex = THREEDAY_DAYTIME_NIGHT;
// Re-spawn the setup actors.
play->numSetupActors = -play->numSetupActors;
}
// Setup next bell time.
if (CURRENT_DAY == 3) {
gSaveContext.save.time--;
func_80A42198(this);
gSaveContext.save.time++;
}
}
// z_obj_tokei_step
void ObjTokeiStep_InitStepsOpen(ObjTokeiStep* this);
void ObjTokeiStep_SetupDoNothingOpen(ObjTokeiStep* this);
void ObjTokeiStep_DrawOpen(Actor* thisx, PlayState* play);
void dsot_ObjTokeiStep_fix(ObjTokeiStep* this, PlayState* play) {
if (PAST_MIDNIGHT) {
// @recomp Manual relocation, TODO remove when the recompiler handles this automatically.
this->dyna.actor.draw = actor_relocate(this, ObjTokeiStep_DrawOpen);
ObjTokeiStep_InitStepsOpen(this);
ObjTokeiStep_SetupDoNothingOpen(this);
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
}
}
// z_obj_tokeidai
#define GET_CURRENT_CLOCK_HOUR(this) ((s32)TIME_TO_HOURS_F((this)->clockTime))
#define GET_CLOCK_FACE_ROTATION(currentClockHour) (TRUNCF_BINANG(currentClockHour * (0x10000 / 24.0f)))
#define GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute) \
(TRUNCF_BINANG(currentClockMinute * (0x10000 * 12.0f / 360)))
s32 ObjTokeidai_GetTargetSunMoonPanelRotation(void);
void ObjTokeidai_SetupClockOrExteriorGear(ObjTokeidai* this);
void ObjTokeidai_Init(Actor* thisx, PlayState* play);
void ObjTokeidai_Draw(Actor* thisx, PlayState* play);
void ObjTokeidai_Clock_Init(ObjTokeidai* this);
void ObjTokeidai_SetupTowerOpening(ObjTokeidai* this);
void ObjTokeidai_DoNothing(ObjTokeidai* this, PlayState* play);
void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx);
void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play);
void ObjTokeidai_ExteriorGear_Draw(Actor* thisx, PlayState* play);
void ObjTokeidai_Clock_Draw(Actor* thisx, PlayState* play);
@ -320,7 +273,7 @@ void dsot_ObjTokeidai_update_clock(ObjTokeidai* this, u16 currentHour, u16 curre
// @recomp Manual relocation, TODO remove when the recompiler handles this automatically.
this->clockTime = CURRENT_TIME;
// Instantly switch to desired hour.
// Instantly switch to desired hour
u16 clockHour = currentHour;
if (currentMinute == 0) {
clockHour--;
@ -334,7 +287,7 @@ void dsot_ObjTokeidai_update_clock(ObjTokeidai* this, u16 currentHour, u16 curre
this->clockFaceAngularVelocity = 0;
this->clockFaceRotationTimer = 0;
// Instantly switch to desired minute.
// Instantly switch to desired minute
u16 clockMinute = currentMinute - 1;
if (clockMinute > 59) {
clockMinute = 59;
@ -352,6 +305,8 @@ void dsot_ObjTokeidai_update_clock(ObjTokeidai* this, u16 currentHour, u16 curre
}
}
#define PAST_MIDNIGHT ((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0)) && (CURRENT_TIME > CLOCK_TIME(0, 0)))
void dsot_ObjTokeidai_fix(ObjTokeidai* this, PlayState* play) {
s32 type = OBJ_TOKEIDAI_TYPE(&this->actor);
u16 currentHour = TIME_TO_HOURS_F(CURRENT_TIME);
@ -401,3 +356,19 @@ void dsot_ObjTokeidai_fix(ObjTokeidai* this, PlayState* play) {
break;
}
}
// z_obj_tokei_step
void ObjTokeiStep_InitStepsOpen(ObjTokeiStep* this);
void ObjTokeiStep_SetupDoNothingOpen(ObjTokeiStep* this);
void ObjTokeiStep_DrawOpen(Actor* thisx, PlayState* play);
void dsot_ObjTokeiStep_fix(ObjTokeiStep* this, PlayState* play) {
if (PAST_MIDNIGHT) {
// @recomp Manual relocation, TODO remove when the recompiler handles this automatically.
this->dyna.actor.draw = actor_relocate(this, ObjTokeiStep_DrawOpen);
ObjTokeiStep_InitStepsOpen(this);
ObjTokeiStep_SetupDoNothingOpen(this);
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
}
}

View File

@ -1,5 +1,201 @@
#include "patches.h"
#define PAST_MIDNIGHT CLOCK_TIME(0, 1)
#include "overlays/actors/ovl_En_Test4/z_en_test4.h"
#include "z64horse.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#define THIS ((EnTest4*)thisx)
static s16 sCsIdList[THREEDAY_DAYTIME_MAX];
void func_80A42AB8(EnTest4* this, PlayState* play); // EnTest4_HandleEvents
void func_80A42F20(EnTest4* this, PlayState* play); // EnTest4_HandleCutscene
static s16 sCurCsId;
void func_800FEAF4(EnvironmentContext* envCtx); // Environment_NewDay
void func_80A41FA4(EnTest4* this, PlayState* play); // EnTest4_HandleDayNightSwap
void func_80A42198(EnTest4* this); // EnTest4_GetBellTimeOnDay3
void func_80A425E4(EnTest4* this, PlayState* play); // EnTest4_GetBellTimeAndShrinkScreenBeforeDay3
// @recomp Patched to perform transitions when Double SoT is used.
/**
* This function checks for two-specific time-based events:
* 1) The day-night transitions
* 2) The play bells sfx event, which contains screen shrinking and the clocktown day 3 midnight cutscene trigger
*/
void func_80A42AB8(EnTest4* this, PlayState* play) { // EnTest4_HandleEvents
static u16 sDayNightTransitionTimes[THREEDAY_DAYTIME_MAX] = {
CLOCK_TIME(6, 0), // THREEDAY_DAYTIME_NIGHT
CLOCK_TIME(18, 0), // THREEDAY_DAYTIME_DAY
};
Player* player = GET_PLAYER(play);
if ((play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (play->numSetupActors <= 0) &&
(play->roomCtx.status == 0) && !Play_IsDebugCamEnabled()) {
u16 transitionTime = sDayNightTransitionTimes[this->daytimeIndex];
s16 curTimeUntilTransition;
s16 prevTimeUntilTransition;
s16 prevTimeUntilBell;
s16 curTimeUntilBell;
curTimeUntilTransition = CURRENT_TIME - transitionTime;
prevTimeUntilTransition = this->prevTime - transitionTime;
prevTimeUntilBell = this->prevBellTime - this->nextBellTime;
curTimeUntilBell = CURRENT_TIME - this->nextBellTime;
extern bool dsot_used;
u8 current_hour = TIME_TO_HOURS_F(CURRENT_TIME);
// @recomp Check for unusual Double SoT time skips.
if (dsot_used) {
if ((this->daytimeIndex == THREEDAY_DAYTIME_DAY) && (CURRENT_TIME < this->prevTime)) {
if (CURRENT_TIME >= CLOCK_TIME(6, 0)) {
transitionTime = sDayNightTransitionTimes[0];
}
curTimeUntilTransition = 0;
}
if ((CURRENT_DAY == 3) && (current_hour == 0)) {
curTimeUntilBell = 0;
this->nextBellTime = CLOCK_TIME(0, 0);
}
}
// When the day-night transition time is passed:
// `curTimeUntilTransition` will be slightly positive (ahead transition time)
// `prevTimeUntilTransition` will be slightly negative (behind transition time)
// Only when the signs are different will this condition pass
if (((curTimeUntilTransition * prevTimeUntilTransition) <= 0)) {
// day-night transition is occuring
gSaveContext.unk_3CA7 = 1;
if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) {
play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON;
}
// @recomp Manual relocation, TODO remove when the recompiler handles this automatically.
s16* sCsIdList_reloc = (s16*)actor_relocate(&this->actor, &sCsIdList);
if (transitionTime != CLOCK_TIME(6, 0)) {
// previously day, turning night
// @recomp Skip night transition cutscene if Double SoT is used.
if ((!dsot_used) || (current_hour == 18)) {
func_80A41FA4(this, play);
} else {
this->daytimeIndex = THREEDAY_DAYTIME_NIGHT;
this->prevTime = CURRENT_TIME;
// Re-spawn the setup actors.
play->numSetupActors = -play->numSetupActors;
}
} else if (transitionTime == CLOCK_TIME(6, 0)) {
// previously night, turning day
if (CURRENT_DAY == 3) {
// Turn day with mooncrash
Interface_StartMoonCrash(play);
Actor_Kill(&this->actor);
SET_EVENTINF(EVENTINF_17);
} else if (((sCsIdList_reloc[this->daytimeIndex] <= CS_ID_NONE) ||
(play->actorCtx.flags & ACTORCTX_FLAG_TELESCOPE_ON)) &&
(CURRENT_DAY != 3)) {
// Turn day without cutscene
func_80A41FA4(this, play);
} else {
// Turn day with DayTelop cutscene
gSaveContext.screenScale = 0.0f;
Play_SetRespawnData(&play->state, RESPAWN_MODE_DOWN, Entrance_CreateFromSpawn(0), player->unk_3CE,
PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC);
func_80169EFC(&play->state);
if (player->stateFlags1 & PLAYER_STATE1_800000) {
EnHorse* rideActor = (EnHorse*)player->rideActor;
if ((rideActor->type == HORSE_TYPE_EPONA) || (rideActor->type == HORSE_TYPE_2)) {
if (CURRENT_DAY < 3) {
gHorseIsMounted = true;
} else {
gHorseIsMounted = false;
}
}
}
gSaveContext.respawnFlag = -4;
SET_EVENTINF(EVENTINF_TRIGGER_DAYTELOP);
Actor_Kill(&this->actor);
}
}
// @recomp Skip night transition cutscene if Double SoT is used.
if ((!dsot_used) || (transitionTime == CLOCK_TIME(6, 0))) {
if ((sCsIdList_reloc[this->daytimeIndex] > CS_ID_NONE) && !(play->actorCtx.flags & ACTORCTX_FLAG_TELESCOPE_ON)) {
player->stateFlags1 |= PLAYER_STATE1_200;
this->prevTime = CURRENT_TIME;
} else {
if (this->daytimeIndex == THREEDAY_DAYTIME_NIGHT) {
this->daytimeIndex = THREEDAY_DAYTIME_DAY;
} else {
this->daytimeIndex = THREEDAY_DAYTIME_NIGHT;
}
gSaveContext.save.time += CLOCK_TIME_MINUTE;
this->prevTime = CURRENT_TIME;
}
return;
}
}
// When the bell sfx time is passed:
// `curTimeUntilBell` will be slightly positive (ahead bell time)
// `prevTimeUntilBell` will be slightly negative (behind bell time)
// Only when the signs are different will this condition pass
if ((curTimeUntilBell * prevTimeUntilBell) <= 0) {
Audio_PlaySfx_BigBells(&this->actor.projectedPos, THREEDAY_GET_BIG_BELLS_SFX_VOLUME_INDEX(&this->actor));
this->prevBellTime = CURRENT_TIME;
if (CURRENT_DAY == 3) {
// @recomp Don't initate cutscene if it's past midnight.
if ((this->nextBellTime == CLOCK_TIME(0, 0)) &&
(CURRENT_TIME < PAST_MIDNIGHT) &&
((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) ||
(play->sceneId == SCENE_CLOCKTOWER))) {
// Initiate Clocktown day 3 midnight festival cutscene
s32 playerParams;
u32 entrance = gSaveContext.save.entrance;
if (play->actorCtx.flags & ACTORCTX_FLAG_TELESCOPE_ON) {
playerParams = PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE);
} else {
playerParams = PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B);
}
Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, entrance, player->unk_3CE, playerParams,
&player->unk_3C0, player->unk_3CC);
if ((play->sceneId == SCENE_TENMON_DAI) || (play->sceneId == SCENE_00KEIKOKU)) {
play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0);
} else {
play->nextEntrance = ENTRANCE(SOUTH_CLOCK_TOWN, 0);
}
gSaveContext.nextCutsceneIndex = 0xFFF1;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_BLACK;
player->stateFlags1 |= PLAYER_STATE1_200;
Actor_Kill(&this->actor);
}
func_80A42198(this);
} else {
func_80A425E4(this, play);
}
}
dsot_used = false;
}
}
u8 func_800FE5D0(struct PlayState* play);
void Environment_UpdateTimeBasedSequence(PlayState* play) {
@ -66,17 +262,19 @@ void Environment_UpdateTimeBasedSequence(PlayState* play) {
}
}
// @recomp Don't play final hours until it's actually past midnight
if ((play->envCtx.timeSeqState != TIMESEQ_REQUEST) && (((void)0, gSaveContext.save.day) == 3) &&
(CURRENT_TIME < CLOCK_TIME(6, 0)) && !func_800FE5D0(play) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(play->transitionMode == TRANS_MODE_OFF) && (play->csCtx.state == CS_STATE_IDLE) &&
((play->sceneId != SCENE_00KEIKOKU) || (((void)0, gSaveContext.sceneLayer) != 1)) &&
(CutsceneManager_GetCurrentCsId() == CS_ID_NONE) &&
(AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS) &&
(AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_SONG_OF_SOARING) &&
(CURRENT_TIME > CLOCK_TIME(0, 0))) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 0);
Audio_PlaySceneSequence(NA_BGM_FINAL_HOURS, 3 - 1);
(AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_SONG_OF_SOARING)) {
// @recomp Don't play final hours until Double SoT finishes.
extern bool dsot_used;
if (!dsot_used) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 0);
Audio_PlaySceneSequence(NA_BGM_FINAL_HOURS, 3 - 1);
}
}
}
@ -338,8 +536,8 @@ void EnTest6_DoubleSoTCutscene(EnTest6* this, PlayState* play) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20);
}
// @recomp Replace DSoT functionality if the option for it is enabled.
if (dsot_enabled() && this->timer == 15) {
// @recomp Advance hour as Double SoT ends.
if (this->timer == 15) {
dsot_advance_hour(play);
}
@ -586,18 +784,7 @@ void EnTest6_SharedSoTCutscene(EnTest6* this, PlayState* play) {
return;
case SOTCS_CUEID_DOUBLE_END:
// @recomp Replace DSoT functionality if the option for it is enabled.
if (!dsot_enabled() && (CURRENT_TIME > CLOCK_TIME(12, 0))) {
Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, ((void)0, gSaveContext.save.entrance),
player->unk_3CE, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0,
player->unk_3CC);
this->drawType = SOTCS_DRAW_TYPE_NONE;
play->transitionTrigger = TRANS_TRIGGER_START;
play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance;
play->transitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.respawnFlag = 2;
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
}
// @recomp Disable scene reset after Double SoT ends.
return;
}
}

View File

@ -452,43 +452,23 @@ void Message_Update(PlayState* play) {
}
} else if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) &&
(play->msgCtx.ocarinaMode == OCARINA_MODE_PROCESS_DOUBLE_TIME)) {
// @recomp Replace DSoT functionality if the option for it is enabled.
if (dsot_enabled()) {
// @recomp
dsot_handle_hour_selection(play);
// @recomp
dsot_handle_hour_selection(play);
if (Message_ShouldAdvance(play)) {
if (msgCtx->choiceIndex == 0) {
Audio_PlaySfx_MessageDecide();
if (Message_ShouldAdvance(play)) {
if (msgCtx->choiceIndex == 0) {
Audio_PlaySfx_MessageDecide();
play->msgCtx.ocarinaMode = OCARINA_MODE_APPLY_DOUBLE_SOT;
gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF;
} else {
Audio_PlaySfx_MessageCancel();
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
play->msgCtx.ocarinaMode = OCARINA_MODE_APPLY_DOUBLE_SOT;
gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF;
} else {
Audio_PlaySfx_MessageCancel();
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
// @recomp
dsot_cancel_hour_selection(play);
}
Message_CloseTextbox(play);
}
} else {
if (Message_ShouldAdvance(play)) {
if (msgCtx->choiceIndex == 0) {
Audio_PlaySfx_MessageDecide();
if (gSaveContext.save.isNight != 0) {
gSaveContext.save.time = CLOCK_TIME(6, 0);
} else {
gSaveContext.save.time = CLOCK_TIME(18, 0);
}
play->msgCtx.ocarinaMode = OCARINA_MODE_APPLY_DOUBLE_SOT;
gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF;
} else {
Audio_PlaySfx_MessageCancel();
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
}
Message_CloseTextbox(play);
// @recomp
dsot_cancel_hour_selection(play);
}
Message_CloseTextbox(play);
}
} else if ((msgCtx->textboxEndType != TEXTBOX_ENDTYPE_10) ||
(pauseCtx->state != PAUSE_STATE_OWL_WARP_CONFIRM)) {
@ -679,66 +659,49 @@ void Message_Update(PlayState* play) {
play->msgCtx.ocarinaMode = OCARINA_MODE_PROCESS_RESTRICTED_SONG;
}
} else if (sLastPlayedSong == OCARINA_SONG_DOUBLE_TIME) {
// @recomp Patch Song of Double Time.
if (interfaceCtx->restrictions.songOfDoubleTime == 0) {
// @recomp
dsot_determine_enabled();
if ((CURRENT_DAY != 3) || (CURRENT_TIME < CLOCK_TIME(5, 0)) || (CURRENT_TIME >= CLOCK_TIME(6, 0))) {
Message_StartTextbox(play, D_801D0464[0], NULL);
// @recomp Replace DSoT functionality if the option for it is enabled.
if (dsot_enabled()) {
if ((CURRENT_DAY != 3) || (CURRENT_TIME < CLOCK_TIME(5, 0)) || (CURRENT_TIME >= CLOCK_TIME(6, 0))) {
Message_StartTextbox(play, D_801D0464[0], NULL);
// @recomp Replace message text.
char *buf = play->msgCtx.font.msgBuf.schar;
buf[25] = ' ';
buf[26] = 1;
buf[27] = 'S';
buf[28] = 'e';
buf[29] = 'l';
buf[30] = 'e';
buf[31] = 'c';
buf[32] = 't';
buf[33] = 'e';
buf[34] = 'd';
buf[35] = ' ';
buf[36] = 'H';
buf[37] = 'o';
buf[38] = 'u';
buf[39] = 'r';
buf[40] = 0;
buf[41] = '?';
buf[42] = 17;
buf[43] = 17;
buf[44] = 2;
buf[45] = -62;
buf[46] = 'Y';
buf[47] = 'e';
buf[48] = 's';
buf[49] = 17;
buf[50] = 'N';
buf[51] = 'o';
buf[52] = -65;
// @recomp Replace message text.
char *buf = play->msgCtx.font.msgBuf.schar;
buf[25] = ' ';
buf[26] = 1;
buf[27] = 'S';
buf[28] = 'e';
buf[29] = 'l';
buf[30] = 'e';
buf[31] = 'c';
buf[32] = 't';
buf[33] = 'e';
buf[34] = 'd';
buf[35] = ' ';
buf[36] = 'H';
buf[37] = 'o';
buf[38] = 'u';
buf[39] = 'r';
buf[40] = 0;
buf[41] = '?';
buf[42] = 17;
buf[43] = 17;
buf[44] = 2;
buf[45] = -62;
buf[46] = 'Y';
buf[47] = 'e';
buf[48] = 's';
buf[49] = 17;
buf[50] = 'N';
buf[51] = 'o';
buf[52] = -65;
play->msgCtx.ocarinaMode = OCARINA_MODE_PROCESS_DOUBLE_TIME;
play->msgCtx.ocarinaMode = OCARINA_MODE_PROCESS_DOUBLE_TIME;
// @recomp
dsot_init_hour_selection(play);
} else {
Message_StartTextbox(play, 0x1B94, NULL);
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
}
// @recomp
dsot_init_hour_selection(play);
} else {
if ((CURRENT_DAY != 3) || (gSaveContext.save.isNight == 0)) {
if (gSaveContext.save.isNight) {
Message_StartTextbox(play, D_801D0464[CURRENT_DAY - 1], NULL);
} else {
Message_StartTextbox(play, D_801D045C[CURRENT_DAY - 1], NULL);
}
play->msgCtx.ocarinaMode = OCARINA_MODE_PROCESS_DOUBLE_TIME;
} else {
Message_StartTextbox(play, 0x1B94, NULL);
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
}
Message_StartTextbox(play, 0x1B94, NULL);
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
}
} else {
sLastPlayedSong = 0xFF;

View File

@ -11,6 +11,5 @@ DECLARE_FUNC(void, recomp_handle_quicksave_actions_main, OSMesgQueue* enter_mq,
DECLARE_FUNC(u16, recomp_get_pending_warp);
DECLARE_FUNC(u32, recomp_get_pending_set_time);
DECLARE_FUNC(s32, recomp_autosave_enabled);
DECLARE_FUNC(s32, recomp_dsot_enabled);
#endif

View File

@ -108,8 +108,6 @@ void draw_autosave_icon(PlayState* play);
void recomp_crash(const char* err);
void dsot_determine_enabled(void);
bool dsot_enabled(void);
void dsot_init_hour_selection(PlayState* play);
void dsot_handle_hour_selection(PlayState* play);
void dsot_cancel_hour_selection(PlayState* play);

View File

@ -60,4 +60,3 @@ recomp_get_inverted_axes = 0x8F0000A4;
recomp_high_precision_fb_enabled = 0x8F0000A8;
recomp_get_resolution_scale = 0x8F0000AC;
recomp_get_analog_inverted_axes = 0x8F0000B0;
recomp_dsot_enabled = 0x8F0000B4;

View File

@ -990,8 +990,8 @@ void Message_DrawTextBox(PlayState* play, Gfx** gfxP) {
gSPPopMatrix(gfx++, G_MTX_MODELVIEW);
}
// @recomp Replace DSoT functionality if the option for it is enabled.
if (dsot_enabled() && (play->msgCtx.ocarinaMode == OCARINA_MODE_PROCESS_DOUBLE_TIME)) {
// @recomp Draw clock for Double SoT.
if (play->msgCtx.ocarinaMode == OCARINA_MODE_PROCESS_DOUBLE_TIME) {
dsot_draw_clock(play);
}

View File

@ -221,7 +221,6 @@ bool save_general_config(const std::filesystem::path& path) {
config_json["analog_cam_mode"] = zelda64::get_analog_cam_mode();
config_json["analog_camera_invert_mode"] = zelda64::get_analog_camera_invert_mode();
config_json["debug_mode"] = zelda64::get_debug_mode_enabled();
config_json["dsot_mode"] = zelda64::get_dsot_mode();
return save_json_with_backups(path, config_json);
}
@ -238,7 +237,6 @@ void set_general_settings_from_json(const nlohmann::json& config_json) {
zelda64::set_analog_cam_mode(from_or_default(config_json, "analog_cam_mode", zelda64::AnalogCamMode::Off));
zelda64::set_analog_camera_invert_mode(from_or_default(config_json, "analog_camera_invert_mode", zelda64::CameraInvertMode::InvertNone));
zelda64::set_debug_mode_enabled(from_or_default(config_json, "debug_mode", false));
zelda64::set_dsot_mode(from_or_default(config_json, "dsot_mode", zelda64::DsotMode::On));
}
bool load_general_config(const std::filesystem::path& path) {

View File

@ -95,10 +95,6 @@ extern "C" void recomp_autosave_enabled(uint8_t* rdram, recomp_context* ctx) {
_return(ctx, static_cast<s32>(zelda64::get_autosave_mode() == zelda64::AutosaveMode::On));
}
extern "C" void recomp_dsot_enabled(uint8_t* rdram, recomp_context* ctx) {
_return(ctx, static_cast<s32>(zelda64::get_dsot_mode() == zelda64::DsotMode::On));
}
extern "C" void recomp_load_overlays(uint8_t * rdram, recomp_context * ctx) {
u32 rom = _arg<0, u32>(rdram, ctx);
PTR(void) ram = _arg<1, PTR(void)>(rdram, ctx);

View File

@ -281,7 +281,6 @@ struct ControlOptionsContext {
zelda64::CameraInvertMode camera_invert_mode;
zelda64::AnalogCamMode analog_cam_mode;
zelda64::CameraInvertMode analog_camera_invert_mode;
zelda64::DsotMode dsot_mode;
};
ControlOptionsContext control_options_context;
@ -402,17 +401,6 @@ void zelda64::set_analog_camera_invert_mode(zelda64::CameraInvertMode mode) {
}
}
zelda64::DsotMode zelda64::get_dsot_mode() {
return control_options_context.dsot_mode;
}
void zelda64::set_dsot_mode(zelda64::DsotMode mode) {
control_options_context.dsot_mode = mode;
if (general_model_handle) {
general_model_handle.DirtyVariable("dsot_mode");
}
}
struct SoundOptionsContext {
std::atomic<int> main_volume; // Option to control the volume of all sound
std::atomic<int> bgm_volume;
@ -915,7 +903,6 @@ public:
bind_option(constructor, "camera_invert_mode", &control_options_context.camera_invert_mode);
bind_option(constructor, "analog_cam_mode", &control_options_context.analog_cam_mode);
bind_option(constructor, "analog_camera_invert_mode", &control_options_context.analog_camera_invert_mode);
bind_option(constructor, "dsot_mode", &control_options_context.dsot_mode);
general_model_handle = constructor.GetModelHandle();
}