monkey: unwisely adding more locations

This commit is contained in:
Vince Weaver 2020-09-19 01:36:48 -04:00
parent 944d4dd793
commit 21b915bb2b
13 changed files with 446 additions and 21 deletions

View File

@ -57,7 +57,8 @@ 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_poster.s monkey_dock.s monkey_bar.s
monkey_lookout.s monkey_poster.s monkey_dock.s monkey_bar.s \
monkey_town.s monkey_map.s
ca65 -o monkey.o monkey.s -l monkey.lst
graphics/graphics.inc:

View File

@ -44,3 +44,5 @@ MONKEY_LOOKOUT = 0
MONKEY_POSTER = 1
MONKEY_DOCK = 2
MONKEY_BAR = 3
MONKEY_TOWN = 4
MONKEY_MAP = 5

View File

@ -9,11 +9,13 @@ all: graphics.inc
####
graphics.inc: \
lookout.lzsa poster.lzsa dock.lzsa bar.lzsa
lookout.lzsa poster.lzsa dock.lzsa bar.lzsa town.lzsa map.lzsa
echo "lookout_lzsa: .incbin \"lookout.lzsa\"" > graphics.inc
echo "poster_lzsa: .incbin \"poster.lzsa\"" >> graphics.inc
echo "dock_lzsa: .incbin \"dock.lzsa\"" >> graphics.inc
echo "bar_lzsa: .incbin \"bar.lzsa\"" >> graphics.inc
echo "town_lzsa: .incbin \"town.lzsa\"" >> graphics.inc
echo "map_lzsa: .incbin \"map.lzsa\"" >> graphics.inc
%.gr: %.png
$(PNG2GR) $< $@

BIN
monkey/graphics/map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

BIN
monkey/graphics/town.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -284,6 +284,8 @@ handle_return:
lda CURSOR_Y
cmp #38
bcc check_walking ; blt
cmp #50
bcs check_walking
lda CURSOR_X
clc
@ -397,7 +399,7 @@ destination_x_is_positive:
lda CURSOR_Y
bpl destination_y_is_positive
lda #0
lda #7
destination_y_is_positive:
sec
sbc #7
@ -415,6 +417,10 @@ destination_y_is_positive:
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
@ -428,6 +434,12 @@ set_destination_dock:
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:
@ -437,9 +449,6 @@ done_set_destination:
;=============================
; change location
;=============================

View File

@ -4,6 +4,7 @@
locations:
.word location0,location1,location2,location3
.word location4,location5
; MONKEY_LOOKOUT -- lookout tower
location0:
@ -68,6 +69,67 @@ location3:
.word door_string ; name
.word door_action-1 ; action
; MONKEY_TOWN -- downtown
location4:
.word town_lzsa ; background
.byte 18,40 ; walking range X
.byte 16,48 ; walking range Y
.byte 8 ; num areas
.byte 33,38 ; x
.byte 14,26 ; y
.word archway_string ; name
.word archway_action-1 ; action
.byte 29,30 ; x
.byte 20,28 ; y
.word door_string ; name
.word town_door_action-1 ; action
.byte 19,23 ; x
.byte 20,30 ; y
.word citizen_string ; name
.word citizen_action-1 ; action
.byte 10,11 ; x
.byte 16,22 ; y
.word door_string ; name
.word town_door_action-1 ; action
.byte 7,8 ; x
.byte 16,22 ; y
.word door_string ; name
.word town_door_action-1 ; action
.byte 4,5 ; x
.byte 16,20 ; y
.word door_string ; name
.word town_door_action-1 ; action
.byte 0,3 ; x
.byte 14,20 ; y
.word archway_string ; name
.word archway_action-1 ; action
.byte 0,3 ; x
.byte 5,10 ; y
.word clock_string ; name
.word clock_action-1 ; action
; MONKEY_MAP -- melee map
location5:
.word map_lzsa ; background
.byte 18,40 ; walking range X
.byte 16,48 ; walking range Y
.byte 1 ; num areas
.byte 9,14 ; x
.byte 20,32 ; y
.word door_string ; name
.word door_action-1 ; action
string_data:
lookout_string: .byte 20,20,"LOOKOUT",0
@ -80,3 +142,7 @@ poster_string: .byte 20,20,"POSTER",0
moon_string: .byte 20,20,"MOON",0
door_string: .byte 20,20,"DOOR",0
archway_string: .byte 20,20,"ARCHWAY",0
clock_string: .byte 20,20,"CLOCK",0
citizen_string: .byte 20,20,"CITIZEN OF MELEE",0

