shuffled the shuffle, backing up work

This commit is contained in:
Shoofle 2025-12-19 15:39:27 -05:00
parent f57b237b2a
commit 430baf4a92
4 changed files with 52 additions and 64 deletions

View File

@ -4,7 +4,8 @@ vState: db
vShuffleIndex: db
vShuffleTime: dw
vShuffleCount: db
def cShuffleMax equ 8 ; the number of times you have to shuffle before you've "fully shuffled"
def cShuffleEdgeCount equ 8 ; the total number of available messy edges
def cShufflesRequired equ 3 ; how many times you have to shuffle to get a fully shuffled deck
POPS
def S_Center = 0
@ -34,6 +35,8 @@ ShuffleSetup:
ld a, 0
ld [vAnimationFrame], a
ld a, cShuffleEdgeCount - cShufflesRequired
ld [vShuffleCount], a
ld a, S_Center
@ -79,16 +82,7 @@ ShuffleSetup:
ld c, 6
call CopyTilesToMap
ld hl, Shuffle.ShuffledEdges
ld de, _SCRN0 + 32*7 + 7
ld b, 8
ld c, 1
call CopyTilesToMap
ld hl, Shuffle.ShuffledEdges + 8
ld de, _SCRN0 + 32*7 + 12
ld b, 8
ld c, 1
call CopyTilesToMap
call UpdateEdges
; draw left arrow
ld a, VARIABLE_TILES_START + 18
@ -418,30 +412,7 @@ ShuffleDraw:
ShuffleTeardown:
ret
DoSomeShuffling:
rept 20 ; every time we shuffle do 20 swaps
call OneSwap
endr
ld hl, vShuffleCount
inc [hl]
ld hl, vAsyncIsBusy
xor a, a
cp a, [hl]
ld hl, .asyncTask
call z, Async_Spawn_HL
ret
.asyncTask
ld hl, vShuffleCount
ld a, cShuffleMax
cp a, [hl]
jr nc, .drawFrame ; if shufflemax-shufflecount doesn't carry, then draw a frame of animation
ret c ; if shufflemax - shufflecount does carry, then we don't have to draw anything
.drawFrame
UpdateEdges:
ld a, [vShuffleCount]
ld hl, Shuffle.ShuffledEdges
ld bc, 16
@ -469,11 +440,30 @@ DoSomeShuffling:
ld c, 1
call CopyTilesToMap
ld hl, vShuffleCount
ld a, cShuffleMax
cp a, [hl]
ret nz
ret
DoSomeShuffling:
rept 26 ; every time we shuffle do 20 swaps
call OneSwap
endr
ld hl, vShuffleCount
inc [hl]
ld hl, vAsyncIsBusy
xor a, a
cp a, [hl]
ld hl, .asyncTask
call z, Async_Spawn_HL
ret
.asyncTask
ld hl, vShuffleCount
ld a, cShuffleEdgeCount
cp a, [hl]
call nc, UpdateEdges ; if shufflemax-shufflecount doesn't carry, then draw a frame of animation
ret
OneSwap: ; shuffles once and decrements vshuffleindex
@ -653,7 +643,6 @@ Shuffle.UITileData:
db $4d,$df,$4b,$df,$4b,$df,$4a,$df,$4a,$df,$42,$cf,$40,$cf,$40,$cf
db $c2,$f3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3
db $a2,$f3,$82,$e3,$82,$e3,$82,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3
db $4d,$df,$4d,$df,$4d,$df,$4c,$df,$4c,$df,$46,$cf,$46,$cf,$46,$cf
db $82,$c3,$82,$c3,$82,$c3,$82,$c3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3
db $4d,$df,$4d,$df,$4d,$df,$4d,$df,$4d,$df,$46,$cf,$46,$cf,$46,$cf
db $43,$c7,$46,$cf,$46,$cf,$46,$cf,$46,$cf,$46,$cf,$46,$cf,$46,$cf
@ -688,21 +677,21 @@ Shuffle.BigCard: ; 6 wide by 10 tall
db $29, $2a, $2a, $2a, $2a, $2b
Shuffle.ShuffledEdges: ; this is a list of 10 pairs of 1x8 tall sprites, edges for the messy pile of cards
db $34, $38, $3e, $45, $4c, $53, $5f, $62
db $61, $39, $3f, $46, $4d, $54, $57, $5e
db $35, $3a, $40, $47, $4c, $53, $5f, $62
db $61, $39, $3f, $46, $4d, $54, $57, $5e
db $35, $3a, $40, $47, $4c, $53, $5f, $62
db $60, $3b, $41, $48, $4e, $55, $58, $5c
db $35, $3a, $42, $49, $4f, $56, $59, $5b
db $60, $3b, $41, $48, $4e, $55, $58, $5c
db $35, $3a, $42, $49, $51, $56, $59, $5b
db $36, $3c, $43, $4a, $50, $55, $58, $5c
db $35, $3a, $42, $49, $51, $56, $59, $5b
db $22, $22, $22, $4b, $50, $55, $58, $5c
db $37, $3d, $44, $44, $52, $56, $5a, $5d
db $22, $22, $22, $4b, $50, $55, $58, $5c
db $37, $3d, $44, $44, $52, $56, $5a, $5d
db $34, $38, $3e, $45, $4c, $52, $5e, $61,
db $60, $39, $3f, $46, $4d, $53, $56, $5d
db $35, $3a, $40, $47, $4c, $52, $5e, $61
db $60, $39, $3f, $46, $4d, $53, $56, $5d
db $35, $3a, $40, $47, $4c, $52, $5e, $61
db $5f, $3b, $41, $48, $4e, $54, $57, $5b
db $35, $3a, $42, $49, $50, $55, $58, $5a
db $5f, $3b, $41, $48, $4e, $54, $57, $5b
db $35, $3a, $42, $49, $50, $55, $58, $5a
db $36, $3c, $43, $4a, $4f, $54, $57, $5b
db $35, $3a, $42, $49, $50, $55, $58, $5a
db $22, $22, $22, $4b, $4f, $54, $57, $5b
db $37, $3d, $44, $44, $51, $55, $59, $5c
db $22, $22, $22, $4b, $4f, $54, $57, $5b
db $37, $3d, $44, $44, $51, $55, $59, $5c
db $22, $22, $22, $22, $22, $22, $22, $22
db $1e, $1e, $1e, $1e, $1e, $1e, $1e, $1e
db $22, $22, $22, $22, $22, $22, $22, $22

