Alchemy

effect_slot.c

Effect slots: the particles Psynergy effects move and draw.

games/tbs/src/object/psynergy_effects/effect_slot.c on GitHub

Effect slots: the particles Psynergy effects move and draw. Part of psynergy_effects.c, compiled only through it.

Functions

EffectSlot_Update

void EffectSlot_Update(struct EffectSlot *effect)

Updates one effect slot: counts its age, runs its callback (after any delay), moves it and draws it.

Used by FieldFx_UpdateSceneSlots.

Line 9

BattleFx_DrawScaledObject

void BattleFx_DrawScaledObject(struct EffectSlot *object)

Draws an effect slot's sprite at its screen position and scale, when it is near the screen: x from -32 to 272 pixels and z from -32 to 224, both exclusive. With flag 4 the slot's z also lifts it (0x1fc pixels less z): it is placed at y 508 pixels and raised back to z, so it shows at the same point but sorts as if at 508.

Used by EffectSlot_Update.

Line 31

EffectSlot_UpdateMotion

void EffectSlot_UpdateMotion(struct EffectSlot *effect)

Moves an effect slot toward its target, turning at most maxTurnStep a frame when limitTurnStep is set and speeding up by acceleration to maxSpeed. A slot that stops at its target lands on it once within 8 pixels.

Used by EffectSlot_Update.

Line 55

EffectSlot_HasPendingTarget

u32 EffectSlot_HasPendingTarget(struct EffectSlot *effect)

Returns 1 while an effect slot that stops at its target still has one (it has not arrived), 0 once it has arrived or when it never stops. The slot callbacks poll it each frame to step their states.

Used by AltmillerCave_UpdateWallFragment, BattleEffect_UpdatePhasedRadialParticle, BattleFx_UpdateOrbitAndReturn, BattleFx_UpdateRadialBurst, BattleFx_UpdateRadialCamera, BattleFx_UpdateRadialLaunch, BattleFx_UpdateRadialSpread, BattleFx_UpdateRandomTargetParticle.

Line 113

EffectSlot_SetPosition

void EffectSlot_SetPosition(struct EffectSlot *effect, s32 x, s32 z)

Places an effect slot at (x, z), at rest with no target.

Used by EffectSlot_Initialize, EffectSlot_UpdateMotion.

Line 126

EffectSlot_SetObjectMode

void EffectSlot_SetObjectMode(struct EffectSlot *effect, s32 mode)

Sets the animation of an effect slot's sprite.

Used by AltmillerCave_ReleaseWallBurst, BattleFx_RunMercuryDjinnCapture, BattleFx_RunVenusDjinnCapture, Djinn_RunJupiterJoinEffect, Djinn_RunMarsJoinEffect, EffectSlot_Initialize, FieldFx_RunForce, FieldFx_RunRetreat.

Line 135

EffectSlot_SetCallback

void EffectSlot_SetCallback(struct EffectSlot *effect, EffectCallback callback)

Gives an effect slot its per-frame callback, starting at state 0.

Used by AltmillerCave_ReleaseWallBurst, BattleEffect_RunFallbackObjectTransition, BattleFx_RunMercuryDjinnCapture, BattleFx_RunVenusDjinnCapture, Djinn_RunJupiterJoinEffect, Djinn_RunMarsJoinEffect, FieldFx_RunForce, FieldFx_RunRetreat.

Line 140

EffectSlot_Initialize

void EffectSlot_Initialize(struct EffectSlot *effect, s32 kind, s32 x, s32 z)

Fills an effect slot with a new sprite of kind at (x, z): stopping at its target, top speed 2, acceleration and scale 1, drawn, animation 1. The slot owns the sprite until BattleFx_ClearOwnedSlot. Its turn is limited with maxTurnStep 0, so it holds heading 0 until its callback clears limitTurnStep or gives a step, as the first states of the callbacks that steer to a target do.

Used by AltmillerCave_ReleaseWallBurst, BattleEffect_RunFallbackObjectTransition, BattleFx_RunMercuryDjinnCapture, BattleFx_RunVenusDjinnCapture, Djinn_RunJupiterJoinEffect, Djinn_RunMarsJoinEffect, FieldFx_RunForce, FieldFx_RunRetreat.

Line 154

BattleFx_ClearOwnedSlot

void BattleFx_ClearOwnedSlot(struct EffectSlot *slot)

Frees an effect slot and its sprite, clearing the slot to zero (inactive). Slot callbacks call it on their own slot as their last state; the slot update then neither moves nor draws it.

Used by AltmillerCave_UpdateWallFragment, BattleEffect_CleanupSceneObjects, BattleEffect_UpdatePhasedRadialParticle, BattleFx_ClearActiveSlotsAndScheduleUpdates, BattleFx_RunAngledApproachPhases, BattleFx_UpdateOrbitAndReturn, BattleFx_UpdateRadialBurst, BattleFx_UpdateRadialCamera, BattleFx_UpdateRadialLaunch, BattleFx_UpdateRadialSpread, BattleFx_UpdateRandomTargetParticle.

Line 192

On this page