monkey: a lot of fixes to outside the bar

This commit is contained in:
Vince Weaver 2020-09-29 13:32:23 -04:00
parent 3ff6c7e992
commit b604a46110
6 changed files with 149 additions and 91 deletions

View File

@ -19,9 +19,10 @@ VERB_WALK = 9
LOCATION_BACKGROUND=0 ; background LOCATION_BACKGROUND=0 ; background
LOCATION_DESTINATION = 2 LOCATION_DESTINATION = 2
LOCATION_EXIT = 4 LOCATION_EXIT = 4
LOCATION_SIZE = 6 LOCATION_BOUNDS = 6
LOCATION_NUM_AREAS=7 LOCATION_SIZE = 8
LOCATION_AREAS=8 ; each area 8 in size LOCATION_NUM_AREAS=9
LOCATION_AREAS=10 ; each area 8 in size
;================================ ;================================

View File

@ -431,41 +431,6 @@ destination_y_is_positive:
set_destination_smc: set_destination_smc:
jsr $0000 jsr $0000
; FIXME: this should be a jump table
; lda LOCATION
; cmp #MONKEY_LOOKOUT
; beq set_destination_lookout
; cmp #MONKEY_POSTER
; beq set_destination_poster
; cmp #MONKEY_DOCK
; beq set_destination_dock
; cmp #MONKEY_BAR
; beq set_destination_bar
; cmp #MONKEY_TOWN
; beq set_destination_town
; cmp #MONKEY_MAP
; beq set_destination_map
;set_destination_lookout:
; jsr lookout_adjust_destination
; jmp done_set_destination
;set_destination_poster:
; jsr poster_adjust_destination
; jmp done_set_destination
;set_destination_dock:
; jsr dock_adjust_destination
; jmp done_set_destination
;set_destination_bar:
; jsr bar_adjust_destination
; jmp done_set_destination
;set_destination_town:
; jsr town_adjust_destination
; jmp done_set_destination
;set_destination_map:
; jsr map_adjust_destination
; jmp done_set_destination
done_set_destination: done_set_destination:
rts rts
@ -521,6 +486,14 @@ change_location:
lda (LOCATION_STRUCT_L),Y lda (LOCATION_STRUCT_L),Y
sta check_exit_smc+2 sta check_exit_smc+2
ldy #LOCATION_BOUNDS
lda (LOCATION_STRUCT_L),Y
sta keep_in_bounds_smc+1
iny
lda (LOCATION_STRUCT_L),Y
sta keep_in_bounds_smc+2
ldy #LOCATION_SIZE ldy #LOCATION_SIZE
lda (LOCATION_STRUCT_L),Y lda (LOCATION_STRUCT_L),Y
sta GUYBRUSH_SIZE sta GUYBRUSH_SIZE

View File

