mist: cursor now changes as you mouse over things

This commit is contained in:
Vince Weaver 2020-03-01 12:45:24 -05:00
parent bf6beefc21
commit 6350149f59
9 changed files with 328 additions and 2 deletions

View File

@ -42,8 +42,13 @@ mist.o: mist.s zp.inc hardware.inc \
####
mist_graphics.inc: \
m_link_book.png
m_link_book.png \
dock_n.png dock_s.png dock_e.png dock_w.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
####

BIN
mist/dock_e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

BIN
mist/dock_n.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
mist/dock_s.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

BIN
mist/dock_w.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

View File

@ -25,10 +25,24 @@ mist_start:
lda #0
sta DRAW_PAGE
; init cursor
lda #20
sta CURSOR_X
sta CURSOR_Y
; init location
lda #0
sta LOCATION
lda #0
sta DIRECTION
lda #<location0
sta LOCATION_STRUCT_L
lda #>location0
sta LOCATION_STRUCT_H
setup_room:
@ -52,14 +66,69 @@ game_loop:
;====================================
; draw pointer
;====================================
draw_pointer:
lda CURSOR_X
sta XPOS
lda CURSOR_Y
sta YPOS
; see if inside special region
ldy #LOCATION_SPECIAL_EXIT
lda (LOCATION_STRUCT_L),Y
bmi finger_not_special
; 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 #<finger_grab_sprite
sta INL
lda #>finger_grab_sprite
jmp finger_draw
finger_not_special:
finger_point:
lda #<finger_point_sprite
sta INL
lda #>finger_point_sprite
jmp finger_draw
finger_left:
lda #<finger_left_sprite
sta INL
lda #>finger_left_sprite
jmp finger_draw
finger_right:
lda #<finger_right_sprite
sta INL
lda #>finger_right_sprite
jmp finger_draw
finger_draw:
sta INH
jsr put_sprite_crop
@ -199,4 +268,59 @@ finger_right_sprite:
;===============================================
; location data
;===============================================
; 19 bytes
LOCATION_NORTH_EXIT=0
LOCATION_SOUTH_EXIT=1
LOCATION_EAST_EXIT=2
LOCATION_WEST_EXIT=3
LOCATION_SPECIAL_EXIT=4
LOCATION_NORTH_BG=5
LOCATION_SOUTH_BG=7
LOCATION_EAST_BG=9
LOCATION_WEST_BG=11
LOCATION_SPECIAL_X1=13
LOCATION_SPECIAL_X2=14
LOCATION_SPECIAL_Y1=15
LOCATION_SPECIAL_Y2=16
LOCATION_SPECIAL_FUNC=17
locations:
.word location0,location1
; myst linking book
location0:
.byte $ff ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte $00 ; special exit
.word $0000 ; north bg
.word $0000 ; south bg
.word $0000 ; east bg
.word $0000 ; west bg
.byte 21,31 ; special x
.byte 10,24 ; special y
.word $0000 ; special function
; dock
location1:
.byte $ff ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte $ff ; special exit
.word dock_n_rle ; north bg
.word dock_s_rle ; south bg
.word dock_e_rle ; east bg
.word dock_w_rle ; west bg
.byte $ff,$ff ; special x
.byte $ff,$ff ; special y
.word $0000 ; special function

View File

