From 6cd11b0a442204791590b475c78b3bb2f0dad1cc Mon Sep 17 00:00:00 2001 From: nmlgc Date: Wed, 26 Aug 2020 23:36:47 +0200 Subject: [PATCH] [Reverse-engineering] [th05] Bullets: Pellet delay cloud render list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Making sure that we don't ever have to iterate over the 8×8 pellet part of the bullet array during rendering… sure, but why not give the same optimization treatment to the 16×16 bullets? Part of P0112, funded by [Anonymous] and Blue Bolt. --- th04/main/bullet/bullet.hpp | 6 ++++++ th05/main/bullet/pellet_r[bss].asm | 4 ++++ th05_main.asm | 21 +++++++++------------ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 th05/main/bullet/pellet_r[bss].asm diff --git a/th04/main/bullet/bullet.hpp b/th04/main/bullet/bullet.hpp index 62d03a61..89e66a0d 100644 --- a/th04/main/bullet/bullet.hpp +++ b/th04/main/bullet/bullet.hpp @@ -132,6 +132,12 @@ union pellet_render_t { } bottom; }; +#if (GAME == 5) + // Separate render list for pellets during their delay cloud stage. + extern int pellet_clouds_render_count; + extern bullet_t near *pellet_clouds_render[PELLET_COUNT]; +#endif + extern int pellets_render_count; extern pellet_render_t pellets_render[PELLET_COUNT]; diff --git a/th05/main/bullet/pellet_r[bss].asm b/th05/main/bullet/pellet_r[bss].asm new file mode 100644 index 00000000..250b7955 --- /dev/null +++ b/th05/main/bullet/pellet_r[bss].asm @@ -0,0 +1,4 @@ +public _pellet_bottom_col, _pellet_clouds_render, _pellet_clouds_render_count +_pellet_bottom_col dw ? +_pellet_clouds_render dw PELLET_COUNT dup(?) +_pellet_clouds_render_count dw ? diff --git a/th05_main.asm b/th05_main.asm index 57714ba1..1852fc0b 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -6970,9 +6970,9 @@ loc_10171: ; --------------------------------------------------------------------------- loc_1018A: - mov bx, word_2CDF8 + mov bx, _pellet_clouds_render_count add bx, bx - mov si, [bx-3D50h] + mov si, _pellet_clouds_render[bx] mov al, [si+bullet_t.spawn_state] mov ah, 0 mov bx, (BSS_CLOUD_FRAMES / BULLET_CLOUD_CELS) @@ -6990,8 +6990,8 @@ loc_1018A: call z_super_roll_put_tiny_16x16_raw pascal, di loc_101BD: - mov ax, word_2CDF8 - dec word_2CDF8 + mov ax, _pellet_clouds_render_count + dec _pellet_clouds_render_count or ax, ax jnz short loc_1018A mov ah, 0Fh @@ -14469,7 +14469,7 @@ var_2 = word ptr -2 push si push di mov [bp+var_2], 0 - mov word_2CDF8, 0 + mov _pellet_clouds_render_count, 0 mov _pellets_render_count, 0 mov si, offset _bullets[(BULLET_COUNT - 1) * size bullet_t] cmp _bullet_clear_trigger, 0 @@ -14608,10 +14608,10 @@ loc_17D36: loc_17D3D: cmp di, BULLET16_COUNT jl loc_17E74 - mov bx, word_2CDF8 + mov bx, _pellet_clouds_render_count add bx, bx - mov [bx-3D50h], si - inc word_2CDF8 + mov _pellet_clouds_render[bx], si + inc _pellet_clouds_render_count jmp loc_17E74 ; --------------------------------------------------------------------------- @@ -28266,10 +28266,7 @@ byte_2C99C db ? include th05/main/lasers_render[bss].asm include th05/main/bullet/curve[bss].asm include th04/main/item/splashes[bss].asm -public _pellet_bottom_col -_pellet_bottom_col dw ? - db 360 dup(?) -word_2CDF8 dw ? +include th05/main/bullet/pellet_r[bss].asm include th04/main/scroll[bss].asm word_2CE02 dw ? word_2CE04 dw ?