Skip to Content
The Alchemy Project

src/window/screens_window_sprites.c

The sprites that sit on windows: item, Psynergy and command icons and the speakers' portraits beside their messages. More…

Included by screens.c.

Macros

NameDescription
#defineOBJ_Y_MASK 0xffAttribute 0's eight bits of y: a sprite above the screen is at 256 less its distance.
#defineWINDOW_SPAN_EMPTY WIN_RANGE(224, 224)A line's window edges with nothing between them: 224 up to 224, so the window covers none of the line.

Typedefs

NameDescription
typedef void (*WINDOW_SPAN_ROUTINE )(Uint16 *spans, Uint16 *tilemap);

Functions

NameDescription
WINDOW_SPR *mnWindowSpriteCreate (Sint32 slot, Sint32 oamFlags, WINDOW *window, Sint32 offsetX, Sint32 offsetY)Creates a window sprite for the VRAM cache slot slot and attaches it to window, placed at (offsetX, offsetY) pixels from the window's inner corner (one tile in from its top-left border).
WINDOW_SPR *mnWindowSpriteCreateFromResource ( Sint32 kind, Sint32 entry, WINDOW *window, Sint32 x, Sint32 y)Shows the icon of entry, of kind (ICON_KIND: a command, item or Psynergy), as a 16x16 sprite at (x, y) in window; the Psynergy, Item and Status menus show their icons this way.
WINDOW_SPR *mnWindowSpriteCreateLoaded ( Sint32 inventoryCode, Sint32 layers, WINDOW *window, Sint32 x, Sint32 y)Shows the icon of the item inventoryCode as a 16x16 sprite at (x, y) in window, with the marks layers asks for (ICON_EQUIPPED and the like over the item): the shops' item icons.
WINDOW_SPR *mnWindowSpriteCreateOverlaidIcon (Sint32 icon, WINDOW *window, Sint32 x, Sint32 y)Builds command icon icon over the command frame ICON_FRAME_COMMAND_RED and shows it as a 16x16 sprite at (x, y) in window, on draw layer 251.
WINDOW_SPR *mnWindowSpriteCreateFromTable (Sint32 tableEntry, WINDOW *window, Sint32 x, Sint32 y)Loads the pattern at the start of MenuTitlePictures into a free VRAM slot and shows it as a 16x16 sprite at (x, y) in window.
WINDOW_SPR *mnPortraitCreate (Sint32 character, Sint32 unused, Sint32 side, WINDOW *window, Sint32 x, Sint32 y)Shows the 32x32 portrait of character at (x, y) in window, in portrait slot side (0 or 1, or any other value for the first free one; the second is tried first).
voidmnPortraitReload (Uint32 side, Sint32 character, Sint32 unused)Reloads the portrait image of character into portrait slot side (0 or 1), keeping its sprite: used to change the picture of a portrait already on screen.
voidmnWindowSpriteSetMotion (WINDOW_SPR *sprite, Sint32 mode)Switches sprite to motion mode (WINDOW_SPRITE_MOTION_) from its first step.
voidmnWindowSpriteSetPriority (void *sprite, Sint32 priority)Sets the draw layer of the window sprite sprite to 255 - priority, so a higher priority draws on a lower layer.
voidmnScanlineWindowFillSpans (void *spans)Fills spans, a page of the screen transition's scan line table, with the outline of the windows on screen, so that they stay in view while the transition covers the rest: for each of the 160 lines, (left << 8) | right in the second halfword (WIN1H) of its pair.
voidmnBgScreenFillRect ( Sint32 x, Sint32 y, Uint32 width, Uint32 height, Sint32 value)Fills the top-left width x height tiles of WINDOW_TILEMAP_VRAM, 32 tiles wide, with the tilemap entry value.

Description

The sprites that sit on windows: item, Psynergy and command icons and the speakers' portraits beside their messages. Also the windows' outline that keeps them in view through a screen transition. Part of screens.c.

Macros in detail

OBJ_Y_MASK

#define OBJ_Y_MASK 0xff

Attribute 0's eight bits of y: a sprite above the screen is at 256 less its distance.

Referenced by mnWindowSpriteCreate().

Definition at line 7 of file screens_window_sprites.c.

WINDOW_SPAN_EMPTY

#define WINDOW_SPAN_EMPTY WIN_RANGE(224, 224)

A line's window edges with nothing between them: 224 up to 224, so the window covers none of the line.

Referenced by mnScanlineWindowFillSpans().

Definition at line 11 of file screens_window_sprites.c.

Typedefs in detail

WINDOW_SPAN_ROUTINE

typedef void (*WINDOW_SPAN_ROUTINE)(Uint16 *spans, Uint16 *tilemap);

Referenced by mnScanlineWindowFillSpans().

Definition at line 271 of file screens_window_sprites.c.

Functions in detail

mnWindowSpriteCreate

WINDOW_SPR *mnWindowSpriteCreate(Sint32 slot, Sint32 oamFlags, WINDOW *window, Sint32 offsetX, Sint32 offsetY)

Creates a window sprite for the VRAM cache slot slot and attaches it to window, placed at (offsetX, offsetY) pixels from the window's inner corner (one tile in from its top-left border). oamFlags holds the OAM shape and size bits.

References mnWindowSpriteAcquireFree(), mnWindowSpriteAppendToList(), Sint32 and syVRAMCacheFreeEntry().

