Alchemy
Loading...
Searching...
No Matches

motion.c File Reference

The units' movements: returning, running, leaping and knocked back, and their positions on the screen. More...

Go to the source code of this file.

Macros

#define NO_MOVE_TARGET   0x80000000
 MotionObject.targetX and targetZ while the object has no move target.
#define CLASS_NO_KNOCKBACK   0x94
 A class that never moves when hit (148, one of the two that never show the stun icon and stand nearer the party).
#define HIT_FLASH_ANIM   0x11b

Functions

void ObjMotRst (s32 unitId)
 Sends unitId back to its spot, landing there, and turns it to face the centre.
void BattleMotion_SetupEscapeObject (s32 unitId)
 Sends unitId running off its side of the battlefield, three times as far out as its spot, with a hop, in pose 1.
void BattleMotion_InterpolatePosition (struct BattleObj *startSlot, struct BattleObj *endSlot, s32 progress)
 Sends the unit of startSlot leaping progress percent of the way toward the unit of endSlot, in pose 2.
void BattleMotion_SetObjectPosition (struct BattleObj *battleObject)
 Sends a unit's object back to its spot. Nothing in the source calls it.
void BattleMotion_ResetObjectAtScaledAnchor (s32 unitId)
 Sends unitId hopping out to one and a half times its spot's distance from the centre.
void BattleMotion_InitializeObject (s32 unitId)
 Sends unit id leaping back to 1.3 times its spot's distance from the centre, in pose 5.
void BattleMotion_ApplyVariantMotion (s32 unitId, s32 variant)
 Knocks unit id back, by the speed, hop and distance of motion variant (gBattleMotion_Variant*), and puts it in pose 5.
void BattleMotion_ApproachTarget (s32 actorId, s32 targetId, s32 travelDivisor, s32 initialVelocityY)
 Sends unit actorId three quarters of the way to unit targetId, arriving in travelDivisor steps, leaping up at initialVelocityY, in pose 2.
void BattleMotion_ResetSlotObjectMode2 (s32 unitId)
 Restarts unit id's motion in pose 2. Nothing in the source calls it.
void BattleMotion_ReservedNoOp83B0 ()
 Does nothing; BattleMotion_ApplyPairMidpoint, its only caller, passes it a position and a distance.
void BattleMotion_ApplyPairMidpoint (s32 firstId, s32 secondId)
 Works out the point halfway between two units, at their move targets where they have one, and hands it to BattleMotion_ReservedNoOp83B0, which does nothing.
void BattleMotion_SpawnSlotEffectAndWait (s32 unitId)
 Plays the hit flash on unit id's sprite and waits ten frames.
