mist: fix some issues with controls/pointers

now can set generator again
This commit is contained in:
Vince Weaver 2020-03-15 15:06:36 -04:00
parent a1d9678117
commit e1a662b725
3 changed files with 29 additions and 17 deletions

View File

@ -9,6 +9,8 @@
draw_pointer: draw_pointer:
; point sprite to right location
lda CURSOR_X lda CURSOR_X
sta XPOS sta XPOS
lda CURSOR_Y lda CURSOR_Y
@ -84,34 +86,37 @@ finger_point:
check_cursor_left: check_cursor_left:
ldy #LOCATION_BGS ldy #LOCATION_BGS
lda (LOCATION_STRUCT_L),Y
check_left_north: check_left_north:
ldy DIRECTION lda DIRECTION
cpy #DIRECTION_N and #$f
cmp #DIRECTION_N
bne check_left_south bne check_left_south
handle_left_north: handle_left_north:
; check if west exists ; check if west exists
lda (LOCATION_STRUCT_L),Y
and #BG_WEST and #BG_WEST
beq finger_point beq finger_point
bne finger_left bne finger_left
check_left_south: check_left_south:
cpy #DIRECTION_S cmp #DIRECTION_S
bne check_left_east bne check_left_east
handle_left_south: handle_left_south:
; check if east exists ; check if east exists
lda (LOCATION_STRUCT_L),Y
and #BG_EAST and #BG_EAST
beq finger_point beq finger_point
bne finger_left bne finger_left
check_left_east: check_left_east:
cpy #DIRECTION_E cmp #DIRECTION_E
bne check_left_west bne check_left_west
handle_left_east: handle_left_east:
; check if north exists ; check if north exists
lda (LOCATION_STRUCT_L),Y
and #BG_NORTH and #BG_NORTH
beq finger_point beq finger_point
bne finger_left bne finger_left
@ -120,6 +125,7 @@ check_left_west:
; we should be only option left ; we should be only option left
handle_left_west: handle_left_west:
; check if south exists ; check if south exists
lda (LOCATION_STRUCT_L),Y
and #BG_SOUTH and #BG_SOUTH
beq finger_point beq finger_point
bne finger_left bne finger_left
@ -128,34 +134,37 @@ handle_left_west:
check_cursor_right: check_cursor_right:
ldy #LOCATION_BGS ldy #LOCATION_BGS
lda (LOCATION_STRUCT_L),Y
check_right_north: check_right_north:
ldy DIRECTION lda DIRECTION
cpy #DIRECTION_N and #$f
cmp #DIRECTION_N
bne check_right_south bne check_right_south
handle_right_north: handle_right_north:
; check if east exists ; check if east exists
lda (LOCATION_STRUCT_L),Y
and #BG_EAST and #BG_EAST
beq finger_point beq finger_point
bne finger_right bne finger_right
check_right_south: check_right_south:
cpy #DIRECTION_S cmp #DIRECTION_S
bne check_right_east bne check_right_east
handle_right_south: handle_right_south:
; check if west exists ; check if west exists
lda (LOCATION_STRUCT_L),Y
and #BG_WEST and #BG_WEST
beq finger_point beq finger_point
bne finger_right bne finger_right
check_right_east: check_right_east:
cpy #DIRECTION_E cmp #DIRECTION_E
bne check_right_west bne check_right_west
handle_right_east: handle_right_east:
; check if south exists ; check if south exists
lda (LOCATION_STRUCT_L),Y
and #BG_SOUTH and #BG_SOUTH
beq finger_point beq finger_point
bne finger_right bne finger_right
@ -164,6 +173,7 @@ check_right_west:
; we should be only option left ; we should be only option left
handle_right_west: handle_right_west:
; check if north exists ; check if north exists
lda (LOCATION_STRUCT_L),Y
and #BG_NORTH and #BG_NORTH
beq finger_point beq finger_point
bne finger_right bne finger_right

View File

@ -1,10 +1,12 @@
;====================== ;======================
; open the spaeshipt door ; open the spaceship door
open_ss_door: open_ss_door:
; check if voltage is 59 ; check if voltage is 59
lda ROCKET_VOLTS
cmp #$59
bne done_ss_door
; change to open door image ; change to open door image
ldy #LOCATION_NORTH_BG ldy #LOCATION_NORTH_BG
@ -91,7 +93,7 @@ generator_button_press:
button_top_row: button_top_row:
lda XPOS lda CURSOR_X
sec sec
sbc #24 sbc #24
lsr lsr
@ -108,7 +110,7 @@ button_top_row:
button_bottom_row: button_bottom_row:
lda XPOS lda CURSOR_X
sec sec
sbc #25 sbc #25
lsr lsr
@ -173,8 +175,8 @@ cbottom_button_off:
bne done_rocket_volts bne done_rocket_volts
lda GENERATOR_VOLTS lda GENERATOR_VOLTS
cmp #$59 cmp #$60
bcs oops_flipped bcs oops_flipped ; bge
sta ROCKET_VOLTS sta ROCKET_VOLTS
jmp done_rocket_volts jmp done_rocket_volts

View File

@ -710,7 +710,7 @@ location36:
.word $0000 ; east bg .word $0000 ; east bg
.word $0000 ; west bg .word $0000 ; west bg
.byte BG_NORTH | BG_SOUTH .byte BG_NORTH | BG_SOUTH
.byte DIRECTION_N|DIRECTION_SPLIT|DIRECTION_ONLY_POINT .byte DIRECTION_N
.byte 24,36 ; special x .byte 24,36 ; special x
.byte 34,40 ; special y .byte 34,40 ; special y
.word generator_button_press-1 ; special function .word generator_button_press-1 ; special function