[Decompilation] [th01] Elis: Initial variables

Part of P0166, funded by Ember2528.
This commit is contained in:
nmlgc 2021-10-30 22:26:08 +02:00
parent 1b1e926cc7
commit e0ecc6bdc0
2 changed files with 44 additions and 53 deletions

View File

@ -19,12 +19,15 @@ extern "C" {
}
#include "th01/main/shape.hpp"
#include "th01/main/boss/boss.hpp"
#include "th01/main/hud/hp.hpp"
// Coordinates
// -----------
static const pixel_t GIRL_W = 128;
static const pixel_t GIRL_H = 96;
static const pixel_t BAT_W = 48;
static const pixel_t BAT_H = 32;
static const pixel_t BASE_LEFT = (PLAYFIELD_CENTER_X - (GIRL_W / 2));
static const pixel_t BASE_TOP = (
@ -92,6 +95,45 @@ 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_setup(void)
{
int col;
int comp;
ent_still_or_wave.pos_set(
BASE_LEFT, BASE_TOP, 48,
PLAYFIELD_LEFT, (PLAYFIELD_RIGHT + ((GIRL_W / 4) * 3)),
PLAYFIELD_TOP, (PLAYFIELD_BOTTOM - GIRL_H)
);
ent_attack.pos_set(
BASE_LEFT, BASE_TOP, 48,
PLAYFIELD_LEFT, (PLAYFIELD_RIGHT + ((GIRL_W / 4) * 3)),
PLAYFIELD_TOP, (PLAYFIELD_BOTTOM - GIRL_H)
);
ent_bat.pos_set(
BASE_LEFT, BASE_TOP, 48,
PLAYFIELD_LEFT, (PLAYFIELD_RIGHT + (BAT_W * 2)),
PLAYFIELD_TOP, (PLAYFIELD_BOTTOM - (BAT_H * 3))
);
ent_still_or_wave.hitbox_set(
((GIRL_W / 4) * 1), ((GIRL_H / 8) * 1),
((GIRL_W / 4) * 3), ((GIRL_H / 3) * 2)
);
// Note that [ent_attack] doesn't receive a hitbox!
ent_bat.hitbox_set(
((BAT_W / 6) * 1), ((BAT_H / 4) * 1),
((BAT_W / 6) * 5), ((BAT_H / 4) * 3)
);
boss_phase = 0;
boss_phase_frame = 0;
boss_hp = 14;
hud_hp_first_white = 10;
hud_hp_first_redwhite = 6;
random_seed = frame_rand;
palette_set_grayscale(boss_post_defeat_palette, 0x0, col, comp);
}
void elis_free(void)
{
ent_free();

View File

@ -18588,65 +18588,14 @@ _elis_load proc far
call _ptn_load stdcall, PTN_SLOT_MISSILE, offset aBoss3_m_ptn_1, ds ; "boss3_m.ptn"
mov _Missiles.MISSILE_ptn_id_base, (PTN_SLOT_MISSILE * PTN_IMAGES_PER_SLOT)
call @boss_palette_snap$qv
nopcall sub_24FE0
nopcall @elis_setup$qv
call @particles_unput_update_render$q17particle_origin_ti stdcall, large PO_INITIALIZE or (V_WHITE shl 16)
add sp, 32h
pop bp
retf
_elis_load endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_24FE0 proc far
push bp
mov bp, sp
push si
push di
call @CBossEntity@pos_set$qiiiiiii stdcall, offset elis_still_or_wave, ds, 256, large 96 or (48 shl 16), large 0 or (736 shl 16), large 64 or (304 shl 16)
call @CBossEntity@pos_set$qiiiiiii stdcall, offset elis_attack, ds, 256, large 96 or (48 shl 16), large 0 or (736 shl 16), large 64 or (304 shl 16)
add sp, 24h
call @CBossEntity@pos_set$qiiiiiii c, offset elis_bat, ds, 256, large 96 or (48 shl 16), large 0 or (736 shl 16), large 64 or (304 shl 16)
CBossEntity__hitbox_set elis_still_or_wave, 32, 12, 96, 64
CBossEntity__hitbox_set elis_bat, 8, 8, 40, 24
mov _boss_phase, 0
mov _boss_phase_frame, 0
mov _boss_hp, 14
mov _hud_hp_first_white, 10
mov _hud_hp_first_redwhite, 6
mov eax, _frame_rand
mov random_seed, eax
xor si, si
jmp short loc_250B3
; ---------------------------------------------------------------------------
loc_2509E:
xor di, di
jmp short loc_250AD
; ---------------------------------------------------------------------------
loc_250A2:
mov bx, si
imul bx, size rgb_t
mov byte ptr _boss_post_defeat_palette[bx+di], 0
inc di
loc_250AD:
cmp di, size rgb_t
jl short loc_250A2
inc si
loc_250B3:
cmp si, COLOR_COUNT
jl short loc_2509E
pop di
pop si
pop bp
retf
sub_24FE0 endp
extern @elis_setup$qv:proc
extern @elis_free$qv:proc
extern @wave_teleport$qii:proc
extern @elis_select_for_rank$qmiiiii:proc