peasant: modernize the cliff code

can do actions again
This commit is contained in:
Vince Weaver 2021-10-27 15:52:36 -04:00
parent b4b5650fd6
commit 7cd8f62268
6 changed files with 539 additions and 16 deletions

View File

@ -231,6 +231,8 @@ CLIFF: cliff.o
ld65 -o CLIFF cliff.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
cliff.o: cliff.s zp.inc inventory.inc \
parse_input.inc \
cliff_actions.s DIALOG_CLIFF.LZSA dialog_cliff.inc \
graphics_cliff/cliff_graphics.inc sprites/peasant_sprites.inc \
graphics_cliff/priority_cliff.inc \
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
@ -553,6 +555,11 @@ dialog_cliff: dialog_cliff.o
dialog_cliff.o: dialog_cliff.s text/cliff.inc
ca65 -o dialog_cliff.o dialog_cliff.s -l dialog_cliff.lst
###
dialog_cliff.inc: generate_all_symbols dialog_cliff
./generate_all_symbols -a 0xd000 dialog_cliff.lst > dialog_cliff.inc
####
graphics_vid/vid_graphics.inc:

View File

@ -33,6 +33,7 @@ peasant2 18302
18780 -- most dialog hooked up
17394 -- move loadsave to qload.inc
17100 -- move parse_input high and move p2 strings back in
17368 -- use lookup table for next room (and other changes)
partial save, can we fit in 4k?
102 lines ; inventory was 115?

View File

@ -1,6 +1,8 @@
; Peasant's Quest
; Cliff Base
; Cliff
; Cliff base, cliff heights, trogdor outer
; by Vince `deater` Weaver vince@deater.net
@ -11,20 +13,27 @@
.include "inventory.inc"
.include "parse_input.inc"
LOCATION_BASE = LOCATION_CLIFF_BASE ; (20)
cliff_base:
lda #0
sta LEVEL_OVER
sta FRAME
jsr hgr_make_tables
jsr hgr2
jsr hgr2 ; Hi-res graphics, no text at bottom
; Y=0, A=0 after this called
; decompress dialog to $D000
lda #<cliff_text_lzsa
sta getsrc_smc+1
lda #>cliff_text_lzsa
sta getsrc_smc+2
; update map location
lda #$D0
jsr decompress_lzsa2_fast
; jsr update_map_location
; update score
@ -40,12 +49,39 @@ new_location:
lda #0
sta LEVEL_OVER
;==========================
; load updated verb table
; setup default verb table
jsr setup_default_verb_table
; local verb table
lda MAP_LOCATION
sec
sbc #LOCATION_BASE
tax
; lda verb_tables_low,X
; sta INL
; lda verb_tables_hi,X
; sta INH
; jsr load_custom_verb_table
;=====================
; load bg
lda #<cliff_base_lzsa
lda MAP_LOCATION
sec
sbc #LOCATION_BASE
tax
lda map_backgrounds_low,X
sta getsrc_smc+1
lda #>cliff_base_lzsa
lda map_backgrounds_hi,X
sta getsrc_smc+2
lda #$40
@ -55,9 +91,14 @@ new_location:
; load priority to $400
; indirectly as we can't trash screen holes
lda #<cliff_base_priority_lzsa
lda MAP_LOCATION
sec
sbc #LOCATION_BASE
tax
lda map_priority_low,X
sta getsrc_smc+1
lda #>cliff_base_priority_lzsa
lda map_priority_hi,X
sta getsrc_smc+2
lda #$20 ; temporarily load to $2000
@ -179,7 +220,36 @@ game_over:
;.include "loadsave_menu.s"
;.include "wait_keypress.s"
.include "graphics_cliff/cliff_graphics.inc"
.include "graphics_cliff/priority_cliff.inc"
map_backgrounds_low:
.byte <cliff_base_lzsa
.byte <cliff_base_lzsa
.byte <cliff_base_lzsa
map_backgrounds_hi:
.byte >cliff_base_lzsa
.byte >cliff_base_lzsa
.byte >cliff_base_lzsa
map_priority_low:
.byte <cliff_base_priority_lzsa
.byte <cliff_base_priority_lzsa
.byte <cliff_base_priority_lzsa
map_priority_hi:
.byte >cliff_base_priority_lzsa
.byte >cliff_base_priority_lzsa
.byte >cliff_base_priority_lzsa
verb_tables_low:
verb_tables_hi:
cliff_text_lzsa:
.incbin "DIALOG_CLIFF.LZSA"
.include "cliff_actions.s"

View File

