peasant: start hooking up Kerrek

This commit is contained in:
Vince Weaver 2021-11-21 01:16:03 -05:00
parent 2dd67c71c1
commit 9b09cb0f93
13 changed files with 415 additions and 67 deletions

View File

@ -310,6 +310,7 @@ PEASANT1: peasant1.o
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 \
sprites/peasant_sprites.inc sprites/inventory_sprites.inc \
graphics_peasantry/graphics_peasant1.inc \
@ -366,6 +367,7 @@ peasant4.o: peasant4.s zp.inc inventory.inc \
sprites/ned_sprites.inc \
peasant4_actions.s DIALOG_PEASANT4.LZSA dialog_peasant4.inc \
kerrek_actions.s \
text/peasant4.inc text/kerrek.inc \
graphics_peasantry/graphics_peasant4.inc sprites/peasant_sprites.inc \
graphics_peasantry/priority_peasant4.inc \
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
@ -499,6 +501,8 @@ parse_input.inc: generate_common parse_input
./generate_common -a 0xee00 -s parse_common_look parse_input.lst >> parse_input.inc
./generate_common -a 0xee00 -s parse_common_get parse_input.lst >> parse_input.inc
./generate_common -a 0xee00 -s parse_common_climb parse_input.lst >> parse_input.inc
./generate_common -a 0xee00 -s parse_common_load parse_input.lst >> parse_input.inc
./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

View File

