Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;-------------------------------------------------
- ;-------------------------------------------------
- ; garbage_fall_check_template
- ; Template macro for checking if a combo
- ; garbage block should fall.
- ;
- ; width Width of garbage block
- ;-------------------------------------------------
- ;-------------------------------------------------
- .macro garbage_fall_check_template width
- .repeat width, i
- .if i < width - 1
- .define label .sprintf("@space%da", i + 2)
- .else
- .define label "@space1b"
- .endif
- lda a:panel_hover_timers+016+(i<<1),y
- beq .ident(label)
- jmp @mark_as_not_falling
- .ident (label):
- .undef label ; undefine to allow reuse
- .endrep
- ;- - - - - - - - - - - - - - - - - - - - - - - - -
- .repeat width, i
- .if i < width - 1
- .define label .sprintf("@space%db", i + 2)
- .else
- .define label "@bextend"
- .endif
- lda a:panel_attrs_2+016+(i<<1),y
- beq .ident(label)
- jmp @space1c
- .ident (label):
- .undef label ; undefine to allow reuse
- .endrep
- jmp @mark_as_falling
- @space1c:
- ;- - - - - - - - - - - - - - - - - - - - - - - - -
- .repeat width, i
- .if i < width - 1
- .define label .sprintf("@space%dc", i + 2)
- .else
- .define label "@space1d"
- .endif
- lda a:panel_attrs_1+016+(i<<1),y
- bit #ATTR1_IS_FALLING
- bne :+
- jmp @mark_as_not_falling
- : bit #ATTR1_UNK_0020
- beq .ident(label)
- jmp @mark_as_not_falling
- .ident (label):
- .undef label ; undefine to allow reuse
- .endrep
- ;- - - - - - - - - - - - - - - - - - - - - - - - -
- .repeat width, i
- .if i < width - 1
- .define label .sprintf("@space%dd", i + 2)
- .else
- .define label "@mark_as_falling"
- .endif
- lda a:panel_attrs_2+016+(i<<1),y
- bit #ATTR2_IS_QUEUED | ATTR2_IS_SWAPPING
- beq :+
- jmp @mark_as_not_falling
- : cmp #$00ff ; check if garbage is at bottom of board
- bne .ident(label)
- jmp @mark_as_not_falling
- .ident (label):
- .undef label ; undefine to allow reuse
- .endrep
- ;- - - - - - - - - - - - - - - - - - - - - - - - -
- .repeat width, i
- lda a:panel_attrs_1+(i<<1),y
- ora #ATTR1_IS_FALLING
- sta a:panel_attrs_1+(i<<1),y
- .if i = 0
- jsr code_86a4a2
- .elseif i = 1
- jsr code_86a4cd
- .elseif i = 2
- jsr code_86a4f8
- .elseif i = 3
- jsr code_86a523
- .elseif i = 4
- jsr code_86a54e
- .elseif i = 5
- jsr code_86a579
- .endif
- .endrep
- rts
- ;- - - - - - - - - - - - - - - - - - - - - - - - -
- @mark_as_not_falling:
- .if width = 6
- tyx
- lda f:array_7e84f6,x
- and #$1f00
- xba
- sta $04
- jsr code_86a254
- lda $02
- pha
- .endif
- .repeat width, i
- lda a:panel_attrs_1+(i<<1),y
- and #~ATTR1_IS_FALLING
- sta a:panel_attrs_1+(i<<1),y
- .endrep
- jsr code_86a286
- .if width = 6
- pla
- sta $02
- bne @return
- .endif
- tyx
- .repeat width, i
- lda f:array_7e84f6+(i<<1),x
- and #~$8000
- sta f:array_7e84f6+(i<<1),x
- .endrep
- ;- - - - - - - - - - - - - - - - - - - - - - - - -
- @return: rts
- .endmac
- ;-------------------------------------------------
- ;-------------------------------------------------
- garbage_fall_check_3_wide:
- garbage_fall_check_template 3
- garbage_fall_check_4_wide:
- garbage_fall_check_template 4
- garbage_fall_check_5_wide:
- garbage_fall_check_template 5
- garbage_fall_check_6_wide:
- garbage_fall_check_template 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement