Alchemy
Loading...
Searching...
No Matches

outputs.c File Reference

Sprite outputs, portraits and the window spans. More...

Go to the source code of this file.

Typedefs

typedef void(*) WindowSpanRoutine(u16 *spans, u16 *tilemap)

Functions

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).
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.
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.
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.
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.
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).
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.
void RenderOutput_SetAnimation (struct RenderOutput *out, s32 mode)
 Switches the sprite output out to animation mode from its first step.
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.
void UiWindow_FillFromScene (void *spans)
 Fills spans with the horizontal extent of the windows on each of the 20 tile rows, read from the UI tilemap by the ARM routine Tile_BuildMetatiles copied into RAM.
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.

Detailed Description

Sprite outputs, portraits and the window spans.

Part of battle_command.c, the menu object, compiled only through it.

Definition in file outputs.c.

Typedef Documentation

◆ WindowSpanRoutine

typedef void(*) WindowSpanRoutine(u16 *spans, u16 *tilemap)

Definition at line 233 of file outputs.c.

Function Documentation

◆ 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.

Definition at line 13 of file outputs.c.

Referenced by CreateSideObject(), Debug_SelectAbilityPair(), DebugMenu_BrowseIcons(), NameEntry_EditOwnerName(), OptionMenu_Open(), PartyTalkMenu_Choose(), RenderOutput_Create(), RenderOutput_CreateFromResource(), RenderOutput_CreateFromTable(), RenderOutput_CreateLoaded(), RenderOutput_CreateWithTransform(), RenderResource_CreateFrame(), RenderResource_CreatePair(), SaveMenu_SelectSlot(), SystemMenu_Open(), and Ui_CreateOutputFromResourceSlot().

◆ 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.

Definition at line 63 of file outputs.c.

Referenced by RenderOutput_CreateFromResource().

◆ 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.

Definition at line 78 of file outputs.c.

Referenced by RenderOutput_CreateLoaded().

◆ 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.

Definition at line 96 of file outputs.c.

Referenced by RenderOutput_CreateWithTransform().

◆ 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.

Definition at line 117 of file outputs.c.

Referenced by RenderOutput_CreateFromTable().

◆ 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.

Definition at line 138 of file outputs.c.

Referenced by CreateSideObject(), and 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.

Definition at line 185 of file outputs.c.

Referenced by Ui_LoadCharacterEntryForSlot().

◆ 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.

Definition at line 219 of file outputs.c.

Referenced by RenderOutput_SetAnimation().

◆ 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.

Definition at line 228 of file outputs.c.

Referenced by RenderOutput_SetInvertedSentinel().

◆ UiWindow_FillFromScene()

void UiWindow_FillFromScene ( void * spans)

Fills spans with the horizontal extent of the windows on each of the 20 tile rows, read from the UI tilemap by the ARM routine Tile_BuildMetatiles copied into RAM.

With no UI work, every row is filled with 0xe0e0 (no window).

Definition at line 239 of file outputs.c.

Referenced by UiWindow_FillFromScene().

◆ 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.

Definition at line 256 of file outputs.c.

Referenced by UiWindow_FillScreenBlockRect().