Skip to Content
The Alchemy Project

src/window/screens_debug.c

The debug destination menu, the flag browser, the Pause menu's choices, and the debug browsers of icons and portraits. More…

Included by screens.c.

Macros

NameDescription
#defineDEBUG_ROW_COLON_X JAPANESE_OR(100, 74)Where the debug destination row's colons and its second column (the entrance number and the area name) start, in pixels; further right in Japanese.
#defineDEBUG_ROW_SECOND_X JAPANESE_OR(110, 82)
#defineDEBUG_SCENE_MAX 324The debug destination menu's range: its scene runs 0 to DEBUG_SCENE_MAX, its entrance 0 to DEBUG_ENTRANCE_MAX.
#defineDEBUG_ENTRANCE_MAX 99
#defineDEBUG_FLAG_PAGES 16The flag browser's pages of DEBUG_FLAG_ROWS rows of DEBUG_FLAGS_PER_ROW flags, 256 a page: every game flag.
#defineDEBUG_FLAG_ROWS 16
#defineDEBUG_FLAGS_PER_ROW 16
#defineICON_BROWSER_KINDS 3The icon browser's kinds (items, Psynergy and status patterns), and its pages of ICON_BROWSER_PAGE_ICONS icons, ICON_BROWSER_ROW_ICONS to a row.
#defineICON_BROWSER_PAGES 12
#defineICON_BROWSER_PAGE_ICONS 32
#defineICON_BROWSER_ROW_ICONS 8

Functions

NameDescription
voidmnDebugSceneSelectDrawRow (void *window, Sint16 scene, const Sint16 *entrance)Draws the debug scene and entrance numbers with their scene code and area name.
Sint16mnDebugSceneSelectRun (void)The debug destination menu: picks a scene and an entrance, starting from the scene the party came from, and sends the party there with A; returns -1 after setting the destination and -2 when B cancels.
Sint32mnDebugSceneSelectHandleRowInput (Sint32 window, Sint16 scene, Sint16 *entrance, Sint16 *field)Edits the debug scene or entrance, returning -1 to exit and -2 to cancel, else the scene after this tick's keys.
Sint32mnDebugFlagEditorRun (void)The flag browser: shows a page of flags and takes input until closed, starting on page 8.
voidmnStringFormatHexDigits (Uint32 value, Uint32 count, Uint8 *out)Writes the lowest count digits of value (up to five), most significant first, to out as uppercase hexadecimal, without a terminating zero.
voidmnDebugFlagEditorDrawTable (Sint32 window, Sint32 page)Draws one page of 256 flags as sixteen rows of hexadecimal labels and bits.
Sint32mnDebugFlagEditorHandleInput (Sint32 window, Sint32 *page, Sint32 *cursor)Moves within the flag grid, changes pages, or toggles the selected flag.
voidmnReservedNoOperation (void)Unused: an empty function, the twin of the window object's mnSelectionMenuReservedNoOperation.
voidmnDjinnSetFoundFlagAndAdd (Sint32 member, Sint32 element, Sint32 index)Sets the Djinni's collected flag, then adds it to the specified party member.
Sint32mnPauseMenuRun (void)Handles Save your quest, Sleep and Change settings from the Pause menu.
voidmnWindowSetTextTileBitRect (const WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Uint32 set)Sets (set 1) or clears (0) bit 12 of the tilemap entries of the width x height tile rectangle at (x, y) inside window, clipped to the screen: bit 12 is the lowest bit of the entry's palette number, so this switches the rectangle between two palettes, such as 15 and 14.
Sint32mnDebugBrowserIcons (void)Browses pages of item, Psynergy and status-pattern icons, suspending the field's actor system while the browser owns its window and cache entries.
Sint32mnDebugBrowserPortraits (void)A debug browser of the portraits: left and right step through PortraitCharacterMap and then PortraitSpriteMap, L and R by DEBUG_LARGE_STEP, each drawn with its number and its name from MsgNamesMasterPoi; A or B leaves.

