Alchemy
Loading...
Searching...
No Matches

options.c File Reference

Window colours, the option screen and the system menu. More...

Go to the source code of this file.

Data Structures

struct  MenuWorkspaceEntry
 One of the seven entries of the option screen's work from offset 0x400; only its state is known. More...

Macros

#define SLIDER_PALETTE   14
#define RESOURCE_SLOTS   96
#define WORKSPACE_ROWS   3
#define WORKSPACE_DEBUG_ROWS   3
#define WORKSPACE_ROW_HEIGHT   24
#define WORKSPACE_TEXT_X   48

Functions

UNUSED void GraphicsPalette_ReservedNoOpC9BC (void)
 Nothing calls them.
UNUSED void GraphicsPalette_ReservedNoOpC9C0 (void)
UNUSED void GraphicsPalette_ReservedNoOpC9C4 (void)
UNUSED void OptionMenu_ResetEntries (struct WorkspaceWork *work)
 Clears the option screen's seven entry states, its row, its tint and its cursor animation.
UNUSED void WindowColor_ComputeTint (struct WorkspaceWork *work)
 Works out the window tint (red, green and blue, 0 to 31) from the window colour settings: the hue picks a point on the colour wheel and the brightness shifts all three channels.
UNUSED void WindowColor_WritePalette (struct WorkspaceWork *work)
 Writes window colours 4 to 10 of BG palette 15, each a fixed scale of the window tint.
u16 WindowColor_ScaleTint (struct WorkspaceWork *work, s32 redScale, s32 greenScale, s32 blueScale)
 Returns the window tint with each channel scaled (16.16 fixed point) and clamped to 0 to 31, as a BGR555 colour.
u16 Color_ScaleComponents (s16 *rgb, s32 redScale, s32 greenScale, s32 blueScale)
 Returns rgb with each channel scaled (16.16 fixed point) and clamped to 0 to 31, as a BGR555 colour.
void PaletteGlow_Update (s32 phase, s32 brightness)
 Sets the window colours (BG palette 15, colours 4 to 10) for a window hue (0 to 23) and brightness (0 to 14, 7 neutral).
UNUSED void OptionMenu_PreviousRow (struct WorkspaceWork *work)
 Moves the three-row settings cursor up, wrapping to the bottom.
UNUSED void OptionMenu_NextRow (struct WorkspaceWork *work)
 Moves the three-row settings cursor down, wrapping to the top.
UNUSED void OptionMenu_LowerSetting (struct WorkspaceWork *work)
 Lowers the setting on the three-row cursor's row: message speed, window hue or window brightness.
UNUSED void OptionMenu_RaiseSetting (struct WorkspaceWork *work)
 Raises the setting on the three-row cursor's row: message speed, window hue or window brightness.
void GraphicsPalette_SelectionNoOp (void)
void OptionMenu_AnimateCursors (void)
 The option screen's per-frame callback: moves the cursor and the two slider markers, animates the marker of the slider in use, and pulses the chosen setting's icon.
void OptionMenu_InitializeWork (void)
 Allocates the option screen's work block, copies the settings into it with how many values each takes, and starts its per-frame callback.
void OptionMenu_Release (void)
 Stops the option screen's per-frame callback and frees its work block.
struct UiWindow * OptionMenu_Open (void)
 Opens the option screen's window: the labels, the hue and brightness sliders with their markers, the cursor and the setting icons.
s32 Menu_RunWorkspaceOptions (void)
 Runs the option screen (window colour and brightness, message speed, speech, auto-sleep) until A or START keeps the settings (returns 0) or B drops them (returns -1).
void SystemMenu_AnimateCursor (void)
 The system menu's per-frame callback: moves the cursor and pulses the chosen entry's icon.
void SystemMenu_Initialize (void)
 Allocates the system menu's work block and starts its per-frame callback.
void SystemMenu_Release (void)
 Stops the system menu's per-frame callback and frees its work block.
struct UiWindow * SystemMenu_Open (void)
 Opens the system menu's window with its entries (Save your quest, Sleep, Change settings, and the debug entries in debug mode; only Change settings while FLAG_IN_LINK_LOBBY is set), their icons and the cursor.
s32 Menu_RunWorkspaceSelectionLoop (void)
 Runs the system menu until the player picks an entry (its number, counting Save your quest as 0) or cancels with B or START (-1).

Detailed Description

Window colours, the option screen and the system menu.

Part of window.c, the window object, compiled only through it.

Definition in file options.c.

Macro Definition Documentation

◆ SLIDER_PALETTE

#define SLIDER_PALETTE   14

Definition at line 305 of file options.c.

Referenced by OptionMenu_Open().

◆ RESOURCE_SLOTS

