2019-09-15 16:23:33 +00:00
|
|
|
; void pascal near sparks_update(void);
|
|
|
|
public SPARKS_UPDATE
|
2019-02-27 19:29:54 +00:00
|
|
|
sparks_update proc near
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
mov di, SPARK_COUNT
|
|
|
|
mov si, offset _sparks
|
|
|
|
|
|
|
|
@@loop:
|
|
|
|
cmp [si+spark_t.flag], 0
|
|
|
|
jz short @@more?
|
|
|
|
cmp [si+spark_t.flag], 1
|
|
|
|
jz short @@update
|
|
|
|
mov [si+spark_t.flag], 0
|
|
|
|
jmp short @@more?
|
|
|
|
|
|
|
|
@@update:
|
|
|
|
lea ax, [si+spark_t.pos]
|
|
|
|
push ax
|
|
|
|
call _motion_update_1
|
|
|
|
add ax, ((SPARK_W / 2) shl 4)
|
|
|
|
cmp ax, ((PLAYFIELD_W + SPARK_W) shl 4)
|
|
|
|
jnb short @@remove
|
|
|
|
add dx, ((SPARK_H / 2) shl 4)
|
|
|
|
cmp dx, ((PLAYFIELD_H + SPARK_H) shl 4)
|
|
|
|
jb short @@age
|
|
|
|
|
|
|
|
@@remove:
|
|
|
|
mov [si+spark_t.flag], 2
|
|
|
|
jmp short @@more?
|
|
|
|
|
|
|
|
@@age:
|
|
|
|
inc [si+spark_t.pos.velocity.y]
|
|
|
|
inc [si+spark_t.age]
|
|
|
|
cmp [si+spark_t.age], 40
|
|
|
|
jbe short @@more?
|
|
|
|
mov [si+spark_t.flag], 2
|
|
|
|
|
|
|
|
@@more?:
|
|
|
|
add si, size spark_t
|
|
|
|
dec di
|
|
|
|
jg short @@loop
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
retn
|
|
|
|
sparks_update endp
|
|
|
|
|
|
|
|
|
2019-09-15 16:23:33 +00:00
|
|
|
; void pascal near sparks_render(void);
|
|
|
|
public SPARKS_RENDER
|
2019-02-27 19:29:54 +00:00
|
|
|
sparks_render proc near
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
mov ah, GC_BR
|
2019-09-15 16:23:33 +00:00
|
|
|
call grcg_setcolor_direct_noint_1
|
2019-02-27 19:29:54 +00:00
|
|
|
mov ax, GRAM_400
|
|
|
|
mov es, ax
|
|
|
|
assume es:nothing
|
|
|
|
mov di, SPARK_COUNT
|
|
|
|
mov si, offset _sparks
|
|
|
|
|
|
|
|
@@loop:
|
|
|
|
cmp [si+spark_t.flag], 1
|
|
|
|
jnz short @@more?
|
|
|
|
mov ax, [si+spark_t.pos.cur.y]
|
|
|
|
add ax, ((PLAYFIELD_Y - (SPARK_H / 2)) shl 4)
|
|
|
|
call scroll_subpixel_y_to_vram_seg1 pascal, ax
|
|
|
|
mov dx, ax
|
|
|
|
mov ax, [si+spark_t.pos.cur.x]
|
|
|
|
add ax, ((PLAYFIELD_X - (SPARK_W / 2)) shl 4)
|
|
|
|
sar ax, 4 ; → actual pixels
|
|
|
|
mov cl, [si+spark_t.age]
|
|
|
|
call @spark_render
|
|
|
|
|
|
|
|
@@more?:
|
|
|
|
add si, size spark_t
|
|
|
|
dec di
|
|
|
|
jg short @@loop
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
retn
|
|
|
|
sparks_render endp
|
|
|
|
even
|
|
|
|
|
|
|
|
|
2019-09-15 16:23:33 +00:00
|
|
|
; void pascal near sparks_invalidate(void);
|
|
|
|
public SPARKS_INVALIDATE
|
2019-02-27 19:29:54 +00:00
|
|
|
sparks_invalidate proc near
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
mov _tile_invalidate_box, (SPARK_W shl 16) or SPARK_H
|
|
|
|
mov di, SPARK_COUNT_BUG
|
|
|
|
mov si, offset _sparks
|
|
|
|
|
|
|
|
@@loop:
|
|
|
|
cmp [si+spark_t.flag], 0
|
|
|
|
jz short @@more?
|
|
|
|
call tiles_invalidate_around pascal, dword ptr [si+spark_t.pos.prev]
|
|
|
|
|
|
|
|
@@more?:
|
|
|
|
add si, size spark_t
|
|
|
|
dec di
|
|
|
|
jg short @@loop
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
retn
|
|
|
|
sparks_invalidate endp
|
|
|
|
|
|
|
|
|
2019-09-15 16:23:33 +00:00
|
|
|
; void pascal near sparks_init(void);
|
|
|
|
public SPARKS_INIT
|
2019-02-27 19:29:54 +00:00
|
|
|
sparks_init proc near
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
mov si, offset _sparks
|
|
|
|
mov di, SPARK_COUNT_BUG
|
|
|
|
|
|
|
|
@@loop:
|
|
|
|
call IRand
|
|
|
|
mov byte ptr [si+spark_t.SPARK_angle], al
|
|
|
|
add si, size spark_t
|
|
|
|
dec di
|
|
|
|
jnz short @@loop
|
|
|
|
mov byte ptr _spark_next_free_offset, 0
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
retn
|
|
|
|
sparks_init endp
|