60 frame = ++actor->
timer;
64 actor->
scaleX = (frame * 3) << 10;
65 actor->
scaleY = (frame * 3) << 10;
75 frame = ++actor->
timer;
108 distance = (
u16)
Iwram_Sqrt(deltaX * deltaX + deltaZ * deltaZ);
112 if (distance <
PIXELS(64))
115 moveDistance = distance / 8;
116 if (moveDistance > actor->
speed)
117 moveDistance = actor->
speed;
120 if (distance <
PIXELS(1) / 4) {
124 if (distance > moveDistance) {
159 sprite = spark->sprite;
164 if (sprite !=
NULL) {
174 sprite = spark->sprite;
180 if (sprite !=
NULL) {
231 for (step = state->
levels; step <= 2; step++) {
244#define MAP_CELLS ((struct MapCell *)Ram_MapCellBuffer)
302 pos[0].
fixed = (actor->
x.
fixed & -0x100000) + 0x80000;
304 pos[2].
fixed = (actor->
z.
fixed & -0x100000) + 0x80000;
305 from = &
MAP_CELLS[(pos[2].
fixed / 0x100000 << 7) + pos[0].fixed / 0x100000];
307 to = &
MAP_CELLS[(pos[2].
fixed / 0x100000 << 7) + pos[0].fixed / 0x100000];
328 sprite = obj->sprite;
334 obj->
speed = 0x40000;
337 if (sprite !=
NULL) {
340 sprite->
flags = zero;
358 actor->
speed = 0x30000;
377 OverlayObject_SpawnKind24AtObject(actor);
405 OverlayObject_SpawnKind24AtObject(point);
416 if (published ==
NULL)
s32 AnimationObjects_SelectAnimation(struct AnimationObject *sprite, s32 animation)
Starts animation flags & 0x7f on every layer of a sprite (bit 7 keeps each layer's place and timer),...
The engine calls the debug menus import, and their palette swatch tiles.
The engine call layer: one typed inline for each of the thirteen main-image routines below that the s...
static s32 FieldObject_CheckMovementCollision(struct FieldActor *actor, struct FieldPosition *position)
Field effects, their scripts and the flags that spawn them.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Engine_ObjectSetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
void Object_SetMode(struct FieldActor *object, s32 animation)
void Engine_ActorMoveToAndWait(s32 actor, s32 x, s32 z)
s32 Engine_MathSin(s32 angle)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
The field's runtime work: map cells, scene records and regions, map markers and FieldWork.
16.16 fixed-point constants, sine and cosine, and the library division.
#define Q16_ONE
One in the engine's signed 16.16 fixed-point format.
volatile u32 gFrameCount
Frames WaitFrames has finished.
struct GameState gGameState
The screen blend's globals and the graphics routines.
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
The heap's work slots and HeapState.
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
static s32 Iwram_RatioMulQ14(s32 divisor, s32 value)
All calls go through this layer.
static s32 Iwram_Sqrt(s32 value)
#define Iwram_MulQ16(left, right)
The keypad state the VBlank interrupt keeps.
volatile u32 gKeysHeld
Keys down now.
volatile u32 gKeysPressed
Keys that went down this frame.
Maps: their cells, layers, animations and blend scripts, and the map state.
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,...
s32 FixedSqrt(s32 value)
Square root of a 16.16 fixed-point value, in 16.16.
Includes field_event.h with FIELD_STAGED_ACTOR_IMPORTS defined, so a scene gets the staged-actor impo...
s32 gMercuryLighthouse_PillarScript[]
s32 gMercuryLighthouse_ScaleCounterScript[]
s32 gMercuryLighthouse_RampScript[]
s32 gMercuryLighthouse_SparkScript[]
u16 gMercuryLighthouse_MoveAngles[]
The reel game's title lettering.
The work pointers in the gWorkSlot table, by name.
The field object script interpreter and the operands its commands read.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_JUMP
An actor jumps: ObjectMotion_Launch plays the high jump above 5 pixels a frame.
struct EventWork * gEventWork
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
static s32 OverlayObject_RampWords24And28Over16Frames(struct ScriptInterpreter *interpreter)
Grows the moving light over the first sixteen script frames.
void MercuryLighthouse_HopAcrossPool(void)
Pushing against the pool's edge (triggers 11, 21 and 31): the leader hops two cells the way the pad p...
static s32 MercuryLighthouse_FollowLeader(struct ScriptInterpreter *interpreter)
Follows the linked actor and alternates the light's animation parameter.
static void MercuryLighthouse_RemoveColumnOnRetreat(void)
Retreat (PSYNERGY_IN_AREA(ABILITY_RETREAT, 1)): remove the column of light.
static void MercuryLighthouse_SpawnSparkPair(void)
Places the two spark animations on the selected actor.
void MercuryLighthouse_LoseLights(void)
Touch trigger 31: the leader loses their lights, and the column swells and fades away.
static s32 OverlayObject_AdvanceScaleCounter(struct ScriptInterpreter *interpreter)
Expands the released light before its script removes it.
void MercuryLighthouse_SparkleAtLeader(void)
Touch trigger 21: while the leader stands there, a sparkle rises from them every 10 to 39 frames.
void MercuryLighthouse_ChargeLights(void)
Touch trigger 11, the pool's heart: the column of light appears over the leader if it is not there,...
static s32 SceneEffect_AdvanceAnchoredRiseFrame(struct ScriptInterpreter *interpreter)
Raises the spark while its scale follows a half-sine pulse.
#define offsetof(type, member)
One animation layer of a sprite: its animation id, frames, running script and timer.
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 AnimationSpritePart image
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
struct AnimationEntry * entries[4]
its layers; empty ones null
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
u16 priority
2 when created
struct FieldActor * actors[8]
the party's characters, ids 0 to 7
A field actor: a person or thing on the field with a position, motion toward a target,...
s16 timer
The parameter its action script reads (a follow distance or an angle to face), the player's frames to...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
struct FieldActor * linkedObject
The object its action script follows or faces.
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
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
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
s32 terrainHeight
16.16 fixed-point pixels
s32 velocityY
16.16 fixed-point pixels per frame
u8 spriteStorageKind
Zero hides sprites; one draws a single sprite, two draws a group.
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....
s32 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
Full event work allocated by Field_RunScene (heap slot 27).
s32 walkingDistanceScale
scales movement for PP and status updates
struct FieldActor * actors[66]
The actors by id: 0 to 7 the party's characters, 8 on the placed actors.
s32 walkingDistance
accumulated 16.16 distance awaiting an update
s32 selectedActor
the leader: its unit and its actor
One cell of a map layer: its metatile and flags, its collision code and an attribute indexing the col...
u8 collisionCode
The step code: 1 to 239 scene events, 240 and 241 encounter ground, 250 hazard, 252 to 254 for Field_...
Published in the scene's light-controller slot while the pillar is active.
s32 terrainCode
the pool's collision code, the floor's region
s32 levels
The leader's lights, 0 to 3: the heart gives three and each hop into the pool spends one.
struct FieldActor * pillar
the column of light over the leader, or null
s32 targetX
16.16 fixed-point pixels: the centre of the column's cell, where a sinking leader is put back.
struct FieldActor * stepEffect
The light holding the leader up where they landed in the pool, or null.
s32 sparkTimer
Frames to the next sparkle at trigger 21, 10 to 39; a hop zeroes it.
The prefix that command handlers read from a field object's 0x70-byte slot.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
A field coordinate, read whole or as its fraction and its whole pixels.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels