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
; ldx #2 ; color is purple
; lda colortbl,X
; sta HGR_COLOR
lda #$22 ; color is purple
sta VGI_RCOLOR
@ -127,84 +123,5 @@ draw_box:
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
.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)
;COLOR_SHIFT = $F47E
;HLINRL = $F530 ; (X,A),(Y)
HGLIN = $F53A ; line to (X,A),(Y)
;HGLIN = $F53A ; line to (X,A),(Y)
;COLORTBL = $F6F6

View File

@ -132,6 +132,18 @@ escape_handler:
lda #$AA
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

View File

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

View File

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