Skip to Content
The Alchemy Project

src/battle/battle_motion.c

The units' movements: returning to their spots, running and leaping, and their positions on the screen. More…

Included by battle.c.

Macros

NameDescription
#definefdActorStartIdleStub ((void (*)(MOTION_OBJECT *))fdActorStartIdleStub)
#definefdActorSetMoveTargetStub
#definefdActorSelectAnimationStubSwitches every sprite of an actor, one or a group of four, to an animation.
#defineEFFECT_HEIGHT_SMALL 24The pixels above a unit where its battle effects play when its class gives none: a small enemy's, and everyone else's.
#defineEFFECT_HEIGHT_LARGE 48

Functions

NameDescription
voidbtMotionReturnToSpot (Sint32 unitId)Sends unitId back to its spot, landing exactly there (snapToTarget), and turns it to face the centre at once.
voidbtMotionSetupEscapeObject (Sint32 unitId)Sends unitId running off its side of the battlefield, three times as far out as its spot, with a hop, in POSE_STANDING.
voidbtMotionLeapToward (ACTOR **startSlot, ACTOR **endSlot, Sint32 progress)Unused: sends one unit leaping progress percent of the way toward another, and turns off the colour effects.
voidbtMotionReturnObjectToSpot (BATTLE_OBJECT *slot)Unused: sends a unit back to its spot.
voidbtMotionHopBack (Sint32 unitId)Sends unitId hopping out to one and a half times its spot's distance from the centre.
voidbtMotionLeapBack (Sint32 unitId)Unused: sends unitId leaping back to 1.3 times its spot's distance from the centre, in POSE_DAMAGE.
voidbtMotionApplyKnockback (Sint32 id, Sint32 variant)Knocks a unit back as the knockback variant (BATTLE_KNOCKBACK) says, in its damage pose; the Fusion Dragon and the Doom Dragon's three forms only take the pose.
voidbtMotionApproachTarget (Sint32 actorId, Sint32 targetId, Sint32 travelTicks, Sint32 initVelocityY)Sends one unit leaping three quarters of the way to another, arriving in travelTicks ticks.
voidbtMotionRestartLeap (Sint32 id)Unused: restarts a unit's motion in POSE_LEAP.
voidbtMotionMidpointNoOperation (void *pos, Sint32 speed)Does nothing; btMotionApplyPairMidpoint, its only caller, passes it a position and a distance.
voidbtMotionApplyPairMidpoint (Sint32 firstId, Sint32 secondId)Unused: works out the point halfway between two units and hands it to a function that does nothing.
voidbtMotionPlayHitFlash (Sint32 unitId)Unused: plays the hit flash on a unit's sprite and waits ten ticks.
Sint32btMotionProjectScaledPos (Sint32 unitId, Sint32 *screen)Projects the point above a unit where its battle effects play (btUnitGetEffectHeight) onto the screen, into screen, scaled as its sprite is.
Sint32btMotionProjectCursorPoint (Sint32 unitId, Sint32 *screen)Projects the point above a unit onto the screen, into screen: the target cursor's place, EFFECT_HEIGHT_SMALL up for a small enemy and EFFECT_HEIGHT_LARGE for others, scaled as the sprite is.
FIXEDbtUnitGetEffectHeight (Sint32 unitId)Returns the height above a unit where its battle effects play, in 16.16 pixels: its class's own, else EFFECT_HEIGHT_SMALL for a small enemy and EFFECT_HEIGHT_LARGE for others.

Description

The units' movements: returning to their spots, running and leaping, and their positions on the screen. Part of battle.c.

Macros in detail

fdActorStartIdleStub

#define fdActorStartIdleStub ((void (*)(MOTION_OBJECT *))fdActorStartIdleStub)

Referenced by btEffectHopBackToSpot(), btEffectRunAstralBlast(), btEffectRunDeathPlunge(), btEffectRunLeapingStrike(), btEffectRunSerac(), btEffectSetApproachMotion(), btEffectStartActorMotion(), btEffectStartActorMotionOutward(), btEffectStartActorMotionRandomDistance(), btMotionApplyKnockback(), btMotionApproachTarget(), btMotionHopBack(), btMotionLeapBack(), btMotionRestartLeap(), btMotionReturnToSpot(), btMotionSetupEscapeObject(), fdActorCenterOnColumn(), fdActorClearDestinationAndStand(), fdActorMoveToAndWaitById(), fdActorResetTargetsAndVelocity(), fdActorRestore(), fdActorSetDestinationById(), fdActorSetDestinationOffsetById(), fdActorSetHorizontalPosAndAngleWithTerrain(), fdActorSetHorizontalPosWithTerrain(), fdActorSetPosWithTerrain(), fdActorStop(), fdActorWalkToAndWaitById(), fdActorWalkToById(), fdCameraMoveWithinMapBounds(), fdEngineRun(), fdPlaceTreasureSpots(), fdSummonTabletPlayRunes() and fdViewMoveStart().

