From 2beeb66a117ade3bc65028ca3a116a3e04acbaa5 Mon Sep 17 00:00:00 2001 From: PhlexPlexico Date: Thu, 11 Jul 2024 12:17:22 -0600 Subject: [PATCH] Fix Koume evaluating to never give pictograph box. (#82) Fix remove models from being rendered in the song of healing models as there was undefined behaviour. Fix possible actor leak in Dm_Char03. --- code/include/rnd/actors/dm_char03.h | 1 + code/source/asm/patches.s | 7 ++----- code/source/rnd/actors/dm_char03.cpp | 5 +++++ code/source/rnd/models.cpp | 7 ++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/code/include/rnd/actors/dm_char03.h b/code/include/rnd/actors/dm_char03.h index 930c887..358a732 100644 --- a/code/include/rnd/actors/dm_char03.h +++ b/code/include/rnd/actors/dm_char03.h @@ -24,6 +24,7 @@ namespace rnd { extern "C" float rDmChar03Scale; void Dm_Char03_Init(game::act::Actor* actor, game::GlobalContext* gctx); void Dm_Char03_Draw(game::act::Actor* actor, game::GlobalContext* gctx); + void Dm_Char03_Destroy(game::act::Actor* actor, game::GlobalContext* gctx); } // namespace rnd #endif \ No newline at end of file diff --git a/code/source/asm/patches.s b/code/source/asm/patches.s index 2534540..eb0e9f6 100644 --- a/code/source/asm/patches.s +++ b/code/source/asm/patches.s @@ -285,17 +285,14 @@ RemoveJimWhenExitingHideout_patch: @ This patch performs the same event check to see if Koume was saved, @ overriding the check to see if woodfall was cleared. This is due @ to the fact you could beat the temple out of logic from saving koume -@ so this removes the temple check, and checks to see if she was saved twice. -@ For more information on the message system, see the following links in MM decomp +@ so this changes to a weekevent reg that is seemingly not used in game +@ and should always evaluate to false. @ https://github.com/zeldaret/mm/blob/6541532abb5c03088ad67748bbb23965c654127e/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c#L21 @ https://github.com/zeldaret/mm/blob/main/include/z64msgevent.h#L354 .section .patch_RemoveWoodfallClearConditionFromBoatHouse .global patch_RemoveWoodfallClearConditionFromBoatHouse patch_RemoveWoodfallClearConditionFromBoatHouse: .byte 0x0C - .byte 0x08 - .byte 0x00 - .byte 0x08 .section .patch_loader .global loader_patch diff --git a/code/source/rnd/actors/dm_char03.cpp b/code/source/rnd/actors/dm_char03.cpp index 14d12f0..3157a00 100644 --- a/code/source/rnd/actors/dm_char03.cpp +++ b/code/source/rnd/actors/dm_char03.cpp @@ -24,4 +24,9 @@ namespace rnd { util::GetPointer(0x41CE70)(actor, gctx); } + void Dm_Char03_Destroy(game::act::Actor* actor, game::GlobalContext* gctx) { + Model_DestroyByActor(actor); + util::GetPointer(0x2043cc)(actor, gctx); + } + } // namespace rnd \ No newline at end of file diff --git a/code/source/rnd/models.cpp b/code/source/rnd/models.cpp index 6309d44..422ef49 100644 --- a/code/source/rnd/models.cpp +++ b/code/source/rnd/models.cpp @@ -297,9 +297,10 @@ namespace rnd { overlayTable[0x12B].info->init_fn = Dm_Char03_Init; overlayTable[0x12B].info->draw_fn = Dm_Char03_Draw; + overlayTable[0x12B].info->deinit_fn = Dm_Char03_Destroy; - overlayTable[0x12D].info->init_fn = DMChar05_Init; - overlayTable[0x12D].info->draw_fn = DMChar05_Draw; - overlayTable[0x12D].info->deinit_fn = DMChar05_Destroy; + // overlayTable[0x12D].info->init_fn = DMChar05_Init; + // overlayTable[0x12D].info->draw_fn = DMChar05_Draw; + // overlayTable[0x12D].info->deinit_fn = DMChar05_Destroy; } } // namespace rnd