9#define NO_MOVE_TARGET 0x80000000
24 object = battleObject->
object;
27 object->speedLimit = 0x80000;
28 object->verticalMotionStrength = 0xab85;
29 object->velocityY = stopped;
30 object->verticalMotionPhase = stopped;
31 object->autoFaceMotion = stopped;
32 object->snapToTarget = 1;
51 object = battleObject->
object;
53 object->speedLimit = 0x80000;
54 object->velocityY = 0x50000;
55 object->verticalMotionStrength = 0x7851;
56 object->verticalMotionPhase = 0;
57 object->autoFaceMotion = 0;
80 x = startX + progress * (end->
x - startX) / 100;
83 zStep = progress * (endZ - startZ) / 100;
100 object->speedLimit = 0x80000;
101 object->verticalMotionStrength = 0xab85;
102 object->verticalMotionPhase = 0;
103 object->autoFaceMotion = 0;
117 object = battleObject->
object;
119 object->speedLimit = 0x40000;
120 object->velocityY = 0x30000;
121 object->verticalMotionStrength = 0x9999;
122 object->verticalMotionPhase = 0;
123 object->autoFaceMotion = 0;
126 scaledX = battleObject->
anchorX * 3;
128 (
s32)(scaledX + (scaledX >> 0x1F)) >> 1, 0,
140 object->speedLimit = 128 << 11;
141 object->velocityY = 128 << 11;
142 object->verticalMotionStrength = 0x9999;
143 object->verticalMotionPhase = 0;
144 object->autoFaceMotion = 0;
154#define CLASS_NO_KNOCKBACK 0x94
167 object = battleObject->
object;
172 if (object->
y == 0 || variant > 4)
174 object->verticalMotionStrength = 0x9999;
175 object->verticalMotionPhase = 0;
176 object->autoFaceMotion = 0;
178 anchorX = battleObject->
anchorX;
192 s32 initialVelocityY) {
198 s32 dx = target->
x -
object->x;
199 s32 startX =
object->x;
200 s32 stepX = percent * dx / 100;
201 s32 dz = target->
z -
object->z;
202 s32 startZ =
object->z;
203 s32 stepZ = percent * dz / 100;
204 s32 x = startX + stepX;
205 s32 z = startZ + stepZ;
207 s32 cellX = stepX >> 8;
208 s32 cellZ = stepZ >> 8;
211 speed =
Iwram_Sqrt(cellX * cellX + cellZ * cellZ);
212 speed = (speed << 8) / travelDivisor;
213 object->acceleration = speed;
214 object->speedLimit = speed;
215 object->snapToTarget = 1;
219 object->velocityY = initialVelocityY;
220 object->velocityY = initialVelocityY;
221 object->verticalMotionStrength = 0xab85;
222 object->autoFaceMotion = 1;
256 second = secondSlot->
object;
275 pos.
x = (x1 + x2) / 2;
277 pos.
z = (z1 + z2) / 2;
282#define HIT_FLASH_ANIM 0x11b
292 if ((
object !=
NULL) &&
296 if (effectHandle != 0) {
324 projected[1] -= projectionScale;
344 projected[1] -= projectedHeight;
s32 BattleClass_IsSmall(s32 index)
Returns 1 for a small class, which takes one enemy sprite slot instead of two and stands closer to it...
s32 BattleClass_GetEffectHeight(s32 index)
Returns the height an effect is drawn at over a class, in pixels, or 0 for its size's default; 0 out ...
struct BattleObj * BattleObjGet(s32 unitId)
Returns unitId's battle object, through its place, or null for a unit with no place.
s32 Camera_ApplyTransformByFlag(void)
Sets up the camera's view for projecting points; under FLAG_CHOOSING_COMMANDS, through the extra tran...
void * GetMotionRecord(struct MotionObject *object, s32 recordIndex)
Returns sprite recordIndex of an object (0 only, for a single sprite), or null when it has no such sp...
s32 gBattleMotion_VariantSpeedLimit[]
s32 gBattleMotion_VariantVelocityY[]
s32 gBattleMotion_VariantAcceleration[]
s32 gBattleMotion_VariantDistancePercent[]
What every part of the battle object shares: its includes, in their original order,...
#define RECORDS_KIND_MASK
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
s32 ResourceMetadata_RegisterFar(struct AnimationObject *state, s32 id)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
void Animation_SetWorkEntryFar(struct AnimationEntry *work, s32 no)
void ObjectDispatch_StartIdleFar(struct DispatchObject *obj)
struct BattleUnit * UnitGetFar(u32 owner)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
static s32 Iwram_Sqrt(s32 value)
#define Iwram_MulQ16(left, right)
s32 ArcTan2(s32 x, s32 y)
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y,...
void BattleMotion_SpawnSlotEffectAndWait(s32 unitId)
Plays the hit flash on unit id's sprite and waits ten frames.
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,...
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,...
#define NO_MOVE_TARGET
MotionObject.targetX and targetZ while the object has no move target.
void BattleMotion_ApplyPairMidpoint(s32 firstId, s32 secondId)
Works out the point halfway between two units, at their move targets where they have one,...
void BattleMotion_SetObjectPosition(struct BattleObj *battleObject)
Sends a unit's object back to its spot. Nothing in the source calls it.
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,...
void BattleMotion_ResetObjectAtScaledAnchor(s32 unitId)
Sends unitId hopping out to one and a half times its spot's distance from the centre.
s32 BattleUnit_GetEffectHeight(s32 unitId)
Returns the height above unit id where its effects play, 16.16: its class's own (BattleClass_GetEffec...
void BattleMotion_InitializeObject(s32 unitId)
Sends unit id leaping back to 1.3 times its spot's distance from the centre, in pose 5.
s32 BattleMotion_ProjectScaledPosition(s32 unitId, s32 *projected)
Projects the point above unit id where its effects play (its class's height, BattleUnit_GetEffectHeig...
#define CLASS_NO_KNOCKBACK
A class that never moves when hit (148, one of the two that never show the stun icon and stand nearer...
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_ApplyVariantMotion(s32 unitId, s32 variant)
Knocks unit id back, by the speed, hop and distance of motion variant (gBattleMotion_Variant*),...
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,...
One animation layer of a sprite: its animation id, frames, running script and timer.
u8 priority
drawing order 0 to 3 among the layers; above 3 not drawn
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
s32 scale
16.16 fixed point, 0x10000 full size
A unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and s...
struct MotionObject * object
NULL once released.
s32 anchorZ
16.16 fixed-point pixels
s32 anchorX
16.16 fixed-point pixels
u8 classId
Who the unit is: a character's id (ISAAC to JENNA, below 8) or an enemy's id (BattleUnitSet).
A field object as the object dispatcher's far calls take it.
A point projected onto the screen, with its depth.
A position in three coordinates, each in 16.16 fixed point.
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
s32 verticalMotionPhase
With motionFlags bit 1, the 16.16 share of velocityY kept on a bounce; with bit 2,...
s32 speedLimit
16.16 fixed-point pixels per frame
s32 z
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
s32 velocityY
16.16 fixed-point pixels per frame
void * records
one sprite, or a table of up to four (recordStorageKind)
s32 targetZ
16.16 fixed-point pixels
u8 motionFlags
bits: 4 no terrain slowdown | 3 bigger float | 2 floats | 1 falls | 0 follows terrain
u8 recordStorageKind
bits: 3..0 RECORDS_NONE, RECORDS_SINGLE or RECORDS_TABLE
s32 acceleration
Horizontal speed gained each frame towards the target, or lost braking without one,...
s32 x
16.16 fixed-point pixels
s32 targetX
16.16 fixed-point pixels; 0x80000000 for no target
s32 verticalMotionStrength
Gravity: taken from velocityY each frame above the ground with motionFlags bit 1, in 16....
u8 autoFaceMotion
bit 0 turns the object to face where it moves
One of the 64 field objects in the object pool (heap slot 5): its script, position,...