View File

@ -259,6 +259,10 @@ nothing_foreground:
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
@ -272,6 +276,12 @@ check_exit_dock:
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:
;====================================
@ -325,6 +335,8 @@ really_exit:
.include "monkey_poster.s"
.include "monkey_dock.s"
.include "monkey_bar.s"
.include "monkey_town.s"
.include "monkey_map.s"
.include "monkey_actions.s"
.include "update_bottom.s"

View File

@ -253,3 +253,124 @@ poster_actions:
poster_look:
.byte 8,21,"RE-ELECT GOVERNOR MARLEY.",0
;=============================
archway_action:
lda CURRENT_VERB
asl
tay
lda archway_actions,Y
cmp #$ff
beq archway_nothing
sta MESSAGE_L
lda archway_actions+1,Y
sta MESSAGE_H
lda #1
sta DISPLAY_MESSAGE
archway_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts
archway_actions:
.word $FFFF ; give
.word doesnt_open ; open
.word doesnt_work ; close
.word cant_pick_up ; pick_up
.word not_special ; look_at
.word $FFFF ; talk_to
.word doesnt_work ; use
.word icant_move ; push
.word icant_move ; pull
;=============================
clock_action:
lda CURRENT_VERB
asl
tay
lda clock_actions,Y
cmp #$ff
beq clock_nothing
sta MESSAGE_L
lda clock_actions+1,Y
sta MESSAGE_H
lda #1
sta DISPLAY_MESSAGE
clock_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts
clock_actions:
.word $FFFF ; give
.word doesnt_open ; open
.word doesnt_work ; close
.word cant_pick_up ; pick_up
.word clock_look ; look_at
.word $FFFF ; talk_to
.word doesnt_work ; use
.word icant_move ; push
.word icant_move ; pull
clock_look:
.byte 12,21,"IT'S 10 O'CLOCK.",0
;=============================
citizen_action:
lda CURRENT_VERB
asl
tay
lda citizen_actions,Y
cmp #$ff
beq citizen_nothing
sta MESSAGE_L
lda citizen_actions+1,Y
sta MESSAGE_H
lda #1
sta DISPLAY_MESSAGE
citizen_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts
citizen_actions:
.word $FFFF ; give
.word $FFFF ; open
.word $FFFF ; close
.word $FFFF ; pick_up
.word citizen_look ; look_at
.word citizen_talk ; talk_to
.word $FFFF ; use
.word $FFFF ; push
.word $FFFF ; pull
citizen_look:
.byte 9,21,"WHAT'RE YOU LOOKING AT?",0
citizen_talk:
.byte 4,21,"DO YOU HAVE A COUSIN NAMED SVEN?",0
;=============================
town_door_action:
town_door_nothing:
lda #VERB_WALK
sta CURRENT_VERB
rts

View File

