Skip to Content
The Alchemy Project

src/window/screens_window_sprites.c

The sprites a window carries (icons, cursors and the speakers' portraits), and the window spans the screen transition reads. More…

Included by screens.c.

Macros

NameDescription
#defineWINDOW_SPAN_EMPTY WIN_RANGE(224, 224)A line's window span with no window: left and right both at 224.

Typedefs

NameDescription
typedef Uint16 *(*WINDOW_SPAN_ROUTINE )(Uint16 *spans, Uint16 *tilemap);The ARM routine that mnScanlineWindowFillSpans copies to RAM and runs, mnScanlineWindowBuildSpans; it returns the end of the spans it wrote.

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 mode, Sint32 resource, WINDOW *window, Sint32 x, Sint32 y)Loads resource resource in loading mode mode into a VRAM slot and shows it as a 16x16 sprite at (x, y) in window.
WINDOW_SPR *mnWindowSpriteCreateLoaded ( Sint32 icon, Sint32 layers, WINDOW *window, Sint32 x, Sint32 y)Copies icon icon (with layers passed on to the copier) into a free VRAM slot and shows it as a 16x16 sprite at (x, y) in window.
WINDOW_SPR *mnWindowSpriteCreateCommandIcon (Sint32 icon, WINDOW *window, Sint32 x, Sint32 y)Unused: builds the 16x16 command icon of overlay icon over base 1 (mnIconBuildCommandIconTiles) and shows it at (x, y) in window, in front of the other window sprites.
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), in PORTRAIT_PALETTE + side.
voidmnPortraitReload (Uint32 slot, Sint32 speaker, Sint32 unused)Reloads the portrait of speaker into portrait slot slot with that slot's palette (PORTRAIT_PALETTE + slot), reusing the slot's VRAM cache entry.
voidmnWindowSpriteSetMotion (WINDOW_SPR *sprite, Sint32 motion)Sets a window sprite's motion and starts it from its first step; does nothing for NULL.
voidmnWindowSpriteSetPriority (void *sprite, Sint32 priority)Sets the depth of the window sprite sprite to ~priority, which is OAM_DEPTH_FRONT - priority: a higher priority draws further back.
voidmnScanlineWindowFillSpans (void *spans)Fills spans, a page of the screen transition's window edges past its WININ and WINOUT, with the windows' horizontal extent on each of the 160 scan lines: (left << 8) | right in the second halfword (WIN1H) of each line's pair, read from the UI tilemap by the ARM function mnScanlineWindowBuildSpans (window_spans.c), copied into RAM for the call.
voidmnBgScreenFillRect ( Sint32 unusedA, Sint32 unusedB, Uint32 width, Uint32 height, Sint32 value)Fills the top-left width x height tiles of WINDOW_TILEMAP_VRAM, a BG_SCREEN_WIDTH-tile map, with the tilemap entry value.

Description

The sprites a window carries (icons, cursors and the speakers' portraits), and the window spans the screen transition reads. Part of screens.c.

Macros in detail

WINDOW_SPAN_EMPTY

#define WINDOW_SPAN_EMPTY WIN_RANGE(224, 224)

A line's window span with no window: left and right both at 224.

Referenced by mnScanlineWindowFillSpans().

Definition at line 206 of file screens_window_sprites.c.

Typedefs in detail

WINDOW_SPAN_ROUTINE

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

The ARM routine that mnScanlineWindowFillSpans copies to RAM and runs, mnScanlineWindowBuildSpans; it returns the end of the spans it wrote.

Referenced by mnScanlineWindowFillSpans().

Definition at line 203 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. Releases the slot and returns NULL when no sprite is free.

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

Referenced by mnCommandIconCreate(), mnDebugBrowserIcons(), mnDebugMenuOpen(), mnDebugShortcutOpen(), mnDebugSoundTestOpen(), mnDebugWarpOpen(), mnNameEntryEditMemberName(), mnPauseMenuOpen(), mnPortraitCreate(), mnSettingsMenuOpen(), mnTitleCreate(), mnWindowSpriteCreateAbilityIcon(), mnWindowSpriteCreateCommandIcon(), mnWindowSpriteCreateFromResource(), mnWindowSpriteCreateLoaded() and scClearEnterPassword().

Definition at line 8 of file screens_window_sprites.c.

mnWindowSpriteCreateFromResource

WINDOW_SPR *mnWindowSpriteCreateFromResource( Sint32 mode, Sint32 resource, WINDOW *window, Sint32 x, Sint32 y)

Loads resource resource in loading mode mode into a VRAM slot and shows it as a 16x16 sprite at (x, y) in window.

References mnSelectionIconLoad(), mnWindowSpriteCreate() and Sint32.

Definition at line 46 of file screens_window_sprites.c.

mnWindowSpriteCreateLoaded

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

Copies icon icon (with layers passed on to the copier) into a free VRAM slot and shows it as a 16x16 sprite at (x, y) in window.

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

Definition at line 61 of file screens_window_sprites.c.

mnWindowSpriteCreateCommandIcon

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

Unused: builds the 16x16 command icon of overlay icon over base 1 (mnIconBuildCommandIconTiles) and shows it at (x, y) in window, in front of the other window sprites. Nothing calls it.

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

Definition at line 81 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), in PORTRAIT_PALETTE + side. unused is passed on to mnIconLoadWithPalette, which ignores it.

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

Referenced by mnPortraitOpenWindow().

Definition at line 104 of file screens_window_sprites.c.

mnPortraitReload

void mnPortraitReload(Uint32 slot, Sint32 speaker, Sint32 unused)

Reloads the portrait of speaker into portrait slot slot with that slot's palette (PORTRAIT_PALETTE + slot), reusing the slot's VRAM cache entry. A slot of 2 or more means whichever slot already shows the picture, the second first; when neither does, nothing is loaded.

References mnIconLoadWithPalette(), mnPortraitGetForSpeaker() and Sint32.

Definition at line 158 of file screens_window_sprites.c.

mnWindowSpriteSetMotion

void mnWindowSpriteSetMotion(WINDOW_SPR *sprite, Sint32 motion)

Sets a window sprite's motion and starts it from its first step; does nothing for NULL.

References Sint32.

Definition at line 183 of file screens_window_sprites.c.

mnWindowSpriteSetPriority

void mnWindowSpriteSetPriority(void *sprite, Sint32 priority)

Sets the depth of the window sprite sprite to ~priority, which is OAM_DEPTH_FRONT - priority: a higher priority draws further back. Does nothing when sprite is NULL.

References Sint32.

Definition at line 195 of file screens_window_sprites.c.

mnScanlineWindowFillSpans

void mnScanlineWindowFillSpans(void *spans)

Fills spans, a page of the screen transition's window edges past its WININ and WINOUT, with the windows' horizontal extent on each of the 160 scan lines: (left << 8) | right in the second halfword (WIN1H) of each line's pair, read from the UI tilemap by the ARM function mnScanlineWindowBuildSpans (window_spans.c), copied into RAM for the call. With no window state, every line gets an empty span.

References mnScanlineWindowBuildSpansCode, mnScanlineWindowBuildSpansCodeSize and syHeapRelease().

Definition at line 214 of file screens_window_sprites.c.

mnBgScreenFillRect

void mnBgScreenFillRect( Sint32 unusedA, Sint32 unusedB, Uint32 width, Uint32 height, Sint32 value)

Fills the top-left width x height tiles of WINDOW_TILEMAP_VRAM, a BG_SCREEN_WIDTH-tile map, with the tilemap entry value.

References Sint32.

Definition at line 243 of file screens_window_sprites.c.