diff --git a/CardHelpers.inc b/CardHelpers.inc index e11d8e1..1b12c11 100644 --- a/CardHelpers.inc +++ b/CardHelpers.inc @@ -113,11 +113,13 @@ LoadCardDataAsync: ld [cvCardAddress + 1], a ld b, a - ld a, [vCurrentCardReversed] - call OneRandomByte - ld a, [rLFSR] - and a, 1 - ld [vCurrentCardReversed], a + 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 jp z, LoadUpright @@ -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: diff --git a/ScreenCardBrowse.inc b/ScreenCardBrowse.inc index 48b04d2..fdb5383 100644 --- a/ScreenCardBrowse.inc +++ b/ScreenCardBrowse.inc @@ -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 diff --git a/ScreenCardRead.inc b/ScreenCardRead.inc index 6f5096d..ed78d97 100644 --- a/ScreenCardRead.inc +++ b/ScreenCardRead.inc @@ -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 diff --git a/ScreenShuffle.inc b/ScreenShuffle.inc index e843a16..85a91ef 100644 --- a/ScreenShuffle.inc +++ b/ScreenShuffle.inc @@ -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 diff --git a/cups11page.inc b/cups11page.inc index 67638e3..d9a9e1b 100644 --- a/cups11page.inc +++ b/cups11page.inc @@ -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 diff --git a/main.asm b/main.asm index aa015f0..60817db 100644 --- a/main.asm +++ b/main.asm @@ -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 - ld [hl+], a - inc a - cp a, b - jr nz, .writeCard + inc hl + .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 + .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 diff --git a/source.zip b/source.zip index 3fc0943..73d1ec6 100644 Binary files a/source.zip and b/source.zip differ