monkey: update so you can walk into distance

more pain than it was worth
This commit is contained in:
Vince Weaver 2020-10-13 16:41:51 -04:00
parent 4605d65403
commit 504f6ef4b7
10 changed files with 573 additions and 69 deletions

View File

@ -84,11 +84,51 @@ guybrush_left2_sprite:
.byte $f0,$ff,$AA
.byte $0f,$A0,$AA
guybrush_medium_sprite:
guybrush_med_sprites:
.word guybrush_med_down_sprite
.word guybrush_med_left_sprite
.word guybrush_med_up_sprite
.word guybrush_med_right_sprite
guybrush_med_up_sprite:
.byte 2,4
.byte $dd,$dd
.byte $fd,$fd
.byte $00,$00
.byte $0f,$0f
guybrush_med_down_sprite:
.byte 2,4
.byte $bd,$bd
.byte $fb,$fb
.byte $00,$00
.byte $0f,$0f
guybrush_med_right_sprite:
.byte 2,4
.byte $AA,$bd
.byte $Ad,$fb
.byte $AA,$00
.byte $AA,$0f
guybrush_med_left_sprite:
.byte 2,4
.byte $bd,$AA
.byte $fb,$Ad
.byte $00,$AA
.byte $0f,$AA
;=====
guybrush_small_sprite:
.byte 1,2
.byte $fd
.byte $0f
guybrush_map_sprite:
;=====
guybrush_tiny_sprite:
.byte 1,1
.byte $ff

View File

@ -391,24 +391,84 @@ done_return:
;==============================
set_destination:
; only adjust Y if we're big guybrush?
lda LOCATION
cmp #MONKEY_MAP
bne set_destination_big
; tiny: y=cursor_y+6
; small: y=cursor_y+2
; med: y=cursor_y-2
; big: y=cursor_y-7
set_destination_on_map:
; adjust differently depending on size
lda GUYBRUSH_SIZE
beq set_destination_big
cmp #GUYBRUSH_MEDIUM
beq set_destination_medium
cmp #GUYBRUSH_SMALL
beq set_destination_small
set_destination_tiny:
lda CURSOR_X
bpl destination_tiny_x_is_positive
; we are off edge of screen, just say 0
lda #$FE
destination_tiny_x_is_positive:
clc
adc #$2
adc #2
sta DESTINATION_X
lda CURSOR_Y
bpl destination_tiny_y_is_positive
lda #0
destination_tiny_y_is_positive:
clc
adc #$4
and #$FE
adc #6
and #$FE ; has to be even
sta DESTINATION_Y
rts
jmp set_destination_smc
set_destination_small:
lda CURSOR_X
bpl destination_small_x_is_positive
; we are off edge of screen, just say 0
lda #$FE
destination_small_x_is_positive:
clc
adc #2
sta DESTINATION_X
lda CURSOR_Y
bpl destination_small_y_is_positive
lda #0
destination_small_y_is_positive:
clc
adc #2
and #$FE ; has to be even
sta DESTINATION_Y
jmp set_destination_smc
set_destination_medium:
lda CURSOR_X
bpl destination_medium_x_is_positive
; we are off edge of screen, just say 0
lda #$ff
destination_medium_x_is_positive:
clc
adc #1
sta DESTINATION_X
lda CURSOR_Y
bpl destination_medium_y_is_positive
lda #0
destination_medium_y_is_positive:
sec
sbc #2
and #$FE ; has to be even
sta DESTINATION_Y
jmp set_destination_smc
set_destination_big:
@ -493,9 +553,10 @@ change_location:
lda (LOCATION_STRUCT_L),Y
sta keep_in_bounds_smc+2
ldy #LOCATION_SIZE
lda (LOCATION_STRUCT_L),Y
sta GUYBRUSH_SIZE
; set on exit as might have multiple entrances
; ldy #LOCATION_SIZE
; lda (LOCATION_STRUCT_L),Y
; sta GUYBRUSH_SIZE
;==========================
; load new background

View File

