2020-03-08 04:11:08 +00:00
|
|
|
;====================================
|
|
|
|
; draw pointer
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
|
|
|
|
draw_pointer:
|
|
|
|
|
2020-03-27 04:38:49 +00:00
|
|
|
; point sprite to right location (X,Y)
|
2020-03-15 19:06:36 +00:00
|
|
|
|
2020-03-08 04:11:08 +00:00
|
|
|
lda CURSOR_X
|
|
|
|
sta XPOS
|
|
|
|
lda CURSOR_Y
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
; see if inside special region
|
|
|
|
ldy #LOCATION_SPECIAL_EXIT
|
|
|
|
lda (LOCATION_STRUCT_L),Y
|
2020-03-11 13:46:53 +00:00
|
|
|
cmp #$ff
|
|
|
|
beq finger_not_special ; if $ff not special
|
2020-03-14 15:57:09 +00:00
|
|
|
|
2020-04-15 19:05:21 +00:00
|
|
|
; lda (LOCATION_STRUCT_L),Y
|
|
|
|
; cmp #DIRECTION_ANY
|
|
|
|
; beq was_any
|
2020-04-01 05:23:32 +00:00
|
|
|
|
2020-03-14 15:57:09 +00:00
|
|
|
lda DIRECTION
|
|
|
|
and #$f
|
2020-04-01 05:23:32 +00:00
|
|
|
|
2020-04-15 19:05:21 +00:00
|
|
|
and (LOCATION_STRUCT_L),Y
|
|
|
|
beq finger_not_special ; only special if facing right way
|
2020-03-08 04:11:08 +00:00
|
|
|
|
2020-04-15 21:03:07 +00:00
|
|
|
;was_any:
|
2020-04-01 05:23:32 +00:00
|
|
|
|
2020-03-08 04:11:08 +00:00
|
|
|
; see if X1 < X < X2
|
|
|
|
lda CURSOR_X
|
|
|
|
ldy #LOCATION_SPECIAL_X1
|
|
|
|
cmp (LOCATION_STRUCT_L),Y
|
|
|
|
bcc finger_not_special ; blt
|
|
|
|
|
|
|
|
ldy #LOCATION_SPECIAL_X2
|
|
|
|
cmp (LOCATION_STRUCT_L),Y
|
|
|
|
bcs finger_not_special ; bge
|
|
|
|
|
|
|
|
; see if Y1 < Y < Y2
|
|
|
|
lda CURSOR_Y
|
|
|
|
ldy #LOCATION_SPECIAL_Y1
|
|
|
|
cmp (LOCATION_STRUCT_L),Y
|
|
|
|
bcc finger_not_special ; blt
|
|
|
|
|
|
|
|
ldy #LOCATION_SPECIAL_Y2
|
|
|
|
cmp (LOCATION_STRUCT_L),Y
|
|
|
|
bcs finger_not_special ; bge
|
|
|
|
|
|
|
|
; we made it this far, we are special
|
|
|
|
|
|
|
|
finger_grab:
|
|
|
|
lda #1
|
|
|
|
sta IN_SPECIAL
|
|
|
|
|
2020-03-24 05:10:39 +00:00
|
|
|
lda CURSOR_VISIBLE ; if not visible skip
|
|
|
|
bne really_draw_grab
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
really_draw_grab:
|
|
|
|
|
2020-03-11 16:07:15 +00:00
|
|
|
lda DIRECTION
|
|
|
|
and #DIRECTION_ONLY_POINT
|
|
|
|
bne special_but_point
|
|
|
|
|
2020-03-08 04:11:08 +00:00
|
|
|
lda #<finger_grab_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_grab_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
2020-03-11 16:07:15 +00:00
|
|
|
special_but_point:
|
|
|
|
jmp finger_point
|
|
|
|
|
2020-03-08 04:11:08 +00:00
|
|
|
finger_not_special:
|
|
|
|
|
2020-03-24 05:10:39 +00:00
|
|
|
lda CURSOR_VISIBLE ; if not visible skip
|
|
|
|
bne really_not_special
|
|
|
|
|
|
|
|
rts
|
2020-03-27 04:43:51 +00:00
|
|
|
|
2020-03-24 05:10:39 +00:00
|
|
|
really_not_special:
|
|
|
|
|
2020-03-08 04:11:08 +00:00
|
|
|
; check for left/right
|
|
|
|
|
|
|
|
lda CURSOR_X
|
|
|
|
cmp #7
|
|
|
|
bcc check_cursor_left ; blt
|
2020-09-06 04:32:55 +00:00
|
|
|
cmp #$f0 ; check if off left side of screen
|
|
|
|
bcs check_cursor_left ; bge
|
2020-03-08 04:11:08 +00:00
|
|
|
|
|
|
|
cmp #33
|
|
|
|
bcs check_cursor_right ; bge
|
|
|
|
|
|
|
|
; otherwise, finger_point
|
|
|
|
|
|
|
|
finger_point:
|
2020-07-15 17:08:33 +00:00
|
|
|
; holding item takes precednce
|
|
|
|
lda HOLDING_ITEM
|
|
|
|
cmp #HOLDING_MATCH
|
|
|
|
beq match_finger
|
|
|
|
cmp #HOLDING_LIT_MATCH
|
|
|
|
beq match_lit_finger
|
|
|
|
cmp #HOLDING_KEY
|
|
|
|
beq key_finger
|
|
|
|
|
2020-03-23 20:11:14 +00:00
|
|
|
lda HOLDING_PAGE
|
2020-07-20 05:44:42 +00:00
|
|
|
and #$c0
|
2020-03-23 20:11:14 +00:00
|
|
|
beq real_finger_point
|
|
|
|
cmp #HOLDING_BLUE_PAGE
|
|
|
|
beq blue_finger
|
|
|
|
cmp #HOLDING_WHITE_PAGE
|
|
|
|
beq white_finger
|
2020-07-15 17:08:33 +00:00
|
|
|
cmp #HOLDING_RED_PAGE
|
|
|
|
; beq red_finger
|
|
|
|
|
|
|
|
red_finger:
|
|
|
|
lda #<finger_red_page_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_red_page_sprite
|
|
|
|
jmp finger_draw
|
2020-07-14 22:42:47 +00:00
|
|
|
|
|
|
|
; all that's left is key
|
|
|
|
key_finger:
|
|
|
|
lda #<finger_key_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_key_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
|
|
|
match_finger:
|
|
|
|
lda #<finger_match_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_match_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
|
|
|
match_lit_finger:
|
|
|
|
lda #<finger_match_lit_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_match_lit_sprite
|
|
|
|
jmp finger_draw
|
2020-03-23 20:11:14 +00:00
|
|
|
|
2020-07-15 17:08:33 +00:00
|
|
|
|
2020-03-23 20:11:14 +00:00
|
|
|
|
|
|
|
blue_finger:
|
|
|
|
lda #<finger_blue_page_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_blue_page_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
|
|
|
white_finger:
|
|
|
|
lda #<finger_white_page_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_white_page_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
|
|
|
real_finger_point:
|
2020-03-08 04:11:08 +00:00
|
|
|
lda #<finger_point_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_point_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
|
|
|
check_cursor_left:
|
2020-03-27 04:43:51 +00:00
|
|
|
jsr lookup_direction
|
2020-03-08 04:11:08 +00:00
|
|
|
|
2020-03-27 04:38:49 +00:00
|
|
|
and #$f
|
2020-03-08 04:11:08 +00:00
|
|
|
beq finger_point
|
2020-03-27 04:43:51 +00:00
|
|
|
cmp #$1
|
2020-03-27 04:38:49 +00:00
|
|
|
beq finger_left
|
|
|
|
bne finger_uturn_left
|
2020-03-08 04:11:08 +00:00
|
|
|
|
|
|
|
check_cursor_right:
|
|
|
|
|
2020-03-27 04:43:51 +00:00
|
|
|
jsr lookup_direction
|
|
|
|
|
|
|
|
and #$f0
|
|
|
|
|
|
|
|
beq finger_point
|
|
|
|
cmp #$10
|
|
|
|
beq finger_right
|
|
|
|
bne finger_uturn_right
|
|
|
|
|
2020-04-15 19:05:21 +00:00
|
|
|
log2_table:
|
|
|
|
; 0 1 2 3 4 5 6 7 8
|
|
|
|
.byte 0,0,1,1,2,2,2,2,3
|
|
|
|
|
2020-03-27 04:43:51 +00:00
|
|
|
lookup_direction:
|
2020-03-15 19:06:36 +00:00
|
|
|
lda DIRECTION
|
|
|
|
and #$f
|
2020-04-15 19:05:21 +00:00
|
|
|
tay
|
|
|
|
lda log2_table,Y
|
2020-03-27 04:38:49 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
clc
|
|
|
|
ldy #LOCATION_BGS
|
|
|
|
adc (LOCATION_STRUCT_L),Y
|
|
|
|
tay
|
2020-03-08 04:11:08 +00:00
|
|
|
|
2020-03-27 04:38:49 +00:00
|
|
|
lda direction_lookup,Y
|
2020-03-08 04:11:08 +00:00
|
|
|
|
2020-03-27 04:43:51 +00:00
|
|
|
rts
|
2020-03-08 04:11:08 +00:00
|
|
|
|
|
|
|
finger_left:
|
|
|
|
lda #1
|
|
|
|
sta IN_LEFT
|
|
|
|
|
|
|
|
lda #<finger_left_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_left_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
|
|
|
finger_right:
|
|
|
|
lda #1
|
|
|
|
sta IN_RIGHT
|
|
|
|
lda #<finger_right_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_right_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
2020-03-27 04:38:49 +00:00
|
|
|
finger_uturn_left:
|
2020-03-08 04:11:08 +00:00
|
|
|
|
2020-03-27 04:38:49 +00:00
|
|
|
lda #2
|
|
|
|
sta IN_LEFT
|
|
|
|
|
|
|
|
lda #<finger_turn_left_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_turn_left_sprite
|
|
|
|
jmp finger_draw
|
|
|
|
|
|
|
|
finger_uturn_right:
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
sta IN_RIGHT
|
|
|
|
|
|
|
|
lda #<finger_turn_right_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>finger_turn_right_sprite
|
|
|
|
jmp finger_draw
|
2020-03-08 04:11:08 +00:00
|
|
|
|
|
|
|
finger_draw:
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
no_draw_pointer:
|
|
|
|
rts
|
|
|
|
|
2020-03-27 04:38:49 +00:00
|
|
|
; 0 = point
|
|
|
|
; 1 = left
|
|
|
|
; 2 = left u-turn
|
2020-03-29 04:52:55 +00:00
|
|
|
; R/L EWSN 0010
|
2020-07-06 02:40:53 +00:00
|
|
|
|
|
|
|
; 1010
|
|
|
|
|
2020-03-27 04:38:49 +00:00
|
|
|
direction_lookup:
|
|
|
|
direction_lookup_n:
|
|
|
|
.byte $00,$00,$22,$22,$01,$01,$21,$21,$10,$10,$12,$12,$11,$11,$11,$11
|
|
|
|
direction_lookup_s:
|
2020-07-06 02:40:53 +00:00
|
|
|
; N S SN W WN WS WSN
|
|
|
|
.byte $00, $22,$00,$22,$10,$12,$10,$12
|
|
|
|
; E EN ES ESN EW EWN EWS EWSN
|
|
|
|
.byte $01,$02,$01,$21,$11,$11,$11,$11
|
2020-03-27 04:38:49 +00:00
|
|
|
direction_lookup_e:
|
|
|
|
.byte $00,$01,$10,$11,$22,$21,$12,$11,$00,$01,$10,$11,$22,$21,$12,$11
|
|
|
|
direction_lookup_w:
|
|
|
|
.byte $00,$10,$01,$11,$00,$10,$01,$11,$22,$12,$21,$11,$22,$12,$21,$11
|
|
|
|
|