Description

The debug destination menu, the flag browser, the Pause menu's choices, and the debug browsers of icons and portraits. Part of screens.c.

Macros in detail

DEBUG_ROW_COLON_X

#define DEBUG_ROW_COLON_X JAPANESE_OR(100, 74)

Where the debug destination row's colons and its second column (the entrance number and the area name) start, in pixels; further right in Japanese.

Referenced by mnDebugSceneSelectDrawRow().

Definition at line 8 of file screens_debug.c.

DEBUG_ROW_SECOND_X

#define DEBUG_ROW_SECOND_X JAPANESE_OR(110, 82)

Referenced by mnDebugSceneSelectDrawRow().

Definition at line 9 of file screens_debug.c.

DEBUG_SCENE_MAX

#define DEBUG_SCENE_MAX 324

The debug destination menu's range: its scene runs 0 to DEBUG_SCENE_MAX, its entrance 0 to DEBUG_ENTRANCE_MAX.

Referenced by mnDebugSceneSelectHandleRowInput().

Definition at line 86 of file screens_debug.c.

DEBUG_ENTRANCE_MAX

#define DEBUG_ENTRANCE_MAX 99

Referenced by mnDebugSceneSelectHandleRowInput().

Definition at line 87 of file screens_debug.c.

DEBUG_FLAG_PAGES

#define DEBUG_FLAG_PAGES 16

The flag browser's pages of DEBUG_FLAG_ROWS rows of DEBUG_FLAGS_PER_ROW flags, 256 a page: every game flag.

Referenced by mnDebugFlagEditorHandleInput().

Definition at line 91 of file screens_debug.c.

DEBUG_FLAG_ROWS

#define DEBUG_FLAG_ROWS 16

Referenced by mnDebugFlagEditorDrawTable() and mnDebugFlagEditorHandleInput().

Definition at line 92 of file screens_debug.c.

DEBUG_FLAGS_PER_ROW

#define DEBUG_FLAGS_PER_ROW 16

Referenced by mnDebugFlagEditorDrawTable() and mnDebugFlagEditorHandleInput().

Definition at line 93 of file screens_debug.c.

ICON_BROWSER_KINDS

#define ICON_BROWSER_KINDS 3

The icon browser's kinds (items, Psynergy and status patterns), and its pages of ICON_BROWSER_PAGE_ICONS icons, ICON_BROWSER_ROW_ICONS to a row.

Referenced by mnDebugBrowserIcons().

Definition at line 490 of file screens_debug.c.

ICON_BROWSER_PAGES

#define ICON_BROWSER_PAGES 12

Referenced by mnDebugBrowserIcons().

Definition at line 491 of file screens_debug.c.

ICON_BROWSER_PAGE_ICONS

#define ICON_BROWSER_PAGE_ICONS 32

Referenced by mnDebugBrowserIcons().

Definition at line 492 of file screens_debug.c.

ICON_BROWSER_ROW_ICONS

#define ICON_BROWSER_ROW_ICONS 8

Referenced by mnDebugBrowserIcons().

Definition at line 493 of file screens_debug.c.

Functions in detail

mnDebugSceneSelectDrawRow

void mnDebugSceneSelectDrawRow(void *window, Sint16 scene, const Sint16 *entrance)

Draws the debug scene and entrance numbers with their scene code and area name. The first line has the scene's code (MsgDebugSceneCode + scene) and, beside it, the area its entrance leads to (MsgDebugAreaName + area); the numbers, three digits each, go under them.

References fdAreaGetNameIndexStub(), MenuColonString, mnTextDrawMessage(), mnTextDrawNumber(), mnTextDrawString(), mnWindowSpritePrepareForRedraw() and Sint32.

Referenced by mnDebugSceneSelectHandleRowInput() and mnDebugSceneSelectRun().

