diff --git a/mist/common_defines.inc b/mist/common_defines.inc index c3e97803..6e151e80 100644 --- a/mist/common_defines.inc +++ b/mist/common_defines.inc @@ -153,9 +153,10 @@ MECHE_EAST_ARCH = 30 MECHE_EAST_TOP = 31 MECHE_EAST_HINT = 32 MECHE_EXIT_PUZZLE = 33 -MECHE_MIST_BOOK = 34 -MECHE_MIST_CLOSED = 35 -MECHE_MIST_OPEN = 36 +MECHE_BOOK_STAIRS = 34 +MECHE_MIST_BOOK = 35 +MECHE_MIST_CLOSED = 36 +MECHE_MIST_OPEN = 37 diff --git a/mist/graphics_meche/Makefile b/mist/graphics_meche/Makefile index 42f20c9f..bb491321 100644 --- a/mist/graphics_meche/Makefile +++ b/mist/graphics_meche/Makefile @@ -13,6 +13,7 @@ meche_graphics.inc: \ departure_e.lzsa \ arrival_w.lzsa \ entrance_e.lzsa entrance_s.lzsa entrance_n.lzsa entrance_w.lzsa \ + entrance_open_n.lzsa \ meche_book_closed.lzsa meche_book_open.lzsa \ fort_view_n.lzsa fort_view_s.lzsa \ bridge2_n.lzsa bridge2_s.lzsa bridge2_e.lzsa bridge2_w.lzsa \ @@ -47,13 +48,18 @@ meche_graphics.inc: \ east_arch_w.lzsa east_arch_s.lzsa \ east_hint_e.lzsa \ east_top_e.lzsa east_top_w.lzsa \ - fort_exit_n.lzsa fort_exit_w.lzsa fort_exit_e.lzsa + fort_exit_n.lzsa fort_exit_w.lzsa fort_exit_e.lzsa \ + exit_puzzle_n.lzsa \ + book_stairs_n.lzsa book_stairs_s.lzsa \ + book_room_n.lzsa \ + book_open_n.lzsa book_closed_n.lzsa echo "departure_e_lzsa: .incbin \"departure_e.lzsa\"" > meche_graphics.inc echo "arrival_w_lzsa: .incbin \"arrival_w.lzsa\"" >> meche_graphics.inc echo "entrance_e_lzsa: .incbin \"entrance_e.lzsa\"" >> meche_graphics.inc echo "entrance_s_lzsa: .incbin \"entrance_s.lzsa\"" >> meche_graphics.inc echo "entrance_n_lzsa: .incbin \"entrance_n.lzsa\"" >> meche_graphics.inc echo "entrance_w_lzsa: .incbin \"entrance_w.lzsa\"" >> meche_graphics.inc + echo "entrance_open_n_lzsa: .incbin \"entrance_open_n.lzsa\"" >> meche_graphics.inc echo "meche_book_closed_lzsa: .incbin \"meche_book_closed.lzsa\"" >> meche_graphics.inc echo "meche_book_open_lzsa: .incbin \"meche_book_open.lzsa\"" >> meche_graphics.inc echo "fort_view_n_lzsa: .incbin \"fort_view_n.lzsa\"" >> meche_graphics.inc @@ -125,6 +131,12 @@ meche_graphics.inc: \ echo "fort_exit_n_lzsa: .incbin \"fort_exit_n.lzsa\"" >> meche_graphics.inc echo "fort_exit_w_lzsa: .incbin \"fort_exit_w.lzsa\"" >> meche_graphics.inc echo "fort_exit_e_lzsa: .incbin \"fort_exit_e.lzsa\"" >> meche_graphics.inc + echo "exit_puzzle_n_lzsa: .incbin \"exit_puzzle_n.lzsa\"" >> meche_graphics.inc + echo "book_stairs_n_lzsa: .incbin \"book_stairs_n.lzsa\"" >> meche_graphics.inc + echo "book_stairs_s_lzsa: .incbin \"book_stairs_s.lzsa\"" >> meche_graphics.inc + echo "book_room_n_lzsa: .incbin \"book_room_n.lzsa\"" >> meche_graphics.inc + echo "book_open_n_lzsa: .incbin \"book_open_n.lzsa\"" >> meche_graphics.inc + echo "book_closed_n_lzsa: .incbin \"book_closed_n.lzsa\"" >> meche_graphics.inc %.gr: %.png $(PNG2GR) $< $@ diff --git a/mist/graphics_meche/book_closed_n.png b/mist/graphics_meche/book_closed_n.png new file mode 100644 index 00000000..84fb5e5a Binary files /dev/null and b/mist/graphics_meche/book_closed_n.png differ diff --git a/mist/graphics_meche/book_open_n.png b/mist/graphics_meche/book_open_n.png new file mode 100644 index 00000000..88a5f060 Binary files /dev/null and b/mist/graphics_meche/book_open_n.png differ diff --git a/mist/graphics_meche/book_room_n.png b/mist/graphics_meche/book_room_n.png new file mode 100644 index 00000000..dfc4ab5c Binary files /dev/null and b/mist/graphics_meche/book_room_n.png differ diff --git a/mist/graphics_meche/book_stairs_n.png b/mist/graphics_meche/book_stairs_n.png new file mode 100644 index 00000000..dce1d33d Binary files /dev/null and b/mist/graphics_meche/book_stairs_n.png differ diff --git a/mist/graphics_meche/book_stairs_s.png b/mist/graphics_meche/book_stairs_s.png new file mode 100644 index 00000000..4651eaca Binary files /dev/null and b/mist/graphics_meche/book_stairs_s.png differ diff --git a/mist/graphics_meche/entrance_open_n.png b/mist/graphics_meche/entrance_open_n.png new file mode 100644 index 00000000..63b934da Binary files /dev/null and b/mist/graphics_meche/entrance_open_n.png differ diff --git a/mist/graphics_meche/exit_puzzle_n.png b/mist/graphics_meche/exit_puzzle_n.png new file mode 100644 index 00000000..e84c0c4e Binary files /dev/null and b/mist/graphics_meche/exit_puzzle_n.png differ diff --git a/mist/graphics_meche/meche_graphics.inc b/mist/graphics_meche/meche_graphics.inc index 20690486..5e9827a2 100644 --- a/mist/graphics_meche/meche_graphics.inc +++ b/mist/graphics_meche/meche_graphics.inc @@ -4,6 +4,7 @@ entrance_e_lzsa: .incbin "entrance_e.lzsa" entrance_s_lzsa: .incbin "entrance_s.lzsa" entrance_n_lzsa: .incbin "entrance_n.lzsa" entrance_w_lzsa: .incbin "entrance_w.lzsa" +entrance_open_n_lzsa: .incbin "entrance_open_n.lzsa" meche_book_closed_lzsa: .incbin "meche_book_closed.lzsa" meche_book_open_lzsa: .incbin "meche_book_open.lzsa" fort_view_n_lzsa: .incbin "fort_view_n.lzsa" @@ -75,3 +76,9 @@ east_top_w_lzsa: .incbin "east_top_w.lzsa" fort_exit_n_lzsa: .incbin "fort_exit_n.lzsa" fort_exit_w_lzsa: .incbin "fort_exit_w.lzsa" fort_exit_e_lzsa: .incbin "fort_exit_e.lzsa" +exit_puzzle_n_lzsa: .incbin "exit_puzzle_n.lzsa" +book_stairs_n_lzsa: .incbin "book_stairs_n.lzsa" +book_stairs_s_lzsa: .incbin "book_stairs_s.lzsa" +book_room_n_lzsa: .incbin "book_room_n.lzsa" +book_open_n_lzsa: .incbin "book_open_n.lzsa" +book_closed_n_lzsa: .incbin "book_closed_n.lzsa" diff --git a/mist/leveldata_meche.inc b/mist/leveldata_meche.inc index a097fb05..d91c235c 100644 --- a/mist/leveldata_meche.inc +++ b/mist/leveldata_meche.inc @@ -12,7 +12,8 @@ locations: .word location20,location21,location22,location23 .word location24,location25,location26,location27 .word location28,location29,location30,location31 - .word location32 + .word location32,location33,location34,location35 + .word location36,location37 ; MECHE_INSIDE_GEAR -- Inside gear on Mist location0: @@ -102,7 +103,11 @@ location4: .word entrance_e_lzsa ; east bg .word entrance_w_lzsa ; west bg .byte BG_NORTH|BG_SOUTH|BG_EAST|BG_WEST - .byte $ff ; special exit + .byte DIRECTION_N ; special exit + .byte 6,22 ; special x + .byte 30,46 ; special y + .word try_exit_puzzle-1 ; special function + ; MECHE_FORT_VIEW -- fort view location5: @@ -598,4 +603,95 @@ location32: .byte BG_EAST .byte $ff ; special exit +; MECHE EXIT_PUZZLE -- exit puzzle +location33: + .byte MECHE_ENTRANCE ; north exit + .byte $ff ; south exit + .byte MECHE_EAST_TOP ; east exit + .byte $ff ; west exit + .byte DIRECTION_N ; north exit_dir + .byte $ff ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word exit_puzzle_n_lzsa ; north bg + .word $0000 ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH + .byte DIRECTION_N ; special exit + .byte 2,38 ; special x + .byte 26,48 ; special y + .word exit_puzzle_button_press-1 ; special function + +; MECHE_BOOK_STAIRS -- stairs down to book +location34: + .byte MECHE_MIST_BOOK ; north exit + .byte MECHE_ENTRANCE ; 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_stairs_n_lzsa ; north bg + .word book_stairs_s_lzsa ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH|BG_SOUTH + .byte $ff + +; MECHE_MIST_BOOK -- book in room +location35: + .byte MECHE_MIST_CLOSED ; north exit + .byte $ff ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_N ; north exit_dir + .byte $ff ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_room_n_lzsa ; north bg + .word $ff ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH + .byte $ff + +; MECHE_MIST_CLOSED -- book in room +location36: + .byte MECHE_MIST_OPEN ; north exit + .byte $ff ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_N ; north exit_dir + .byte $ff ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_closed_n_lzsa ; north bg + .word $ff ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH + .byte $ff + +; MECHE_MIST_OPEN -- book in room +location37: + .byte MECHE_BOOK_STAIRS ; north exit + .byte $ff ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_S ; north exit_dir + .byte $ff ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word book_open_n_lzsa ; north bg + .word $ff ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH + .byte DIRECTION_N + .byte 24,32 ; special x + .byte 12,22 ; special y + .word mist_link_book-1 ; special function + diff --git a/mist/meche.s b/mist/meche.s index 66c58abc..10cf9384 100644 --- a/mist/meche.s +++ b/mist/meche.s @@ -41,6 +41,8 @@ meche_start: jsr adjust_basement_door + jsr check_puzzle_solved + game_loop: ;================= ; reset things @@ -68,6 +70,10 @@ game_loop: beq animate_elevator_rotate cmp #MECHE_ROTATE_CONTROLS beq animate_rotate_controls + cmp #MECHE_EXIT_PUZZLE + beq animate_meche_puzzle + cmp #MECHE_MIST_OPEN + beq animate_mist_book jmp nothing_special animate_meche_book: @@ -109,6 +115,43 @@ animate_elevator_rotate: animate_rotate_controls: jsr draw_rotation_controls + jmp nothing_special + +animate_meche_puzzle: + jsr draw_exit_puzzle_sprites + jmp nothing_special + +animate_mist_book: + lda 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 + sta XPOS + lda #12 + sta YPOS + + jsr put_sprite_crop + + lda FRAMEL + and #$f + bne done_animate_mist_book + + inc ANIMATE_FRAME + +done_animate_mist_book: nothing_special: diff --git a/mist/meche_rotation.s b/mist/meche_rotation.s index 8f8fc778..138accc0 100644 --- a/mist/meche_rotation.s +++ b/mist/meche_rotation.s @@ -1,3 +1,225 @@ + ;=============================== + ;=============================== + ; exit puzzle stuff + ;=============================== + ;=============================== + +exit_puzzle_button_press: + + lda CURSOR_Y + cmp #40 + bcs check_valid ; bge + +; handle 4 chars + lda CURSOR_X + cmp #10 + bcc handle_char1 + cmp #20 + bcc handle_char2 + cmp #30 + bcc handle_char3 + bcs handle_char4 + +handle_char1: + inc MECHE_LOCK1 + lda MECHE_LOCK1 + cmp #10 + bne wrap_lock1 + lda #0 + sta MECHE_LOCK1 +wrap_lock1: + rts + +handle_char2: + inc MECHE_LOCK2 + lda MECHE_LOCK2 + cmp #10 + bne wrap_lock2 + lda #0 + sta MECHE_LOCK2 +wrap_lock2: + rts + +handle_char3: + inc MECHE_LOCK3 + lda MECHE_LOCK3 + cmp #10 + bne wrap_lock3 + lda #0 + sta MECHE_LOCK3 +wrap_lock3: + rts + +handle_char4: + inc MECHE_LOCK4 + lda MECHE_LOCK4 + cmp #10 + bne wrap_lock4 + lda #0 + sta MECHE_LOCK4 +wrap_lock4: + rts + +check_valid: + + jsr check_puzzle_solved + bcs proper_code + bcc not_valid + +proper_code: + + ; move to in front of open door + + lda #MECHE_BOOK_STAIRS + sta LOCATION + jsr change_location + +not_valid: + + rts + + + ;======================= + ; check if puzzle solved + ;======================= +check_puzzle_solved: + lda MECHE_LOCK1 + cmp #2 + bne keep_door_closed + lda MECHE_LOCK2 + cmp #8 + bne keep_door_closed + lda MECHE_LOCK3 + cmp #5 + bne keep_door_closed + lda MECHE_LOCK4 + cmp #1 + bne keep_door_closed +keep_door_open: + + ; change to open stairwell + ldy #LOCATION_NORTH_BG + lda #entrance_open_n_lzsa + sta location4+1,Y + + ; path to stairs handled elsewhere + + ; set carry to indicate open + + sec + + rts +keep_door_closed: + + ; change to closed stairwell + ldy #LOCATION_NORTH_BG + lda #entrance_n_lzsa + sta location4+1,Y + + ; path to stairs handled elsewhere + + ; clear carry to indicate closed + + clc + + rts + + + ;======================== + ; draw sprites + +draw_exit_puzzle_sprites: + + lda MECHE_LOCK1 + asl + tay + lda exit_puzzle_sprites,Y + sta INL + lda exit_puzzle_sprites+1,Y + sta INH + lda #5 + sta XPOS + lda #8 + sta YPOS + jsr put_sprite_crop + + lda MECHE_LOCK2 + asl + tay + lda exit_puzzle_sprites,Y + sta INL + lda exit_puzzle_sprites+1,Y + sta INH + lda #14 + sta XPOS + lda #8 + sta YPOS + jsr put_sprite_crop + + lda MECHE_LOCK3 + asl + tay + lda exit_puzzle_sprites,Y + sta INL + lda exit_puzzle_sprites+1,Y + sta INH + lda #23 + sta XPOS + lda #8 + sta YPOS + jsr put_sprite_crop + + lda MECHE_LOCK4 + asl + tay + lda exit_puzzle_sprites,Y + sta INL + lda exit_puzzle_sprites+1,Y + sta INH + lda #32 + sta XPOS + lda #8 + sta YPOS + jsr put_sprite_crop + + + rts + + + ;========================================= + ; exit puzzle first + ; we really have two entrance points but on same node + ; so can't have both?? + + ; also handle path to book + +try_exit_puzzle: + + lda CURSOR_X + cmp #14 + bcc do_puzzle + + ; not puzzle, instead go down steps if available + + jsr check_puzzle_solved + bcc cant_go_there + + lda #MECHE_BOOK_STAIRS + sta LOCATION + jsr change_location +cant_go_there: + rts + +do_puzzle: + lda #MECHE_EXIT_PUZZLE + sta LOCATION + jsr change_location + rts + ;================================= ;================================= ; rotation stuff @@ -596,3 +818,96 @@ elevator3: .byte 3,2 .byte $f0,$f0,$0f .byte $0f,$0f,$f0 + + + +exit_puzzle_sprites: + .word exit_char0,exit_char1,exit_char2,exit_char3,exit_char4 + .word exit_char5,exit_char6,exit_char7,exit_char8,exit_char9 + +exit_char0: ; + + .byte 4,5 + .byte $ff,$4f,$4f,$ff + .byte $ff,$44,$44,$ff + .byte $44,$44,$44,$44 + .byte $ff,$44,$44,$ff + .byte $ff,$f4,$f4,$ff + +exit_char1: ; half circle + .byte 4,5 + .byte $ff,$4f,$44,$ff + .byte $4f,$44,$44,$ff + .byte $44,$44,$44,$ff + .byte $ff,$44,$44,$ff + .byte $ff,$ff,$f4,$ff + +exit_char2: ; Cyan Logo + .byte 4,5 + .byte $4f,$f4,$f4,$4f + .byte $44,$ff,$ff,$44 + .byte $44,$ff,$ff,$44 + .byte $44,$ff,$ff,$44 + .byte $f4,$ff,$ff,$f4 + +exit_char3: ; Right Triangle + .byte 4,5 + .byte $44,$44,$44,$44 + .byte $44,$44,$44,$ff + .byte $44,$44,$f4,$ff + .byte $44,$f4,$ff,$ff + .byte $f4,$ff,$ff,$ff + +exit_char4: ; split square + .byte 4,5 + .byte $44,$f4,$ff,$44 + .byte $44,$ff,$ff,$44 + .byte $44,$ff,$ff,$44 + .byte $44,$ff,$ff,$44 + .byte $f4,$ff,$f4,$f4 + +exit_char5: ; spikes with ball + .byte 4,5 + .byte $ff,$44,$44,$ff + .byte $ff,$f4,$f4,$ff + .byte $44,$ff,$ff,$44 + .byte $44,$ff,$ff,$44 + .byte $f4,$ff,$ff,$f4 + +exit_char6: ; ping pong + .byte 4,5 + .byte $44,$ff,$44,$44 + .byte $f4,$4f,$ff,$ff + .byte $ff,$f4,$4f,$ff + .byte $ff,$ff,$f4,$4f + .byte $ff,$ff,$ff,$f4 + +exit_char7: ; zig-zag + .byte 4,5 + .byte $f4,$44,$4f,$ff + .byte $ff,$4f,$44,$f4 + .byte $f4,$44,$4f,$ff + .byte $ff,$4f,$44,$f4 + .byte $f4,$f4,$ff,$ff + +exit_char8: ; triangles alternating + .byte 4,5 + .byte $44,$44,$ff,$44 + .byte $44,$44,$ff,$44 + .byte $44,$ff,$4f,$44 + .byte $44,$ff,$44,$44 + .byte $f4,$ff,$f4,$f4 + +exit_char9: ; circle with square + .byte 4,5 + .byte $4f,$f4,$f4,$4f + .byte $44,$4f,$4f,$44 + .byte $44,$44,$44,$44 + .byte $44,$ff,$ff,$44 + .byte $ff,$f4,$f4,$ff + + + + + + +