mist: can look left and right

This commit is contained in:
Vince Weaver 2020-03-01 15:18:10 -05:00
parent c42e3a7bf4
commit 8a81509259
5 changed files with 278 additions and 10 deletions

View File

@ -43,12 +43,14 @@ mist.o: mist.s zp.inc hardware.inc \
mist_graphics.inc: \
m_link_book.png \
dock_n.png dock_s.png dock_e.png dock_w.png
dock_n.png dock_s.png dock_e.png dock_w.png \
dock_switch_n.png
$(PNG2RLE) asm m_link_book.png link_book_rle > mist_graphics.inc
$(PNG2RLE) asm dock_n.png dock_n_rle >> mist_graphics.inc
$(PNG2RLE) asm dock_s.png dock_s_rle >> mist_graphics.inc
$(PNG2RLE) asm dock_e.png dock_e_rle >> mist_graphics.inc
$(PNG2RLE) asm dock_w.png dock_w_rle >> mist_graphics.inc
$(PNG2RLE) asm dock_switch_n.png dock_switch_n_rle >> mist_graphics.inc
####

BIN
mist/dock_switch_n.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -54,6 +54,8 @@ game_loop:
lda #0
sta IN_SPECIAL
sta IN_RIGHT
sta IN_LEFT
;====================================
; copy background to current page
@ -115,6 +117,16 @@ finger_grab:
finger_not_special:
; check for left/right
lda CURSOR_X
cmp #7
bcc check_cursor_left ; blt
cmp #33
bcs check_cursor_right ; bge
; otherwise, finger_point
finger_point:
lda #<finger_point_sprite
@ -122,13 +134,106 @@ finger_point:
lda #>finger_point_sprite
jmp finger_draw
check_cursor_left:
ldy #LOCATION_BGS
lda (LOCATION_STRUCT_L),Y
check_left_north:
ldy DIRECTION
cpy #DIRECTION_N
bne check_left_south
handle_left_north:
; check if west exists
and #BG_WEST
beq finger_point
bne finger_left
check_left_south:
cpy #DIRECTION_S
bne check_left_east
handle_left_south:
; check if east exists
and #BG_EAST
beq finger_point
bne finger_left
check_left_east:
cpy #DIRECTION_E
bne check_left_west
handle_left_east:
; check if north exists
and #BG_NORTH
beq finger_point
bne finger_left
check_left_west:
; we should be only option left
handle_left_west:
; check if south exists
and #BG_SOUTH
beq finger_point
bne finger_left
check_cursor_right:
ldy #LOCATION_BGS
lda (LOCATION_STRUCT_L),Y
check_right_north:
ldy DIRECTION
cpy #DIRECTION_N
bne check_right_south
handle_right_north:
; check if east exists
and #BG_EAST
beq finger_point
bne finger_right
check_right_south:
cpy #DIRECTION_S
bne check_right_east
handle_right_south:
; check if west exists
and #BG_WEST
beq finger_point
bne finger_right
check_right_east:
cpy #DIRECTION_E
bne check_right_west
handle_right_east:
; check if south exists
and #BG_SOUTH
beq finger_point
bne finger_right
check_right_west:
; we should be only option left
handle_right_west:
; check if north exists
and #BG_NORTH
beq finger_point
bne finger_right
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
@ -229,13 +334,33 @@ return_pressed:
lda IN_SPECIAL
beq not_special_return
special_return:
jsr handle_special
; special case, don't make cursor visible
jmp no_keypress
not_special_return:
; special case, don't make cursor visible
lda IN_RIGHT
beq not_right_return
right_return:
jsr turn_right
jmp no_keypress
not_right_return:
lda IN_LEFT
beq not_left_return
left_return:
jsr turn_left
jmp no_keypress
not_left_return:
jsr go_forward
jmp no_keypress
done_keypress:
@ -321,6 +446,60 @@ change_location:
rts
;==========================
; go forward
;===========================
go_forward:
rts
;==========================
; turn left
;===========================
turn_left:
lda DIRECTION
cmp #DIRECTION_N
beq go_west
cmp #DIRECTION_W
beq go_south
cmp #DIRECTION_S
beq go_east
bne go_north
;==========================
; turn right
;===========================
turn_right:
lda DIRECTION
cmp #DIRECTION_N
beq go_east
cmp #DIRECTION_E
beq go_south
cmp #DIRECTION_S
beq go_west
bne go_north
go_north:
lda #DIRECTION_N
jmp done_turning
go_east:
lda #DIRECTION_E
jmp done_turning
go_south:
lda #DIRECTION_S
jmp done_turning
go_west:
lda #DIRECTION_W
jmp done_turning
done_turning:
sta DIRECTION
jsr change_direction
rts
;==========================
; includes
;==========================
@ -386,12 +565,15 @@ LOCATION_SPECIAL_X2=14
LOCATION_SPECIAL_Y1=15
LOCATION_SPECIAL_Y2=16
LOCATION_SPECIAL_FUNC=17
LOCATION_BGS = 19
BG_NORTH = 1
BG_SOUTH = 2
BG_EAST = 4
BG_WEST = 8
locations:
.word location0,location1
.word location0,location1,location2
; myst linking book
location0:
@ -407,10 +589,11 @@ location0:
.byte 21,31 ; special x
.byte 10,24 ; special y
.word myst_link_book-1 ; special function
.byte $1 ; only north bg
; dock
location1:
.byte $ff ; north exit
.byte $2 ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
@ -422,4 +605,28 @@ location1:
.byte $ff,$ff ; special x
.byte $ff,$ff ; special y
.word $0000 ; special function
.byte $f ; all bgs
; by dock switch
location2:
.byte $ff ; north exit
.byte $1 ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte $ff ; special exit
.word dock_switch_n_rle ; north bg
.word $0000 ; south bg
.word $0000 ; east bg
.word $0000 ; west bg
.byte $ff,$ff ; special x
.byte $ff,$ff ; special y
.word $0000 ; special function
.byte $1 ; only north
; Looking North, click enter, go to north exit
; Looking South, click enter, go to south exit
; Looking East, click enter, go to east exit
; Looking North, if east_bg then show left arrow

