monkey: can walk around map and exit map

This commit is contained in:
Vince Weaver 2020-09-19 12:07:45 -04:00
parent 21b915bb2b
commit f9b696d331
8 changed files with 149 additions and 40 deletions

View File

@ -85,5 +85,6 @@ guybrush_left2_sprite:
.byte $0f,$A0,$AA
guybrush_map_sprite:
.byte 1,1
.byte $ff

View File

@ -390,6 +390,28 @@ done_return:
; set destination
;==============================
set_destination:
; only adjust Y if we're big guybrush?
lda LOCATION
cmp #MONKEY_MAP
bne set_destination_big
set_destination_on_map:
lda CURSOR_X
clc
adc #$2
sta DESTINATION_X
lda CURSOR_Y
clc
adc #$4
and #$FE
sta DESTINATION_Y
rts
set_destination_big:
lda CURSOR_X
bpl destination_x_is_positive
; we are off edge of screen, just say 0

View File

@ -122,16 +122,52 @@ location5:
.word map_lzsa ; background
.byte 18,40 ; walking range X
.byte 16,48 ; walking range Y
.byte 1 ; num areas
.byte 7 ; num areas
.byte 9,14 ; x
.byte 20,32 ; y
.word door_string ; name
.word door_action-1 ; action
.byte 32,33 ; x
.byte 20,22 ; y
.word house_string ; name
.word map_action-1 ; action
.byte 24,27 ; x
.byte 26,30 ; y
.word lights_string ; name
.word map_action-1 ; action
.byte 18,19 ; x
.byte 16,18 ; y
.word clearing_string ; name
.word map_action-1 ; action
.byte 28,29 ; x
.byte 2,3 ; y
.word island_string ; name
.word map_action-1 ; action
.byte 26,27 ; x
.byte 2,5 ; y
.word shore_string ; name
.word map_action-1 ; action
.byte 12,13 ; x
.byte 22,23 ; y
.word lookout_point_string ; name
.word map_action-1 ; action
.byte 10,13 ; x
.byte 24,28 ; y
.word village_string ; name
.word map_action-1 ; action
string_data:
house_string: .byte 18,20,"HOUSE",0
lights_string: .byte 17,20,"LIGHTS",0
clearing_string:.byte 16,20,"CLEARING",0
island_string: .byte 17,20,"ISLAND",0
shore_string: .byte 18,20,"SHORE",0
lookout_point_string: .byte 13,20,"LOOKOUT POINT",0
village_string: .byte 16,20,"VILLAGE",0
lookout_string: .byte 20,20,"LOOKOUT",0
path_string: .byte 20,20,"PATH",0
stairs_string: .byte 20,20,"STAIRS",0

View File

@ -175,6 +175,17 @@ done_move_guybrush:
lda GUYBRUSH_Y
sta YPOS
lda LOCATION
cmp #MONKEY_MAP
bne big_guybrush
map_guybrush:
lda #<guybrush_map_sprite
sta INL
lda #>guybrush_map_sprite
sta INH
jmp really_draw_guybrush
big_guybrush:
lda GUYBRUSH_Y ; always even
lsr
eor GUYBRUSH_X
@ -187,7 +198,7 @@ done_move_guybrush:
sta INL
lda guybrush_sprites+1,Y
sta INH
really_draw_guybrush:
jsr put_sprite_crop

View File

@ -372,5 +372,12 @@ town_door_nothing:
sta CURRENT_VERB
rts
;=============================
map_action:
map_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts

View File

@ -4,7 +4,7 @@
; at location 4,20
; if 28<x<35 and y<10 and direction==down
; goto MONKEY_MAP
; at location 20,20
; at location 11,20
lookout_check_exit:
lda GUYBRUSH_X
cmp #28
@ -42,7 +42,7 @@ lookout_check_arch:
lda #MONKEY_MAP
sta LOCATION
lda #4
lda #11
sta GUYBRUSH_X
sta DESTINATION_X
lda #20

View File

@ -1,20 +1,25 @@
map_check_exit:
jmp map_no_exit
lda GUYBRUSH_X
cmp #5
bcc map_to_dock
bcs map_no_exit
cmp #11
bne map_no_exit
map_to_dock:
lda #MONKEY_DOCK
lda GUYBRUSH_Y
cmp #22
bne map_no_exit
map_to_lookout:
lda #MONKEY_LOOKOUT
sta LOCATION
lda #34
lda #30
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
lda #14
sta GUYBRUSH_Y
lda #22
sta DESTINATION_Y
lda #DIR_DOWN
sta GUYBRUSH_DIRECTION
jsr change_location
map_no_exit:
@ -22,31 +27,38 @@ map_no_exit:
map_adjust_destination:
; if x<28, y must be >30
; if 28<x<40, y must be > 26
; x can't go past 25
; x between 6 and 30
; y between 2 and 32
mp_check_x:
lda DESTINATION_X
cmp #28
bcs mp_x_left
bcc mp_x_right
mp_x_left:
lda DESTINATION_Y
cmp #6
bcc mp_too_left
cmp #30
bcs done_mp_adjust
lda #30
sta DESTINATION_Y
jmp done_mp_adjust
mp_x_right:
lda DESTINATION_Y
cmp #26
bcs done_mp_adjust
lda #26
sta DESTINATION_Y
jmp done_mp_adjust
bcc mp_check_y
lda #30
sta DESTINATION_X
jmp mp_check_y
mp_too_left:
lda #6
sta DESTINATION_X
mp_check_y:
lda DESTINATION_Y
cmp #2
bcc mp_too_up
cmp #32
bcc done_mp_adjust
lda #32
sta DESTINATION_Y
jmp done_mp_adjust
mp_too_up:
lda #2
sta DESTINATION_Y
done_mp_adjust:
rts

View File

@ -8,6 +8,26 @@ update_bottom:
jsr clear_bottom
lda LOCATION
cmp #MONKEY_MAP
bne not_the_map
map_noun:
lda VALID_NOUN
beq done_map_noun
lda NOUN_L
sta OUTL
lda NOUN_H
sta OUTH
jsr move_and_print
done_map_noun:
rts
not_the_map:
;=======================
; if message, print it