peasant: all inventory shown

This commit is contained in:
Vince Weaver 2021-09-01 23:27:06 -04:00
parent c680123ada
commit 00516ef998
5 changed files with 112 additions and 178 deletions

View File

@ -33,10 +33,6 @@ draw_box:
; draw lines ; draw lines
; ldx #2 ; color is purple
; lda colortbl,X
; sta HGR_COLOR
lda #$22 ; color is purple lda #$22 ; color is purple
sta VGI_RCOLOR sta VGI_RCOLOR
@ -127,84 +123,5 @@ draw_box:
jsr vgi_simple_rectangle jsr vgi_simple_rectangle
.if 0
clc
lda BOX_X1L
adc #6
sta BOX_X1L
sec
lda BOX_X2L
sbc #6
sta BOX_X2L
clc
lda BOX_Y1
adc #5
sta BOX_Y1
sec
lda BOX_Y2
sbc #5
sta BOX_Y2
jsr draw_rectangle
; draw inner rectangle, x+7, y+6 x-7, y-6
inc BOX_X1L
dec BOX_X2L
inc BOX_Y1
dec BOX_Y2
jsr draw_rectangle
; make vertical line extra thick
inc BOX_X1L
dec BOX_X2L
jsr draw_rectangle
; make vertical line extra thick
inc BOX_X1L
dec BOX_X2L
jsr draw_rectangle
.endif
rts rts
.if 0
draw_rectangle:
ldy #0
ldx BOX_X1L
lda BOX_Y1
jsr HPLOT0 ; plot at (Y,X), (A)
ldx #0
lda BOX_X2L
ldy BOX_Y1
jsr HGLIN ; line to (X,A),(Y)
ldx #0
lda BOX_X2L
ldy BOX_Y2
jsr HGLIN ; line to (X,A),(Y)
ldx #0
lda BOX_X1L
ldy BOX_Y2
jsr HGLIN ; line to (X,A),(Y)
ldx #0
lda BOX_X1L
ldy BOX_Y1
jsr HGLIN ; line to (X,A),(Y)
rts
.endif

View File

@ -36,7 +36,7 @@ HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
HPLOT0 = $F457 ; plot at (Y,X), (A) HPLOT0 = $F457 ; plot at (Y,X), (A)
;COLOR_SHIFT = $F47E ;COLOR_SHIFT = $F47E
;HLINRL = $F530 ; (X,A),(Y) ;HLINRL = $F530 ; (X,A),(Y)
HGLIN = $F53A ; line to (X,A),(Y) ;HGLIN = $F53A ; line to (X,A),(Y)
;COLORTBL = $F6F6 ;COLORTBL = $F6F6

View File

@ -132,6 +132,18 @@ escape_handler:
lda #$AA lda #$AA
sta INVENTORY_1 sta INVENTORY_1
lda #$FF
sta INVENTORY_2
lda #INV3_SHIRT
sta INVENTORY_3
lda #0
sta INVENTORY_1_GONE
sta INVENTORY_3_GONE
lda #$AA
sta INVENTORY_2_GONE
rts rts

View File

