diff --git a/mist/graphics_meche/Makefile b/mist/graphics_meche/Makefile index 53f67be8..42f20c9f 100644 --- a/mist/graphics_meche/Makefile +++ b/mist/graphics_meche/Makefile @@ -46,7 +46,8 @@ meche_graphics.inc: \ eastturn_e.lzsa eastturn_w.lzsa \ east_arch_w.lzsa east_arch_s.lzsa \ east_hint_e.lzsa \ - east_top_e.lzsa east_top_w.lzsa + east_top_e.lzsa east_top_w.lzsa \ + fort_exit_n.lzsa fort_exit_w.lzsa fort_exit_e.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 @@ -121,10 +122,9 @@ meche_graphics.inc: \ echo "east_hint_e_lzsa: .incbin \"east_hint_e.lzsa\"" >> meche_graphics.inc echo "east_top_e_lzsa: .incbin \"east_top_e.lzsa\"" >> meche_graphics.inc echo "east_top_w_lzsa: .incbin \"east_top_w.lzsa\"" >> 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 %.gr: %.png $(PNG2GR) $< $@ @@ -135,4 +135,4 @@ meche_graphics.inc: \ #### clean: - rm -f *~ *.o *.lst *.gr meche_graphics.inc + rm -f *~ *.o *.lst *.gr *.lzsa meche_graphics.inc diff --git a/mist/graphics_meche/fort_exit_e.png b/mist/graphics_meche/fort_exit_e.png new file mode 100644 index 00000000..14bd80ae Binary files /dev/null and b/mist/graphics_meche/fort_exit_e.png differ diff --git a/mist/graphics_meche/meche_graphics.inc b/mist/graphics_meche/meche_graphics.inc index 30ad066d..20690486 100644 --- a/mist/graphics_meche/meche_graphics.inc +++ b/mist/graphics_meche/meche_graphics.inc @@ -72,3 +72,6 @@ east_arch_s_lzsa: .incbin "east_arch_s.lzsa" east_hint_e_lzsa: .incbin "east_hint_e.lzsa" east_top_e_lzsa: .incbin "east_top_e.lzsa" 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" diff --git a/mist/graphics_meche/rotate_controls_e.png b/mist/graphics_meche/rotate_controls_e.png index ae8f459f..e7a9dd9d 100644 Binary files a/mist/graphics_meche/rotate_controls_e.png and b/mist/graphics_meche/rotate_controls_e.png differ diff --git a/mist/graphics_meche/top_floor_ye_w.png b/mist/graphics_meche/top_floor_ye_w.png index 87529628..462c96bb 100644 Binary files a/mist/graphics_meche/top_floor_ye_w.png and b/mist/graphics_meche/top_floor_ye_w.png differ diff --git a/mist/graphics_meche/westturn_e.png b/mist/graphics_meche/westturn_e.png index 518278f4..0df64647 100644 Binary files a/mist/graphics_meche/westturn_e.png and b/mist/graphics_meche/westturn_e.png differ diff --git a/mist/graphics_meche/westturn_n.png b/mist/graphics_meche/westturn_n.png index 0d0881d6..518278f4 100644 Binary files a/mist/graphics_meche/westturn_n.png and b/mist/graphics_meche/westturn_n.png differ diff --git a/mist/graphics_meche/westturn_s.png b/mist/graphics_meche/westturn_s.png index 0df64647..df15070a 100644 Binary files a/mist/graphics_meche/westturn_s.png and b/mist/graphics_meche/westturn_s.png differ diff --git a/mist/graphics_meche/westturn_w.png b/mist/graphics_meche/westturn_w.png index df15070a..0d0881d6 100644 Binary files a/mist/graphics_meche/westturn_w.png and b/mist/graphics_meche/westturn_w.png differ diff --git a/mist/init_state.s b/mist/init_state.s index ade80665..98018793 100644 --- a/mist/init_state.s +++ b/mist/init_state.s @@ -36,5 +36,9 @@ init_state: ; meche elevator sta MECHE_ELEVATOR sta MECHE_ROTATION + sta MECHE_LOCK1 + sta MECHE_LOCK2 + sta MECHE_LOCK3 + sta MECHE_LOCK4 rts diff --git a/mist/leveldata_meche.inc b/mist/leveldata_meche.inc index d4a37587..a097fb05 100644 --- a/mist/leveldata_meche.inc +++ b/mist/leveldata_meche.inc @@ -180,8 +180,8 @@ location9: .byte MECHE_FORT_ENTRY ; east exit .byte $ff ; west exit .byte $ff ; north exit_dir - .byte DIRECTION_N ; south exit_dir - .byte $ff ; east exit_dir + .byte $ff ; south exit_dir + .byte DIRECTION_N ; east exit_dir .byte $ff ; west exit_dir .word westturn_n_lzsa ; north bg .word westturn_s_lzsa ; south bg @@ -193,11 +193,11 @@ location9: ; MECHE_NORTH_PLATFORM -- rotated to north platform location10: - .byte $ff ; north exit + .byte MECHE_NORTH_DIP ; north exit .byte MECHE_FORT_ENTRY ; south exit .byte $ff ; east exit .byte $ff ; west exit - .byte $ff ; north exit_dir + .byte DIRECTION_N ; north exit_dir .byte DIRECTION_N ; south exit_dir .byte $ff ; east exit_dir .byte $ff ; west exit_dir @@ -214,7 +214,7 @@ location11: .byte $ff ; south exit .byte $ff ; east exit .byte $ff ; west exit - .byte DIRECTION_N ; north exit_dir + .byte DIRECTION_S ; north exit_dir .byte $ff ; south exit_dir .byte $ff ; east exit_dir .byte $ff ; west exit_dir @@ -228,11 +228,11 @@ location11: ; MECHE_NORTH_TOP -- north top location12: .byte MECHE_NORTH_HINT ; north exit - .byte $ff ; south exit + .byte MECHE_NORTH_DIP ; south exit .byte $ff ; east exit .byte $ff ; west exit .byte DIRECTION_N ; north exit_dir - .byte $ff ; south exit_dir + .byte DIRECTION_S ; south exit_dir .byte $ff ; east exit_dir .byte $ff ; west exit_dir .word north_top_n_lzsa ; north bg @@ -525,8 +525,10 @@ location28: .word rotate_controls_e_lzsa ; east bg .word $0000 ; west bg .byte BG_EAST|BG_WEST - .byte $ff ; special exit - + .byte DIRECTION_E ; special exit + .byte 13,28 ; special x + .byte 18,42 ; special y + .word handle_rotation_controls-1 ; special function ; MECHE EAST_PLATFORM -- rotated to east platform location29: diff --git a/mist/meche.s b/mist/meche.s index 305be5ee..66c58abc 100644 --- a/mist/meche.s +++ b/mist/meche.s @@ -66,6 +66,8 @@ game_loop: beq animate_meche_book cmp #MECHE_ELEVATOR_ROTATE beq animate_elevator_rotate + cmp #MECHE_ROTATE_CONTROLS + beq animate_rotate_controls jmp nothing_special animate_meche_book: @@ -103,6 +105,10 @@ done_animate_book: animate_elevator_rotate: jsr draw_elevator_panel + jmp nothing_special + +animate_rotate_controls: + jsr draw_rotation_controls nothing_special: diff --git a/mist/meche_rotation.s b/mist/meche_rotation.s index 62b857a4..8f8fc778 100644 --- a/mist/meche_rotation.s +++ b/mist/meche_rotation.s @@ -1,3 +1,301 @@ + ;================================= + ;================================= + ; rotation stuff + ;================================= + ;================================= + +handle_rotation_controls: + + lda CURSOR_Y + + cmp #34 + bcs rot_button_press + + lda CURSOR_X + cmp #19 + bcc handle_left ; blt + +handle_right: + + lda MECHE_LEVERS + eor #RIGHT_LEVER + sta MECHE_LEVERS + + rts + +handle_left: + lda MECHE_LEVERS + eor #LEFT_LEVER + sta MECHE_LEVERS + + ; if flip to 0, then update rotation + + and #LEFT_LEVER + bne done_handle_left + + jsr rotate_fortress + +done_handle_left: + rts + + +rot_button_press: + + ; get outside and face elevator + lda #MECHE_TOP_FLOOR + sta LOCATION + lda #DIRECTION_W + sta DIRECTION + + ; change to plain elevator + ldy #LOCATION_WEST_BG + lda #top_floor_ye_w_lzsa + sta location27+1,Y + + ; change destination to controls + ldy #LOCATION_WEST_EXIT + lda #MECHE_IN_ELEVATOR + sta location27,Y + + jmp change_location ; tail call + + + + + ;================================= + ; draw rotation controls + ;================================= + +draw_rotation_controls: + + ;========================== + ; rotate, where applicable + + lda MECHE_LEVERS + and #LEFT_LEVER + beq draw_rotation + + lda MECHE_LEVERS + and #RIGHT_LEVER + beq draw_rotation + + lda FRAMEL + and #$f + bne draw_rotation + + inc MECHE_ROTATION + lda MECHE_ROTATION + and #$f + sta MECHE_ROTATION + +draw_rotation: + + ; draw rotation + lda MECHE_ROTATION + lsr + lsr + ; 0 -> $C1 at 19,8 + ; 1 -> $10 at 21,4 + ; 2 -> $01 at 19,2 + ; 3 -> $10 at 17,4 + + beq rot0 + cmp #1 + beq rot1 + cmp #2 + beq rot2 + bne rot3 + +rot0: + lda #$C1 + sta $613 + sta $A13 + jmp draw_levers +rot1: + lda #$10 + sta $515 + sta $915 + jmp draw_levers +rot2: + lda #$01 + sta $493 + sta $893 + jmp draw_levers +rot3: + lda #$10 + sta $511 + sta $911 + jmp draw_levers + +draw_levers: + ; draw left lever + lda #lever_sprite + sta INH + + lda #15 + sta XPOS + + lda MECHE_LEVERS + and #LEFT_LEVER + eor #LEFT_LEVER + asl + asl + asl + clc + adc #20 + sta YPOS + + jsr put_sprite_crop + + ; draw right lever + + lda #lever_sprite + sta INH + + lda #21 + sta XPOS + + lda MECHE_LEVERS + and #RIGHT_LEVER + eor #RIGHT_LEVER + asl + asl + clc + adc #20 + sta YPOS + + jsr put_sprite_crop + + rts + +lever_sprite: + .byte 4,3 + .byte $0A,$00,$00,$0A + .byte $00,$00,$05,$00 + .byte $A0,$00,$00,$A0 + + + + + + ;======================== + ; rotate fortress + +rotate_fortress: + + lda MECHE_ROTATION + lsr + lsr + beq fortress_south + cmp #1 + beq fortress_east + cmp #2 + beq fortress_north + bne fortress_west + +fortress_south: + + ; point exit south (original entry point) + + ldy #LOCATION_SOUTH_EXIT + lda #MECHE_BRIDGE2 + sta location8,Y ; MECH_FORT_ENTRY + + ldy #LOCATION_SOUTH_EXIT_DIR + lda #DIRECTION_S + sta location8,Y ; MECH_FORT_ENTRY + + ; set bg to orig entry background + + ldy #LOCATION_SOUTH_BG + + lda #fort_entry_s_lzsa + + jmp rotate_fortress_done + +fortress_west: + + ; point exit south (original entry point) + + ldy #LOCATION_SOUTH_EXIT + lda #MECHE_WEST_PLATFORM + sta location8,Y ; MECH_FORT_ENTRY + + ldy #LOCATION_SOUTH_EXIT_DIR + lda #DIRECTION_W + sta location8,Y ; MECH_FORT_ENTRY + + ; set bg to orig entry background + + ldy #LOCATION_SOUTH_BG + + lda #fort_exit_w_lzsa + + jmp rotate_fortress_done + +fortress_east: + + ; point exit south (original entry point) + + ldy #LOCATION_SOUTH_EXIT + lda #MECHE_EAST_PLATFORM + sta location8,Y ; MECH_FORT_ENTRY + + ldy #LOCATION_SOUTH_EXIT_DIR + lda #DIRECTION_E + sta location8,Y ; MECH_FORT_ENTRY + + ; set bg to orig entry background + + ldy #LOCATION_SOUTH_BG + + lda #fort_exit_e_lzsa + + jmp rotate_fortress_done + +fortress_north: + + ; point exit south (original entry point) + + ldy #LOCATION_SOUTH_EXIT + lda #MECHE_NORTH_PLATFORM + sta location8,Y ; MECH_FORT_ENTRY + + ldy #LOCATION_SOUTH_EXIT_DIR + lda #DIRECTION_N + sta location8,Y ; MECH_FORT_ENTRY + + ; set bg to orig entry background + + ldy #LOCATION_SOUTH_BG + + lda #fort_exit_n_lzsa + + jmp rotate_fortress_done + + + +rotate_fortress_done: + + sta location8+1,Y + + rts + + ;================================== ; elevator stuff @@ -56,6 +354,38 @@ elevator_goto_ground: elevator_goto_half: + ; if at top kick outside and lower + ; TODO: animation? + + ldy #LOCATION_EAST_EXIT + cpy #MECHE_TOP_FLOOR + beq regular_half + +half_and_controls: + ;============================= + ; kick us out, lower controls + + ; get outside and face elevator + lda #MECHE_TOP_FLOOR + sta LOCATION + lda #DIRECTION_W + sta DIRECTION + + ; change to elevator roof + ldy #LOCATION_WEST_BG + lda #top_floor_ne_w_lzsa + sta location27+1,Y + + ; change destination to controls + ldy #LOCATION_WEST_EXIT + lda #MECHE_ROTATE_CONTROLS + sta location27,Y + + jmp elevator_button_done_no_update + +regular_half: ; set exit to top floor ldy #LOCATION_EAST_EXIT @@ -80,6 +410,8 @@ elevator_button_done: sta location26+1,Y +elevator_button_done_no_update: + jsr change_location ; tail call? rts diff --git a/mist/zp.inc b/mist/zp.inc index eca1e3f6..99d384e7 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -89,6 +89,13 @@ ROCKET_NOTE3 = $9D ROCKET_NOTE4 = $9E MECHE_ELEVATOR = $9F MECHE_ROTATION = $A0 +MECHE_LEVERS = $A1 + LEFT_LEVER = 1 + RIGHT_LEVER = 2 +MECHE_LOCK1 = $A2 +MECHE_LOCK2 = $A3 +MECHE_LOCK3 = $A4 +MECHE_LOCK4 = $A5 ; done game puzzle state