mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-11-19 12:09:15 +01:00
use better names, add better annotations
This commit is contained in:
parent
51efeed0cc
commit
296d45614e
@ -99,20 +99,22 @@ RECOMP_EXPORT void recomp_do_autosave(PlayState* play) {
|
||||
gSaveContext.save.isOwlSave = false;
|
||||
}
|
||||
|
||||
bool owl_saves_delete = true;
|
||||
bool loading_deletes_owl_save = true;
|
||||
|
||||
RECOMP_EXPORT void recomp_set_owl_saves_delete(bool new_val)
|
||||
// @recomp_export void recomp_set_loading_deletes_owl_save(bool new_val): Set whether loading an owl save should also delete it.
|
||||
RECOMP_EXPORT void recomp_set_loading_deletes_owl_save(bool new_val)
|
||||
{
|
||||
owl_saves_delete = new_val;
|
||||
loading_deletes_owl_save = new_val;
|
||||
}
|
||||
|
||||
// @recomp Do not clear the save if the save was an autosave.
|
||||
// @recomp Do not clear the save if the save was an autosave, or if mods have disabled save deletion.
|
||||
RECOMP_PATCH void func_80147314(SramContext* sramCtx, s32 fileNum) {
|
||||
s32 save_type = gSaveContext.save.isOwlSave;
|
||||
gSaveContext.save.isOwlSave = false;
|
||||
|
||||
// @recomp Prevent owl save/autosave deletion if autosaving is enabled.
|
||||
if (!recomp_autosave_enabled() && owl_saves_delete) {
|
||||
// @recomp Prevent owl save/autosave deletion if autosaving is enabled, and...
|
||||
// @recomp_use_export_var Prevent owl save deletion if mods disable it.
|
||||
if (!recomp_autosave_enabled() && loading_deletes_owl_save) {
|
||||
gSaveContext.save.saveInfo.playerData.newf[0] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[1] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[2] = '\0';
|
||||
@ -540,6 +542,7 @@ RECOMP_PATCH void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCt
|
||||
s32 pad1;
|
||||
s32 fileNum;
|
||||
|
||||
// @recomp_event recomp_on_load_save: A save-file was just chosen.
|
||||
recomp_on_load_save(fileSelect, sramCtx);
|
||||
|
||||
if (gSaveContext.flashSaveAvailable) {
|
||||
@ -666,11 +669,13 @@ RECOMP_PATCH void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCt
|
||||
// @recomp Initialize the autosave state tracking.
|
||||
autosave_init();
|
||||
|
||||
// @recomp_event recomp_after_load_save: The save has finished loading.
|
||||
recomp_after_load_save(fileSelect, sramCtx);
|
||||
}
|
||||
|
||||
bool moon_crash_resets_save = true;
|
||||
|
||||
// @recomp_export void recomp_set_moon_crash_resets_save(bool new_val): Set whether a moon crash should revert the player's save data.
|
||||
RECOMP_EXPORT void recomp_set_moon_crash_resets_save(bool new_val)
|
||||
{
|
||||
moon_crash_resets_save = new_val;
|
||||
@ -686,6 +691,7 @@ RECOMP_PATCH void Sram_ResetSaveFromMoonCrash(SramContext* sramCtx) {
|
||||
s32 i;
|
||||
s32 cutsceneIndex = gSaveContext.save.cutsceneIndex;
|
||||
|
||||
// @recomp_event recomp_on_moon_crash: A moon crash has just been triggered.
|
||||
recomp_on_moon_crash(sramCtx);
|
||||
|
||||
if (moon_crash_resets_save)
|
||||
@ -736,26 +742,29 @@ RECOMP_PATCH void Sram_ResetSaveFromMoonCrash(SramContext* sramCtx) {
|
||||
// @recomp Use the slow autosave timer to give the player extra time to respond to the moon crashing to decide if they want to reload their autosave.
|
||||
recomp_reset_autosave_timer_slow();
|
||||
|
||||
// @recomp_event recomp_after_moon_crash: The effects of moon crash have been written.
|
||||
recomp_after_moon_crash(sramCtx);
|
||||
}
|
||||
|
||||
|
||||
bool loading_deletes_owl_save = true;
|
||||
bool owls_save_and_quit = true;
|
||||
|
||||
RECOMP_EXPORT void recomp_set_loading_deletes_owl_save(bool new_val)
|
||||
// @recomp_export void recomp_set_owls_save_and_quit(bool new_val): Set if owls should use their code to save and quit. If false is passed, owl saves now do nothing.
|
||||
RECOMP_EXPORT void recomp_set_owls_save_and_quit(bool new_val)
|
||||
{
|
||||
loading_deletes_owl_save = new_val;
|
||||
owls_save_and_quit = new_val;
|
||||
}
|
||||
|
||||
RECOMP_DECLARE_EVENT(recomp_on_owl_update(ObjWarpstone* this, PlayState* play));
|
||||
RECOMP_DECLARE_EVENT(recomp_on_owl_save(ObjWarpstone* this, PlayState* play));
|
||||
RECOMP_DECLARE_EVENT(recomp_after_owl_save(ObjWarpstone* this, PlayState* play));
|
||||
|
||||
// @recomp If autosave is enabled, skip the part of the owl statue dialog that talks about the file being deleted on load, since it's not true.
|
||||
// @recomp If autosave is enabled or owl save deletion is disabled, skip the part of the owl statue dialog that talks about the file being deleted on load, since it's not true.
|
||||
RECOMP_PATCH void ObjWarpstone_Update(Actor* thisx, PlayState* play) {
|
||||
ObjWarpstone* this = (ObjWarpstone*)thisx;
|
||||
s32 pad;
|
||||
|
||||
// @recomp_event recomp_on_owl_update: Allow mods to handle owl update frames.
|
||||
recomp_on_owl_update(this, play);
|
||||
|
||||
if (this->isTalking) {
|
||||
@ -763,17 +772,23 @@ RECOMP_PATCH void ObjWarpstone_Update(Actor* thisx, PlayState* play) {
|
||||
this->isTalking = false;
|
||||
} else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
|
||||
if (play->msgCtx.choiceIndex != 0) {
|
||||
// @recomp_event recomp_on_owl_save: The player chose to save from an owl statue.
|
||||
recomp_on_owl_save(this, play);
|
||||
|
||||
Audio_PlaySfx_MessageDecide();
|
||||
// @recomp Only use normal owl save if flag is set.
|
||||
if (loading_deletes_owl_save) {
|
||||
|
||||
// @recomp_use_export_var owls_save_and_quit: Only use normal owl save if quit flag is set.
|
||||
if (owls_save_and_quit) {
|
||||
play->msgCtx.msgMode = MSGMODE_OWL_SAVE_0;
|
||||
} else {
|
||||
Message_CloseTextbox(play);
|
||||
}
|
||||
|
||||
play->msgCtx.unk120D6 = 0;
|
||||
play->msgCtx.unk120D4 = 0;
|
||||
gSaveContext.save.owlWarpId = OBJ_WARPSTONE_GET_OWL_WARP_ID(&this->dyna.actor);
|
||||
|
||||
// @recomp_event recomp_after_owl_save: Owl save is finished.
|
||||
recomp_after_owl_save(this, play);
|
||||
} else {
|
||||
Message_CloseTextbox(play);
|
||||
@ -785,7 +800,7 @@ RECOMP_PATCH void ObjWarpstone_Update(Actor* thisx, PlayState* play) {
|
||||
Actor_OfferTalkNearColChkInfoCylinder(&this->dyna.actor, play);
|
||||
}
|
||||
|
||||
// @recomp Skip the text talking about the save being deleted on load, if autosave is enabled.
|
||||
// @recomp_use_export_var loading_deletes_owl_save: Skip the text talking about the save being deleted on load, if autosave is enabled or if owl save deletion is disabled.
|
||||
if (recomp_autosave_enabled() || !loading_deletes_owl_save) {
|
||||
if (this->isTalking && play->msgCtx.currentTextId == 0xC01 && play->msgCtx.msgBufPos == 269) {
|
||||
play->msgCtx.msgBufPos = 530;
|
||||
|
@ -17,6 +17,7 @@ RECOMP_PATCH void Play_Main(GameState* thisx) {
|
||||
static Input* prevInput = NULL;
|
||||
PlayState* this = (PlayState*)thisx;
|
||||
|
||||
// @recomp_event Allow mods to execute code every frame.
|
||||
recomp_on_play_main(this);
|
||||
|
||||
// @recomp
|
||||
@ -38,9 +39,15 @@ RECOMP_PATCH void Play_Main(GameState* thisx) {
|
||||
this->state.gfxCtx = NULL;
|
||||
}
|
||||
camera_pre_play_update(this);
|
||||
|
||||
// @recomp_event Play_Update is about to be called.
|
||||
recomp_on_play_update(this);
|
||||
|
||||
Play_Update(this);
|
||||
|
||||
// @recomp_event Play_Update was called.
|
||||
recomp_after_play_update(this);
|
||||
|
||||
camera_post_play_update(this);
|
||||
analog_cam_post_play_update(this);
|
||||
autosave_post_play_update(this);
|
||||
|
@ -16,6 +16,7 @@ RECOMP_PATCH void Main_Init(void) {
|
||||
OSMesg msg[1];
|
||||
size_t prevSize;
|
||||
|
||||
// @recomp_event Allow mods to initialize themselves once.
|
||||
recomp_on_init();
|
||||
|
||||
osCreateMesgQueue(&mq, msg, ARRAY_COUNT(msg));
|
||||
|
Loading…
Reference in New Issue
Block a user