@ -1,3 +1,78 @@
; notes
; walk into footprint land
; if kerrek alive
; odds of kerrek there are ??? 50/50?
; if kerrek dead
; if dead on this screen
; if dead not on this screen
kerrek_setup:
; first see if Kerrek alive
lda KERREK_STATE
and #$f
bne kerrek_setup_dead
kerrek_setup_alive:
jsr random16
and #$1
beq kerrek_alive_not_there
kerrek_alive_out:
lda #20
sta KERREK_X
lda #100
sta KERREK_Y
lda #0
sta KERREK_DIRECTION
lda #1
sta KERREK_SPEED
lda MAP_LOCATION
cmp #LOCATION_KERREK_1
bne kerrek_there
lda KERREK_STATE
ora #KERREK_ROW1
sta KERREK_STATE
kerrek_there:
lda KERREK_STATE
ora #KERREK_ONSCREEN
sta KERREK_STATE
rts
kerrek_alive_not_there:
kerrek_not_there:
lda KERREK_STATE
and #(~KERREK_ONSCREEN)
sta KERREK_STATE
rts
kerrek_setup_dead:
; see if on this screen
lda KERREK_STATE
and #KERREK_ROW1
beq kerrek_row4
kerrek_row1:
lda MAP_LOCATION
cmp #LOCATION_KERREK_1
beq kerrek_there
bne kerrek_not_there
kerrek_row4:
lda MAP_LOCATION
cmp #LOCATION_KERREK_2
beq kerrek_there
bne kerrek_not_there
rts
;=======================
;=======================
;=======================
@ -7,10 +82,123 @@
;=======================
kerrek_verb_table:
.byte VERB_LOAD
.word kerrek_load-1
.byte VERB_SAVE
.word kerrek_save-1
.byte VERB_LOOK
.word kerrek_look-1
.byte VERB_SHOOT
.word kerrek_shoot-1
.byte VERB_KILL
.word kerrek_kill-1
.byte VERB_TALK
.word kerrek_talk-1
.byte VERB_MAKE
.word kerrek_make-1
.byte VERB_BUY
.word kerrek_buy-1
.byte 0
;=================
; buy
;=================
kerrek_buy:
lda CURRENT_NOUN
cmp #NOUN_KERREK
bne kerrek_buy_not_there
lda KERREK_STATE
bpl kerrek_buy_not_there
lda KERREK_STATE
and #$f
bne kerrek_buy_not_there
inc KERREK_SPEED
ldx #<kerrek_buy_cold_one_message
ldy #>kerrek_buy_cold_one_message
jmp finish_parse_message
kerrek_buy_not_there:
jmp parse_common_unknown
;=================
; make
;=================
kerrek_make:
lda CURRENT_NOUN
cmp #NOUN_KERREK
bne kerrek_make_not_there
lda KERREK_STATE
bpl kerrek_make_not_there
lda KERREK_STATE
and #$f
bne kerrek_make_not_there
ldx #<kerrek_make_friends_message
ldy #>kerrek_make_friends_message
jmp finish_parse_message
kerrek_make_not_there:
jmp parse_common_unknown
;=================
; talk
;=================
kerrek_talk:
lda CURRENT_NOUN
cmp #NOUN_KERREK
bne kerrek_talk_not_there
lda KERREK_STATE
bpl kerrek_talk_not_there
lda KERREK_STATE
and #$f
bne kerrek_talk_not_there
kerrek_there_talk:
ldx #<kerrek_talk_message
ldy #>kerrek_talk_message
jmp finish_parse_message
kerrek_talk_not_there:
jmp parse_common_talk
;=================
; load/save
;=================
kerrek_load:
lda KERREK_STATE
bmi kerrek_load_there
jmp parse_common_load
kerrek_load_there:
ldx #<kerrek_load_save_message
ldy #>kerrek_load_save_message
jmp finish_parse_message
kerrek_save:
lda KERREK_STATE
bmi kerrek_load_there
jmp parse_common_save
;=================
; kill/shoot
;=================
kerrek_kill:
kerrek_shoot:
rts
;=================
; look
;=================
@ -19,13 +207,47 @@ kerrek_look:
lda CURRENT_NOUN
cmp #NOUN_FOOTPRINTS
beq kerrek_look_footprints
cmp #NOUN_TRACKS
beq kerrek_look_tracks
cmp #NOUN_NONE
beq kerrek_look_at
jmp parse_common_look
kerrek_look_at:
ldx #<kerrek_look_at_message
ldy #>kerrek_look_at_message
lda KERREK_STATE
bmi kerrek_look_none_kerrek
kerrek_look_none_no_kerrek:
lda KERREK_STATE
and #$f
beq kerrek_look_none_kerrek_alive
kerrek_look_none_kerrek_dead:
ldx #<kerrek_look_no_dead_kerrek_message
ldy #>kerrek_look_no_dead_kerrek_message
jmp finish_parse_message
kerrek_look_none_kerrek_alive:
ldx #<kerrek_look_no_kerrek_message
ldy #>kerrek_look_no_kerrek_message
jmp finish_parse_message
kerrek_look_none_kerrek:
ldx #<kerrek_look_kerrek_message
ldy #>kerrek_look_kerrek_message
jmp finish_parse_message
kerrek_look_tracks:
kerrek_look_footprints:
lda KERREK_STATE
bpl kerrek_look_none_kerrek
ldx #<kerrek_look_footprints_message
ldy #>kerrek_look_footprints_message
jmp finish_parse_message

View File

@ -514,9 +514,9 @@ parse_common_where:
lda location_names_h,X
sta INH
lda #<(where_message+22)
lda #<(where_message_offset)
sta OUTL
lda #>(where_message+22)
lda #>(where_message_offset)
sta OUTH
ldy #0

View File

@ -121,6 +121,20 @@ new_location:
jsr print_score
;====================
; handle kerrek
lda MAP_LOCATION
cmp #LOCATION_KERREK_1
bne not_kerrek
jsr kerrek_setup
not_kerrek:
;====================
; save background

View File

@ -154,10 +154,25 @@ not_necessary_cottage:
jsr hgr_put_string
;==============
; put score
jsr print_score
;====================
; handle kerrek
lda MAP_LOCATION
cmp #LOCATION_KERREK_2
bne not_kerrek
jsr kerrek_setup
not_kerrek:
;====================
; save background

View File

