[Decompilation] [th01] Elis: Sprite freeing

Part of P0166, funded by Ember2528.
This commit is contained in:
nmlgc 2021-10-30 21:44:58 +02:00
parent 6217e51efb
commit e9af8c91db
3 changed files with 19 additions and 20 deletions

View File

@ -11,6 +11,7 @@ extern "C" {
#include "th01/hardware/egc.h"
#include "th01/hardware/graph.h"
#include "th01/formats/pf.hpp"
#include "th01/formats/grc.hpp"
#include "th01/formats/ptn.hpp"
#include "th01/main/playfld.hpp"
#include "th01/main/vars.hpp"
@ -67,6 +68,15 @@ inline void ent_attack_sync_with_still_or_wave(void) {
static const main_ptn_slot_t PTN_SLOT_BG_ENT = PTN_SLOT_BOSS_1;
static const main_ptn_slot_t PTN_SLOT_MISSILE = PTN_SLOT_BOSS_2;
static inline void ent_free(void) {
bos_entity_free(0);
bos_entity_free(1);
bos_entity_free(2);
grc_free(GRC_SLOT_BOSS_1);
ptn_free(PTN_SLOT_BG_ENT);
ptn_free(PTN_SLOT_MISSILE);
}
// --------
// TODO: Remove once all functions are part of this translation unit
@ -82,6 +92,11 @@ void girl_bg_put(int unncessary_parameter_that_still_needs_to_be_1_or_2)
;
#define girl_bg_put(v) nopcall_workaround(girl_bg_put, v)
void elis_free(void)
{
ent_free();
}
bool16 wave_teleport(screen_x_t target_left, screen_y_t target_top)
{
ent_attack_sync_with_still_or_wave();

View File

@ -47,6 +47,8 @@ void boss_hit_update_and_render(
// -----------------
// Makai
void elis_free(void);
void sariel_entrance(int8_t unused);
void sariel_load_and_init(void);

View File

@ -2235,7 +2235,7 @@ loc_D508:
; ---------------------------------------------------------------------------
loc_D50F:
call _elis_free
call @elis_free$qv
pop bp
retf
; ---------------------------------------------------------------------------
@ -18647,25 +18647,7 @@ loc_250B3:
retf
sub_24FE0 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public _elis_free
_elis_free proc far
push bp
mov bp, sp
call _bos_entity_free stdcall, 0
call _bos_entity_free stdcall, 1
call _bos_entity_free stdcall, 2
call _grc_free stdcall, 0
call _ptn_free stdcall, PTN_SLOT_BG_ENT
call _ptn_free stdcall, PTN_SLOT_MISSILE
add sp, 0Ch
pop bp
retf
_elis_free endp
extern @elis_free$qv:proc
extern @wave_teleport$qii:proc
extern @elis_select_for_rank$qmiiiii:proc
main_35_TEXT ends