#define RESOURCE_SLOTS   96

Definition at line 306 of file options.c.

Referenced by OptionMenu_Open(), and SystemMenu_Open().

◆ WORKSPACE_ROWS

#define WORKSPACE_ROWS   3

Definition at line 588 of file options.c.

Referenced by SystemMenu_Open().

◆ WORKSPACE_DEBUG_ROWS

#define WORKSPACE_DEBUG_ROWS   3

Definition at line 589 of file options.c.

Referenced by SystemMenu_Open().

◆ WORKSPACE_ROW_HEIGHT

#define WORKSPACE_ROW_HEIGHT   24

Definition at line 590 of file options.c.

Referenced by SystemMenu_Open().

◆ WORKSPACE_TEXT_X

#define WORKSPACE_TEXT_X   48

Definition at line 591 of file options.c.

Referenced by SystemMenu_Open().

Function Documentation

◆ GraphicsPalette_ReservedNoOpC9BC()

UNUSED void GraphicsPalette_ReservedNoOpC9BC ( void )

Nothing calls them.

Definition at line 8 of file options.c.

Referenced by GraphicsPalette_ReservedNoOpC9BC().

◆ GraphicsPalette_ReservedNoOpC9C0()

UNUSED void GraphicsPalette_ReservedNoOpC9C0 ( void )

Definition at line 9 of file options.c.

Referenced by GraphicsPalette_ReservedNoOpC9C0().

◆ GraphicsPalette_ReservedNoOpC9C4()

UNUSED void GraphicsPalette_ReservedNoOpC9C4 ( void )

Definition at line 10 of file options.c.

Referenced by GraphicsPalette_ReservedNoOpC9C4().

◆ OptionMenu_ResetEntries()

UNUSED void OptionMenu_ResetEntries ( struct WorkspaceWork * work)

Clears the option screen's seven entry states, its row, its tint and its cursor animation.

Nothing calls it.

Definition at line 23 of file options.c.

Referenced by OptionMenu_ResetEntries().

◆ WindowColor_ComputeTint()

UNUSED void WindowColor_ComputeTint ( struct WorkspaceWork * work)

Works out the window tint (red, green and blue, 0 to 31) from the window colour settings: the hue picks a point on the colour wheel and the brightness shifts all three channels.

The three wave samples are one third of the 96-step colour cycle apart. Nothing calls it.

Definition at line 53 of file options.c.

Referenced by WindowColor_ComputeTint().

◆ WindowColor_WritePalette()

UNUSED void WindowColor_WritePalette ( struct WorkspaceWork * work)

Writes window colours 4 to 10 of BG palette 15, each a fixed scale of the window tint.

Nothing calls it.

Definition at line 88 of file options.c.

Referenced by WindowColor_WritePalette().

◆ WindowColor_ScaleTint()

u16 WindowColor_ScaleTint ( struct WorkspaceWork * work,
s32 redScale,
s32 greenScale,
s32 blueScale )

Returns the window tint with each channel scaled (16.16 fixed point) and clamped to 0 to 31, as a BGR555 colour.

Definition at line 107 of file options.c.

Referenced by WindowColor_ScaleTint(), and WindowColor_WritePalette().

◆ Color_ScaleComponents()

u16 Color_ScaleComponents ( s16 * rgb,
s32 redScale,
s32 greenScale,
s32 blueScale )

Returns rgb with each channel scaled (16.16 fixed point) and clamped to 0 to 31, as a BGR555 colour.

rgb holds three components, not an already packed palette word.

Definition at line 134 of file options.c.

Referenced by Color_ScaleComponents(), and PaletteGlow_Update().

◆ PaletteGlow_Update()

void PaletteGlow_Update ( s32 phase,
s32 brightness )

Sets the window colours (BG palette 15, colours 4 to 10) for a window hue (0 to 23) and brightness (0 to 14, 7 neutral).

The live palette path leaves the saved colour settings untouched.

Definition at line 152 of file options.c.

Referenced by Menu_RunWorkspaceOptions(), PaletteGlow_Update(), SaveMenu_Run(), SaveMenu_SelectSlot(), Vale_Initialize(), and WorldMap_ShowEndingScene().

◆ OptionMenu_PreviousRow()

UNUSED void OptionMenu_PreviousRow ( struct WorkspaceWork * work)

Moves the three-row settings cursor up, wrapping to the bottom.

Nothing calls it.

Definition at line 182 of file options.c.

Referenced by OptionMenu_PreviousRow().

◆ OptionMenu_NextRow()

UNUSED void OptionMenu_NextRow ( struct WorkspaceWork * work)

Moves the three-row settings cursor down, wrapping to the top.

Nothing calls it.