@ -38,6 +38,7 @@ monkey_start:
sta DRAW_PAGE
sta LEVEL_OVER
sta GUYBRUSH_DIRECTION
sta GUYBRUSH_SIZE
sta DISPLAY_MESSAGE
sta BAR_DOOR_OPEN
sta VALID_NOUN
@ -190,23 +191,37 @@ done_move_guybrush:
sta YPOS
lda GUYBRUSH_SIZE
cmp #GUYBRUSH_BIG
beq big_guybrush
cmp #GUYBRUSH_MEDIUM
beq medium_guybrush
lda GUYBRUSH_SIZE
cmp #GUYBRUSH_TINY
beq map_guybrush
beq tiny_guybrush
small_guybrush:
lda #<guybrush_medium_sprite
lda #<guybrush_small_sprite
sta INL
lda #>guybrush_medium_sprite
lda #>guybrush_small_sprite
jmp really_draw_guybrush
map_guybrush:
lda #<guybrush_map_sprite
tiny_guybrush:
lda #<guybrush_tiny_sprite
sta INL
lda #>guybrush_map_sprite
lda #>guybrush_tiny_sprite
jmp really_draw_guybrush
medium_guybrush:
lda GUYBRUSH_DIRECTION ; 00/01 or 02/03 or 04/05 or 06/07
and #$fe
tay
lda guybrush_med_sprites,Y
sta INL
lda guybrush_med_sprites+1,Y
jmp really_draw_guybrush
big_guybrush:

View File

@ -57,7 +57,7 @@ bar_to_town:
lda #34
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
lda #18
sta GUYBRUSH_Y
lda #26
sta DESTINATION_Y

View File

@ -28,12 +28,17 @@ church_to_mansion_path:
church_to_town:
lda #MONKEY_TOWN
sta LOCATION
lda #5
lda #1
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
sta GUYBRUSH_Y
lda #30
sta DESTINATION_Y
lda #GUYBRUSH_SMALL
sta GUYBRUSH_SIZE
jsr change_location
jmp church_no_exit

View File

@ -18,6 +18,10 @@ mansion_to_mansion_path:
lda #10
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_SMALL
sta GUYBRUSH_SIZE
jsr change_location
jmp mansion_no_exit

View File

@ -22,6 +22,10 @@ mansion_path_to_mansion:
lda #20
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_BIG
sta GUYBRUSH_SIZE
jsr change_location
jmp mansion_path_no_exit
@ -34,6 +38,10 @@ mansion_path_to_church:
lda #32
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_SMALL
sta GUYBRUSH_SIZE
jsr change_location
jmp mansion_path_no_exit

View File

