2021-11-05 15:18:29 -04:00
|
|
|
; Peasant's Quest
|
|
|
|
|
|
|
|
; Archery Minigame
|
|
|
|
|
|
|
|
; by Vince `deater` Weaver vince@deater.net
|
|
|
|
|
|
|
|
.include "hardware.inc"
|
|
|
|
.include "zp.inc"
|
|
|
|
|
|
|
|
.include "qload.inc"
|
|
|
|
.include "inventory.inc"
|
|
|
|
.include "parse_input.inc"
|
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
LOCATION_BASE = LOCATION_ARCHERY ; (28)
|
2021-11-05 15:18:29 -04:00
|
|
|
|
|
|
|
archery:
|
|
|
|
lda #0
|
|
|
|
sta LEVEL_OVER
|
|
|
|
sta FRAME
|
|
|
|
|
|
|
|
jsr hgr_make_tables
|
|
|
|
jsr hgr2
|
|
|
|
|
|
|
|
;=============================
|
|
|
|
;=============================
|
|
|
|
; new screen location
|
|
|
|
;=============================
|
|
|
|
;=============================
|
|
|
|
|
|
|
|
new_location:
|
|
|
|
lda #0
|
|
|
|
sta LEVEL_OVER
|
|
|
|
|
|
|
|
;=====================
|
|
|
|
; load bg
|
|
|
|
|
|
|
|
lda MAP_LOCATION
|
|
|
|
sec
|
|
|
|
sbc #LOCATION_BASE
|
|
|
|
tax
|
|
|
|
|
|
|
|
lda #<target_lzsa
|
|
|
|
sta getsrc_smc+1
|
|
|
|
lda #>target_lzsa
|
|
|
|
sta getsrc_smc+2
|
|
|
|
|
|
|
|
lda #$40
|
|
|
|
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
|
|
|
; put peasant text
|
|
|
|
|
|
|
|
; lda #<peasant_text
|
|
|
|
; sta OUTL
|
|
|
|
; lda #>peasant_text
|
|
|
|
; sta OUTH
|
|
|
|
|
|
|
|
; jsr hgr_put_string
|
|
|
|
|
|
|
|
; put score
|
|
|
|
|
|
|
|
; jsr print_score
|
|
|
|
|
|
|
|
;=====================
|
|
|
|
; move peasant
|
|
|
|
; FIXME: don't do this if loading game
|
|
|
|
|
|
|
|
; lda #20
|
|
|
|
; sta PEASANT_X
|
|
|
|
; lda #150
|
|
|
|
; sta PEASANT_Y
|
|
|
|
|
|
|
|
;====================
|
|
|
|
; save background
|
|
|
|
|
|
|
|
; lda PEASANT_X
|
|
|
|
; sta CURSOR_X
|
|
|
|
; lda PEASANT_Y
|
|
|
|
; sta CURSOR_Y
|
|
|
|
|
|
|
|
;=======================
|
|
|
|
; draw initial peasant
|
|
|
|
|
|
|
|
; jsr save_bg_1x28
|
|
|
|
|
|
|
|
; jsr draw_peasant
|
|
|
|
|
|
|
|
game_loop:
|
|
|
|
|
|
|
|
; jsr move_peasant
|
|
|
|
|
|
|
|
inc FRAME
|
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
bit KEYRESET
|
2021-11-05 15:18:29 -04:00
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
jsr wait_until_keypress
|
|
|
|
|
2021-11-20 00:17:47 -05:00
|
|
|
; lda #$30 ; got 0 of 3
|
|
|
|
; lda #$31 ; got 1 of 3
|
|
|
|
lda #$33 ; got 3 of 3
|
|
|
|
sta ARROW_SCORE
|
|
|
|
|
|
|
|
lda ARROW_SCORE
|
|
|
|
ora #ARROW_DONE
|
|
|
|
sta ARROW_SCORE
|
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
lda #LOCATION_ARCHERY
|
|
|
|
jmp update_map_location
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; jsr check_keyboard
|
|
|
|
|
|
|
|
; lda LEVEL_OVER
|
|
|
|
; bmi oops_new_location
|
|
|
|
; bne game_over
|
2021-11-05 15:18:29 -04:00
|
|
|
|
|
|
|
|
|
|
|
; delay
|
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
; lda #200
|
|
|
|
; jsr wait
|
2021-11-05 15:18:29 -04:00
|
|
|
|
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
; jmp game_loop
|
2021-11-05 15:18:29 -04:00
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
;oops_new_location:
|
|
|
|
; jmp new_location
|
2021-11-05 15:18:29 -04:00
|
|
|
|
|
|
|
|
|
|
|
;************************
|
|
|
|
; exit level
|
|
|
|
;************************
|
|
|
|
game_over:
|
2021-11-20 00:17:47 -05:00
|
|
|
lda ARROW_SCORE
|
|
|
|
ora #ARROW_DONE
|
|
|
|
sta ARROW_SCORE
|
2021-11-05 15:18:29 -04:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
;.include "draw_peasant.s"
|
2021-11-05 15:18:29 -04:00
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
;.include "gr_copy.s"
|
2021-11-05 15:18:29 -04:00
|
|
|
|
|
|
|
.include "new_map_location.s"
|
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
;.include "peasant_move.s"
|
2021-11-05 15:18:29 -04:00
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
;.include "score.s"
|
2021-11-05 15:18:29 -04:00
|
|
|
|
2021-11-07 14:05:46 -05:00
|
|
|
;.include "keyboard.s"
|
2021-11-05 15:18:29 -04:00
|
|
|
|
|
|
|
.include "wait.s"
|
|
|
|
.include "wait_a_bit.s"
|
|
|
|
|
|
|
|
.include "graphics_archery/archery_graphics.inc"
|
|
|
|
|
|
|
|
|