@ -0,0 +1,440 @@
.include "tokens.inc"
;=======================
;=======================
;=======================
; Hidden Glen
;=======================
;=======================
;=======================
hidden_glen_verb_table:
.if 0
.byte VERB_ENTER
.word hay_bale_enter-1
.byte VERB_GET
.word hay_bale_get-1
.byte VERB_JUMP
.word hay_bale_jump-1
.byte VERB_HIDE
.word hay_bale_hide-1
.byte VERB_HUG
.word hay_bale_hug-1
.byte VERB_LOOK
.word hay_bale_look-1
.byte VERB_STEAL
.word hay_bale_steal-1
.byte VERB_TAKE
.word hay_bale_take-1
.endif
.byte 0
.if 0
;================
; get
;================
hay_bale_get:
hay_bale_steal:
hay_bale_take:
lda CURRENT_NOUN
cmp #NOUN_HAY
beq hay_get_hay
; else "probably wish" message
jmp parse_common_get
hay_get_hay:
ldx #<hay_get_hay_message
ldy #>hay_get_hay_message
jmp finish_parse_message
;=================
; look
;=================
hay_bale_look:
lda CURRENT_NOUN
cmp #NOUN_HAY
beq hay_look_at_hay
cmp #NOUN_IN_HAY
beq hay_look_in_hay
cmp #NOUN_TREE
beq hay_look_at_tree
cmp #NOUN_FENCE
beq hay_look_at_fence
cmp #NOUN_NONE
beq hay_look_at
jmp parse_common_look
hay_look_at:
ldx #<hay_look_message
ldy #>hay_look_message
jmp finish_parse_message
hay_look_at_hay:
ldx #<hay_look_at_hay_message
ldy #>hay_look_at_hay_message
jmp finish_parse_message
hay_look_in_hay:
ldx #<hay_look_in_hay_message
ldy #>hay_look_in_hay_message
jmp finish_parse_message
hay_look_at_tree:
ldx #<hay_look_at_tree_message
ldy #>hay_look_at_tree_message
jmp finish_parse_message
hay_look_at_fence:
ldx #<hay_look_at_fence_message
ldy #>hay_look_at_fence_message
jmp finish_parse_message
;===================
; enter hay
;===================
hay_bale_enter:
hay_bale_jump:
hay_bale_hide:
lda CURRENT_NOUN
cmp #NOUN_HAY
beq enter_hay
jmp parse_common_unknown
enter_hay:
ldx #<hay_enter_hay_clean_message
ldy #>hay_enter_hay_clean_message
jmp finish_parse_message
;===================
; hug tree
;===================
hay_bale_hug:
lda CURRENT_NOUN
cmp #NOUN_TREE
beq hug_tree
jmp parse_common_unknown
hug_tree:
ldx #<hay_hug_tree_message
ldy #>hay_hug_tree_message
jmp finish_parse_message
.endif
;=======================
;=======================
;=======================
; Inside Lady Cottage
;=======================
;=======================
;=======================
inside_cottage_verb_table:
.if 0
.byte VERB_GET
.word puddle_get-1
.byte VERB_TAKE
.word puddle_take-1
.byte VERB_STEAL
.word puddle_steal-1
.byte VERB_LOOK
.word puddle_look-1
.endif
.byte 0
.if 0
;================
; get
;================
puddle_get:
puddle_steal:
puddle_take:
lda CURRENT_NOUN
cmp #NOUN_ROCK
beq puddle_get_rock
cmp #NOUN_STONE
beq puddle_get_rock
; else "probably wish" message
jmp parse_common_get
puddle_get_rock:
ldx #<puddle_get_rock_message
ldy #>puddle_get_rock_message
jmp finish_parse_message
;=================
; look
;=================
puddle_look:
lda CURRENT_NOUN
cmp #NOUN_ROCK
beq puddle_look_at_rock
cmp #NOUN_STONE
beq puddle_look_at_rock
cmp #NOUN_MUD
beq puddle_look_at_mud
cmp #NOUN_PUDDLE
beq puddle_look_at_mud
cmp #NOUN_NONE
beq puddle_look_at
jmp parse_common_look
puddle_look_at:
ldx #<puddle_look_at_message
ldy #>puddle_look_at_message
jmp finish_parse_message
puddle_look_at_mud:
ldx #<puddle_look_mud_message
ldy #>puddle_look_mud_message
jmp finish_parse_message
puddle_look_at_rock:
ldx #<puddle_get_rock_message
ldy #>puddle_get_rock_message
jmp finish_parse_message
.endif
;=======================
;=======================
;=======================
; Inside Ned Cottage
;=======================
;=======================
;=======================
inside_nn_verb_table:
.if 0
.byte VERB_ASK
.word archery_ask-1
.byte VERB_GET
.word archery_get-1
.byte VERB_GIVE
.word archery_give-1
.byte VERB_HALDO
.word archery_haldo-1
.byte VERB_LOOK
.word archery_look-1
.byte VERB_PLAY
.word archery_play-1
.byte VERB_STEAL
.word archery_steal-1
.byte VERB_TALK
.word archery_talk-1
.byte VERB_TAKE
.word archery_take-1
.endif
.byte 0
.if 0
;================
; ask
;================
archery_ask:
; TODO
jmp parse_common_ask
;================
; get
;================
archery_get:
archery_steal:
archery_take:
lda CURRENT_NOUN
cmp #NOUN_TARGET
beq archery_get_target
cmp #NOUN_ARROW
beq archery_get_arrow
; else "probably wish" message
jmp parse_common_get
archery_get_target:
ldx #<archery_get_target_message
ldy #>archery_get_target_message
jmp finish_parse_message
archery_get_arrow:
ldx #<archery_get_arrow_message
ldy #>archery_get_arrow_message
jmp finish_parse_message
;================
; give
;================
archery_give:
; TODO
jmp parse_common_give
;================
; haldo
;================
archery_haldo:
; TODO
jmp parse_common_haldo
;=================
; look
;=================
archery_look:
lda CURRENT_NOUN
cmp #NOUN_DESK
beq archery_look_at_desk
cmp #NOUN_TARGET
beq archery_look_at_target
cmp #NOUN_ARCHER
beq archery_look_at_archer
cmp #NOUN_NONE
beq archery_look_at
jmp parse_common_look
archery_look_at:
ldx #<archery_look_message
ldy #>archery_look_message
jmp finish_parse_message
archery_look_at_archer:
ldx #<archery_look_at_archer_message
ldy #>archery_look_at_archer_message
jmp finish_parse_message
archery_look_at_target:
ldx #<archery_look_at_target_message
ldy #>archery_look_at_target_message
jmp finish_parse_message
archery_look_at_desk:
ldx #<archery_look_at_desk_message
ldy #>archery_look_at_desk_message
jmp finish_parse_message
;================
; play
;================
archery_play:
lda CURRENT_NOUN
cmp #NOUN_GAME
beq archery_play_game
jmp parse_common_unknown
archery_play_game:
ldx #<archery_play_game_message
ldy #>archery_play_game_message
jmp finish_parse_message
;================
; talk
;================
archery_talk:
; only talk if close
lda PEASANT_X
cmp #23
bcc archery_talk_too_far
; check Y too?
; probably less than $7D?
; actual game will walk you in if close
; will it work from beind?
lda CURRENT_NOUN
cmp #NOUN_MAN
beq archery_talk_mendelev
cmp #NOUN_GUY
beq archery_talk_mendelev
cmp #NOUN_DUDE
beq archery_talk_mendelev
cmp #NOUN_MENDELEV
beq archery_talk_mendelev
cmp #NOUN_ARCHER
beq archery_talk_mendelev
jmp parse_common_unknown
archery_talk_mendelev:
ldx #<archery_talk_mendelev_message
ldy #>archery_talk_mendelev_message
jsr partial_message_step
ldx #<archery_talk_mendelev2_message
ldy #>archery_talk_mendelev2_message
jsr partial_message_step
ldx #<archery_talk_mendelev3_message
ldy #>archery_talk_mendelev3_message
jsr finish_parse_message
; add 1 point to score if don't have mask or trinket
; add 2 points otherwise
lda INVENTORY_2
and #INV2_TRINKET
bne archer_2_points
lda INVENTORY_1
and #INV1_MONSTER_MASK
bne archer_2_points
archer_1_point:
lda #1
bne archer_score_points ; bra
archer_2_points:
lda #2
archer_score_points:
jsr score_points
rts
archery_talk_too_far:
ldx #<archery_talk_far_message
ldy #>archery_talk_far_message
jmp finish_parse_message
.endif
.include "dialog_inside.inc"