Definition at line 4 of file battle_motion.c.

fdActorSetMoveTargetStub

#define fdActorSetMoveTargetStub

Referenced by btEffectHopBackToSpot(), btEffectRunAstralBlast(), btEffectRunDeathPlunge(), btEffectRunSerac(), btEffectSetApproachMotion(), btEffectStartActorMotion(), btEffectStartActorMotionOutward(), btEffectStartActorMotionRandomDistance(), btMotionApplyKnockback(), btMotionApproachTarget(), btMotionHopBack(), btMotionLeapBack(), btMotionLeapToward(), btMotionReturnObjectToSpot(), btMotionReturnToSpot(), btMotionSetupEscapeObject(), fdActorCenterOnColumn(), fdActorJumpDownLedge(), fdActorMoveToAndWaitById(), fdActorMoveTowardTarget(), fdActorSetDestinationById(), fdActorSetDestinationOffsetById(), fdActorSetTargetPosFromMagnitudeAngle(), fdActorWalkByById(), fdActorWalkToAndWaitById(), fdActorWalkToById(), fdCameraMoveWithinMapBounds(), fdClimbDown(), fdClimbUp(), fdEffectSpawnBurstParticleField(), fdEntranceEndArrivalAnimation(), fdItemDisplayRaiseAboveLeader(), fdLeaderPushObjectAhead(), fdLeaderStepOffRope(), fdLeaderStepOffTightrope(), fdLeaderStepOntoRope(), fdLeaderStepOntoTightrope(), fdPsynergyForce(), fdPsynergySteerLiftedTarget(), fdPsynergySteerPushedTarget() and fdPsynergyUpdateMindReadWave().

Definition at line 5 of file battle_motion.c.

fdActorSelectAnimationStub

#define fdActorSelectAnimationStub

