Skip to Content
The Alchemy Project

src/window/screens_debug.c

The debug menus (scenes, flags, icon browsers) and the Pause menu's choices. More…

Included by screens.c.

Macros

NameDescription
#defineDEBUG_SCENE_LAST 200The last scene the debug scene selector offers, the last of the game's 201, and its last entrance.
#defineDEBUG_ENTRANCE_LAST 99
#defineDEBUG_ENTRANCE_WRAPBUG: an entrance moved past either end by DEBUG_MENU_JUMP wraps by DEBUG_ENTRANCE_LAST rather than by the DEBUG_ENTRANCE_LAST + 1 entrances, so 95 + 10 gives 6.
#defineDEBUG_MENU_JUMP 10How far L and R move in the debug menus, where Left and Right move by one.
#defineDEBUG_FLAG_DIGIT_VALUES 16The flag editor shows a flag number's three hex digits as its page, row and column, so it has sixteen of each.
#defineICON_BROWSER_PAGES 8The icon browser's pages, each of ICON_BROWSER_PAGE_ICONS 16 by 16 icons in rows of ICON_BROWSER_COLUMNS.
#defineICON_BROWSER_PAGE_ICONS 32
#defineICON_BROWSER_COLUMNS 8
#defineDEBUG_SCENE_GO -1What the debug scene selector's keys return besides a scene.
#defineDEBUG_SCENE_CANCEL -2B: close without going
#defineDEBUG_GLYPH_NAMEThe message of the portrait browser's first label, which the German, French, Spanish and Italian editions point at other messages.

Enumerations

NameDescription
enumICON_BROWSER_MODE { ICON_BROWSER_ITEMS, ICON_BROWSER_PSYNERGY, ICON_BROWSER_STAT … }What the icon browser shows, which L and R change.

Functions

NameDescription
voidmnDebugSceneSelectSchedule (void)Unused: runs the debug scene and entrance selector as an event.
voidmnDebugSceneSelectDrawRow (WINDOW *window, Sint32 sceneId, const Sint16 *entrance)Draws the debug scene and entrance numbers with their scene code and area name.
Sint16mnDebugSceneSelectRun (void)
Sint32mnDebugSceneSelectHandleRowInput (WINDOW *window, Sint16 sceneId, Sint16 *entrance, Sint16 *selectedField)Edits the debug scene or entrance by one tick's keys, returning the scene, DEBUG_SCENE_GO or DEBUG_SCENE_CANCEL.
Sint32mnDebugFlagEditorRun (void)Shows a 16x16 flag grid per page and processes input until closed.
voidmnStringFormatHexDigits (Uint32 value, Uint32 count, Uint8 *out)Writes the lowest count digits of value, up to five, most significant first as uppercase hexadecimal in out, without a null terminator.
voidmnDebugFlagEditorDrawTable (WINDOW *window, Sint32 page)Draws one page of 256 flags as sixteen rows of hexadecimal labels and bits.
Sint32mnDebugFlagEditorHandleInput (WINDOW *window, Sint32 *page, Sint32 *cursor)Moves within the flag grid, changes pages, or toggles the selected flag.
voidmnReservedNoOperation (void)Unused: an empty function nothing calls.
voidmnDjinnSetFoundFlagAndAdd (Sint32 member, Sint32 element, Sint32 index)Marks the Djinni found (FLAG_DJINNI), then gives it to party member member.
Sint32mnPauseMenuRun (void)The Pause menu: Save your quest, Sleep or Change settings.
Sint32mnDebugBrowserIcons (void)Browses pages of item, Psynergy and status-pattern icons, suspending the field engine's actor system while the browser owns its window and cache entries.
Sint32mnDebugBrowserPortraits (void)Browses the character and sprite portrait maps as one circular list.

Description

The debug menus (scenes, flags, icon browsers) and the Pause menu's choices. Part of screens.c.

Macros in detail

DEBUG_SCENE_LAST

#define DEBUG_SCENE_LAST 200

The last scene the debug scene selector offers, the last of the game's 201, and its last entrance.