Definition at line 191 of file options.c.

Referenced by OptionMenu_NextRow().

◆ OptionMenu_LowerSetting()

UNUSED void OptionMenu_LowerSetting ( struct WorkspaceWork * work)

Lowers the setting on the three-row cursor's row: message speed, window hue or window brightness.

Nothing calls it.

Definition at line 199 of file options.c.

Referenced by OptionMenu_LowerSetting().

◆ OptionMenu_RaiseSetting()

UNUSED void OptionMenu_RaiseSetting ( struct WorkspaceWork * work)

Raises the setting on the three-row cursor's row: message speed, window hue or window brightness.

Nothing calls it.

Definition at line 219 of file options.c.

Referenced by OptionMenu_RaiseSetting().

◆ GraphicsPalette_SelectionNoOp()

void GraphicsPalette_SelectionNoOp ( void )

Definition at line 236 of file options.c.

Referenced by GraphicsPalette_SelectionNoOp().

◆ OptionMenu_AnimateCursors()

void OptionMenu_AnimateCursors ( void )

The option screen's per-frame callback: moves the cursor and the two slider markers, animates the marker of the slider in use, and pulses the chosen setting's icon.

Definition at line 241 of file options.c.

Referenced by OptionMenu_AnimateCursors(), OptionMenu_InitializeWork(), and OptionMenu_Release().

◆ OptionMenu_InitializeWork()

void OptionMenu_InitializeWork ( void )

Allocates the option screen's work block, copies the settings into it with how many values each takes, and starts its per-frame callback.

The copy lets cancelling discard the edits.

Definition at line 280 of file options.c.

Referenced by Menu_RunWorkspaceOptions(), and OptionMenu_InitializeWork().

◆ OptionMenu_Release()

void OptionMenu_Release ( void )

Stops the option screen's per-frame callback and frees its work block.

The callback goes first, since it reads the work block.

Definition at line 300 of file options.c.

Referenced by Menu_RunWorkspaceOptions(), and OptionMenu_Release().

◆ OptionMenu_Open()

struct UiWindow * OptionMenu_Open ( void )

Opens the option screen's window: the labels, the hue and brightness sliders with their markers, the cursor and the setting icons.

Returns the window.

Definition at line 311 of file options.c.

Referenced by Menu_RunWorkspaceOptions(), and OptionMenu_Open().

◆ Menu_RunWorkspaceOptions()

s32 Menu_RunWorkspaceOptions ( void )

Runs the option screen (window colour and brightness, message speed, speech, auto-sleep) until A or START keeps the settings (returns 0) or B drops them (returns -1).

SELECT cycles through the colour presets. Preview edits affect the live palette; only confirmation saves the settings.

Definition at line 422 of file options.c.

Referenced by Menu_RunWorkspaceOptions(), and Menu_RunWorkspaceResultLoop().

◆ SystemMenu_AnimateCursor()

void SystemMenu_AnimateCursor ( void )

The system menu's per-frame callback: moves the cursor and pulses the chosen entry's icon.

Definition at line 595 of file options.c.

Referenced by SystemMenu_AnimateCursor(), SystemMenu_Initialize(), and SystemMenu_Release().

◆ SystemMenu_Initialize()

void SystemMenu_Initialize ( void )

Allocates the system menu's work block and starts its per-frame callback.

The system menu shares the option workspace slot and cannot run concurrently.

Definition at line 607 of file options.c.

Referenced by Menu_RunWorkspaceSelectionLoop(), and SystemMenu_Initialize().

◆ SystemMenu_Release()

void SystemMenu_Release ( void )

Stops the system menu's per-frame callback and frees its work block.

The callback goes first, since it reads the work block.

Definition at line 616 of file options.c.

Referenced by Menu_RunWorkspaceSelectionLoop(), and SystemMenu_Release().

◆ SystemMenu_Open()

struct UiWindow * SystemMenu_Open ( void )

Opens the system menu's window with its entries (Save your quest, Sleep, Change settings, and the debug entries in debug mode; only Change settings while FLAG_IN_LINK_LOBBY is set), their icons and the cursor.

Returns the window.

Definition at line 625 of file options.c.

Referenced by Menu_RunWorkspaceSelectionLoop(), and SystemMenu_Open().

◆ Menu_RunWorkspaceSelectionLoop()

s32 Menu_RunWorkspaceSelectionLoop ( void )

Runs the system menu until the player picks an entry (its number, counting Save your quest as 0) or cancels with B or START (-1).

The result counts in the full entry table even when only Change settings is shown.

Definition at line 700 of file options.c.

Referenced by Menu_RunWorkspaceResultLoop(), and Menu_RunWorkspaceSelectionLoop().