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,47 +728,66 @@ 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_KNIFE &&
|
||||||
gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BROKEN)) {
|
(gSaveContext.equips.buttonItems[0] != ITEM_FISHING_POLE ||
|
||||||
for (int i = 43; i <= 46; i++) {
|
(!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER) &&
|
||||||
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BIGGORON) &&
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str(), i, gsDPNoOp());
|
!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE))));
|
||||||
}
|
|
||||||
for (int i = 62; i <= 150; i++) {
|
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_MASTER_SWORD) && shouldPatch) {
|
||||||
std::string patchName = "adultNoMS." + std::to_string(2) + "." + std::to_string(i);
|
// Patching if conditions are met
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathNearDL, patchName.c_str(), i, gsDPNoOp());
|
for (int i = 43; i <= 46; i++) {
|
||||||
}
|
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
||||||
for (int i = 61; i <= 118; i++) {
|
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str(), i, gsDPNoOp());
|
||||||
std::string patchName = "adultNoMS." + std::to_string(3) + "." + std::to_string(i);
|
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathFarDL, patchName.c_str(), i, gsDPNoOp());
|
|
||||||
}
|
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "adultNoMSHylianShield1", 75, gsSPEndDisplayList());
|
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, "adultNoMSHylianShield2", 71, gsSPEndDisplayList());
|
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1", 2, gsSPEndDisplayList());
|
|
||||||
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathFarDL, "adultNoMasterSword2", 2, gsSPEndDisplayList());
|
|
||||||
}
|
}
|
||||||
else {
|
for (int i = 62; i <= 150; i++) {
|
||||||
for (int i = 43; i <= 46; i++) {
|
std::string patchName = "adultNoMS." + std::to_string(2) + "." + std::to_string(i);
|
||||||
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
ResourceMgr_PatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathNearDL, patchName.c_str(), i, gsDPNoOp());
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str());
|
|
||||||
}
|
|
||||||
for (int i = 62; i <= 150; i++) {
|
|
||||||
std::string patchName = "adultNoMS." + std::to_string(2) + "." + std::to_string(i);
|
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathNearDL, patchName.c_str());
|
|
||||||
}
|
|
||||||
for (int i = 61; i <= 118; i++) {
|
|
||||||
std::string patchName = "adultNoMS." + std::to_string(3) + "." + std::to_string(i);
|
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathFarDL, patchName.c_str());
|
|
||||||
}
|
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "adultNoMSHylianShield1");
|
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, "adultNoMSHylianShield2");
|
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1");
|
|
||||||
ResourceMgr_UnpatchGfxByName(gLinkAdultMasterSwordAndSheathFarDL, "adultNoMasterSword2");
|
|
||||||
}
|
}
|
||||||
|
for (int i = 61; i <= 118; i++) {
|
||||||
|
std::string patchName = "adultNoMS." + std::to_string(3) + "." + std::to_string(i);
|
||||||
|
ResourceMgr_PatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathFarDL, patchName.c_str(), i, gsDPNoOp());
|
||||||
|
}
|
||||||
|
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "adultNoMSHylianShield1", 75, gsSPEndDisplayList());
|
||||||
|
ResourceMgr_PatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, "adultNoMSHylianShield2", 71, gsSPEndDisplayList());
|
||||||
|
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1", 2, gsSPEndDisplayList());
|
||||||
|
ResourceMgr_PatchGfxByName(gLinkAdultMasterSwordAndSheathFarDL, "adultNoMasterSword2", 2, gsSPEndDisplayList());
|
||||||
|
} else {
|
||||||
|
// Unpatching if conditions are not met
|
||||||
|
for (int i = 43; i <= 46; i++) {
|
||||||
|
std::string patchName = "adultNoMS." + std::to_string(1) + "." + std::to_string(i);
|
||||||
|
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, patchName.c_str());
|
||||||
|
}
|
||||||
|
for (int i = 62; i <= 150; i++) {
|
||||||
|
std::string patchName = "adultNoMS." + std::to_string(2) + "." + std::to_string(i);
|
||||||
|
ResourceMgr_UnpatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathNearDL, patchName.c_str());
|
||||||
|
}
|
||||||
|
for (int i = 61; i <= 118; i++) {
|
||||||
|
std::string patchName = "adultNoMS." + std::to_string(3) + "." + std::to_string(i);
|
||||||
|
ResourceMgr_UnpatchGfxByName(gLinkAdultMirrorShieldSwordAndSheathFarDL, patchName.c_str());
|
||||||
|
}
|
||||||
|
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathNearDL, "adultNoMSHylianShield1");
|
||||||
|
ResourceMgr_UnpatchGfxByName(gLinkAdultHylianShieldSwordAndSheathFarDL, "adultNoMSHylianShield2");
|
||||||
|
ResourceMgr_UnpatchGfxByName(gLinkAdultMasterSwordAndSheathNearDL, "adultNoMasterSword1");
|
||||||
|
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