Referenced by mnDebugSceneSelectHandleRowInput().

Definition at line 6 of file screens_debug.c.

DEBUG_ENTRANCE_LAST

#define DEBUG_ENTRANCE_LAST 99

Referenced by mnDebugSceneSelectHandleRowInput().

Definition at line 7 of file screens_debug.c.

DEBUG_ENTRANCE_WRAP

#define DEBUG_ENTRANCE_WRAP

BUG: an entrance moved past either end by DEBUG_MENU_JUMP wraps by DEBUG_ENTRANCE_LAST rather than by the DEBUG_ENTRANCE_LAST + 1 entrances, so 95 + 10 gives 6.

Referenced by mnDebugSceneSelectHandleRowInput().

Definition at line 11 of file screens_debug.c.

DEBUG_MENU_JUMP

#define DEBUG_MENU_JUMP 10

How far L and R move in the debug menus, where Left and Right move by one.

Referenced by mnDebugBrowserPortraits(), mnDebugFlagEditorHandleInput() and mnDebugSceneSelectHandleRowInput().

Definition at line 16 of file screens_debug.c.

DEBUG_FLAG_DIGIT_VALUES

#define DEBUG_FLAG_DIGIT_VALUES 16

The flag editor shows a flag number's three hex digits as its page, row and column, so it has sixteen of each.

Referenced by mnDebugFlagEditorDrawTable() and mnDebugFlagEditorHandleInput().

Definition at line 19 of file screens_debug.c.

ICON_BROWSER_PAGES

#define ICON_BROWSER_PAGES 8

The icon browser's pages, each of ICON_BROWSER_PAGE_ICONS 16 by 16 icons in rows of ICON_BROWSER_COLUMNS.

Referenced by mnDebugBrowserIcons().

Definition at line 22 of file screens_debug.c.

ICON_BROWSER_PAGE_ICONS

#define ICON_BROWSER_PAGE_ICONS 32

Referenced by mnDebugBrowserIcons().

Definition at line 23 of file screens_debug.c.

ICON_BROWSER_COLUMNS

#define ICON_BROWSER_COLUMNS 8

Referenced by mnDebugBrowserIcons().

Definition at line 24 of file screens_debug.c.

DEBUG_SCENE_GO

#define DEBUG_SCENE_GO -1

What the debug scene selector's keys return besides a scene.

A: go to the scene and entrance shown

Referenced by mnDebugSceneSelectHandleRowInput() and mnDebugSceneSelectRun().

Definition at line 27 of file screens_debug.c.

DEBUG_SCENE_CANCEL

#define DEBUG_SCENE_CANCEL -2

B: close without going

Referenced by mnDebugSceneSelectHandleRowInput() and mnDebugSceneSelectRun().

Definition at line 28 of file screens_debug.c.

DEBUG_GLYPH_NAME

#define DEBUG_GLYPH_NAME

The message of the portrait browser's first label, which the German, French, Spanish and Italian editions point at other messages.

Referenced by mnDebugBrowserPortraits().

Definition at line 525 of file screens_debug.c.

Enumerations in detail

ICON_BROWSER_MODE

enum ICON_BROWSER_MODE

What the icon browser shows, which L and R change.

EnumeratorValueDescription
ICON_BROWSER_ITEMS
ICON_BROWSER_PSYNERGY
ICON_BROWSER_STATUS
ICON_BROWSER_MODES

Definition at line 31 of file screens_debug.c.

Functions in detail

mnDebugSceneSelectSchedule

void mnDebugSceneSelectSchedule(void)

Unused: runs the debug scene and entrance selector as an event.

References mnDebugSceneSelectRun() and sySetEvent().

Definition at line 40 of file screens_debug.c.

mnDebugSceneSelectDrawRow

void mnDebugSceneSelectDrawRow(WINDOW *window, Sint32 sceneId, const Sint16 *entrance)

Draws the debug scene and entrance numbers with their scene code and area name.

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

Referenced by mnDebugSceneSelectHandleRowInput() and mnDebugSceneSelectRun().

Definition at line 47 of file screens_debug.c.