@ -12,7 +12,7 @@
.byte 0 ; MAP_X = $94
.byte 1 ; MAP_Y = $95
.byte LOCATION_ARCHERY ; MAP_LOCATION = $96
.byte GARY_SCARED|TALKED_TO_MENDELEV|HALDO_TO_DONGOLEV
.byte GARY_SCARED|TALKED_TO_MENDELEV|HALDO_TO_DONGOLEV|ARROW_BEATEN|TRINKET_GIVEN
; GAME_STATE_0 = $97
.byte $00 ; GAME_STATE_1 = $98
.byte TALKED_TO_KNIGHT
@ -23,12 +23,13 @@
.byte $00 ; ARROW_SCORE = $9D
.byte $00 ; SCORE_HUNDREDS= $9E
.byte $20 ; SCORE_TENSONES= $9F
.byte INV1_MONSTER_MASK|INV1_PEBBLES|INV1_ARROW
.byte INV1_MONSTER_MASK|INV1_PEBBLES|INV1_ARROW|INV1_BOW
; INVENTORY_1 = $A0
.byte INV2_TRINKET ; INVENTORY_2 = $A1
.byte INV3_SHIRT|INV3_MAP
; INVENTORY_3 = $A2
.byte INV1_PEBBLES
; INVENTORY_1_GONE = $A3
.byte $00 ; INVENTORY_2_GONE_= $A4
.byte INV2_TRINKET
; INVENTORY_2_GONE_= $A4
.byte $00 ; INVENTORY_3_GONE = $A5

View File

@ -0,0 +1,35 @@
; SAVE1 -- ??
.include "zp.inc"
; want to load this to address $90
;
.byte LOAD_PEASANT2 ; WHICH_LOAD = $90
.byte 10 ; PEASANT_X = $91
.byte 100 ; PEASANT_Y = $92
.byte PEASANT_DIR_UP ; PEASANT_DIR = $93
.byte 0 ; MAP_X = $94
.byte 1 ; MAP_Y = $95
.byte LOCATION_ARCHERY ; MAP_LOCATION = $96
.byte GARY_SCARED|TALKED_TO_MENDELEV|HALDO_TO_DONGOLEV|ARROW_BEATEN|TRINKET_GIVEN
; GAME_STATE_0 = $97
.byte $00 ; GAME_STATE_1 = $98
.byte TALKED_TO_KNIGHT
; GAME_STATE_2 = $99
.byte $00 ; NED_STATUS = $9A
.byte $00 ; BUSH_STATUS = $9B
.byte $00 ; KERREK_STATE = $9C
.byte $00 ; ARROW_SCORE = $9D
.byte $00 ; SCORE_HUNDREDS= $9E
.byte $20 ; SCORE_TENSONES= $9F
.byte INV1_MONSTER_MASK|INV1_PEBBLES|INV1_ARROW|INV1_BOW
; INVENTORY_1 = $A0
.byte INV2_TRINKET ; INVENTORY_2 = $A1
.byte INV3_SHIRT|INV3_MAP
; INVENTORY_3 = $A2
.byte INV1_PEBBLES
; INVENTORY_1_GONE = $A3
.byte INV2_TRINKET
; INVENTORY_2_GONE_= $A4
.byte $00 ; INVENTORY_3_GONE = $A5

View File

@ -3,10 +3,17 @@
;==================
; + get/wear belt (after getting it)
.byte "You're already wearing it. Too bad you smell like the trash barge off Peasant Isle.",0
.byte "You're already wearing it.",13
.byte "Too bad you smell like the",13
.byte "trash barge off Peasant",13
.byte "Isle.",0
; + wear mask (after getting it)
.byte "Not on this screen. You've got your image to think about. Actually, you might want to start deliberating on that right now.",0
.byte "Not on this screen. You've",13
.byte "got your image to think",13
.byte "about. Actually, you might",13
.byte "want to start deliberating",13
.byte "on that right now.",0
; +3 points
; + wear robe (after getting it)
@ -103,6 +110,7 @@ what_message:
; + where (offset 22)
where_message:
.byte "You're hanging out in",13
where_message_offset:
.byte " ",0
; + why

View File