s32 BattleMotion_ProjectScaledPosition (s32 unitId, s32 *projected)
 Projects the point above unit id where its effects play (its class's height, BattleUnit_GetEffectHeight) onto the screen, into projected; the height is scaled by the sprite's projected scale.
s32 BattleMotion_ProjectConditionalPosition (s32 unitId, s32 *projected)
 Projects the point above unit id onto the screen, into projected: 24 pixels up for a small enemy, 48 for others, as drawn.
s32 BattleUnit_GetEffectHeight (s32 unitId)
 Returns the height above unit id where its effects play, 16.16: its class's own (BattleClass_GetEffectHeight), else 24 for a small enemy and 48 for others.

Detailed Description

The units' movements: returning, running, leaping and knocked back, and their positions on the screen.

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

Definition in file motion.c.

Macro Definition Documentation

◆ NO_MOVE_TARGET

#define NO_MOVE_TARGET   0x80000000

MotionObject.targetX and targetZ while the object has no move target.

Definition at line 9 of file motion.c.

Referenced by BattleMotion_ApplyPairMidpoint().

◆ CLASS_NO_KNOCKBACK

#define CLASS_NO_KNOCKBACK   0x94

A class that never moves when hit (148, one of the two that never show the stun icon and stand nearer the party).

Definition at line 154 of file motion.c.

Referenced by BattleMotion_ApplyVariantMotion().

◆ HIT_FLASH_ANIM

#define HIT_FLASH_ANIM   0x11b

Definition at line 282 of file motion.c.

Referenced by BattleMotion_SpawnSlotEffectAndWait().

Function Documentation

◆ ObjMotRst()

void ObjMotRst ( s32 unitId)

Sends unitId back to its spot, landing there, and turns it to face the centre.

Called after an action by the staging code, the auto battle, BattleTargetExec and the Quake effect.

Definition at line 17 of file motion.c.

Referenced by BattlePres_RunApproachAction(), BattlePres_RunAttack(), BattlePres_RunItem(), BattlePres_RunPlainAttack(), BattlePres_RunPsynergyCast(), BattlePres_RunUnitAction(), BattlePresentation_DispatchAction(), BattleTargetExec(), and ObjMotRst().

◆ BattleMotion_SetupEscapeObject()

void BattleMotion_SetupEscapeObject ( s32 unitId)

Sends unitId running off its side of the battlefield, three times as far out as its spot, with a hop, in pose 1.

Called by BattleEscape_PlayRun and BattlePres_RunEscape.

Definition at line 46 of file motion.c.

Referenced by BattleEscape_PlayRun(), BattleMotion_SetupEscapeObject(), and BattlePres_RunEscape().

◆ BattleMotion_InterpolatePosition()

void BattleMotion_InterpolatePosition ( struct BattleObj * startSlot,
struct BattleObj * endSlot,
s32 progress )

Sends the unit of startSlot leaping progress percent of the way toward the unit of endSlot, in pose 2.

Also clears REG_BLDCNT. Nothing in the source calls it.

Definition at line 67 of file motion.c.

Referenced by BattleMotion_InterpolatePosition().

◆ BattleMotion_SetObjectPosition()

void BattleMotion_SetObjectPosition ( struct BattleObj * battleObject)

Sends a unit's object back to its spot. Nothing in the source calls it.

Definition at line 96 of file motion.c.

Referenced by BattleMotion_SetObjectPosition().

◆ BattleMotion_ResetObjectAtScaledAnchor()

void BattleMotion_ResetObjectAtScaledAnchor ( s32 unitId)

Sends unitId hopping out to one and a half times its spot's distance from the centre.

Called by BattlePres_RunAttack and BattlePres_RunPlainAttack.

Definition at line 111 of file motion.c.

Referenced by BattleMotion_ResetObjectAtScaledAnchor(), BattlePres_RunAttack(), and BattlePres_RunPlainAttack().

◆ BattleMotion_InitializeObject()

void BattleMotion_InitializeObject ( s32 unitId)

Sends unit id leaping back to 1.3 times its spot's distance from the centre, in pose 5.

Only an unnamed overlay veneer in BATTLE.S reaches it, and nothing in the source calls that.

Definition at line 135 of file motion.c.

Referenced by BattleMotion_InitializeObject().

◆ BattleMotion_ApplyVariantMotion()

void BattleMotion_ApplyVariantMotion ( s32 unitId,
s32 variant )

Knocks unit id back, by the speed, hop and distance of motion variant (gBattleMotion_Variant*), and puts it in pose 5.

One class only takes the pose. Reached through its far stub from the effects, by the EFFECT_STRIKE_TARGET macro of effect_internal.h and directly.

Definition at line 160 of file motion.c.

Referenced by BattleMotion_ApplyVariantMotion().

◆ BattleMotion_ApproachTarget()

void BattleMotion_ApproachTarget ( s32 actorId,
s32 targetId,
s32 travelDivisor,
s32 initialVelocityY )

Sends unit actorId three quarters of the way to unit targetId, arriving in travelDivisor steps, leaping up at initialVelocityY, in pose 2.

Called by BattlePres_RunAttack, BattlePres_RunPlainAttack and BattlePres_RunApproachAction, and through its far stub by the Bind, burst scene, Annihilation, target motes and Thrash effects.

Definition at line 191 of file motion.c.

Referenced by BattleMotion_ApproachTarget(), BattlePres_RunApproachAction(), BattlePres_RunAttack(), and BattlePres_RunPlainAttack().

◆ BattleMotion_ResetSlotObjectMode2()

void BattleMotion_ResetSlotObjectMode2 ( s32 unitId)

Restarts unit id's motion in pose 2. Nothing in the source calls it.

Definition at line 229 of file motion.c.

Referenced by BattleMotion_ResetSlotObjectMode2().

◆ BattleMotion_ReservedNoOp83B0()

void BattleMotion_ReservedNoOp83B0 ( )

Does nothing; BattleMotion_ApplyPairMidpoint, its only caller, passes it a position and a distance.

Definition at line 239 of file motion.c.

Referenced by BattleMotion_ApplyPairMidpoint(), and BattleMotion_ReservedNoOp83B0().

◆ BattleMotion_ApplyPairMidpoint()

void BattleMotion_ApplyPairMidpoint ( s32 firstId,
s32 secondId )

Works out the point halfway between two units, at their move targets where they have one, and hands it to BattleMotion_ReservedNoOp83B0, which does nothing.

Nothing in the source calls it.

Definition at line 244 of file motion.c.

Referenced by BattleMotion_ApplyPairMidpoint().

◆ BattleMotion_SpawnSlotEffectAndWait()

void BattleMotion_SpawnSlotEffectAndWait ( s32 unitId)

Plays the hit flash on unit id's sprite and waits ten frames.

Only a single-sprite object takes it. Nothing in the source calls it.

Definition at line 286 of file motion.c.

Referenced by BattleMotion_SpawnSlotEffectAndWait().

◆ BattleMotion_ProjectScaledPosition()

s32 BattleMotion_ProjectScaledPosition ( s32 unitId,
s32 * projected )

Projects the point above unit id where its effects play (its class's height, BattleUnit_GetEffectHeight) onto the screen, into projected; the height is scaled by the sprite's projected scale.

Called by BattleFx_PlayUnitElementEffect, and through its far stub by EffectPosition_ProjectScaledBattler and SelectionScreen_Draw.

Definition at line 310 of file motion.c.

Referenced by BattleFx_PlayUnitElementEffect(), and BattleMotion_ProjectScaledPosition().

◆ BattleMotion_ProjectConditionalPosition()

s32 BattleMotion_ProjectConditionalPosition ( s32 unitId,
s32 * projected )

Projects the point above unit id onto the screen, into projected: 24 pixels up for a small enemy, 48 for others, as drawn.

Reached through its far stub from BattleTarget_RunSelection, to place the target cursor.

Definition at line 331 of file motion.c.

Referenced by BattleMotion_ProjectConditionalPosition().

◆ BattleUnit_GetEffectHeight()

s32 BattleUnit_GetEffectHeight ( s32 unitId)

Returns the height above unit id where its effects play, 16.16: its class's own (BattleClass_GetEffectHeight), else 24 for a small enemy and 48 for others.

Called by BattleMotion_ProjectScaledPosition, and through its far stub by the effects that play at a unit's body.

Definition at line 352 of file motion.c.

Referenced by BattleMotion_ProjectScaledPosition(), and BattleUnit_GetEffectHeight().