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
beq finger_not_special ; if $ff not special
lda (LOCATION_STRUCT_L),Y
cmp #$4
beq was_any
; lda (LOCATION_STRUCT_L),Y
; cmp #DIRECTION_ANY
; beq was_any
lda DIRECTION
and #$f
cmp (LOCATION_STRUCT_L),Y
bne finger_not_special ; only special if facing right way
and (LOCATION_STRUCT_L),Y
beq finger_not_special ; only special if facing right way
was_any:
@ -147,9 +147,15 @@ check_cursor_right:
beq finger_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:
lda DIRECTION
and #$f
tay
lda log2_table,Y
asl
asl
asl

View File

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

View File

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