diff --git a/mist/Makefile b/mist/Makefile index 2a09afa7..499960be 100644 --- a/mist/Makefile +++ b/mist/Makefile @@ -190,6 +190,7 @@ channel.o: channel.s zp.inc hardware.inc common_defines.inc \ keyboard.s \ draw_pointer.s \ link_book_channel.s \ + link_book_mist.s \ gr_copy.s audio.s text_print.s decompress_fast_v2.s ca65 -o channel.o channel.s -l channel.lst diff --git a/mist/channel.s b/mist/channel.s index ada3d730..eb31476e 100644 --- a/mist/channel.s +++ b/mist/channel.s @@ -39,6 +39,13 @@ channel_start: lda #0 sta ANIMATE_FRAME + ; reset elevators and bridges at start + ; actual game does this too? + + lda CHANNEL_SWITCHES + and #~(CHANNEL_BRIDGE_UP|CHANNEL_PIPE_EXTENDED|CHANNEL_BOOK_ELEVATOR_UP) + sta CHANNEL_SWITCHES + ; set up bridges jsr adjust_after_changes @@ -67,11 +74,20 @@ game_loop: lda LOCATION cmp #CHANNEL_TREE_BOOK_OPEN beq animate_channel_book + cmp #CHANNEL_BOOK_OPEN + beq animate_mist_book jmp nothing_special animate_channel_book: + lda ANIMATE_FRAME + cmp #11 + bcc channel_book_good + lda #0 + sta ANIMATE_FRAME + +channel_book_good: ; handle animated linking book lda ANIMATE_FRAME @@ -83,24 +99,47 @@ animate_channel_book: sta INH lda #22 - sta XPOS - lda #12 - sta YPOS - jsr put_sprite_crop + jmp draw_book - lda FRAMEL - and #$f +animate_mist_book: + lda DIRECTION + cmp #DIRECTION_S bne done_animate_book - inc ANIMATE_FRAME lda ANIMATE_FRAME - cmp #11 - bne done_animate_book - lda #0 - sta ANIMATE_FRAME + cmp #6 + bcc mist_book_good ; blt + + lda #0 + sta ANIMATE_FRAME + +mist_book_good: + + asl + tay + lda mist_movie,Y + sta INL + lda mist_movie+1,Y + sta INH + + lda #24 +draw_book: + sta XPOS + + lda #12 + sta YPOS + + jsr put_sprite_crop + + lda FRAMEL + and #$f + bne done_animate_book + + inc ANIMATE_FRAME + done_animate_book: - jmp nothing_special + jmp nothing_special nothing_special: @@ -268,5 +307,6 @@ exit_to_mist: ; linking books + .include "link_book_mist.s" .include "link_book_channel.s" diff --git a/mist/channel_switches.s b/mist/channel_switches.s index 7900042e..3cf55670 100644 --- a/mist/channel_switches.s +++ b/mist/channel_switches.s @@ -1,3 +1,80 @@ + +;=========================== +; pick up myst linking book +book_room_grab_book: + + lda #CHANNEL_BOOK_CLOSED + sta LOCATION + jmp change_location + + rts + +;============================= +; book elevator handle pulled + +; FIXME: check for water power +; FIXME: animate +book_elevator_handle: + + ; click speaker + bit SPEAKER + + ; check for water power + + ; toggle floor + + lda CHANNEL_SWITCHES + eor #CHANNEL_BOOK_ELEVATOR_UP + sta CHANNEL_SWITCHES + and #CHANNEL_BOOK_ELEVATOR_UP + bne book_elevator_floor2 + +book_elevator_floor1: + + ; change to ground floor + ldy #LOCATION_SOUTH_BG + + lda #book_elevator_inside_gnd_closed_lzsa + sta location44+1,Y ; CHANNEL_BOOK_E_IN_CLOSED + + ; change exit + ldy #LOCATION_SOUTH_EXIT + lda #CHANNEL_BOOK_E_INSIDE_GND + sta location44,Y ; CHANNEL_BOOK_E_IN_CLOSED + + jmp book_elevator_handle_done +book_elevator_floor2: + + ; change to 2nd floor + ldy #LOCATION_SOUTH_BG + + lda #book_elevator_inside_top_closed_lzsa + sta location44+1,Y ; CHANNEL_BOOK_E_IN_CLOSED + + ; change exit + ldy #LOCATION_SOUTH_EXIT + lda #CHANNEL_BOOK_E_INSIDE_TOP + sta location44,Y ; CHANNEL_BOOK_E_IN_CLOSED + +book_elevator_handle_done: + + jsr change_location + + rts + + ;========================= + ; close door +book_elevator_close_door: + + lda #CHANNEL_BOOK_E_IN_CLOSED + sta LOCATION + jmp change_location + + ;======================= ; raise bridge diff --git a/mist/common_defines.inc b/mist/common_defines.inc index ec61da52..cb896c3a 100644 --- a/mist/common_defines.inc +++ b/mist/common_defines.inc @@ -350,3 +350,12 @@ CHANNEL_AFTER_BRIDGE1 = 37 CHANNEL_AFTER_BRIDGE2 = 38 CHANNEL_BOOK_FORK = 39 CHANNEL_PIPE_EXTEND = 40 +CHANNEL_BOOK_ELEVATOR = 41 +CHANNEL_BOOK_E_OPEN = 42 +CHANNEL_BOOK_E_INSIDE_GND= 43 +CHANNEL_BOOK_E_IN_CLOSED= 44 +CHANNEL_BOOK_E_INSIDE_TOP= 45 +CHANNEL_BOOK_ROOM = 46 +CHANNEL_BOOK_CLOSED = 47 +CHANNEL_BOOK_OPEN = 48 + diff --git a/mist/graphics_channel/Makefile b/mist/graphics_channel/Makefile index e3e015b4..83846efd 100644 --- a/mist/graphics_channel/Makefile +++ b/mist/graphics_channel/Makefile @@ -48,7 +48,13 @@ channel_graphics.inc: \ after_bridge1_e.lzsa after_bridge1_w.lzsa \ after_bridge2_e.lzsa after_bridge2_w.lzsa \ book_fork_n.lzsa book_fork_s.lzsa book_fork_w.lzsa \ - pipe_extend_n.lzsa pipe_extend_down_s.lzsa pipe_extend_up_s.lzsa + pipe_extend_n.lzsa pipe_extend_down_s.lzsa pipe_extend_up_s.lzsa \ + book_room_n.lzsa book_room_s.lzsa \ + book_elevator_s.lzsa \ + book_elevator_open_n.lzsa book_elevator_closed_n.lzsa \ + book_elevator_inside_gnd_open.lzsa book_elevator_inside_gnd_closed.lzsa \ + book_elevator_inside_top_open.lzsa book_elevator_inside_top_closed.lzsa \ + book_mist_closed_s.lzsa book_mist_open_s.lzsa echo "arrival_n_lzsa: .incbin \"arrival_n.lzsa\"" > channel_graphics.inc echo "arrival_s_lzsa: .incbin \"arrival_s.lzsa\"" >> channel_graphics.inc echo "clearing_e_lzsa: .incbin \"clearing_e.lzsa\"" >> channel_graphics.inc @@ -135,6 +141,17 @@ channel_graphics.inc: \ echo "pipe_extend_n_lzsa: .incbin \"pipe_extend_n.lzsa\"" >> channel_graphics.inc echo "pipe_extend_up_s_lzsa: .incbin \"pipe_extend_up_s.lzsa\"" >> channel_graphics.inc echo "pipe_extend_down_s_lzsa: .incbin \"pipe_extend_down_s.lzsa\"" >> channel_graphics.inc + echo "book_room_n_lzsa: .incbin \"book_room_n.lzsa\"" >> channel_graphics.inc + echo "book_room_s_lzsa: .incbin \"book_room_s.lzsa\"" >> channel_graphics.inc + echo "book_elevator_s_lzsa: .incbin \"book_elevator_s.lzsa\"" >> channel_graphics.inc + echo "book_elevator_open_n_lzsa: .incbin \"book_elevator_open_n.lzsa\"" >> channel_graphics.inc + echo "book_elevator_closed_n_lzsa: .incbin \"book_elevator_closed_n.lzsa\"" >> channel_graphics.inc + echo "book_elevator_inside_gnd_open_lzsa: .incbin \"book_elevator_inside_gnd_open.lzsa\"" >> channel_graphics.inc + echo "book_elevator_inside_gnd_closed_lzsa: .incbin \"book_elevator_inside_gnd_closed.lzsa\"" >> channel_graphics.inc + echo "book_elevator_inside_top_open_lzsa: .incbin \"book_elevator_inside_top_open.lzsa\"" >> channel_graphics.inc + echo "book_elevator_inside_top_closed_lzsa: .incbin \"book_elevator_inside_top_closed.lzsa\"" >> channel_graphics.inc + echo "book_mist_closed_s_lzsa: .incbin \"book_mist_closed_s.lzsa\"" >> channel_graphics.inc + echo "book_mist_open_s_lzsa: .incbin \"book_mist_open_s.lzsa\"" >> channel_graphics.inc %.gr: %.png $(PNG2GR) $< $@ diff --git a/mist/graphics_channel/book_elevator_closed_n.png b/mist/graphics_channel/book_elevator_closed_n.png new file mode 100644 index 00000000..77ce9669 Binary files /dev/null and b/mist/graphics_channel/book_elevator_closed_n.png differ diff --git a/mist/graphics_channel/book_elevator_inside_gnd_closed.png b/mist/graphics_channel/book_elevator_inside_gnd_closed.png new file mode 100644 index 00000000..50564392 Binary files /dev/null and b/mist/graphics_channel/book_elevator_inside_gnd_closed.png differ diff --git a/mist/graphics_channel/book_elevator_inside_gnd_open.png b/mist/graphics_channel/book_elevator_inside_gnd_open.png new file mode 100644 index 00000000..b4feb76a Binary files /dev/null and b/mist/graphics_channel/book_elevator_inside_gnd_open.png differ diff --git a/mist/graphics_channel/book_elevator_inside_top_closed.png b/mist/graphics_channel/book_elevator_inside_top_closed.png new file mode 100644 index 00000000..c9ec03b2 Binary files /dev/null and b/mist/graphics_channel/book_elevator_inside_top_closed.png differ diff --git a/mist/graphics_channel/book_elevator_inside_top_open.png b/mist/graphics_channel/book_elevator_inside_top_open.png new file mode 100644 index 00000000..40797395 Binary files /dev/null and b/mist/graphics_channel/book_elevator_inside_top_open.png differ diff --git a/mist/graphics_channel/book_elevator_open_n.png b/mist/graphics_channel/book_elevator_open_n.png new file mode 100644 index 00000000..cc79cba0 Binary files /dev/null and b/mist/graphics_channel/book_elevator_open_n.png differ diff --git a/mist/graphics_channel/book_elevator_s.png b/mist/graphics_channel/book_elevator_s.png new file mode 100644 index 00000000..a8ca36c9 Binary files /dev/null and b/mist/graphics_channel/book_elevator_s.png differ diff --git a/mist/graphics_channel/book_mist_closed_s.png b/mist/graphics_channel/book_mist_closed_s.png new file mode 100644 index 00000000..34710918 Binary files /dev/null and b/mist/graphics_channel/book_mist_closed_s.png differ diff --git a/mist/graphics_channel/book_mist_open_s.png b/mist/graphics_channel/book_mist_open_s.png new file mode 100644 index 00000000..e8534993 Binary files /dev/null and b/mist/graphics_channel/book_mist_open_s.png differ diff --git a/mist/graphics_channel/book_room_n.png b/mist/graphics_channel/book_room_n.png new file mode 100644 index 00000000..09867f48 Binary files /dev/null and b/mist/graphics_channel/book_room_n.png differ diff --git a/mist/graphics_channel/book_room_s.png b/mist/graphics_channel/book_room_s.png new file mode 100644 index 00000000..2094c19d Binary files /dev/null and b/mist/graphics_channel/book_room_s.png differ diff --git a/mist/leveldata_channel.inc b/mist/leveldata_channel.inc index 52ac11de..f0c020f5 100644 --- a/mist/leveldata_channel.inc +++ b/mist/leveldata_channel.inc @@ -13,7 +13,9 @@ locations: .word location28,location29,location30,location31 .word location32,location33,location34,location35 .word location36,location37,location38,location39 - .word location40 + .word location40,location41,location42,location43 + .word location44,location45,location46,location47 + .word location48 ; CHANNEL_OUTSIDE_CABIN -- outside in clearing location0: @@ -707,11 +709,11 @@ location38: ; CHANNEL_BOOK_FORK -- fork to book elevator location39: - .byte $ff ; north exit + .byte CHANNEL_BOOK_ELEVATOR ; north exit .byte CHANNEL_PIPE_EXTEND ; south exit .byte $ff ; east exit .byte CHANNEL_AFTER_BRIDGE2 ; west exit - .byte $ff ; north exit_dir + .byte DIRECTION_N ; north exit_dir .byte DIRECTION_S ; south exit_dir .byte $ff ; east exit_dir .byte DIRECTION_W ; west exit_dir @@ -742,4 +744,154 @@ location40: .byte 34,40 ; special y .word extend_pipe-1 ; special function +; CHANNEL_BOOK_ELEVATOR -- outside book elevator, door closed +location41: + .byte CHANNEL_BOOK_E_OPEN ; north exit + .byte CHANNEL_BOOK_FORK ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_N ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_elevator_closed_n_lzsa ; north bg + .word book_elevator_s_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH|BG_SOUTH + .byte $ff ; special exit + +; CHANNEL_E_OPEN -- outside book elevator, door open +location42: + .byte CHANNEL_BOOK_E_INSIDE_GND ; north exit + .byte CHANNEL_BOOK_FORK ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_S ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_elevator_open_n_lzsa ; north bg + .word book_elevator_s_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH|BG_SOUTH + .byte $ff ; special exit + +; CHANNEL_BOOK_E_INSIDE_GND -- inside book elevator, gnd, door open +location43: + .byte $ff ; north exit + .byte CHANNEL_BOOK_ELEVATOR ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte $ff ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word $ff ; north bg + .word book_elevator_inside_gnd_open_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_SOUTH + .byte DIRECTION_S ; special exit + .byte 10,17 ; special x + .byte 6,46 ; special y + .word book_elevator_close_door-1 ; special function + +; CHANNEL_BOOK_E_IN_CLOSED -- inside book elevator, door closed +location44: + .byte $ff ; north exit + .byte CHANNEL_BOOK_E_INSIDE_GND ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte $ff ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word $ff ; north bg + .word book_elevator_inside_gnd_closed_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_SOUTH + .byte DIRECTION_S ; special exit + .byte 28,34 ; special x + .byte 28,36 ; special y + .word book_elevator_handle-1 ; special function + +; CHANNEL_BOOK_E_INSIDE_TOP -- inside book elevator, top, door open +location45: + .byte $ff ; north exit + .byte CHANNEL_BOOK_ROOM ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte $ff ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word $ff ; north bg + .word book_elevator_inside_top_open_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_SOUTH + .byte DIRECTION_S ; special exit + .byte 10,17 ; special x + .byte 6,46 ; special y + .word book_elevator_close_door-1 ; special function + +; CHANNEL_BOOK_ROOM -- the room with the myst book +location46: + .byte CHANNEL_BOOK_E_INSIDE_TOP ; north exit + .byte $ff ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_S ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_room_n_lzsa ; north bg + .word book_room_s_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_SOUTH|BG_NORTH + .byte DIRECTION_S ; special function + .byte 15,23 ; special x + .byte 30,44 ; special y + .word book_room_grab_book-1 ; special function + +; CHANNEL_BOOK_CLOSED -- myst book closed +location47: + .byte CHANNEL_BOOK_E_INSIDE_TOP ; north exit + .byte CHANNEL_BOOK_OPEN ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_S ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_room_n_lzsa ; north bg + .word book_mist_closed_s_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_SOUTH|BG_NORTH + .byte $ff ; special function + +; CHANNEL_BOOK_OPEN -- myst book open +location48: + .byte CHANNEL_BOOK_E_INSIDE_TOP ; north exit + .byte CHANNEL_BOOK_ROOM ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_S ; north exit_dir + .byte DIRECTION_S ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_room_n_lzsa ; north bg + .word book_mist_open_s_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_SOUTH|BG_NORTH + .byte DIRECTION_S + .byte 24,32 ; special x + .byte 12,22 ; special y + .word mist_link_book-1 ; special function diff --git a/mist/zp.inc b/mist/zp.inc index 4604fa1f..f940e774 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -136,6 +136,7 @@ WHITE_PAGE_TAKEN= $B1 CHANNEL_SWITCHES= $B2 CHANNEL_BRIDGE_UP = $01 CHANNEL_PIPE_EXTENDED = $02 + CHANNEL_BOOK_ELEVATOR_UP= $04 CHANNEL_SW_WINDMILL = $40 CHANNEL_SW_FAUCET = $80 CHANNEL_VALVES = $B3