20 const s16 *entrance) {
21 s16 sceneIndex = scene;
93 s16 *entrance,
s16 *selectedField) {
103 if (*selectedField == 0) {
114 if (*selectedField == 0) {
125 if (*selectedField == 0) {
137 if (*selectedField == 0) {
194 for (i = 0; i != count; i++) {
195 u32 digit = value & 15;
197 digits[i] = digit +
'0';
199 digits[i] = digit +
'A' - 10;
203 for (i = count - 1; (
s32)i >= 0; i--)
219 for (row = 0; row != 16; row++) {
224 for (i = 0; i != 5; i++) {
231 for (i = 0; i < 16; i++) {
233 bits[i] = (set != 0) + 48;
244 s32 *row = &cursor[1];
247 s32 flag = (((*page << 4) + *row) << 4) + cursor[0];
267 if (++cursor[0] > 15)
314 }
else if (result == 1) {
317 }
else if (result == 2) {
370 page = (page + 8) % 8;
371 mode = (mode + 3) % 3;
386 for (i = 0; i <= 31; i++) {
389 x = (i - row * 8) * 16;
394 }
else if (mode == 1) {
412#define DEBUG_GLYPH_NAME MsgDebugGlyphName
413#elif (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_FRENCH)
414#define DEBUG_GLYPH_NAME MsgEnd
416#define DEBUG_GLYPH_NAME MsgDebugSecondForm
446 entryCount = characterCount + i;
450 cancelKey = ((
u32)(
u16)characterCount >> 16) |
KEY_B;
478 index = (index + entryCount) % entryCount;
480 if (index < characterCount)
489 s32 loadedSlot = *(
u16 *)((
u8 *)work + slotOffset);
What every part of the menu object shares: its includes, edition values, macros and the link round st...
#define OUTPUT_SIZE_16X16
OAM attribute bits a sprite output is created with: the size field of attribute 1 (bits 30-31 of the ...
void(*) SchedulerCallback(void)
s32 GameFlag_TestFar(s32 flag)
s32 GameFlag_SetBitFar(s32 flag)
s32 Djinn_AddToOwnerFar(s32 owner, s32 index, s32 bit)
void GameFlag_ClearBitFar(s32 flag)
s32 Scene_GetAreaNameIndexFar(s32 scene, s32 entrance)
void Event_SetDestinationFar(s32 first, s32 second)
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
volatile u8 gSleepRequested
1: sleep this frame; more: count down to it.
void UiText_ShowPositionedMessageAndWait(s32 message, s32 flags)
Shows a message in a window centred on the screen, waits until it is typed out and closes it.
struct GameState gGameState
volatile u32 gKeysHeld
Keys down now.
volatile u32 gKeysPressed
Keys that went down this frame.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
s32 Menu_RunWorkspaceSelectionLoop(void)
Runs the system menu until the player picks an entry (its number, counting Save your quest as 0) or c...
s32 Menu_RunWorkspaceOptions(void)
Runs the option screen (window colour and brightness, message speed, speech, auto-sleep) until A or S...
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,...
const s16 gPortrait_SpriteMap[100]
{sprite, portrait} pairs of the other speakers, ending in -1: portrait n of this list is portrait 128...
const s16 gPortrait_CharacterMap[20]
{character, portrait} pairs of the playable characters, ending in -1.
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
void UiTextResource_Initialize(struct MenuSprite *sprite, s32 *slot)
Sets up a sprite as the right-pointing arrow, in a free tile slot (returned in *slot).
void UiTextResource_Release(s32 value)
Frees an arrow sprite's tile slot.
void UiTextResource_SetPosition(struct MenuSprite *sprite, s32 x, s32 y)
Places an arrow sprite at (x, y) and queues it for drawing.
s16 defaultEntrance
the entrance it was entered by
s16 defaultScene
the scene being run, kept as it starts
s16 suspended
nonzero while a menu has suspended sprite projection
The window system's work: the windows' tilemap, the windows, the three text channels,...
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
#define RENDER_SLOT_VALUE_OFFSET
void UiText_DrawStringInWindow(const u8 *text, struct UiWindow *window, u32 x, u32 y)
Draws a byte string into a window's tilemap at pixel (x, y) of its interior, rounded down to tiles.
void UiText_DrawResource(s32 message, struct UiWindow *window, s32 x, s32 y)
Decodes a message and draws it into a text canvas window at pixel (x, y).
void UiText_DrawString(const u8 *text, struct UiWindow *window, s32 x, s32 y)
Draws a byte string into a text canvas window at pixel (x, y).
void UiText_DrawNumberInWindow(s32 value, s32 width, struct UiWindow *window, s32 x, s32 y)
Draws a number (width as UiText_FormatNumber) into a window's tilemap at pixel (x,...
void UiText_DrawCharacterAtOffset(s32 message, const struct UiWindow *window, u32 offsetX, u32 offsetY)
Decodes a message and draws it as tiles in a window at pixel (offsetX, offsetY) of its interior.
void UiText_DrawNumber(s32 value, s32 width, struct UiWindow *window, s32 x, s32 y)
Draws a number (width as UiText_FormatNumber) into a text canvas window at pixel (x,...
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
s32 Menu_HandleSelectionRowInput(struct UiWindow *window, s16 scene, s16 *entrance, s16 *selectedField)
Edits the debug scene or entrance, returning -1 to warp and -2 to cancel.
void Menu_DrawSelectionRow(struct UiWindow *work, s32 scene, const s16 *entrance)
Draws the debug scene and entrance numbers with their category/area labels.
s32 DebugMenu_BrowseIcons(void)
Browses pages of item, Psynergy and status-pattern icons, suspending the menu controller while the br...
UNUSED void DebugMenu_ScheduleSceneSelector(void)
Schedules the debug scene and entrance selector; 0xc80 is a scheduler order, not a number of frames t...
void Menu_DrawFlagBitTable(struct UiWindow *window, s32 page)
Draws one page of 256 flags as sixteen rows of hexadecimal labels and bits.
void Text_FormatHex(u32 value, u32 count, u8 *out)
Writes the lowest count digits of value, up to five, most significant first as uppercase hexadecimal ...
s32 Menu_RunSelectionWithCursorObject(void)
Shows a 16x16 flag grid per page and processes input until closed.
s32 Menu_RunWorkspaceResultLoop(void)
Handles Save, Sleep and Options from the field workspace.
s32 DebugMenu_BrowseEntryGlyphs(void)
Browses the character and sprite portrait maps as one circular list.
s32 Menu_HandleFlagGridInput(struct UiWindow *window, s32 *page, s32 *cursor)
Moves within the flag grid, changes pages, or toggles the selected flag.
void Menu_ReservedNoOp(void)
Reserved menu entry.
s16 Menu_RunSelection(void)
void Djinn_SetFoundFlagAndAdd(s32 owner, s32 element, s32 index)
Sets the Djinni's collected flag, then adds it to the specified owner.
s32 Save_WriteSelectedSlot(void)
The Save command: lets the player choose a file (the current one first), asks whether to save over it...
void UiIcon_BuildAbilityIconTiles(u32 glyph, s32 withBase, s32 *cacheSlot, s32 *tileOut, s32 reuse)
Builds the Psynergy icon glyph, over the icon frame when withBase is set, and loads it into *cacheSlo...
s32 Ui_BuildPatternToSlot(s32 icon, s32 unused, s32 cacheSlot)
Builds one of the other icons and loads it into sprite tile slot cacheSlot.
void UiIcon_BuildItemIconTiles(u32 glyph, s32 withBase, s32 *cacheSlot, s32 *tileOut, s32 reuse)
Builds the item icon glyph, over the icon frame when withBase is set, and loads it into *cacheSlot (a...
void UiGlyph_LoadEntryWithPalette(u32 icon, s32 unused, s32 *slot, s32 *tile, s32 palette, s32 reuse)
Loads a 32x32 icon from the icon resource into sprite tile slot *slot (a free slot unless reuse is se...
struct UiWindow * UiWindow_CreateWithSideObject(s32 speaker, s32 portraitOption, s32 x, s32 y)
Opens a portrait window at tile (x, y) showing the speaker's portrait.
void RenderOutput_PrepareForRedraw(struct UiWindow *window)
Clears a window's contents: redraws its empty frame and releases the render outputs it carries.
void UiWork_Finalize(struct UiWindow *window, s32 instant)
Closes a window: clears its contents and remembers its last rectangle.
struct UiWindow * UiWindow_Create(s32 x, s32 y, s32 width, s32 height, s32 attrs)
Opens a window at tile (x, y) of width by height tiles in the first free window slot,...