Referenced by mnColossoMenuChoose(), mnCommandIconCreate(), mnDebugBrowserIcons(), mnDebugSelectShortcuts(), mnNameEntryEditMemberName(), mnPauseMenuOpen(), mnPortraitCreate(), mnSettingsMenuOpen(), mnTitleCreate(), mnWindowSpriteCreateAbilityIcon(), mnWindowSpriteCreateFromResource(), mnWindowSpriteCreateFromTable(), mnWindowSpriteCreateLoaded() and mnWindowSpriteCreateOverlaidIcon().

Definition at line 17 of file screens_window_sprites.c.

mnWindowSpriteCreateFromResource

WINDOW_SPR *mnWindowSpriteCreateFromResource( Sint32 kind, Sint32 entry, WINDOW *window, Sint32 x, Sint32 y)

Shows the icon of entry, of kind (ICON_KIND: a command, item or Psynergy), as a 16x16 sprite at (x, y) in window; the Psynergy, Item and Status menus show their icons this way.

References mnSelectionIconLoad(), mnWindowSpriteCreate() and Sint32.

Definition at line 72 of file screens_window_sprites.c.

mnWindowSpriteCreateLoaded

WINDOW_SPR *mnWindowSpriteCreateLoaded( Sint32 inventoryCode, Sint32 layers, WINDOW *window, Sint32 x, Sint32 y)

Shows the icon of the item inventoryCode as a 16x16 sprite at (x, y) in window, with the marks layers asks for (ICON_EQUIPPED and the like over the item): the shops' item icons.

References mnItemIconLoadLayersIntoSlot(), mnWindowSpriteCreate(), Sint32 and syVRAMCacheFindFreeEntry().

Definition at line 88 of file screens_window_sprites.c.

mnWindowSpriteCreateOverlaidIcon

WINDOW_SPR *mnWindowSpriteCreateOverlaidIcon(Sint32 icon, WINDOW *window, Sint32 x, Sint32 y)

Builds command icon icon over the command frame ICON_FRAME_COMMAND_RED and shows it as a 16x16 sprite at (x, y) in window, on draw layer 251.

References mnIconBuildCommandIconTiles(), mnWindowSpriteCreate(), Sint32 and syVRAMCacheFindFreeEntry().

Definition at line 107 of file screens_window_sprites.c.

mnWindowSpriteCreateFromTable

WINDOW_SPR *mnWindowSpriteCreateFromTable(Sint32 tableEntry, WINDOW *window, Sint32 x, Sint32 y)

Loads the pattern at the start of MenuTitlePictures into a free VRAM slot and shows it as a 16x16 sprite at (x, y) in window. tableEntry is passed on to the loader, which loads that same pattern for every value.

References mnTitleLoadFirstTile(), mnWindowSpriteCreate(), Sint32 and syVRAMCacheFindFreeEntry().

Definition at line 131 of file screens_window_sprites.c.

mnPortraitCreate

WINDOW_SPR *mnPortraitCreate(Sint32 character, Sint32 unused, Sint32 side, WINDOW *window, Sint32 x, Sint32 y)

Shows the 32x32 portrait of character at (x, y) in window, in portrait slot side (0 or 1, or any other value for the first free one; the second is tried first).

References gmFlagGetStub(), mnIconLoadWithPalette(), mnPortraitGetForSpeaker(), mnWindowSpriteCreate(), Sint32 and state.

Referenced by mnPortraitOpenWindow().

Definition at line 153 of file screens_window_sprites.c.

mnPortraitReload

void mnPortraitReload(Uint32 side, Sint32 character, Sint32 unused)

Reloads the portrait image of character into portrait slot side (0 or 1), keeping its sprite: used to change the picture of a portrait already on screen.

References gmFlagGetStub(), mnIconLoadWithPalette(), mnPortraitGetForSpeaker(), Sint32 and state.

Definition at line 211 of file screens_window_sprites.c.

mnWindowSpriteSetMotion

void mnWindowSpriteSetMotion(WINDOW_SPR *sprite, Sint32 mode)

Switches sprite to motion mode (WINDOW_SPRITE_MOTION_) from its first step. Does nothing when sprite is NULL.

References Sint32.

Definition at line 254 of file screens_window_sprites.c.

mnWindowSpriteSetPriority

void mnWindowSpriteSetPriority(void *sprite, Sint32 priority)

Sets the draw layer of the window sprite sprite to 255 - priority, so a higher priority draws on a lower layer. Does nothing when sprite is NULL.

References Sint32.

Definition at line 265 of file screens_window_sprites.c.

mnScanlineWindowFillSpans

void mnScanlineWindowFillSpans(void *spans)

Fills spans, a page of the screen transition's scan line table, with the outline of the windows on screen, so that they stay in view while the transition covers the rest: for each of the 160 lines, (left << 8) | right in the second halfword (WIN1H) of its pair. The edges are read off the UI tilemap by mnScanlineWindowBuildEdges, ARM code copied into RAM for the call; before the window state is set up, every line's span is empty.

References mnScanlineWindowBuildEdges(), mnScanlineWindowBuildEdgesCodeSize and syHeapRelease().

Definition at line 279 of file screens_window_sprites.c.

mnBgScreenFillRect

void mnBgScreenFillRect( Sint32 x, Sint32 y, Uint32 width, Uint32 height, Sint32 value)

Fills the top-left width x height tiles of WINDOW_TILEMAP_VRAM, 32 tiles wide, with the tilemap entry value.

References Sint32 and width.

Definition at line 308 of file screens_window_sprites.c.