8 return *(
s32 *)&sprite->
scaleX != 0x10001000;
14 if (sprite->
time > 0) {
25 if (sprite->
state != 3) {
68 if (sprite->
time > 0) {
70 scaledDy = dy * sprite->
time;
73 offset = rsin((sprite->
time << 12) / (sprite->
duration * 2)) * 0x1C00;
74 sprite->
y += (dy > 0 ? -offset : offset) / 0x1000;
105 sprite->
scaleY = rsin((sprite->
time << 12) / 24) / 16 + 0x1000;
107 if (sprite->
time >= 12) {
120 sprite->
state = state;
132 if (sprite->
time >= 10) {
144 if (sprite->
time >= duration) {
159 sprite->
scaleY = 0x1000 - rsin((sprite->
time << 12) / 24) / 8;
161 if (sprite->
time >= 12) {
175 sprite->
state = state;
184 sprite->
scaleX = 0x1000 - rsin((sprite->
time << 12) / 24);
190 if (sprite->
time >= 12) {
199 return (
u8 *)sheet + offset;
212 u = sprite->
index / 8 * 32;
213 v = sprite->
index % 8 * 32;
218 frame[1] = sprite->
index;
232 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
238 drawer.
draw(sheet, 0, sprite->
x >> 8, sprite->
y >> 8);
249 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
257 sprite->
x >> 8, sprite->
y >> 8);
261 sprite->
x >> 8, sprite->
y >> 8);
270 sprite->
x >> 8, sprite->
y >> 8);
279 sprite->
x >> 8, sprite->
y >> 8);
304 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
316 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
334 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
350 for (i = 0, n = 0; i < 3; i++) {
351 if (sprite->
marks[i] != 0) {
355 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
375 number.
x = (sprite->
x >> 8) + 4;
376 number.
y = (sprite->
y >> 8) + 0x21;
378 number.
pivotX = (sprite->
x >> 8) + 0x14;
379 number.
pivotY = (sprite->
y >> 8) + 0x17;
383 number.
x = (sprite->
x >> 8) + 0x17;
384 number.
y = (sprite->
y >> 8) + 0x21;
386 number.
pivotX = (sprite->
x >> 8) + 0x14;
387 number.
pivotY = (sprite->
y >> 8) + 0x17;
394 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
409 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
438 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
444 sprite->
x >> 8, sprite->
y >> 8);
454 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
468 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
487 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
503 drawer.
setPivot((sprite->
x >> 8) + 0x14, (sprite->
y >> 8) + 0x17);
513 switch (sprite->
state) {
581 for (i = 39; i >= 0; i--) {
585 for (pass = 0; pass < 2; pass++) {
586 for (i = 39; i >= 0; i--) {
CARDGAME.PRO: the card battle (mode 0x700).
u8 CARDGAME_highlightCluts[]
a palette cycle: 0, 1, 2, 3, 2, 1
u8 CARDGAME_loopFrames[]
the frames of a sprite's effect 1, which loops
u8 CARDGAME_onceFrames[]
the frames of its effect 2, which plays once
s16 CARDGAME_shakeOffsets[]
CARDGAME_shakeSprite's x offsets, by time.
s16 CARDGAME_jitterOffsets[]
CARDGAME_jitterSprite's x and y offsets.
s32 CARDGAME_pictureSheet[]
the sprite sheet CARDGAME_drawCardPicture draws a card's picture with
GfxState GFX
GFX: the graphics state and its methods.
FileCache FILE_CACHE
The file cache.
#define FILE_CARDGAME_TIMS
CARDGAME's own pictures, a TIM archive.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
void CARDGAME_drawSpriteEffect(CardScreen *screen, CardSprite *sprite)
Draws a sprite's effect animation (1-4, frames 0x28-0x4C of the fourth TIM) and ends it when its time...
void CARDGAME_updateSprites(CardScreen *screen, CardScreenItems *items)
Animates the sprites, then draws them: the moving ones first.
static void endSpriteFlip(CardSprite *sprite, s32 state)
The end of a sprite's flip (CARDGAME_flipSprite)
static void drawCardMark(CardSprite *sprite)
Draws the mark (sprite 0x1E) of a card that is not of kind 16.
void CARDGAME_animateSprite(CardScreen *screen, CardScreenItems *items, CardSprite *sprite)
Runs a sprite's animation for its state; sets bit 0 of spriteFlags while one runs.
void CARDGAME_drawSpriteBlink(CardScreen *screen, CardSprite *sprite)
Draws a blinking sprite's flash (state 11), its CLUT row changing.
s32 CARDGAME_holdSprite(CardScreen *screen, CardSprite *sprite, s32 duration)
Holds a sprite for duration frames, then ends its effect: 1 at the end.
void CARDGAME_drawSpriteHighlights(CardScreen *screen, CardSprite *sprite)
Draws the highlights over a sprite (highlight bits 0-2), with a cycling palette.
s32 CARDGAME_flipSprite(CardScreen *screen, CardSprite *sprite)
Turns a sprite over for 12 frames, its side swapped after 7: 1 at the end.
static s32 isScaled(CardSprite *sprite)
Whether sprite is scaled: its scaleX and scaleY, read as one word, aren't both 0x1000.
void CARDGAME_drawSpriteMarks(CardScreen *screen, CardSprite *sprite)
Draws a card's marks that are set (marks[0..2]: sprites 0x37 to 0x39), in a row 8 pixels apart.
void CARDGAME_drawSpriteOrder(CardScreen *screen, CardSprite *sprite)
Draws a sprite's order number (order), the place of its card in the record.
s32 CARDGAME_holdSpriteThenBlink(CardScreen *screen, CardSprite *sprite)
Holds a sprite for 10 frames, then starts its blink: 1 at the end.
void CARDGAME_drawSpriteCard(CardScreen *screen, CardSprite *sprite)
Draws a card sprite: its frame (visible 1, with the numbers or the mark and the image) or its back (v...
s32 CARDGAME_jitterSprite(CardScreen *screen, CardSprite *sprite)
Jitters a sprite about where it started and squashes it, for 12 frames: 1 at the end.
static void drawCardNumbers(CardSprite *sprite)
Draws a card's two numbers (ap and hp) and the sprite between them.
void CARDGAME_drawSprite(CardScreen *screen, CardSprite *sprite)
Draws a sprite and its marks, unless it is scaled to nothing.
static void resetSprite(CardSprite *sprite, s32 state)
Ends a sprite's move and puts it in STATE.
static void * getSheetPart(s32 *sheet, s32 offset)
The part of a sprite sheet at offset, one of the offsets it starts with.
s32 CARDGAME_shakeSprite(CardScreen *screen, CardSprite *sprite)
Shakes a sprite sideways and stretches it, for 12 frames: 1 at the end.
void CARDGAME_drawCardPicture(CardSprite *sprite)
Draws a card's picture: a one-part sprite sheet (CARDGAME_pictureSheet) made on the fly,...
s32 CARDGAME_flySprite(CardScreen *screen, CardSprite *sprite)
Flies a sprite from start to target along an arc while scaling it; at the end it swaps start and targ...
void CARDGAME_moveSprite(CardScreen *screen, CardSprite *sprite)
Moves and scales a sprite towards its targets; at the end it plays a sound (unless in state 3) and go...
void CARDGAME_drawSpriteDim(CardScreen *screen, CardSprite *sprite)
Draws the shade over a dimmed sprite.
A number drawn with the TIM archive's digits (CARDGAME_drawNumber)
The battle screen's task items.
The battle screen (created by CARDGAME_createScreen): the two panels, the cards on the table and the ...
s32 spriteFlags
this frame: bit 0 a sprite is animated, bit 1 a flying one landed
A card on the battle screen (CardScreen.sprites)
s32 growTime
the frames it grows for before it flies (CARDGAME_flySprite)
s16 index
in the battle's card list
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
u8 effect
1-4, drawn by CARDGAME_drawSpriteEffect
void *(* getEntry)(u32 fileAndIndex)
s32(* getFrameTime)(void)
s32(* next)(void)
0 to RANDOM_COUNT - 1
short(* playSound)(s32 id)
returns the voice of a key-on
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
void(* setAltClut)()
(x, y)
void(* setScale)()
(x, y, z), ONE = 1.0
void(* setLayerId)()
(id, depth)
void(* setClutRow)()
(row)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
One part of a sprite sheet, a rectangle of its texture.
s16 clutX
added to the drawer's CLUT position
s16 mode
0: 4-bit texture, 1: 8-bit, with the drawer's other CLUT
void CARDGAME_drawNumber(CardNumber *number, s32 scaled)
Draws a number with the TIM archive's digits, seven pixels apart, without leading zeros unless asked;...