@ -5,7 +5,9 @@ bar_check_exit:
lda GUYBRUSH_X
cmp #5
bcc bar_to_dock
bcs bar_no_exit
cmp #35
bcs bar_to_town
bcc bar_no_exit
bar_to_dock:
lda #MONKEY_DOCK
@ -17,6 +19,22 @@ bar_to_dock:
sta GUYBRUSH_Y
sta DESTINATION_Y
jsr change_location
jmp bar_no_exit
bar_to_town:
lda #MONKEY_TOWN
sta LOCATION
lda #34
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
sta GUYBRUSH_Y
lda #26
sta DESTINATION_Y
lda #DIR_DOWN
sta GUYBRUSH_DIRECTION
jsr change_location
bar_no_exit:
rts
@ -25,7 +43,7 @@ bar_adjust_destination:
; if x<21, y=20
; if x<25, y=18
; x can't go past 25
; else y=`6
br_check_x:
lda DESTINATION_X
@ -36,9 +54,9 @@ br_check_x:
bcs br_x_medium
br_x_too_big:
lda #25
sta DESTINATION_X
lda #18
; lda #25
; sta DESTINATION_X
lda #16
sta DESTINATION_Y
bne done_br_adjust

View File

@ -1,21 +1,25 @@
; if 28<x<35 and y>=28 and direction==down
; if 28<x<35 and y>=24 and direction==down
; goto MONKEY_POSTER
; at location 4,20
; if 28<x<35 and y<10 and direction==down
; goto MONKEY_MAP
; at location 20,20
lookout_check_exit:
lda GUYBRUSH_Y
cmp #24
bcc lookout_no_exit
lda GUYBRUSH_DIRECTION
cmp #DIR_DOWN
bne lookout_no_exit
lda GUYBRUSH_X
cmp #28
bcc lookout_no_exit
cmp #35
bcs lookout_no_exit
lookout_check_stairs:
lda GUYBRUSH_Y
cmp #24
bcc lookout_check_arch
lda GUYBRUSH_DIRECTION
cmp #DIR_DOWN
bne lookout_no_exit
lda #MONKEY_POSTER
sta LOCATION
lda #4
@ -25,6 +29,27 @@ lookout_check_exit:
sta GUYBRUSH_Y
sta DESTINATION_Y
jsr change_location
jmp lookout_no_exit
lookout_check_arch:
lda GUYBRUSH_Y
cmp #12
bcs lookout_no_exit
lda GUYBRUSH_DIRECTION
cmp #DIR_UP
bne lookout_no_exit
lda #MONKEY_MAP
sta LOCATION
lda #4
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
sta GUYBRUSH_Y
sta DESTINATION_Y
jsr change_location
jmp lookout_no_exit
lookout_no_exit:
rts
@ -35,12 +60,12 @@ ld_check_x:
lda DESTINATION_X
cmp #19
bcc ld_x_too_small
cmp #35
cmp #34
bcs ld_x_too_big
jmp ld_check_y
ld_x_too_big:
lda #35
lda #34
sta DESTINATION_X
bne ld_check_y
@ -52,6 +77,15 @@ 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_X
cmp #28
bcc ld_narrow_y
ld_wide_y:
; lda DESTINATON_Y
jmp done_ld_adjust
ld_narrow_y:
lda DESTINATION_Y
cmp #16
bcc ld_y_too_small

75
monkey/monkey_map.s Normal file
View File

@ -0,0 +1,75 @@
map_check_exit:
jmp map_no_exit
lda GUYBRUSH_X
cmp #5
bcc map_to_dock
bcs map_no_exit
map_to_dock:
lda #MONKEY_DOCK
sta LOCATION
lda #34
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
sta GUYBRUSH_Y
sta DESTINATION_Y
jsr change_location
map_no_exit:
rts
map_adjust_destination:
; if x<28, y must be >30
; if 28<x<40, y must be > 26
; x can't go past 25
mp_check_x:
lda DESTINATION_X
cmp #28
bcs mp_x_left
bcc mp_x_right
mp_x_left:
lda DESTINATION_Y
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
done_mp_adjust:
rts
;draw_map_door:
;
; lda BAR_DOOR_OPEN
; beq done_draw_map_door
; lda #<door_sprite
; sta INL
; lda #>door_sprite
; sta INH
; lda #11
; sta XPOS
; lda #22
; sta YPOS
; jsr put_sprite_crop
;done_draw_map_door:
; rts

85
monkey/monkey_town.s Normal file
View File

@ -0,0 +1,85 @@
town_check_exit:
lda GUYBRUSH_X
cmp #32
bcc town_no_exit
lda GUYBRUSH_Y
cmp #22
bcs town_no_exit
lda GUYBRUSH_DIRECTION
cmp #DIR_UP
bne town_no_exit
town_to_bar:
lda #MONKEY_BAR
sta LOCATION
lda #34
sta GUYBRUSH_X
sta DESTINATION_X
lda #20
sta GUYBRUSH_Y
sta DESTINATION_Y
lda #DIR_LEFT
sta GUYBRUSH_DIRECTION
jsr change_location
town_no_exit:
rts
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
done_tn_adjust:
rts
;draw_town_door:
;
; lda BAR_DOOR_OPEN
; beq done_draw_town_door
; lda #<door_sprite
; sta INL
; lda #>door_sprite
; sta INH
; lda #11
; sta XPOS
; lda #22
; sta YPOS
; jsr put_sprite_crop
;done_draw_town_door:
; rts