@ -13,6 +13,7 @@ location0:
.word lookout_lzsa ; background .word lookout_lzsa ; background
.word lookout_adjust_destination ; destination .word lookout_adjust_destination ; destination
.word lookout_check_exit ; exit .word lookout_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 3 ; num areas .byte 3 ; num areas
@ -36,6 +37,7 @@ location1:
.word poster_lzsa ; background .word poster_lzsa ; background
.word poster_adjust_destination ; destination .word poster_adjust_destination ; destination
.word poster_check_exit ; exit .word poster_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 2 ; num areas .byte 2 ; num areas
@ -54,6 +56,7 @@ location2:
.word dock_lzsa ; background .word dock_lzsa ; background
.word dock_adjust_destination ; destination .word dock_adjust_destination ; destination
.word dock_check_exit ; exit .word dock_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 1 ; num areas .byte 1 ; num areas
@ -67,19 +70,27 @@ location3:
.word bar_lzsa ; background .word bar_lzsa ; background
.word bar_adjust_destination ; destination .word bar_adjust_destination ; destination
.word bar_check_exit ; exit .word bar_check_exit ; exit
.word bar_keep_in_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 1 ; num areas .byte 2 ; num areas
.byte 9,14 ; x .byte 9,14 ; x
.byte 20,32 ; y .byte 20,32 ; y
.word door_string ; name .word door_string ; name
.word door_action-1 ; action .word door_action-1 ; action
.byte 36,40 ; x
.byte 14,34 ; y
.word archway_string ; name
.word archway_action-1 ; action
; MONKEY_TOWN -- downtown ; MONKEY_TOWN -- downtown
location4: location4:
.word town_lzsa ; background .word town_lzsa ; background
.word town_adjust_destination ; destination .word town_adjust_destination ; destination
.word town_check_exit ; exit .word town_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 8 ; num areas .byte 8 ; num areas
@ -129,6 +140,7 @@ location5:
.word map_lzsa ; background .word map_lzsa ; background
.word map_adjust_destination ; destination .word map_adjust_destination ; destination
.word map_check_exit ; exit .word map_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_TINY ; size .byte GUYBRUSH_TINY ; size
.byte 7 ; num areas .byte 7 ; num areas
@ -173,6 +185,7 @@ location6:
.word bar_inside1_lzsa ; background .word bar_inside1_lzsa ; background
.word bar_inside1_adjust_destination ; destination .word bar_inside1_adjust_destination ; destination
.word bar_inside1_check_exit ; exit .word bar_inside1_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 4 ; num areas .byte 4 ; num areas
@ -202,6 +215,7 @@ location7:
.word bar_inside2_lzsa ; background .word bar_inside2_lzsa ; background
.word bar_inside2_adjust_destination ; destination .word bar_inside2_adjust_destination ; destination
.word bar_inside2_check_exit ; exit .word bar_inside2_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 4 ; num areas .byte 4 ; num areas
@ -230,6 +244,7 @@ location8:
.word church_lzsa ; background .word church_lzsa ; background
.word church_adjust_destination ; destination .word church_adjust_destination ; destination
.word church_check_exit ; exit .word church_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 1 ; num areas .byte 1 ; num areas
@ -243,6 +258,7 @@ location9:
.word mansion_path_lzsa ; background .word mansion_path_lzsa ; background
.word mansion_path_adjust_destination ; destination .word mansion_path_adjust_destination ; destination
.word mansion_path_check_exit ; exit .word mansion_path_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 1 ; num areas .byte 1 ; num areas
@ -256,6 +272,7 @@ location10:
.word mansion_lzsa ; background .word mansion_lzsa ; background
.word mansion_adjust_destination ; destination .word mansion_adjust_destination ; destination
.word mansion_check_exit ; exit .word mansion_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 1 ; num areas .byte 1 ; num areas
@ -269,6 +286,7 @@ location11:
.word zipline_lzsa ; background .word zipline_lzsa ; background
.word zipline_adjust_destination ; destination .word zipline_adjust_destination ; destination
.word zipline_check_exit ; exit .word zipline_check_exit ; exit
.word lookout_check_bounds ; bounds check
.byte GUYBRUSH_BIG ; size .byte GUYBRUSH_BIG ; size
.byte 3 ; num areas .byte 3 ; num areas
@ -297,7 +315,7 @@ pole_string: .byte 20,20,"POLE",0
cable_string: .byte 20,20,"CABLE",0 cable_string: .byte 20,20,"CABLE",0
sign_string: .byte 20,20,"SIGN",0 sign_string: .byte 20,20,"SIGN",0
; bar strings
; lookout strings ; lookout strings

View File

@ -218,6 +218,8 @@ really_draw_guybrush:
beq do_draw_wall beq do_draw_wall
cmp #MONKEY_POSTER cmp #MONKEY_POSTER
beq do_draw_house beq do_draw_house
cmp #MONKEY_BAR
beq do_draw_building
jmp nothing_foreground jmp nothing_foreground
@ -229,6 +231,11 @@ do_draw_house:
jsr draw_house jsr draw_house
jmp nothing_foreground jmp nothing_foreground
do_draw_building:
jsr draw_bar_fg_building
jmp nothing_foreground
nothing_foreground: nothing_foreground:
@ -262,6 +269,13 @@ nothing_foreground:
jsr handle_keypress jsr handle_keypress
;====================================
; keep in bounds
;====================================
keep_in_bounds_smc:
jsr $0000
;==================================== ;====================================
; check if exiting room ; check if exiting room
;==================================== ;====================================
@ -269,40 +283,6 @@ nothing_foreground:
check_exit_smc: check_exit_smc:
jsr $0000 jsr $0000
; lda LOCATION
; cmp #MONKEY_LOOKOUT
; beq check_exit_lookout
; cmp #MONKEY_POSTER
; beq check_exit_poster
; cmp #MONKEY_DOCK
; beq check_exit_dock
; cmp #MONKEY_BAR
; beq check_exit_bar
; cmp #MONKEY_TOWN
; beq check_exit_town
; cmp #MONKEY_MAP
; beq check_exit_map
;check_exit_lookout:
; jsr lookout_check_exit
; jmp done_check_exit
;check_exit_poster:
; jsr poster_check_exit
; jmp done_check_exit
;check_exit_dock:
; jsr dock_check_exit
; jmp done_check_exit
;check_exit_bar:
; jsr bar_check_exit
; jmp done_check_exit
;check_exit_town:
; jsr town_check_exit
; jmp done_check_exit
;check_exit_map:
; jsr map_check_exit
; jmp done_check_exit
done_check_exit:
;==================================== ;====================================
; inc frame count ; inc frame count
;==================================== ;====================================

