outputs.c
Sprite outputs, portraits and the window spans.
games/tbs/src/window/battle_command/outputs.c on GitHub
Sprite outputs, portraits and the window spans. Part of battle_command.c, the menu object, compiled only through it.
Functions
RenderOutput_Create
struct RenderOutput *RenderOutput_Create(s32 slot, s32 oamFlags, struct UiWindow *window, s32 offsetX, s32 offsetY)
Creates a sprite output 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. The sprite draws on layer 255 until the caller changes
it. Returns the output, or NULL with the VRAM slot released when all
outputs are in use.
Used by CreateSideObject, Debug_SelectAbilityPair, NameEntry_EditOwnerName, OptionMenu_Open, PartyTalkMenu_Choose, RenderOutput_CreateFromResource, RenderOutput_CreateFromTable, RenderOutput_CreateLoaded, RenderOutput_CreateWithTransform, RenderResource_CreateFrame, RenderResource_CreatePair, SaveMenu_SelectSlot, SystemMenu_Open.
RenderOutput_CreateFromResource
struct RenderOutput *RenderOutput_CreateFromResource(s32 mode, s32 resource, struct UiWindow *window, s32 x, s32 y)
Loads resource resource in loading mode mode into a VRAM slot and shows
it as a 16x16 sprite at (x, y) in window. Returns NULL when it cannot be
loaded. The field menus' item and Psynergy icons come through here, by far
call (menu/menu).
RenderOutput_CreateLoaded
struct RenderOutput *RenderOutput_CreateLoaded(s32 icon, s32 layers, struct UiWindow *window, s32 x, s32 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. Returns NULL
when no slot is free. The shops' item icons come through here, by far
call.
RenderOutput_CreateWithTransform
struct RenderOutput *RenderOutput_CreateWithTransform(s32 icon, struct UiWindow *window, s32 x, s32 y)
Builds a 16x16 icon from frame pattern 1 with overlay pattern icon drawn
over it, and shows it at (x, y) in window on draw layer 251. Returns NULL
when no VRAM slot is free. Nothing calls it.
RenderOutput_CreateFromTable
struct RenderOutput *RenderOutput_CreateFromTable(s32 tableEntry, struct UiWindow *window, s32 x, s32 y)
Loads the pattern at the start of gRenderResource_PairSourceTable 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. Returns NULL when no slot is free.
CreateSideObject
struct RenderOutput *CreateSideObject(s32 character, s32 unused, s32 side, struct UiWindow *window, s32 x, s32 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). Each slot has its own palette, 14 or 15. In the prologue,
characters 0 and 1 show portraits 18 and 19 instead. unused is
passed on to the loader, which ignores it. Returns the sprite, or NULL when
the character has no portrait or both slots are taken. The slot records
the portrait and its VRAM slot (UiRenderWork.resourceIds and outputIds);
the message windows' speaker portraits come through here
(window/messages.c).
Used by UiWindow_CreateWithSideObject.
Ui_LoadCharacterEntryForSlot
void Ui_LoadCharacterEntryForSlot(u32 side, s32 character, s32 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. With any other side, the slot already showing that character's
portrait is used, and nothing happens when none does. unused is passed on
to the loader, which ignores it. The field menus reload portrait slot 0
with it by far call (menu/menu/common.c).
RenderOutput_SetAnimation
void RenderOutput_SetAnimation(struct RenderOutput *out, s32 mode)
Switches the sprite output out to animation mode from its first step.
Does nothing when out is NULL.
RenderOutput_SetInvertedSentinel
void RenderOutput_SetInvertedSentinel(void *output, s32 priority)
Sets the draw layer of the sprite output output to 255 - priority, so a
higher priority draws on a lower layer. Does nothing when output is NULL.
UiWindow_FillFromScene
void UiWindow_FillFromScene(void *spans)
Fills spans, a page of the display transition's window edges past its
WININ and WINOUT, with the window frames' 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 routine
Tile_BuildMetatiles, copied into RAM for the call. Each frame of a window
transition calls it (DisplayTransition_UpdateScanlineTable). With no UI
work it writes 0xe0e0, an empty extent, over 0x140 bytes: both halfwords
of the first 80 lines only.
XXX: likely meant to cover all 160 lines, because each line takes 4 bytes;
what the lower half then shows is not established.
UiWindow_FillScreenBlockRect
void UiWindow_FillScreenBlockRect(s32 unused0, s32 unused1, u32 width, u32 height, s32 value)
Fills the top-left width x height tiles of the 32-tile-wide BG screen
block at 0x06002000 with the tilemap entry value. The first two
parameters are ignored.
Types, without a comment: WindowSpanRoutine.