src/window/window_settings_menu.c
Window colours, the settings menu and the Pause menu. More…
Included by window.c.
Structures
| Name | Description | |
|---|---|---|
struct | OPTION_MENU_ENTRY | One of the seven entries of the settings menu's state (SETTINGS_MENU_STATE.entries); only its state is known, and only the unused mnSettingsMenuResetEntries writes it. |
Macros
| Name | Description | |
|---|---|---|
#define | OPTION_SLIDER_WIDTH 60 | The pixels a settings slider's marker runs across, from OPTION_SLIDER_X. |
#define | WINDOW_SHADE (n) | The window colours the window colour settings set: WINDOW_PALETTE's colours from its background (shade 0, WINDOW_BACKGROUND_COLOR) to shade 6. |
#define | WINDOW_COLOR_SLIDER_PALETTE 14 | The sprite palettes of the sliders' ends, which SettingsMenuSliderPalette fills. |
#define | WINDOW_BRIGHTNESS_SLIDER_PALETTE (WINDOW_COLOR_SLIDER_PALETTE + 1) | |
#define | PAUSE_MENU_ROWS 3 | Save your quest, Sleep and Change settings |
#define | PAUSE_MENU_DEBUG_ROWS 3 | the entries added in debug mode |
#define | PAUSE_MENU_ROW_HEIGHT 24 | pixels, 3 tiles |
#define | PAUSE_MENU_TEXT_X 48 | pixels into the window, after the icons |
Enumerations
| Name | Description | |
|---|---|---|
enum | anonymous enum { MENU_TITLE_PAUSE, MENU_TITLE_SETTINGS } | The headings of MenuTitlePictures (graphics/ui/menu_titles.s) these menus show above their windows. |
enum | SETTINGS_MENU_ROW { SETTINGS_ROW_WINDOW_COLOR, SETTINGS_ROW_WINDOW_BRIGHTNESS, S … } | The settings menu's rows, in the order of their help messages (MsgOptionHelp on) and of SETTINGS_MENU_STATE.option. |
enum | OPTION_MENU_ROW { OPTION_ROW_MESSAGE_SPEED, OPTION_ROW_WINDOW_COLOR, OPTION_RO … } | The rows of an unused three-row settings menu (SETTINGS_MENU_STATE.page): message speed, window color and brightness. |
Functions
| Name | Description | |
|---|---|---|
void | mnSettingsMenuReservedNoOperationA (void) | Unused: three empty functions. |
void | mnSettingsMenuReservedNoOperationB (void) | |
void | mnSettingsMenuReservedNoOperationC (void) | |
void | mnSettingsMenuResetEntries (SETTINGS_MENU_STATE *state) | Clears the settings menu's seven entry states, its row, its tint and its cursor animation. |
void | mnWindowColorCalculateTint (SETTINGS_MENU_STATE *state) | Works out the window tint (red, green and blue, 0 to 31) from the window colour settings: the window color picks a point on the colour wheel and the brightness shifts all three channels. |
void | mnWindowColorWritePalette (SETTINGS_MENU_STATE *state) | Writes the window colours (shades 0 to 6 of WINDOW_SHADE), each a fixed scale of the window tint. |
Uint16 | mnWindowColorScaleTint (SETTINGS_MENU_STATE *state, FIXED redScale, FIXED greenScale, FIXED blueScale) | Returns the window tint with each channel scaled (16.16 fixed point) and clamped to 0 to 31, as a BGR555 colour. |
Uint16 | mnColorScaleComponents (Sint16 *rgb, FIXED redScale, FIXED greenScale, FIXED 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. |
void | mnWindowColorApply (Sint32 windowColor, Sint32 brightness) | Sets the window colours (WINDOW_SHADE) for a window color (0 to 23) and brightness (0 to 14, 7 neutral). |
void | mnSettingsMenuPreviousRow (SETTINGS_MENU_STATE *state) | Moves the three-row settings cursor up, wrapping to the bottom. |
void | mnSettingsMenuNextRow (SETTINGS_MENU_STATE *state) | Moves the three-row settings cursor down, wrapping to the top. |
void | mnSettingsMenuLowerSetting (SETTINGS_MENU_STATE *state) | Lowers the setting on the three-row cursor's row: message speed, window color or window brightness. |
void | mnSettingsMenuRaiseSetting (SETTINGS_MENU_STATE *state) | Raises the setting on the three-row cursor's row: message speed, window color or window brightness. |
void | mnSettingsMenuSelectionNoOperation (void) | An empty function, reached only through a bare entry of the window stub table. |
void | mnSettingsMenuAnimateCursors (void) | The settings menu's per-tick event: moves the cursor and the two slider markers, animates the marker of the slider in use, and pulses the chosen setting's icon. |
void | mnSettingsMenuInitState (void) | Allocates the settings menu's state block, copies the settings into it with how many values each takes, and starts its per-tick event. |
void | mnSettingsMenuRelease (void) | Stops the settings menu's per-tick event and frees its state block. |
WINDOW * | mnSettingsMenuOpen (void) | Opens the settings menu's window: the labels, the window color and brightness sliders with their markers, the cursor and the setting icons. |
Sint32 | mnSettingsMenuRun (void) | Runs the settings menu (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 | mnPauseMenuAnimateCursor (void) | The Pause menu's per-tick event: moves the cursor and pulses the chosen entry's icon. |
void | mnPauseMenuInit (void) | Allocates the Pause menu's state block and starts its per-tick event. |
void | mnPauseMenuRelease (void) | Stops the Pause menu's per-tick event and frees its state block. |
WINDOW * | mnPauseMenuOpen (void) | Opens the Pause 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_BATTLE_ARENA is set), their icons and the cursor. |
Sint32 | mnPauseMenuChoose (void) | Runs the Pause menu until the player picks an entry (PAUSE_MENU_ENTRY) or cancels with B or START (-1). |
Description
Window colours, the settings menu and the Pause menu. Part of window.c.
Macros in detail
OPTION_SLIDER_WIDTH
#define OPTION_SLIDER_WIDTH 60
The pixels a settings slider's marker runs across, from OPTION_SLIDER_X.
Referenced by mnSettingsMenuOpen() and mnSettingsMenuRun().
Definition at line 4 of file window_settings_menu.c.
WINDOW_SHADE
#define WINDOW_SHADE(n)
The window colours the window colour settings set: WINDOW_PALETTE's colours
from its background (shade 0, WINDOW_BACKGROUND_COLOR) to shade 6.
Referenced by mnWindowColorApply() and mnWindowColorWritePalette().
Definition at line 28 of file window_settings_menu.c.
WINDOW_COLOR_SLIDER_PALETTE
#define WINDOW_COLOR_SLIDER_PALETTE 14
The sprite palettes of the sliders' ends, which SettingsMenuSliderPalette
fills.
Referenced by mnSettingsMenuOpen().
Definition at line 399 of file window_settings_menu.c.
WINDOW_BRIGHTNESS_SLIDER_PALETTE
#define WINDOW_BRIGHTNESS_SLIDER_PALETTE (WINDOW_COLOR_SLIDER_PALETTE + 1)
Referenced by mnSettingsMenuOpen().
Definition at line 400 of file window_settings_menu.c.
PAUSE_MENU_ROWS
#define PAUSE_MENU_ROWS 3
Save your quest, Sleep and Change settings
Referenced by mnPauseMenuChoose() and mnPauseMenuOpen().
Definition at line 740 of file window_settings_menu.c.
PAUSE_MENU_DEBUG_ROWS
#define PAUSE_MENU_DEBUG_ROWS 3
the entries added in debug mode
Referenced by mnPauseMenuChoose() and mnPauseMenuOpen().
Definition at line 741 of file window_settings_menu.c.
PAUSE_MENU_ROW_HEIGHT
#define PAUSE_MENU_ROW_HEIGHT 24
pixels, 3 tiles
Referenced by mnPauseMenuOpen().
Definition at line 742 of file window_settings_menu.c.
PAUSE_MENU_TEXT_X
#define PAUSE_MENU_TEXT_X 48
pixels into the window, after the icons
Referenced by mnPauseMenuOpen().
Definition at line 743 of file window_settings_menu.c.
Enumerations in detail
anonymous enum
enum { MENU_TITLE_PAUSE, MENU_TITLE_SETTINGS }
The headings of MenuTitlePictures (graphics/ui/menu_titles.s) these menus
show above their windows.
| Enumerator | Value | Description |
|---|---|---|
MENU_TITLE_PAUSE | 6 | "Pause" |
MENU_TITLE_SETTINGS | 7 | "Settings" |
Definition at line 8 of file window_settings_menu.c.
SETTINGS_MENU_ROW
enum SETTINGS_MENU_ROW
The settings menu's rows, in the order of their help messages (MsgOptionHelp
on) and of SETTINGS_MENU_STATE.option.
| Enumerator | Value | Description |
|---|---|---|
SETTINGS_ROW_WINDOW_COLOR | 0 | "Window color" |
SETTINGS_ROW_WINDOW_BRIGHTNESS | 1 | |
SETTINGS_ROW_MESSAGE_SPEED | 2 | |
SETTINGS_ROW_SPEECH | 3 | "Turn voice sounds on or off." |
SETTINGS_ROW_AUTO_SLEEP | 4 | |
SETTINGS_ROW_COUNT | 5 |
Definition at line 16 of file window_settings_menu.c.
OPTION_MENU_ROW
enum OPTION_MENU_ROW
The rows of an unused three-row settings menu (SETTINGS_MENU_STATE.page):
message speed, window color and brightness. The four routines after it move
its cursor and change its settings; the five-row menu mnSettingsMenuRun runs
uses none of them.
| Enumerator | Value | Description |
|---|---|---|
OPTION_ROW_MESSAGE_SPEED | 0 | |
OPTION_ROW_WINDOW_COLOR | 1 | |
OPTION_ROW_WINDOW_BRIGHTNESS | 2 |
Definition at line 241 of file window_settings_menu.c.
Functions in detail
mnSettingsMenuReservedNoOperationA
void mnSettingsMenuReservedNoOperationA(void)
Unused: three empty functions.
Definition at line 32 of file window_settings_menu.c.
mnSettingsMenuReservedNoOperationB
void mnSettingsMenuReservedNoOperationB(void)
Definition at line 36 of file window_settings_menu.c.
mnSettingsMenuReservedNoOperationC
void mnSettingsMenuReservedNoOperationC(void)
Definition at line 40 of file window_settings_menu.c.
mnSettingsMenuResetEntries
void mnSettingsMenuResetEntries(SETTINGS_MENU_STATE *state)
Clears the settings menu's seven entry states, its row, its tint and its cursor animation.
References state.
Definition at line 57 of file window_settings_menu.c.
mnWindowColorCalculateTint
void mnWindowColorCalculateTint(SETTINGS_MENU_STATE *state)
Works out the window tint (red, green and blue, 0 to 31) from the window colour settings: the window color picks a point on the colour wheel and the brightness shifts all three channels.
References MainRoutineStateWork, Sint32, state and WindowColorWaveTable.
Definition at line 84 of file window_settings_menu.c.
mnWindowColorWritePalette
void mnWindowColorWritePalette(SETTINGS_MENU_STATE *state)
Writes the window colours (shades 0 to 6 of WINDOW_SHADE), each a fixed scale
of the window tint.
References mnWindowColorScaleTint() and state.
Definition at line 122 of file window_settings_menu.c.
mnWindowColorScaleTint
Uint16 mnWindowColorScaleTint(SETTINGS_MENU_STATE *state, FIXED redScale, FIXED greenScale, FIXED blueScale)
Returns the window tint with each channel scaled (16.16 fixed point) and clamped to 0 to 31, as a BGR555 colour.
References Sint32, state and syMulFX().
Referenced by mnWindowColorWritePalette().
Definition at line 142 of file window_settings_menu.c.
mnColorScaleComponents
Uint16 mnColorScaleComponents(Sint16 *rgb, FIXED redScale, FIXED greenScale, FIXED 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.
References Sint32 and syMulFX().
Referenced by mnWindowColorApply().
Definition at line 172 of file window_settings_menu.c.
mnWindowColorApply
void mnWindowColorApply(Sint32 windowColor, Sint32 brightness)
Sets the window colours (WINDOW_SHADE) for a window color (0 to 23) and
brightness (0 to 14, 7 neutral).
References mnColorScaleComponents(), Sint32 and WindowColorWaveTable.
Referenced by mnFileListSelectFile(), mnSettingsMenuRun(), scInit() and scWorldMapShowEndingScript().
Definition at line 192 of file window_settings_menu.c.
mnSettingsMenuPreviousRow
void mnSettingsMenuPreviousRow(SETTINGS_MENU_STATE *state)
Moves the three-row settings cursor up, wrapping to the bottom.
References state.
Definition at line 249 of file window_settings_menu.c.
mnSettingsMenuNextRow
void mnSettingsMenuNextRow(SETTINGS_MENU_STATE *state)
Moves the three-row settings cursor down, wrapping to the top.
References state.
Definition at line 258 of file window_settings_menu.c.
mnSettingsMenuLowerSetting
void mnSettingsMenuLowerSetting(SETTINGS_MENU_STATE *state)
Lowers the setting on the three-row cursor's row: message speed, window color or window brightness.
References MainRoutineStateWork and state.
Definition at line 266 of file window_settings_menu.c.
mnSettingsMenuRaiseSetting
void mnSettingsMenuRaiseSetting(SETTINGS_MENU_STATE *state)
Raises the setting on the three-row cursor's row: message speed, window color or window brightness.
References MainRoutineStateWork and state.
Definition at line 287 of file window_settings_menu.c.
mnSettingsMenuSelectionNoOperation
void mnSettingsMenuSelectionNoOperation(void)
An empty function, reached only through a bare entry of the window stub table.
Definition at line 309 of file window_settings_menu.c.
mnSettingsMenuAnimateCursors
void mnSettingsMenuAnimateCursors(void)
The settings menu's per-tick event: moves the cursor and the two slider markers, animates the marker of the slider in use, and pulses the chosen setting's icon.
References mnCursorAdvanceStub(), mnCursorMoveTowardTargetStub(), mnWindowSpritePulse(), Sint32, state, syResourceGetTableEntry() and syVRAMCacheLoad().
Referenced by mnSettingsMenuInitState() and mnSettingsMenuRelease().
Definition at line 316 of file window_settings_menu.c.
mnSettingsMenuInitState
void mnSettingsMenuInitState(void)
Allocates the settings menu's state block, copies the settings into it with how many values each takes, and starts its per-tick event.
References MainRoutineStateWork, mnSettingsMenuAnimateCursors(), state, syHeapSlotAllocateEWRAM() and sySetEvent().
Referenced by mnSettingsMenuRun().
Definition at line 366 of file window_settings_menu.c.
mnSettingsMenuRelease
void mnSettingsMenuRelease(void)
Stops the settings menu's per-tick event and frees its state block. The event goes first, since it reads the state block.
References mnSettingsMenuAnimateCursors(), syCloseEvent() and syHeapSlotRelease().
Referenced by mnSettingsMenuRun().
Definition at line 391 of file window_settings_menu.c.
mnSettingsMenuOpen
WINDOW *mnSettingsMenuOpen(void)
Opens the settings menu's window: the labels, the window color and brightness sliders with their markers, the cursor and the setting icons. Returns the window.
References mnCommandIconCreate(), mnCursorSetPosImmediateStub(), mnTextDrawMessageAsTiles(), mnWindowCreate(), mnWindowDrawDividerLine(), mnWindowSpriteCreate(), PointingHandTiles, SettingsMenuSleepIcons, SettingsMenuSliderPalette, SettingsMenuSliderTiles, SettingsMenuSpeechIcons, SettingsMenuSpeedIcons, Sint32, state, syDMAXCopy(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnSettingsMenuRun().
Definition at line 405 of file window_settings_menu.c.
mnSettingsMenuRun
Sint32 mnSettingsMenuRun(void)
Runs the settings menu (window colour and brightness, message speed, speech, auto-sleep) until A or START keeps the settings (returns 0) or B drops them (returns -1).
References IdleSleepEnabled, MainRoutineStateWork, mnCommandIconLoad(), mnCursorSetStub(), mnIconShowStub(), mnSettingsMenuInitState(), mnSettingsMenuOpen(), mnSettingsMenuRelease(), mnTextDrawMessage(), mnTextDrawMessageAsTiles(), mnTitleBob(), mnTitleCreate(), mnWindowClearInteriorTiles(), mnWindowClose(), mnWindowColorApply(), mnWindowCreate(), mnWindowSpriteClearList(), PerPush, PerRepeat, SettingsMenuBrightnessPresets, SettingsMenuHuePresets, SettingsMenuSleepIcons, SettingsMenuSpeechIcons, SettingsMenuSpeedIcons, Sint32, SleepDisabled, state, sySoundPlayStub() and sySynch().
Referenced by mnPauseMenuRun().
Definition at line 538 of file window_settings_menu.c.
mnPauseMenuAnimateCursor
void mnPauseMenuAnimateCursor(void)
The Pause menu's per-tick event: moves the cursor and pulses the chosen entry's icon.
References mnCursorAdvanceStub(), mnWindowSpritePulse() and state.
Referenced by mnPauseMenuInit() and mnPauseMenuRelease().
Definition at line 747 of file window_settings_menu.c.
mnPauseMenuInit
void mnPauseMenuInit(void)
Allocates the Pause menu's state block and starts its per-tick event.
References mnPauseMenuAnimateCursor(), state, syHeapSlotAllocateEWRAM() and sySetEvent().
Referenced by mnPauseMenuChoose().
Definition at line 758 of file window_settings_menu.c.
mnPauseMenuRelease
void mnPauseMenuRelease(void)
Stops the Pause menu's per-tick event and frees its state block. The event goes first, since it reads the state block.
References mnPauseMenuAnimateCursor(), syCloseEvent() and syHeapSlotRelease().
Referenced by mnPauseMenuChoose().
Definition at line 769 of file window_settings_menu.c.
mnPauseMenuOpen
WINDOW *mnPauseMenuOpen(void)
Opens the Pause 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_BATTLE_ARENA is set), their icons and the cursor.
References DebugMode, gmFlagGetStub(), mnCommandIconCreate(), mnCursorSetPosImmediateStub(), mnTextDrawMessage(), mnWindowCreate(), mnWindowDrawDividerLine(), mnWindowSpriteCreate(), PauseMenuIcons, PointingHandTiles, Sint32, state, syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnPauseMenuChoose().
Definition at line 778 of file window_settings_menu.c.
mnPauseMenuChoose
Sint32 mnPauseMenuChoose(void)
Runs the Pause menu until the player picks an entry (PAUSE_MENU_ENTRY) or
cancels with B or START (-1).
References DebugMode, gmFlagGetStub(), mnCommandIconLoad(), mnCursorSetStub(), mnIconShowStub(), mnPauseMenuInit(), mnPauseMenuOpen(), mnPauseMenuRelease(), mnTitleBob(), mnTitleCreate(), mnWindowClose(), PauseMenuIcons, PerPush, PerRepeat, Sint32, state, sySoundPlayStub() and sySynch().
Referenced by mnPauseMenuRun().
Definition at line 859 of file window_settings_menu.c.