retreat.c
Retreat.
games/tbs/src/object/psynergy_effects/retreat.c on GitHub
Retreat. Part of psynergy_effects.c, compiled only through it.
Functions
FieldFx_UpdateSpinAngle
void FieldFx_UpdateSpinAngle(union FieldObject *fieldObject)
Per-frame update: spins by 0x1000 + timer * 0x50 a frame, speeding up (timer counts up) until timer * 0x50 reaches 0x1000: from 1/16 turn a frame to just over 1/8 in 52 frames, as BattleFx_AdvanceAngleWithRamp.
Used by FieldFx_RunRetreat.
BattleFx_UpdateDescendingObject
void BattleFx_UpdateDescendingObject(union FieldObject *fieldObject)
Per-frame update: spins 1/8 turn a frame as it shrinks by 0x280, rising a pixel a frame; once its scale falls below 0x3000 (84 frames from full size) its sprites are hidden (spriteStorageKind 0), but it is not released. Retreat gives it to the caster.
Used by FieldFx_RunRetreat.
BattleFx_UpdateRadialLaunch
void BattleFx_UpdateRadialLaunch(struct EffectSlot *slot)
Effect slot callback: a particle flies 120 pixels from the main object's screen position (8 pixels lower) in a direction within 1/8 turn of up the screen, at up to 5 pixels a frame. In state 1 it starts again from the main object on arrival; set to state 2 (FieldFx_RunRetreat) it is freed on arrival.
Used by FieldFx_RunRetreat.
FieldFx_RunRetreat
void FieldFx_RunRetreat(void)
Spins the main object and shrinks it while 24 particles fly out, one a frame.
Abilities: Retreat (field kind 15).
The caster turns south, plays animation 28 with its colours cycling, spins up for 70 frames (FieldFx_UpdateSpinAngle), then rises and shrinks out of sight (BattleFx_UpdateDescendingObject) as the particles fly. It is hidden, not released, and the effect opens an event (FieldEvent_Begin) it does not end: the Retreat exit raised before it (EXIT_RETREAT, by Field_UsePsynergy or Field_UseItem) then leaves the scene. Called by BattleFx_Run and BattleFx_DispatchRequestKind.
Used by BattleFx_DispatchRequestKind, BattleFx_Run.
BattleFx_UpdateDescendingParticlePositiveArc
void BattleFx_UpdateDescendingParticlePositiveArc( union FieldObject *fieldObject)
Per-frame update of a falling arc: grows toward full size (0xc00 a frame) as it falls 2 pixels a frame on the object it follows, 9 pixels in front of it and up to 5 pixels further while small; released 10 pixels above the ground (4 on the world map, whose map is SceneId_Clear).
Used by BattleFx_SpawnDescendingArcParticles.
BattleFx_UpdateDescendingParticleNegativeArc
void BattleFx_UpdateDescendingParticleNegativeArc( union FieldObject *fieldObject)
As BattleFx_UpdateDescendingParticlePositiveArc for the arc drawn upside down, 16 pixels in front of the object and up to 5 pixels nearer.
Used by BattleFx_SpawnDescendingArcParticles.
BattleFx_SpawnDescendingArcParticles
void BattleFx_SpawnDescendingArcParticles(struct FieldActor *arc)
Spawns a pair of falling arcs (one upside down) on arc, 64 pixels above it, at 0.4 of full size, drawn with the tiles in scene->arcTileSlot. The upside-down arc draws in front of everything (priority 0), the other at the caster's priority, as BattleFx_SpawnScaledArcObjects does. Called by BattleFx_UpdatePairedArcSpawner, so arc is Avoid's caster.
Used by BattleFx_UpdatePairedArcSpawner.
Structures
DescendingArcSprite
struct DescendingArcSprite
A falling arc's sprite (struct AnimationObject), seen as the attribute bits, resource slot and animation that Avoid's arcs set on it; the notes give the AnimationObject fields, some under other names here.
| Field | Declared as | |
|---|---|---|
padding00 | u8 padding00[5] | |
flags05_0 | u8 flags05_0 : 5 | |
flags05_5 | u8 flags05_5 : 1 | image.fullColor: 0 for 16 colours |
layer | u8 layer : 2 | image.shape, despite the name: 1 wide |
padding06 | u8 padding06 | |
flags07_0 | u8 flags07_0 : 6 | |
size | u8 size : 2 | image.size |
tile, flags08_10, half, tileLow, flags09_0, variant, flags09_4, byte, attr | union { struct { u16 tile : 10; ///< image.tile, the first sprite tile in VRAM u16 flags08_10 : 6; } half; struct { u8 tileLow; u8 flags09_0 : 2; u8 variant : 2; ///< image.priority, despite the name u8 flags09_4 : 4; } byte; } attr | |
padding0c | u8 padding0c[16] | |
resource | u8 resource | slot: the VRAM cache entry holding its tiles |
active | u8 active : 1 | retainCacheEntry: the borrowed tiles stay loaded |
flags1d1 | u8 flags1d1 : 7 | |
padding1e | u8 padding1e[8] | |
animation | u8 animation | flags, despite the name: 0 drops the shadow |
padding27 | u8 padding27 | |
frame | struct AnimationEntry *frame | entries[0], its first layer |
Used by BattleFx_SpawnDescendingArcParticles.