2022-06-06 14:25:42 -07:00
|
|
|
DEF CARDFLIP_LIGHT_OFF EQU "♂" ; $ef
|
|
|
|
DEF CARDFLIP_LIGHT_ON EQU "♀" ; $f5
|
2018-01-09 19:44:06 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF CARDFLIP_DECK_SIZE EQUS "(wDeckEnd - wDeck)"
|
2020-10-26 12:45:57 -07:00
|
|
|
assert wDiscardPileEnd - wDiscardPile == wDeckEnd - wDeck
|
2015-12-11 08:33:14 -08:00
|
|
|
|
2020-11-08 16:32:57 -08:00
|
|
|
MemoryGameGFX:
|
2018-01-02 07:25:40 -08:00
|
|
|
; Graphics for an unused Game Corner
|
|
|
|
; game were meant to be here.
|
2020-10-22 07:54:53 -07:00
|
|
|
|
|
|
|
UnusedCursor_InterpretJoypad_AnimateCursor:
|
2018-01-02 07:25:40 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
_CardFlip:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOptions
|
2018-04-05 08:44:02 -07:00
|
|
|
set NO_TEXT_SCROLL, [hl]
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearBGPalettes
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearSprites
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
call DisableLCD
|
|
|
|
call LoadStandardFont
|
2023-08-02 10:52:51 -07:00
|
|
|
call LoadFrame
|
2015-12-11 05:17:38 -08:00
|
|
|
|
|
|
|
ld hl, CardFlipLZ01
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $00
|
2015-11-11 20:38:57 -08:00
|
|
|
call Decompress
|
2015-12-11 05:17:38 -08:00
|
|
|
ld hl, CardFlipLZ02
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $3e
|
2015-11-11 20:38:57 -08:00
|
|
|
call Decompress
|
2015-12-11 05:17:38 -08:00
|
|
|
ld hl, CardFlipLZ03
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles0 tile $00
|
2015-11-11 20:38:57 -08:00
|
|
|
call Decompress
|
2015-12-11 05:17:38 -08:00
|
|
|
ld hl, CardFlipOffButtonGFX
|
2018-01-09 19:44:06 -08:00
|
|
|
ld de, vTiles0 tile CARDFLIP_LIGHT_OFF
|
2015-12-11 05:17:38 -08:00
|
|
|
ld bc, 1 tiles
|
2015-11-11 20:38:57 -08:00
|
|
|
call CopyBytes
|
2015-12-11 05:17:38 -08:00
|
|
|
ld hl, CardFlipOnButtonGFX
|
2018-01-09 19:44:06 -08:00
|
|
|
ld de, vTiles0 tile CARDFLIP_LIGHT_ON
|
2015-12-11 05:17:38 -08:00
|
|
|
ld bc, 1 tiles
|
2015-11-11 20:38:57 -08:00
|
|
|
call CopyBytes
|
2015-12-11 05:17:38 -08:00
|
|
|
|
2019-02-18 08:35:28 -08:00
|
|
|
call CardFlip_ShiftDigitsUpOnePixel
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_InitTilemap
|
|
|
|
call CardFlip_InitAttrPals
|
2015-11-11 20:38:57 -08:00
|
|
|
call EnableLCD
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2019-02-16 10:04:08 -08:00
|
|
|
ld a, %11100100
|
2015-11-11 20:38:57 -08:00
|
|
|
call DmgToCgbBGPals
|
2019-02-16 10:04:08 -08:00
|
|
|
lb de, %11100100, %11100100
|
2015-11-11 20:38:57 -08:00
|
|
|
call DmgToCgbObjPals
|
|
|
|
call DelayFrame
|
|
|
|
xor a
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ld a, $2
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipCursorY], a
|
|
|
|
ld [wCardFlipCursorX], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld de, MUSIC_GAME_CORNER
|
|
|
|
call PlayMusic
|
2016-04-10 11:42:14 -07:00
|
|
|
.MasterLoop:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .leavethegame
|
|
|
|
call .CardFlip
|
|
|
|
jr .MasterLoop
|
|
|
|
.leavethegame
|
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_QUIT_SLOTS
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
call ClearBGPalettes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOptions
|
2015-11-11 20:38:57 -08:00
|
|
|
res 4, [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CardFlip:
|
2020-07-01 10:13:49 -07:00
|
|
|
jumptable .Jumptable, wJumptableIndex
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jumptable:
|
2015-12-26 18:59:03 -08:00
|
|
|
dw .AskPlayWithThree
|
2023-09-02 09:23:25 -07:00
|
|
|
dw .DeductChips
|
2015-12-26 18:59:03 -08:00
|
|
|
dw .ChooseACard
|
|
|
|
dw .PlaceYourBet
|
|
|
|
dw .CheckTheCard
|
|
|
|
dw .TabulateTheResult
|
|
|
|
dw .PlayAgain
|
|
|
|
dw .Quit
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Increment:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.AskPlayWithThree:
|
2023-09-02 09:23:25 -07:00
|
|
|
ld hl, .CardFlipPlayWithThreeChipsText
|
|
|
|
call CardFlip_UpdateChipBalanceDisplay
|
2015-11-11 20:38:57 -08:00
|
|
|
call YesNoBox
|
|
|
|
jr c, .SaidNo
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_ShuffleDeck
|
2015-11-11 20:38:57 -08:00
|
|
|
call .Increment
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SaidNo:
|
2015-12-26 18:59:03 -08:00
|
|
|
ld a, 7
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
.CardFlipPlayWithThreeChipsText:
|
|
|
|
text_far _CardFlipPlayWithThreeChipsText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
.DeductChips:
|
|
|
|
ld a, [wChips]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld h, a
|
2023-09-02 09:23:25 -07:00
|
|
|
ld a, [wChips + 1]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld l, a
|
|
|
|
ld a, h
|
|
|
|
and a
|
2023-09-02 09:23:25 -07:00
|
|
|
jr nz, .deduct ; You have at least 256 chips.
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, l
|
|
|
|
cp 3
|
2023-09-02 09:23:25 -07:00
|
|
|
jr nc, .deduct ; You have at least 3 chips.
|
|
|
|
ld hl, .CardFlipNotEnoughChipsText
|
|
|
|
call CardFlip_UpdateChipBalanceDisplay
|
2015-12-26 18:59:03 -08:00
|
|
|
ld a, 7
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.deduct
|
|
|
|
ld de, -3
|
|
|
|
add hl, de
|
|
|
|
ld a, h
|
2023-09-02 09:23:25 -07:00
|
|
|
ld [wChips], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, l
|
2023-09-02 09:23:25 -07:00
|
|
|
ld [wChips + 1], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld de, SFX_TRANSACTION
|
|
|
|
call PlaySFX
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_PrintChipBalance
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-11 20:38:57 -08:00
|
|
|
call WaitSFX
|
|
|
|
call .Increment
|
|
|
|
ret
|
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
.CardFlipNotEnoughChipsText:
|
|
|
|
text_far _CardFlipNotEnoughChipsText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ChooseACard:
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 0, 0
|
|
|
|
lb bc, 12, 9
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillGreenBox
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 9, 0
|
|
|
|
ld bc, SCREEN_WIDTH
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipNumCardsPlayed]
|
2015-11-11 20:38:57 -08:00
|
|
|
call AddNTimes
|
2015-12-11 08:33:14 -08:00
|
|
|
ld [hl], CARDFLIP_LIGHT_ON
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, 20
|
|
|
|
call DelayFrames
|
|
|
|
hlcoord 2, 0
|
2015-12-11 13:59:40 -08:00
|
|
|
call PlaceCardFaceDown
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, 20
|
|
|
|
call DelayFrames
|
|
|
|
hlcoord 2, 6
|
2015-12-11 13:59:40 -08:00
|
|
|
call PlaceCardFaceDown
|
2015-11-11 20:38:57 -08:00
|
|
|
call WaitBGMap
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .CardFlipChooseACardText
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_UpdateChipBalanceDisplay
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipWhichCard], a
|
2015-11-11 20:38:57 -08:00
|
|
|
.loop
|
|
|
|
call JoyTextDelay
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyLast]
|
2015-11-11 20:38:57 -08:00
|
|
|
and A_BUTTON
|
|
|
|
jr nz, .next
|
|
|
|
ld de, SFX_KINESIS
|
|
|
|
call PlaySFX
|
2015-12-11 13:59:40 -08:00
|
|
|
call PlaceOAMCardBorder
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, 4
|
|
|
|
call DelayFrames
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wCardFlipWhichCard
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
xor $1
|
|
|
|
ld [hl], a
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.next
|
|
|
|
ld de, SFX_SLOT_MACHINE_START
|
|
|
|
call PlaySFX
|
|
|
|
ld a, $3
|
|
|
|
.loop2
|
|
|
|
push af
|
2015-12-11 13:59:40 -08:00
|
|
|
call PlaceOAMCardBorder
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, 4
|
|
|
|
call DelayFrames
|
|
|
|
call ClearSprites
|
|
|
|
ld c, 4
|
|
|
|
call DelayFrames
|
|
|
|
pop af
|
|
|
|
dec a
|
|
|
|
jr nz, .loop2
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wCardFlipWhichCard
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
xor $1
|
|
|
|
ld [hl], a
|
2015-12-11 13:59:40 -08:00
|
|
|
call GetCoordsOfChosenCard
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 6, 5
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillGreenBox
|
2015-11-11 20:38:57 -08:00
|
|
|
pop af
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipWhichCard], a
|
2015-11-11 20:38:57 -08:00
|
|
|
call .Increment
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.CardFlipChooseACardText:
|
|
|
|
text_far _CardFlipChooseACardText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PlaceYourBet:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .CardFlipPlaceYourBetText
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_UpdateChipBalanceDisplay
|
2015-11-11 20:38:57 -08:00
|
|
|
.betloop
|
|
|
|
call JoyTextDelay
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyLast]
|
2015-11-11 20:38:57 -08:00
|
|
|
and A_BUTTON
|
|
|
|
jr nz, .betdone
|
2015-12-11 13:59:40 -08:00
|
|
|
call ChooseCard_HandleJoypad
|
|
|
|
call CardFlip_UpdateCursorOAM
|
2015-11-11 20:38:57 -08:00
|
|
|
call DelayFrame
|
|
|
|
jr .betloop
|
|
|
|
|
|
|
|
.betdone
|
|
|
|
call .Increment
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.CardFlipPlaceYourBetText:
|
|
|
|
text_far _CardFlipPlaceYourBetText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CheckTheCard:
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hVBlankCounter], a
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_UpdateCursorOAM
|
2015-11-11 20:38:57 -08:00
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_CHOOSE_A_CARD
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipNumCardsPlayed]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-11 05:17:38 -08:00
|
|
|
ld hl, wDeck
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipWhichCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, a
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipFaceUpCard], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, a
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wDiscardPile
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [hl], TRUE
|
|
|
|
call GetCoordsOfChosenCard
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_DisplayCardFaceUp
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2015-11-11 20:38:57 -08:00
|
|
|
call .Increment
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.TabulateTheResult:
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_CheckWinCondition
|
2015-11-11 20:38:57 -08:00
|
|
|
call WaitPressAorB_BlinkCursor
|
|
|
|
call .Increment
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PlayAgain:
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearSprites
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .CardFlipPlayAgainText
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_UpdateChipBalanceDisplay
|
2015-11-11 20:38:57 -08:00
|
|
|
call YesNoBox
|
|
|
|
jr nc, .Continue
|
|
|
|
call .Increment
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Continue:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipNumCardsPlayed]
|
2015-11-11 20:38:57 -08:00
|
|
|
inc a
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipNumCardsPlayed], a
|
|
|
|
cp 12
|
2015-11-11 20:38:57 -08:00
|
|
|
jr c, .KeepTheCurrentDeck
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_InitTilemap
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_ShuffleDeck
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .CardFlipShuffledText
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-11 20:38:57 -08:00
|
|
|
jr .LoopAround
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.KeepTheCurrentDeck:
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_BlankDiscardedCardSlot
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.LoopAround:
|
2015-12-26 18:59:03 -08:00
|
|
|
ld a, 1
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.CardFlipPlayAgainText:
|
|
|
|
text_far _CardFlipPlayAgainText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.CardFlipShuffledText:
|
|
|
|
text_far _CardFlipShuffledText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Quit:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_ShuffleDeck:
|
2015-12-11 05:17:38 -08:00
|
|
|
ld hl, wDeck
|
2015-12-11 13:59:40 -08:00
|
|
|
ld bc, CARDFLIP_DECK_SIZE
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
2015-12-11 05:17:38 -08:00
|
|
|
ld de, wDeck
|
2015-12-11 13:59:40 -08:00
|
|
|
ld c, CARDFLIP_DECK_SIZE - 1
|
2015-12-11 05:17:38 -08:00
|
|
|
.loop
|
2015-11-11 20:38:57 -08:00
|
|
|
call Random
|
|
|
|
and $1f
|
2015-12-11 13:59:40 -08:00
|
|
|
cp CARDFLIP_DECK_SIZE
|
2015-12-11 05:17:38 -08:00
|
|
|
jr nc, .loop
|
2015-11-11 20:38:57 -08:00
|
|
|
ld l, a
|
2020-11-09 12:17:03 -08:00
|
|
|
ld h, 0
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 05:17:38 -08:00
|
|
|
jr nz, .loop
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], c
|
|
|
|
dec c
|
2015-12-11 05:17:38 -08:00
|
|
|
jr nz, .loop
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipNumCardsPlayed], a
|
|
|
|
ld hl, wDiscardPile
|
|
|
|
ld bc, CARDFLIP_DECK_SIZE
|
2015-11-11 20:38:57 -08:00
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CollapseCursorPosition:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld hl, 0
|
|
|
|
ld bc, 6
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipCursorY]
|
2015-11-11 20:38:57 -08:00
|
|
|
call AddNTimes
|
|
|
|
ld b, $0
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipCursorX]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetCoordsOfChosenCard:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipWhichCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .BottomCard
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 2, 0
|
2015-12-11 13:59:40 -08:00
|
|
|
bcpixel 2, 3
|
|
|
|
jr .done
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.BottomCard:
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 2, 6
|
2015-12-11 13:59:40 -08:00
|
|
|
bcpixel 8, 3
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.done
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceCardFaceDown:
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-11 13:59:40 -08:00
|
|
|
ld de, .FaceDownCardTilemap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 6, 5
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_CopyToBox
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.FaceDownCardTilemap:
|
2015-11-11 20:38:57 -08:00
|
|
|
db $08, $09, $09, $09, $0a
|
|
|
|
db $0b, $28, $2b, $28, $0c
|
|
|
|
db $0b, $2c, $2d, $2e, $0c
|
|
|
|
db $0b, $2f, $30, $31, $0c
|
|
|
|
db $0b, $32, $33, $34, $0c
|
|
|
|
db $0d, $0e, $0e, $0e, $0f
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_DisplayCardFaceUp:
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-11 20:38:57 -08:00
|
|
|
push hl
|
|
|
|
push hl
|
2015-12-11 13:59:40 -08:00
|
|
|
; Flip the card face up.
|
|
|
|
ld de, .FaceUpCardTilemap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 6, 5
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_CopyToBox
|
|
|
|
|
|
|
|
; Get the level and species of the upturned card.
|
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-11 05:17:38 -08:00
|
|
|
ld hl, .Deck
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld d, [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
|
|
|
|
; Place the level.
|
2015-11-11 20:38:57 -08:00
|
|
|
pop hl
|
2015-12-11 13:59:40 -08:00
|
|
|
ld bc, 3 + SCREEN_WIDTH
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], e
|
2015-12-11 13:59:40 -08:00
|
|
|
|
|
|
|
; Place the Pokepic.
|
2015-11-11 20:38:57 -08:00
|
|
|
ld bc, SCREEN_HEIGHT
|
|
|
|
add hl, bc
|
|
|
|
ld a, d
|
|
|
|
ld de, SCREEN_WIDTH
|
2015-12-11 13:59:40 -08:00
|
|
|
ld b, 3
|
|
|
|
.row
|
2015-11-11 20:38:57 -08:00
|
|
|
push hl
|
2015-12-11 13:59:40 -08:00
|
|
|
ld c, 3
|
|
|
|
.col
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
dec c
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .col
|
2015-11-11 20:38:57 -08:00
|
|
|
pop hl
|
|
|
|
add hl, de
|
|
|
|
dec b
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .row
|
2015-11-11 20:38:57 -08:00
|
|
|
pop hl
|
2015-12-11 13:59:40 -08:00
|
|
|
|
|
|
|
; Set the attributes
|
2020-02-13 09:30:13 -08:00
|
|
|
ld de, wAttrmap - wTilemap
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and 3
|
|
|
|
inc a
|
|
|
|
lb bc, 6, 5
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillBox
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.FaceUpCardTilemap:
|
2015-11-11 20:38:57 -08:00
|
|
|
db $18, $19, $19, $19, $1a
|
|
|
|
db $1b, $35, $7f, $7f, $1c
|
|
|
|
db $0b, $28, $28, $28, $0c
|
|
|
|
db $0b, $28, $28, $28, $0c
|
|
|
|
db $0b, $28, $28, $28, $0c
|
|
|
|
db $1d, $1e, $1e, $1e, $1f
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Deck:
|
2015-12-11 13:59:40 -08:00
|
|
|
; level, pic anchor (3x3)
|
2017-12-09 21:06:20 -08:00
|
|
|
db "1", $4e, "1", $57, "1", $69, "1", $60
|
|
|
|
db "2", $4e, "2", $57, "2", $69, "2", $60
|
|
|
|
db "3", $4e, "3", $57, "3", $69, "3", $60
|
|
|
|
db "4", $4e, "4", $57, "4", $69, "4", $60
|
|
|
|
db "5", $4e, "5", $57, "5", $69, "5", $60
|
|
|
|
db "6", $4e, "6", $57, "6", $69, "6", $60
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
CardFlip_UpdateChipBalanceDisplay:
|
2015-11-11 20:38:57 -08:00
|
|
|
push hl
|
|
|
|
hlcoord 0, 12
|
2015-12-11 05:17:38 -08:00
|
|
|
ld b, 4
|
|
|
|
ld c, SCREEN_WIDTH - 2
|
2023-08-11 03:28:14 -07:00
|
|
|
call Textbox1bpp
|
2015-11-11 20:38:57 -08:00
|
|
|
pop hl
|
2019-04-08 05:15:10 -07:00
|
|
|
call PrintTextboxText
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_PrintChipBalance
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
CardFlip_PrintChipBalance:
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 9, 15
|
2015-12-11 05:17:38 -08:00
|
|
|
ld b, 1
|
|
|
|
ld c, 9
|
2023-08-11 03:28:14 -07:00
|
|
|
call Textbox1bpp
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 10, 16
|
2023-09-02 09:23:25 -07:00
|
|
|
ld de, .ChipStr
|
2015-11-11 20:38:57 -08:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 15, 16
|
2023-09-02 09:23:25 -07:00
|
|
|
ld de, wChips
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 2, 4
|
|
|
|
call PrintNum
|
|
|
|
ret
|
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
.ChipStr:
|
|
|
|
db "CHIP@"
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_InitTilemap:
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
|
|
ld a, $29
|
|
|
|
call ByteFill
|
|
|
|
hlcoord 9, 0
|
2015-12-11 13:59:40 -08:00
|
|
|
ld de, CardFlipTilemap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 12, 11
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_CopyToBox
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 0, 12
|
|
|
|
lb bc, 4, 18
|
2023-08-11 03:28:14 -07:00
|
|
|
call Textbox1bpp
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_FillGreenBox:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $29
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_FillBox:
|
2015-12-11 05:17:38 -08:00
|
|
|
.row
|
2015-11-11 20:38:57 -08:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-12-11 05:17:38 -08:00
|
|
|
.col
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-11 05:17:38 -08:00
|
|
|
jr nz, .col
|
2015-11-11 20:38:57 -08:00
|
|
|
pop hl
|
2015-12-11 05:17:38 -08:00
|
|
|
ld bc, SCREEN_WIDTH
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-11 05:17:38 -08:00
|
|
|
jr nz, .row
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_CopyToBox:
|
2015-12-11 13:59:40 -08:00
|
|
|
.row
|
2015-11-11 20:38:57 -08:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-12-11 13:59:40 -08:00
|
|
|
.col
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .col
|
2015-11-11 20:38:57 -08:00
|
|
|
pop hl
|
2015-12-11 13:59:40 -08:00
|
|
|
ld bc, SCREEN_WIDTH
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .row
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_CopyOAM:
|
2022-07-09 14:18:22 -07:00
|
|
|
ld de, wShadowOAMSprite00
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hli]
|
2015-12-11 05:17:38 -08:00
|
|
|
.loop
|
2015-11-11 20:38:57 -08:00
|
|
|
push af
|
|
|
|
ld a, [hli]
|
|
|
|
add b
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; y
|
2015-11-11 20:38:57 -08:00
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
add c
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; x
|
2015-11-11 20:38:57 -08:00
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; tile id
|
2015-11-11 20:38:57 -08:00
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; attributes
|
2015-11-11 20:38:57 -08:00
|
|
|
inc de
|
|
|
|
pop af
|
|
|
|
dec a
|
2015-12-11 05:17:38 -08:00
|
|
|
jr nz, .loop
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2019-02-18 08:35:28 -08:00
|
|
|
CardFlip_ShiftDigitsUpOnePixel:
|
|
|
|
; The top rows of digits 1-9 become the bottom rows of 0-8,
|
|
|
|
; so this routine relies on the top rows being blank.
|
2018-01-10 10:47:57 -08:00
|
|
|
ld de, vTiles0 tile "0"
|
|
|
|
ld hl, vTiles0 tile "0" + 2
|
2015-12-11 05:17:38 -08:00
|
|
|
ld bc, 10 tiles - 2
|
2015-11-11 20:38:57 -08:00
|
|
|
call CopyBytes
|
2018-01-10 10:47:57 -08:00
|
|
|
ld hl, vTiles0 tile "9" + 1 tiles - 2
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_BlankDiscardedCardSlot:
|
2015-11-11 20:38:57 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-11 13:59:40 -08:00
|
|
|
|
|
|
|
and 3 ; get mon
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, e
|
2015-12-11 13:59:40 -08:00
|
|
|
and $1c ; get level
|
2015-11-11 20:38:57 -08:00
|
|
|
srl a
|
2017-12-25 10:40:10 -08:00
|
|
|
add LOW(.Jumptable)
|
2015-11-11 20:38:57 -08:00
|
|
|
ld l, a
|
|
|
|
ld a, 0
|
2017-12-25 10:40:10 -08:00
|
|
|
adc HIGH(.Jumptable)
|
2015-11-11 20:38:57 -08:00
|
|
|
ld h, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jumptable:
|
2015-12-26 18:59:03 -08:00
|
|
|
dw .Level1
|
|
|
|
dw .Level2
|
|
|
|
dw .Level3
|
|
|
|
dw .Level4
|
|
|
|
dw .Level5
|
|
|
|
dw .Level6
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Level1:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wDiscardPile + 4
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .discarded2
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 3
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $36
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $37
|
|
|
|
ret
|
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.discarded2
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 3
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $36
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Level2:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wDiscardPile - 4
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .discarded1
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 4
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $3b
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3a
|
|
|
|
ret
|
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.discarded1
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 4
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $3d
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Level3:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wDiscardPile + 4
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .discarded4
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 6
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $36
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $38
|
|
|
|
ret
|
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.discarded4
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 6
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $36
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Level4:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wDiscardPile - 4
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .discarded3
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 7
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $3c
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3a
|
|
|
|
ret
|
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.discarded3
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 7
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $3d
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Level5:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wDiscardPile + 4
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .discarded6
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 9
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $36
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $39
|
|
|
|
ret
|
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.discarded6
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 9
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $36
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Level6:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wDiscardPile - 4
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .discarded5
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 10
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $3c
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3a
|
|
|
|
ret
|
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.discarded5
|
2015-11-11 20:38:57 -08:00
|
|
|
hlcoord 13, 10
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hl], $3d
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $3a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_CheckWinCondition:
|
2015-12-11 13:59:40 -08:00
|
|
|
call CollapseCursorPosition
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, hl
|
2015-12-11 05:17:38 -08:00
|
|
|
ld de, .Jumptable
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jumptable:
|
2015-12-26 18:59:03 -08:00
|
|
|
dw .Impossible
|
|
|
|
dw .Impossible
|
|
|
|
dw .PikaJiggly
|
|
|
|
dw .PikaJiggly
|
|
|
|
dw .PoliOddish
|
|
|
|
dw .PoliOddish
|
|
|
|
|
|
|
|
dw .Impossible
|
|
|
|
dw .Impossible
|
|
|
|
dw .Pikachu
|
|
|
|
dw .Jigglypuff
|
|
|
|
dw .Poliwag
|
|
|
|
dw .Oddish
|
|
|
|
|
|
|
|
dw .OneTwo
|
|
|
|
dw .One
|
|
|
|
dw .PikaOne
|
|
|
|
dw .JigglyOne
|
|
|
|
dw .PoliOne
|
|
|
|
dw .OddOne
|
|
|
|
|
|
|
|
dw .OneTwo
|
|
|
|
dw .Two
|
|
|
|
dw .PikaTwo
|
|
|
|
dw .JigglyTwo
|
|
|
|
dw .PoliTwo
|
|
|
|
dw .OddTwo
|
|
|
|
|
|
|
|
dw .ThreeFour
|
|
|
|
dw .Three
|
|
|
|
dw .PikaThree
|
|
|
|
dw .JigglyThree
|
|
|
|
dw .PoliThree
|
|
|
|
dw .OddThree
|
|
|
|
|
|
|
|
dw .ThreeFour
|
|
|
|
dw .Four
|
|
|
|
dw .PikaFour
|
|
|
|
dw .JigglyFour
|
|
|
|
dw .PoliFour
|
|
|
|
dw .OddFour
|
|
|
|
|
|
|
|
dw .FiveSix
|
|
|
|
dw .Five
|
|
|
|
dw .PikaFive
|
|
|
|
dw .JigglyFive
|
|
|
|
dw .PoliFive
|
|
|
|
dw .OddFive
|
|
|
|
|
|
|
|
dw .FiveSix
|
|
|
|
dw .Six
|
|
|
|
dw .PikaSix
|
|
|
|
dw .JigglySix
|
|
|
|
dw .PoliSix
|
|
|
|
dw .OddSix
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Impossible:
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PikaJiggly:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $2
|
2015-12-11 13:59:40 -08:00
|
|
|
jp nz, .Lose
|
|
|
|
jr .WinSix
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PoliOddish:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $2
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .WinSix
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.WinSix:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, $6
|
|
|
|
ld de, SFX_2ND_PLACE
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .Payout
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OneTwo:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $18
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinNine
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ThreeFour:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $18
|
|
|
|
cp $8
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinNine
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.FiveSix:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $18
|
|
|
|
cp $10
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinNine
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.WinNine:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, $9
|
|
|
|
ld de, SFX_2ND_PLACE
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .Payout
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Pikachu:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $3
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinTwelve
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jigglypuff:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $3
|
|
|
|
cp $1
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinTwelve
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Poliwag:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $3
|
|
|
|
cp $2
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinTwelve
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Oddish:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $3
|
|
|
|
cp $3
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinTwelve
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.WinTwelve:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, $c
|
|
|
|
ld de, SFX_2ND_PLACE
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .Payout
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.One:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $1c
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinEighteen
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Two:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $1c
|
|
|
|
cp $4
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinEighteen
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Three:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $1c
|
|
|
|
cp $8
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinEighteen
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Four:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $1c
|
|
|
|
cp $c
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinEighteen
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Five:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $1c
|
|
|
|
cp $10
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinEighteen
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Six:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
and $1c
|
|
|
|
cp $14
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .WinEighteen
|
|
|
|
jp .Lose
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.WinEighteen:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, $12
|
|
|
|
ld de, SFX_2ND_PLACE
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .Payout
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PikaOne:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $0
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.JigglyOne:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $1
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PoliOne:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $2
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OddOne:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $3
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PikaTwo:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $4
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.JigglyTwo:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $5
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PoliTwo:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $6
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OddTwo:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $7
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PikaThree:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $8
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.JigglyThree:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $9
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PoliThree:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OddThree:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $b
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PikaFour:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $c
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.JigglyFour:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $d
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PoliFour:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $e
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OddFour:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $f
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PikaFive:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $10
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.JigglyFive:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $11
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PoliFive:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $12
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OddFive:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $13
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PikaSix:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $14
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.JigglySix:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $15
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PoliSix:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $16
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .CheckWin72
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OddSix:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld e, $17
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CheckWin72:
|
2015-12-11 13:59:40 -08:00
|
|
|
ld a, [wCardFlipFaceUpCard]
|
2015-11-11 20:38:57 -08:00
|
|
|
cp e
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .Lose
|
|
|
|
ld c, 72
|
2015-11-11 20:38:57 -08:00
|
|
|
ld de, SFX_2ND_PLACE
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .Payout
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Lose:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld de, SFX_WRONG
|
|
|
|
call PlaySFX
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .CardFlipDarnText
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_UpdateChipBalanceDisplay
|
2015-11-11 20:38:57 -08:00
|
|
|
call WaitSFX
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Payout:
|
2015-11-11 20:38:57 -08:00
|
|
|
push bc
|
|
|
|
push de
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .CardFlipYeahText
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_UpdateChipBalanceDisplay
|
2015-11-11 20:38:57 -08:00
|
|
|
pop de
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
pop bc
|
2015-12-11 13:59:40 -08:00
|
|
|
.loop
|
2015-11-11 20:38:57 -08:00
|
|
|
push bc
|
2023-09-02 09:23:25 -07:00
|
|
|
call .IsChipCaseFull
|
2015-12-11 13:59:40 -08:00
|
|
|
jr c, .full
|
2023-09-02 09:23:25 -07:00
|
|
|
call .AddChipPlaySFX
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.full
|
2023-09-02 09:23:25 -07:00
|
|
|
call CardFlip_PrintChipBalance
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, 2
|
|
|
|
call DelayFrames
|
|
|
|
pop bc
|
|
|
|
dec c
|
2015-12-11 13:59:40 -08:00
|
|
|
jr nz, .loop
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.CardFlipYeahText:
|
|
|
|
text_far _CardFlipYeahText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.CardFlipDarnText:
|
|
|
|
text_far _CardFlipDarnText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
.AddChipPlaySFX:
|
|
|
|
ld a, [wChips]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld h, a
|
2023-09-02 09:23:25 -07:00
|
|
|
ld a, [wChips + 1]
|
2015-11-11 20:38:57 -08:00
|
|
|
ld l, a
|
|
|
|
inc hl
|
|
|
|
ld a, h
|
2023-09-02 09:23:25 -07:00
|
|
|
ld [wChips], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, l
|
2023-09-02 09:23:25 -07:00
|
|
|
ld [wChips + 1], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld de, SFX_PAY_DAY
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
.IsChipCaseFull:
|
|
|
|
ld a, [wChips]
|
|
|
|
cp HIGH(MAX_CHIPS)
|
2015-12-11 13:59:40 -08:00
|
|
|
jr c, .less
|
|
|
|
jr z, .check_low
|
|
|
|
jr .more
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.check_low
|
2023-09-02 09:23:25 -07:00
|
|
|
ld a, [wChips + 1]
|
|
|
|
cp LOW(MAX_CHIPS)
|
2015-12-11 13:59:40 -08:00
|
|
|
jr c, .less
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.more
|
2015-11-11 20:38:57 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.less
|
2015-11-11 20:38:57 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceOAMCardBorder:
|
2015-12-11 13:59:40 -08:00
|
|
|
call GetCoordsOfChosenCard
|
|
|
|
ld hl, .SpriteData
|
|
|
|
call CardFlip_CopyOAM
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.SpriteData:
|
2015-11-11 20:38:57 -08:00
|
|
|
db 18
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 0, 0, 0, $04, 0
|
|
|
|
dbsprite 1, 0, 0, 0, $06, 0
|
|
|
|
dbsprite 2, 0, 0, 0, $06, 0
|
|
|
|
dbsprite 3, 0, 0, 0, $06, 0
|
|
|
|
dbsprite 4, 0, 0, 0, $04, 0 | X_FLIP
|
2015-12-11 13:59:40 -08:00
|
|
|
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 1, 0, 0, $05, 0
|
|
|
|
dbsprite 4, 1, 0, 0, $05, 0 | X_FLIP
|
2015-12-11 13:59:40 -08:00
|
|
|
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 2, 0, 0, $05, 0
|
|
|
|
dbsprite 4, 2, 0, 0, $05, 0 | X_FLIP
|
2015-12-11 13:59:40 -08:00
|
|
|
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 3, 0, 0, $05, 0
|
|
|
|
dbsprite 4, 3, 0, 0, $05, 0 | X_FLIP
|
2015-12-11 13:59:40 -08:00
|
|
|
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 4, 0, 0, $05, $00
|
|
|
|
dbsprite 4, 4, 0, 0, $05, 0 | X_FLIP
|
2015-12-11 13:59:40 -08:00
|
|
|
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 5, 0, 0, $04, 0 | Y_FLIP
|
|
|
|
dbsprite 1, 5, 0, 0, $06, 0 | Y_FLIP
|
|
|
|
dbsprite 2, 5, 0, 0, $06, 0 | Y_FLIP
|
|
|
|
dbsprite 3, 5, 0, 0, $06, 0 | Y_FLIP
|
|
|
|
dbsprite 4, 5, 0, 0, $04, 0 | X_FLIP | Y_FLIP
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ChooseCard_HandleJoypad:
|
2015-11-11 20:38:57 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
2015-12-11 13:59:40 -08:00
|
|
|
jp nz, .d_left
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT
|
2015-12-11 13:59:40 -08:00
|
|
|
jp nz, .d_right
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
2015-12-11 13:59:40 -08:00
|
|
|
jp nz, .d_up
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
2015-12-11 13:59:40 -08:00
|
|
|
jp nz, .d_down
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.d_left
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wCardFlipCursorX
|
|
|
|
ld a, [wCardFlipCursorY]
|
2015-11-11 20:38:57 -08:00
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .mon_pair_left
|
2015-11-11 20:38:57 -08:00
|
|
|
cp $1
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .mon_group_left
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.mon_group_left
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
cp $3
|
2015-12-11 13:59:40 -08:00
|
|
|
jr c, .left_to_number_gp
|
2015-11-11 20:38:57 -08:00
|
|
|
dec [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.mon_pair_left
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and $e
|
|
|
|
ld [hl], a
|
|
|
|
cp $3
|
2015-12-11 13:59:40 -08:00
|
|
|
jr c, .left_to_number_gp
|
2015-11-11 20:38:57 -08:00
|
|
|
dec [hl]
|
2016-05-04 08:46:23 -07:00
|
|
|
dec [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jp .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.left_to_number_gp
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $2
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipCursorY], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $1
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipCursorX], a
|
|
|
|
jp .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.d_right
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wCardFlipCursorX
|
|
|
|
ld a, [wCardFlipCursorY]
|
2015-11-11 20:38:57 -08:00
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .mon_pair_right
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
cp $5
|
|
|
|
ret nc
|
|
|
|
inc [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.mon_pair_right
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and $e
|
|
|
|
ld [hl], a
|
|
|
|
cp $4
|
|
|
|
ret nc
|
|
|
|
inc [hl]
|
2016-05-04 08:46:23 -07:00
|
|
|
inc [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.d_up
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wCardFlipCursorY
|
|
|
|
ld a, [wCardFlipCursorX]
|
2015-11-11 20:38:57 -08:00
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .num_pair_up
|
2015-11-11 20:38:57 -08:00
|
|
|
cp $1
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .num_gp_up
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.num_gp_up
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
cp $3
|
2015-12-11 13:59:40 -08:00
|
|
|
jr c, .up_to_mon_group
|
2015-11-11 20:38:57 -08:00
|
|
|
dec [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.num_pair_up
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and $e
|
|
|
|
ld [hl], a
|
|
|
|
cp $3
|
2015-12-11 13:59:40 -08:00
|
|
|
jr c, .up_to_mon_group
|
2015-11-11 20:38:57 -08:00
|
|
|
dec [hl]
|
2016-05-04 08:46:23 -07:00
|
|
|
dec [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.up_to_mon_group
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $1
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipCursorY], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, $2
|
2015-12-11 13:59:40 -08:00
|
|
|
ld [wCardFlipCursorX], a
|
|
|
|
jr .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.d_down
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, wCardFlipCursorY
|
|
|
|
ld a, [wCardFlipCursorX]
|
2015-11-11 20:38:57 -08:00
|
|
|
and a
|
2015-12-11 13:59:40 -08:00
|
|
|
jr z, .num_pair_down
|
|
|
|
ld hl, wCardFlipCursorY
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
cp $7
|
|
|
|
ret nc
|
|
|
|
inc [hl]
|
2015-12-11 13:59:40 -08:00
|
|
|
jr .play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2015-12-11 13:59:40 -08:00
|
|
|
.num_pair_down
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and $e
|
|
|
|
ld [hl], a
|
|
|
|
cp $6
|
|
|
|
ret nc
|
|
|
|
inc [hl]
|
2016-05-04 08:46:23 -07:00
|
|
|
inc [hl]
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.play_sound
|
2015-11-11 20:38:57 -08:00
|
|
|
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_UpdateCursorOAM:
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearSprites
|
2015-12-11 13:59:40 -08:00
|
|
|
call CollapseCursorPosition
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, hl
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, hl
|
2015-12-11 13:59:40 -08:00
|
|
|
ld de, .OAMData
|
2015-11-11 20:38:57 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-11 13:59:40 -08:00
|
|
|
call CardFlip_CopyOAM
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.OAMData:
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO cardflip_cursor
|
|
|
|
if _NARG >= 5
|
|
|
|
dbpixel \1, \2, \3, \4
|
|
|
|
dw \5
|
|
|
|
else
|
|
|
|
dbpixel \1, \2
|
|
|
|
dw \3
|
|
|
|
endc
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2015-12-11 13:59:40 -08:00
|
|
|
|
|
|
|
cardflip_cursor 11, 2, .Impossible
|
|
|
|
cardflip_cursor 12, 2, .Impossible
|
|
|
|
cardflip_cursor 13, 2, .PokeGroupPair
|
|
|
|
cardflip_cursor 13, 2, .PokeGroupPair
|
|
|
|
cardflip_cursor 17, 2, .PokeGroupPair
|
|
|
|
cardflip_cursor 17, 2, .PokeGroupPair
|
|
|
|
|
|
|
|
cardflip_cursor 11, 3, .Impossible
|
|
|
|
cardflip_cursor 12, 3, .Impossible
|
|
|
|
cardflip_cursor 13, 3, .PokeGroup
|
|
|
|
cardflip_cursor 15, 3, .PokeGroup
|
|
|
|
cardflip_cursor 17, 3, .PokeGroup
|
|
|
|
cardflip_cursor 19, 3, .PokeGroup
|
|
|
|
|
|
|
|
cardflip_cursor 11, 5, .NumGroupPair
|
|
|
|
cardflip_cursor 12, 5, .NumGroup
|
|
|
|
cardflip_cursor 13, 5, .SingleTile
|
|
|
|
cardflip_cursor 15, 5, .SingleTile
|
|
|
|
cardflip_cursor 17, 5, .SingleTile
|
|
|
|
cardflip_cursor 19, 5, .SingleTile
|
|
|
|
|
|
|
|
cardflip_cursor 11, 5, .NumGroupPair
|
|
|
|
cardflip_cursor 12, 6, 0, 4, .NumGroup
|
|
|
|
cardflip_cursor 13, 6, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 15, 6, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 17, 6, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 19, 6, 0, 4, .SingleTile
|
|
|
|
|
|
|
|
cardflip_cursor 11, 8, .NumGroupPair
|
|
|
|
cardflip_cursor 12, 8, .NumGroup
|
|
|
|
cardflip_cursor 13, 8, .SingleTile
|
|
|
|
cardflip_cursor 15, 8, .SingleTile
|
|
|
|
cardflip_cursor 17, 8, .SingleTile
|
|
|
|
cardflip_cursor 19, 8, .SingleTile
|
|
|
|
|
|
|
|
cardflip_cursor 11, 8, .NumGroupPair
|
|
|
|
cardflip_cursor 12, 9, 0, 4, .NumGroup
|
|
|
|
cardflip_cursor 13, 9, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 15, 9, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 17, 9, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 19, 9, 0, 4, .SingleTile
|
|
|
|
|
|
|
|
cardflip_cursor 11, 11, .NumGroupPair
|
|
|
|
cardflip_cursor 12, 11, .NumGroup
|
|
|
|
cardflip_cursor 13, 11, .SingleTile
|
|
|
|
cardflip_cursor 15, 11, .SingleTile
|
|
|
|
cardflip_cursor 17, 11, .SingleTile
|
|
|
|
cardflip_cursor 19, 11, .SingleTile
|
|
|
|
|
|
|
|
cardflip_cursor 11, 11, .NumGroupPair
|
|
|
|
cardflip_cursor 12, 12, 0, 4, .NumGroup
|
|
|
|
cardflip_cursor 13, 12, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 15, 12, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 17, 12, 0, 4, .SingleTile
|
|
|
|
cardflip_cursor 19, 12, 0, 4, .SingleTile
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.SingleTile:
|
2015-11-11 20:38:57 -08:00
|
|
|
db 6
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite -1, 0, 7, 0, $00, 0 | PRIORITY
|
|
|
|
dbsprite 0, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 1, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 0, 7, 5, $00, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 0, 0, 0, 5, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 1, 0, 0, 5, $03, 0 | PRIORITY
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PokeGroup:
|
2015-11-11 20:38:57 -08:00
|
|
|
db 26
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite -1, 0, 7, 0, $00, 0 | PRIORITY
|
|
|
|
dbsprite 0, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 1, 0, 0, 0, $00, 0 | X_FLIP | PRIORITY
|
|
|
|
dbsprite -1, 1, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 1, 0, 0, $01, 0 | X_FLIP | PRIORITY
|
|
|
|
dbsprite -1, 2, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 2, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 3, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 3, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 4, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 4, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 5, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 5, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 6, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 6, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 7, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 7, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 8, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 8, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 9, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 9, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 10, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 10, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 10, 7, 1, $00, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 0, 10, 0, 1, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 1, 10, 0, 1, $03, 0 | PRIORITY
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.NumGroup:
|
2015-11-11 20:38:57 -08:00
|
|
|
db 20
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite -1, 0, 7, 0, $00, 0 | PRIORITY
|
|
|
|
dbsprite 0, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 1, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 2, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 4, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 5, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 6, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 7, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 8, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 0, 7, 5, $00, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 0, 0, 0, 5, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 1, 0, 0, 5, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 2, 0, 0, 5, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 0, 0, 5, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 4, 0, 0, 5, $03, 0 | PRIORITY
|
|
|
|
dbsprite 5, 0, 0, 5, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 6, 0, 0, 5, $03, 0 | PRIORITY
|
|
|
|
dbsprite 7, 0, 0, 5, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 8, 0, 0, 5, $03, 0 | PRIORITY
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.NumGroupPair:
|
2015-11-11 20:38:57 -08:00
|
|
|
db 30
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 0, 0, 0, $00, 0 | PRIORITY
|
|
|
|
dbsprite 1, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 2, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 3, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 4, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 5, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 6, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 7, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 8, 0, 0, 0, $02, 0 | PRIORITY
|
|
|
|
dbsprite 9, 0, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 0, 1, 0, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 3, 1, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 5, 1, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 7, 1, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 9, 1, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 0, 2, 0, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 3, 2, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 5, 2, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 7, 2, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 9, 2, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 0, 2, 0, 1, $00, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 1, 2, 0, 1, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 2, 2, 0, 1, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 3, 2, 0, 1, $03, 0 | PRIORITY
|
|
|
|
dbsprite 4, 2, 0, 1, $03, 0 | PRIORITY
|
|
|
|
dbsprite 5, 2, 0, 1, $03, 0 | PRIORITY
|
|
|
|
dbsprite 6, 2, 0, 1, $03, 0 | PRIORITY
|
|
|
|
dbsprite 7, 2, 0, 1, $03, 0 | PRIORITY
|
|
|
|
dbsprite 8, 2, 0, 1, $03, 0 | PRIORITY
|
|
|
|
dbsprite 9, 2, 0, 1, $03, 0 | PRIORITY
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PokeGroupPair:
|
2015-11-11 20:38:57 -08:00
|
|
|
db 38
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite -1, 0, 7, 0, $00, 0 | PRIORITY
|
|
|
|
dbsprite 3, 0, 0, 0, $00, 0 | X_FLIP | PRIORITY
|
|
|
|
dbsprite -1, 1, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 3, 1, 0, 0, $01, 0 | X_FLIP | PRIORITY
|
|
|
|
dbsprite -1, 2, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 3, 2, 0, 0, $01, 0 | X_FLIP | PRIORITY
|
|
|
|
dbsprite -1, 3, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 3, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 3, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 4, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 4, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 4, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 5, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 5, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 5, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 6, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 6, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 6, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 7, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 7, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 7, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 8, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 8, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 8, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 9, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 9, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 9, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 10, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 10, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 10, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 11, 7, 0, $01, 0 | PRIORITY
|
|
|
|
dbsprite 1, 11, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite 3, 11, 0, 0, $03, 0 | PRIORITY
|
|
|
|
dbsprite -1, 11, 7, 1, $00, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 0, 11, 0, 1, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 1, 11, 0, 1, $03, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 2, 11, 0, 1, $02, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 3, 11, 0, 1, $03, 0 | X_FLIP | Y_FLIP | PRIORITY
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Impossible:
|
2015-11-11 20:38:57 -08:00
|
|
|
db 4
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 0, 0, 0, $00, 0 | PRIORITY
|
|
|
|
dbsprite 1, 0, 0, 0, $00, 0 | X_FLIP | PRIORITY
|
|
|
|
dbsprite 0, 1, 0, 0, $00, 0 | Y_FLIP | PRIORITY
|
|
|
|
dbsprite 1, 1, 0, 0, $00, 0 | X_FLIP | Y_FLIP | PRIORITY
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlip_InitAttrPals:
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-11-11 20:38:57 -08:00
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 12, 1, wAttrmap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 2, 2
|
|
|
|
ld a, $1
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillBox
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 14, 1, wAttrmap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 2, 2
|
|
|
|
ld a, $2
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillBox
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 16, 1, wAttrmap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 2, 2
|
|
|
|
ld a, $3
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillBox
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 18, 1, wAttrmap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 2, 2
|
|
|
|
ld a, $4
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillBox
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 9, 0, wAttrmap
|
2015-11-11 20:38:57 -08:00
|
|
|
lb bc, 12, 1
|
|
|
|
ld a, $1
|
2015-12-11 05:17:38 -08:00
|
|
|
call CardFlip_FillBox
|
2015-12-11 13:59:40 -08:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2015-11-11 20:38:57 -08:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-12-11 13:59:40 -08:00
|
|
|
ld hl, .palettes
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wBGPals1
|
2015-12-11 13:59:40 -08:00
|
|
|
ld bc, 9 palettes
|
2015-11-11 20:38:57 -08:00
|
|
|
call CopyBytes
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.palettes
|
2018-01-09 20:21:32 -08:00
|
|
|
INCLUDE "gfx/card_flip/card_flip.pal"
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlipLZ03:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/card_flip/card_flip_3.2bpp.lz"
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlipOffButtonGFX:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/card_flip/off.2bpp"
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlipOnButtonGFX:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/card_flip/on.2bpp"
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlipLZ01:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/card_flip/card_flip_1.2bpp.lz"
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlipLZ02:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/card_flip/card_flip_2.2bpp.lz"
|
2015-11-11 20:38:57 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardFlipTilemap:
|
2017-12-15 19:36:33 -08:00
|
|
|
INCBIN "gfx/card_flip/card_flip.tilemap"
|