Skip to Content
The Alchemy Project

src/window/window_sprites.c

Characters drawn into windows, and the per-tick sprite update. More…

Included by window.c.

Macros

NameDescription
#definePAGE_ARROW_Y_OFFSET JAPANESE_OR(1, (-1))Pixels added to the page arrow's and the sprite glyphs' screen y, which differ by language.
#defineGLYPH_SPRITE_Y_OFFSET JAPANESE_OR(0, (-2))
#defineGLYPH_SPRITE_SIZE (OBJ_SIZE_16X16 >> 16)A glyph sprite's size in OAM attribute 1: 16x16, with the square shape.
#defineVOICED_MARK_OVER_BORDER_TILE 30The tiles a voiced mark takes in place of its own over a window's top border and over a divider; a semi-voiced mark takes the next.
#defineVOICED_MARK_OVER_DIVIDER_TILE 14
#defineTILEMAP_ENTRIES (BG_SCREEN_WIDTH * DISPLAY_TILE_HEIGHT)The windows' tilemap entries in use: a screen block's rows down the screen.
#defineBOUNCE_SCALE_STEPS 32The steps of WindowSpriteBounceScales: a swell to 1.5 times and back.
#definePAGE_ARROW_FRAME_BYTES (2 * TILE_SIZE_8BPP)A frame of the next-page arrow: an 8 by 16 sprite of 256 colours.
#defineWOBBLE_STEPS 20The steps of WindowSpriteWobbleOffsets and WindowSpriteBounceOffsets.
#defineHOP_STEPS 16

Typedefs

NameDescription
typedef Sint32 (*GLYPH_ROUTINE )( WINDOW *, Uint32, Uint32, Uint32, const Uint8 *);

Functions

NameDescription
Sint32mnGlyphDraw (WINDOW *window, Sint32 character, Sint32 x, Sint32 y, Sint32 mode)Draws a character of a window's text with its top-left corner at pixel (x, y) of the window's interior and returns how far the text advances.
voidmnWindowPutGlyph ( WINDOW *window, Uint32 tile, Uint32 x, Uint32 y, Sint32 mode)Puts a character into a window's tilemap as a tile at tile (x, y) of its interior.
voidmnWindowSetTilemapEntry ( WINDOW *window, Sint32 value, Sint32 x, Sint32 y, Uint32 mode)Writes value into a window's tilemap at tile (x, y) of its interior, with the palette mode names (TILEMAP_ENTRY_), or as it is for TILEMAP_ENTRY_PLAIN; TILEMAP_ENTRY_NONE writes nothing. y -1 is the border's top row, where the menus put their page numbers and arrows (menu/menu_shared.c); a place beyond the bottom or right border, or outside the tilemap, is ignored.
voidmnWindowSpriteUpdateScaleAnimation (WINDOW_SPR *windowSprite)Steps a scaling sprite's animation (WINDOW_SPRITE_MOTION_SWELL to WINDOW_SPRITE_MOTION_SHRINK_HALF) and sets its affine scale for this tick.
voidmnWindowSpriteUpdateAll (void)The per-tick sprite update: moves each sprite that an open window carries by its animation mode (WINDOW_SPRITE_MOTION_) and queues it for drawing, at its depth slot (WINDOW_SPR.depth).

Description

Characters drawn into windows, and the per-tick sprite update. Part of window.c.

Macros in detail

PAGE_ARROW_Y_OFFSET

#define PAGE_ARROW_Y_OFFSET JAPANESE_OR(1, (-1))

Pixels added to the page arrow's and the sprite glyphs' screen y, which differ by language.

Referenced by mnGlyphDraw().

Definition at line 6 of file window_sprites.c.

GLYPH_SPRITE_Y_OFFSET

#define GLYPH_SPRITE_Y_OFFSET JAPANESE_OR(0, (-2))

Referenced by mnGlyphDraw().

Definition at line 7 of file window_sprites.c.

GLYPH_SPRITE_SIZE

#define GLYPH_SPRITE_SIZE (OBJ_SIZE_16X16 >> 16)

A glyph sprite's size in OAM attribute 1: 16x16, with the square shape.

Referenced by mnGlyphDraw().

Definition at line 13 of file window_sprites.c.

VOICED_MARK_OVER_BORDER_TILE

#define VOICED_MARK_OVER_BORDER_TILE 30

The tiles a voiced mark takes in place of its own over a window's top border and over a divider; a semi-voiced mark takes the next.

Referenced by mnWindowPutGlyph().

Definition at line 240 of file window_sprites.c.

VOICED_MARK_OVER_DIVIDER_TILE

#define VOICED_MARK_OVER_DIVIDER_TILE 14

Referenced by mnWindowPutGlyph().

Definition at line 241 of file window_sprites.c.

TILEMAP_ENTRIES

#define TILEMAP_ENTRIES (BG_SCREEN_WIDTH * DISPLAY_TILE_HEIGHT)

The windows' tilemap entries in use: a screen block's rows down the screen.

Referenced by mnWindowSetTilemapEntry().

