66 for (i = 0; i < n; i++) {
74 }
else if (index >= 6) {
83 }
else if (index < 6) {
139 screen->
addSprite(screen, index, 0xE500, 0x6100);
146 screen->
scaleSprite(screen, index, 20, 0x1000, 0x1000);
168 for (j = i; j < pile->
handCount - 1; j++) {
173 screen->
addSprite(screen, index, 0xE500, 0x6100);
175 for (i = 0; i < 5; i++) {
184 screen->
scaleSprite(screen, index, 20, 0x1000, 0x1000);
225 screen->
startMove(screen, index, 20, x, y);
257 src = &player->
slots[slot];
258 for (i = 0; i < 12; i++) {
275 player->
slots[slot] = *src;
276 screen->
addSprite(screen, index, 0xE500, 0x6100);
325 screen->
scaleSprite(screen, index, 5, 0x1000, 0x1000);
337 screen->
startMove(screen, index, 20, x, y);
366 screen->
addSprite(screen, 15, 0xE500, 0x6100);
369 screen->
scaleSprite(screen, 15, 8, 0x1000, 0x1000);
374 for (j = 0; j < 15; j++) {
384#elif VERSION_EU || VERSION_JP
390 screen->
addSprite(screen, 15, 0xE500, 0x6100);
393 screen->
scaleSprite(screen, 15, 8, 0x1000, 0x1000);
396#if VERSION_EU || VERSION_JP
401 for (i = 0; i < 15; i++) {
412#if VERSION_EU || VERSION_JP
426#elif VERSION_EU || VERSION_JP
474 for (i = 0; i < 15; i++) {
487 for (j = 0; j < 15; j++) {
499 screen->
scaleSprite(screen, 15, 8, 0x1000, 0x1000);
511 for (j = 0; j < 12; j++) {
547 for (side = 0; side < 2; side++) {
548 for (j = 0; j < 6; j++) {
555 for (i = 0; i < 6; i++) {
559 screen->
addSprite(screen, i, 0x16000, 0x9000);
566 for (i = 0; i < 6; i++) {
570 screen->
addSprite(screen, i + 6, 0x16000, 0x3200);
806 s32 other = side ^ 1;
824 screen->
startFly(screen, index, 6, x, side != 0 ? 0x6D00 : 0x5500);
826 screen->
startFly(screen, index, 6, x, 0x6100);
855 screen->
startJitter(screen, side == 0 ? i + 6 : i);
900 s32 delta = to - from;
903 if (time == duration || from == to) {
906 from += delta * time / duration;
920 screen->
addSprite(screen, 0x11, 0x8300, 0x6100);
923 screen->
scaleSprite(screen, 0x11, 10, 0x1000, 0x1000);
1031 screen->
addSprite(screen, 0x11, 0x8300, 0x6100);
1033 for (card = 89; card < battle->
cardCount; card++) {
1088 screen->
scaleSprite(screen, 0x11, 10, 0x1000, 0x1000);
1286 screen->
openWindow(screen, 5, 5, 20, 0, 110);
CARDGAME.PRO: the card battle (mode 0x700).
void initCardDrawer(CardDrawer *obj)
Clears a card drawer, gives it its methods and binds it.
void CARDGAME_setCountingCardValues(CardBattle *battle, CardSlot *slot, s32 side, s32 pass)
Sets the values of a slot that holds the pass-th card of CARDGAME_countingCards from the battle's cou...
#define CARD_ANIM_UNDIM_ALL
CardAnim.dimAll.
#define CARD_INFO_STEPS
The steps CARDGAME_stepPlayCard has before its card goes off: the European and Japanese versions show...
s32 CARDGAME_recordCardPositions[][2]
where card 15 goes, by CardRecord.playCount
s16 CARDGAME_cardWindowPositions[2][2][2]
two positions, then the same moved for SHIFT_PAL_SCREEN
s32 CARDGAME_slotRowPositions[2][4]
sprite positions, by SHIFT_PAL_SCREEN
GfxState GFX
GFX: the graphics state and its methods.
s32 SHIFT_PAL_SCREEN
moves both display areas 0x18 lines down
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
s32 CARDGAME_openStepWindows(CardBattle *battle, CardScreen *screen, s32 layout, s32 text, s32 time, s32 step)
Opens the windows of the step CARDGAME_windowSteps[step] once its time is past; the next step.
void CARDGAME_startAttack(CardBattle *battle, CardScreen *screen, s32 side)
Starts CARDGAME_stepAttack: side's apTotal comes off the other side's hpTotal (down to 0),...
static void countNextColors(CardBattle *battle, CardScreen *screen)
Counts the colours of the next card of each side; the cards that add to one blink.
void CARDGAME_takeHandCard(CardBattle *battle, CardScreen *screen, s32 side)
Takes the card the last record names out of the side's hand into its next slot and shows it.
s32 CARDGAME_stepSwap(CardBattle *battle, CardScreen *screen)
Swaps the two sides' pile apTotal and hpTotal, counting the panels' ap and hp over to each other,...
void CARDGAME_startTotals(CardBattle *battle, CardScreen *screen)
Starts CARDGAME_stepTotals.
void CARDGAME_putSlotCard(CardBattle *battle, CardScreen *screen, s32 side, s32 card)
Puts a card in the side's next slot (owned by side 2) and shows it.
s32 CARDGAME_stepSlotSweep(CardBattle *battle, CardScreen *screen, s32 which)
Goes over the marked slots one by one, discarding their cards (which 0) or returning them to the hand...
void CARDGAME_markRecordHits(CardBattle *battle, CardScreen *screen, s32 side, s32 index)
Marks (marks) the plays whose effect reaches sprite index, by their target (targetKind): a side,...
s32 CARDGAME_interpolate(s32 to, s32 from, s32 duration, s32 time)
The value going from FROM to TO in DURATION, at TIME, never past TO.
static void startDealState(CardBattle *battle, CardScreen *screen)
Starts the state of the battle start effectStep.nextState asks for.
s32 CARDGAME_stepSlotTotal(CardBattle *battle, CardScreen *screen, s32 side)
Takes the marked slots' sprites away, shows card effectStep.vars[4] in window 2 for 90 frames (or unt...
s32 CARDGAME_stepAttack(CardBattle *battle, CardScreen *screen, s32 side)
The side's slot cards go over one by one (every 27 frames) while the panels count its attack (CARD_PA...
void CARDGAME_clearHands(CardBattle *battle, CardScreen *screen)
Empties both hands, on the panels with the decks.
void CARDGAME_copySlotCard(CardBattle *battle, CardScreen *screen, s32 side)
Copies the first marked slot card (effectStep.marked) into the side's next slot.
void CARDGAME_showSlotTotal(CardBattle *battle, CardScreen *screen, s32 side)
Adds up the marked slots' ap and hp (at most 99, 20 more for four or more slots) and shows them on sp...
s32 CARDGAME_stepTotals(CardBattle *battle, CardScreen *screen)
Adds up both players' slots' ap and hp and counts the panels' ap and hp over to the totals,...
s32 CARDGAME_stepStart(CardBattle *battle, CardScreen *screen)
The start of a card battle: deals six cards to each side (dealNextCards), turns them over and counts ...
s32 CARDGAME_stepDiscardAllSlots(CardBattle *battle, CardScreen *screen, s32 side)
Discards side's slot cards from the last to the first; 1 once done.
void CARDGAME_dealHands(CardBattle *battle, CardScreen *screen)
Deals six cards from each side's deck into its hand and puts them on the table, face down.
void CARDGAME_startPlayCard(CardBattle *battle, CardScreen *screen, s32 side)
Shows the card being played as sprite 15 (opening the panels for side 0) and starts moving it to its ...
s32 CARDGAME_flipSlotCard(CardBattle *battle, CardScreen *screen, s32 side)
Waits effectStep.time frames, then flips the side's next slot card over and moves it into place; 1 on...
void CARDGAME_startDiscardAllSlots(CardBattle *battle, CardScreen *screen, s32 side)
Starts CARDGAME_stepDiscardAllSlots from side's last slot.
s32 CARDGAME_moveSlotCard(CardBattle *battle, CardScreen *screen, s32 side)
Moves the side's next slot card into place; 1 once it is there.
s32 CARDGAME_stepRoundEnd(CardBattle *battle, CardScreen *screen, s32 side)
Takes the side's slots away one by one, then moves both sides' hands back into their decks one at a t...
void CARDGAME_startSlotSweep(CardBattle *battle, CardScreen *screen)
Starts CARDGAME_stepSlotSweep.
static void dealNextCards(CardBattle *battle, CardScreen *screen)
Deals the next card of each side to its slot, and counts it off the deck on the panels.
void CARDGAME_startRoundEnd(CardBattle *battle, CardScreen *screen)
Starts CARDGAME_stepRoundEnd.
void CARDGAME_startSwap(CardBattle *battle, CardScreen *screen)
Shows the kept card (keptCard) as sprite 17 for CARDGAME_stepSwap.
s32 CARDGAME_stepPlayCard(CardBattle *battle, CardScreen *screen)
Card 15 goes off and the marked slot cards turn over; it then lands in sprite 12 + CardRecord....
s32 CARDGAME_addColorCount(CardBattle *battle, CardScreen *screen, s32 side, s32 card)
Counts a card of the colour it has on a side's panel (at most 99); 1 if it has one.
s32 CARDGAME_stepDiscardSlotCard(CardBattle *battle, CardScreen *screen, s32 side, s32 index)
Shakes side's slot index away, then CARDGAME_discardSlotCard; 1 once done.
void CARDGAME_discardSlotCard(CardBattle *battle, CardScreen *screen, s32 side, s32 index)
Puts the card of side's slot index on its owner's discards, on the panel.
s32 CARDGAME_stepReturnSlotCard(CardBattle *battle, CardScreen *screen, s32 side, s32 index)
Sends side's slot index off, then CARDGAME_returnSlotCard; 1 once done.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#define SOUND_COUNT
SYSTEM10: a number counts up or down.
#define SOUND_WIN_JINGLE
W_JINGLE: a battle won.
u8 dimAll
sets dimmed of the first 15 sprites once
The card battle (CARDGAME_createBattle).
s32 prize
the item the player wins (GAME.items)
s16 cards[250]
card ids, minus one (CARDGAME_loadCardImages)
void(* addCard)(struct CardBattle *battle, s32 side, s32 card)
u8 keptCard
the card CARDGAME_keepLastCard kept, plus one
u8 slotCount
the slots added so far
Draws the cards' images (CardImage), from files 0x7E7-0x7EB.
u8 state
1 opening, 2 open, 4 confirmed, 5 closing
A player's cards in a card battle (CardSide.pile)
s16 hpTotal
the sum of its slot cards' hp: the higher one wins the round
s16 deckCount
the cards left in the deck
s16 deck[40]
deckTop on are left
s16 deckTop
the index of the deck's top card
s16 apTotal
the sum of its slot cards' ap, which comes off the other side's hpTotal
s16 hand[10]
handCount in use
s16 card
the index in the battle's card list
u8 targetKind
its effect's (CardEffect.target)
u8 target
the slot's order, or the card, it was played on
One of the two players of a card battle.
s8 playCount
the plays in use
u8 turnSide
the side whose turn it is
CardPlay plays[3]
the cards played this turn, up to three
The battle screen (created by CARDGAME_createScreen): the two panels, the cards on the table and the ...
CardMessageWindow message
void(* setSpriteCard)(struct CardScreen *screen, s32 sprite, s32 index)
void(* openWindow)(struct CardScreen *screen, s32 index, s16 layout, s32 value, s32 x, s32 y)
s32(* startFly)(struct CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
void(* setPanelValue)(struct CardScreen *screen, s32 side, u32 which, s32 value)
void(* scaleSprite)(struct CardScreen *screen, s32 index, s32 duration, s32 scaleX, s32 scaleY)
void(* setPanelFlags)(struct CardScreen *screen, s32 bits)
void(* clearPanelFlags)(struct CardScreen *screen)
void(* startMove)(struct CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
void(* resetPanels)(struct CardScreen *screen)
void(* openPanels)(struct CardScreen *screen)
void(* openMessage)(struct CardScreen *screen, s32 message, s32 prompt, s16 choice, s32 place)
s32(* removeSprite)(struct CardScreen *screen, s32 index)
void(* setSpriteScale)(struct CardScreen *screen, s32 index, s32 scaleX, s32 scaleY)
void(* closePanels)(struct CardScreen *screen)
s32(* startJitter)(struct CardScreen *screen, s32 index)
void(* closeMessage)(struct CardScreen *screen)
s32 spriteFlags
this frame: bit 0 a sprite is animated, bit 1 a flying one landed
void(* closeWindow)(struct CardScreen *screen, s32 index)
s32(* startBlink)(struct CardScreen *screen, s32 index)
s32(* startFlip)(struct CardScreen *screen, s32 index)
void(* openGauge)(struct CardScreen *screen, s32 index, s16 value)
s32(* addSprite)(struct CardScreen *screen, s32 index, s32 x, s32 y)
A card a player has out (CARDGAME_setSlot)
s16 hp
its hit points, 0 to 99: at 0 it is lost
s16 apBonus
what the effects added to its ap
s16 ap
its attack points, 0 to 99
s16 card
the index in the battle's card list
u8 order
CardBattle.slotCount when it was added.
u8 ap
the values shown, which count towards the slot's
s16 color
the card's colour, from 0
u8 order
a played card's place in the record, from 1
u8 highlight
bit 0 the cursor, bit 1 picked, bit 2 glowing
u8 marks[3]
the plays that apply to the card, drawn as marks
s32 time
a frame count, or the step's own sub-state
s8 eligible[0x29]
the cards or slots that can be picked
u8 state
the step's own state
s32 vars[5]
values each step uses its own way
u8 nextState
the state to set up first, if not 0
s8 marked[40]
the cards or slots picked
s32 choice
the card, slot or answer chosen; -1 for none
u8 numbers[3]
two numbers, and whether they are shown
s32 value
by its layout: a string, a card, or points | colour << 4
s32(* getFrameTime)(void)
short(* playSound)(s32 id)
returns the voice of a key-on