dos33fsprogs/games/peasant/peasant1.s

334 lines
5.8 KiB
ArmAsm
Raw Normal View History

; Peasant's Quest
; Peasantry Part 1 (top line of map)
2021-10-21 05:18:02 +00:00
2021-09-29 20:13:38 +00:00
; Gary, Kerrek 1, Well, Yellow Tree, Waterfall
2021-08-15 04:23:41 +00:00
; by Vince `deater` Weaver vince@deater.net
; with apologies to everyone
.include "hardware.inc"
.include "zp.inc"
.include "qload.inc"
.include "inventory.inc"
2021-10-21 05:18:02 +00:00
.include "parse_input.inc"
LOCATION_BASE = LOCATION_POOR_GARY ; index starts here (0)
2021-10-21 05:18:02 +00:00
peasantry1:
2021-08-15 04:23:41 +00:00
2021-08-15 05:12:43 +00:00
lda #0
sta LEVEL_OVER
sta FRAME
2021-08-15 04:23:41 +00:00
2021-10-21 05:18:02 +00:00
jsr hgr_make_tables ; necessary?
jsr hgr2 ; necessary?
2021-08-15 04:23:41 +00:00
2021-10-21 05:18:02 +00:00
; decompress dialog to $d000
lda #<peasant1_text_lzsa
sta getsrc_smc+1
lda #>peasant1_text_lzsa
sta getsrc_smc+2
2021-08-15 04:23:41 +00:00
2021-10-21 05:18:02 +00:00
lda #$D0
jsr decompress_lzsa2_fast
2021-08-15 04:23:41 +00:00
2021-08-29 03:05:36 +00:00
; update score
jsr update_score
;=============================
;=============================
; new screen location
;=============================
;=============================
new_location:
lda #0
sta LEVEL_OVER
2021-10-21 05:18:02 +00:00
;==========================
; load updated verb table
;==========================
; setup default verb table
jsr setup_default_verb_table
2021-10-21 05:18:02 +00:00
; we are PEASANT1 so locations 0...4 map to 0...4
ldx MAP_LOCATION
lda verb_tables_low,X
sta INL
lda verb_tables_hi,X
sta INH
jsr load_custom_verb_table
;===========================
; load priority to $400
; indirectly as we can't trash screen holes
2021-08-15 04:23:41 +00:00
ldx MAP_LOCATION
lda map_priority_low,X
2021-08-15 04:23:41 +00:00
sta getsrc_smc+1
lda map_priority_hi,X
2021-08-15 04:23:41 +00:00
sta getsrc_smc+2
lda #$20 ; temporarily load to $2000
2021-08-15 04:23:41 +00:00
jsr decompress_lzsa2_fast
; copy to $400
jsr gr_copy_to_page1
2021-08-24 17:38:03 +00:00
;=====================
; load bg
; we are PEASANT1 so locations 0...4 map to 0...4, no change
2021-08-24 17:38:03 +00:00
ldx MAP_LOCATION
lda map_backgrounds_low,X
2021-08-24 17:38:03 +00:00
sta getsrc_smc+1
lda map_backgrounds_hi,X
2021-08-24 17:38:03 +00:00
sta getsrc_smc+2
lda #$20
2021-08-24 17:38:03 +00:00
jsr decompress_lzsa2_fast
; copy to $4000
2021-08-24 17:38:03 +00:00
jsr hgr_copy
2021-08-24 17:38:03 +00:00
; put peasant text
2021-08-15 04:23:41 +00:00
lda #<peasant_text
sta OUTL
lda #>peasant_text
sta OUTH
jsr hgr_put_string
; put score
2021-08-29 03:05:36 +00:00
jsr print_score
2021-08-15 04:23:41 +00:00
2021-11-21 06:16:03 +00:00
2021-12-06 03:57:18 +00:00
2021-11-21 06:16:03 +00:00
;====================
; handle kerrek
;====================
; clear out old state otherwise kerrek can follow us around
lda #0
sta KERREK_STATE
2021-11-21 06:16:03 +00:00
lda MAP_LOCATION
cmp #LOCATION_KERREK_1
bne not_kerrek
jsr kerrek_setup
2021-11-21 06:16:03 +00:00
not_kerrek:
2021-08-15 04:23:41 +00:00
;====================
; save background
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
;=======================
; draw initial peasant
jsr save_bg_1x28
2021-08-15 05:19:26 +00:00
2021-08-15 04:23:41 +00:00
jsr draw_peasant
2021-12-06 03:57:18 +00:00
;===================
; check hay
jsr check_haystack_exit
2021-08-15 04:23:41 +00:00
game_loop:
2021-08-24 17:52:11 +00:00
jsr move_peasant
2021-08-15 04:23:41 +00:00
inc FRAME
jsr check_keyboard
2021-12-26 23:51:08 +00:00
; FIXME: draw kerrek before peasant if behind him
2021-12-24 06:00:22 +00:00
jsr kerrek_draw
2021-12-26 23:51:08 +00:00
jsr kerrek_move_and_check_collision
lda LEVEL_OVER
bmi oops_new_location
2021-08-15 05:12:43 +00:00
bne game_over
2021-08-15 05:19:26 +00:00
; delay
lda #200
jsr wait
2021-08-15 05:19:26 +00:00
2021-08-15 04:23:41 +00:00
jmp game_loop
;====================
; end of level
oops_new_location:
; special case if leaving with baby in well
; trouble though, by this point MAP_LOCATION is the new one?
lda PREVIOUS_LOCATION
cmp #LOCATION_OLD_WELL
bne skip_level_specific
at_old_well:
lda GAME_STATE_0
and #BABY_IN_WELL
beq skip_level_specific
ldx #<well_leave_baby_in_well_message
ldy #>well_leave_baby_in_well_message
jsr finish_parse_message
lda #LOAD_GAME_OVER
sta WHICH_LOAD
lda #NEW_FROM_DISK ; needed?
sta LEVEL_OVER
jmp game_over
skip_level_specific:
jmp new_location
2021-08-15 04:23:41 +00:00
2021-08-15 05:12:43 +00:00
;************************
; exit level
2021-08-15 05:12:43 +00:00
;************************
game_over:
rts
2021-12-06 03:57:18 +00:00
.include "peasant_common.s"
;.include "inventory.s"
2021-08-15 04:23:41 +00:00
.include "draw_peasant.s"
2021-08-24 17:38:03 +00:00
.include "gr_copy.s"
.include "new_map_location.s"
2021-08-24 17:52:11 +00:00
.include "peasant_move.s"
;.include "parse_input.s"
2021-08-31 05:15:12 +00:00
;.include "score.s"
2021-08-29 03:05:36 +00:00
.include "keyboard.s"
.include "wait.s"
2021-08-15 04:23:41 +00:00
.include "wait_a_bit.s"
2021-08-24 03:02:23 +00:00
.include "version.inc"
2021-12-24 06:00:22 +00:00
.include "hgr_sprite.s"
; Moved to qload
;.include "decompress_fast_v2.s"
;.include "hgr_font.s"
;.include "draw_box.s"
;.include "hgr_rectangle.s"
;.include "hgr_1x28_sprite_mask.s"
;.include "hgr_1x5_sprite.s"
;.include "hgr_partial_save.s"
;.include "hgr_input.s"
;.include "hgr_tables.s"
;.include "hgr_text_box.s"
;.include "clear_bottom.s"
;.include "hgr_hgr2.s"
;.include "wait_keypress.s"
;.include "loadsave_menu.s"
.include "hgr_copy.s"
2021-10-13 21:42:07 +00:00
;.include "text/peasant1.inc"
2021-08-15 05:12:43 +00:00
.include "graphics_peasantry/graphics_peasant1.inc"
map_backgrounds_low:
2021-08-22 05:47:52 +00:00
.byte <gary_lzsa ; 0 -- gary the horse
.byte <top_prints_lzsa ; 1 -- top footprints
.byte <wishing_well_lzsa ; 2 -- wishing well
2021-08-22 05:47:52 +00:00
.byte <leaning_tree_lzsa ; 3 -- leaning tree
2021-08-17 04:04:04 +00:00
.byte <waterfall_lzsa ; 4 -- waterfall
map_backgrounds_hi:
2021-08-22 05:47:52 +00:00
.byte >gary_lzsa ; 0 -- gary the horse
.byte >top_prints_lzsa ; 1 -- top footprints
.byte >wishing_well_lzsa ; 2 -- wishing well
2021-08-22 05:47:52 +00:00
.byte >leaning_tree_lzsa ; 3 -- leaning tree
2021-08-17 04:04:04 +00:00
.byte >waterfall_lzsa ; 4 -- waterfall
2021-08-24 17:38:03 +00:00
.include "graphics_peasantry/priority_peasant1.inc"
2021-08-24 17:38:03 +00:00
map_priority_low:
.byte <gary_priority_lzsa ; 0 -- gary the horse
.byte <top_prints_priority_lzsa ; 1 -- top footprints
.byte <wishing_well_priority_lzsa ; 2 -- wishing well
.byte <leaning_tree_priority_lzsa ; 3 -- leaning tree
.byte <waterfall_priority_lzsa ; 4 -- waterfall
map_priority_hi:
.byte >gary_priority_lzsa ; 0 -- gary the horse
.byte >top_prints_priority_lzsa ; 1 -- top footprints
.byte >wishing_well_priority_lzsa ; 2 -- wishing well
.byte >leaning_tree_priority_lzsa ; 3 -- leaning tree
.byte >waterfall_priority_lzsa ; 4 -- waterfall
2021-10-13 21:42:07 +00:00
2021-10-21 05:18:02 +00:00
verb_tables_low:
.byte <gary_verb_table ; 0 -- gary the horse
2021-10-24 01:14:29 +00:00
.byte <kerrek_verb_table ; 1 -- top footprints
.byte <wishing_well_verb_table ; 2 -- wishing well
2021-10-23 14:36:03 +00:00
.byte <yellow_tree_verb_table ; 3 -- leaning tree
2021-10-23 13:22:18 +00:00
.byte <waterfall_verb_table ; 4 -- waterfall
2021-10-21 05:18:02 +00:00
verb_tables_hi:
.byte >gary_verb_table ; 0 -- gary the horse
2021-10-24 01:14:29 +00:00
.byte >kerrek_verb_table ; 1 -- top footprints
.byte >wishing_well_verb_table ; 2 -- wishing well
2021-10-23 14:36:03 +00:00
.byte >yellow_tree_verb_table ; 3 -- leaning tree
2021-10-23 13:22:18 +00:00
.byte >waterfall_verb_table ; 4 -- waterfall
2021-10-21 05:18:02 +00:00
peasant1_text_lzsa:
.incbin "DIALOG_PEASANT1.LZSA"
.include "peasant1_actions.s"