From 21b915bb2b31bb27cf783bbfab8955f8aa58ce77 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 19 Sep 2020 01:36:48 -0400 Subject: [PATCH] monkey: unwisely adding more locations --- monkey/Makefile | 3 +- monkey/common_defines.inc | 2 + monkey/graphics/Makefile | 4 +- monkey/graphics/map.png | Bin 0 -> 975 bytes monkey/graphics/town.png | Bin 0 -> 1129 bytes monkey/keyboard.s | 17 +++-- monkey/leveldata_monkey.inc | 66 ++++++++++++++++++++ monkey/monkey.s | 12 ++++ monkey/monkey_actions.s | 121 ++++++++++++++++++++++++++++++++++++ monkey/monkey_bar.s | 28 +++++++-- monkey/monkey_lookout.s | 54 +++++++++++++--- monkey/monkey_map.s | 75 ++++++++++++++++++++++ monkey/monkey_town.s | 85 +++++++++++++++++++++++++ 13 files changed, 446 insertions(+), 21 deletions(-) create mode 100644 monkey/graphics/map.png create mode 100644 monkey/graphics/town.png create mode 100644 monkey/monkey_map.s create mode 100644 monkey/monkey_town.s diff --git a/monkey/Makefile b/monkey/Makefile index ae114e96..9e573ae7 100644 --- a/monkey/Makefile +++ b/monkey/Makefile @@ -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: diff --git a/monkey/common_defines.inc b/monkey/common_defines.inc index b7904c04..811d98ec 100644 --- a/monkey/common_defines.inc +++ b/monkey/common_defines.inc @@ -44,3 +44,5 @@ MONKEY_LOOKOUT = 0 MONKEY_POSTER = 1 MONKEY_DOCK = 2 MONKEY_BAR = 3 +MONKEY_TOWN = 4 +MONKEY_MAP = 5 diff --git a/monkey/graphics/Makefile b/monkey/graphics/Makefile index 043b0808..ffc1b73b 100644 --- a/monkey/graphics/Makefile +++ b/monkey/graphics/Makefile @@ -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) $< $@ diff --git a/monkey/graphics/map.png b/monkey/graphics/map.png new file mode 100644 index 0000000000000000000000000000000000000000..3832a4d50e02bc566fcdd101fa42a2e0f12516a5 GIT binary patch literal 975 zcmV;=12FuFP)EX>4Tx04R}tkv&MmKpe$iQ^gM|f))`G%ut=Ih>AFB6^c+H)C#RSm|Xe=O&XFE z7e~Rh;NZt%)xpJCR|i)?5c~jfa&%I3krMxx6k5c3aNLh~_a1le0HIP~n$TyLGZCLB4ibym238uF*{h@IUz7t(BRa@R9-%p!LOZK8As|U7%WaobO}Dsh$A-XW&Y&`->G|=9Bbt zT?-un-P^#$bzM{TfXf}A|H+U|*_He>g-ix`KcjC-0ll|C=bG1BZ6Bu(K!Uo8-2exN zz(|&|*PFb%y|K4{&(!++0i^G8yMH=u6#xJLGf+%aMF0Q*;~rpOPQCv`{Q#q2oSd8# z&;8KD|6pw69YFgR4XRg0000PbVXQnLvL+uWo~o;Lvm$dbY)~9cWHEJ zAV*0}P*;Ht7XSbOc}YY;R7l6|meH=mAP9z=E;VsU-~V+NM*ks56}n|N8y6>5kKX{{ z*Jb&R6=Qn#0?z+|^Ytli)po4ltCU((!P2hnWuVFo|3@NN+AMRxj8ZZUSAuR=F`oun zsC*@XoG%K_0x@nwo)%Ck48-PI1!4~zup!a{HLlMpjix|C`dg3L4nIM9N79wKvOv&s z0D620*g|a4KpMh0_OQnx{m14N&B#p{XuQps^@R_QU=y6}SlI1mgA1ynJ`x)7_j$Wb zz#K~7aE$bULntjEXz>wVdMeI;2WJhW_zB7Af$UeUL!jhEbovZQAWp@!r literal 0 HcmV?d00001 diff --git a/monkey/graphics/town.png b/monkey/graphics/town.png new file mode 100644 index 0000000000000000000000000000000000000000..b4384eb24eba8b5da066a4f179374a4bfb1ab654 GIT binary patch literal 1129 zcmV-v1eW`WP)EX>4Tx04R}tkv&MmKpe$iQ^gM|f))`G%ut=Ih>AFB6^c+H)C#RSm|Xe=O&XFE z7e~Rh;NZt%)xpJCR|i)?5c~jfa&%I3krMxx6k5c3aNLh~_a1le0HIP~n$TyLGZCLB4ibym238uF*{h@IUz7t(BRa@R9-%p!LOZK8As|U7%WaobO}Dsh$A-XW&Y&`->G|=9Bbt zT?-un-P^#$bzM{TfXf}A|H+U|*_He>g-ix`KcjC-0ll|C=bG1BZ6Bu(K!Uo8-2exN zz(|&|*PFb%y|K4{&(!++0i^G8yMH=u6#xJLGf+%aMF0Q*;~rpOPQCv`{Q#q2oSd8# z&;8KD|6pw69gm@3*}J;0000PbVXQnLvL+uWo~o;Lvm$dbY)~9cWHEJ zAV*0}P*;Ht7XSbP6G=otR7l6|mD_H^AP_{6BW&8l;{X4)9giooi=DJp`%q`xWwpjxsS$X& zU;+l#%B~SeZ-_%bW}Vpv?0uT%nFcu}sJBIf<1kiOC zE8jrAtBj?I zjBFXx?mCMuuj}RFqx3PbjCV&WfFdBi^q$WZ1APu{^N#nM4+bg5H{>w`9YY1?6o@^Y zbz*woECaciZ@(u%Lh~_tboraWGo30719|0Rkud{LfP(URXNxxCc4Ym+gdFV*w~epg vuzXR`eg*uA{R3YD_=5KS$M&!A6%>8|p#48_;Z)>Q00000NkvXXu0mjfSGfVp literal 0 HcmV?d00001 diff --git a/monkey/keyboard.s b/monkey/keyboard.s index 5a1b5383..83e36cb1 100644 --- a/monkey/keyboard.s +++ b/monkey/keyboard.s @@ -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 ;============================= diff --git a/monkey/leveldata_monkey.inc b/monkey/leveldata_monkey.inc index 32a6cb66..d0359669 100644 --- a/monkey/leveldata_monkey.inc +++ b/monkey/leveldata_monkey.inc @@ -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 diff --git a/monkey/monkey.s b/monkey/monkey.s index 3db28d88..b7adbd5c 100644 --- a/monkey/monkey.s +++ b/monkey/monkey.s @@ -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" diff --git a/monkey/monkey_actions.s b/monkey/monkey_actions.s index 448dcbc2..096d18f0 100644 --- a/monkey/monkey_actions.s +++ b/monkey/monkey_actions.s @@ -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 + + + diff --git a/monkey/monkey_bar.s b/monkey/monkey_bar.s index 5a8a9ec6..2ffda784 100644 --- a/monkey/monkey_bar.s +++ b/monkey/monkey_bar.s @@ -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 diff --git a/monkey/monkey_lookout.s b/monkey/monkey_lookout.s index 816d5182..59eb9a83 100644 --- a/monkey/monkey_lookout.s +++ b/monkey/monkey_lookout.s @@ -1,21 +1,25 @@ - ; if 28=28 and direction==down + ; if 28=24 and direction==down ; goto MONKEY_POSTER ; at location 4,20 + ; if 2830 + ; if 28 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 INH + +; lda #11 +; sta XPOS +; lda #22 +; sta YPOS + +; jsr put_sprite_crop +;done_draw_map_door: +; rts + diff --git a/monkey/monkey_town.s b/monkey/monkey_town.s new file mode 100644 index 00000000..ce9644cb --- /dev/null +++ b/monkey/monkey_town.s @@ -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 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 INH + +; lda #11 +; sta XPOS +; lda #22 +; sta YPOS + +; jsr put_sprite_crop +;done_draw_town_door: +; rts +