Referenced by btActionRunBuild(), btAutoBattleApplyDamage(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btDjinnRecoveryCountDownSide(), btEffectHopBackToSpot(), btEffectRunAgingGas(), btEffectRunAstralBlast(), btEffectRunCastingImpact(), btEffectRunDeathPlunge(), btEffectRunFireDance(), btEffectRunFlashingStrike(), btEffectRunGaspFamily(), btEffectRunLeapingStrike(), btEffectRunMineBall(), btEffectRunOdyssey(), btEffectRunRagnarok(), btEffectRunRisingDragon(), btEffectRunSerac(), btEffectRunStoneJustice(), btEffectRunVolleyWithAction(), btEffectSetApproachMotion(), btEffectStartActorMotion(), btEffectStartActorMotionOutward(), btEffectStartActorMotionRandomDistance(), btMotionApplyKnockback(), btMotionApproachTarget(), btMotionCallBeast(), btMotionFlashHit(), btMotionLeapBack(), btMotionLeapToward(), btMotionRestartLeap(), btMotionSetupEscapeObject(), btObjectUpdatePose(), btPlaybackRun(), btProcessTurnEnd(), btStagingRunAttack(), btStagingRunFullScreen(), btStagingRunItem(), btStagingRunPsynergyCast(), btUnitProcessActionEnd(), fdActorAppearInWhirlwind(), fdActorCenterOnColumn(), fdActorClearDestinationAndStand(), fdActorDescendInWhirlwind(), fdActorFallOverById(), fdActorFallOverWithAnimationById(), fdActorInitSparkle(), fdActorJumpDownLedge(), fdActorLaunchFromLeader() and 89 more.

Definition at line 8 of file battle_motion.c.

EFFECT_HEIGHT_SMALL

#define EFFECT_HEIGHT_SMALL 24

The pixels above a unit where its battle effects play when its class gives none: a small enemy's, and everyone else's.

Referenced by btMotionProjectCursorPoint() and btUnitGetEffectHeight().

Definition at line 312 of file battle_motion.c.

EFFECT_HEIGHT_LARGE

#define EFFECT_HEIGHT_LARGE 48

Referenced by btMotionProjectCursorPoint() and btUnitGetEffectHeight().

Definition at line 313 of file battle_motion.c.

Functions in detail

btMotionReturnToSpot

void btMotionReturnToSpot(Sint32 unitId)

Sends unitId back to its spot, landing exactly there (snapToTarget), and turns it to face the centre at once.

References btObjectGet(), Sint32 and syAtan().

Referenced by btAbilityApplyToTarget(), btAutoBattleRunApproachAttack(), btAutoBattleRunAttackOrItem(), btMotionDismissBeast(), btPartyReturnAllToSpots(), btStagingRunAttack(), btStagingRunItem() and btStagingRunPsynergyCast().

Definition at line 13 of file battle_motion.c.

btMotionSetupEscapeObject

void btMotionSetupEscapeObject(Sint32 unitId)

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

References btObjectGet(), fdActorSelectAnimationStub() and Sint32.

Referenced by btFleePlayRun() and btStagingRunFlee().

Definition at line 36 of file battle_motion.c.

btMotionLeapToward

void btMotionLeapToward(ACTOR **startSlot, ACTOR **endSlot, Sint32 progress)

Unused: sends one unit leaping progress percent of the way toward another, and turns off the colour effects.

References fdActorSelectAnimationStub() and Sint32.

Definition at line 56 of file battle_motion.c.

btMotionReturnObjectToSpot

void btMotionReturnObjectToSpot(BATTLE_OBJECT *slot)

Unused: sends a unit back to its spot.

Definition at line 77 of file battle_motion.c.

btMotionHopBack

void btMotionHopBack(Sint32 unitId)

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

References btObjectGet() and Sint32.

Referenced by btStagingRunAttack().

Definition at line 91 of file battle_motion.c.

btMotionLeapBack

void btMotionLeapBack(Sint32 unitId)

Unused: sends unitId leaping back to 1.3 times its spot's distance from the centre, in POSE_DAMAGE.

References btObjectGet(), fdActorSelectAnimationStub() and Sint32.

Definition at line 110 of file battle_motion.c.

btMotionApplyKnockback

void btMotionApplyKnockback(Sint32 id, Sint32 variant)

Knocks a unit back as the knockback variant (BATTLE_KNOCKBACK) says, in its damage pose; the Fusion Dragon and the Doom Dragon's three forms only take the pose.

References BattleKnockbackAcceleration, BattleKnockbackDistancePercent, BattleKnockbackSpeedLimit, BattleKnockbackVelocityY, btObjectGet(), fdActorSelectAnimationStub(), gmUnitGet() and Sint32.

Definition at line 138 of file battle_motion.c.

btMotionApproachTarget

void btMotionApproachTarget(Sint32 actorId, Sint32 targetId, Sint32 travelTicks, Sint32 initVelocityY)

Sends one unit leaping three quarters of the way to another, arriving in travelTicks ticks.

References btObjectGet(), fdActorSelectAnimationStub(), Sint32 and sySquartIWRAM().

Referenced by btAutoBattleRunApproachAttack() and btStagingRunAttack().

Definition at line 171 of file battle_motion.c.

btMotionRestartLeap

void btMotionRestartLeap(Sint32 id)

Unused: restarts a unit's motion in POSE_LEAP.

References btObjectGet(), fdActorSelectAnimationStub() and Sint32.

Definition at line 218 of file battle_motion.c.

btMotionMidpointNoOperation

void btMotionMidpointNoOperation(void *pos, Sint32 speed)

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

References Sint32.

Referenced by btMotionApplyPairMidpoint().

Definition at line 233 of file battle_motion.c.

btMotionApplyPairMidpoint

void btMotionApplyPairMidpoint(Sint32 firstId, Sint32 secondId)

Unused: works out the point halfway between two units and hands it to a function that does nothing.

References btMotionMidpointNoOperation(), btObjectGet() and Sint32.

Definition at line 239 of file battle_motion.c.

btMotionPlayHitFlash

void btMotionPlayHitFlash(Sint32 unitId)

Unused: plays the hit flash on a unit's sprite and waits ten ticks. Only a single-sprite actor takes it.

References btObjectGet(), fdSpriteAddAnimationStub(), fdSpriteAnimationStartStub(), Sint32 and sySynch().

Definition at line 288 of file battle_motion.c.

btMotionProjectScaledPos

Sint32 btMotionProjectScaledPos(Sint32 unitId, Sint32 *screen)

Projects the point above a unit where its battle effects play (btUnitGetEffectHeight) onto the screen, into screen, scaled as its sprite is. Returns 0.

References btActorGetSprite(), btCameraApplyTransform(), btObjectGet(), btUnitGetEffectHeight(), Sint32 and syConvert3Dto2D().

Referenced by btElementGlowPlay().

Definition at line 318 of file battle_motion.c.

btMotionProjectCursorPoint

Sint32 btMotionProjectCursorPoint(Sint32 unitId, Sint32 *screen)

Projects the point above a unit onto the screen, into screen: the target cursor's place, EFFECT_HEIGHT_SMALL up for a small enemy and EFFECT_HEIGHT_LARGE for others, scaled as the sprite is. Returns 0.

References btActorGetSprite(), btCameraApplyTransform(), btObjectGet(), btSpriteIsSmall(), gmUnitGet(), Sint32 and syConvert3Dto2D().

Definition at line 336 of file battle_motion.c.

btUnitGetEffectHeight

FIXED btUnitGetEffectHeight(Sint32 unitId)

Returns the height above a unit where its battle effects play, in 16.16 pixels: its class's own, else EFFECT_HEIGHT_SMALL for a small enemy and EFFECT_HEIGHT_LARGE for others.

References btSpriteGetEffectHeight(), btSpriteIsSmall(), gmUnitGet() and Sint32.

Referenced by btMotionProjectScaledPos().

Definition at line 354 of file battle_motion.c.