monkey: add actions to nouns

This commit is contained in:
Vince Weaver 2020-09-17 23:39:02 -04:00
parent d562adf8fd
commit 57333b52de
6 changed files with 215 additions and 23 deletions

View File

@ -1,10 +1,9 @@
title:
+ wait before displaying
+ display credits
game: game:
+ animated flame + click on verbs
+ foreground rock piles + actions for all the nouns
+ sprites for all dir
+ sprites for walking
bigger changes:
+ real game, if you action something you're not near, you walk to it first

View File

@ -267,6 +267,8 @@ special_return:
done_keypress: done_keypress:
lda #1 ; make cursor visible lda #1 ; make cursor visible
sta CURSOR_VISIBLE sta CURSOR_VISIBLE
lda #0
sta DISPLAY_MESSAGE
no_keypress: no_keypress:
bit KEYRESET bit KEYRESET
@ -279,10 +281,37 @@ no_keypress:
handle_return: handle_return:
; check if walking verb ; check if walking verb
lda CURRENT_VERB
cmp #VERB_WALK
beq action_walk_to
; otherwise see if there's a noun
lda VALID_NOUN ; 0 means yes for some reason
beq activate_noun
; wasn't valid, switch to walk
lda #VERB_WALK
sta CURRENT_VERB
jmp done_return
activate_noun:
;============================
; handle_special
;===========================
; set up jump table fakery
lda NOUN_VECTOR_H ; h first
pha
lda NOUN_VECTOR_L
pha
rts ; jmp to it
action_walk_to:
jsr set_destination jsr set_destination
done_return:
rts rts
;============================== ;==============================
@ -335,19 +364,7 @@ done_set_destination:
rts rts
;============================
; handle_special
;===========================
; set up jump table fakery
handle_special:
; ldy #LOCATION_SPECIAL_FUNC+1
; lda (LOCATION_STRUCT_L),Y
; pha
; dey
; lda (LOCATION_STRUCT_L),Y
; pha
rts

View File

@ -38,6 +38,8 @@ monkey_start:
sta DRAW_PAGE sta DRAW_PAGE
sta LEVEL_OVER sta LEVEL_OVER
sta GUYBRUSH_DIRECTION sta GUYBRUSH_DIRECTION
sta DISPLAY_MESSAGE
sta BAR_DOOR_OPEN
; init cursor ; init cursor

View File

@ -80,22 +80,176 @@ point_nowhere:
lookout_action: lookout_action:
lda CURRENT_VERB
asl
tay
lda lookout_actions,Y
cmp #$ff
beq lookout_nothing
sta MESSAGE_L
lda lookout_actions+1,Y
sta MESSAGE_H
lda #1
sta DISPLAY_MESSAGE
lookout_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts rts
lookout_actions:
.word $FFFF ; give
.word doesnt_open ; open
.word doesnt_work ; close
.word $FFFF ; pick_up
.word lookout_look ; look_at
.word lookout_talk ; talk_to
.word doesnt_work ; use
.word icant_move ; push
.word icant_move ; pull
;0123456789012345678901234567890123456789
lookout_look:
.byte 7,21,"I THINK HE MIGHT BE ASLEEP.",0
lookout_talk:
.byte 16,21,"YIKES!!",0
doesnt_open:
.byte 9,21,"IT DOESN'T SEEM TO OPEN.",0
doesnt_work:
.byte 12,21,"THAT DOESN'T WORK.",0
icant_move:
.byte 12,21,"I CAN'T MOVE IT.",0
cant_pick_up:
.byte 10,21,"I CAN'T PICK THAT UP.",0
not_special:
.byte 1,21,"I DON'T SEE ANYTHING SPECIAL ABOUT IT.",0
;=============================
; can't do anything with path
; real game they all make you walk there
path_action: path_action:
path_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts rts
;=============================
; can't do anything with stairs
; real game they all make you walk there
stairs_action: stairs_action:
stairs_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts rts
;======================
; door
door_action: door_action:
lda CURRENT_VERB
cmp #VERB_OPEN
bne check_door_close
lda #1
sta BAR_DOOR_OPEN
jmp door_nothing
check_door_close:
cmp #VERB_CLOSE
bne door_common
lda #0
sta BAR_DOOR_OPEN
jmp door_nothing
door_common:
asl
tay
lda door_actions,Y
cmp #$ff
beq door_nothing
sta MESSAGE_L
lda door_actions+1,Y
sta MESSAGE_H
lda #1
sta DISPLAY_MESSAGE
door_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts
door_actions:
.word $FFFF ; give
.word $FFFF ; open
.word $FFFF ; close
.word cant_pick_up ; pick_up
.word not_special ; look_at
.word $FFFF ; talk_to
.word doesnt_work ; use
.word icant_move ; push
.word icant_move ; pull
rts rts
moon_action: moon_action:
moon_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts rts
;=============================
; can't do anything with cliffside
; real game they all make you walk there
cliffside_action: cliffside_action:
cliffside_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts rts
poster_action: poster_action:
lda CURRENT_VERB
asl
tay
lda poster_actions,Y
cmp #$ff
beq poster_nothing
sta MESSAGE_L
lda poster_actions+1,Y
sta MESSAGE_H
lda #1
sta DISPLAY_MESSAGE
poster_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts rts
poster_actions:
.word $FFFF ; give
.word doesnt_open ; open
.word doesnt_work ; close
.word cant_pick_up ; pick_up
.word poster_look ; look_at
.word $FFFF ; talk_to
.word doesnt_work ; use
.word icant_move ; push
.word icant_move ; pull
poster_look:
.byte 8,21,"RE-ELECT GOVERNOR MARLEY.",0

View File

@ -4,7 +4,25 @@
;==================================== ;====================================
;==================================== ;====================================
update_bottom: update_bottom:
jsr normal_text
jsr clear_bottom
;=======================
; if message, print it
lda DISPLAY_MESSAGE
beq no_message
lda MESSAGE_L
sta OUTL
lda MESSAGE_H
sta OUTH
jsr move_and_print
rts
no_message:
; draw first line ; draw first line
; it's verb followed by noun ; it's verb followed by noun
@ -40,10 +58,9 @@ update_bottom:
no_noun: no_noun:
;======================== ;========================
; draw command bars ; draw command bars
draw_command_bars:
jsr inverse_text jsr inverse_text
ldx #0 ldx #0

View File

@ -106,6 +106,9 @@ GUYBRUSH_DIRECTION = $93
DIR_RIGHT= 6 DIR_RIGHT= 6
BAR_DOOR_OPEN = $94 BAR_DOOR_OPEN = $94
DISPLAY_MESSAGE = $95
MESSAGE_L = $96
MESSAGE_H = $97
; done game puzzle state ; done game puzzle state