monkey: center the current command

also simplifies/removes some hacks while adding some new ones
This commit is contained in:
Vince Weaver 2020-10-18 16:59:00 -04:00
parent ba0111987c
commit 09dc8de953
2 changed files with 147 additions and 57 deletions

View File

@ -482,54 +482,54 @@ location14:
; common strings
door_string: .byte 20,20,"DOOR",0
pirate_string: .byte 20,20,"PIRATE",0
pirates_string: .byte 20,20,"PIRATES",0
door_string: .byte "DOOR",0
pirate_string: .byte "PIRATE",0
pirates_string: .byte "PIRATES",0
; bar3 strings
stew_string: .byte 20,20,"POT O' STEW",0
table_string: .byte 20,20,"TABLE",0
barrel_string: .byte 20,20,"BARREL",0
meat_string: .byte 20,20,"HUNK OF MEAT",0
stew_string: .byte "POT O' STEW",0
table_string: .byte "TABLE",0
barrel_string: .byte "BARREL",0
meat_string: .byte "HUNK OF MEAT",0
; voodoo1 strings
couch_string: .byte 20,20,"COUCH",0
chicken_string: .byte 20,20,"CHICKEN",0
chickens_string:.byte 20,20,"CHICKENS",0
statue_string: .byte 20,20,"STATUE",0
basket_string: .byte 20,20,"BASKET",0
baskets_string: .byte 20,20,"BASKETS",0
bones_string: .byte 20,20,"BONES",0
chalice_string: .byte 20,20,"CHALICE",0
trunk_string: .byte 20,20,"TRUNK",0
voodoo_knicknacks_string:.byte 20,20,"VOODOO KNICKNACKS",0
couch_string: .byte "COUCH",0
chicken_string: .byte "CHICKEN",0
chickens_string:.byte "CHICKENS",0
statue_string: .byte "STATUE",0
basket_string: .byte "BASKET",0
baskets_string: .byte "BASKETS",0
bones_string: .byte "BONES",0
chalice_string: .byte "CHALICE",0
trunk_string: .byte "TRUNK",0
voodoo_knicknacks_string:.byte "VOODOO KNICKNACKS",0
; voodoo2 strings
voodoo_lady_string: .byte 20,20,"VOODOO LADY",0
voodoo_lady_string: .byte "VOODOO LADY",0
; church strings
alley_string: .byte 20,20,"ALLEY",0
alley_string: .byte "ALLEY",0
; mansion path strings
mansion_string: .byte 20,20,"GOVERNOR'S MANSION",0
town_string: .byte 20,20,"TOWN",0
mansion_string: .byte "GOVERNOR'S MANSION",0
town_string: .byte "TOWN",0
; mansion strings
poodles_string: .byte 20,20,"PIRANHA POODLES",0
trail_string: .byte 20,20,"TRAIL",0
poodles_string: .byte "PIRANHA POODLES",0
trail_string: .byte "TRAIL",0
; zipline strings
pole_string: .byte 20,20,"POLE",0
cable_string: .byte 20,20,"CABLE",0
sign_string: .byte 20,20,"SIGN",0
pole_string: .byte "POLE",0
cable_string: .byte "CABLE",0
sign_string: .byte "SIGN",0
; bar strings
; lookout strings
lookout_string: .byte 20,20,"LOOKOUT",0
path_string: .byte 20,20,"PATH",0
stairs_string: .byte 20,20,"STAIRS",0
lookout_string: .byte "LOOKOUT",0
path_string: .byte "PATH",0
stairs_string: .byte "STAIRS",0
; map strings
@ -542,25 +542,25 @@ lookout_point_string: .byte 13,20,"LOOKOUT POINT",0
village_string: .byte 16,20,"VILLAGE",0
; inside_bar2 strings
dog_string: .byte 20,20,"DOG",0
dog_string: .byte "DOG",0
; inside_bar2 strings
curtain_string: .byte 20,20,"CURTAIN",0
impt_pirate_string: .byte 20,20,"IMPORTANT PIRATES",0
fireplace_string: .byte 20,20,"FIREPLACE",0
curtain_string: .byte "CURTAIN",0
impt_pirate_string: .byte "IMPORTANT PIRATES",0
fireplace_string: .byte "FIREPLACE",0
; poster strings
cliffside_string: .byte 20,20,"CLIFFSIDE",0
poster_string: .byte 20,20,"POSTER",0
cliffside_string: .byte "CLIFFSIDE",0
poster_string: .byte "POSTER",0
; dock strings
moon_string: .byte 20,20,"MOON",0
moon_string: .byte "MOON",0
; town strings
archway_string: .byte 20,20,"ARCHWAY",0
clock_string: .byte 20,20,"CLOCK",0
citizen_string: .byte 20,20,"CITIZEN OF MELEE",0
archway_string: .byte "ARCHWAY",0
clock_string: .byte "CLOCK",0
citizen_string: .byte "CITIZEN OF MELEE",0

