2021-10-04 02:28:27 +00:00
|
|
|
; Peasant's Quest
|
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
; Cliff
|
|
|
|
|
|
|
|
; Cliff base, cliff heights, trogdor outer
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
; by Vince `deater` Weaver vince@deater.net
|
|
|
|
|
|
|
|
.include "hardware.inc"
|
|
|
|
.include "zp.inc"
|
|
|
|
|
|
|
|
.include "qload.inc"
|
2021-10-17 04:41:52 +00:00
|
|
|
.include "inventory.inc"
|
2021-10-21 03:54:09 +00:00
|
|
|
.include "parse_input.inc"
|
2021-10-04 02:28:27 +00:00
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
LOCATION_BASE = LOCATION_CLIFF_BASE ; (20)
|
|
|
|
|
2021-10-04 02:28:27 +00:00
|
|
|
cliff_base:
|
|
|
|
lda #0
|
2021-10-27 19:20:58 +00:00
|
|
|
sta LEVEL_OVER
|
2021-10-04 02:28:27 +00:00
|
|
|
sta FRAME
|
|
|
|
|
|
|
|
jsr hgr_make_tables
|
2021-10-27 19:52:36 +00:00
|
|
|
jsr hgr2
|
2021-10-04 02:28:27 +00:00
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
; decompress dialog to $D000
|
2021-10-04 02:28:27 +00:00
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
lda #<cliff_text_lzsa
|
|
|
|
sta getsrc_smc+1
|
|
|
|
lda #>cliff_text_lzsa
|
|
|
|
sta getsrc_smc+2
|
2021-10-04 02:28:27 +00:00
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
lda #$D0
|
|
|
|
|
|
|
|
jsr decompress_lzsa2_fast
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
; update score
|
|
|
|
|
|
|
|
jsr update_score
|
|
|
|
|
|
|
|
;=============================
|
|
|
|
;=============================
|
|
|
|
; new screen location
|
|
|
|
;=============================
|
|
|
|
;=============================
|
|
|
|
|
|
|
|
new_location:
|
|
|
|
lda #0
|
2021-10-27 19:20:58 +00:00
|
|
|
sta LEVEL_OVER
|
2021-10-04 02:28:27 +00:00
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
;==========================
|
|
|
|
; load updated verb table
|
|
|
|
|
|
|
|
; setup default verb table
|
|
|
|
|
|
|
|
jsr setup_default_verb_table
|
|
|
|
|
|
|
|
; local verb table
|
|
|
|
|
|
|
|
lda MAP_LOCATION
|
|
|
|
sec
|
|
|
|
sbc #LOCATION_BASE
|
|
|
|
tax
|
|
|
|
|
2021-10-28 17:57:48 +00:00
|
|
|
lda verb_tables_low,X
|
|
|
|
sta INL
|
|
|
|
lda verb_tables_hi,X
|
|
|
|
sta INH
|
|
|
|
jsr load_custom_verb_table
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-04 02:28:27 +00:00
|
|
|
;=====================
|
|
|
|
; load bg
|
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
lda MAP_LOCATION
|
|
|
|
sec
|
|
|
|
sbc #LOCATION_BASE
|
|
|
|
tax
|
|
|
|
|
|
|
|
lda map_backgrounds_low,X
|
2021-10-04 02:28:27 +00:00
|
|
|
sta getsrc_smc+1
|
2021-10-27 19:52:36 +00:00
|
|
|
lda map_backgrounds_hi,X
|
2021-10-04 02:28:27 +00:00
|
|
|
sta getsrc_smc+2
|
|
|
|
|
|
|
|
lda #$40
|
|
|
|
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
|
|
|
; load priority to $400
|
|
|
|
; indirectly as we can't trash screen holes
|
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
lda MAP_LOCATION
|
|
|
|
sec
|
|
|
|
sbc #LOCATION_BASE
|
|
|
|
tax
|
|
|
|
|
|
|
|
lda map_priority_low,X
|
2021-10-04 02:28:27 +00:00
|
|
|
sta getsrc_smc+1
|
2021-10-27 19:52:36 +00:00
|
|
|
lda map_priority_hi,X
|
2021-10-04 02:28:27 +00:00
|
|
|
sta getsrc_smc+2
|
|
|
|
|
|
|
|
lda #$20 ; temporarily load to $2000
|
|
|
|
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
|
|
|
; copy to $400
|
|
|
|
|
|
|
|
jsr gr_copy_to_page1
|
|
|
|
|
|
|
|
; put peasant text
|
|
|
|
|
|
|
|
lda #<peasant_text
|
|
|
|
sta OUTL
|
|
|
|
lda #>peasant_text
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
jsr hgr_put_string
|
|
|
|
|
|
|
|
; put score
|
|
|
|
|
|
|
|
jsr print_score
|
|
|
|
|
|
|
|
;=====================
|
|
|
|
; move peasant
|
|
|
|
|
2021-12-13 03:29:36 +00:00
|
|
|
; lda #20
|
|
|
|
; sta PEASANT_X
|
|
|
|
; lda #150
|
|
|
|
; sta PEASANT_Y
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
;====================
|
|
|
|
; save background
|
|
|
|
|
|
|
|
lda PEASANT_X
|
|
|
|
sta CURSOR_X
|
|
|
|
lda PEASANT_Y
|
|
|
|
sta CURSOR_Y
|
|
|
|
|
|
|
|
;=======================
|
|
|
|
; draw initial peasant
|
|
|
|
|
2021-10-05 04:13:31 +00:00
|
|
|
jsr save_bg_1x28
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
jsr draw_peasant
|
|
|
|
|
|
|
|
game_loop:
|
|
|
|
|
|
|
|
jsr move_peasant
|
|
|
|
|
|
|
|
inc FRAME
|
|
|
|
|
|
|
|
jsr check_keyboard
|
|
|
|
|
2021-10-27 19:20:58 +00:00
|
|
|
lda LEVEL_OVER
|
2021-10-04 02:28:27 +00:00
|
|
|
bmi oops_new_location
|
2021-12-13 03:29:36 +00:00
|
|
|
bne level_over
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
; delay
|
|
|
|
|
|
|
|
lda #200
|
|
|
|
jsr wait
|
|
|
|
|
|
|
|
|
|
|
|
jmp game_loop
|
|
|
|
|
|
|
|
oops_new_location:
|
2021-12-13 03:29:36 +00:00
|
|
|
|
|
|
|
; new location but same file
|
|
|
|
|
|
|
|
lda MAP_LOCATION
|
|
|
|
cmp #LOCATION_CLIFF_HEIGHTS
|
|
|
|
bne not_the_cliff
|
|
|
|
|
|
|
|
lda PREVIOUS_LOCATION
|
|
|
|
cmp #LOCATION_TROGDOR_OUTER
|
|
|
|
beq to_cliff_from_outer
|
|
|
|
|
|
|
|
to_cliff_from_cliff:
|
|
|
|
lda #18
|
|
|
|
sta PEASANT_X
|
|
|
|
lda #140
|
|
|
|
sta PEASANT_Y
|
|
|
|
bne not_the_cliff ; bra
|
|
|
|
|
|
|
|
to_cliff_from_outer:
|
|
|
|
lda #32
|
|
|
|
sta PEASANT_X
|
|
|
|
lda #120
|
|
|
|
sta PEASANT_Y
|
|
|
|
bne not_the_cliff ; bra
|
|
|
|
|
|
|
|
not_the_cliff:
|
|
|
|
|
|
|
|
lda MAP_LOCATION
|
|
|
|
cmp #LOCATION_TROGDOR_OUTER
|
|
|
|
bne not_outer
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
sta PEASANT_X
|
|
|
|
lda #100
|
|
|
|
sta PEASANT_Y
|
|
|
|
|
|
|
|
not_outer:
|
|
|
|
just_go_there:
|
|
|
|
|
2021-10-04 02:28:27 +00:00
|
|
|
jmp new_location
|
|
|
|
|
|
|
|
|
|
|
|
;************************
|
|
|
|
; exit level
|
|
|
|
;************************
|
2021-12-13 03:29:36 +00:00
|
|
|
level_over:
|
|
|
|
|
2021-12-18 16:11:28 +00:00
|
|
|
; new location
|
|
|
|
; in theory this can only be TROGDOR
|
|
|
|
|
|
|
|
lda #4
|
|
|
|
sta PEASANT_X
|
|
|
|
lda #170
|
|
|
|
sta PEASANT_Y
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta PEASANT_XADD
|
|
|
|
sta PEASANT_YADD
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2021-10-21 03:21:00 +00:00
|
|
|
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
.include "draw_peasant.s"
|
2021-12-28 21:45:19 +00:00
|
|
|
.include "move_peasant.s"
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
.include "gr_copy.s"
|
|
|
|
|
|
|
|
.include "new_map_location.s"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.include "keyboard.s"
|
|
|
|
|
|
|
|
.include "wait.s"
|
|
|
|
.include "wait_a_bit.s"
|
|
|
|
|
|
|
|
.include "version.inc"
|
2021-10-21 03:21:00 +00:00
|
|
|
|
2021-10-04 02:28:27 +00:00
|
|
|
|
|
|
|
.include "graphics_cliff/cliff_graphics.inc"
|
|
|
|
.include "graphics_cliff/priority_cliff.inc"
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
map_backgrounds_low:
|
|
|
|
.byte <cliff_base_lzsa
|
2021-10-28 04:50:19 +00:00
|
|
|
.byte <cliff_heights_lzsa
|
2021-10-28 14:07:18 +00:00
|
|
|
.byte <outer_lzsa
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
map_backgrounds_hi:
|
|
|
|
.byte >cliff_base_lzsa
|
2021-10-28 04:50:19 +00:00
|
|
|
.byte >cliff_heights_lzsa
|
2021-10-28 14:07:18 +00:00
|
|
|
.byte >outer_lzsa
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
map_priority_low:
|
|
|
|
.byte <cliff_base_priority_lzsa
|
2021-10-28 04:50:19 +00:00
|
|
|
.byte <cliff_heights_priority_lzsa
|
2021-10-28 14:07:18 +00:00
|
|
|
.byte <outer_priority_lzsa
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
map_priority_hi:
|
|
|
|
.byte >cliff_base_priority_lzsa
|
2021-10-28 04:50:19 +00:00
|
|
|
.byte >cliff_heights_priority_lzsa
|
2021-10-28 14:07:18 +00:00
|
|
|
.byte >outer_priority_lzsa
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
verb_tables_low:
|
2021-10-28 17:57:48 +00:00
|
|
|
.byte <cliff_base_verb_table
|
|
|
|
.byte <cliff_heights_verb_table
|
|
|
|
.byte <cave_outer_verb_table
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
verb_tables_hi:
|
2021-10-28 17:57:48 +00:00
|
|
|
.byte >cliff_base_verb_table
|
|
|
|
.byte >cliff_heights_verb_table
|
|
|
|
.byte >cave_outer_verb_table
|
|
|
|
|
2021-10-27 19:52:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
cliff_text_lzsa:
|
|
|
|
.incbin "DIALOG_CLIFF.LZSA"
|
|
|
|
|
|
|
|
.include "cliff_actions.s"
|