2019-09-23 15:24:45 +00:00
|
|
|
; void pascal near player_render(void);
|
|
|
|
public PLAYER_RENDER
|
|
|
|
player_render proc near
|
|
|
|
@@angle = byte ptr -5
|
|
|
|
@@i = word ptr -4
|
|
|
|
@@screen_y = word ptr -2
|
|
|
|
@@patnum equ si
|
|
|
|
|
|
|
|
enter 6, 0
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
cmp _miss_time, 0
|
|
|
|
jz short @@alive
|
|
|
|
cmp _miss_time, MISS_ANIM_FRAMES
|
|
|
|
jbe @@in_miss_anim
|
|
|
|
|
|
|
|
@@alive:
|
2019-11-15 19:54:33 +00:00
|
|
|
mov ax, _player_pos.cur.x
|
2019-09-23 15:24:45 +00:00
|
|
|
sar ax, 4
|
2020-08-25 18:29:24 +00:00
|
|
|
add ax, PLAYFIELD_LEFT - (PLAYER_W / 2)
|
2019-09-23 15:24:45 +00:00
|
|
|
mov di, ax
|
2019-11-15 19:54:33 +00:00
|
|
|
mov ax, _player_pos.cur.y
|
2020-08-25 18:29:24 +00:00
|
|
|
add ax, ((PLAYFIELD_TOP - (PLAYER_H / 2)) shl 4)
|
2019-09-23 15:24:45 +00:00
|
|
|
call scroll_subpixel_y_to_vram_seg1 pascal, ax
|
|
|
|
mov [bp+@@screen_y], ax
|
2019-11-15 19:54:33 +00:00
|
|
|
cmp _player_pos.velocity.x, 0
|
2019-09-23 15:24:45 +00:00
|
|
|
jge short @@moving_right?
|
|
|
|
mov @@patnum, 1
|
|
|
|
jmp short @@invincible?
|
|
|
|
|
|
|
|
@@moving_right?:
|
2019-11-15 19:54:33 +00:00
|
|
|
cmp _player_pos.velocity.x, 0
|
2019-09-23 15:24:45 +00:00
|
|
|
jz short @@no_x_movement
|
|
|
|
mov @@patnum, 2
|
|
|
|
jmp short @@invincible?
|
|
|
|
|
|
|
|
@@no_x_movement:
|
|
|
|
xor @@patnum, @@patnum
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@invincible?:
|
|
|
|
cmp _player_invincibility_time, 0
|
|
|
|
jz short @@render_regular
|
2019-12-30 20:38:58 +00:00
|
|
|
cmp _stage_frame_mod4, 0
|
2019-09-23 15:24:45 +00:00
|
|
|
jnz short @@render_regular
|
|
|
|
call super_roll_put_1plane pascal, di, [bp+@@screen_y], @@patnum, large PLANE_PUT or GC_BRGI
|
|
|
|
jmp short @@got_options?
|
|
|
|
|
|
|
|
@@render_regular:
|
|
|
|
call super_roll_put pascal, di, [bp+@@screen_y], @@patnum
|
|
|
|
|
|
|
|
@@got_options?:
|
2020-02-22 12:49:32 +00:00
|
|
|
cmp _shot_level, 2
|
2019-09-23 15:24:45 +00:00
|
|
|
jb @@ret
|
2022-04-24 18:01:47 +00:00
|
|
|
call @grcg_setmode_rmw$qv
|
2019-09-23 15:24:45 +00:00
|
|
|
mov ax, _player_option_pos_cur.x
|
|
|
|
sar ax, 4
|
2020-08-25 18:29:24 +00:00
|
|
|
; Technically, DI = AX + PLAYFIELD_LEFT - PLAYER_OPTION_DISTANCE - (PLAYER_OPTION_W / 2)
|
2019-09-23 15:24:45 +00:00
|
|
|
mov di, ax
|
|
|
|
mov ax, _player_option_pos_cur.y
|
2020-08-25 18:29:24 +00:00
|
|
|
add ax, ((PLAYFIELD_TOP - (PLAYER_OPTION_H / 2)) shl 4)
|
2019-09-23 15:24:45 +00:00
|
|
|
call scroll_subpixel_y_to_vram_seg1 pascal, ax
|
|
|
|
mov [bp+@@screen_y], ax
|
|
|
|
mov ax, di
|
|
|
|
mov dx, [bp+@@screen_y]
|
[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, _player_option_patnum
|
2019-10-07 19:51:11 +00:00
|
|
|
lea ax, [di + PLAYER_OPTION_DISTANCE * 2]
|
2019-09-23 15:24:45 +00:00
|
|
|
mov dx, [bp+@@screen_y]
|
[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, _player_option_patnum
|
2019-09-23 15:24:45 +00:00
|
|
|
GRCG_OFF_CLOBBERING dx
|
|
|
|
jmp @@ret
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@in_miss_anim:
|
|
|
|
cmp _miss_time, MISS_ANIM_FRAMES - MISS_ANIM_EXPLODE_UNTIL
|
|
|
|
jbe @@ret
|
|
|
|
mov si, _miss_explosion_radius
|
|
|
|
mov [bp+@@i], 0
|
|
|
|
mov al, _miss_explosion_angle
|
|
|
|
jmp short @@more?
|
|
|
|
|
|
|
|
@@loop:
|
|
|
|
cmp [bp+@@i], MISS_EXPLOSION_COUNT / 2
|
|
|
|
jnz short @@put
|
|
|
|
mov ax, si
|
|
|
|
cwd
|
|
|
|
sub ax, dx
|
|
|
|
sar ax, 1
|
|
|
|
mov si, ax
|
|
|
|
mov al, [bp+@@angle]
|
|
|
|
neg al
|
|
|
|
mov [bp+@@angle], al
|
|
|
|
|
|
|
|
@@put:
|
|
|
|
push offset _drawpoint
|
2019-11-15 19:54:33 +00:00
|
|
|
push _player_pos.cur.x
|
|
|
|
push _player_pos.cur.y
|
2019-09-23 15:24:45 +00:00
|
|
|
push si
|
|
|
|
mov al, [bp+@@angle]
|
|
|
|
mov ah, 0
|
|
|
|
push ax
|
|
|
|
call vector2_at
|
|
|
|
MISS_EXPLOSION_CLIP @@next
|
|
|
|
mov ax, _drawpoint.x
|
|
|
|
sar ax, 4
|
2020-08-25 18:29:24 +00:00
|
|
|
add ax, PLAYFIELD_LEFT - (MISS_EXPLOSION_W / 2)
|
2019-09-23 15:24:45 +00:00
|
|
|
mov di, ax
|
|
|
|
mov ax, _drawpoint.y
|
2020-08-25 18:29:24 +00:00
|
|
|
add ax, ((PLAYFIELD_TOP - (MISS_EXPLOSION_H / 2)) shl 4)
|
2019-09-23 15:24:45 +00:00
|
|
|
call scroll_subpixel_y_to_vram_seg1 pascal, ax
|
|
|
|
mov [bp+@@screen_y], ax
|
|
|
|
call super_roll_put pascal, di, ax, 3
|
|
|
|
|
|
|
|
@@next:
|
|
|
|
inc [bp+@@i]
|
|
|
|
mov al, [bp+@@angle]
|
|
|
|
add al, 256 / (MISS_EXPLOSION_COUNT / 2)
|
|
|
|
|
|
|
|
@@more?:
|
|
|
|
mov [bp+@@angle], al
|
|
|
|
cmp [bp+@@i], MISS_EXPLOSION_COUNT
|
|
|
|
jl short @@loop
|
|
|
|
|
|
|
|
@@ret:
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
leave
|
|
|
|
retn
|
|
|
|
player_render endp
|