From e4343b2c95f1982ea6973f9496b603f08cf4b6fb Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sun, 30 Jan 2022 00:23:27 +0100 Subject: [PATCH] [Maintenance] [th01] Better distinguish boss "entities" from "other sprites" Part of P0174, funded by Ember2528. --- th01/main/boss/b10j.cpp | 20 ++++++++++++-------- th01/main/boss/b10m.cpp | 6 +++--- th01/main/boss/b15j.cpp | 6 +++--- th01/main/boss/b15m.cpp | 16 ++++++++++------ th01/main/boss/b20m.cpp | 8 ++++++-- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/th01/main/boss/b10j.cpp b/th01/main/boss/b10j.cpp index f005f2be..173759cd 100644 --- a/th01/main/boss/b10j.cpp +++ b/th01/main/boss/b10j.cpp @@ -71,19 +71,21 @@ enum anim_cel_t { #define ent_still boss_entities[0] #define ent_anim boss_entities[1] +static inline void ent_free(void) { + bos_entity_free(0); + bos_entity_free(1); +} +// -------- + +// .PTN +// ---- + 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; // Three unused background .PTN IDs, for three unused 32×32 animations? static const int BG_ENT_OFFSET = 3; - -static inline void ent_free(void) { - bos_entity_free(0); - bos_entity_free(1); - ptn_free(PTN_SLOT_BG_ENT); - ptn_free(PTN_SLOT_MISSILE); -} -// -------- +// ---- void mima_load(void) { @@ -309,6 +311,8 @@ void mima_setup(void) void mima_free(void) { ent_free(); + ptn_free(PTN_SLOT_BG_ENT); + ptn_free(PTN_SLOT_MISSILE); } #define select_for_rank mima_select_for_rank diff --git a/th01/main/boss/b10m.cpp b/th01/main/boss/b10m.cpp index bd35381a..06000882 100644 --- a/th01/main/boss/b10m.cpp +++ b/th01/main/boss/b10m.cpp @@ -17,8 +17,8 @@ extern bool16 invincible; extern int invincibility_frame; extern bool initial_hp_rendered; -// Entities -// -------- +// .PTN +// ---- static const main_ptn_slot_t PTN_SLOT_MISSILE = PTN_SLOT_BOSS_1; -// -------- +// ---- diff --git a/th01/main/boss/b15j.cpp b/th01/main/boss/b15j.cpp index 36dee87d..e1e85527 100644 --- a/th01/main/boss/b15j.cpp +++ b/th01/main/boss/b15j.cpp @@ -17,11 +17,11 @@ extern bool16 invincible; extern int invincibility_frame; extern bool initial_hp_rendered; -// Entities (and animations) -// -------- +// .PTN +// ---- static const main_ptn_slot_t PTN_SLOT_WAVE = PTN_SLOT_BOSS_1; -// -------- +// ---- #define select_for_rank kikuri_select_for_rank #include "th01/main/select_r.cpp" diff --git a/th01/main/boss/b15m.cpp b/th01/main/boss/b15m.cpp index 0a3423ea..22ba5a1f 100644 --- a/th01/main/boss/b15m.cpp +++ b/th01/main/boss/b15m.cpp @@ -80,19 +80,20 @@ 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); } // -------- +// .PTN +// ---- + +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; +// ---- + #define bg_func_init(left, top, entity_src) { \ ent_attack_sync_with_still_or_wave(); \ if(entity_src == 1) { \ @@ -197,6 +198,9 @@ void elis_setup(void) void elis_free(void) { ent_free(); + grc_free(GRC_SLOT_BOSS_1); + ptn_free(PTN_SLOT_BG_ENT); + ptn_free(PTN_SLOT_MISSILE); } bool16 wave_teleport(screen_x_t target_left, screen_y_t target_top) diff --git a/th01/main/boss/b20m.cpp b/th01/main/boss/b20m.cpp index 901a273c..39dc2b6d 100644 --- a/th01/main/boss/b20m.cpp +++ b/th01/main/boss/b20m.cpp @@ -57,13 +57,17 @@ extern bool initial_hp_rendered; // Entities (and animations) // -------- -static const main_ptn_slot_t PTN_SLOT_BG_ENT = PTN_SLOT_BOSS_1; - #define ent_shield boss_entities[0] #define anm_dress boss_anims[0] #define anm_wand boss_anims[1] // -------- +// .PTN +// ---- + +static const main_ptn_slot_t PTN_SLOT_BG_ENT = PTN_SLOT_BOSS_1; +// ---- + // File names // ----------