mist: redo directions (make them bitmask instead of ordinal)

this might break subtle things :(
This commit is contained in:
Vince Weaver 2020-04-15 15:05:21 -04:00
parent eb86b01b7f
commit 428b62e937
3 changed files with 22 additions and 10 deletions

View File

@ -18,15 +18,15 @@ draw_pointer:
cmp #$ff cmp #$ff
beq finger_not_special ; if $ff not special beq finger_not_special ; if $ff not special
lda (LOCATION_STRUCT_L),Y ; lda (LOCATION_STRUCT_L),Y
cmp #$4 ; cmp #DIRECTION_ANY
beq was_any ; beq was_any
lda DIRECTION lda DIRECTION
and #$f and #$f
cmp (LOCATION_STRUCT_L),Y and (LOCATION_STRUCT_L),Y
bne finger_not_special ; only special if facing right way beq finger_not_special ; only special if facing right way
was_any: was_any:
@ -147,9 +147,15 @@ check_cursor_right:
beq finger_right beq finger_right
bne finger_uturn_right bne finger_uturn_right
log2_table:
; 0 1 2 3 4 5 6 7 8
.byte 0,0,1,1,2,2,2,2,3
lookup_direction: lookup_direction:
lda DIRECTION lda DIRECTION
and #$f and #$f
tay
lda log2_table,Y
asl asl
asl asl
asl asl

View File

@ -154,6 +154,8 @@ no_split:
done_split: done_split:
and #$f ; mask off special flags and #$f ; mask off special flags
tay
lda log2_table,Y
asl asl
clc clc
adc #LOCATION_NORTH_BG adc #LOCATION_NORTH_BG
@ -204,6 +206,8 @@ go_forward:
lda DIRECTION lda DIRECTION
and #$f and #$f
tay
lda log2_table,Y
clc clc
adc #LOCATION_NORTH_EXIT adc #LOCATION_NORTH_EXIT
tay tay
@ -218,6 +222,8 @@ go_forward:
lda DIRECTION lda DIRECTION
and #$f and #$f
tay
lda log2_table,Y
clc clc
adc #LOCATION_NORTH_EXIT_DIR adc #LOCATION_NORTH_EXIT_DIR
tay tay

View File

@ -37,11 +37,11 @@ CURSOR_Y= $63
XPOS = $64 XPOS = $64
YPOS = $65 YPOS = $65
DIRECTION = $66 DIRECTION = $66
DIRECTION_N = $0 DIRECTION_N = $1
DIRECTION_S = $1 DIRECTION_S = $2
DIRECTION_E = $2 DIRECTION_E = $4
DIRECTION_W = $3 DIRECTION_W = $8
DIRECTION_ANY=$4 DIRECTION_ANY=$f
DIRECTION_ONLY_POINT = $40 ; do not change pointer to grab DIRECTION_ONLY_POINT = $40 ; do not change pointer to grab
DIRECTION_SPLIT = $80 ; split text/graphics DIRECTION_SPLIT = $80 ; split text/graphics
LOCATION = $67 LOCATION = $67