30 if (dx != 0 || dz != 0) {
51 0x11d, position.
x, position.
y, position.
z);
52 BattleFx_InitializeFallingFragment(fragment);
55#define MOVE_CELL_MASK 0xfff00000
86 angle = work->
angle + 0x8000;
102 candidate = &position;
107 candidate->
y, candidate->
z);
109 pusher->
speed = 4 << 16;
113 target->
speed = 0x6666;
125 if (direction == 0xffff) {
127 position.
y = target->
y.
fixed + (16 << 16);
131 position.
y, position.
z);
140 position.
y = target->
y.
fixed + (16 << 16);
145 position.
y, position.
z);
206 target->speed = 0x3333;
209 position.
y, position.
z);
210 pusher->motionFlags = 0;
211 pusher->speed = 0x3333;
215 position.
y + (16 << 16), position.
z);
218 user->
speed = 0x3333;
336 215, source->
x, source->
y + (16 << 16), source->
z);
351 for (fragmentIndex = 7; fragmentIndex >= 0; fragmentIndex--) {
353 285, source->
x, source->
y + (16 << 16), source->
z);
358 child->acceleration = 1 << 16;
359 child->speedLimit = speed;
360 child->motionFlags = 2;
361 child->verticalMotionStrength = 0x51e;
363 child->velocityY = spread -
Random16();
364 radius =
Random16() * 24 + (8 << 16);
383 if (scale <= 0xffff) {
385 next = scale + 0x1000;
387 }
while (next <= 0xffff);
405 for (i = 30; i >= 0; i--) {
407 src->
angle += 0x2000;
412 for (i = 7; i >= 0; i--) {
424 child->acceleration = unit;
425 child->speedLimit = speed + unit;
426 child->motionFlags = 2;
427 child->verticalMotionStrength = 0xa3d;
429 child->velocityY = spread -
Random16();
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
u32 EffectSlot_HasPendingTarget(struct EffectSlot *effect)
Returns nonzero while an effect slot that stops at its target still has one (it has not arrived),...
void BattleFx_ClearOwnedSlot(struct EffectSlot *slot)
Frees an effect slot and its sprite.
struct ScriptObjectEntry * ScriptObject_FindOverlappingEntryFar(struct ScriptObjectEntry *object, s32 *values)
void ObjectDispatch_ReleaseFar(struct DispatchObject *obj)
s32 Map_GetCellAttributeLowNibbleFar(s32 index, s32 x, s32 y)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void ObjectDispatch_InitializeFar(struct DispatchObject *obj, const s32 *script)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
void Animation_ApplyChildValuesFar(struct DispatchObject *obj, u32 val)
s32 Map_CheckObjectStepFar(struct ObjectRuntime *object, struct FieldPosition *position)
void FieldObject_WaitForMoveFar(void *fieldObject)
void AudioCommand_PlayFar(s32 id)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
volatile u32 gFrameCount
Frames WaitFrames has finished.
const u8 gBattleFx_QuadrantModes[4]
const s32 gBattleFx_FragmentScript[]
const s32 gBattleFx_SourceHoldScript[]
const u16 gBattleFx_CyclePatternWords[16]
An angle for each value of the right, left, up and down bits of the +Control Pad; 0xffff for none.
void * gEffectWork
Slot 56: points to a scene-specific structure.
volatile u32 gKeysHeld
Keys down now.
volatile u32 gKeysPressed
Keys that went down this frame.
#define SET_VELOCITY(p, vx, vy, vz)
#define SET_POSITION(p, px, py, pz)
Sets the position or the velocity of a particle, a piece of debris or an object in one statement.
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
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 BattleFx_UpdateItemBreakFragment(union FieldObject *fieldObject)
Per-frame update of a broken item's main fragment: turns it toward the object it is linked to,...
#define MOVE_CELL_MASK
a 16-pixel tile
s32 Input_GetDpadAngle(u32 unused)
Returns the direction of the d-pad (0x10000 a full turn): right 0, down 0x4000, left 0x8000,...
void * BattleFx_StartItemBreak(void *object)
Spawns the broken item (object 215) 16 pixels above object and moves it 16 pixels the way object face...
void UpdateRisingParticleBurst(void *object)
Per-frame update: the object spins as it rises for 31 frames, shrinks, and bursts into 8 particles.
void BattleFx_UpdateOrbitAndReturn(struct EffectSlot *slot)
Effect slot callback of a particle that flies 30 pixels out from where it started,...
void BattleFx_SnapScaleToFull(struct MotionObject *obj)
Per-frame update: grows an object's scale by 1/16 a frame up to full size and fixes its position.
void BattleFx_SteerPushedTarget(s32 targetId)
Puts the pushing hand beside the target and pushes the target 16 pixels the way the d-pad points,...
void FieldFx_RunMove(void)
Shows the broken item beside the caster for 30 frames, then turns it into particles.
void Motion_SetTargetPositionFromMagnitudeAngle(struct ObjectRuntime *object, s32 magnitude, s32 angle)
Sends an object toward the point magnitude (16.16 pixels) away from it in direction angle: sets its m...
struct ObjectRuntime * Object_Spawn(s32 kind, s32 x, s32 y, s32 z)
Creates an object for an effect, at the caster's ground height, with sprite priority 0 and animation ...
void ObjectGroup_ApplyRandomChildValues(union FieldObject *fieldObject)
Per-frame update: sets every part of an object's sprite to param frame % 6, which cycles its colours.
void BattleEffect_InitializeSharedScene(void)
Saves the palettes for the effect (once, unless an effect is already shown) and fades them toward one...
void BattleFx_PrepareBufferInterpolation(void)
Fades the palettes back from an effect's colours to the saved ones (or to palette 0x10001 while an ef...
void EffectRuntime_StopCurrentObject(void)
Stops the caster's per-frame hook and restores its colours.
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
void * mainObject
the caster's object
void * child
the target's object, or NULL
A field object as the object dispatcher's far calls take it.
A particle a Psynergy effect moves and draws: its sprite, its position and target,...
s8 state
the callback's own step; 0 when it is given
s32 originX
16.16 fixed-point pixels; where the slot started
s16 maxTurnStep
1/65536 turns a frame
s8 limitTurnStep
Clamp steering to maxTurnStep; zero faces the target directly.
s32 originZ
16.16 fixed-point pixels; where the slot started
s32 targetZ
16.16 fixed-point pixels; EFFECT_NO_TARGET at rest
s32 targetX
16.16 fixed-point pixels; EFFECT_NO_TARGET at rest
s32 maxSpeed
16.16 fixed-point pixels per frame
s32 acceleration
16.16 fixed-point pixels per frame, each frame
A world position, as Camera_WorldToScreen converts it to the screen.
s32 y
16.16 fixed-point pixels
s32 z
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
A field actor: a person or thing on the field with a position, motion toward a target,...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
struct FieldActor * linkedObject
The object its action script follows or faces.
u8 steeringFlags
ActorSteeringFlag bits.
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
union FieldCoordinate y
16.16 fixed-point pixels
union FieldCoordinate z
16.16 fixed-point pixels
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
u8 terrainId
The map layer (0 to 3) its ground height is read from, which the scrolling camera updates from the ce...
s32 z
16.16 fixed-point pixels
A FieldActor seen with the halfword at 0x5e (its lifetime), which FieldActor does not name.
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 speedLimit
16.16 fixed-point pixels per frame
s32 z
16.16 fixed-point pixels
void(*) update(union FieldObject *object)
run first each frame
s32 y
16.16 fixed-point pixels
u8 motionFlags
bits: 4 no terrain slowdown | 3 bigger float | 2 floats | 1 falls | 0 follows terrain
s32 acceleration
Horizontal speed gained each frame towards the target, or lost braking without one,...
s32 scaleY
16.16 fixed point, 0x10000 full size
s32 x
16.16 fixed-point pixels
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s32 velocityZ
16.16 fixed-point pixels per frame
s32 velocityX
16.16 fixed-point pixels per frame
s32 z
16.16 fixed-point pixels
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
s32 x
16.16 fixed-point pixels
A field object as the script commands' overlap checks see it.
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.