mirror of
https://github.com/robmcmullen/fujirun.git
synced 2024-12-28 23:30:22 +00:00
added box marking (but not painting yet)
This commit is contained in:
parent
b9b5c7cf3b
commit
961310fd02
1
actors.s
1
actors.s
@ -87,6 +87,7 @@ GAME_OVER = 255
|
||||
;
|
||||
DOT_SCORE = 1
|
||||
PAINT_SCORE_PER_LINE = 10
|
||||
box_score .byte 0, $10, $20, $30, $40, $50, $60, $70, $80, $90
|
||||
|
||||
add_score nop
|
||||
sed
|
||||
|
25
background.s
25
background.s
@ -18,10 +18,6 @@ check_dots nop
|
||||
sta c
|
||||
jsr has_dot
|
||||
beq ?1
|
||||
lda r
|
||||
sta dot_eaten_row,x
|
||||
lda c
|
||||
sta dot_eaten_col,x
|
||||
|
||||
ldy r
|
||||
jsr mazerow
|
||||
@ -44,27 +40,6 @@ damage_maze nop
|
||||
rts
|
||||
|
||||
|
||||
;
|
||||
; def update_background():
|
||||
; zp.current_actor = 0
|
||||
; while zp.current_actor < zp.num_players:
|
||||
; if dot_eaten_col[zp.current_actor] < 128:
|
||||
; # Here we update the screen; note the maze has already been updated
|
||||
; # but we don't change the background until now so sprites can
|
||||
; # restore their saved backgrounds first.
|
||||
;
|
||||
; r = dot_eaten_row[zp.current_actor]
|
||||
; c = dot_eaten_col[zp.current_actor]
|
||||
; addr = screenrow(r)
|
||||
; addr[c] &= ~TILE_DOT
|
||||
;
|
||||
; # mark as completed
|
||||
; dot_eaten_col[zp.current_actor] = 255
|
||||
; update_score()
|
||||
; zp.current_actor += 1
|
||||
;
|
||||
; paint_boxes()
|
||||
;
|
||||
; def paint_boxes():
|
||||
; x = 0
|
||||
; pad.addstr(28, 0, "Checking box:")
|
||||
|
142
maze.s
142
maze.s
@ -18,6 +18,10 @@ VPATH_NUM = 6
|
||||
BOX_WIDTH = 5
|
||||
VPATH_COL_SPACING = BOX_WIDTH + 1
|
||||
|
||||
NUM_BOX_PAINTING_PARAMS = 4
|
||||
MAX_BOX_PAINTING = NUM_BOX_PAINTING_PARAMS * 16
|
||||
|
||||
|
||||
; storage
|
||||
|
||||
vpath_cols .byte 1, 7, 13, 19, 25, 31
|
||||
@ -425,15 +429,55 @@ finish_boxes nop
|
||||
|
||||
|
||||
;def check_boxes():
|
||||
check_boxes nop
|
||||
; x = 0
|
||||
ldy #0
|
||||
sty param_index
|
||||
?loop ldy param_index
|
||||
lda level_boxes,y
|
||||
; pad.addstr(28, 0, str(level_boxes[0:21]))
|
||||
; while level_boxes[x] < 0xff:
|
||||
bpl ?1
|
||||
rts
|
||||
; c = level_boxes[x]
|
||||
; if c > 0:
|
||||
?1 bne ?check
|
||||
iny ; box is filled; don't check again
|
||||
iny
|
||||
iny
|
||||
sty param_index
|
||||
bne ?loop
|
||||
|
||||
?check sta c1
|
||||
sty param_save ; save index so we can mark the box as filled
|
||||
; r1 = level_boxes[x + 1]
|
||||
iny
|
||||
lda level_boxes,y
|
||||
sta r1
|
||||
|
||||
iny
|
||||
lda level_boxes,y
|
||||
sta r2
|
||||
|
||||
iny
|
||||
sty param_index
|
||||
|
||||
; addr = mazerow(r1)
|
||||
ldy r1
|
||||
jsr mazerow
|
||||
lda mazeaddr
|
||||
sta scratch_addr
|
||||
lda mazeaddr+1
|
||||
sta scratch_addr+1 ; scratch_addr is top row
|
||||
|
||||
; r1 += 1
|
||||
iny
|
||||
; r1_save = r1
|
||||
sty r1
|
||||
sty r
|
||||
|
||||
ldy r2
|
||||
jsr mazerow ; mazeaddr is bot row
|
||||
;
|
||||
; # If there's a dot anywhere, then the box isn't painted. We don't
|
||||
; # care where it is so we don't need to keep track of individual
|
||||
@ -443,34 +487,116 @@ finish_boxes nop
|
||||
; r2 = level_boxes[x + 2]
|
||||
; addr = mazerow(r2)
|
||||
; dot |= addr[c]|addr[c + 1]|addr[c + 2]|addr[c + 3]|addr[c + 4]|addr[c + 5]|addr[c + BOX_WIDTH + 1]
|
||||
;
|
||||
lda #0
|
||||
sta dot
|
||||
|
||||
; start checking top and bottom rows. 7 columns starting at c
|
||||
ldy c1
|
||||
ora (mazeaddr),y
|
||||
ora (scratch_addr),y
|
||||
iny
|
||||
ora (mazeaddr),y
|
||||
ora (scratch_addr),y
|
||||
iny
|
||||
ora (mazeaddr),y
|
||||
ora (scratch_addr),y
|
||||
iny
|
||||
ora (mazeaddr),y
|
||||
ora (scratch_addr),y
|
||||
iny
|
||||
ora (mazeaddr),y
|
||||
ora (scratch_addr),y
|
||||
iny
|
||||
ora (mazeaddr),y
|
||||
ora (scratch_addr),y
|
||||
iny
|
||||
ora (mazeaddr),y
|
||||
ora (scratch_addr),y
|
||||
|
||||
and #TILE_DOT
|
||||
bne ?loop ; a dot somewhere in there; skip this box!
|
||||
|
||||
sty c2
|
||||
|
||||
; while r1 < r2:
|
||||
; addr = mazerow(r1)
|
||||
; dot |= addr[c]|addr[c + BOX_WIDTH + 1]
|
||||
; r1 += 1
|
||||
;
|
||||
?cols ldy r1
|
||||
cpy r2
|
||||
bcs ?paint
|
||||
|
||||
jsr mazerow
|
||||
lda #0
|
||||
ldy c1
|
||||
ora (mazeaddr),y
|
||||
ldy c2
|
||||
ora (mazeaddr),y
|
||||
and #TILE_DOT
|
||||
bne ?loop ; a dot somewhere in there; skip this box!
|
||||
|
||||
inc r1
|
||||
bne ?cols
|
||||
|
||||
; if (dot & TILE_DOT) == 0:
|
||||
; # No dots anywhere! Start painting
|
||||
; mark_box_for_painting(r1_save, r2, c + 1)
|
||||
?paint ldy r
|
||||
sty r1
|
||||
inc c1
|
||||
jsr mark_box_for_painting
|
||||
|
||||
; level_boxes[x] = 0 # Set flag so we don't check this box again
|
||||
ldy param_save
|
||||
lda #0
|
||||
sta level_boxes,y
|
||||
|
||||
; num_rows = r2 - r1_save
|
||||
; player_score[zp.current_actor] += num_rows * 100
|
||||
; level_boxes[x] = 0 # Set flag so we don't check this box again
|
||||
;
|
||||
; x += 3
|
||||
check_boxes nop
|
||||
rts
|
||||
lda r2
|
||||
sec
|
||||
sbc r
|
||||
tay
|
||||
lda box_score,y
|
||||
jsr add_score
|
||||
|
||||
|
||||
|
||||
;
|
||||
;def mark_box_for_painting(r1, r2, c):
|
||||
mark_box_for_painting nop
|
||||
; box_log.debug("Marking box, player $%d @ %d,%d -> %d,%d" % (zp.current_actor, r1, c, r2, c + BOX_WIDTH))
|
||||
; x = 0
|
||||
; while x < NUM_BOX_PAINTING_PARAMS * 16:
|
||||
ldy #0
|
||||
?loop cpy #MAX_BOX_PAINTING
|
||||
bcc ?1
|
||||
rts
|
||||
; if box_painting[x] == 0:
|
||||
; box_painting[x] = c
|
||||
; box_painting[x + 1] = r1
|
||||
; box_painting[x + 2] = r2
|
||||
; box_painting[x + 3] = zp.current_actor
|
||||
; break
|
||||
?1 lda box_painting,y
|
||||
bne ?skip
|
||||
lda c1
|
||||
sta box_painting,y
|
||||
iny
|
||||
lda r1
|
||||
sta box_painting,y
|
||||
iny
|
||||
lda r2
|
||||
sta box_painting,y
|
||||
iny
|
||||
txa ; player number
|
||||
sta box_painting,y
|
||||
rts
|
||||
|
||||
|
||||
; x += NUM_BOX_PAINTING_PARAMS
|
||||
; pad.addstr(27, 0, "starting box, player @ %d %d,%d -> %d,%d" % (zp.current_actor, r1, c, r2, c + BOX_WIDTH))
|
||||
?skip iny
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
bne ?loop ; always
|
||||
|
4
vars.s
4
vars.s
@ -20,8 +20,6 @@ actor_active .ds MAX_ACTORS ; 1 = active, 0 = skip, $ff = end
|
||||
actor_l .ds MAX_ACTORS
|
||||
actor_h .ds MAX_ACTORS
|
||||
|
||||
dot_eaten_row .ds 4 ; # dot eaten by player
|
||||
dot_eaten_col .ds 4
|
||||
player_score .ds 4
|
||||
player_next_target_score .ds 4
|
||||
player_lives .ds 4 ; # lives remaining
|
||||
@ -29,3 +27,5 @@ player_lives .ds 4 ; # lives remaining
|
||||
amidar_start_col .ds VPATH_NUM
|
||||
round_robin_up .ds VPATH_NUM
|
||||
round_robin_down .ds VPATH_NUM
|
||||
|
||||
box_painting .ds MAX_BOX_PAINTING
|
||||
|
19
working.s
19
working.s
@ -25,6 +25,7 @@ param_col .ds 1
|
||||
param_row .ds 1
|
||||
param_index .ds 1
|
||||
param_count .ds 1
|
||||
param_save .ds 1
|
||||
|
||||
*= $0010
|
||||
; scratch areas: these may be modified by child subroutines
|
||||
@ -87,7 +88,12 @@ current .ds 1 ; current direction
|
||||
allowed .ds 1 ; allowed directions
|
||||
d .ds 1 ; actor input dir
|
||||
r .ds 1
|
||||
r1 .ds 1
|
||||
r2 .ds 1
|
||||
c .ds 1
|
||||
c1 .ds 1
|
||||
c2 .ds 1
|
||||
dot .ds 1
|
||||
round_robin_index .ds 2
|
||||
level .ds 1
|
||||
last_enemy .ds 1
|
||||
@ -125,12 +131,21 @@ start nop
|
||||
bit SETHIRES
|
||||
|
||||
jsr clrscr
|
||||
jsr init_screen_once
|
||||
jsr init_actors_once
|
||||
jsr init_once
|
||||
jsr title_screen
|
||||
jsr init_game
|
||||
jsr game_loop
|
||||
|
||||
init_once
|
||||
jsr init_screen_once
|
||||
jsr init_actors_once
|
||||
ldx #MAX_BOX_PAINTING
|
||||
lda #0
|
||||
?1 sta box_painting - 1,x
|
||||
dex
|
||||
bne ?1
|
||||
rts
|
||||
|
||||
forever
|
||||
jmp forever
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user