Alchemy
Loading...
Searching...
No Matches

targets.c File Reference

The actor a field action aims at, and the helpers that follow it. More...

Go to the source code of this file.

Functions

s32 Field_GetPsynergyTargetRange (s32 kind)
 Returns how far, in pixels, a field Psynergy of the given kind reaches: gBattleFx_TargetRangeByMode pairs kinds with ranges, ended by -1, and a kind not listed reaches 16 pixels.
s32 Field_FindNearbyTalkTarget (s32 id)
 Returns the actor nearest to actor id that it could talk to, or -1: within 48 pixels of height and 32 pixels of distance and, beyond 11 pixels, within 0x2fff of the direction it faces.
s32 Field_FindNearbyPsynergyTarget (s32 id, s32 kind)
 Returns the actor nearest in front of actor id that a field Psynergy of the given kind can reach, or -1.
s32 BattleFx_PlayCueAndStartEmitterOnTarget (s32 actor, s32 target, s32 itemId)
 If actor target exists, plays SE_124, gives it animation 4 and, 12 frames later, shows itemId in front of actor with sparkles.
void Animation_ApplyChildPalette (struct MotionObject *object, s32 palette)
 Gives every part of a motion object's sprite (but those at palette 15) palette - 1, or for palette 0 the next palette of a cycle that changes every 2 frames.
void Battle_ResetEffectCounter (void)
 Clears the field's busy flag and, while Reveal is active, ends it: Reveal used with ACT_PACKED runs its ending events.

Detailed Description

The actor a field action aims at, and the helpers that follow it.

Part of object.c, the field object, compiled only through it.

Definition in file targets.c.

Function Documentation

◆ Field_GetPsynergyTargetRange()

s32 Field_GetPsynergyTargetRange ( s32 kind)

Returns how far, in pixels, a field Psynergy of the given kind reaches: gBattleFx_TargetRangeByMode pairs kinds with ranges, ended by -1, and a kind not listed reaches 16 pixels.

Called by Field_FindNearbyPsynergyTarget.

Definition at line 10 of file targets.c.

Referenced by Field_FindNearbyPsynergyTarget(), and Field_GetPsynergyTargetRange().

◆ Field_FindNearbyTalkTarget()

s32 Field_FindNearbyTalkTarget ( s32 id)

Returns the actor nearest to actor id that it could talk to, or -1: within 48 pixels of height and 32 pixels of distance and, beyond 11 pixels, within 0x2fff of the direction it faces.

Actors with collision flag 8 are skipped, and those with flag 4 count as 10/13 as far. Called with the leader by Field_RunScene for the A button, and by the item code (items.c) to find whom an item is used on.

Definition at line 33 of file targets.c.

Referenced by Field_FindItemEvent(), Field_FindNearbyTalkTarget(), Field_RunScene(), and Field_UseItem().

◆ Field_FindNearbyPsynergyTarget()

s32 Field_FindNearbyPsynergyTarget ( s32 id,
s32 kind )

Returns the actor nearest in front of actor id that a field Psynergy of the given kind can reach, or -1.

The direction is rounded to a quarter turn and the distance measured on the ground; kind sets the range, the height allowed and the width of the cone. Actors with collision flag 0x10 count as 2/3 as far. Called with the leader by Field_UsePsynergy, by the item code (items.c) and by the Psynergy dispatch (psynergy_effects/dispatch.c).

Definition at line 110 of file targets.c.

Referenced by BattleFx_FindMatchingEvent(), BattleFx_Run(), Field_FindNearbyPsynergyTarget(), and Field_UsePsynergy().

◆ BattleFx_PlayCueAndStartEmitterOnTarget()

s32 BattleFx_PlayCueAndStartEmitterOnTarget ( s32 actor,
s32 target,
s32 itemId )

If actor target exists, plays SE_124, gives it animation 4 and, 12 frames later, shows itemId in front of actor with sparkles.

Returns the picture's encoded actor pointer, or 0 when the target or picture is absent. Called by two scene overlays: McCoy's palace, when a reward chest opens, and Vault's interiors, when Ivan finds the Shaman's Rod.

Definition at line 207 of file targets.c.

Referenced by BattleFx_PlayCueAndStartEmitterOnTarget(), McCoyPalace_ClaimReward(), and VaultInteriors_ReturnStolenGoods().

◆ Animation_ApplyChildPalette()

void Animation_ApplyChildPalette ( struct MotionObject * object,
s32 palette )

Gives every part of a motion object's sprite (but those at palette 15) palette - 1, or for palette 0 the next palette of a cycle that changes every 2 frames.

Sets the sprite's dirty flag so it is drawn again. Called by Mind Read's wave effect (psynergy_effects/mind_read.c) on the caster: each frame with 0 to cycle its colours, and with 1 (palette 0) when it ends.

Definition at line 227 of file targets.c.

Referenced by Animation_ApplyChildPalette(), BattleFx_FinishSceneAndReleaseHeapBlock(), and FieldFx_UpdateMindReadWave().

◆ Battle_ResetEffectCounter()