mnDebugSceneSelectRun

Sint16 mnDebugSceneSelectRun(void)

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

Referenced by mnDebugSceneSelectSchedule().

Definition at line 69 of file screens_debug.c.

mnDebugSceneSelectHandleRowInput

Sint32 mnDebugSceneSelectHandleRowInput(WINDOW *window, Sint16 sceneId, Sint16 *entrance, Sint16 *selectedField)

Edits the debug scene or entrance by one tick's keys, returning the scene, DEBUG_SCENE_GO or DEBUG_SCENE_CANCEL. L and R move a scene by DEBUG_MENU_JUMP and set its entrance to 0; an entrance moved past either end wraps by DEBUG_ENTRANCE_WRAP.

References mnDebugSceneSelectDrawRow(), PerRepeat and Sint32.

Referenced by mnDebugSceneSelectRun().

Definition at line 122 of file screens_debug.c.

mnDebugFlagEditorRun

Sint32 mnDebugFlagEditorRun(void)

Shows a 16x16 flag grid per page and processes input until closed. Starts on page 8 and always returns 0.

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

Definition at line 210 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 as uppercase hexadecimal in out, without a null terminator.

References Sint32.

Referenced by mnDebugFlagEditorDrawTable().

Definition at line 244 of file screens_debug.c.

mnDebugFlagEditorDrawTable

void mnDebugFlagEditorDrawTable(WINDOW *window, Sint32 page)

Draws one page of 256 flags as sixteen rows of hexadecimal labels and bits.

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

Referenced by mnDebugFlagEditorRun().

Definition at line 267 of file screens_debug.c.

mnDebugFlagEditorHandleInput

Sint32 mnDebugFlagEditorHandleInput(WINDOW *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.

References gmFlagClearStub(), gmFlagGetStub(), gmFlagSetStub(), PerPush, PerRepeat and Sint32.

Referenced by mnDebugFlagEditorRun().

Definition at line 306 of file screens_debug.c.

mnReservedNoOperation

void mnReservedNoOperation(void)

Unused: an empty function nothing calls.

Definition at line 373 of file screens_debug.c.

mnDjinnSetFoundFlagAndAdd

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

Marks the Djinni found (FLAG_DJINNI), then gives it to party member member.

References gmDjinnGiveStub(), gmFlagSetStub() and Sint32.

Definition at line 378 of file screens_debug.c.

mnPauseMenuRun

Sint32 mnPauseMenuRun(void)

The Pause menu: Save your quest, Sleep or Change settings. A cancelled save or settings menu reopens the Pause menu; cancelling the Pause menu returns -1. Sleep shows its message and sets SleepRequested. Otherwise returns 0. The field engine reaches it by stub call (field/field_engine_run.c).

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

Definition at line 388 of file screens_debug.c.

mnDebugBrowserIcons

Sint32 mnDebugBrowserIcons(void)

Browses pages of item, Psynergy and status-pattern icons, suspending the field engine's actor system while the browser owns its window and cache entries.

References DebugMenuEnergyTitle, DebugMenuItemTitle, DebugMenuPageLabel, DebugMenuRangeDash, DebugMenuStatusTitle, mnIconBuildAbilityIconTiles(), mnIconBuildItemIconTiles(), mnIconBuildMiscellaneousIconTiles(), mnTextDrawNumberInWindow(), mnTextDrawStringInWindow(), mnWindowClose(), mnWindowCreate(), mnWindowSpriteCreate(), PerRepeat, Sint32, sySynch() and syVRAMCacheFindFreeEntry().

Referenced by dbIncreaseItemAndLevelOpenIconBrowser() and dbMenuTestOpenIconBrowser().

Definition at line 422 of file screens_debug.c.

mnDebugBrowserPortraits

Sint32 mnDebugBrowserPortraits(void)

Browses the character and sprite portrait maps as one circular list. Shows each entry's glyph and label, then releases both windows on A or B.

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

Referenced by dbIncreaseItemAndLevelOpenPortraitBrowser().

Definition at line 535 of file screens_debug.c.