src/window/window_borders.c
Window zoom and borders, and opening and waiting on message windows. More…
Included by window.c.
Structures
| Name | Description | |
|---|---|---|
struct | WINDOW_ZOOM_SCRATCH | Scratch values for a stage of a window's zoom, as in The Broken Seal: the scaled part of a side, the scaled duration and their ratio. |
Macros
| Name | Description | |
|---|---|---|
#define | TILE_NUMBER_AND_FLIPS (TILE_NUMBER_MASK | TILE_HFLIP | TILE_VFLIP) | A tilemap entry's tile number and flip bits, below its palette. |
#define | FIELD_MESSAGE_TOP_ROWS 12 | The tile rows a field message is centred in, from the top of the screen. |
Functions
| Name | Description | |
|---|---|---|
void | mnWindowDrawZoomBorder (WINDOW *window, Sint32 savePos) | Draws a zooming window at its size for this tick: the window grows from its centre as zoomStage counts down to 0. |
void | mnWindowDrawOpened (WINDOW *window) | Draws a window at its full size: its border, and for a text canvas window the canvas, filled with colour 4 under a border when the window is bordered and transparent otherwise. |
void | mnWindowUpdateZooms (void) | Steps each window's open or close animation: an open window moves toward its geometry and is drawn when it arrives; a closing one is erased tick by tick and cleared when its duration is reached. |
Uint16 * | mnMemoryFillHalfwordsDMA (Uint16 *dest, Sint32 value, Sint32 count) | Fills count halfwords at dest with value and returns the position after the fill. |
void | mnWindowDrawBorder (Sint32 x, Sint32 y, Uint32 width, Uint32 height) | Draws an empty window: a border around a filled interior, at tile (x, y) of width by height tiles, and frees the text tiles the rectangle showed. |
void | mnWindowDrawFlashBorder (Sint32 x, Sint32 y, Uint32 width, Uint32 height) | mnWindowDrawBorder in the flash border's tiles (8 to 15), which mnWindowShowFlashFrame loads: the tick a window flashes with as it swells. |
void | mnWindowMapTextCanvasTiles ( Sint32 x, Sint32 y, Uint32 width, Uint32 height, Sint32 fullWidth) | Maps the text canvas tiles into the interior of a window at tile (x, y). |
Bool | mnMessageAllTyped (void) | Returns 1 once every message's window has its text typed out, or 0 while one is still typing (its state 0). |
Bool | mnWindowIsClosed (WINDOW *window) | Returns 1 when a window is fully closed (its slot free), and 0 while it is open or closing. |
void | mnTextResetStyle (void) | Resets the text style glyphs are drawn with: white, plain, and the default line and glyph spacing. |
void | mnWindowSystemUpdate (void) | The window system's per-tick event: windows, then messages, then sprite animation. |
void | mnWindowSystemUpdateBattle (void) | The window system's per-tick event in battle: windows, messages and sprite animation while the battle menu's state exists, otherwise messages alone. |
void | mnWindowSystemStartFieldUpdate (void) | Reserves the glyph sprites' tiles, resets the text style, starts the ring of decoded text from its beginning and starts the per-tick window update (mnWindowSystemUpdate). |
void | mnWindowSystemStartBattleUpdate (Sint32 loadGlyphTiles) | Resets the text style and starts the per-tick window update: the field's (mnWindowSystemUpdate) when loadGlyphTiles is set, which first reserves the glyph sprites' tiles, else the battle's (mnWindowSystemUpdateBattle). |
void | mnBattleMessageClose (void) | Closes the battle message window at once, if one is open, and forgets it, so the next battle message (mnBattleMessageOpen) opens a new one. |
Sint32 | mnMessageDecode (Sint32 msg, Sint32 clear) | Decodes message into the ring of decoded text (WIN_STATE.textBuf) after the text decoded last, and returns where it starts; message -1 returns the last decoded message's start again. |
void | mnBattleMessageOpen (Sint32 msg) | Decodes message and starts it in the message window along the bottom of the screen (tiles 0, 15, 30 by 6), creating the window first if it is not open; a message that decodes to nothing shows nothing. |
void | mnBattleMessageShowAndWait (Sint32 msg) | Shows a message in the battle message window and waits until it has been typed out. |
Sint32 | mnMessageOpenDecoded (Sint32 window, Sint32 msg) | Decodes message and starts it typing in window, which is already open; returns 0 when the message is empty or there is no window. |
void | mnMessageSetDecodeFlags (Uint32 flags) | Sets the decode flags the next message is decoded with (mnMessageDecode): MESSAGE_DECODE_HALTING_SPEECH makes it halting speech, a short pause before each character, broken off with an ellipsis after the first word; MESSAGE_DECODE_SPACING_AFTER puts a wide gap (ENTRY_WIDE_GAP) after certain characters in English and Japanese. |
WINDOW * | mnMessageOpenWindow (Sint32 msg, Sint32 x, Sint32 y, Uint32 packed) | Opens a window sized to a message near tile (x, y) and starts typing the message into it. packed holds the window options in its low bits (MESSAGE_WINDOW_OPTION) and the speaker's voice sound in bits 16 to 27 (MESSAGE_WINDOW_VOICE). |
void | mnFieldMessageShow (Sint32 msg, Sint32 flags) | Shows a message in a window centred on the screen, waits until it is typed out and closes it, as its flags say. |
Description
Window zoom and borders, and opening and waiting on message windows. Part of
window.c.
Macros in detail
TILE_NUMBER_AND_FLIPS
#define TILE_NUMBER_AND_FLIPS (TILE_NUMBER_MASK | TILE_HFLIP | TILE_VFLIP)
A tilemap entry's tile number and flip bits, below its palette.
Referenced by mnWindowMapTextCanvasTiles().
Definition at line 8 of file window_borders.c.
FIELD_MESSAGE_TOP_ROWS
#define FIELD_MESSAGE_TOP_ROWS 12
The tile rows a field message is centred in, from the top of the screen.
Referenced by mnFieldMessageShow().
Definition at line 515 of file window_borders.c.
Functions in detail
mnWindowDrawZoomBorder
void mnWindowDrawZoomBorder(WINDOW *window, Sint32 savePos)
Draws a zooming window at its size for this tick: the window grows from its centre as zoomStage counts down to 0. With savePos set (when closing) the drawn rectangle is remembered, for the next tick to erase.
References mnWindowDrawBorder(), Sint32 and syDivFX().
Referenced by mnWindowUpdateZooms().
Definition at lines 4 and 87 of file window_borders.c.
mnWindowUpdateZooms
void mnWindowUpdateZooms(void)
Steps each window's open or close animation: an open window moves toward its geometry and is drawn when it arrives; a closing one is erased tick by tick and cleared when its duration is reached.
References mnWindowDrawOpened(), mnWindowDrawZoomBorder(), mnWindowEraseBorderRect() and Sint32.
Referenced by mnWindowSystemUpdate() and mnWindowSystemUpdateBattle().
Definition at line 13 of file window_borders.c.
mnMemoryFillHalfwordsDMA
Uint16 *mnMemoryFillHalfwordsDMA(Uint16 *dest, Sint32 value, Sint32 count)
Fills count halfwords at dest with value and returns the position after the fill.
References Sint32.
Referenced by mnWindowDrawBorder() and mnWindowDrawFlashBorder().
Definition at line 137 of file window_borders.c.
mnWindowDrawBorder
void mnWindowDrawBorder(Sint32 x, Sint32 y, Uint32 width, Uint32 height)
Draws an empty window: a border around a filled interior, at tile (x, y) of width by height tiles, and frees the text tiles the rectangle showed.
References mnMemoryFillHalfwordsDMA(), mnWindowClearTextTilesInRect() and Sint32.
Referenced by mnMessageType(), mnPartyStatusDraw(), mnWindowDrawOpened(), mnWindowDrawZoomBorder(), mnWindowSpriteRedrawSavedRect() and mnWindowStepSwellEffect().
Definition at line 149 of file window_borders.c.
mnWindowDrawFlashBorder
void mnWindowDrawFlashBorder(Sint32 x, Sint32 y, Uint32 width, Uint32 height)
mnWindowDrawBorder in the flash border's tiles (8 to 15), which
mnWindowShowFlashFrame loads: the tick a window flashes with as it swells.
References mnMemoryFillHalfwordsDMA(), mnWindowClearTextTilesInRect() and Sint32.
Referenced by mnWindowShowFlashFrame().
Definition at line 194 of file window_borders.c.
mnWindowMapTextCanvasTiles
void mnWindowMapTextCanvasTiles( Sint32 x, Sint32 y, Uint32 width, Uint32 height, Sint32 fullWidth)
Maps the text canvas tiles into the interior of a window at tile (x, y). With fullWidth set the canvas covers the side border columns too.
References Sint32.
Referenced by mnBattleMessageOpen(), mnBattleStatusScreenRun() and mnWindowDrawOpened().
Definition at line 227 of file window_borders.c.
mnMessageAllTyped
Bool mnMessageAllTyped(void)
Returns 1 once every message's window has its text typed out, or 0 while one is still typing (its state 0).
References Sint32.
Referenced by dbPsynergyTestShowMessageAndWait(), dbShopTestBrowseMessageRange(), mnBattleCollectPartyCommands(), mnBattleMessageShowAndWait(), mnFieldMessageShow(), mnFieldMessageShowCentered(), mnMessageShowAndWait(), mnSaveEraseSelectedFile(), mnSaveToChosenFile(), mnSaveToFile(), scChampaShowTwoMessages(), scEpilogueShowLineAt() and scLemuriaEntranceShowLineWithPortrait().
Definition at line 271 of file window_borders.c.
mnWindowIsClosed
Bool mnWindowIsClosed(WINDOW *window)
Returns 1 when a window is fully closed (its slot free), and 0 while it is open or closing.
Referenced by mnFieldMessageShow() and mnFieldMessageShowCentered().
Definition at line 287 of file window_borders.c.
mnTextResetStyle
void mnTextResetStyle(void)
Resets the text style glyphs are drawn with: white, plain, and the default line and glyph spacing.
Referenced by mnTextDrawMessageToCanvas(), mnTextDrawWideStringAtOffset(), mnTextMeasureAllPages(), mnTextMeasureDecoded() and mnWindowCreate().
Definition at line 298 of file window_borders.c.
mnWindowSystemUpdate
void mnWindowSystemUpdate(void)
The window system's per-tick event: windows, then messages, then sprite animation.
References mnMessageUpdateAll(), mnWindowSpriteUpdateAll() and mnWindowUpdateZooms().
Referenced by mnWindowSystemStartBattleUpdate() and mnWindowSystemStartFieldUpdate().
Definition at lines 309 and 605 of file window_borders.c.
mnWindowSystemUpdateBattle
void mnWindowSystemUpdateBattle(void)
The window system's per-tick event in battle: windows, messages and sprite animation while the battle menu's state exists, otherwise messages alone.
References mnMessageUpdateAll(), mnWindowSpriteUpdateAll() and mnWindowUpdateZooms().
Referenced by mnWindowSystemStartBattleUpdate().
Definition at lines 310 and 614 of file window_borders.c.
mnWindowSystemStartFieldUpdate
void mnWindowSystemStartFieldUpdate(void)
Reserves the glyph sprites' tiles, resets the text style, starts the ring of
decoded text from its beginning and starts the per-tick window update
(mnWindowSystemUpdate).
References mnWindowSystemUpdate(), sySetEvent() and syVRAMCacheLoad().
Referenced by mnWindowSystemInitField().
Definition at line 315 of file window_borders.c.
mnWindowSystemStartBattleUpdate
void mnWindowSystemStartBattleUpdate(Sint32 loadGlyphTiles)
Resets the text style and starts the per-tick window update: the field's
(mnWindowSystemUpdate) when loadGlyphTiles is set, which first reserves the
glyph sprites' tiles, else the battle's (mnWindowSystemUpdateBattle).
References mnWindowSystemUpdate(), mnWindowSystemUpdateBattle(), Sint32, sySetEvent() and syVRAMCacheLoad().
Referenced by mnWindowSystemInitBattle().
Definition at line 332 of file window_borders.c.
mnBattleMessageClose
void mnBattleMessageClose(void)
Closes the battle message window at once, if one is open, and forgets it, so
the next battle message (mnBattleMessageOpen) opens a new one.
References mnWindowClose().
Definition at line 352 of file window_borders.c.
mnBattleMessageOpen
void mnBattleMessageOpen(Sint32 msg)
Decodes message and starts it in the message window along the bottom of the screen (tiles 0, 15, 30 by 6), creating the window first if it is not open; a message that decodes to nothing shows nothing.
References mnBattleMessageContinue(), mnMessageDecode(), mnWindowClose(), mnWindowCreate(), mnWindowMapTextCanvasTiles() and Sint32.
Referenced by mnBattleMessageShowAndWait().
Definition at line 368 of file window_borders.c.
mnBattleMessageShowAndWait
void mnBattleMessageShowAndWait(Sint32 msg)
Shows a message in the battle message window and waits until it has been typed out.
References mnBattleMessageOpen(), mnMessageAllTyped(), Sint32 and sySynch().
Definition at line 413 of file window_borders.c.
mnMessageOpenDecoded
Sint32 mnMessageOpenDecoded(Sint32 window, Sint32 msg)
Decodes message and starts it typing in window, which is already open; returns 0 when the message is empty or there is no window.
References mnMessageDecode(), mnMessageStart(), result and Sint32.
Definition at line 424 of file window_borders.c.
mnMessageSetDecodeFlags
void mnMessageSetDecodeFlags(Uint32 flags)
Sets the decode flags the next message is decoded with (mnMessageDecode):
MESSAGE_DECODE_HALTING_SPEECH makes it halting speech, a short pause before
each character, broken off with an ellipsis after the first word;
MESSAGE_DECODE_SPACING_AFTER puts a wide gap (ENTRY_WIDE_GAP) after certain
characters in English and Japanese. Flags already set stay set: only
mnMessageOpenWindow clears both, once it has started a message typing, so
they also apply to every message decoded before that.
Definition at line 453 of file window_borders.c.
mnMessageOpenWindow
WINDOW *mnMessageOpenWindow(Sint32 msg, Sint32 x, Sint32 y, Uint32 packed)
Opens a window sized to a message near tile (x, y) and starts typing the
message into it. packed holds the window options in its low bits
(MESSAGE_WINDOW_OPTION) and the speaker's voice sound in bits 16 to 27
(MESSAGE_WINDOW_VOICE).
References mnMessageDecode(), mnMessageStart(), mnWindowClose(), mnWindowCreate(), mnWindowFitOnScreen() and Sint32.
Referenced by dbPsynergyTestShowMessageAndWait(), dbShopTestBrowseMessageRange(), mnFieldMessageShow(), mnMessageShowAndWait(), mnSaveEraseSelectedFile(), scChampaShowTwoMessages(), scEpilogueShowLineAt(), scLemuriaEntranceShowLineWithPortrait() and scLinkLobbyEnterBattle().
Definition at line 470 of file window_borders.c.
mnFieldMessageShow
void mnFieldMessageShow(Sint32 msg, Sint32 flags)
Shows a message in a window centred on the screen, waits until it is typed out and closes it, as its flags say.
References fdActorGetScreenPosStub(), fdPartyGetLeaderActorStub(), mnMessageAllTyped(), mnMessageOpenWindow(), mnTextGetMessageSize(), mnWindowClose(), mnWindowIsClosed(), Sint32 and sySynch().
Referenced by dbShopTestDamageAndAfflictParty(), dbShopTestGiveEquipmentTestStock(), dbShopTestGivePartyDjinn(), mnMessageShowCentered(), mnPauseMenuRun(), mnSaveChooseAndLoadFile(), mnSaveCopyFile(), mnSaveEraseSelectedFile(), mnSaveToChosenFile(), mnSaveToFile(), mnSaveWriteFile(), mnSaveWriteLinkTallies(), mnSettingsMenuRun(), scAirsRockInsideCheckPsynergyStone(), scAirsRockInsideReadRevealTablet(), scAirsRockInsideWalkToRevealTablet(), scContigoBabyThinks(), scContigoExamineWall(), scContigoReadLuckyDicePairs(), scContigoReadLuckyDiceRules(), scContigoReadLuckyDiceSign(), scContigoReadLuckyWheelsPrizes(), scContigoReadLuckyWheelsRules(), scContigoReadLuckyWheelsSign(), scContigoReadSign(), scContigoReadSuperLuckyDiceRules(), scContigoReadSuperLuckyDiceSign(), scDailaRoomsGiveItem(), scDailaRoomsTakeSeaGodsTear(), scGaiaRockInsidePlaceDollOnCobwebAltar(), scGaiaRockInsidePlaceDollOnEastAltar(), scGaiaRockInsidePlaceDollOnWestAltar(), scGaiaRockInsideReadSandTablet(), scInit(), scIsletsTradeWithCow(), scKandoreanTempleReadPoisSign(), scKandoreanTempleTryTheLockedDoor(), scLemurianShipExamineLiftSwitch(), scLinkLobbySaveBattleResults(), scLinkLobbySaveMonsterBattleResults(), scLohoExamineCannon(), scLohoReadInnSign(), scMadraCatacombsHearEyesOfTruth(), scMadraCatacombsTryLockedDoor(), scMadraMeetKarst(), scMarsLighthouseEntranceCheckIce(), scShamanVillageReadTrialRoadSign(), scShamanVillageStopAtClosedEntrance(), scShowEntranceLocked(), scShrineOfTheSeaGodExamineStatue() and 6 more.
Definition at line 519 of file window_borders.c.