2019-09-15 16:23:33 +00:00
|
|
|
; void pascal near explosions_small_update_and_render(void);
|
|
|
|
public EXPLOSIONS_SMALL_UPDATE_AND_RENDER
|
2019-03-02 22:23:38 +00:00
|
|
|
explosions_small_update_and_render proc near
|
|
|
|
|
|
|
|
@@angle = byte ptr -7
|
|
|
|
@@i = word ptr -6
|
|
|
|
@@draw_y = word ptr -4
|
|
|
|
@@draw_x = word ptr -2
|
|
|
|
|
|
|
|
enter 8, 0
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
mov ax, GRAM_400
|
|
|
|
mov es, ax
|
|
|
|
assume es:nothing
|
2019-09-15 16:23:33 +00:00
|
|
|
call grcg_setmode_rmw_1
|
2019-03-02 22:23:38 +00:00
|
|
|
mov si, offset _explosions_small
|
|
|
|
mov [bp+@@i], 0
|
|
|
|
jmp @@more_explosions?
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@explosion_loop:
|
|
|
|
cmp [si+explosion_t.flag], 0
|
|
|
|
jz @@next_explosion
|
|
|
|
xor di, di
|
|
|
|
mov [bp+@@angle], 0
|
|
|
|
jmp short @@more_sprites?
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@sprite_loop:
|
|
|
|
push [si+explosion_t.center.x]
|
|
|
|
push [si+explosion_t.EXPLOSION_radius_cur.x]
|
|
|
|
mov al, [bp+@@angle]
|
|
|
|
mov ah, 0
|
|
|
|
add ax, ax
|
|
|
|
mov bx, ax
|
|
|
|
push _CosTable8[bx]
|
|
|
|
call vector1_at
|
|
|
|
mov [bp+@@draw_x], ax
|
|
|
|
push [si+explosion_t.center.y]
|
|
|
|
push [si+explosion_t.EXPLOSION_radius_cur.y]
|
|
|
|
mov al, [si+explosion_t.angle_offset]
|
|
|
|
add al, [bp+@@angle]
|
|
|
|
mov ah, 0
|
|
|
|
add ax, ax
|
|
|
|
mov bx, ax
|
|
|
|
push _SinTable8[bx]
|
|
|
|
call vector1_at
|
|
|
|
mov [bp+@@draw_y], ax
|
|
|
|
sar ax, 4
|
|
|
|
add ax, PLAYFIELD_Y - (EXPLOSION_SMALL_H / 2)
|
|
|
|
mov dx, ax
|
|
|
|
mov ax, [bp+@@draw_x]
|
|
|
|
sar ax, 4
|
|
|
|
add ax, PLAYFIELD_X - (EXPLOSION_SMALL_W / 2)
|
|
|
|
cmp ax, PLAYFIELD_X - EXPLOSION_SMALL_W
|
|
|
|
jbe short @@next_sprite
|
|
|
|
cmp ax, PLAYFIELD_X + PLAYFIELD_W
|
|
|
|
jnb short @@next_sprite
|
|
|
|
or dx, dx
|
|
|
|
jbe short @@next_sprite
|
|
|
|
cmp dx, PLAYFIELD_Y + PLAYFIELD_H
|
|
|
|
jnb short @@next_sprite
|
[Maintenance] [th04/th05] Improve the z_super_roll_put*() naming convention
So, master.lib has:
• super_put_tiny() for tiny-format 16×n sprites
• super_roll_put_tiny() for vertically wrapped tiny-format 16×16
sprites
• super_put_tiny_small() for tiny-format 8×n sprites
• yet *no* super_roll_put_tiny_small() function
And now we have ZUN adding micro-optimized versions of:
1) vertically-wrapped tiny-format 16×16, clearly based on master.lib's
super_roll_put_tiny(), RE'd in 35f9bd7
2) vertically-wrapped tiny-format 32×32
3) vertically-wrapped non-tiny monochrome 16×16 (TH05 only)
Conclusion: Even though 1) does duplicate a master.lib function, trying
to continue following master.lib's inconsistent naming convention only
leads to more confusion here. master.lib also already designates the _8
suffix to mean "x will be byte-aligned, ⌊x/8⌋*8"…
So let's:
• spell out both coordinates of the sprite size directly in the
function
• keep the z_ prefix to encode ZUN's optimized calling convention
(left/top coordinates in registers, ES already set to the beginning
of a VRAM plane, GRCG already on) for all of these, not just 1).
• and prefix the actual functions with _raw, since C land will want
to handle the coordinate parameter registers in a macro.
Part of P0073, funded by [Anonymous] and -Tom-.
2020-02-06 21:45:59 +00:00
|
|
|
call z_super_roll_put_tiny_16x16_raw pascal, EXPLOSION_SMALL_PATNUM
|
2019-03-02 22:23:38 +00:00
|
|
|
|
|
|
|
@@next_sprite:
|
|
|
|
inc di
|
|
|
|
mov al, [bp+@@angle]
|
|
|
|
add al, (256 / EXPLOSION_SMALL_SPRITES)
|
|
|
|
mov [bp+@@angle], al
|
|
|
|
|
|
|
|
@@more_sprites?:
|
|
|
|
cmp di, EXPLOSION_SMALL_SPRITES
|
|
|
|
jl short @@sprite_loop
|
|
|
|
mov ax, [si+explosion_t.EXPLOSION_radius_delta.x]
|
|
|
|
add [si+explosion_t.EXPLOSION_radius_cur.x], ax
|
|
|
|
mov ax, [si+explosion_t.EXPLOSION_radius_delta.y]
|
|
|
|
add [si+explosion_t.EXPLOSION_radius_cur.y], ax
|
|
|
|
inc [si+explosion_t.age]
|
|
|
|
cmp [si+explosion_t.age], EXPLOSION_AGE_MAX
|
|
|
|
jb short @@next_explosion
|
|
|
|
mov [si+explosion_t.flag], 0
|
|
|
|
|
|
|
|
@@next_explosion:
|
|
|
|
inc [bp+@@i]
|
|
|
|
add si, size explosion_t
|
|
|
|
|
|
|
|
@@more_explosions?:
|
|
|
|
cmp [bp+@@i], 2
|
|
|
|
jl @@explosion_loop
|
|
|
|
GRCG_OFF_CLOBBERING dx
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
leave
|
|
|
|
retn
|
|
|
|
explosions_small_update_and_render endp
|