[Decompilation] [th01] Elis: Move compiler-generated data to C land

Featuring the most disgusting alignment workaround yet.

Part of P0193, funded by Ember2528.
This commit is contained in:
nmlgc 2022-05-07 16:30:24 +02:00
parent 772c1730fd
commit 6beb197ec2
2 changed files with 10 additions and 29 deletions

View File

@ -22,8 +22,9 @@ extern "C" {
}
#include "th01/shiftjis/fns.hpp"
#undef MISSILE_FN
#define MISSILE_FN boss3_m_ptn_1
extern const char MISSILE_FN[];
// Stuffing float constants at the end of a string to work around alignment
// limitations… how disgusting.
#define MISSILE_FN "boss3_m.ptn\x00\x00\x00\xC8\x43\x00\x00\x20\x44\x9A\x99\x99\x99\x99\x99\xA9\x3F"
#include "th01/sprites/pellet.h"
#include "th01/main/shape.hpp"
#include "th01/main/particle.hpp"
@ -59,15 +60,6 @@ extern bool16 invincible;
extern bool16 wave_teleport_done;
extern bool initial_hp_rendered;
// File names
// ----------
extern const char boss5_bos[];
extern const char boss5_2_bos[];
extern const char boss5_3_bos[];
extern const char boss5_gr_grc[];
// ----------
extern union {
int unknown;
} pattern_state;
@ -90,9 +82,9 @@ enum still_or_wave_cel_t {
#define ent_bat boss_entities[2]
inline void elis_ent_load(void) {
ent_still_or_wave.load(boss5_bos, 0);
ent_attack.load(boss5_2_bos, 1);
ent_bat.load(boss5_3_bos, 2);
ent_still_or_wave.load("boss5.bos", 0);
ent_attack.load("boss5_2.bos", 1);
ent_bat.load("boss5_3.bos", 2);
}
inline void elis_ent_free(void) {
@ -161,7 +153,7 @@ void elis_load(void)
pellet_interlace = true;
Pellets.unknown_seven = 7;
elis_ent_load();
grc_load(GRC_SLOT_BOSS_1, boss5_gr_grc);
grc_load(GRC_SLOT_BOSS_1, "boss5_gr.grc");
ptn_new(PTN_SLOT_BG_ENT, ((GIRL_W / PTN_W) * (GIRL_H / PTN_H)));
Missiles.load(PTN_SLOT_MISSILE);
boss_palette_snap();

View File

@ -17598,7 +17598,7 @@ loc_255FB:
fild [bp+var_12]
fstp [bp+var_8]
fwait
fld flt_35D8D
fld dword ptr ds:[13EDh]
fstp [bp+var_10]
push 25 or (4 shl 16) ; (moveout_at_age) or (w shl 16)
push 7 ; col
@ -17633,7 +17633,7 @@ loc_255FB:
cmp word_3A6E5, 0
jnz short loc_2567E
fld [bp+var_8]
fcomp flt_35D91
fcomp dword ptr ds:[13F1h]
fstsw [bp+var_12]
fwait
mov ax, [bp+var_12]
@ -17931,7 +17931,7 @@ loc_25977:
mov ah, 0
mov [bp+var_6], ax
fild [bp+var_6]
fadd qword ptr dbl_35D95
fadd qword ptr ds:[13F5h]
call ftol@
push ax ; angle_end
push word ptr angle_3A6FB ; angle_start
@ -22997,17 +22997,6 @@ word_35D4A dw 0
word_35D4C dw 0
public _elis_invincibility_flash_colors
_elis_invincibility_flash_colors db 3, 6, 8, 2
public _boss5_bos, _boss5_2_bos, _boss5_3_bos, _boss5_gr_grc, _boss3_m_ptn_1
_boss5_bos db 'boss5.bos',0
_boss5_2_bos db 'boss5_2.bos',0
_boss5_3_bos db 'boss5_3.bos',0
_boss5_gr_grc db 'boss5_gr.grc',0
_boss3_m_ptn_1 db 'boss3_m.ptn',0
flt_35D8D dd 400.0
flt_35D91 dd 640.0
; Hack. Let's better use bytes for accuracy here.
dbl_35D95 db 09ah, 099h, 099h, 099h, 099h, 099h, 0a9h, 03fh
db 0
extern _game_cleared:byte
extern _unused_boss_stage_flag:word
extern _pellet_interlace:byte