added box painting

This commit is contained in:
Rob McMullen 2017-07-21 13:20:57 -07:00
parent 961310fd02
commit 61100c36c9
5 changed files with 119 additions and 4 deletions

View File

@ -40,30 +40,118 @@ damage_maze nop
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():
paint_boxes nop
; x = 0
; pad.addstr(28, 0, "Checking box:")
; while x < NUM_BOX_PAINTING_PARAMS * 16:
; pad.addstr(29, x, "%d " % x)
ldy #0
sty param_index
?loop ldy param_index
cpy #MAX_BOX_PAINTING
bcc ?1
rts
; if box_painting[x] > 0:
?1 lda box_painting,y
beq ?skip
; c1 = box_painting[x]
; r1 = box_painting[x + 1]
; r2 = box_painting[x + 2]
; i = box_painting[x + 3]
inc debug_paint_box
sta c1
sty save_index
iny
lda box_painting,y
sta r1
iny
lda box_painting,y
sta r2
iny
lda box_painting,y ; player number
iny
sty param_index
; 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)
ldy r1
jsr mazerow
ldy c1
lda #$23 ; # sign
sta (mazeaddr),y
iny
sta (mazeaddr),y
iny
sta (mazeaddr),y
iny
sta (mazeaddr),y
iny
sta (mazeaddr),y
lda c1
sta c
lda r1
sta r
lda #5
sta size
jsr damage_string
; for c in range(BOX_WIDTH):
; if i == 0:
; addr[c1 + c] = ord("X")
; else:
; addr[c1 + c] = ord(".")
; r1 += 1
inc r1
; print "ROW", r1
; box_painting[x + 1] = r1
; if r1 >= r2:
; box_painting[x] = 0
lda r1
cmp r2
bcs ?finish
; box_painting[x + 1] = r1
ldy save_index
iny
sta box_painting,y
bne ?loop
?finish ldy save_index
lda #0
sta box_painting,y
beq ?loop
; x += NUM_BOX_PAINTING_PARAMS
?skip iny
iny
iny
iny
sty param_index
bne ?loop ; always
;
; def init_static_background():
; zp.current_actor = 0

18
debug.s
View File

@ -41,6 +41,12 @@ printstr ; X = column, Y = row, scratch_ptr is text (null terminated)
bne ?next
?exit rts
debug_damage .byte 0
debug_paint_box .byte 0
debug_mark_box .byte 0
debug_player nop
lda #22
sta scratch_row
@ -92,4 +98,16 @@ debug_player nop
ldy scratch_row
jsr printhex
dec scratch_row
ldx #0
lda debug_mark_box
ldx #35
ldy scratch_row
jsr printhex
ldx #0
lda debug_paint_box
ldx #38
ldy scratch_row
jsr printhex
rts

1
maze.s
View File

@ -579,6 +579,7 @@ mark_box_for_painting nop
; break
?1 lda box_painting,y
bne ?skip
inc debug_mark_box
lda c1
sta box_painting,y
iny

View File

@ -370,6 +370,12 @@ renderend
; text position in r, c. add single char to both pages!
damage_char nop
lda #1
sta size
; fallthrough
; text position in r, c; string length in size
damage_string nop
ldy tdamageindex1
lda c
sta TEXTDAMAGE,y
@ -377,7 +383,7 @@ damage_char nop
lda r
sta TEXTDAMAGE,y
iny
lda #1
lda size
sta TEXTDAMAGE,y
iny
sty tdamageindex1
@ -389,7 +395,7 @@ damage_char nop
lda r
sta TEXTDAMAGE,y
iny
lda #1
lda size
sta TEXTDAMAGE,y
iny
sty tdamageindex2

View File

@ -93,6 +93,7 @@ r2 .ds 1
c .ds 1
c1 .ds 1
c2 .ds 1
size .ds 1
dot .ds 1
round_robin_index .ds 2
level .ds 1
@ -250,6 +251,7 @@ game_loop nop
; show_screen()
?draw jsr restorebg_driver
jsr restoretext
jsr paint_boxes
jsr renderstart
jsr pageflip
jsr wait