monkey: can walk to other room now

This commit is contained in:
Vince Weaver 2020-09-17 21:26:01 -04:00
parent d143b22a23
commit 2317067e98
5 changed files with 205 additions and 2 deletions

View File

@ -56,7 +56,7 @@ monkey.o: monkey.s zp.inc hardware.inc common_defines.inc \
leveldata_monkey.inc \
monkey_actions.s update_bottom.s \
guy.brush \
monkey_lookout.s
monkey_lookout.s monkey_poster.s
ca65 -o monkey.o monkey.s -l monkey.lst
graphics/graphics.inc:

View File

@ -292,11 +292,38 @@ set_destination:
lda CURSOR_X
sta DESTINATION_X
lda CURSOR_Y
sec
sbc #7
and #$FE ; has to be even
sta DESTINATION_Y
; FIXME: adjust for bounds
; 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
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
done_set_destination:
rts

View File

@ -233,6 +233,36 @@ nothing_foreground:
jsr handle_keypress
;====================================
; check if exiting room
;====================================
; FIXME: this should be a jump table
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
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
done_check_exit:
;====================================
; inc frame count
;====================================
@ -281,6 +311,7 @@ really_exit:
.include "guy.brush"
.include "monkey_lookout.s"
.include "monkey_poster.s"
.include "monkey_actions.s"
.include "update_bottom.s"

View File

@ -1,4 +1,68 @@
; if 28<x<35 and y>28
; goto MONKEY_POSTER
; at location 2,22
lookout_check_exit:
lda DESTINATION_Y
cmp #28
bcc lookout_no_exit
lda DESTINATION_X
cmp #28
bcc lookout_no_exit
cmp #35
bcs lookout_no_exit
lda #MONKEY_POSTER
sta LOCATION
lda #2
sta GUYBRUSH_X
lda #22
sta GUYBRUSH_Y
jsr change_location
lookout_no_exit:
rts
lookout_adjust_destination:
ld_check_x:
lda DESTINATION_X
cmp #19
bcc ld_x_too_small
cmp #35
bcs ld_x_too_big
jmp ld_check_y
ld_x_too_big:
lda #35
sta DESTINATION_X
bne ld_check_y
ld_x_too_small:
lda #18
sta DESTINATION_X
ld_check_y:
; if x < 28, Y must be between 16 and 18
; if x < 35, Y must be between 8 and 28
lda DESTINATION_Y
cmp #16
bcc ld_y_too_small
rts
ld_y_too_small:
lda #16
sta DESTINATION_Y
done_ld_adjust:
rts
draw_fire:
lda FRAMEL
and #$18

81
monkey/monkey_poster.s Normal file
View File

@ -0,0 +1,81 @@
poster_check_exit:
; lda DESTINATION_Y
; cmp #28
; bcc lookout_no_exit
; lda DESTINATION_X
; cmp #28
; bcc lookout_no_exit
; cmp #35
; bcs lookout_no_exit
; lda #MONKEY_POSTER
; sta LOCATION
; lda #2
; sta GUYBRUSH_X
; lda #22
; sta GUYBRUSH_Y
; jsr change_location
poster_no_exit:
rts
poster_adjust_destination:
ps_check_x:
; lda DESTINATION_X
; cmp #19
; bcc ld_x_too_small
; cmp #35
; bcs ld_x_too_big
; jmp ld_check_y
ps_x_too_big:
; lda #35
; sta DESTINATION_X
; bne ld_check_y
ps_x_too_small:
; lda #18
; sta DESTINATION_X
ps_check_y:
; if x < 28, Y must be between 16 and 18
; if x < 35, Y must be between 8 and 28
; lda DESTINATION_Y
; cmp #16
; bcc ld_y_too_small
rts
ps_y_too_small:
; lda #16
; sta DESTINATION_Y
done_ps_adjust:
rts
draw_house:
; lda #<wall_sprite
; sta INL
; lda #>wall_sprite
; sta INH
; lda #18
; sta XPOS
; lda #22
; sta YPOS
; jsr put_sprite_crop
; rts
house_sprite: