19 for (tableIndex = 0; tableIndex < 4; tableIndex++) {
21 if (placement ==
NULL)
24 for (; (
s16)placement->
sprite != -1; placement++) {
34 for (; (
s16)placement->
sprite != -1; placement++) {
36 if (placedActor ==
id) {
68 if (condition == -1) {
71 if (0x1000 & condition) {
93 searchFlags = flags & 0x1ff;
96 mimicDifference = (result & 0xfff00000) ^ 0x500000;
97 ignoresCondition = mimicDifference | (0U - mimicDifference);
99 ignoresCondition >>= 31;
101 return ignoresCondition;
118 flags =
event->flags;
120 while (flags != -1) {
121 if ((flags & 0xf) == kind && event->value == target &&
124 (flags = event->flags, 1)))) {
126 s32 minimumPushFrames = 12;
127 s32 touchRequirements;
129 if ((flags & 0x800) != 0)
130 minimumPushFrames = 2;
133 switch (touchRequirements) {
138 if (
work->blockedSteps > minimumPushFrames) {
146 matches = (
u16)((flags -
facing) + 0x1fff) <= 0x3ffe;
149 if (
work->blockedSteps > minimumPushFrames) {
151 matches = (
u16)((flags -
facing) + 0x1fff) <= 0x3ffe;
160 if (event->flags == -1)
162 flags =
event->flags;
179 if (pausedActor ==
id) {
182 if (pausedEvent != 0) {
183 return (
s32)pausedEvent;
186 return (
s32)talkEvent;
205 s32 usePausedDialogue = 0;
212 usePausedDialogue = 1;
218 if (event->
result >= 0x10000) {
222 MsgPonderEllipsis + definitionFlags * 2 + (random * 2 >> 16);
234 if (event != 0 && event->
result != 0) {
242 savedAngle = actor->angle;
244 if (talkFacing <= (1 << 24) || talkFacing == (3 << 24)) {
256 if (event->
result < 0x10000) {
277 actor->
action = savedAngle;
343 if ((touch != 0) && (touch->
result != 0)) {
347 if (touch->
result < 0x10000) {
362 exitKind =
exit->flags & 0x30;
393 switch (collisionCode) {
442 messageOffset = tile - 242;
443 if (messageOffset <= 5) {
451 s32 flags =
event->control;
456 messageOffset = (flags >> 4) & 31;
457 if ((event->
trigger & 0x400) == 0 && messageOffset != 0) {
468 searchResult =
event->value;
469 if ((searchResult & 0x0f000000) != 0 ||
470 (searchResult & 0xfff00000) == 0x400000) {
471 if ((searchResult & 0x0f000000) != 0) {
477 MsgTileResult + messageOffset, 1);
491 searchResult =
event->value;
493 if ((searchResult & 0xf0000) == 0x10000 && leader <= 7)
497 if ((event->
control & 0x1ff) == 19)
499 rewardType =
event->value & 0xfff00000;
500 if (rewardType == 0x300000) {
504 if ((event->
control & 0x1ff) == 19)
525 }
else if (rewardType == 0x500000) {
529 if ((
event->control & 0x1ff) == 19)
534 if (condition != -1) {
543 }
else if (rewardType == 0x200000) {
550 if ((
event->control & 0x1ff) == 19)
570 messageOffset = 0xffff;
571 if (recipient == -1) {
576 if ((
event->control & 0x1ff) == 19)
579 if ((
event->control & 0x1ff) == 19)
void Object_LinkPair(s32 firstId, s32 secondId, s32 wait)
The event command "actors face each other": turns two actors toward each other, then waits wait frame...
void Actor_JumpDownLedge(s32 actor, s32 pose, s32 param)
Makes an actor jump down off a ledge in front of it (the field runs it for the leader when the player...
void Event_SetMessageId(s32 message)
The event command "set message": the number of the event's next message, written to work->message.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void ObjectMotion_SetActionCallback(struct ObjectRuntime *object, s32 action)
Starts an actor's action script: 1 to 4 the fixed action scripts, 5 follow the linked object,...
void * ObjectTable_Get(u32 actorIndex)
Returns the actor in slot index (0 to 65), or NULL.
const u8 gObjectMotion_LinkedActionScript[]
s32 Field_ClimbUp(void)
Climbing up (the player presses up at a climbable wall).
s32 Field_ClimbDown(void)
Climbing down (the player presses down at a climbable wall).
s32 Field_TryJumpForward(void)
Makes the leader jump two tiles forward, over the tile in front, when the map allows it (Map_CheckObj...
void ObjectEffect_BeginContextEffect25(void)
Leaves through an exit of kind 0x30 (animation 25), recorded in flag 0x121.
void ObjectEffect_BeginContextEffect26(void)
Leaves through an exit of kind 0x20 (animation 26); flag 0x120 makes the next scene play the matching...
void ObjectDispatch_ReleaseFar(struct DispatchObject *obj)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void ObjectDispatch_InitializeFar(struct DispatchObject *obj, const s32 *script)
void ObjectDispatch_SetAnimationSpeedFar(struct DispatchObject *obj, s32 val)
s32 GameFlag_TestFar(s32 flag)
s32 GameFlag_SetBitFar(s32 flag)
s32 PartyInventory_AddFar(s32 item_id)
void GameFlag_ClearBitFar(s32 flag)
s32 Party_AdjustCoinsFar(s32 amount)
void AudioCommand_PlayFar(s32 id)
void UiWork_SetBusyFlagsFar(s32 flags)
void UiWindow_CreateWithLayoutBoundsFar(s32 flags)
void PartyStatus_CloseFar(void)
void UiText_ShowPositionedMessageAndWaitFar(s32 no, s32 flags)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
const u8 gObjectMotion_StepAngleScript[]
void Object_DestroyIfPresent(void *object)
Releases object unless it is NULL.
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 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...
struct SceneEntries gOverlayArea
#define EVENT_TOUCH_FACING
#define EVENT_TOUCH_WALKING
#define FLAG_NOTHING_HAPPENS
Set before an action on the field; still set afterwards, nothing came of it and the game says so.
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
const u8 gField_TileMessageOffsets[6]
The message of each searchable tile code from 242 to 247, as an offset from MsgTileChecked and MsgTil...
#define Battle_SetStart(mode)
Sets the battle start type.
struct GameState gGameState
void BattleFx_ResumeObject(s32 actorId)
Resumes object id with the update and param kept by BattleEffect_PauseObject.
volatile u32 gKeysHeld
Keys down now.
#define SET_VELOCITY(p, vx, vy, vz)
struct ObjectRuntime * Marker_GetActor(s32 id)
Returns the actor of marker id, or NULL when no slot has it.
void Marker_CloseChest(s32 id)
Closes the chest of marker id again (its item could not be carried), with SE_125.
void Marker_ShowOpened(s32 id)
Shows the chest of marker id open (animation 2), with no sound.
void Marker_OpenChest(s32 id)
Opens the chest of marker id (animation 4) with SE_124, and waits 12 frames.
void Marker_LaunchMimic(s32 id)
Makes the chest of marker id jump up as a mimic: after 18 frames it takes animation 7,...
void Marker_Hide(s32 id)
Hides the actor of marker id by clearing its animationKind.
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
u16 Encounter_GetEnemyGroupAtSlot(s32 zone, s32 slot)
Returns the enemy group in slot (0 to 7) of zone; 14 halfwords make a zone.
void BattleFx_SelectBattleCue(s32 zone, s32 slot)
Chooses the battle music for slot of zone (gGameState.sceneCue).
s32 GameFlag_IsConditionActive(s32 condition)
Returns whether an event condition holds: -1 always holds; a condition with bit 0x1000 holds while th...
struct EffectDescriptor * Scene_FindEvent(s32 kind, s32 target)
Returns the first of the scene's events of kind for target whose condition holds, or NULL.
s32 Scene_TalkToActor(s32 id)
Talks to actor id: shows its event's message or calls its event function, with the actor stopped and ...
s32 Scene_RunTouchOrExit(s32 value)
Runs the touch event (kind 2) of what the leader touched, or else takes its exit (kind 1): plays the ...
s32 Scene_FindActorTalkEvent(s32 id)
Returns the talk event of actor id: for the actor the party has stopped, its kind 7 event if it has o...
s32 Field_SearchTile(s32 tile)
Searches the tile ahead with the given collision code.
UNUSED void Runtime_CallWorkBlockEntry(void)
Nothing calls this.
s32 Scene_RunRaisedEvent(s32 value)
Runs the scene's raised event (kind 6) for value: its message or its function.
struct ScenePlacement * Scene_FindActorPlacement(s32 id)
Returns the placement of actor id in the scene's placement tables, or NULL: for a party character (0 ...
s32 Field_RunPushTileEvent(s32 collisionCode)
Runs the event of a tile the leader pushes against (codes 0xf9 and 0xfc to 0xfe), once it has pushed ...
u32 Event_SearchIgnoresCondition(s32 flags, s32 result)
Returns 1 for a search event (kind 3) that holds whatever its condition: one with more flags than its...
void Leader_StopMoving(void)
Stops the leader where it stands: no horizontal velocity, the normal walking speed (1....
void FieldEvent_End(void)
Ends an event: stops the debug fast-forward callback, gives the camera back to the leader and refresh...
void FieldEvent_WaitFrames(s32 frames)
The event command "wait": waits the requested frames, unless debug fast forward (Event_UpdateDebugSki...
void FieldEvent_Begin(void)
The event command "begin event": closes any timed notice, stops the leader, resets the message and ti...
void FieldEvent_ShowMessageAndWait(s32 actor, s32 flags)
The event command "show message": opens the current message at actor (UiText_OpenMessageAtObject) and...
What every part of object.c shares: its includes and the macros and types more than one part uses.
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
#define MUS_TREASURE_FOUND
s32 BattleFx_GetFlags(s32 id)
Returns the definition flags of actor id's sprite, which choose its line when it has nothing to say.
struct EventWork * gEventWork
void BattleParty_ApplyDrain(s32 amount, s32 unused)
Gives each character in the party amount PP (PP regenerates as the party walks).
A field object as the object dispatcher's far calls take it.
One of the scene's events (the same 12 bytes as struct SceneEvent).
u8 value
the target (an actor or a tile code)
s32 result
below 0x10000 a message, else a function to call
s32 flags
the low 4 bits are the kind (SceneEventKind; 7 talks to the actor the party stopped)
A field actor: a person or thing on the field with a position, motion toward a target,...
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 exit
the exit taken, which ends the scene
s16 event
A raised event for Scene_RunRaisedEvent, or -1 when characters fell to poison or hazard damage,...
const struct SceneEvent * events
the scene's event table
s16 tile
a tile's collision code, for Field_SearchTile
s16 battle
the enemy group of a random encounter
struct ScenePlacement * tables[4]
The placement tables placed so far, recorded by Event_SpawnObjectTable.
s16 blockedSteps
Frames the leader has pushed against something, counted by the player controls; touch events and push...
s16 sceneCue
the battle music chosen for the encounter
s16 pendingDjinnEvent
The Djinni battle pending (DJINNI_0 plus its number, flags in bits 15 to 11), resolved on returning t...
s16 pausedObject
Halt: the stopped object; -1 for none.
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,...
s32 targetZ
16.16 fixed-point pixels; 0x80000000 when unset
u8 actionFlags
FieldActor.steeringFlags: bit 0 faces its motion.
s32 targetY
16.16 fixed-point pixels; 0x80000000 when unset
u8 movementState
nonzero skips its script and motion (paused)
s32 z
16.16 fixed-point pixels
s32 targetX
16.16 fixed-point pixels; 0x80000000 when unset
s32 * script
the object script it runs; null when the object is free
s32 x
16.16 fixed-point pixels
s16 step
the script cursor, in words
s32 y
16.16 fixed-point pixels
struct ObjectRuntime * linkedObject
The object its action script follows or faces.
s16 action
The parameter its action script reads (a follow distance or an angle), or the player's frames to its ...
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...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
u8 talkFacing
enum ActorTalkFacing; 3 follows the leader afterwards
s16 sprite
The actor's sprite; 0 to 7 are the party's characters, each in its own actor slot,...