From f9b696d331f201280f93f16bfaf626d3d20e9388 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 19 Sep 2020 12:07:45 -0400 Subject: [PATCH] monkey: can walk around map and exit map --- monkey/guy.brush | 5 +-- monkey/keyboard.s | 22 ++++++++++++ monkey/leveldata_monkey.inc | 50 +++++++++++++++++++++++---- monkey/monkey.s | 13 ++++++- monkey/monkey_actions.s | 7 ++++ monkey/monkey_lookout.s | 4 +-- monkey/monkey_map.s | 68 ++++++++++++++++++++++--------------- monkey/update_bottom.s | 20 +++++++++++ 8 files changed, 149 insertions(+), 40 deletions(-) diff --git a/monkey/guy.brush b/monkey/guy.brush index e08234e4..8006e954 100644 --- a/monkey/guy.brush +++ b/monkey/guy.brush @@ -85,5 +85,6 @@ guybrush_left2_sprite: .byte $0f,$A0,$AA - - +guybrush_map_sprite: +.byte 1,1 +.byte $ff diff --git a/monkey/keyboard.s b/monkey/keyboard.s index 83e36cb1..dfe5ad2a 100644 --- a/monkey/keyboard.s +++ b/monkey/keyboard.s @@ -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 diff --git a/monkey/leveldata_monkey.inc b/monkey/leveldata_monkey.inc index d0359669..88f22592 100644 --- a/monkey/leveldata_monkey.inc +++ b/monkey/leveldata_monkey.inc @@ -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 diff --git a/monkey/monkey.s b/monkey/monkey.s index b7adbd5c..f07350fc 100644 --- a/monkey/monkey.s +++ b/monkey/monkey.s @@ -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 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 diff --git a/monkey/monkey_actions.s b/monkey/monkey_actions.s index 096d18f0..bead547d 100644 --- a/monkey/monkey_actions.s +++ b/monkey/monkey_actions.s @@ -372,5 +372,12 @@ town_door_nothing: sta CURRENT_VERB rts + ;============================= +map_action: +map_nothing: + lda #VERB_WALK + sta CURRENT_VERB + rts + diff --git a/monkey/monkey_lookout.s b/monkey/monkey_lookout.s index 59eb9a83..ab5a6b34 100644 --- a/monkey/monkey_lookout.s +++ b/monkey/monkey_lookout.s @@ -4,7 +4,7 @@ ; at location 4,20 ; if 2830 - ; if 28 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 diff --git a/monkey/update_bottom.s b/monkey/update_bottom.s index 318ecd85..6a0c8004 100644 --- a/monkey/update_bottom.s +++ b/monkey/update_bottom.s @@ -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