diff --git a/games/peasant/Makefile b/games/peasant/Makefile index 35fcfb53..f18ec2f9 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -317,7 +317,7 @@ peasant1.o: peasant1.s zp.inc inventory.inc \ parse_input.inc \ peasant1_actions.s DIALOG_PEASANT1.LZSA dialog_peasant1.inc \ text/peasant1.inc text/kerrek.inc \ - kerrek_actions.s \ + kerrek_actions.s peasant_common.s \ sprites/peasant_sprites.inc sprites/inventory_sprites.inc \ graphics_peasantry/graphics_peasant1.inc \ graphics_peasantry/priority_peasant1.inc \ @@ -339,6 +339,7 @@ peasant2.o: peasant2.s zp.inc inventory.inc \ graphics_peasantry/graphics_peasant2.inc sprites/peasant_sprites.inc \ graphics_peasantry/priority_peasant2.inc \ sprites/inventory_sprites.inc \ + peasant_common.s \ draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \ wait_a_bit.s draw_peasant.s hgr_text_box.s \ @@ -356,6 +357,7 @@ peasant3.o: peasant3.s zp.inc inventory.inc \ peasant3_actions.s DIALOG_PEASANT3.LZSA dialog_peasant3.inc \ graphics_peasantry/graphics_peasant3.inc sprites/peasant_sprites.inc \ graphics_peasantry/priority_peasant3.inc \ + peasant_common.s \ draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ hgr_1x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \ wait_a_bit.s draw_peasant.s hgr_text_box.s \ @@ -372,7 +374,7 @@ peasant4.o: peasant4.s zp.inc inventory.inc \ parse_input.inc \ sprites/ned_sprites.inc \ peasant4_actions.s DIALOG_PEASANT4.LZSA dialog_peasant4.inc \ - kerrek_actions.s \ + kerrek_actions.s peasant_common.s \ text/peasant4.inc text/kerrek.inc \ graphics_peasantry/graphics_peasant4.inc sprites/peasant_sprites.inc \ graphics_peasantry/priority_peasant4.inc \ @@ -511,6 +513,7 @@ parse_input.inc: generate_common parse_input ./generate_common -a 0xee00 -s parse_common_save parse_input.lst >> parse_input.inc ./generate_common -a 0xee00 -s get_noun_again parse_input.lst >> parse_input.inc ./generate_common -a 0xee00 -s parse_input_smc parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s hay_blown_away_message parse_input.lst >> parse_input.inc ### diff --git a/games/peasant/parse_input.s b/games/peasant/parse_input.s index c531b067..d4bef3b3 100644 --- a/games/peasant/parse_input.s +++ b/games/peasant/parse_input.s @@ -7,6 +7,8 @@ .include "tokens.inc" +parse_input_file_begin: + ;========================== ; parse input @@ -1299,3 +1301,10 @@ common_verb_table: .byte VERB_WHY .word parse_common_why-1 .byte 0 + +parse_input_file_end: + +; make sure smaller than 4.5k + +.assert (>parse_input_file_end - >parse_input_file_begin) < 18 , error, "peasant1 dialog too big" + diff --git a/games/peasant/peasant1.s b/games/peasant/peasant1.s index a65ea401..1e1b475b 100644 --- a/games/peasant/peasant1.s +++ b/games/peasant/peasant1.s @@ -123,6 +123,7 @@ new_location: + ;==================== ; handle kerrek @@ -150,6 +151,12 @@ not_kerrek: jsr draw_peasant + ;=================== + ; check hay + + jsr check_haystack_exit + + game_loop: jsr move_peasant @@ -213,7 +220,7 @@ game_over: rts - +.include "peasant_common.s" ;.include "inventory.s" diff --git a/games/peasant/peasant2.s b/games/peasant/peasant2.s index cae51f93..6ca2728c 100644 --- a/games/peasant/peasant2.s +++ b/games/peasant/peasant2.s @@ -146,6 +146,11 @@ new_location: jsr draw_peasant + ;====================== + ; check if in hay + + jsr check_haystack_exit + ;===================== ; special archery @@ -340,6 +345,8 @@ to_left: rts +.include "peasant_common.s" + .include "draw_peasant.s" .include "gr_copy.s" diff --git a/games/peasant/peasant2_actions.s b/games/peasant/peasant2_actions.s index da368813..4707b04d 100644 --- a/games/peasant/peasant2_actions.s +++ b/games/peasant/peasant2_actions.s @@ -53,7 +53,17 @@ hay_get_hay: ;================= hay_bale_look: + ; first check if in hay + lda GAME_STATE_1 + and #IN_HAY_BALE + beq not_in_hay_bale + + ldx #hay_look_while_in_hay_message + jmp finish_parse_message + +not_in_hay_bale: lda CURRENT_NOUN cmp #NOUN_HAY diff --git a/games/peasant/peasant3.s b/games/peasant/peasant3.s index 7211d56e..8ac422d7 100644 --- a/games/peasant/peasant3.s +++ b/games/peasant/peasant3.s @@ -140,6 +140,11 @@ new_location: jsr draw_peasant + ;======================= + ; check if in hay + + jsr check_haystack_exit + ;======================= ; before game text @@ -226,7 +231,7 @@ game_over: rts - +.include "peasant_common.s" .include "draw_peasant.s" diff --git a/games/peasant/peasant3_actions.s b/games/peasant/peasant3_actions.s index 547a5176..a1956544 100644 --- a/games/peasant/peasant3_actions.s +++ b/games/peasant/peasant3_actions.s @@ -98,6 +98,11 @@ jhonka_get_kerrek_dead: ; else "probably wish" message jmp parse_common_get +jhonka_get_club: + ldx #jhonka_get_club_message + jmp finish_parse_message + jhonka_get_riches: lda GAME_STATE_1 @@ -115,6 +120,15 @@ jhonka_get_riches_in_hay: ldy #>jhonka_steal_riches_message jsr partial_message_step + ; exit hay bale + lda GAME_STATE_1 + and #<(~IN_HAY_BALE) + sta GAME_STATE_1 + ; no longer muddy + lda GAME_STATE_2 + and #<(~COVERED_IN_MUD) + sta GAME_STATE_2 + jhonka_wait_for_answer: jsr clear_bottom jsr hgr_input @@ -181,10 +195,7 @@ jhonka_verb_yes: jmp finish_parse_message -jhonka_get_club: - ldx #jhonka_get_club_message - jmp finish_parse_message + @@ -197,6 +208,18 @@ jhonka_get_club: jhonka_look: + ; first check if in hay + + lda GAME_STATE_1 + and #IN_HAY_BALE + beq not_in_hay_bale + + ldx #hay_look_while_in_hay_message + jmp finish_parse_message + +not_in_hay_bale: + ; check if kerrek alive lda KERREK_STATE and #$f diff --git a/games/peasant/peasant4.s b/games/peasant/peasant4.s index 180626f3..00fd1762 100644 --- a/games/peasant/peasant4.s +++ b/games/peasant/peasant4.s @@ -188,6 +188,13 @@ not_kerrek: jsr draw_peasant + + ;====================== + ; check if in haystack + + jsr check_haystack_exit + + game_loop: jsr move_peasant @@ -322,7 +329,7 @@ game_over: - +.include "peasant_common.s" .include "draw_peasant.s" diff --git a/games/peasant/peasant_common.s b/games/peasant/peasant_common.s new file mode 100644 index 00000000..c7ae5bd2 --- /dev/null +++ b/games/peasant/peasant_common.s @@ -0,0 +1,53 @@ +; some common actions that are needed in all the peasantry levels + +; + exiting hastack +; + kerrek body countdown +; + night-time count down +; + rain-storm count down + + + ;====================================================== + ; if start level and not in JHONKA_CAVE or HAY_BALE + ; then exit the hay bale, print message, do animation + +check_haystack_exit: + + ; fist see if in hay bale + + lda GAME_STATE_1 + and #IN_HAY_BALE + beq hay_bale_good + + lda MAP_LOCATION + cmp #LOCATION_JHONKA_CAVE + beq hay_bale_good + cmp #LOCATION_HAY_BALE + bne must_exit_hay + +hay_bale_good: + rts + + +must_exit_hay: + + ; exit hay bale + + lda GAME_STATE_1 + and #<(~IN_HAY_BALE) + sta GAME_STATE_1 + + ; no longer muddy + lda GAME_STATE_2 + and #<(~COVERED_IN_MUD) + sta GAME_STATE_2 + + ; print message + ldx #hay_blown_away_message + jsr partial_message_step + + ; TODO: show animation + + rts + + diff --git a/games/peasant/text/common.inc b/games/peasant/text/common.inc index 18b04c67..225113ab 100644 --- a/games/peasant/text/common.inc +++ b/games/peasant/text/common.inc @@ -8,9 +8,10 @@ inside_inn_pot_on_head_message: .byte "there before that smelly",13 .byte "octogenarian gets back.",0 -; TODO + ; After jumping in the haystack, go to any screen except Jhonka ; both hay and mud go away +hay_blown_away_message: .byte "Drat. The winds are heavy",13 .byte "on all but a couple of key",13 .byte "screens... looks like",13 @@ -226,14 +227,17 @@ look_irrelevant_message: .byte "You don't need to look at",13 .byte "that.",0 -; + look (at anything, while hiding inside the bale of hay) -.byte "Right now, you see a bunch of hay.",0 - ; + look (at something previously in your inventory but now gone) -.byte "You used to have one, before the great item blight of 402. Check your INVENTORY to read about it.",0 +.byte "You used to have one,",13 +.byte "before the great item",13 +.byte "blight of 402. Check your",13 +.byte "INVENTORY to read about it.",0 ; + look (at something currently in your inventory) -.byte "You've totally got one of those! Check your INVENTORY to give'r a serious looksee.",0 +.byte "You've totally got one of",13 +.byte "those! Check your",13 +.byte "INVENTORY to give'r a",13 +.byte "serious looksee.",0 ; + load ; + save diff --git a/games/peasant/text/peasant2.inc b/games/peasant/text/peasant2.inc index ed0da0a4..c67c8286 100644 --- a/games/peasant/text/peasant2.inc +++ b/games/peasant/text/peasant2.inc @@ -4,6 +4,11 @@ peasant2_dialog_start: ; That Hay Bale ;=============== +; + look (at anything, while hiding inside the bale of hay) +hay_look_while_in_hay_message: +.byte "Right now, you see a bunch",13 +.byte "of hay.",0 + ; + look hay_look_message: .byte "Well, there's that big bale",13 diff --git a/games/peasant/text/peasant3.inc b/games/peasant/text/peasant3.inc index fcd3db72..3efc59a5 100644 --- a/games/peasant/text/peasant3.inc +++ b/games/peasant/text/peasant3.inc @@ -4,6 +4,11 @@ peasant3_dialog_start: ; Jhonka cave ;============= +; + look (at anything, while hiding inside the bale of hay) +hay_look_while_in_hay_message: +.byte "Right now, you see a bunch",13 +.byte "of hay.",0 + ; + (walk in haystack) jhonka_in_hay_message: .byte "Hey, nice disguise! The",13