View File

@ -1,5 +1,11 @@
; if x<5 goto DOCK at 34,20 ; if x<5 goto DOCK at 34,20
;===========================
; check if exit bar screen
;===========================
; if x<5 goto DOCK at 34,20
; if x>35 goto TOWN
bar_check_exit: bar_check_exit:
lda GUYBRUSH_X lda GUYBRUSH_X
@ -39,35 +45,78 @@ bar_to_town:
bar_no_exit: bar_no_exit:
rts rts
;===========================
; adjust walking destination
;===========================
bar_keep_in_bounds:
br_force_x:
lda GUYBRUSH_X
cmp #25
bcs br_gb_x_too_big
cmp #21
bcc br_gb_x_small
bcs br_gb_x_medium
br_gb_x_too_big:
lda #16
sta GUYBRUSH_Y
sta DESTINATION_Y
bne done_br_gb_adjust
br_gb_x_medium:
lda #18
sta GUYBRUSH_Y
sta DESTINATION_Y
bne done_br_gb_adjust
br_gb_x_small:
lda #20
sta GUYBRUSH_Y
sta DESTINATION_Y
done_br_gb_adjust:
rts
;===========================
; adjust walking destination
;===========================
bar_adjust_destination: bar_adjust_destination:
; if x<21, y=20 ; if x<21, y=20
; if x<25, y=18 ; if x<25, y=18
; else y=`6 ; else y=16
; also adjust actual Y
lda GUYBRUSH_Y
sta DESTINATION_Y
br_check_x: br_check_x:
lda DESTINATION_X ; lda DESTINATION_X
cmp #25 ; cmp #25
bcs br_x_too_big ; bcs br_x_too_big
cmp #21 ; cmp #21
bcc br_x_small ; bcc br_x_small
bcs br_x_medium ; bcs br_x_medium
br_x_too_big: br_x_too_big:
; lda #25 ; lda #16
; sta DESTINATION_X ; sta DESTINATION_Y
lda #16 ; bne done_br_adjust
sta DESTINATION_Y
bne done_br_adjust
br_x_medium: br_x_medium:
lda #18 ; lda #18
sta DESTINATION_Y ; sta DESTINATION_Y
bne done_br_adjust ; bne done_br_adjust
br_x_small: br_x_small:
lda #20 ; lda #20
sta DESTINATION_Y ; sta DESTINATION_Y
done_br_adjust: done_br_adjust:
rts rts
@ -75,6 +124,9 @@ done_br_adjust:
draw_bar_door: draw_bar_door:
lda BAR_DOOR_OPEN lda BAR_DOOR_OPEN
@ -103,4 +155,34 @@ door_sprite:
.byte $5d,$5D .byte $5d,$5D
draw_bar_fg_building:
; only draw it if we're that side of screeen
lda GUYBRUSH_X
cmp #24
bcc done_draw_bar_fg_building
lda #<building_sprite
sta INL
lda #>building_sprite
sta INH
lda #27
sta XPOS
lda #16
sta YPOS
jsr put_sprite_crop
done_draw_bar_fg_building:
rts
building_sprite:
.byte 13,7
.byte $77,$22,$9d,$00,$9d,$00,$22,$22,$22,$00,$00,$00,$0A
.byte $77,$25,$25,$25,$25,$25,$22,$22,$22,$00,$00,$00,$00
.byte $77,$22,$22,$22,$22,$22,$22,$22,$02,$00,$00,$90,$90
.byte $A7,$72,$02,$02,$02,$00,$00,$00,$00,$00,$00,$09,$09
.byte $AA,$77,$00,$00,$00,$00,$00,$00,$00,$60,$60,$d9,$dd
.byte $AA,$77,$00,$00,$00,$00,$60,$00,$60,$06,$00,$66,$dd
.byte $AA,$77,$00,$60,$26,$66,$02,$06,$00,$00,$60,$22,$00

View File

@ -102,6 +102,10 @@ done_ld_adjust:
lookout_check_bounds:
rts
draw_fire: draw_fire:
lda FRAMEL lda FRAMEL
and #$18 and #$18