mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-27 02:31:00 +00:00
peasant: inventory keyboard navigation works
This commit is contained in:
parent
4f6f22391a
commit
2bb7e1064c
@ -43,6 +43,10 @@ hgr_1x8_sprite_yloop:
|
||||
lda (GBASL),Y
|
||||
hds_smc1:
|
||||
eor $D000,X ; not $0000 or it will make it ZP
|
||||
|
||||
invert_smc1:
|
||||
eor #$00 ; invert
|
||||
|
||||
sta (GBASL),Y
|
||||
|
||||
inx
|
||||
|
@ -7,10 +7,23 @@ show_inventory:
|
||||
|
||||
lda #0
|
||||
sta INVENTORY_X
|
||||
lda #28
|
||||
sta INVENTORY_Y
|
||||
|
||||
;=================
|
||||
; save bg
|
||||
|
||||
lda #20
|
||||
sta BOX_Y1
|
||||
lda #135
|
||||
sta BOX_Y2
|
||||
|
||||
jsr hgr_partial_save
|
||||
|
||||
|
||||
;====================
|
||||
; draw text box
|
||||
draw_inv_box:
|
||||
|
||||
lda #0
|
||||
sta BOX_X1H
|
||||
@ -26,13 +39,14 @@ show_inventory:
|
||||
lda #135
|
||||
sta BOX_Y2
|
||||
|
||||
jsr hgr_partial_save
|
||||
|
||||
|
||||
|
||||
jsr draw_box
|
||||
|
||||
;===================
|
||||
; draw main text
|
||||
|
||||
draw_inv_text:
|
||||
lda #<inventory_message
|
||||
sta OUTL
|
||||
lda #>inventory_message
|
||||
@ -51,6 +65,18 @@ show_inventory:
|
||||
sta INVENTORY_MASK
|
||||
left_column_loop:
|
||||
|
||||
lda INVENTORY_X ; we are column 0
|
||||
bne not_left_inverted
|
||||
|
||||
lda CURSOR_Y
|
||||
cmp INVENTORY_Y
|
||||
bne not_left_inverted
|
||||
|
||||
lda #$7f
|
||||
sta invert_smc1+1
|
||||
|
||||
not_left_inverted:
|
||||
|
||||
lda #4
|
||||
sta CURSOR_X
|
||||
|
||||
@ -80,6 +106,11 @@ left_print_item:
|
||||
|
||||
jsr disp_one_line
|
||||
|
||||
; reset inverse
|
||||
|
||||
lda #$00
|
||||
sta invert_smc1+1
|
||||
|
||||
lda CURSOR_Y
|
||||
clc
|
||||
adc #8
|
||||
@ -88,6 +119,7 @@ left_print_item:
|
||||
asl INVENTORY_MASK
|
||||
|
||||
pla
|
||||
|
||||
tay
|
||||
iny
|
||||
cpy #8
|
||||
@ -105,20 +137,47 @@ left_print_item:
|
||||
sta CURSOR_Y
|
||||
|
||||
ldy #0
|
||||
lda #1
|
||||
sta INVENTORY_MASK
|
||||
right_column_loop:
|
||||
|
||||
lda INVENTORY_X ; we are column 1
|
||||
beq not_right_inverted
|
||||
|
||||
lda CURSOR_Y
|
||||
cmp INVENTORY_Y
|
||||
bne not_right_inverted
|
||||
|
||||
lda #$7f
|
||||
sta invert_smc1+1
|
||||
|
||||
not_right_inverted:
|
||||
|
||||
lda #23
|
||||
sta CURSOR_X
|
||||
|
||||
tya
|
||||
pha
|
||||
|
||||
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_questionmarks:
|
||||
lda #<unknown_string
|
||||
sta OUTL
|
||||
lda #>unknown_string
|
||||
|
||||
right_print_item:
|
||||
sta OUTH
|
||||
|
||||
jsr disp_one_line
|
||||
@ -128,17 +187,112 @@ right_column_loop:
|
||||
adc #8
|
||||
sta CURSOR_Y
|
||||
|
||||
asl INVENTORY_MASK
|
||||
|
||||
; reset inverse
|
||||
|
||||
lda #$00
|
||||
sta invert_smc1+1
|
||||
|
||||
pla
|
||||
|
||||
tay
|
||||
iny
|
||||
cpy #8
|
||||
bne right_column_loop
|
||||
|
||||
|
||||
jsr wait_until_keypress
|
||||
handle_inv_keypress:
|
||||
|
||||
lda KEYPRESS
|
||||
bpl handle_inv_keypress ; no keypress
|
||||
|
||||
bit KEYRESET ; clear keyboard strobe
|
||||
|
||||
and #$7f ; clear top bit
|
||||
|
||||
|
||||
cmp #27
|
||||
beq done_inv_keypress ; ESCAPE
|
||||
cmp #$7f
|
||||
beq done_inv_keypress ; DELETE
|
||||
|
||||
inv_check_down:
|
||||
cmp #$0A
|
||||
beq inv_handle_down
|
||||
cmp #'S'
|
||||
bne inv_check_up
|
||||
inv_handle_down:
|
||||
lda INVENTORY_Y
|
||||
clc
|
||||
adc #$8
|
||||
sta INVENTORY_Y
|
||||
jmp inv_done_moving
|
||||
|
||||
inv_check_up:
|
||||
cmp #$0B
|
||||
beq inv_handle_up
|
||||
cmp #'W'
|
||||
bne inv_check_left_right
|
||||
inv_handle_up:
|
||||
lda INVENTORY_Y
|
||||
sec
|
||||
sbc #$8
|
||||
sta INVENTORY_Y
|
||||
jmp inv_done_moving
|
||||
|
||||
inv_check_left_right:
|
||||
cmp #$15
|
||||
beq inv_handle_left_right
|
||||
cmp #'D'
|
||||
beq inv_handle_left_right
|
||||
cmp #$08
|
||||
beq inv_handle_left_right
|
||||
cmp #'A'
|
||||
bne inv_check_return
|
||||
inv_handle_left_right:
|
||||
lda INVENTORY_X
|
||||
eor #$1
|
||||
sta INVENTORY_X
|
||||
jmp inv_done_moving
|
||||
|
||||
inv_check_return:
|
||||
|
||||
|
||||
inv_done_moving:
|
||||
;================
|
||||
; check bounds
|
||||
|
||||
lda INVENTORY_Y
|
||||
cmp #28
|
||||
bcc inv_y_set_top ; blt too small
|
||||
cmp #100
|
||||
bcs inv_y_set_bottom ; bge
|
||||
bcc inv_y_done ; bra
|
||||
|
||||
inv_y_set_top:
|
||||
lda #100
|
||||
jmp inv_y_done
|
||||
|
||||
inv_y_set_bottom:
|
||||
lda #28
|
||||
|
||||
inv_y_done:
|
||||
sta INVENTORY_Y
|
||||
|
||||
;================
|
||||
; clear box
|
||||
|
||||
;================
|
||||
; repeat
|
||||
|
||||
jmp draw_inv_box
|
||||
|
||||
done_inv_keypress:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;======================
|
||||
; text
|
||||
;======================
|
||||
@ -152,7 +306,7 @@ right_column_loop:
|
||||
; first is only printed if have in inventory, though still can
|
||||
inventory_message:
|
||||
.byte 5,106," Press return for description",13
|
||||
.byte "Press ESC or Backspace to exit",0
|
||||
.byte " Press ESC or DELETE to exit",0
|
||||
|
||||
;====================
|
||||
; Inventory Strings
|
||||
@ -250,6 +404,7 @@ chicken_feed_description:
|
||||
.byte "feed. Crap.",0
|
||||
|
||||
; SuperTime FunBow TM
|
||||
funbow_description:
|
||||
.byte "This is a pretty fancy bow.",13
|
||||
.byte "You're suprised those shady",13
|
||||
.byte "archers give away such decent",13
|
||||
@ -257,17 +412,20 @@ chicken_feed_description:
|
||||
.byte "fish in a bag.",0
|
||||
|
||||
; monster maskus
|
||||
monster_maskus_description:
|
||||
.byte "Man, those pagans sure can make",13
|
||||
.byte "a freaky lookin mask when they",13
|
||||
.byte "want to. It's like those theatre",13
|
||||
.byte "masks' evil uncle or something",0
|
||||
|
||||
; pebbles
|
||||
pebbles_description:
|
||||
.byte "Woah! Gray chicken feed! Oh",13
|
||||
.byte "wait... those are just pebbles.",13
|
||||
.byte "Heavier than they look, though.",0
|
||||
|
||||
; pills
|
||||
pills_description:
|
||||
.byte "The innkeeper's medication says",13
|
||||
.byte "it's supposed to tread ",34,"general",13
|
||||
.byte "oldness. May cause checkers",13
|
||||
@ -275,6 +433,7 @@ chicken_feed_description:
|
||||
.byte "overall pee smell.",34,0
|
||||
|
||||
; riches
|
||||
riches_description:
|
||||
.byte "Riches, dude. Riches. That",13
|
||||
.byte "peasant lady totally has to",13
|
||||
.byte "share some of this with you,",13
|
||||
@ -282,15 +441,18 @@ chicken_feed_description:
|
||||
.byte "clawed sceptre thing.",0
|
||||
|
||||
; robe
|
||||
robe_description:
|
||||
.byte "A propa peasant robe. It smells",13
|
||||
.byte "freshly washed and has the",13
|
||||
.byte "initials 'N.N' sewn onto the",13
|
||||
.byte "tag.",0
|
||||
|
||||
; soda
|
||||
soda_description:
|
||||
.byte "A full bottle of popular soda.",0
|
||||
|
||||
; meatball sub
|
||||
meatball_sub_description:
|
||||
.byte "A piping hot meatball sub fresh",13
|
||||
.byte "from the bottom of a dingy old",13
|
||||
.byte "well. All you need is a bag of",13
|
||||
@ -298,6 +460,7 @@ chicken_feed_description:
|
||||
.byte "meal!",0
|
||||
|
||||
; super trinket
|
||||
super_trinket_description:
|
||||
.byte "This super trinket is weird. It",13
|
||||
.byte "looks like it could either kill",13
|
||||
.byte "you or make you the hit of your",13
|
||||
|
@ -459,6 +459,9 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr,"Warning! x1 should be a multiple of 7\n");
|
||||
}
|
||||
|
||||
printf("; %d %d %d %d\n",x1,y1,x2,y2);
|
||||
printf("sprite:\n");
|
||||
|
||||
for(y=y1;y<y2;y++) {
|
||||
printf("\t.byte ");
|
||||
for(x=x1/7;x<=x2/7;x++) {
|
||||
|
Loading…
Reference in New Issue
Block a user