Binary file not shown.

View File

@ -56,7 +56,6 @@ tileset:
db $4d,$df,$4b,$df,$4b,$df,$4a,$df,$4a,$df,$42,$cf,$40,$cf,$40,$cf
db $c2,$f3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3
db $a2,$f3,$82,$e3,$82,$e3,$82,$e3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3
db $4d,$df,$4d,$df,$4d,$df,$4c,$df,$4c,$df,$46,$cf,$46,$cf,$46,$cf
db $82,$c3,$82,$c3,$82,$c3,$82,$c3,$c2,$e3,$c2,$e3,$c2,$e3,$c2,$e3
db $4d,$df,$4d,$df,$4d,$df,$4d,$df,$4d,$df,$46,$cf,$46,$cf,$46,$cf
db $43,$c7,$46,$cf,$46,$cf,$46,$cf,$46,$cf,$46,$cf,$46,$cf,$46,$cf
@ -80,11 +79,11 @@ tileset:
ShuffleUI:
db $34, $61, $35, $61, $35, $60, $35, $60, $35, $36, $35, $22, $37, $22, $37, $22, $1e, $22
db $34, $60, $35, $60, $35, $5f, $35, $5f, $35, $36, $35, $22, $37, $22, $37, $22, $1e, $22
db $38, $39, $3a, $39, $3a, $3b, $3a, $3b, $3a, $3c, $3a, $22, $3d, $22, $3d, $22, $1e, $22
db $3e, $3f, $40, $3f, $40, $41, $42, $41, $42, $43, $42, $22, $44, $22, $44, $22, $1e, $22
db $45, $46, $47, $46, $47, $48, $49, $48, $49, $4a, $49, $4b, $44, $4b, $44, $22, $1e, $22
db $4c, $4d, $4c, $4d, $4c, $4e, $4f, $4e, $51, $50, $51, $50, $52, $50, $52, $22, $1e, $22
db $53, $54, $53, $54, $53, $55, $56, $55, $56, $55, $56, $55, $56, $55, $56, $22, $1e, $22
db $5f, $57, $5f, $57, $5f, $58, $59, $58, $59, $58, $59, $58, $5a, $58, $5a, $22, $1e, $22
db $62, $5e, $62, $5e, $62, $5c, $5b, $5c, $5b, $5c, $5b, $5c, $5d, $5c, $5d, $22, $1e, $22
db $4c, $4d, $4c, $4d, $4c, $4e, $50, $4e, $50, $4f, $50, $4f, $51, $4f, $51, $22, $1e, $22
db $52, $53, $52, $53, $52, $54, $55, $54, $55, $54, $55, $54, $55, $54, $55, $22, $1e, $22
db $5e, $56, $5e, $56, $5e, $57, $58, $57, $58, $57, $58, $57, $59, $57, $59, $22, $1e, $22
db $61, $5d, $61, $5d, $61, $5b, $5a, $5b, $5a, $5b, $5a, $5b, $5c, $5b, $5c, $22, $1e, $22

Binary file not shown.