From 49248f458cc02b63172a388a2b217391004c45ba Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sat, 18 Jun 2022 00:06:07 +0200 Subject: [PATCH] [Decompilation] [th01] SinGyoku: Sprite freeing Part of P0201, funded by Ember2528 and Yanga. --- th01/main/boss/b05.cpp | 11 +++++++++++ th01/main/boss/boss.hpp | 2 ++ th01_reiiden.asm | 19 ++----------------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/th01/main/boss/b05.cpp b/th01/main/boss/b05.cpp index 90e40f1e..e402c421 100644 --- a/th01/main/boss/b05.cpp +++ b/th01/main/boss/b05.cpp @@ -24,6 +24,12 @@ static const int SPHERE_CELS = 8; boss_entities[0] \ ) +inline void singyoku_ent_free(void) { + bos_entity_free(0); + bos_entity_free(1); + bos_entity_free(2); +} + // And that's how you avoid the entity position synchronization code that // plagues Elis: By simply only using a single set of coordinates. #define ent ent_sphere @@ -53,6 +59,11 @@ extern bool16 invincible; extern int invincibility_frame; extern bool16 initial_hp_rendered; +void singyoku_free(void) +{ + singyoku_ent_free(); +} + // Rotates the sphere by the given [cel_delta]. [interval] could be used to // restrict this function to certain [boss_phase_frame] intervals, but it's // always either 1 or -1 in the original game. diff --git a/th01/main/boss/boss.hpp b/th01/main/boss/boss.hpp index 086136ba..84c4ce37 100644 --- a/th01/main/boss/boss.hpp +++ b/th01/main/boss/boss.hpp @@ -56,6 +56,8 @@ static const pixel_t SINGYOKU_W = 96; // is part of the regular boss defeat translation unit. static const pixel_t SINGYOKU_H = 96; +void singyoku_free(void); + // Makai void elis_load(void); void elis_main(void); diff --git a/th01_reiiden.asm b/th01_reiiden.asm index caae9127..d1a732ca 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -2022,7 +2022,7 @@ sub_D4DD proc far jmp cs:off_D524[bx] loc_D4F3: - call _singyoku_free + call @singyoku_free$qv pop bp retf ; --------------------------------------------------------------------------- @@ -13441,22 +13441,7 @@ sub_22731 proc far retf sub_22731 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame -public _singyoku_free -_singyoku_free proc far - push bp - mov bp, sp - call @bos_entity_free$qi stdcall, 0 - call @bos_entity_free$qi stdcall, 1 - call @bos_entity_free$qi stdcall, 2 - add sp, 6 - pop bp - retf -_singyoku_free endp - + extern @singyoku_free$qv:proc extern @sphere_rotate_and_render$qii:proc extern @singyoku_select_for_rank$qmiiiii:proc main_33_TEXT ends