View File

@ -40,7 +40,7 @@ inside:
; update map location
jsr update_map_location
; jsr update_map_location
; update score

View File

@ -694,14 +694,17 @@ location_names_l:
.byte <lname_kerrek_2
.byte <lname_outside_lady
.byte <lname_burn_tree
.byte <lname_hidden_glen
.byte <lname_cliff_base
.byte <lname_cliffland_heights
.byte <lname_trogdor_outer
.byte <lname_trogdor_posh
.byte <lname_hidden_glen
.byte <lname_inside_lady
.byte <lname_inside_inn
.byte <lname_inside_nn
.byte <lname_inside_inn
.byte <lname_empty
location_names_h:
@ -725,14 +728,17 @@ location_names_h:
.byte >lname_kerrek_2
.byte >lname_outside_lady
.byte >lname_burn_tree
.byte >lname_hidden_glen
.byte >lname_cliff_base
.byte >lname_cliffland_heights
.byte >lname_trogdor_outer
.byte >lname_trogdor_posh
.byte >lname_hidden_glen
.byte >lname_inside_lady
.byte >lname_inside_inn
.byte >lname_inside_nn
.byte >lname_inside_inn
.byte >lname_empty
@ -758,7 +764,6 @@ lname_kerrek_2: .byte "Kerrek Tracks 2",0 ; C4 LOCATION_KERREK_2
lname_outside_lady: .byte "Outside Baby Lady Cottage",0 ; D4 LOCATION_OUTSIDE_LADY
lname_burn_tree: .byte "Burninated Trees",0 ; E4 LOCATION_BURN_TREES
lname_cliff_base: .byte "Cliff Base",0 ; LOCATION_CLIFF_BASE
lname_cliffland_heights:.byte "Cliffland Heights",0 ; LOCATION_CLIFF_HEIGHTS
lname_trogdor_outer: .byte "Trogdor's Outer Sanctum",0 ; LOCATION_TROGDOR_OUTER