reversed cards now integrated into shuffling etc

This commit is contained in:
Shoofle 2025-09-28 13:01:18 -04:00
parent e70b752ec2
commit 0f8152a803
7 changed files with 82 additions and 35 deletions

View File

@ -113,10 +113,12 @@ LoadCardDataAsync:
ld [cvCardAddress + 1], a
ld b, a
ld a, [vCurrentCardReversed]
call OneRandomByte
ld a, [rLFSR]
and a, 1
ld a, [vSelectedCardIndex]
ld b, 0
ld c, a ; bc from a, the number of the card in the cards list
ld hl, DECK_FLIPS + 1
add hl, bc
ld a, [hl]
ld [vCurrentCardReversed], a
cp a, 0
@ -428,11 +430,11 @@ CardInit:
ld [rOBP0], a
ld [rOBP1], a
call CARD_INIT - 1
ld a, [vCurrentCardReversed]
cp a, 0
call nz, RotateSprites180
call CARD_INIT - 1
ret
CardUpdate:

View File

@ -93,6 +93,21 @@ CardBrowseUpdate:
ret
.doneWithB
ld hl, rMYBTNP
bit 4, [hl]
jp z, .doneWithA
ld a, [vSelectedCardIndex]
ld b, 0
ld c, a
ld hl, DECK_FLIPS+1
add hl, bc
ld a, [hl]
xor a, %10000000
ld [hl], a
jr .attemptCardChange
.doneWithA
ld a, [vSelectedCardIndex]
ld hl, rMYBTNP
bit 0, [hl]
@ -103,6 +118,8 @@ CardBrowseUpdate:
jp z, :+ ; skip the following code if right is not pressed
dec a
:
.doneWithButtons
ld [vSelectedCardIndex], a
ld hl, Cards
call ArrayClampLooping
@ -113,6 +130,8 @@ CardBrowseUpdate:
cp a, [hl]
ret z ; if the selected card diddn't change, nothing to do
.attemptCardChange
ld a, [vBlocked]
cp a, 0
ret nz

View File

@ -91,6 +91,7 @@ CardReadUpdate:
ret
.doneWithB
ld a, [vSelectedSpreadCard]
ld hl, rMYBTNP
bit 1, [hl]
@ -181,6 +182,7 @@ ChangedCardTask:
ld b, 0
add hl, bc
ld a, [hl]
ld [vSelectedCardIndex], a
ld [vPreviousCardIndex], a

View File

@ -27,8 +27,7 @@ ScreenShuffle:
dw ShuffleTeardown
ShuffleSetup:
ld hl, SHUFFLED_DECK
ld a, [hl]
ld a, [SHUFFLED_DECK]
dec a
ld [vShuffleIndex], a
@ -164,24 +163,20 @@ CenterButtonHandler:
ld hl, rMYBTNP
: bit 0, [hl]
jp z, :+
ld a, S_RightOut
ld [vState], a
ld a, S_RightOut
ld [vState], a
: bit 1, [hl]
jp z, :+
ld a, S_LeftOut
ld [vState], a
ld a, S_LeftOut
ld [vState], a
: bit 2, [hl]
jp z, :+
ld a, S_UpOut
ld [vState], a
ld a, S_UpOut
ld [vState], a
: bit 3, [hl]
jp z, :+
ld a, S_DownOut
ld [vState], a
ld a, S_DownOut
ld [vState], a
: ret
RightButtonHandler:
@ -353,6 +348,10 @@ DoSomeShuffling:
call OneSwap
call OneSwap
call OneSwap
call OneSwap
call OneSwap
call OneSwap
call OneSwap
ret
OneSwap: ; shuffles once and decrements vshuffleindex
@ -370,6 +369,17 @@ OneSwap: ; shuffles once and decrements vshuffleindex
ld hl, SHUFFLED_DECK
call SwapCards ; arguments c and e as indices to swap, hl as array in memory
call ClockLFSR
ld a, [vShuffleIndex]
ld b, 0
ld c, a
ld hl, DECK_FLIPS+1
add hl, bc
ld a, [rLFSR]
and a, %10000000
ld [hl], a
ld a, [vShuffleIndex]
dec a
ld [vShuffleIndex], a ; decrement vshuffleindex so the next time around

View File

@ -7,9 +7,15 @@
TheFool:
db 10, "PAGE OF "
db 10, "CUPS "
db 9, "dreamer "
db 9, "new love "
db 9, "imagine "
db 9, "childish "
db 9, "seduction"
db 9, "envy "
dw .BackgroundCopyEnd - .BackgroundCopy
dw .BackgroundCopy
dw .KeyArtTilesEnd - .KeyArtTiles
@ -26,12 +32,9 @@ TheFool:
.fDraw: ret
.fPrintPrep: ret
.SpriteTiles:
.SpriteTilesEnd:
.KeyArtTiles:
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$01,$01,$03,$03,$07,$07,$0f,$0f,$0f,$0f,$0f,$0f

View File

@ -7,9 +7,6 @@
; fae for all your help on music and sound and sunday mornings
; sadie for hardware and packaging help
def MY_OAM equ $c000
; $c100 - c120 call handles, scene stack, interrupt, card functions
@ -41,7 +38,8 @@ def CARD_VARS_START equ $c700 ; variables for animation of individual cards
def CVS equ CARD_VARS_START ; handy to be able to refer to CVS by a short name
def AUDIO_VARS_START equ $c800 ; variables for the audio subsystem
def PRINTER_VARS_START equ $c900
def SHUFFLED_DECK equ $ca00 ; location for the shuffled deck
def SHUFFLED_DECK equ $cb00 ; location for the shuffled deck
def DECK_FLIPS equ $cb80 ; location for the flips
pushs "work spaces", WRAMX[$D000]
ZEROES: ds $200
@ -138,16 +136,29 @@ EntryPoint:
ld a, 0
ld [vSelectedSpreadIndex], a
ld [vSelectedCardIndex], a
; set up the SHUFFLED_DECK
ld hl, Cards
ld b, [hl]
ld b, [hl] ; b holds the length of the card array
ld hl, SHUFFLED_DECK
ld [hl], b
inc hl
.writeCard
.writeCard
ld [hl+], a
inc a
cp a, b
jr nz, .writeCard
ld c, 0 ; c holds the thing to write to each flip
ld a, b ; a holds the length of the array
ld hl, DECK_FLIPS
ld [hl+], a
inc a
cp a, b
jr nz, .writeCard
.writeFlip
ld [hl], c ; write a zero to a spot in the array
inc hl
dec a ; decrement our length counter
jr nz, .writeFlip
ld a, %1010_1010
ld [rLFSR], a

Binary file not shown.