@ -42,3 +42,191 @@ link_book_rle: .byte $28 ; ysize=48
.byte $FF, $A9,$00, $A0,$1F,$0F, $A5,$00
.byte $A1
; cycles=1154
dock_n_rle: .byte $28 ; ysize=48
.byte $A3,$55, $22, $55, $A4,$22, $A0,$1F,$77, $A3,$55, $22
.byte $55, $22, $55, $22, $A0,$20,$77, $A3,$55, $22
.byte $55, $22, $77, $22, $A0,$20,$77, $A3,$25, $22
.byte $55, $22, $47, $22, $A0,$20,$77, $A6,$22, $44
.byte $22, $A0,$20,$77, $A8,$22, $47, $A8,$77, $57, $55
.byte $50, $07, $A0,$13,$77, $A9,$22, $A5,$77, $A3,$57, $55
.byte $85, $A3,$55, $58, $55, $A0,$10,$77, $02, $A9,$22
.byte $27, $A3,$77, $47, $45, $87, $48, $95
.byte $55, $50, $85, $88, $55, $57, $77,$77
.byte $55, $AC,$77, $00,$00, $A9,$22, $77,$77, $88,$88, $44
.byte $98, $88,$88, $55, $85, $58, $88, $84,$84
.byte $44, $88, $99, $AC,$77, $00,$00, $02, $A8,$22
.byte $47, $77, $88,$88, $55, $A3,$85, $58, $05
.byte $00, $88, $98, $88, $44, $88, $99
.byte $AC,$77, $A3,$00, $A8,$22, $44, $77, $88,$88, $A7,$00
.byte $88, $99, $00, $44,$44, $99, $AC,$77, $A4,$00
.byte $A7,$22, $44, $97, $88, $08, $A4,$00, $48
.byte $88, $80, $55, $99, $00,$00, $84, $99
.byte $AC,$77, $80, $87, $85, $A4,$05, $07, $05,$05
.byte $00, $20, $A3,$22, $20,$20, $A4,$44, $08, $55
.byte $99, $80, $00,$00, $88, $99, $87, $84
.byte $A9,$77, $00,$00, $88, $A9,$00, $A5,$22, $55,$55, $58
.byte $44, $88, $55, $99, $88,$88, $00, $88
.byte $99, $88,$88, $A9,$77, $00,$00, $88, $AB,$00, $A3,$22
.byte $55, $75, $77, $55, $08, $88, $09
.byte $88,$88, $80, $88, $99, $88, $00, $88
.byte $A8,$55, $00,$00, $88, $AB,$00, $02, $22,$22, $80,$80
.byte $87, $85, $00, $A6,$88, $99, $88, $00
.byte $99, $88, $A4,$45, $55, $45, $85, $00,$00
.byte $88, $AC,$00, $02, $22, $A6,$88, $99, $55
.byte $05, $48,$48, $99, $48,$48, $00, $94, $A3,$44
.byte $84, $48,$48, $44, $00,$00, $08, $88, $80
.byte $AA,$00, $80, $A7,$88, $89, $98, $88, $45,$45
.byte $99, $94, $44,$44, $00, $84,$84, $48, $A4,$44
.byte $A4,$00, $08, $88, $80, $A7,$00, $80, $A9,$88
.byte $99, $88, $A3,$45, $99, $84,$84, $48, $08
.byte $A6,$44, $A5,$00, $08, $88, $80, $A6,$00, $58
.byte $88, $A3,$58, $85, $A5,$88, $99, $A4,$45, $58
.byte $54, $44, $40, $05, $55, $44, $45
.byte $55, $44, $A7,$00, $88, $A5,$00, $55,$55, $85,$85
.byte $A8,$88, $89, $95, $A3,$45, $44, $54,$54, $44
.byte $49, $09, $44, $45, $54, $45, $A7,$00
.byte $08, $88, $A3,$00, $80, $58,$58, $AB,$88, $99
.byte $A4,$45, $04, $54,$54, $44, $00, $94, $A3,$44
.byte $A8,$00, $88, $80, $00,$00, $85, $AD,$88, $89
.byte $99, $45,$45, $00, $75, $A3,$55, $05, $00
.byte $85, $45,$45, $A8,$00, $08, $88, $00, $A0,$10,$88
.byte $89, $99, $44, $00, $05, $57, $07
.byte $A3,$00, $88, $45,$45
.byte $A1
; cycles=1467
dock_s_rle: .byte $28 ; ysize=48
.byte $AE,$77, $44,$44, $77, $44,$44, $77, $44, $77
.byte $44,$44, $00, $77, $44, $77, $00, $44
.byte $77, $47, $44, $00, $44,$44, $88, $44
.byte $88,$88, $AE,$77, $44, $84, $77, $44,$44, $77
.byte $44, $47, $88, $44, $00, $74, $44,$44
.byte $00, $44, $77, $44, $84, $00, $44,$44
.byte $88, $44,$44, $48, $AD,$77, $47, $44, $88
.byte $77, $A3,$44, $84, $44, $88, $44, $00
.byte $47, $88, $44, $00, $A3,$44, $88, $00
.byte $44,$44, $88, $A3,$44, $AD,$77, $44,$44, $88, $47
.byte $84, $44,$44, $88, $44, $88, $44, $00
.byte $44, $88, $44, $00, $A3,$44, $88, $00
.byte $44,$44, $88, $A3,$44, $AD,$77, $44, $77, $88
.byte $44, $88, $44, $74, $88, $44, $88
.byte $44, $00, $04, $88, $44, $00, $A3,$44
.byte $88, $00, $44,$44, $88, $44, $84, $44
.byte $AD,$77, $84, $77, $88, $44, $88, $44,$44
.byte $88, $44, $88, $44, $00, $44, $88
.byte $44, $00, $77, $44,$44, $88, $00, $44,$44
.byte $88, $44, $88, $84, $AC,$77, $44, $88
.byte $44, $88, $44, $88,$88, $44, $88, $44
.byte $88, $44, $00, $44, $88, $44, $00
.byte $77, $44,$44, $88, $00, $77, $44, $88
.byte $44, $88,$88, $AC,$77, $44, $88, $44, $88
.byte $44, $88, $44,$44, $88, $44, $88, $44
.byte $00, $44, $88, $44, $00, $77, $44,$44
.byte $88, $00, $77,$77, $88, $44, $88,$88, $AC,$77
.byte $74, $88, $44, $88, $44, $88, $44
.byte $74, $88, $44, $88, $44, $00, $44
.byte $88, $44, $00, $77, $44,$44, $88, $00
.byte $77,$77, $88, $44, $88,$88, $AD,$77, $88, $44
.byte $88, $77, $88,$88, $77, $88, $44, $88
.byte $44, $00, $04, $08, $A5,$00, $40, $00
.byte $40, $A5,$00, $AD,$77, $88, $74, $88, $77
.byte $88,$88, $77, $88, $A8,$00, $04, $A4,$00, $04
.byte $40, $A4,$00, $AD,$77, $88, $77, $28, $27
.byte $28,$28, $27, $08, $A7,$00, $04, $00,$00, $04
.byte $00, $40, $A6,$00, $AC,$77, $A3,$55, $A5,$22, $A9,$00
.byte $04, $00, $44, $00, $04, $00,$00, $02
.byte $A3,$22, $AA,$A7, $57, $55,$55, $25, $A6,$22, $AA,$00
.byte $40, $A6,$00, $02, $22,$22, $A9,$4A, $5A, $A3,$55
.byte $A7,$22, $AA,$00, $44, $A7,$00, $22,$22, $A8,$44, $54
.byte $55,$55, $A9,$22, $20, $A0,$13,$00, $A6,$44, $55, $54
.byte $A3,$55, $AA,$22, $A0,$13,$00, $A5,$44, $54, $A5,$55, $AA,$22
.byte $A0,$13,$00, $A4,$44, $A7,$55, $AA,$22, $A0,$13,$00, $44,$44, $54,$54
.byte $A5,$55, $A4,$00, $A8,$22, $A3,$00, $22, $AF,$00, $44
.byte $A8,$55, $A4,$00, $A7,$22, $02, $A3,$00, $22, $AF,$00
.byte $44, $A8,$55, $80,$80, $D0, $DD, $22,$22, $A5,$82
.byte $A6,$80, $AE,$00, $44, $88,$88, $48, $88, $48
.byte $A3,$55, $88,$88, $DD,$DD, $82,$82, $AC,$88, $AD,$00, $84
.byte $48, $44, $88, $48, $44, $A3,$55, $88,$88
.byte $8D, $A0,$10,$88, $AC,$00
.byte $A1
; cycles=938
dock_e_rle: .byte $28 ; ysize=48
.byte $A7,$77, $90, $88, $A0,$26,$77, $09, $88, $A0,$26,$77
.byte $99, $88, $A0,$26,$77, $09, $88, $87, $A0,$24,$77
.byte $57, $05, $80, $70, $A0,$23,$77, $57, $75
.byte $99, $88, $A0,$23,$77, $57, $75, $77, $09
.byte $88, $A0,$22,$77, $57, $75, $77,$77, $99, $88
.byte $A0,$20,$77, $57, $75, $A4,$77, $09, $88, $A0,$1F,$77
.byte $75, $A5,$77, $55, $99, $88, $A0,$25,$77, $55
.byte $09, $88, $A0,$25,$77, $55, $90, $88, $A0,$24,$77
.byte $55, $77, $79, $88, $A0,$15,$77, $87, $A9,$77
.byte $A3,$55, $A5,$85, $88, $A5,$85, $A0,$10,$55, $88, $A9,$55
.byte $54, $4A, $AA,$88, $08, $48, $54, $45
.byte $54, $45, $54, $45, $54, $45, $54
.byte $45, $54, $45, $54, $45, $54, $45
.byte $88, $45, $54, $45, $54, $45, $54
.byte $45, $54, $45, $A3,$44, $A7,$00, $80, $D0
.byte $00, $A0,$11,$44, $88, $A9,$44, $A3,$04, $00,$00, $80
.byte $DD, $A5,$88, $00, $A0,$11,$44, $88, $A4,$44, $A5,$04
.byte $A3,$D0, $0D,$0D, $A5,$08, $D0,$D0, $80, $AD,$44, $48
.byte $A3,$44, $88, $A4,$44, $A9,$00, $A4,$0D, $8D,$8D, $80
.byte $48, $A0,$12,$44, $88, $A4,$44, $40, $A6,$00, $80
.byte $D0, $A4,$48, $08, $48, $A0,$14,$44, $88, $A5,$44
.byte $A4,$00, $80, $DD, $88, $DD, $A4,$44, $00
.byte $A0,$15,$44, $88, $A5,$44, $A3,$00, $80, $88, $DD
.byte $88, $DD, $A4,$44, $00, $A0,$1B,$44, $80, $00,$00
.byte $88,$88, $DD, $88, $DD, $A4,$44, $00, $A0,$1B,$44
.byte $A3,$00, $88, $A0,$22,$8D, $80, $A5,$00
.byte $A1
; cycles=1305
dock_w_rle: .byte $28 ; ysize=48
.byte $4F, $94, $F4, $A4,$44, $FF,$FF, $44, $A5,$FF
.byte $44, $AD,$FF, $0F, $50, $55, $05,$05, $00,$00
.byte $20, $A3,$00, $44, $99, $40, $A4,$44, $FF,$FF
.byte $44, $4F, $A4,$FF, $44, $AC,$FF, $0F, $55
.byte $75, $A3,$00, $20, $00, $22,$22, $20,$20, $44
.byte $99, $44,$44, $88, $44,$44, $FF, $F4, $44,$44
.byte $4F, $A3,$FF, $44, $AB,$FF, $50, $55, $00
.byte $77, $00, $20, $22,$22, $00, $A4,$22, $44
.byte $99, $84, $44, $88, $44,$44, $4F, $44
.byte $94, $44,$44, $FF,$FF, $44,$44, $5F, $AA,$FF, $55
.byte $22, $00, $77, $00, $A3,$22, $00, $A4,$22
.byte $44, $99, $88, $44, $88, $99, $A3,$44
.byte $99, $F4, $44, $FF,$FF, $A3,$44, $AB,$FF, $77
.byte $20, $77, $00, $A3,$22, $00, $A4,$22, $F4
.byte $99, $88, $F4, $88, $99, $A3,$44, $99
.byte $A3,$44, $FF, $44, $99, $44, $4F, $FF
.byte $4F, $A6,$FF, $2F,$2F, $77, $22, $77, $00
.byte $A3,$22, $00, $A4,$22, $FF, $99, $88, $FF
.byte $88, $99, $A3,$44, $99, $44, $84, $A3,$44
.byte $99, $44,$44, $FF, $44, $A4,$FF, $5F, $55
.byte $22,$22, $77, $22, $77, $00, $A3,$22, $50
.byte $A4,$52, $FF, $99, $88, $FF, $88, $99
.byte $04, $44,$44, $99, $44, $88, $44, $84
.byte $F4, $99, $F4, $44, $FF, $44, $FF,$FF
.byte $55, $A3,$57, $22,$22, $77, $52, $57, $A9,$55
.byte $FF, $99, $88, $FF, $88, $99, $FF
.byte $44,$44, $99, $FF, $88, $94, $88, $FF
.byte $99, $FF, $88, $FF, $88, $FF,$FF, $22
.byte $72, $A3,$22, $52, $57, $AB,$55, $FF, $99
.byte $88, $FF, $88, $99, $A3,$FF, $99, $FF
.byte $88, $99, $88, $FF, $99, $FF, $88
.byte $FF, $88, $FF,$FF, $22, $77, $82, $88
.byte $52, $AD,$55, $FF, $99, $88, $FF, $88
.byte $99, $A3,$FF, $99, $0F, $88, $99, $88
.byte $00,$00, $40,$40, $A3,$00, $AC,$44, $A7,$55, $00,$00, $08
.byte $00, $08,$08, $A7,$00, $40, $A4,$44, $A4,$00, $AC,$44
.byte $A6,$55, $00,$00, $40, $00, $40, $A6,$00, $40
.byte $A5,$44, $A5,$00, $AC,$44, $45, $A5,$55, $00,$00, $40
.byte $00, $04, $40, $00, $A3,$50, $54, $A6,$74
.byte $A5,$70, $AD,$74, $A5,$75, $00,$00, $04, $A5,$00, $05
.byte $A7,$55, $00, $A5,$88, $00, $A0,$11,$55, $A4,$00, $44
.byte $A4,$00, $A3,$05, $A4,$55, $00, $A5,$88, $00, $A0,$11,$55
.byte $A5,$00, $04, $A7,$00, $A3,$05, $50, $A5,$D8, $50
.byte $45, $A0,$10,$44, $A0,$10,$00, $55, $A5,$DD, $55, $A0,$11,$44
.byte $A0,$10,$00, $55, $A5,$DD, $55, $A0,$11,$44, $A0,$10,$00, $55
.byte $A5,$0D, $55, $A0,$11,$44, $A0,$10,$00, $55, $A5,$00, $55
.byte $54, $A4,$44, $04, $A0,$1B,$00, $55, $A6,$00, $55
.byte $A3,$44, $A0,$1D,$00, $55, $A6,$50, $55, $44,$44, $84
.byte $AD,$80, $AA,$00, $80, $A0,$1D,$88
.byte $A1
; cycles=886

BIN
mist/sprites.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

View File

@ -41,6 +41,15 @@ CURSOR_X= $62
CURSOR_Y= $63
XPOS = $64
YPOS = $65
DIRECTION = $66
; DIRECTION_N = $0
; DIRECTION_S = $1
; DIRECTION_E = $2
; DIRECTION_W = $3
LOCATION = $67
LOCATION_STRUCT_L = $68
LOCATION_STRUCT_H = $69
DISP_PAGE = $ED ; ALL
DRAW_PAGE = $EE ; ALL