Alchemy

targets.c

Choosing a battle target.

games/tbs/src/window/battle_command/targets.c on GitHub

Choosing a battle target. Part of battle_command.c, the menu object, compiled only through it.

Functions

BattleTarget_RunSelection

s32 BattleTarget_RunSelection(s32 selection, s32 mode, u32 spread, u32 kind)

Lets the player choose the target of an action of unit selection, with a cursor over the aimed unit and smaller markers on the others its range covers. mode is the action's targetMode: 2 the party, 4 only selection itself, anything else the enemies. spread is its range: 1 one unit, n the aimed one and n - 1 either side, ABILITY_RANGE_ALL every one (the cursor does not move); 0 counts as 1. kind is Battle_ClassifyEntryKind's class, or 7 for setting a Djinni: on a party member it opens a window of what the action would do (its HP or PP, the ailments it cures, "Set Djinni"), and a reviving or curing action (kinds 3 to 6) not aimed at everyone starts on the first member who needs it. On an enemy a window across the screen names it.

Returns 0x100 | the party place or 0x180 | the enemy place of the unit chosen with A, or -1 when cancelled or when the link battle's time runs out. While it runs, the battle scene slides (targetSceneOffset of BattleMenuWork: -2 for the party, 16 for the enemies) and the covered units are marked (BattlePres_SetActorModesFar). The Djinn tutorial presses A every 60 frames.

Used by Battle_CollectPartyCommands.

Line 45

Structures

CursorSlot

struct CursorSlot

A target marker's track: where it is, its state flags and the target it follows. Track 0 follows the aimed unit, track i the unit i places after it and track 6 - i the unit i places before.

FieldDeclared as
xu8 xscreen pixels
yu8 yscreen pixels
flagsu8 flagsbits: 7..2 frames to stay put (the byte drops by 4 a frame) | 1 in the current spread | 0 easing halfway to its unit each frame
indexs8 indexthe place it follows from the aimed one; 6 when unused

Used by BattleTarget_RunSelection.

Line 18

Macros, without a comment: TARGET_MYSTERY_NAME_COPY, TARGET_MYSTERY_NAME_CAPACITY, TARGET_MYSTERY_NAME_COPY, TARGET_MYSTERY_NAME_CAPACITY.

On this page