From b4d599d06054b293f2bf96fe15c8a6b16dba5a22 Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Mon, 24 Jul 2017 19:52:57 -0700 Subject: [PATCH] Cleanup of box painting and damage_maze --- background.s | 60 +++++++++++----------------------------------------- main.s | 5 ----- maze.s | 40 ++++++++++++++++------------------- vars.s | 5 ++++- 4 files changed, 34 insertions(+), 76 deletions(-) diff --git a/background.s b/background.s index 4201861..4d0334f 100644 --- a/background.s +++ b/background.s @@ -27,36 +27,13 @@ check_dots nop sta (mazeaddr),y ; update damage! Needs to update both screens - jsr damage_maze + jsr damage_char lda #DOT_SCORE jsr add_score ?1 rts -; update both screens! -damage_maze nop - jsr damage_char - 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 - lda c1 - 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)) - - save_index .byte 0 ; def paint_boxes(): @@ -72,7 +49,7 @@ paint_boxes nop rts ; if box_painting[x] > 0: -?1 lda box_painting,y +?1 lda box_painting_c,y beq ?skip ; c1 = box_painting[x] ; r1 = box_painting[x + 1] @@ -82,17 +59,11 @@ paint_boxes nop inc debug_paint_box sta c1 - sty save_index - iny - lda box_painting,y + lda box_painting_r1,y sta r1 - iny - lda box_painting,y + lda box_painting_r2,y sta r2 - iny - lda box_painting,y ; player number - iny - sty param_index + lda box_painting_actor,y ; player number ; box_log.debug("Painting box line, player %d at %d,%d" % (i, r1, c1)) ; pad.addstr(30, 0, "painting box line at %d,%d" % (r1, c1)) ; addr = screenrow(r1) @@ -136,24 +107,17 @@ paint_boxes nop bcs ?finish ; box_painting[x + 1] = r1 - ldy save_index - iny - sta box_painting,y - bne ?loop + ldy param_index + sta box_painting_r1,y + inc param_index + bne ?loop ; always -?finish ldy save_index +?finish ldy param_index lda #0 - sta box_painting,y - beq ?loop - - + sta box_painting_c,y ; x += NUM_BOX_PAINTING_PARAMS -?skip iny - iny - iny - iny - sty param_index +?skip inc param_index bne ?loop ; always ; diff --git a/main.s b/main.s index 87ed1e0..f460ff2 100644 --- a/main.s +++ b/main.s @@ -178,11 +178,6 @@ forever 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 clrscr diff --git a/maze.s b/maze.s index 7864175..8283c9e 100644 --- a/maze.s +++ b/maze.s @@ -18,8 +18,7 @@ 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 +MAX_BOX_PAINTING = 16 ; storage @@ -382,6 +381,14 @@ level_boxes = $bd00 init_boxes nop lda #0 sta next_level_box + ldx #MAX_BOX_PAINTING + lda #0 +?1 sta box_painting_c - 1,x + sta box_painting_r1 - 1,x + sta box_painting_r2 - 1,x + sta box_painting_actor - 1,x + dex + bne ?1 rts ; ;def start_box(r, c): @@ -568,8 +575,9 @@ 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 + ldy #$ff +?loop iny + cpy #MAX_BOX_PAINTING bcc ?1 rts ; if box_painting[x] == 0: @@ -578,27 +586,15 @@ mark_box_for_painting nop ; box_painting[x + 2] = r2 ; box_painting[x + 3] = zp.current_actor ; break -?1 lda box_painting,y - bne ?skip +?1 lda box_painting_c,y + bne ?loop inc debug_mark_box lda c1 - sta box_painting,y - iny + sta box_painting_c,y lda r1 - sta box_painting,y - iny + sta box_painting_r1,y lda r2 - sta box_painting,y - iny + sta box_painting_r2,y txa ; player number - sta box_painting,y + sta box_painting_actor,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 diff --git a/vars.s b/vars.s index 3fadbfd..79a35b5 100644 --- a/vars.s +++ b/vars.s @@ -31,4 +31,7 @@ amidar_start_col .ds VPATH_NUM round_robin_up .ds VPATH_NUM round_robin_down .ds VPATH_NUM -box_painting .ds MAX_BOX_PAINTING +box_painting_c .ds MAX_BOX_PAINTING +box_painting_r1 .ds MAX_BOX_PAINTING +box_painting_r2 .ds MAX_BOX_PAINTING +box_painting_actor .ds MAX_BOX_PAINTING