@ -3,17 +3,27 @@
;================================================
; (Walk too close to the Kerrek) {The Kerrek pounds your head into the ground}
.byte "Your mom always told you not to take head poundings from strange Kerreks. And NOW looks what's happened. You dead. Thanks for playing.",0
.byte "Your mom always told you",13
.byte "not to take head poundings",13
.byte "from strange Kerreks. And",13
.byte "NOW looks what's happened.",13
.byte "You dead. Thanks for",13
.byte "playing.",0
; + 5 POINTS
; + kill kerrek
; + shoot Kerrek with bow
.byte "Here goes nothin', Kid",13
.byte "Icarus",0
; animation of shooting him, him falling
.byte "ARROWED!! Nice shot. You",13
.byte "smote the Kerrek! He lay",13
.byte "there stinking.",0
; pause
.byte "A light rain heralds the",13
.byte "washing free of the",13
.byte "Kerrek's grip on the land.",13
@ -22,6 +32,32 @@
.byte "artless symbolism doesn't",13
.byte "bug you.",0
; + kill kerrek (he is there, no bow or arrow)
.byte "With what?! You got no",13
.byte "weapons except your",13
.byte "butter-knife wit.",0
; + kill kerrek (he is there, you have arrow but not bow)
.byte "With what?! You gonna throw",13
.byte "that arrow at him?",0
; + kill kerrek (he is there, you have bow, not arrow
.byte "With what?! You got no",13
.byte "arrow, fool!",0
; + kill kerrek (he is dead)
.byte "Yeah. You smote the Kerrek.",13
.byte "You deserve a trophy full",13
.byte "of Mutton-ums.",0
; + kill kerrek (he is not there)
.byte "Good idea. But you kinda",13
.byte "need the actual Kerrek to",13
.byte "be here for that to work.",0
; + 10 POINTS
; + get belt
.byte "You strap the Kerrek's belt",13
@ -35,22 +71,43 @@
.byte "that follows you like a",13
.byte "shadow.",0
; + look
kerrek_look_at_message:
; + get arrow (after killing)
.byte "Eww! No way. That thing's",13
.byte "got some serious",13
.byte "Kerrek-Brand kooties on it",13
.byte "now.",0
; + get kerrek
.byte "Well, he does smell real",13
.byte "bad. But he's a bit too big",13
.byte "to fit in your pocket.",0
;==================
; look
;==================
; + look (no Kerrek, kerrek dead)
kerrek_look_no_dead_kerrek_message:
.byte "There are large hoof prints",13
.byte "in the grass here.",0
.byte "in the the grass here.",0
; + look (no Kerrek)
kerrek_look_no_kerrek_message:
.byte "There are large hoof prints",13
.byte "in the the grass here. And",13
.byte "it smells like a public latrine.",0
.byte "it smells like a public",13
.byte "latrine.",0
; + look (living Kerrek)
; + look footprints/tracks (living Kerrek)
kerrek_look_kerrek_message:
.byte "It's the Kerrek, you moron!",13
.byte "Get outta here!",0
; + look footprints/tracks (Kerrek not present)
kerrek_look_footprints_message:
.byte "If you weren't a simpleton",13
.byte "you might think these were",13
.byte "Kerrek prints. But since",13
@ -76,55 +133,6 @@ kerrek_look_at_message:
.byte "Looks like someone left",13
.byte "their spare bones here.",0
; + buy kerrek a cold one (in the Kerrek's domain while he's still alive)
; (Warning: This speeds the Kerrek up, so be careful.)
.byte "The kerrek is a teetotaller",13
.byte "and is offended by your",13
.byte "offer. You've really",13
.byte "cheesed him off now.",0
; + make friends with kerrek
.byte "Look, it didn't work for",13
.byte "Strongbad and it's not",13
.byte "gonna work for you either.",0
; + load / save (while he's still alive)
.byte "You can't be fumbling with",13
.byte "a floppy while the Kerrek",13
.byte "is bearing down on you.",0
; + kill kerrek (he is there, no bow or arrow)
.byte "With what?! You got no",13
.byte "weapons except your",13
.byte "butter-knife wit.",0
; + kill kerrek (he is there, you have arrow but not bow)
.byte "With what?! You gonna throw that arrow at him?",0
; + kill kerrek (he is there, you have bow, not arrow
.byte "With what?! You got no arrow, fool!",0
; + kill kerrek (he is dead)
.byte "Yeah. You smote the Kerrek.",13
.byte "You deserve a trophy full",13
.byte "of Mutton-ums.",0
; + kill kerrek (he is not there)
.byte "Good idea. But you kinda",13
.byte "need the actual Kerrek to",13
.byte "be here for that to work.",0
; + get arrow (after killing)
.byte "Eww! No way. That thing's",13
.byte "got some serious",13
.byte "Kerrek-Brand kooties on it",13
.byte "now.",0
; + get kerrek
.byte "Well, he does smell real",13
.byte "bad. But he's a bit too big",13
.byte "to fit in your pocket.",0
; + look belt (still alive)
.byte "Yecch. I wouldn't touch",13
.byte "that unless it was, like,",13
@ -149,11 +157,39 @@ kerrek_look_at_message:
.byte "He dead. He wasn't fat, he",13
.byte "was just big boned! Poor",13
.byte "pig-man.",0
; + look bones (skips the "he dead." part?)
.byte "He wasn't fat, he was just",13
.byte "big boned! Poor pig-man.",0
;===============
; buy
;===============
; + buy kerrek a cold one (in the Kerrek's domain while he's still alive)
; (Warning: This speeds the Kerrek up, so be careful.)
kerrek_buy_cold_one_message:
.byte "The kerrek is a teetotaller",13
.byte "and is offended by your",13
.byte "offer. You've really",13
.byte "cheesed him off now.",0
; + make friends with kerrek
kerrek_make_friends_message:
.byte "Look, it didn't work for",13
.byte "Strongbad and it's not",13
.byte "gonna work for you either.",0
; + load / save (while he's still alive)
kerrek_load_save_message:
.byte "You can't be fumbling with",13
.byte "a floppy while the Kerrek",13
.byte "is bearing down on you.",0
; + talk kerrek (while he is alive)
kerrek_talk_message:
.byte 34,"Me llamo Julio,",34," you",13
.byte "begin... It seems only to",13
.byte "further anger the already",13

View File

@ -166,7 +166,7 @@ gary_talk_message:
; Kerrek Tracks 1/2 (top or bottom footprints?)
;================================================
.include "kerrek.inc"
.include "kerrek.inc.lookup"
;=========================
; Old Well / Wishing Well

View File

@ -259,6 +259,8 @@ archery_give_trinket_again_message:
.byte "humiliate yourself at the",13
.byte "range.",0
; launches into game...
; play game, after trinket
archery_play_game_message:
.byte 34,"Haldo again!",34," say the",13

View File

@ -226,7 +226,7 @@ ned_tree_talk_tree_message:
; Kerrek Tracks 1/2 (top or bottom footprints?)
;===============================================
.include "kerrek.inc"
.include "kerrek.inc.lookup"
;===========================
; Outside Baby Lady Cottage

View File

@ -61,6 +61,9 @@ PEASANT_YADD = $6B
LEVEL_OVER = $6C
NEW_LOCATION = $FF
NEW_FROM_DISK = $01
KERREK_SPEED = $6D
KERREK_DIRECTION= $6E ; 0 = left, 1=right
SPEECH_PTRL = $70
SPEECH_PTRH = $71
@ -99,10 +102,12 @@ MB_ADDR_H = $88
DONE_PLAYING = $89
DONE_SONG = $8A
APPLEII_MODEL = $8B
ESC_PRESSED = $8C
PREVIOUS_LOCATION= $8D
;=======================
; savegame state
;=======================
@ -158,6 +163,9 @@ KERREK_STATE = $9C
KERREK_DEAD = $01
KERREK_DECOMPOSING = $02
KERREK_SKELETON = $03
KERREK_ROW1 = $40
KERREK_ONSCREEN = $80
ARROW_SCORE = $9D ; bottom=score, top=random num needed 3-5?
ARROW_DONE = $80
@ -192,7 +200,10 @@ INVENTORY_3 = $A2
INVENTORY_1_GONE = $A3 ; had item, but now it's gone
INVENTORY_2_GONE = $A4
INVENTORY_3_GONE = $A5
END_OF_SAVE = $A6
KERREK_X = $A6 ; should be in save area, as we use
KERREK_Y = $A7 ; for skeleton location
END_OF_SAVE = $A8
CURRENT_VERB = $B0 ; parser
CURRENT_NOUN = $B1