diff --git a/th03/main/hitcirc.cpp b/th03/main/hitcirc.cpp index b0e4a6e3..5e586a6b 100644 --- a/th03/main/hitcirc.cpp +++ b/th03/main/hitcirc.cpp @@ -82,3 +82,21 @@ void pascal hitcircles_player_add( p.spawn(pid); hitcircle_set_topleft(p, center_x, center_y, pid); } + +void near hitcircles_update(void) +{ + HitCircle near* p = hitcircles; + int i = 0; + while(i < HITCIRCLE_COUNT) { + if(p->age) { + p->age++; + + // Not off-by-one, since [age] starts at 1. + if(p->age > HITCIRCLE_FRAMES) { + p->age = 0; + } + } + i++; + p++; + } +} diff --git a/th03/main/hitcirc.hpp b/th03/main/hitcirc.hpp index 839de79f..71c451c1 100644 --- a/th03/main/hitcirc.hpp +++ b/th03/main/hitcirc.hpp @@ -11,3 +11,4 @@ void pascal hitcircles_enemy_add( void pascal hitcircles_player_add( subpixel_t center_x, subpixel_t center_y, pid2 pid ); +void near hitcircles_update(void); diff --git a/th03_main.asm b/th03_main.asm index 46f9d83b..f6603bd3 100644 --- a/th03_main.asm +++ b/th03_main.asm @@ -235,7 +235,7 @@ loc_977E: call p2_1FE7C call p2_1F332 call p2_205D2 - call sub_B7E5 + call @hitcircles_update$qv call shots_update mov _pid_current, 0 mov _pid_PID_so_attack, SO_ATTACK_P1 @@ -2580,44 +2580,11 @@ sub_B60A endp extern @HITCIRCLES_ENEMY_ADD$QIII:proc extern @HITCIRCLES_PLAYER_ADD$QIII:proc + @hitcircles_update$qv procdesc near HITCIRC_TEXT ends PLAYER_M_TEXT segment byte public 'CODE' use16 -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_B7E5 proc near - push bp - mov bp, sp - push si - mov si, offset _hitcircles - xor ax, ax - jmp short loc_B803 -; --------------------------------------------------------------------------- - -loc_B7F0: - cmp [si+hitcircle_t.HITCIRCLE_age], 0 - jz short loc_B7FF - inc [si+hitcircle_t.HITCIRCLE_age] - cmp [si+hitcircle_t.HITCIRCLE_age], HITCIRCLE_FRAMES - jbe short loc_B7FF - mov [si+hitcircle_t.HITCIRCLE_age], 0 - -loc_B7FF: - inc ax - add si, size hitcircle_t - -loc_B803: - cmp ax, HITCIRCLE_COUNT - jl short loc_B7F0 - pop si - pop bp - retn -sub_B7E5 endp - - ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame