Skip to Content
The Alchemy Project

src/window/screens_battle_targets.c

Choosing a battle target. More…

Included by screens.c.

Macros

NameDescription
#defineTARGET_SET_DJINNI_WIDTH JAPANESE_OR(8, 9)Widths in tiles that fit each language's text: the "Set Djinni" window (MsgSetDjinni) and the list of conditions an action cures; and the Mystery names' copy, which Japanese decodes raw where the other languages copy it expanded.
#defineTARGET_CONDITION_LIST_WIDTH JAPANESE_OR(14, 16)
#defineTARGET_MYSTERY_NAME_COPY
#defineTARGET_MYSTERY_NAME_CAPACITY JAPANESE_OR(10, 14)
#defineTARGET_SET_DJINNI_WIDTH_ITALIAN 10These editions size the "Set Djinni" window by the cartridge's language as it runs: wider for Italian and Spanish.
#defineTARGET_SET_DJINNI_WIDTH_SPANISH 11
#defineTARGET_GAUGE_WIDTH 13The HP and PP window's width, and the one-line windows' of a revival or a cure of poison.
#defineTARGET_ONE_LINE_WIDTH 12
#defineTARGET_HELP_COLUMN (back, windowWidth)The help window's column, back tiles left of the aimed party member's; a window windowWidth tiles wide that would run past the screen's right edge stands against it instead.
#defineTARGET_CONDITION_LIST_WIDTH_SPANISH 17These editions widen it by a tile for Spanish as it runs.
#defineTARGET_CONDITION_LIST_WINDOW ()
#defineTARGET_NAME_WINDOW_ROW 12The enemy name window, the screen's width from row 12, and the pixels of its interior the name is kept within.
#defineTARGET_NAME_INTERIOR_WIDTH ((DISPLAY_TILE_WIDTH - 2) * 8)
#defineTARGET_VIEW_OFFSET_ENEMIES 16Where the battle view slides while a target is chosen (BATTLE_MENU_STATE.targetViewOffset): 16 pixels down when aiming at the enemies, 2 up when aiming at the party or the user.
#defineTARGET_VIEW_OFFSET_PARTY (-2)
#defineCURSOR_EASING (1 << 0)TARGET_TRACK.flags: easing halfway to its unit each tick, in the current spread, and one tick of staying put (bits 7 to 2 count those ticks).
#defineCURSOR_IN_SPREAD (1 << 1)
#defineCURSOR_HOLD_TICK (1 << 2)
#defineTARGET_REDRAW_SPREAD 1What the selection redraws: the spread's targets and their markers, and at the start every part.
#defineTARGET_REDRAW_ALL 0xFFFF
#defineTARGET_BOB (y)The cursors' bob, a sine turn every 16 ticks scaled down to 2 pixels: the sine divided by toFIXED(1) / 2, rounding toward zero.

Functions