@ -1,3 +1,5 @@
; won't you take me to...
; right side of downtown village
;=======================
@ -6,23 +8,27 @@
;
town_check_exit:
jsr update_feet_location
lda GUYBRUSH_X
cmp #5 ; temporary
cmp #2
bcc town_to_church
cmp #9
beq town_to_voodoo
cmp #32
bcc town_no_exit
lda GUYBRUSH_Y
cmp #22
town_to_bar:
lda GUYBRUSH_FEET
cmp #26
bcs town_no_exit
lda GUYBRUSH_DIRECTION
cmp #DIR_UP
bne town_no_exit
town_to_bar:
lda #MONKEY_BAR
sta LOCATION
lda #34
@ -32,12 +38,42 @@ town_to_bar:
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_BIG
sta GUYBRUSH_SIZE
lda #DIR_LEFT
sta GUYBRUSH_DIRECTION
jsr change_location
jmp town_no_exit
town_to_voodoo:
lda GUYBRUSH_FEET
cmp #22
bne town_no_exit
lda #MONKEY_VOODOO1
sta LOCATION
lda #11
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_BIG
sta GUYBRUSH_SIZE
lda #DIR_RIGHT
sta GUYBRUSH_DIRECTION
jsr change_location
jmp town_no_exit
town_to_church:
lda GUYBRUSH_FEET
cmp #20
bcs town_no_exit
lda #MONKEY_CHURCH
sta LOCATION
lda #34
@ -47,6 +83,9 @@ town_to_church:
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_SMALL
sta GUYBRUSH_SIZE
lda #DIR_LEFT
sta GUYBRUSH_DIRECTION
jsr change_location
@ -60,31 +99,7 @@ town_no_exit:
town_adjust_destination:
; if x<32, y must be >22
; if 32<x<40, y must be > 18
; x can't go past 25
tn_check_x:
lda DESTINATION_X
cmp #32
bcs tn_x_right
bcc tn_x_left
tn_x_left:
lda DESTINATION_Y
cmp #22
bcs done_tn_adjust
lda #22
sta DESTINATION_Y
jmp done_tn_adjust
tn_x_right:
lda DESTINATION_Y
cmp #18
bcs done_tn_adjust
lda #18
sta DESTINATION_Y
jmp done_tn_adjust
; blah
done_tn_adjust:
rts
@ -94,25 +109,377 @@ done_tn_adjust:
; adjust bounds
;=======================
town_check_bounds:
; if x<2, y unrestricted
; if 7<x<13, y must be >20
; if 14<x<32 y must be > 22
; if 32<x<40, y must be > 16
; x can't go past 25
jsr update_feet_location
tn_check_x:
lda GUYBRUSH_X
cmp #2
bcc tn_x_gateway
cmp #7
bcc tn_x_road
cmp #12
bcc tn_x_voodoo
cmp #15
bcc tn_x_sidewalk
cmp #32
bcs tn_x_right
bcc tn_x_left
tn_x_gateway:
jmp town_adjust_height
tn_x_road:
lda GUYBRUSH_FEET
cmp #20
bcs town_adjust_height
lda #(20-2) ; assume tiny
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_TINY
sta GUYBRUSH_SIZE
jmp town_adjust_height
tn_x_voodoo:
lda GUYBRUSH_FEET
cmp #22
bcs town_adjust_height
lda #(22-4) ; assume small
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_SMALL
sta GUYBRUSH_SIZE
jmp town_adjust_height
tn_x_sidewalk:
lda GUYBRUSH_FEET
cmp #26
bcs town_adjust_height
lda #(26-8) ; assume medium
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_MEDIUM
sta GUYBRUSH_SIZE
jmp town_adjust_height
tn_x_left:
lda GUYBRUSH_FEET
cmp #32
bcs town_adjust_height
lda #(32-14) ; assume large
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_BIG
sta GUYBRUSH_SIZE
jmp town_adjust_height
tn_x_right:
lda GUYBRUSH_FEET
cmp #18
bcs town_adjust_height
lda #(18-2) ; assume tiny
sta GUYBRUSH_Y
sta DESTINATION_Y
jmp town_adjust_height
;====================
; adjust tallness
; this is based on where your feet are
town_adjust_height:
; jsr update_feet_location
lda GUYBRUSH_FEET
cmp #32
bcs town_big ; > 30, big
cmp #26 ; > 24, medium
bcs town_medium
cmp #20 ; > 20, small
bcs town_small
; else, tiny
towntiny:
lda #GUYBRUSH_TINY
jmp town_done_set_height
town_big:
lda #GUYBRUSH_BIG
jmp town_done_set_height
town_medium:
lda #GUYBRUSH_MEDIUM
jmp town_done_set_height
town_small:
lda #GUYBRUSH_SMALL
town_done_set_height:
jmp set_height
;==========================
;==========================
; set height
;==========================
;==========================
; we have to adjust destination because it's at feet
; and that changes when we get small
; A=new height
set_height:
cmp #GUYBRUSH_BIG
bne set_height_check_medium
jmp set_height_new_big
set_height_check_medium:
cmp #GUYBRUSH_MEDIUM
bne set_height_check_small
jmp set_height_new_medium
set_height_check_small:
cmp #GUYBRUSH_SMALL
bne set_height_check_tiny
jmp set_height_new_small
set_height_check_tiny:
; fallthrough
;=================================
set_height_new_tiny:
lda GUYBRUSH_SIZE
cmp #GUYBRUSH_TINY
beq done_set_new_height_tiny
cmp #GUYBRUSH_SMALL
beq set_height_new_tiny_old_small
cmp #GUYBRUSH_MEDIUM
beq set_height_new_tiny_old_medium
; fallthrough
set_height_new_tiny_old_big:
lda DESTINATION_Y
clc
adc #12
sta DESTINATION_Y
lda GUYBRUSH_Y
clc
adc #12
sta GUYBRUSH_Y
lda #GUYBRUSH_TINY
jmp set_new_height_tiny
set_height_new_tiny_old_medium:
lda DESTINATION_Y
clc
adc #6
sta DESTINATION_Y
lda GUYBRUSH_Y
clc
adc #6
sta GUYBRUSH_Y
lda #GUYBRUSH_TINY
jmp set_new_height_tiny
set_height_new_tiny_old_small:
lda DESTINATION_Y
clc
adc #2
sta DESTINATION_Y
lda GUYBRUSH_Y
clc
adc #2
sta GUYBRUSH_Y
lda #GUYBRUSH_TINY
set_new_height_tiny:
sta GUYBRUSH_SIZE
done_set_new_height_tiny:
rts
;draw_town_door:
;
; lda BAR_DOOR_OPEN
; beq done_draw_town_door
;======================================
set_height_new_small:
lda GUYBRUSH_SIZE
cmp #GUYBRUSH_SMALL
beq done_set_new_height_small
cmp #GUYBRUSH_TINY
beq set_height_new_small_old_tiny
cmp #GUYBRUSH_MEDIUM
beq set_height_new_small_old_medium
; fallthrough
set_height_new_small_old_big:
lda DESTINATION_Y
clc
adc #10
sta DESTINATION_Y
lda GUYBRUSH_Y
clc
adc #10
sta GUYBRUSH_Y
lda #GUYBRUSH_SMALL
jmp set_new_height_small
set_height_new_small_old_medium:
lda DESTINATION_Y
clc
adc #4
sta DESTINATION_Y
lda GUYBRUSH_Y
clc
adc #4
sta GUYBRUSH_Y
lda #GUYBRUSH_SMALL
jmp set_new_height_small
set_height_new_small_old_tiny:
lda DESTINATION_Y
sec
sbc #2
sta DESTINATION_Y
lda GUYBRUSH_Y
sec
sbc #2
sta GUYBRUSH_Y
lda #GUYBRUSH_SMALL
set_new_height_small:
sta GUYBRUSH_SIZE
done_set_new_height_small:
rts
; lda #<door_sprite
; sta INL
; lda #>door_sprite
; sta INH
; lda #11
; sta XPOS
; lda #22
; sta YPOS
;==============================
set_height_new_medium:
lda GUYBRUSH_SIZE
cmp #GUYBRUSH_MEDIUM
beq done_set_new_height_medium
cmp #GUYBRUSH_BIG
beq set_height_new_medium_old_big
cmp #GUYBRUSH_TINY
beq set_height_new_medium_old_tiny
; fallthrough
set_height_new_medium_old_small:
lda DESTINATION_Y
sec
sbc #4
sta DESTINATION_Y
lda GUYBRUSH_Y
sec
sbc #4
sta GUYBRUSH_Y
lda #GUYBRUSH_MEDIUM
jmp set_new_height_medium
set_height_new_medium_old_big:
lda DESTINATION_Y
clc
adc #6
sta DESTINATION_Y
lda GUYBRUSH_Y
clc
adc #6
sta GUYBRUSH_Y
lda #GUYBRUSH_MEDIUM
jmp set_new_height_medium
set_height_new_medium_old_tiny:
lda DESTINATION_Y
sec
sbc #6
sta DESTINATION_Y
lda GUYBRUSH_Y
sec
sbc #6
sta GUYBRUSH_Y
lda #GUYBRUSH_MEDIUM
set_new_height_medium:
sta GUYBRUSH_SIZE
done_set_new_height_medium:
rts
; jsr put_sprite_crop
;done_draw_town_door:
; rts
;===========================
set_height_new_big:
lda GUYBRUSH_SIZE
cmp #GUYBRUSH_BIG
beq done_set_new_height_big
cmp #GUYBRUSH_TINY
beq set_height_new_big_old_tiny
cmp #GUYBRUSH_MEDIUM
beq set_height_new_big_old_medium
set_height_new_big_old_small:
lda DESTINATION_Y
sec
sbc #10
sta DESTINATION_Y
lda GUYBRUSH_Y
sec
sbc #10
sta GUYBRUSH_Y
lda #GUYBRUSH_BIG
jmp set_new_height_big
set_height_new_big_old_medium:
lda DESTINATION_Y
sec
sbc #6
sta DESTINATION_Y
lda GUYBRUSH_Y
sec
sbc #6
sta GUYBRUSH_Y
lda #GUYBRUSH_BIG
jmp set_new_height_big
set_height_new_big_old_tiny:
lda DESTINATION_Y
sec
sbc #12
sta DESTINATION_Y
lda GUYBRUSH_Y
sec
sbc #12
sta GUYBRUSH_Y
lda #GUYBRUSH_BIG
jmp set_new_height_big
set_new_height_big:
sta GUYBRUSH_SIZE
done_set_new_height_big:
rts
;=====================
;=====================
; update feet
;=====================
;=====================
update_feet_location:
lda GUYBRUSH_SIZE
cmp #GUYBRUSH_TINY
beq adjust_feet_tiny
cmp #GUYBRUSH_SMALL
beq adjust_feet_small
cmp #GUYBRUSH_MEDIUM
beq adjust_feet_medium
adjust_feet_large:
lda GUYBRUSH_Y
clc
adc #14
jmp done_adjust_feet
adjust_feet_medium:
lda GUYBRUSH_Y
clc
adc #8
jmp done_adjust_feet
adjust_feet_small:
lda GUYBRUSH_Y
clc
adc #4
jmp done_adjust_feet
adjust_feet_tiny:
lda GUYBRUSH_Y
clc
adc #2
done_adjust_feet:
sta GUYBRUSH_FEET
rts

View File

@ -33,9 +33,11 @@ voodoo1_to_town:
lda #10
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
lda #18
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #GUYBRUSH_SMALL
sta GUYBRUSH_SIZE
jsr change_location
jmp voodoo1_no_exit

View File

@ -112,8 +112,10 @@ MESSAGE_H = $97
GUYBRUSH_SIZE = $98
GUYBRUSH_BIG = 0
GUYBRUSH_SMALL = 1
GUYBRUSH_TINY = 2
GUYBRUSH_MEDIUM = 1
GUYBRUSH_SMALL = 2
GUYBRUSH_TINY = 3
GUYBRUSH_FEET = $99
; done game puzzle state