Skip to content

Commit

Permalink
[Decompilation] [th01] SinGyoku: Sprite freeing
Browse files Browse the repository at this point in the history
Part of P0201, funded by Ember2528 and Yanga.
  • Loading branch information
nmlgc committed Jun 24, 2022
1 parent 4779a95 commit 49248f4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
11 changes: 11 additions & 0 deletions th01/main/boss/b05.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions th01/main/boss/boss.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
19 changes: 2 additions & 17 deletions th01_reiiden.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
; ---------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49248f4

Please sign in to comment.