View File

@ -13,6 +13,10 @@ update_bottom:
cmp #MONKEY_MAP
bne not_the_map
;===================================
; draw map footer
; you don't have actions on the map?
;===================================
map_noun:
lda VALID_NOUN
beq done_map_noun
@ -28,8 +32,10 @@ done_map_noun:
rts
not_the_map:
;=======================
; if message, print it
;===========================================================
; if footer is disable and instead we are printing a message
; then print the message
;===========================================================
lda DISPLAY_MESSAGE
beq no_message
@ -43,8 +49,15 @@ not_the_map:
rts
no_message:
;===============================================
; draw the standard footer
;===============================================
; draw first line
; it's verb followed by noun
; we go through a lot of trouble to center it
; text is not inverse
jsr normal_text
@ -55,28 +68,70 @@ no_message:
sta OUTH
jsr move_and_print
; set up temp line
; already here as we're immediately after clear line?
lda #<(temp_line+2)
sta OUTL
lda #>(temp_line+2)
sta OUTH
; concatenate verb
lda CURRENT_VERB
asl
tay
lda verb_names,Y
sta OUTL
sta INL
lda verb_names+1,Y
sta OUTH
sta INH
jsr move_and_print
jsr strcat
; concatenate noun if applicable
lda VALID_NOUN
beq no_noun
lda NOUN_L
sta OUTL
sta INL
lda NOUN_H
sta INH
jsr strcat
no_noun:
; stick zero at end
lda #0
tay
sta (OUTL),Y
; center it
lda #<(temp_line+2)
sta INL
lda #>(temp_line+2)
sta INH
jsr strlen
sty temp_line
lda #40
sec
sbc temp_line
lsr
sta temp_line
; now print it
lda #<temp_line
sta OUTL
lda #>temp_line
sta OUTH
jsr move_and_print
no_noun:
;========================
; draw command bars
@ -142,15 +197,50 @@ verb_names:
.word verb_pull
.word verb_walk
verb_give: .byte 15,20,"GIVE ",0
verb_open: .byte 15,20,"OPEN ",0
verb_close: .byte 14,20,"CLOSE ",0
verb_pick_up: .byte 12,20,"PICK UP ",0
verb_look_at: .byte 12,20,"LOOK AT ",0
verb_talk_to: .byte 12,20,"TALK TO ",0
verb_use: .byte 16,20,"USE ",0
verb_push: .byte 15,20,"PUSH ",0
verb_pull: .byte 15,20,"PULL ",0
verb_walk: .byte 12,20,"WALK TO ",0
verb_give: .byte "GIVE ",0
verb_open: .byte "OPEN ",0
verb_close: .byte "CLOSE ",0
verb_pick_up: .byte "PICK UP ",0
verb_look_at: .byte "LOOK AT ",0
verb_talk_to: .byte "TALK TO ",0
verb_use: .byte "USE ",0
verb_push: .byte "PUSH ",0
verb_pull: .byte "PULL ",0
verb_walk: .byte "WALK TO ",0
clear_line: .byte 12,20," ",0
clear_line: .byte 0,20," ",0
temp_line: .byte 0,20," ",0
;====================================
; concatenate (INL) to end of (OUTL)
; update (OUTL) to point to end when done
strcat:
ldy #0
strcat_loop:
lda (INL),Y
beq strcat_done
sta (OUTL),Y
iny
bne strcat_loop
strcat_done:
tya
clc
adc OUTL
sta OUTL
lda #0
adc OUTH
sta OUTH
rts
;====================================
; calculate length of string in (INL)
; returns value in Y
strlen:
ldy #0
strlen_loop:
lda (INL),Y
beq strlen_done
iny
bne strlen_loop
strlen_done:
rts