@ -7,7 +7,7 @@ show_inventory:
lda #0 lda #0
sta INVENTORY_X sta INVENTORY_X
lda #28 lda #0
sta INVENTORY_Y sta INVENTORY_Y
;================= ;=================
@ -52,65 +52,73 @@ draw_inv_text:
jsr disp_put_string jsr disp_put_string
;=============== ;===============
; left column ; draw text
lda #28 lda #28
sta CURSOR_Y sta CURSOR_Y
ldy #0 ldy #0
inv_reset_mask:
lda #1 lda #1
sta INVENTORY_MASK sta INVENTORY_MASK
left_column_loop:
lda INVENTORY_X ; we are column 0 draw_inv_loop:
bne not_left_inverted
lda CURSOR_Y cpy #9
cmp INVENTORY_Y bcs right_column ; bge
bne not_left_inverted
lda #$7f
sta invert_smc1+1
not_left_inverted:
left_column:
lda #4 lda #4
bne done_column ; bra
right_column:
lda #23
done_column:
sta CURSOR_X sta CURSOR_X
tya tya
pha pha
lda INVENTORY_MASK
and INVENTORY_1
beq left_questionmarks
left_have_item: lsr
lsr
lsr ; Y/8
tax
lda INVENTORY_1,X
and INVENTORY_MASK
beq questionmarks
have_item:
clc clc
lda left_item_offsets,Y lda item_offsets,Y
adc #<item_strings adc #<item_strings
sta OUTL sta OUTL
lda #0 lda #0
adc #>item_strings adc #>item_strings
jmp left_print_item jmp print_item
left_questionmarks: questionmarks:
lda #<unknown_string lda #<unknown_string
sta OUTL sta OUTL
lda #>unknown_string lda #>unknown_string
left_print_item: print_item:
sta OUTH sta OUTH
jsr disp_one_line jsr disp_one_line
; reset inverse
lda #$00 lda CURSOR_Y ; incrememnt cursor location
sta invert_smc1+1
lda CURSOR_Y
clc clc
adc #8 adc #8
cmp #100
bne inv_cursory_good
lda #28
inv_cursory_good:
sta CURSOR_Y sta CURSOR_Y
asl INVENTORY_MASK asl INVENTORY_MASK
@ -119,84 +127,85 @@ left_print_item:
tay tay
iny iny
cpy #8
bne left_column_loop
; extra for riches
tya
and #$7
beq inv_reset_mask
cpy #18
bne draw_inv_loop
;================ ;================
; right column ; right column
lda #28 ; lda #28
sta CURSOR_Y ; sta CURSOR_Y
ldy #0 ; ldy #0
lda #1 ; lda #1
sta INVENTORY_MASK ; sta INVENTORY_MASK
right_column_loop: ;right_column_loop:
lda INVENTORY_X ; we are column 1 ; lda INVENTORY_X ; we are column 1
beq not_right_inverted ; beq not_right_inverted
lda CURSOR_Y ; lda CURSOR_Y
cmp INVENTORY_Y ; cmp INVENTORY_Y
bne not_right_inverted ; bne not_right_inverted
lda #$7f ; lda #$7f
sta invert_smc1+1 ; sta invert_smc1+1
not_right_inverted: ;not_right_inverted:
lda #23 ; lda #23
sta CURSOR_X ; sta CURSOR_X
tya ; tya
pha ; pha
lda INVENTORY_MASK ; lda INVENTORY_MASK
and INVENTORY_2 ; and INVENTORY_2
beq right_questionmarks ; beq right_questionmarks
right_have_item: ;right_have_item:
clc ; clc
lda right_item_offsets,Y ; lda right_item_offsets,Y
adc #<item_strings ; adc #<item_strings
sta OUTL ; sta OUTL
lda #0 ; lda #0
adc #>item_strings ; adc #>item_strings
jmp right_print_item ; jmp right_print_item
right_questionmarks: ;right_questionmarks:
lda #<unknown_string ; lda #<unknown_string
sta OUTL ; sta OUTL
lda #>unknown_string ; lda #>unknown_string
right_print_item: ;right_print_item:
sta OUTH ; sta OUTH
jsr disp_one_line ; jsr disp_one_line
lda CURSOR_Y ; lda CURSOR_Y
clc ; clc
adc #8 ; adc #9
sta CURSOR_Y ; sta CURSOR_Y
asl INVENTORY_MASK ; asl INVENTORY_MASK
; reset inverse ; reset inverse
lda #$00 ; lda #$00
sta invert_smc1+1 ; sta invert_smc1+1
pla ; pla
tay ; tay
iny ; iny
cpy #8 ; cpy #8
bne right_column_loop ; bne right_column_loop
handle_inv_keypress: handle_inv_keypress:
@ -312,7 +321,7 @@ inventory_message:
unknown_string: unknown_string:
.byte "???",0 .byte "???",0
left_item_offsets: item_offsets:
.byte (item_arrow-item_strings) .byte (item_arrow-item_strings)
.byte (item_baby-item_strings) .byte (item_baby-item_strings)
.byte (item_kerrek_belt-item_strings) .byte (item_kerrek_belt-item_strings)
@ -321,8 +330,7 @@ left_item_offsets:
.byte (item_monster_mask-item_strings) .byte (item_monster_mask-item_strings)
.byte (item_pebbles-item_strings) .byte (item_pebbles-item_strings)
.byte (item_pills-item_strings) .byte (item_pills-item_strings)
.byte (item_riches-item_strings)
right_item_offsets:
.byte (item_robe-item_strings) .byte (item_robe-item_strings)
.byte (item_soda-item_strings) .byte (item_soda-item_strings)
.byte (item_meatball_sub-item_strings) .byte (item_meatball_sub-item_strings)
@ -331,10 +339,7 @@ right_item_offsets:
.byte (item_trogshield-item_strings) .byte (item_trogshield-item_strings)
.byte (item_trogsword-item_strings) .byte (item_trogsword-item_strings)
.byte (item_impossible-item_strings) .byte (item_impossible-item_strings)
.byte (item_shirt-item_strings)
item_strings: item_strings:

View File

@ -137,17 +137,17 @@ INVENTORY_1 = $A0
INV1_PILLS = $80 INV1_PILLS = $80
INVENTORY_2 = $A1 INVENTORY_2 = $A1
INV2_ROBE = $01 INV2_RICHES = $01
INV2_SODA = $02 INV2_ROBE = $02
INV2_MEATBALL = $04 INV2_SODA = $04
INV2_TRINKET = $08 INV2_MEATBALL = $06
INV2_TROGHELM = $10 INV2_TRINKET = $10
INV2_TROGSHIELD = $20 INV2_TROGHELM = $20
INV2_TROGSWORD = $40 INV2_TROGSHIELD = $40
INV2_IMPOSSIBLE = $80 INV2_TROGSWORD = $80
INVENTORY_3 = $A2 INVENTORY_3 = $A2
INV3_RICHES = $01 INV3_IMPOSSIBLE = $01
INV3_SHIRT = $02 INV3_SHIRT = $02
INV3_MAP = $04 INV3_MAP = $04