Definition at line 330 of file window_sprites.c.

BOUNCE_SCALE_STEPS

#define BOUNCE_SCALE_STEPS 32

The steps of WindowSpriteBounceScales: a swell to 1.5 times and back.

Referenced by mnWindowSpriteUpdateScaleAnimation().

Definition at line 385 of file window_sprites.c.

PAGE_ARROW_FRAME_BYTES

#define PAGE_ARROW_FRAME_BYTES (2 * TILE_SIZE_8BPP)

A frame of the next-page arrow: an 8 by 16 sprite of 256 colours.

Referenced by mnWindowSpriteUpdateAll().

Definition at line 453 of file window_sprites.c.

WOBBLE_STEPS

#define WOBBLE_STEPS 20

The steps of WindowSpriteWobbleOffsets and WindowSpriteBounceOffsets.

Referenced by mnWindowSpriteUpdateAll().

Definition at line 455 of file window_sprites.c.

HOP_STEPS

#define HOP_STEPS 16

Referenced by mnWindowSpriteUpdateAll().

Definition at line 456 of file window_sprites.c.

Typedefs in detail

GLYPH_ROUTINE

typedef Sint32 (*GLYPH_ROUTINE)( WINDOW *, Uint32, Uint32, Uint32, const Uint8 *);

Referenced by mnGlyphDraw().

Definition at line 9 of file window_sprites.c.

Functions in detail

mnGlyphDraw

Sint32 mnGlyphDraw(WINDOW *window, Sint32 character, Sint32 x, Sint32 y, Sint32 mode)

Draws a character of a window's text with its top-left corner at pixel (x, y) of the window's interior and returns how far the text advances.

References FontMarkGlyphCodes, mnGlyphDrawArm(), mnGlyphDrawCodeSize, mnTextDrawGlyphPair(), mnWindowSpriteAcquireFree(), mnWindowSpriteAppendToList(), Sint32, state, syDMAXCopy(), syHeapRelease(), syResourceGetTableEntry(), syVRAMCacheFindFreeEntry() and width.

Referenced by mnMessageType() and mnTextDrawWideStringAtOffset().

Definition at line 17 of file window_sprites.c.

mnWindowPutGlyph

void mnWindowPutGlyph( WINDOW *window, Uint32 tile, Uint32 x, Uint32 y, Sint32 mode)

Puts a character into a window's tilemap as a tile at tile (x, y) of its interior.

The Japanese mnWindowPutGlyph, which also places the kana marks.

References line, mnWindowSpriteAcquireFree(), mnWindowSpriteAppendToList(), Sint32, state and syVRAMCacheFindFreeEntry().

Referenced by mnBattleCollectPartyCommands(), mnBattleSummonMenuRun() and mnTextDrawWideStringInWindow().

Definition at lines 173 and 244 of file window_sprites.c.

mnWindowSetTilemapEntry

void mnWindowSetTilemapEntry( WINDOW *window, Sint32 value, Sint32 x, Sint32 y, Uint32 mode)

Writes value into a window's tilemap at tile (x, y) of its interior, with the palette mode names (TILEMAP_ENTRY_), or as it is for TILEMAP_ENTRY_PLAIN; TILEMAP_ENTRY_NONE writes nothing. y -1 is the border's top row, where the menus put their page numbers and arrows (menu/menu_shared.c); a place beyond the bottom or right border, or outside the tilemap, is ignored.

References Sint32 and state.

Referenced by mnBattleCollectPartyCommands(), mnBattleDjinnMenuRun(), mnBattleDjinnMenuShowChangePreview(), mnBattleItemMenuRun(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun(), mnBattleSummonMenuRun(), mnPartyStatusDraw(), mnRangeIconDraw() and scInit().

Definition at line 337 of file window_sprites.c.

mnWindowSpriteUpdateScaleAnimation

void mnWindowSpriteUpdateScaleAnimation(WINDOW_SPR *windowSprite)

Steps a scaling sprite's animation (WINDOW_SPRITE_MOTION_SWELL to WINDOW_SPRITE_MOTION_SHRINK_HALF) and sets its affine scale for this tick.

References Sint32, syOAMMatrixAllocateFromTransform() and WindowSpriteBounceScales.

Referenced by mnWindowSpriteUpdateAll().

Definition at line 389 of file window_sprites.c.

mnWindowSpriteUpdateAll

void mnWindowSpriteUpdateAll(void)

The per-tick sprite update: moves each sprite that an open window carries by its animation mode (WINDOW_SPRITE_MOTION_) and queues it for drawing, at its depth slot (WINDOW_SPR.depth).

References FrameCount, mnWindowSpriteUpdateScaleAnimation(), Sint32, state, syCos(), syOAMAddSpriteAtDepth(), syOAMMatrixAllocateFromTransform(), sySin(), syVRAMCacheLoad(), WindowSpriteBounceOffsets, WindowSpriteCursorBobOffsets, WindowSpritePageArrowTiles and WindowSpriteWobbleOffsets.

Referenced by mnWindowSystemUpdate().

Definition at line 461 of file window_sprites.c.