53 i <
sizeof(
work->actors) /
sizeof(
work->actors[0]); i++) {
62 if ((position->
x >> 20) == (actor->
x.
fixed >> 20) &&
63 (position->
y / 0x10000) == (actor->
y.
fixed / 0x10000) &&
64 (position->
z >> 20) == (actor->
z.
fixed >> 20)) {
87 dst.
x = lead->
x.
fixed + (step & 0xffff0000);
96 dst.
x = next->
x.
fixed + (step & 0xffff0000);
105 dst.
y = next->
y.
fixed + 0x100000;
113 dst.
x = next->
x.
fixed + (step & 0xffff0000);
164 cells += x + (z << 7);
165 for (row = 0; row < height; row++) {
166 struct MapCell *cell = cells + (row << 7);
168 for (column = 0; column < width; column++) {
194 dir = actor->
facing >> 12;
196 probe.
x = actor->
x.
fixed + (step & 0xffff0000);
199 probe.
z = actor->
z.
fixed + step;
203 s32 kind = target->sprite->entries[0]->animId;
207 if (kind == *kinds++) {
222 probe.
x = actor->
x.
fixed + (step & 0xffff0000);
225 probe.
z = actor->
z.
fixed + step;
247 *direction = player->
facing >> 12;
250 i <
sizeof(
work->actors) /
sizeof(
work->actors[0]); list++, i++) {
260 kind = actor->sprite->entries[0]->animId;
261 for (j = 0; j < 6; j++) {
263 s32 x,
z, left, top, right, bottom;
282 if (left <=
x &&
x < right && top <=
z &&
z < bottom) {
284 if (left != (player->
x.
fixed >> 20)) {
288 }
else if (top != (player->
z.
fixed >> 20)) {
313 s32 nearEdge, farEdge;
328 offset = footprint * 4;
331 nearEdge = -nearEdge;
337 height = (nearEdge + farEdge) >> 4;
340 nearEdge = -nearEdge;
346 width = (nearEdge + farEdge) >> 4;
362 for (row = 0; row < height; row++) {
366 for (column = 0; column < width; column++) {
404 s32 horizontalExtent;
426 verticalExtent = (extentA + extentB) >> 4;
433 horizontalExtent = (extentA + extentB) >> 4;
436 actor->
speed = 0x8000;
438 originalPosition.
x = actor->
x.
fixed;
439 originalPosition.
z = actor->
z.
fixed;
443 (actor->
x.
fixed + (*(
s32 *)(footprintTable + tableOffset) << 16));
446 (actor->
z.
fixed + (*(
s32 *)(footprintTable + tableOffset) << 16));
447 tilePosition.
x >>= 20;
448 tilePosition.
z >>= 20;
452 horizontalExtent, verticalExtent, 0);
459 if (horizontalDelta < 0)
460 horizontalDelta += 0x1ffff;
461 horizontalDelta >>= 17;
464 if (verticalDelta < 0)
465 verticalDelta += 0x1ffff;
466 verticalDelta >>= 17;
478 if ((
u32)(direction - 6) <= 7)
493 ((
s16)packedOrientation) / 2);
513 s32 horizontalOrigin;
519 (probe.
position.
x + (*(
s32 *)(table + tableOffset) << 16));
522 (probe.
position.
z + (*(
s32 *)(table + tableOffset) << 16));
530 verticalExtent, horizontalOrigin + probe.
position.
x,
534 verticalExtent, 255);
537 verticalExtent, 255);
542 (originalPosition.
x + (*(
s32 *)(table + tableOffset) << 16));
545 (originalPosition.
z + (*(
s32 *)(table + tableOffset) << 16));
546 originalPosition.
x >>= 20;
547 originalPosition.
z >>= 20;
549 horizontalOrigin += originalPosition.
x;
550 verticalOrigin += originalPosition.
z;
553 horizontalExtent, verticalExtent,
554 originalPosition.
x, originalPosition.
z);
556 originalPosition.
z, horizontalExtent,
578 for (idx = 0; idx <= 5; idx++) {
598 height = (z0 + z1) >> 4;
605 width = (x0 + x1) >> 4;
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
s32 gStagedActor_DirectionSteps[]
Pixel step by direction: X in the upper halfword, Z in the lower.
s32 gStagedActor_FootprintBounds[]
u32 gStagedActor_FootprintKinds[]
Calls through a function pointer, by argument count.
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)
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 Engine_MapCopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Object_SetMode(struct FieldActor *object, s32 animation)
void Engine_ActorSetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ActorWaitForMove(s32 actor)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ActorSetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_EventWait(s32 frames)
The field's runtime work: map cells, scene records and regions, map markers and FieldWork.
FixedPointPosition, a position in 16.16 fixed point.
The work slots of gWorkSlot, read through their own names.
struct EffectStep gMapCellBuffer[]
Map cells; battle effects reuse this as a particle array.
The screen blend's globals and the graphics routines.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
Maps: their cells, layers, animations and blend scripts, and the map state.
Declares nothing of its own: it only includes edition.h and types.h.
The reel game's title lettering.
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
static struct FieldActor * FieldScene_FindActorRegion(s32 *direction, s32 *slot, s32 *footprint)
Returns the large thing whose footprint covers the cell ahead of the leader (the leader not standing ...
static struct FieldActor * StagedActor_FindAtTile(const struct FieldPosition *position, const struct FieldActor *origin)
Returns the placed actor on the cell of the 16.16 position and at its height (in whole pixels),...
static UNUSED s32 FieldScene_RedrawActorFootprint(s32 id)
Block large thing id's cells (collision 255) where it stands, through the map's layer 1 offset; retur...
static UNUSED void StagedActor_AdvancePair(void)
The leader pushes the block in front of them a cell on, unless something solid is beyond it or on top...
static UNUSED void SceneActor_MoveAndRedraw(struct StagedActorProbe probe)
Rolls the large thing to the position probe found: the leader pushes (animation 8),...
static s32 StagedActor_StopBlockedMotion(struct FieldActor *actor)
The leader's movement callback while pushing a large thing: stop the leader when another actor that i...
static UNUSED s32 StagedActor_FindClearPosition(struct StagedActorProbe *probe)
Finds where the large thing ahead of the leader would roll to: step its footprint on,...
static s32 StagedActor_FillGridAttributeRectangle(u32 layer, s32 x, s32 z, u32 width, u32 height, s32 value)
Sets the collision code of a width by height rectangle of cells, from cell (x, z),...
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
Song and sound effect ids, indices into gSound_SongTable.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_AudioPlayCue()
The pushable actors' movement probes and footprint bounds.
A field actor: a person or thing on the field with a position, motion toward a target,...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
u8 riseCounter
not read by the engine; scene code's own counter
union FieldCoordinate x
16.16 fixed-point pixels
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
s32 velocityX
16.16 fixed-point pixels per frame
union FieldCoordinate y
16.16 fixed-point pixels
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....
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
s32 velocityZ
16.16 fixed-point pixels per frame
u8 terrainId
The map layer (0 to 3) its ground height is read from, which the scrolling camera updates from the ce...
s32 z
16.16 fixed-point pixels
Full event work allocated by Field_RunScene (heap slot 27).
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_...
Where a large thing ahead of the leader would roll to: its footprint, its actor, that position,...
struct FieldPosition position
16.16 pixels while moving; converted to cells by footprint redraws.
void(*) callback(void)
Run as the leader follows the rolling thing, when not null; the probe clears it.
s32 actorSlot
the large thing's actor number, 8 to 65
s32 footprintIndex
The large thing's row in gStagedActor_FootprintKinds and gStagedActor_FootprintBounds,...
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.