68 dir = (user->
facing + 0x2000) & 0xc000;
103#define SETUP_OBJECT_SLOTS ((struct ScriptMotionObject *)gObjectSlots)
129 runtime = *(
struct FieldWork **)((
u8 *)sceneCell - 116);
132 for (remaining = 0; remaining < 24; remaining++) {
133 sceneObject = &scene->
slots[remaining];
134 if (sceneObject->
active != 0)
151 while (remaining <= 63) {
154 if (update == firstActiveUpdate || update == secondActiveUpdate) {
166 }
while (active != 0 && waited <= 29);
188 s32 announcedAbility;
197 announcedAbility = ability;
212 if ((
s8)scene->
mode != 0) {
245 if (((
struct FieldWork *)scene)->revealActive == 0)
280 savedPalettes = (
s32)(field + 0x236);
282 if (((
struct FieldWork *)field)->revealActive != 0) {
306 position->
x = result[0] << 16;
307 position->
z = result[1] << 16;
323 position->
z -= position->
y;
331#undef SETUP_OBJECT_SLOTS
void * ObjectTable_Get(u32 actorIndex)
Returns the actor in slot index (0 to 65), or NULL.
void BattleFx_FlickerObjectAndTick(union FieldObject *fieldObject)
Per-frame update: flashes an object between sprite param 7 and 0 every 2 frames and spawns the swelli...
void FieldFx_CycleObjectValueByCounter(union FieldObject *fieldObject)
Per-frame update: cycles an object through sprite params 0 to 5, one step every 2 frames,...
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)) wh...
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 nea...
const u8 gBattleFx_SparkTiles[]
const s32 gBattleFx_TargetColors[]
void BattleFx_ApplyColorToTargetBuffer(s32 mode, s32 half)
Sets the colours the buffer moves toward (see BattleFx_BuildBuffer); does nothing without a colour bu...
void BattleFx_StartBufferInterpolation(s32 frames)
Starts moving the shown colours to the target colours over frames frames: sets work->duration,...
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
#define Dma_Fill32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
void BattleFx_ClearOwnedSlot(struct EffectSlot *slot)
Frees an effect slot and its sprite.
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void Animation_ApplyChildValuesFar(struct DispatchObject *obj, u32 val)
s32 GameFlag_TestFar(s32 flag)
struct BattleAct * BattleActGet(s32 actionId)
Far call to BattleAction_GetDirect.
void AudioCommand_PlayFar(s32 id)
void UiText_ShowPositionedMessageAndWaitFar(s32 no, s32 flags)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
volatile u32 gFrameCount
Frames WaitFrames has finished.
struct GameState gGameState
void * gEffectWork
Slot 56: points to a scene-specific structure.
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
#define SET_VELOCITY(p, vx, vy, vz)
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,...
void Runtime_ReleaseHeapBlock(s32 slot)
void ObjectGroup_SetActionForOthers(struct ObjectRuntime *except, s32 state, s32 value)
Sets the movement state and animation timer steps of every object but the player's and except.
s32 ResourceTable_CountFreeBlocks(void)
Counts the free blocks (owner 0xff) of the 512 resource blocks.
void BattleFx_UpdateAllEffectSlots(void)
Scheduler callback: updates the 24 effect slots.
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 BattleFx_SetupObjectPair(s32 userId, s32 targetId)
Records the caster and the target of an effect.
void EffectRuntime_StopCurrentObject(void)
Stops the caster's per-frame hook and restores its colours.
void BattleEffect_CleanupSceneObjects(void)
Ends a Psynergy effect: frees the effect slots still in use and, unless another effect is being resol...
void Camera_WorldToScreen(struct EffectVector *position)
Converts a world position (16.16 pixels) to the screen: x and z receive the screen's x and y and y be...
#define SETUP_OBJECT_SLOTS
void EventObject_Initialize(void)
Starts casting: the caster takes its casting pose (animation 20) and stops.
void BattleFx_LoadActionEffectResources(s32 abilityId, s32 mode)
Prepares the work of the Psynergy effect for ability (heap slot 56) and loads its spark tiles.
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
#define HEAP_SLOT_FX
the Psynergy effect's work (gWorkSlot[56], gEffectWork)
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
char SceneId_MercuryLighthouseEntrance
char SceneId_MercuryLighthouse2
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
struct EventWork * gEventWork
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationEntry * entries[4]
its layers; empty ones null
u8 type0c
The field Psynergy the ability works as, 1 (Move) to 16 (Avoid); 0 for none.
The colour buffer (heap block 32) that fades the BG and OBJ palettes: the source palette,...
u16 current[0x540]
The shown colours, as B, G and R channels shifted up 10 bits, three a colour.
u16 target[0x540]
the colours current moves toward, as current
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
u16 freeBlocks
512 less the free resource blocks at the start
u8 mode
where the effect runs; MODE_WORLD_MAP on the world map
s32 y
16.16 fixed-point pixels
s16 firstObjectId
the caster's object id
void(*) savedCallback(union FieldObject *object)
The target's update hook and script, saved at the start and restored when Move or Carry lets it go.
s8 visible
set at the start: the caster flashes with a sound
u8 savedPalette
the target's first sprite's param, saved likewise
struct EffectSlot slots[24]
u16 tileSlot
resource entry holding the spark tiles
void * mainObject
the caster's object
s32 savedShakeX
The map's shake and its decay, restored when the effect ends.
u8 lit
set in two Mercury Lighthouse maps; not read by name
s16 fieldKind
the ability's field kind (FIELD_KIND_)
s8 messageMode
the announcement's box mode: 1, a scene adds 8
void * child
the target's object, or NULL
s8 enabled
Set at the start: Force then aims in front of the caster; cleared once the target has been dispatched...
s32 x
16.16 fixed-point pixels
s8 active
set at the start: the ability's name is announced
s32 z
16.16 fixed-point pixels
s16 secondObjectId
the target's object id, -1 for none
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 active
nonzero while the slot is in use
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 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
union FieldCoordinate x
16.16 fixed-point pixels
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
union FieldCoordinate y
16.16 fixed-point pixels
union FieldCoordinate z
16.16 fixed-point pixels
s32 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
Full event work allocated by Field_RunScene (heap slot 27).
s8 resolvingAction
set while Psynergy takes effect
s16 event
A raised event for Scene_RunRaisedEvent, or -1 when characters fell to poison or hazard damage,...
s16 effectTimerRunning
Nonzero lets the Reveal countdown advance; menus and other effects pause it.
s8 castStarted
set once a cast has been announced
s16 map
the scene's map; SceneId_Clear for the world map
s32 selectedActor
the leader: its unit and its actor
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
void * animation
its sprite, or its list of four, by animationKind
A field object as the motion code sees it: its script, position, motion toward a target,...
s32 x
16.16 fixed-point pixels
void(*) hook(union FieldObject *object)
Called each frame before its script.
const ScriptMotionWords * script
null when the object is free
s32 y
16.16 fixed-point pixels
s32 z
16.16 fixed-point pixels
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
#define MODE_WORLD_MAP
the world map
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
s32 VramCache_Load(u32 no, u32 size, const void *src)
Gives cache entry no size bytes of sprite VRAM and copies src there.