Skip to content

Commit

Permalink
[Decompilation] [th01] Sariel: Shield animation
Browse files Browse the repository at this point in the history
Part of P0175, funded by Ember2528.
  • Loading branch information
nmlgc committed Jan 31, 2022
1 parent a0fe812 commit 5db5df4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 45 deletions.
15 changes: 15 additions & 0 deletions th01/main/boss/b20m.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,18 @@ void pascal near birds_reset_fire_spawn_unput_update_render(
}
}
}

void near shield_render_both(void)
{
enum {
CELS = 4,
FRAMES_PER_CEL = 10,
};
if((boss_phase_frame % FRAMES_PER_CEL) != 0) {
return;
}
int cel = ((boss_phase_frame % (FRAMES_PER_CEL * CELS)) / FRAMES_PER_CEL);
ent_shield.bos_image = cel;
graph_accesspage_func(1); ent_shield.move_lock_and_put_8();
graph_accesspage_func(0); ent_shield.move_lock_and_put_8();
}
9 changes: 9 additions & 0 deletions th01/main/boss/entity_a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class CBossEntity {
pixel_t &h
) const;

void set_image(int image) {
bos_image = image;
}

/// Blitting
/// --------
// All functions with an [image] parameter use that image from [bos_slot],
Expand Down Expand Up @@ -218,6 +222,11 @@ class CBossEntity {
int unused, pixel_t delta_x, pixel_t delta_y, int lock_frames
);

void move_lock_and_put_8(void) {
move_lock_frame = 0;
move_lock_and_put_8(0, 0, 0, 3);
}

void move_lock_and_put_image_8(int image) {
move_lock_frame = 0;
bos_image = image;
Expand Down
50 changes: 5 additions & 45 deletions th01_reiiden.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22435,6 +22435,7 @@ main_36_TEXT segment byte public 'CODE' use16
@SPAWNRAY_UNPUT_AND_PUT$QIIIII procdesc pascal near \
origin:Point, target_x:word, target_y:word, col:word
@BIRDS_RESET_FIRE_SPAWN_UNPUT_UPD$QDDDDC procdesc pascal near
@shield_render_both$qv procdesc near
main_36_TEXT ends

main_36__TEXT segment byte public 'CODE' use16
Expand All @@ -22448,47 +22449,6 @@ sariel_shield equ <boss_entity_0>
sariel_dress equ <boss_anim_0>
sariel_wand equ <boss_anim_1>

; =============== S U B R O U T I N E =======================================

; Attributes: bp-based frame

sub_28EA6 proc near

var_2 = word ptr -2

enter 2, 0
mov ax, _boss_phase_frame
mov bx, 10
cwd
idiv bx
or dx, dx
jnz short locret_28F0F
mov ax, _boss_phase_frame
mov bx, 40
cwd
idiv bx
mov bx, 10
mov ax, dx
cwd
idiv bx
mov [bp+var_2], ax
mov sariel_shield.BE_bos_image, ax
push 1
call _graph_accesspage_func
mov sariel_shield.BE_move_lock_frame, 0
call @CBossEntity@move_lock_and_put_8$qiiii stdcall, offset sariel_shield, ds, large 0, large 0 or (3 shl 16)
push 0
call _graph_accesspage_func
mov sariel_shield.BE_move_lock_frame, 0
call @CBossEntity@move_lock_and_put_8$qiiii stdcall, offset sariel_shield, ds, large 0, large 0 or (3 shl 16)
add sp, 1Ch

locret_28F0F:
leave
retn
sub_28EA6 endp


; =============== S U B R O U T I N E =======================================

; Attributes: bp-based frame
Expand Down Expand Up @@ -27784,7 +27744,7 @@ loc_2C399:
loc_2C3BE:
inc _boss_phase_frame
inc _sariel_invincibility_frame
call sub_28EA6
call @shield_render_both$qv
call sub_28FC5
fldz
sub sp, 8
Expand Down Expand Up @@ -27899,7 +27859,7 @@ loc_2C4D8:
jnz loc_2C594
inc _boss_phase_frame
inc _sariel_invincibility_frame
call sub_28EA6
call @shield_render_both$qv
call sub_28FC5
push 0
call sub_29D8B
Expand Down Expand Up @@ -27996,7 +27956,7 @@ loc_2C5D6:
jnz loc_2C6B0
inc _boss_phase_frame
inc _sariel_invincibility_frame
call sub_28EA6
call @shield_render_both$qv
call sub_28FC5
call sub_2A469
cmp word_35E95, 0
Expand Down Expand Up @@ -28114,7 +28074,7 @@ loc_2C6F2:
jnz loc_2C7F1
inc _boss_phase_frame
inc _sariel_invincibility_frame
call sub_28EA6
call @shield_render_both$qv
call sub_28FC5
push 1
call sub_29D8B
Expand Down

0 comments on commit 5db5df4

Please sign in to comment.