Definition at line 15 of file screens_debug.c.

mnDebugSceneSelectRun

Sint16 mnDebugSceneSelectRun(void)

The debug destination menu: picks a scene and an entrance, starting from the scene the party came from, and sends the party there with A; returns -1 after setting the destination and -2 when B cancels.

References fdScriptSetDestinationStub(), MainRoutineStateWork, mnArrowCreate(), mnArrowRelease(), mnArrowSetPos(), mnDebugSceneSelectDrawRow(), mnDebugSceneSelectHandleRowInput(), mnWindowClose(), mnWindowCreate(), PerWork, result, Sint32 and sySynch().

Referenced by mnDebugSceneSelectSchedule().

Definition at line 35 of file screens_debug.c.

mnDebugSceneSelectHandleRowInput

Sint32 mnDebugSceneSelectHandleRowInput(Sint32 window, Sint16 scene, Sint16 *entrance, Sint16 *field)

Edits the debug scene or entrance, returning -1 to exit and -2 to cancel, else the scene after this tick's keys. Up and Down switch the field (field: 0 scene, 1 entrance), Left and Right step by one and wrap at either end. R and L step a scene by DEBUG_LARGE_STEP, setting the entrance to 0, and past either end go to the other; they step an entrance as far, wrapping by DEBUG_ENTRANCE_MAX (95 + 10 gives 6).

References mnDebugSceneSelectDrawRow(), PerWork and Sint32.

Referenced by mnDebugSceneSelectRun().

Definition at line 101 of file screens_debug.c.

mnDebugFlagEditorRun

Sint32 mnDebugFlagEditorRun(void)

The flag browser: shows a page of flags and takes input until closed, starting on page 8. Returns 0.

References mnArrowCreate(), mnArrowRelease(), mnArrowSetPos(), mnDebugFlagEditorDrawTable(), mnDebugFlagEditorHandleInput(), mnWindowClose(), mnWindowCreate(), Sint32 and sySynch().

Definition at line 189 of file screens_debug.c.

mnStringFormatHexDigits

void mnStringFormatHexDigits(Uint32 value, Uint32 count, Uint8 *out)

Writes the lowest count digits of value (up to five), most significant first, to out as uppercase hexadecimal, without a terminating zero.

References Sint32.

Referenced by mnDebugFlagEditorDrawTable().

Definition at line 223 of file screens_debug.c.

mnDebugFlagEditorDrawTable

void mnDebugFlagEditorDrawTable(Sint32 window, Sint32 page)

Draws one page of 256 flags as sixteen rows of hexadecimal labels and bits. Each row: its first flag's number in three hex digits, then its 16 flags as 0 or 1, lowest first, under a heading of hex digits.

References MenuColonString, MenuHexDigitsString, mnStringFormatHexDigits(), mnTextDrawStringInWindow(), mnWindowSpritePrepareForRedraw(), Sint32 and syGameFlagGet().

Referenced by mnDebugFlagEditorRun().

Definition at line 248 of file screens_debug.c.

mnDebugFlagEditorHandleInput

Sint32 mnDebugFlagEditorHandleInput(Sint32 window, Sint32 *page, Sint32 *cursor)

Moves within the flag grid, changes pages, or toggles the selected flag. Returns 1 when flags/page need redrawing, -1 to close, and 0 otherwise. A toggles flag page * 256 + row * 16 + column; B or Select closes. L and R turn a page, wrapping at either end; with Start held they jump DEBUG_LARGE_STEP, to the other end when that passes it (5 - 10 gives 15).

References PerWork, Sint32, syGameFlagClear(), syGameFlagGet() and syGameFlagSet().

Referenced by mnDebugFlagEditorRun().

Definition at line 297 of file screens_debug.c.

mnReservedNoOperation

void mnReservedNoOperation(void)

Unused: an empty function, the twin of the window object's mnSelectionMenuReservedNoOperation. Nothing calls it.

