Merge remote-tracking branch 'origin/rando-mod' into rando-mod

This commit is contained in:
TakaRikka
2026-08-14 18:57:21 -07:00
13 changed files with 247 additions and 65 deletions
+26 -3
View File
@@ -33,6 +33,9 @@
#include "d/d_msg_object.h"
#include "d/d_save.h"
#include "d/d_shop_system.h"
#include "d/d_s_name.h"
#include "f_op/f_op_overlap_mng.h"
#include "m_Do/m_Do_Reset.h"
#include "c/c_damagereaction.h"
DEFINE_HOOK(&dFile_select_c::selectDataNameMove, dFile_select_c__selectDataNameMove);
@@ -56,8 +59,12 @@ DEFINE_HOOK(&dSv_player_item_c::setLineUpItem, dSv_player_item_c__setLineUpItem)
DEFINE_HOOK(&dSv_info_c::onSwitch, dSv_info_c__onSwitch);
/*DEFINE_HOOK_SYMBOL("__Z21dComIfGp_setNextStagePKcsaafjiasii",
void(char const*, s16, s8, s8, f32, u32, int, s8, s16, int, int), setNextStage);*/
#ifdef _MSVC_LANG
#define setNextStage_sig "?dComIfGp_setNextStage@@YAXPEBDFCCMIHCFHH@Z"
#else
#define setNextStage_sig "_Z21dComIfGp_setNextStagePKcsaafjiasii"
#endif
DEFINE_HOOK_SYMBOL(setNextStage_sig, void(char const *, s16, s8, s8, f32, u32, int, s8, s16, int, int), setNextStage);
DEFINE_HOOK_SYMBOL("daObj_Gb_Create", int(fopAc_ac_c*), ObjGb_Create);
@@ -119,6 +126,8 @@ DEFINE_HOOK_SYMBOL("daE_MD_Create", int(fopAc_ac_c*), daE_MD_c__create);
DEFINE_HOOK(&daObjMasterSword_c::executeWait, daObjMasterSword_c__executeWait);
DEFINE_HOOK_SYMBOL("daObjMasterSword_Execute", int(daObjMasterSword_c*), daObjMasterSword_c__execute);
DEFINE_HOOK(&dScnName_c::changeGameScene, dScnName_c__changeGameScene);
namespace randomizer::ui {
dialogSelectModeState g_dialogSelectModeState = SelectReady;
}
@@ -1933,6 +1942,9 @@ HookAction hookPreNpcFOrderEvent(ModContext*, void* args, void* retval, void*) {
u16 i_priority = mods::arg<u16>(args, 4);
// kinda hacky way to check for the state where Bo is trying to talk after getting Iron Boots
if (i_this->eventInfo.getArchiveName() == nullptr) {
return HOOK_CONTINUE;
}
const std::string arcName = i_this->eventInfo.getArchiveName();
if (arcName == "Bou4" && i_priority == 40) {
i_forceSpeak = FALSE;
@@ -2106,6 +2118,12 @@ HookAction hookPreMasterSwordExecute(ModContext*, void* args, void* retval, void
return HOOK_CONTINUE;
}
void hookPost_dScnName_c__changeGameScene(ModContext* ctx, void* args, void* retval, void* userdata) {
if (!mDoRst::isReset() && !fopOvlpM_IsPeek()) {
randomizer::session::registerStartingLocation();
}
}
}
ModResult initialize() {
@@ -2148,7 +2166,7 @@ ModResult initialize() {
ADD_HOOK_PRE(dSv_info_c__onSwitch, hookPreSaveInfoOnSwitch);
//ADD_HOOK_PRE(setNextStage, hookPreSetNextStage);
ADD_HOOK_PRE(setNextStage, hookPreSetNextStage);
ADD_HOOK_PRE(ObjGb_Create, hookPreObjGbCreate);
@@ -2211,6 +2229,8 @@ ModResult initialize() {
ADD_HOOK_REPLACE(daObjMasterSword_c__executeWait, hookReplaceMasterSwordExecuteWait);
ADD_HOOK_PRE(daObjMasterSword_c__execute, hookPreMasterSwordExecute);
ADD_HOOK_POST(dScnName_c__changeGameScene, hookPost_dScnName_c__changeGameScene);
return MOD_OK;
}
@@ -2237,6 +2257,7 @@ ModResult uninstall() {
mods::hook::uninstall<dSv_player_item_c__setLineUpItem>(svc_hook);
mods::hook::uninstall<dSv_info_c__onSwitch>(svc_hook);
mods::hook::uninstall<setNextStage>();
mods::hook::uninstall<ObjGb_Create>(svc_hook);
@@ -2296,6 +2317,8 @@ ModResult uninstall() {
mods::hook::uninstall<daObjMasterSword_c__executeWait>(svc_hook);
mods::hook::uninstall<daObjMasterSword_c__execute>(svc_hook);
mods::hook::uninstall<dScnName_c__changeGameScene>();
return MOD_OK;
}
}