From e1a662b7252ee5780356f3be0ae17f8539268f86 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 15 Mar 2020 15:06:36 -0400 Subject: [PATCH] mist: fix some issues with controls/pointers now can set generator again --- mist/draw_pointer.s | 30 ++++++++++++++++++++---------- mist/generator_puzzle.s | 14 ++++++++------ mist/leveldata_mist.inc | 2 +- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/mist/draw_pointer.s b/mist/draw_pointer.s index 5bf99cde..36de83c1 100644 --- a/mist/draw_pointer.s +++ b/mist/draw_pointer.s @@ -9,6 +9,8 @@ draw_pointer: + ; point sprite to right location + lda CURSOR_X sta XPOS lda CURSOR_Y @@ -84,34 +86,37 @@ finger_point: check_cursor_left: ldy #LOCATION_BGS - lda (LOCATION_STRUCT_L),Y check_left_north: - ldy DIRECTION - cpy #DIRECTION_N + lda DIRECTION + and #$f + cmp #DIRECTION_N bne check_left_south handle_left_north: ; check if west exists + lda (LOCATION_STRUCT_L),Y and #BG_WEST beq finger_point bne finger_left check_left_south: - cpy #DIRECTION_S + cmp #DIRECTION_S bne check_left_east handle_left_south: ; check if east exists + lda (LOCATION_STRUCT_L),Y and #BG_EAST beq finger_point bne finger_left check_left_east: - cpy #DIRECTION_E + cmp #DIRECTION_E bne check_left_west handle_left_east: ; check if north exists + lda (LOCATION_STRUCT_L),Y and #BG_NORTH beq finger_point bne finger_left @@ -120,6 +125,7 @@ check_left_west: ; we should be only option left handle_left_west: ; check if south exists + lda (LOCATION_STRUCT_L),Y and #BG_SOUTH beq finger_point bne finger_left @@ -128,34 +134,37 @@ handle_left_west: check_cursor_right: ldy #LOCATION_BGS - lda (LOCATION_STRUCT_L),Y check_right_north: - ldy DIRECTION - cpy #DIRECTION_N + lda DIRECTION + and #$f + cmp #DIRECTION_N bne check_right_south handle_right_north: ; check if east exists + lda (LOCATION_STRUCT_L),Y and #BG_EAST beq finger_point bne finger_right check_right_south: - cpy #DIRECTION_S + cmp #DIRECTION_S bne check_right_east handle_right_south: ; check if west exists + lda (LOCATION_STRUCT_L),Y and #BG_WEST beq finger_point bne finger_right check_right_east: - cpy #DIRECTION_E + cmp #DIRECTION_E bne check_right_west handle_right_east: ; check if south exists + lda (LOCATION_STRUCT_L),Y and #BG_SOUTH beq finger_point bne finger_right @@ -164,6 +173,7 @@ check_right_west: ; we should be only option left handle_right_west: ; check if north exists + lda (LOCATION_STRUCT_L),Y and #BG_NORTH beq finger_point bne finger_right diff --git a/mist/generator_puzzle.s b/mist/generator_puzzle.s index 8dbf8e6d..7f3f1845 100644 --- a/mist/generator_puzzle.s +++ b/mist/generator_puzzle.s @@ -1,10 +1,12 @@ ;====================== -; open the spaeshipt door +; open the spaceship door open_ss_door: ; check if voltage is 59 - + lda ROCKET_VOLTS + cmp #$59 + bne done_ss_door ; change to open door image ldy #LOCATION_NORTH_BG @@ -91,7 +93,7 @@ generator_button_press: button_top_row: - lda XPOS + lda CURSOR_X sec sbc #24 lsr @@ -108,7 +110,7 @@ button_top_row: button_bottom_row: - lda XPOS + lda CURSOR_X sec sbc #25 lsr @@ -173,8 +175,8 @@ cbottom_button_off: bne done_rocket_volts lda GENERATOR_VOLTS - cmp #$59 - bcs oops_flipped + cmp #$60 + bcs oops_flipped ; bge sta ROCKET_VOLTS jmp done_rocket_volts diff --git a/mist/leveldata_mist.inc b/mist/leveldata_mist.inc index 83d664e1..108b4778 100644 --- a/mist/leveldata_mist.inc +++ b/mist/leveldata_mist.inc @@ -710,7 +710,7 @@ location36: .word $0000 ; east bg .word $0000 ; west bg .byte BG_NORTH | BG_SOUTH - .byte DIRECTION_N|DIRECTION_SPLIT|DIRECTION_ONLY_POINT + .byte DIRECTION_N .byte 24,36 ; special x .byte 34,40 ; special y .word generator_button_press-1 ; special function