NameDescription
Sint32mnBattleTargetRunSelection (Sint32 selection, Sint32 mode, Uint32 spread, Uint32 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.

Description

Choosing a battle target. Part of screens.c.

Macros in detail

TARGET_SET_DJINNI_WIDTH

#define TARGET_SET_DJINNI_WIDTH JAPANESE_OR(8, 9)

Widths in tiles that fit each language's text: the "Set Djinni" window (MsgSetDjinni) and the list of conditions an action cures; and the Mystery names' copy, which Japanese decodes raw where the other languages copy it expanded.

Referenced by mnBattleTargetRunSelection().

Definition at line 7 of file screens_battle_targets.c.

TARGET_CONDITION_LIST_WIDTH

#define TARGET_CONDITION_LIST_WIDTH JAPANESE_OR(14, 16)

Definition at line 8 of file screens_battle_targets.c.

TARGET_MYSTERY_NAME_COPY

#define TARGET_MYSTERY_NAME_COPY

Referenced by mnBattleTargetRunSelection().

Definition at line 9 of file screens_battle_targets.c.

TARGET_MYSTERY_NAME_CAPACITY

#define TARGET_MYSTERY_NAME_CAPACITY JAPANESE_OR(10, 14)

Referenced by mnBattleTargetRunSelection().

Definition at line 11 of file screens_battle_targets.c.

TARGET_SET_DJINNI_WIDTH_ITALIAN

#define TARGET_SET_DJINNI_WIDTH_ITALIAN 10

These editions size the "Set Djinni" window by the cartridge's language as it runs: wider for Italian and Spanish.

Referenced by mnBattleTargetRunSelection().

Definition at line 16 of file screens_battle_targets.c.

TARGET_SET_DJINNI_WIDTH_SPANISH

#define TARGET_SET_DJINNI_WIDTH_SPANISH 11

Referenced by mnBattleTargetRunSelection().

Definition at line 17 of file screens_battle_targets.c.

TARGET_GAUGE_WIDTH

#define TARGET_GAUGE_WIDTH 13

The HP and PP window's width, and the one-line windows' of a revival or a cure of poison.

Referenced by mnBattleTargetRunSelection().

Definition at line 22 of file screens_battle_targets.c.

TARGET_ONE_LINE_WIDTH

#define TARGET_ONE_LINE_WIDTH 12

Referenced by mnBattleTargetRunSelection().

Definition at line 23 of file screens_battle_targets.c.

TARGET_HELP_COLUMN

#define TARGET_HELP_COLUMN(back, windowWidth)

The help window's column, back tiles left of the aimed party member's; a window windowWidth tiles wide that would run past the screen's right edge stands against it instead.

Referenced by mnBattleTargetRunSelection().

Definition at line 28 of file screens_battle_targets.c.

TARGET_CONDITION_LIST_WIDTH_SPANISH

#define TARGET_CONDITION_LIST_WIDTH_SPANISH 17

These editions widen it by a tile for Spanish as it runs.

Definition at line 40 of file screens_battle_targets.c.

TARGET_CONDITION_LIST_WINDOW

#define TARGET_CONDITION_LIST_WINDOW()

Referenced by mnBattleTargetRunSelection().

Definition at lines 41 and 73 of file screens_battle_targets.c.

TARGET_NAME_WINDOW_ROW

#define TARGET_NAME_WINDOW_ROW 12

The enemy name window, the screen's width from row 12, and the pixels of its interior the name is kept within.

Referenced by mnBattleTargetRunSelection().

Definition at line 87 of file screens_battle_targets.c.

TARGET_NAME_INTERIOR_WIDTH

#define TARGET_NAME_INTERIOR_WIDTH ((DISPLAY_TILE_WIDTH - 2) * 8)

Referenced by mnBattleTargetRunSelection().

Definition at line 88 of file screens_battle_targets.c.

TARGET_VIEW_OFFSET_ENEMIES

#define TARGET_VIEW_OFFSET_ENEMIES 16

Where the battle view slides while a target is chosen (BATTLE_MENU_STATE.targetViewOffset): 16 pixels down when aiming at the enemies, 2 up when aiming at the party or the user.

Referenced by mnBattleTargetRunSelection().

Definition at line 93 of file screens_battle_targets.c.

TARGET_VIEW_OFFSET_PARTY

#define TARGET_VIEW_OFFSET_PARTY (-2)

Referenced by mnBattleTargetRunSelection().

Definition at line 94 of file screens_battle_targets.c.

CURSOR_EASING

#define CURSOR_EASING (1 << 0)

TARGET_TRACK.flags: easing halfway to its unit each tick, in the current spread, and one tick of staying put (bits 7 to 2 count those ticks).

Referenced by mnBattleTargetRunSelection().

Definition at line 98 of file screens_battle_targets.c.

CURSOR_IN_SPREAD

#define CURSOR_IN_SPREAD (1 << 1)

Referenced by mnBattleTargetRunSelection().

Definition at line 99 of file screens_battle_targets.c.

CURSOR_HOLD_TICK

#define CURSOR_HOLD_TICK (1 << 2)

Referenced by mnBattleTargetRunSelection().

Definition at line 100 of file screens_battle_targets.c.

TARGET_REDRAW_SPREAD

#define TARGET_REDRAW_SPREAD 1

What the selection redraws: the spread's targets and their markers, and at the start every part.

Referenced by mnBattleTargetRunSelection().

Definition at line 104 of file screens_battle_targets.c.

TARGET_REDRAW_ALL

#define TARGET_REDRAW_ALL 0xFFFF

Referenced by mnBattleTargetRunSelection().

Definition at line 105 of file screens_battle_targets.c.

TARGET_BOB

#define TARGET_BOB(y)

The cursors' bob, a sine turn every 16 ticks scaled down to 2 pixels: the sine divided by toFIXED(1) / 2, rounding toward zero.

Referenced by mnBattleTargetRunSelection().

Definition at line 109 of file screens_battle_targets.c.

Functions in detail

mnBattleTargetRunSelection

Sint32 mnBattleTargetRunSelection(Sint32 selection, Sint32 mode, Uint32 spread, Uint32 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: ABILITY_TARGET_ALLIES the party, ABILITY_TARGET_SELF 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 (BATTLE_TARGET_HINT) is mnBattleClassifyEntryKind's class, or TARGET_HINT_SET_DJINNI: on a party member it opens a window of what the action would do (its HP or PP, the statuses it cures, "Set Djinni"), and a reviving or curing action not aimed at everyone starts on the first party member who needs it, TARGET_HINT_LAST_TARGET on the party member last aimed at. Returns the target chosen, PLACE_PARTY | its party slot or PLACE_ENEMY | its enemy slot, or -1 when cancelled.

References btHighlightSetModesStub(), btMotionProjectCursorPointStub(), gmUnitGet(), MenuAnimatedCursorTiles, mnTextClearCanvas(), mnTextDrawMessageAsTiles(), mnTextDrawNumberInWindow(), mnTextDrawStringAtOffset(), mnTextDrawWideStringAtOffset(), mnTextGetWideStringWidth(), mnTextSetColor(), mnWindowClose(), mnWindowCreate(), OwnerStatusHpString, OwnerStatusKpString, OwnerStatusPpString, OwnerStatusPvString, OwnerStatusSlashString, PerWork, result, Sint32, syGameFlagGet(), syGetLanguage(), syOAMAddSpriteAtDepth(), syOAMMatrixAllocateFromTransform(), sySoundPlayStub(), sySynch(), syVRAMCacheAllocateEntry(), syVRAMCacheFreeEntry(), syVRAMCacheReload() and TickCount.

Referenced by mnBattleCollectPartyCommands().

Definition at line 130 of file screens_battle_targets.c.