Alchemy

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.

Line 32

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.

Line 143

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.

FieldDeclared as
padding000u8 padding000[8]halfwords 0 to 3, "EXEC" while the link holds
eu16 e
du16 d
vu16 v
su16 s
padding010u8 padding010[8]

Used by UpdateLinkSessionCountdown.

Line 14

Macros, without a comment: COUNTDOWN_START_FRAMES, FRAMES_PER_SECOND.

On this page