Fix crashing when creating a new file (#3764)

This commit is contained in:
Pepe20129 2023-12-29 19:36:56 +01:00 committed by GitHub
parent 81ec2805ee
commit 807b00a058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1208,18 +1208,15 @@ void PatchToTMedallions() {
}
}
void RegisterToTMedallionsFromItem() {
void RegisterToTMedallions() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnItemReceive>([](GetItemEntry _unused) {
if (!CVarGetInteger("gToTMedallionsColors", 0) && gPlayState->sceneNum != SCENE_TEMPLE_OF_TIME) {
if (!CVarGetInteger("gToTMedallionsColors", 0) || !gPlayState || gPlayState->sceneNum != SCENE_TEMPLE_OF_TIME) {
return;
}
PatchToTMedallions();
});
}
void RegisterToTMedallionsFromScene() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) {
if (!CVarGetInteger("gToTMedallionsColors", 0) && gPlayState->sceneNum != SCENE_TEMPLE_OF_TIME) {
if (!CVarGetInteger("gToTMedallionsColors", 0) || sceneNum != SCENE_TEMPLE_OF_TIME) {
return;
}
PatchToTMedallions();
@ -1257,7 +1254,6 @@ void InitMods() {
RegisterAltTrapTypes();
RegisterRandomizerSheikSpawn();
RegisterRandomizedEnemySizes();
RegisterToTMedallionsFromItem();
RegisterToTMedallionsFromScene();
RegisterToTMedallions();
NameTag_RegisterHooks();
}