link_timer.c
The link battle timer and the no-escape check.
games/tbs/src/window/battle_command/link_timer.c on GitHub
The link battle timer and the no-escape check. Part of battle_command.c, the menu object, compiled only through it.
Functions
UpdateLinkSessionCountdown
void UpdateLinkSessionCountdown(void)
A scheduler callback while the party's commands are chosen (Battle_CollectPartyCommands): eases the battle scene a third of the way to BattleMenuWork.targetSceneOffset each frame (a pixel at least), draws the sprites of BattleMenuWork.icons that are shown (the chosen command's and ability's icons, the member's portrait) and slides the page arrows. In a link battle it also runs the timer: once the partner has chosen its commands, 15 seconds, shown in a window at the top left with a tone at each whole second; at 0 the menus end as if cancelled, or take their first command. A paused link sets the timer to 0 at once.
Used by Battle_CollectPartyCommands.
UiText_ShowLocalizedMessageAndWait
s32 UiText_ShowLocalizedMessageAndWait(void)
Tests whether the party may not run from this battle: battle starts 3 and 4 (the battles a scene starts, and link battles; see BATTLE_START_NO_ESCAPE in battle/battle/round.c) and a party once challenged (BattleWork.challengeFlag). When it may not, shows "This is no time to be running away!" until A or B is pressed or the link battle's time runs out, and returns 1; else returns 0. The Flee command asks it (Battle_CollectPartyCommands).
Used by Battle_CollectPartyCommands.
Structures
LinkSignature
struct LinkSignature
The partner console's link signature (gLinkPeerSignatures) as the timer reads it: halfwords 4 to 7 read "EDVS" once the partner has chosen its commands (Battle_CollectPartyCommands), which starts this side's countdown.
| Field | Declared as | |
|---|---|---|
padding000 | u8 padding000[8] | halfwords 0 to 3, "EXEC" while the link holds |
e | u16 e | |
d | u16 d | |
v | u16 v | |
s | u16 s | |
padding010 | u8 padding010[8] |
Used by UpdateLinkSessionCountdown.
Macros, without a comment: COUNTDOWN_START_FRAMES, FRAMES_PER_SECOND.