Definition at line 364 of file screens_debug.c.

mnDjinnSetFoundFlagAndAdd

void mnDjinnSetFoundFlagAndAdd(Sint32 member, Sint32 element, Sint32 index)

Sets the Djinni's collected flag, then adds it to the specified party member. The flag is FLAG_DJINN_FIRST + DJINN_PER_ELEMENT * element + index.

The Pause menu's choices, a tilemap palette-bit rectangle, and the debug browsers of icons and

References gmDjinnGiveStub(), Sint32 and syGameFlagSet().

Definition at line 370 of file screens_debug.c.

mnPauseMenuRun

Sint32 mnPauseMenuRun(void)

Handles Save your quest, Sleep and Change settings from the Pause menu. Saving is refused, with its message, while FLAG_CANNOT_SAVE_HERE or FLAG_NO_PLACE_TO_SAVE is set. A refused or cancelled save or a cancelled settings menu reopens the Pause menu on the same entry; cancelling the Pause menu returns -1. Sleep shows its message and sets SleepRequested. Otherwise returns 0.

References mnFieldMessageShow(), mnPauseMenuChoose(), mnSaveToChosenFile(), mnSettingsMenuRun(), Sint32, SleepRequested and syGameFlagGet().

Definition at line 385 of file screens_debug.c.

mnWindowSetTextTileBitRect

void mnWindowSetTextTileBitRect(const WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Uint32 set)

Sets (set 1) or clears (0) bit 12 of the tilemap entries of the width x height tile rectangle at (x, y) inside window, clipped to the screen: bit 12 is the lowest bit of the entry's palette number, so this switches the rectangle between two palettes, such as 15 and 14. Nothing calls it.

References Sint32.

Definition at line 428 of file screens_debug.c.

mnDebugBrowserIcons

Sint32 mnDebugBrowserIcons(void)

Browses pages of item, Psynergy and status-pattern icons, suspending the field's actor system while the browser owns its window and cache entries. L and R switch the kind, Left and Right turn its pages (item and Psynergy icons from page * ICON_BROWSER_PAGE_ICONS on; the status patterns are the first page's on every page, whatever the heading says), A or B closes it. Returns 0. The debug rooms open it (debug/level.c, debug/psynergy_test.c, debug/shop_test.c).

References IconBrowserEnergyTitle, IconBrowserItemTitle, IconBrowserPageLabel, IconBrowserRangeDash, IconBrowserStatusTitle, mnIconBuildAbilityIconTiles(), mnIconBuildItemIconTiles(), mnIconBuildMiscellaneousIconTiles(), mnTextDrawNumberInWindow(), mnTextDrawStringInWindow(), mnWindowClose(), mnWindowCreate(), mnWindowSpriteCreate(), PerWork, Sint32, sySynch() and syVRAMCacheFindFreeEntry().

Referenced by dbIncreaseItemAndLevelOpenIconBrowser(), dbPsynergyTestOpenIconBrowser() and dbShopTestOpenIconBrowser().

Definition at line 502 of file screens_debug.c.

mnDebugBrowserPortraits

Sint32 mnDebugBrowserPortraits(void)

A debug browser of the portraits: left and right step through PortraitCharacterMap and then PortraitSpriteMap, L and R by DEBUG_LARGE_STEP, each drawn with its number and its name from MsgNamesMasterPoi; A or B leaves.

References mnIconLoadWithPalette(), mnPortraitOpenWindow(), mnTextDrawMessageAsTiles(), mnTextDrawNumberInWindow(), mnWindowClose(), mnWindowCreate(), mnWindowSpritePrepareForRedraw(), PerWork, PortraitCharacterMap, PortraitSpriteMap, Sint32 and sySynch().

Referenced by dbIncreaseItemAndLevelOpenPortraitBrowser() and dbShopTestOpenPortraitBrowser().

Definition at line 607 of file screens_debug.c.