View File

@ -230,3 +230,60 @@ dock_w_rle: .byte $28 ; ysize=48
.byte $AD,$80, $AA,$00, $80, $A0,$1D,$88
.byte $A1
; cycles=886
dock_switch_n_rle: .byte $28 ; ysize=48
.byte $A0,$11,$77, $57, $07, $A0,$15,$77, $55, $57, $AD,$77
.byte $57, $07, $55, $50, $55, $07, $A0,$13,$77
.byte $55,$55, $AD,$77, $A5,$55, $50, $A0,$13,$77, $22, $25
.byte $57, $A9,$77, $FF, $77,$77, $55, $05,$05, $A3,$55
.byte $00, $77, $55, $00, $55, $AE,$77, $22,$22
.byte $25, $55, $A6,$77, $87,$87, $8F, $A6,$88, $85
.byte $80, $85, $87, $25, $20, $25, $AE,$77
.byte $A3,$22, $55, $57, $A4,$77, $87, $A7,$88, $58
.byte $28,$28, $A3,$55, $22,$22, $82, $87, $88, $87
.byte $AB,$77, $A4,$22, $55, $A3,$77, $88, $A9,$55, $22
.byte $02, $05,$05, $00, $22, $A6,$88, $AA,$77, $A4,$22
.byte $25, $A3,$77, $88, $00, $A7,$05, $20,$20, $22,$22
.byte $00,$00, $22,$22, $88,$88, $98, $88, $58, $57
.byte $A9,$77, $A5,$22, $55,$55, $77, $98, $A5,$50, $22,$22
.byte $00, $02, $A3,$22, $00,$00, $22,$22, $88, $A3,$99
.byte $55,$55, $A9,$77, $A5,$22, $55,$55, $77, $99, $A5,$55
.byte $22,$22, $00,$00, $02, $22,$22, $00,$00, $02,$02, $88
.byte $A3,$99, $00, $55, $A9,$77, $00, $A4,$22, $55
.byte $88, $89,$89, $05, $A4,$55, $22,$22, $A8,$00, $90
.byte $88, $A3,$99, $00, $55, $87, $A8,$77, $00,$00
.byte $22,$22, $A4,$99, $08, $28, $08, $22, $05,$05
.byte $02, $22, $A7,$00, $99, $88,$88, $A3,$99, $00
.byte $55, $88, $A8,$77, $50,$50, $A4,$00, $70,$70, $00
.byte $22, $00, $22, $08, $88, $80, $A8,$00
.byte $09, $88,$88, $A3,$99, $90, $05, $58, $88,$88
.byte $87, $88, $77, $87,$87, $77, $00, $05,$05
.byte $50,$50, $05, $00,$00, $77, $72, $70, $22
.byte $A3,$00, $08, $22, $80, $A6,$00, $08, $88
.byte $59, $A3,$99, $00, $85, $00, $58, $A5,$88
.byte $77, $A4,$00, $05,$05, $55,$55, $0F,$0F, $A3,$77, $70
.byte $00,$00, $22, $00, $08, $80, $A5,$00, $58
.byte $D5,$D5, $99,$99, $00, $88, $00, $88, $85
.byte $58,$58, $A3,$88, $AA,$00, $50, $07, $A4,$77, $72
.byte $00,$00, $22, $A4,$00, $50, $55, $50,$50, $55
.byte $99, $00, $88, $00, $A3,$88, $55, $58
.byte $88,$88, $A9,$00, $05, $00, $50, $07, $A3,$F7
.byte $77,$77, $00, $22, $A4,$00, $A6,$D5, $90, $88
.byte $00, $09, $99, $88, $89, $95,$95, $88
.byte $A9,$00, $50, $05, $00, $05,$05, $00,$00, $77,$77
.byte $50, $02, $A4,$00, $DD, $A4,$88, $DD, $99
.byte $88, $80, $00, $89, $A3,$88, $89, $99
.byte $AC,$00, $50, $05, $00, $50,$50, $57, $55
.byte $A5,$00, $DD, $A4,$88, $DD, $99, $88,$88, $00
.byte $A6,$88, $AB,$00, $05, $00, $A4,$25, $55, $75
.byte $A5,$00, $DD, $A4,$88, $DD, $00, $08, $88,$88
.byte $00, $A5,$58, $AB,$00, $20, $A3,$22, $52, $55
.byte $F5, $77, $A5,$00, $DD, $A4,$88, $DD, $00
.byte $50, $00, $88, $00, $84, $A4,$44, $A8,$00
.byte $55, $00,$00, $A3,$22, $52, $55,$55, $FF, $F7
.byte $A5,$00, $DD, $A4,$D8, $DD, $05, $A4,$00, $48
.byte $A4,$44, $A8,$00, $55, $A5,$00, $05, $07,$07, $0F,$0F
.byte $A5,$00, $A6,$55, $A3,$00, $50, $05, $A5,$44, $A8,$00
.byte $55, $AF,$00, $A4,$55, $05, $A4,$00, $55, $00
.byte $A5,$44
.byte $A1
; cycles=48572

View File

@ -42,15 +42,17 @@ CURSOR_Y= $63
XPOS = $64
YPOS = $65
DIRECTION = $66
; DIRECTION_N = $0
; DIRECTION_S = $1
; DIRECTION_E = $2
; DIRECTION_W = $3
DIRECTION_N = $0
DIRECTION_S = $1
DIRECTION_E = $2
DIRECTION_W = $3
LOCATION = $67
LOCATION_STRUCT_L = $68
LOCATION_STRUCT_H = $69
IN_SPECIAL = $6A
CURSOR_VISIBLE = $6B
IN_LEFT = $6C
IN_RIGHT = $6D
DISP_PAGE = $ED ; ALL
DRAW_PAGE = $EE ; ALL