mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-28 20:32:18 -05:00
Much Less OnGameUpdating
This commit is contained in:
parent
9b8835117c
commit
619c579005
@ -728,12 +728,18 @@ void RegisterMirrorModeHandler() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterPatchNoMSHandler() {
|
void UpdateNoMSPatch() {
|
||||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
|
// Condition for patching
|
||||||
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_MASTER_SWORD) &&
|
bool shouldPatch = (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_MASTER &&
|
||||||
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_MASTER &&
|
|
||||||
gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BGS &&
|
gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BGS &&
|
||||||
gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BROKEN)) {
|
gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE &&
|
||||||
|
(gSaveContext.equips.buttonItems[0] != ITEM_FISHING_POLE ||
|
||||||
|
(!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER) &&
|
||||||
|
!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BIGGORON) &&
|
||||||
|
!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE))));
|
||||||
|
|
||||||
|
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_MASTER_SWORD) && shouldPatch) {
|
||||||
|
// Patching if conditions are met
|
||||||
for (int i = 43; i <= 46; i++) {
|
for (int i = 43; i <= 46; i++) {
|
||||||
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str(), i, gsDPNoOp());
|
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str(), i, gsDPNoOp());
|
||||||
@ -750,8 +756,8 @@ void RegisterPatchNoMSHandler() {
|
|||||||
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, "adultNoMSHylianShield2", 71, gsSPEndDisplayList());
|
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, "adultNoMSHylianShield2", 71, gsSPEndDisplayList());
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1", 2, gsSPEndDisplayList());
|
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1", 2, gsSPEndDisplayList());
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathFarDL, "adultNoMasterSword2", 2, gsSPEndDisplayList());
|
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathFarDL, "adultNoMasterSword2", 2, gsSPEndDisplayList());
|
||||||
}
|
} else {
|
||||||
else {
|
// Unpatching if conditions are not met
|
||||||
for (int i = 43; i <= 46; i++) {
|
for (int i = 43; i <= 46; i++) {
|
||||||
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str());
|
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str());
|
||||||
@ -769,6 +775,19 @@ void RegisterPatchNoMSHandler() {
|
|||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1");
|
ResourceMgr_UnpatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1");
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultMasterSwordAndSheathFarDL, "adultNoMasterSword2");
|
ResourceMgr_UnpatchGfxByName(gLinkAdultMasterSwordAndSheathFarDL, "adultNoMasterSword2");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RegisterNoMSPatch() {
|
||||||
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() {
|
||||||
|
static uint16_t lastItemOnB = gSaveContext.equips.buttonItems[0];
|
||||||
|
if (lastItemOnB != gSaveContext.equips.buttonItems[0]) {
|
||||||
|
UpdateNoMSPatch();
|
||||||
|
lastItemOnB = gSaveContext.equips.buttonItems[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneSpawnActors>([]() {
|
||||||
|
UpdateNoMSPatch();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1490,7 +1509,7 @@ void InitMods() {
|
|||||||
RegisterToTMedallions();
|
RegisterToTMedallions();
|
||||||
RegisterRandomizerCompasses();
|
RegisterRandomizerCompasses();
|
||||||
NameTag_RegisterHooks();
|
NameTag_RegisterHooks();
|
||||||
RegisterPatchNoMSHandler();
|
RegisterNoMSPatch();
|
||||||
RegisterFloorSwitchesHook();
|
RegisterFloorSwitchesHook();
|
||||||
RegisterPatchHandHandler();
|
RegisterPatchHandHandler();
|
||||||
RegisterHurtContainerModeHandler();
|
RegisterHurtContainerModeHandler();
|
||||||
|
@ -17,6 +17,7 @@ void UpdateHyperEnemiesState();
|
|||||||
void UpdateHyperBossesState();
|
void UpdateHyperBossesState();
|
||||||
void InitMods();
|
void InitMods();
|
||||||
void UpdatePatchHand();
|
void UpdatePatchHand();
|
||||||
|
void UpdateNoMSPatch();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user