28#define EFFECT_OBJECT_COUNT 64
30#define EFFECT_OBJECT_POOL ((struct EffectObj *)gObjectSlots)
35#define EFFECT_OBJECT_POOL (*(struct EffectObj **)((u8 *)&gEventWork - 88))
37#define SPARKLE_OBJECT_ID 285
55 if (marker->
id != 0) {
59 cellX = marker->
column << 20;
60 dx = x - cellX - (8 << 16);
61 cellZ = marker->
row << 20;
62 dz = z - cellZ - (8 << 16);
63 if ((dx >= -0xfffff && dx <= 0xfffff) &&
64 (dz >= -0xfffff && dz <= 0xfffff)) {
65 leader->
x = cellX + (8 << 16);
66 leader->
z = cellZ + (8 << 16);
76 if (markerIndex > 9 || marker->
id == 0)
136 u32 actorOffset = (actor * 4) + 0x14;
150 pictureX = (picturePosition.
vector.
x & 0xfff00000) + (8 << 16);
152 srcZ = (picturePosition.
vector.
z & 0xfff00000) + (8 << 16);
228 object->acceleration = 1 << 16;
229 object->speedLimit = 2 << 16;
237 leader->
angle = 0x4000;
247 if (
object !=
NULL) {
307#define PARTICLES_PAUSE_FOR_MENU 1
310#if defined(PARTICLES_PAUSE_FOR_MENU)
311#define MENU_OPEN_OFFSET 0xcca
327 }
while (remainingActors >= 0);
342#if defined(PARTICLES_PAUSE_FOR_MENU)
368 isActive = (0 - revealState) | revealState;
394 leaderColumn = actor->
x >> 20;
395 leaderRow = actor->
z >> 20;
396 if (markerData != 0) {
397 while (column = *markerData++, row = *markerData++,
398 column != 0xff || row != 0xff) {
402 if (id < 100 || id > 239)
404 if (leaderColumn - column >= 0) {
405 if (leaderColumn - column > 8)
407 }
else if (column - leaderColumn > 8)
409 if (leaderRow - row >= 0) {
410 if (leaderRow - row > 5)
412 }
else if (row - leaderRow > 5)
419 switch (entry->
value & 0xfff00000) {
431 22, (column << 20) + (8 << 16), 0, (row << 20) + (8 << 16));
450#undef EFFECT_OBJECT_COUNT
451#undef EFFECT_OBJECT_POOL
452#undef SPARKLE_OBJECT_ID
453#undef PARTICLES_PAUSE_FOR_MENU
454#undef MENU_OPEN_OFFSET
void * ObjectTable_Get(u32 actorIndex)
Returns the actor in slot index (0 to 65), or NULL.
struct ObjectRuntime * Object_CreateFar(s32 id, s32 x, s32 y, s32 z)
Far call to FieldObject_Create.
void ObjectDispatch_ReleaseFar(struct DispatchObject *obj)
void ObjectDispatch_SetSingleChildFlagsFar(struct DispatchObject *obj, u32 flags)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void ObjectDispatch_InitializeFar(struct DispatchObject *obj, const s32 *script)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
s32 GameFlag_TestFar(s32 flag)
void Ui_PrepareTransferForItemFar(s32 code)
void ItemDisplay_EmitSparkles(union FieldObject *fieldObject)
Each frame of a found item's picture: one time in ten, a sparkle appears within 16 pixels of it.
void Object_DestroyIfPresent(void *object)
Releases object unless it is NULL.
void Marker_MoveLeaderAway(void)
Keeps the party leader off the markers: a leader within 16 pixels of a marker cell's centre is moved ...
#define SPARKLE_OBJECT_ID
struct EffectObj * BattleFx_StartRandomParticleEmitter(s32 actor, s32 item)
Shows the picture of item (0 for none) at the centre of the cell 16 pixels in front of character acto...
void FieldEffect_SpawnNearbyMarkers(void)
Reveal: marks with sparkles the hidden things within 8 cells left or right and 5 up or down of the le...
#define EFFECT_OBJECT_COUNT
ObjectSystem_Initialize allocates 64 ObjectRuntime records in heap slot 5.
void EffectRuntime_RunRisingObjectSequence(void *object, s32 flags)
Shows a found item's picture: flags bit 0 adds sparkles and bit 1 raises it above the leader,...
void BattleFx_StartEffectObject22(s32 item, s32 flags)
Shows the picture of item 36 pixels above the party leader for 80 frames; flags bit 0 adds sparkles a...
static void Object_InitializeSparkle(struct ObjectRuntime *obj)
Starts the particle script and its first child at priority 1, if the spawn succeeded.
void RevealMarker_EmitSparkles(union FieldObject *fieldObject)
Each frame of a Reveal marker: one time in ten, a sparkle appears within 16 pixels of it.
void ItemDisplay_RaiseAboveLeader(struct ObjectRuntime *object)
Raises a found item's picture to 36 pixels above the party leader, who holds it up (animation 28) fac...
s32 Field_IsRevealActive(struct ScriptInterpreter *interpreter)
Returns 1 while Reveal is active, else 0.
#define EFFECT_OBJECT_POOL
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
struct SceneEntries gOverlayArea
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
const s32 gBattleFx_MarkerParticleScript[]
const s32 gBattleFx_RisingPulseScript[]
Pulses twice, then rests, over and over.
const s32 gBattleFx_ParticleScript[]
Rises for 60 frames, then disappears.
const s32 gBattleFx_ParticleEmitterScript[]
Grows from half size to full size, a step every 2 frames.
struct GameState gGameState
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
struct ObjectRuntime * Marker_GetActor(s32 id)
Returns the actor of marker id, or NULL when no slot has it.
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,...
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
s32 ArcTan2(s32 x, s32 y)
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y,...
void Runtime_ReleaseHeapBlock(s32 slot)
struct ObjectRuntime * Object_Spawn(s32 kind, s32 x, s32 y, s32 z)
Creates an object for an effect, at the caster's ground height, with sprite priority 0 and animation ...
What every part of object.c shares: its includes and the macros and types more than one part uses.
struct EventWork * gEventWork
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
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)
u8 slot
VRAM cache entry holding its tiles.
u8 count
layers in use, up to the last one present
u16 fullColor
256 colours; set for both parts when created
u16 tile
first sprite tile in VRAM
u16 priority
2 when created
A field object as the object dispatcher's far calls take it.
An actor as these effects see it.
struct AnimationObject * animation
s32 scriptWord
the encoded script pointer
void(*) updateHook(union FieldObject *object)
frame hook at offset 0x6c
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,...
union FieldCoordinate x
16.16 fixed-point pixels
union FieldCoordinate y
16.16 fixed-point pixels
union FieldCoordinate z
16.16 fixed-point pixels
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
Full event work allocated by Field_RunScene (heap slot 27).
s16 revealActive
nonzero while Reveal is active
struct MarkerSlot markers[10]
the map's markers (MARKER_MAX)
s32 selectedActor
the leader: its unit and its actor
A map marker placed as an actor: a chest or a Psynergy stone.
u8 id
the trigger of its scene event
u8 column
its 16-pixel cell
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s32 targetZ
16.16 fixed-point pixels; 0x80000000 when unset
s32 targetY
16.16 fixed-point pixels; 0x80000000 when unset
s32 velocityY
16.16 fixed-point pixels per frame
s32 z
16.16 fixed-point pixels
s32 targetX
16.16 fixed-point pixels; 0x80000000 when unset
u8 flags
FieldActor.motionFlags: 3 when created, 4 for a placed actor above the ground; zero is free flight in...
s32 x
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
const struct SceneEvent *(*) events(void)
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
s16 condition
-1 always, a flag | 0x1000 set, else the flag clear
s16 trigger
What the event answers: an actor id, a tile's collision code, a marker id or a raised value.
u32 value
A message below 0x10000, else an event function; for an exit, the exit kind its scene's exit table ma...
u32 control
The kind and its detail, read by Scene_FindEvent and the item, Psynergy and search lookups; -1 ends t...
The prefix that command handlers read from a field object's 0x70-byte slot.
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
The polar-offset routine walks three array elements.
struct EffectVector vector
void BattleFx_ClearRandomParticles(void)
s32 VramCache_Load(u32 no, u32 size, const void *src)
Gives cache entry no size bytes of sprite VRAM and copies src there.