arcs.c
The swelling arcs over the caster.
games/tbs/src/object/psynergy_effects/arcs.c on GitHub
The swelling arcs over the caster. Part of psynergy_effects.c, compiled only through it.
Functions
FieldFx_UpdateScaledArcObjectA
void FieldFx_UpdateScaledArcObjectA(union FieldObject *fieldObject)
Per-frame update of arc A: over 32 frames it swells and shrinks again (scale sin(frame / 64 turn)) while it rises a pixel a frame on the object it follows, 9 pixels in front of it and up to 5 pixels further while small.
Used by BattleEffect_CleanupSceneObjects, BattleFx_SpawnScaledArcObjects.
FieldFx_UpdateScaledArcObjectB
void FieldFx_UpdateScaledArcObjectB(union FieldObject *fieldObject)
Per-frame update of arc B: arc A upside down, 16 pixels in front of the object and up to 5 pixels nearer while small.
Used by BattleEffect_CleanupSceneObjects, BattleFx_SpawnScaledArcObjects.
BattleFx_SpawnScaledArcObjects
void BattleFx_SpawnScaledArcObjects(struct FieldActor *linked)
Spawns the two swelling arcs (object 26) on an object, A and B (B upside down); they follow it for 32 frames, then free themselves. They draw with the effect's spark tiles, so they need the effect's work; the casting hooks below spawn them every 16 frames, and BattleEffect_CleanupSceneObjects waits for the last to end (at most 30 frames).
Used by BattleFx_FlickerObjectAndTick, FieldFx_CycleObjectValueByCounter.
BattleFx_FlickerObjectAndTick
void BattleFx_FlickerObjectAndTick(union FieldObject *fieldObject)
Per-frame update: flashes an object between sprite param 7 and 0 every 2 frames and spawns the swelling arcs on it every 16. EventObject_Initialize gives it to the caster as a cast starts with a flash (scene->visible).
Used by EventObject_Initialize.
FieldFx_CycleObjectValueByCounter
void FieldFx_CycleObjectValueByCounter(union FieldObject *fieldObject)
Per-frame update: cycles an object through sprite params 0 to 5, one step every 2 frames, and spawns the swelling arcs on it every 16. EventObject_Initialize gives it to the caster in place of the flicker while flag 0x140 is set.
Used by EventObject_Initialize.
Structures
ArcSprite
struct ArcSprite
A sprite (struct AnimationObject) as the arcs set it up: its image's three OAM attributes and its bookkeeping; the notes give the AnimationObject fields at the same offsets.
| Field | Declared as | |
|---|---|---|
pad00 | u8 pad00[4] | |
y | u16 y : 8 | screen pixels |
affine | u16 affine : 1 | |
doubleSize | u16 doubleSize : 1 | |
mode | u16 mode : 2 | |
mosaic | u16 mosaic : 1 | |
color | u16 color : 1 | 1 = 256 colours |
shape | u16 shape : 2 | 1 wide |
x | u16 x : 9 | screen pixels |
unused | u16 unused : 3 | |
hflip | u16 hflip : 1 | |
vflip | u16 vflip : 1 | |
size | u16 size : 2 | |
tile | u16 tile : 10 | first sprite tile in VRAM |
priority | u16 priority : 2 | |
palette | u16 palette : 4 | |
pad0a | u8 pad0a[18] | |
slot | u8 slot | VRAM cache entry holding its tiles |
active | u8 active : 1 | retainCacheEntry: set, releasing the arc leaves the effect's spark tiles (scene->tileSlot), which it borrows, loaded. |
displayFlags | u8 displayFlags : 7 | |
pad1e | u8 pad1e[8] | |
flags | u8 flags | bit 0 draws its shadow; the arcs clear it |
pad27 | u8 pad27 | |
child | struct AnimationEntry *child | entries[0], its first layer |
Used by BattleFx_SpawnScaledArcObjects.