From 37e50c3ef381e47d3d615140332e0a7719d8e668 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 3 Oct 2021 22:28:27 -0400 Subject: [PATCH] peasant: add cliff location --- games/peasant/Makefile | 20 ++- games/peasant/cliff.s | 186 ++++++++++++++++++++++++++ games/peasant/graphics_cliff/Makefile | 21 ++- games/peasant/new_map_location.s | 10 +- games/peasant/qload.s | 10 +- games/peasant/text/common.inc | 8 +- games/peasant/zp.inc | 1 + 7 files changed, 243 insertions(+), 13 deletions(-) create mode 100644 games/peasant/cliff.s diff --git a/games/peasant/Makefile b/games/peasant/Makefile index 48e9f680..ae1de2d9 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -29,11 +29,12 @@ peasant.dsk: QBOOT QLOAD VID_LOGO TITLE INTRO COPY_CHECK \ $(DOS33_RAW) peasant.dsk 25 0 PEASANT3 0 0 $(DOS33_RAW) peasant.dsk 30 0 PEASANT4 0 0 -peasant_side2.dsk: WBOOT2 TROGDOR ENDING +peasant_side2.dsk: WBOOT2 TROGDOR ENDING CLIFF cp $(EMPTY_DISK)/empty.dsk peasant_side2.dsk $(DOS33_RAW) peasant_side2.dsk 0 0 WBOOT2 0 1 $(DOS33_RAW) peasant_side2.dsk 19 0 TROGDOR 0 0 $(DOS33_RAW) peasant_side2.dsk 24 0 ENDING 0 0 + $(DOS33_RAW) peasant_side2.dsk 29 0 CLIFF 0 0 ### @@ -194,6 +195,23 @@ music.o: music.s zp.inc \ ### +CLIFF: cliff.o + ld65 -o CLIFF cliff.o -C $(LINKER_SCRIPTS)/apple2_6000.inc + +cliff.o: cliff.s zp.inc \ + graphics_cliff/cliff_graphics.inc sprites/peasant_sprite.inc \ + graphics_cliff/priority_cliff.inc \ + draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ + hgr_7x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \ + wait_a_bit.s draw_peasant.s hgr_text_box.s \ + keyboard.s parse_input.s new_map_location.s \ + peasant_move.s score.s + ca65 -o cliff.o cliff.s -l cliff.lst + + +### + + PEASANT1: peasant1.o ld65 -o PEASANT1 peasant1.o -C $(LINKER_SCRIPTS)/apple2_6000.inc diff --git a/games/peasant/cliff.s b/games/peasant/cliff.s new file mode 100644 index 00000000..aeec6dfd --- /dev/null +++ b/games/peasant/cliff.s @@ -0,0 +1,186 @@ +; Peasant's Quest + +; Cliff Base + +WHICH_PEASANTRY=0 + +; by Vince `deater` Weaver vince@deater.net + +.include "hardware.inc" +.include "zp.inc" + +.include "qload.inc" + + +cliff_base: + lda #0 + sta GAME_OVER + sta FRAME + + jsr hgr_make_tables + + jsr hgr2 ; Hi-res graphics, no text at bottom + ; Y=0, A=0 after this called + + + ; update map location + +; jsr update_map_location + + ; update score + + jsr update_score + + ;============================= + ;============================= + ; new screen location + ;============================= + ;============================= + +new_location: + lda #0 + sta GAME_OVER + + ;===================== + ; load bg + + lda #cliff_base_lzsa + sta getsrc_smc+2 + + lda #$40 + + jsr decompress_lzsa2_fast + + ; load priority to $400 + ; indirectly as we can't trash screen holes + + lda #cliff_base_priority_lzsa + 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 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_7x28 + + jsr draw_peasant + +game_loop: + + jsr move_peasant + + inc FRAME + + jsr check_keyboard + + lda GAME_OVER + bmi oops_new_location + bne game_over + + + ; delay + + lda #200 + jsr wait + + + jmp game_loop + +oops_new_location: + jmp new_location + + + ;************************ + ; exit level + ;************************ +game_over: + + rts + + +.include "wait_keypress.s" + +.include "draw_peasant.s" + +.include "gr_copy.s" + +.include "new_map_location.s" + +.include "peasant_move.s" + +.include "parse_input.s" + +.include "inventory.s" + +.include "score.s" + +.include "keyboard.s" + +.include "wait.s" +.include "wait_a_bit.s" + +.include "version.inc" +.include "loadsave_menu.s" + + +; Moved to qload +;.include "decompress_fast_v2.s" +;.include "hgr_font.s" +;.include "draw_box.s" +;.include "hgr_rectangle.s" +;.include "hgr_7x28_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 "graphics_cliff/cliff_graphics.inc" + +.include "graphics_cliff/priority_cliff.inc" diff --git a/games/peasant/graphics_cliff/Makefile b/games/peasant/graphics_cliff/Makefile index f99d2db0..6b166117 100644 --- a/games/peasant/graphics_cliff/Makefile +++ b/games/peasant/graphics_cliff/Makefile @@ -5,8 +5,10 @@ PNG2HGR = ../../../utils/hgr-utils/png2hgr LZSA = ~/research/lzsa/lzsa/lzsa B2D = ../../../utils/bmp2dhr/b2d -all: cliff_graphics.inc +all: cliff_graphics.inc \ + priority_cliff.inc +### cliff_graphics.inc: \ cliff_base.lzsa @@ -22,7 +24,22 @@ cliff_base.hgr: cliff_base.png ### +priority_cliff.inc: \ + todo_priority.lzsa + echo "cliff_base_priority_lzsa: .incbin \"todo_priority.lzsa\"" > priority_cliff.inc + +#### + + +todo_priority.lzsa: todo_priority.gr + $(LZSA) -r -f2 todo_priority.gr todo_priority.lzsa + +todo_priority.gr: todo_priority.png + $(PNG2GR) todo_priority.png todo_priority.gr + +#### + clean: - rm -f *~ trogdor_graphics.inc *.lzsa *.gr *.hgr + rm -f *~ cliff_graphics.inc priority_cliff.inc *.lzsa *.gr *.hgr diff --git a/games/peasant/new_map_location.s b/games/peasant/new_map_location.s index 5471e37e..5d4fde1d 100644 --- a/games/peasant/new_map_location.s +++ b/games/peasant/new_map_location.s @@ -22,11 +22,15 @@ map_wrap_x: cmp #5 bcc map_wrap_y ; blt - lda #0 - beq update_map_x ; bra + lda #NEW_FROM_DISK + sta GAME_OVER + + lda #LOAD_CLIFF + sta WHICH_LOAD + rts map_x_went_negative: - lda #4 + lda #0 ; don't wrap anymore update_map_x: sta MAP_X diff --git a/games/peasant/qload.s b/games/peasant/qload.s index a4219c4c..a83b8e93 100644 --- a/games/peasant/qload.s +++ b/games/peasant/qload.s @@ -195,7 +195,7 @@ insert_disk_string: which_disk_array: .byte 1,1,1,1 ; VID_LOGO, TITLE, INTRO. COPY_CHECK .byte 1,1,1,1 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 - .byte 2,2,1,1 ; TROGDOR, ENDING, MUSIC + .byte 2,2,1,2 ; TROGDOR, ENDING, MUSIC, CLIFF .byte 1,1,1,1 ; .byte 1 ; .byte 1,1,1,1,1 ; SAVE1, SAVE2, SAVE3 @@ -204,7 +204,7 @@ which_disk_array: load_address_array: .byte $60,$60,$60,$60 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte $60,$60,$60,$60 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 - .byte $60,$60,$D0,$40 ; TROGDOR, ENDING, MUSIC + .byte $60,$60,$D0,$60 ; TROGDOR, ENDING, MUSIC, CLIFF .byte $40,$40,$40,$40 ; .byte $08 ; .byte $BC,$BC,$BC,$0A ; SAVE1, SAVE2, SAVE3 @@ -214,7 +214,7 @@ load_address_array: track_array: .byte 4, 6, 9,13 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte 15,20,25,30 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 - .byte 19,24, 3,20 ; TROGDOR, ENDING, MUSIC + .byte 19,24, 3,29 ; TROGDOR, ENDING, MUSIC, CLIFF .byte 30,32,28,30 ; .byte 0 ; .byte 0, 0, 0, 0, 0 ; SAVE1, SAVE2, SAVE3 @@ -223,7 +223,7 @@ track_array: sector_array: .byte 0, 0, 0, 0 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte 0, 0, 0, 0 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 - .byte 0, 0, 0, 0 ; TROGDOR, ENDING, MUSIC + .byte 0, 0, 0, 0 ; TROGDOR, ENDING, MUSIC, CLIFF .byte 0,13, 0, 1 ; .byte 6 ; .byte 11,12,13,14,15 ; SAVE1, SAVE2, SAVE3 @@ -232,7 +232,7 @@ sector_array: length_array: .byte 32, 50, 60, 20 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte 80, 80, 80, 80 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 - .byte 80, 80, 16,109 ; TROGDOR, ENDING, MUSIC + .byte 80, 80, 16, 80 ; TROGDOR, ENDING, MUSIC, CLIFF .byte 20, 33, 27, 78 ; .byte 3 ; .byte 1,1,1,1,1 ; SAVE1, SAVE2, SAVE3 diff --git a/games/peasant/text/common.inc b/games/peasant/text/common.inc index 2bdab352..382efac1 100644 --- a/games/peasant/text/common.inc +++ b/games/peasant/text/common.inc @@ -73,8 +73,12 @@ drink_message2: ; + what the f- / this sucks .byte "Come now. Don't get discouraged.",0 -; + where -.byte "You're hanging out in {location}.",0 + +; + where (offset 21) +where_label: +.byte "You're hanging out in",13 +.byte " ",0 + ; + why .byte "I wish I knew.",0 ; + haldo diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index 5d45549f..1dc56b37 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -232,6 +232,7 @@ LOAD_PEASANT4 = 7 LOAD_TROGDOR = 8 LOAD_ENDING = 9 LOAD_MUSIC = 10 +LOAD_CLIFF = 11 LOAD_SAVE1 = 17 LOAD_SAVE2 = 18