Alchemy
Loading...
Searching...
No Matches

actor_commands.c

Go to the documentation of this file.
1/// @file
2/// Event commands on actors: placing, moving and animating them.
3/// Part of psynergy_effects.c, compiled only through it.
4
6
7/// Returns an actor, or NULL if it does not exist. Scene scripts reach it
8/// through Actor_Get and OBJ_GET; it is the far-callable form of
9/// ObjectTable_Get that the other banks use.
11 struct FieldActor *object = ObjectTable_Get(actor);
12
13 if (object == NULL)
14 return NULL;
15 return object;
16}
17
18/// The event command "set actor speed": its top speed and acceleration, 16.16
19/// pixels per frame. Writes the actor's speedLimit and acceleration. Scene
20/// scripts reach it as Engine_ActorSetSpeed (OBJ_SPEED, Actor_SetSpeed).
21void ObjectMotion_SetSpeedParameters(u32 objectId, s32 speedLimit,
23 struct ObjectRuntime *object = ObjectTable_Get(objectId);
24
25 if (object != NULL) {
26 object->acceleration = acceleration;
27 object->speedLimit = speedLimit;
28 }
29}
30
31/// Gives an actor an action script (ObjectMotion_SetActionCallback) and lets
32/// it run: sets bit 0 of its actionFlags. Scene scripts reach it as
33/// Engine_ActorEnableActionCallback (Actor_SetActionScript and
34/// Actor_SetBuiltinAction).
36 struct ObjectRuntime *object = ObjectTable_Get(objectId);
37
38 if (object != NULL) {
39 s32 value = 1;
40 value |= object->actionFlags;
41 object->actionFlags = value;
43 }
44}
45
46/// The event command "stop actor": stops its action and puts it back under
47/// event control (dispatch script 6), setting bit 0 of its actionFlags. Scene
48/// scripts reach it as Engine_ActorStop (Actor_Stop), about 22 of them.
50 struct ObjectRuntime *object = ObjectTable_Get(objectId);
51 u8 enabled;
52
53 if (object != NULL) {
54 enabled = 1;
55 object->actionFlags = enabled | object->actionFlags;
57 }
58}
59
60/// Makes an actor follow another (the linked action script): writes its
61/// linkedObject. Called by the Colosso log scene script, and by Altmiller
62/// Cave's as Engine_ActorFollow.
63void Object_LinkObjectAndSetCallback(u32 objectId, u32 linkedObjectId) {
64 struct ObjectRuntime *object = ObjectTable_Get(objectId);
65
66 if (object != NULL) {
67 object->linkedObject =
68 (struct ObjectRuntime *)Object_GetById(linkedObjectId);
71 }
72}
73
74/// Waits, at most 300 frames, for an actor's script to reach its end
75/// (command 0x10). Called by Motion_SetVarCbAndRefresh, the climbing events
76/// and about 28 scene scripts.
78 struct ObjectRuntime *object = ObjectTable_Get(objectId);
79
80 if (object != NULL)
82}
83
84/// Starts a built-in action or supplied script, then waits up to 300 frames for
85/// its script to end. Scene script calls use Actor_RunActionScriptAndWait.
87 struct ObjectRuntime *object = ObjectTable_Get(objectId);
88
89 if (object != NULL) {
90 s32 value = 1;
91 value |= object->actionFlags;
92 object->actionFlags = value;
95 }
96}
97
98/// The event command "set actor destination": the actor heads for (x, z), in
99/// pixels, keeping its current animation. Clears its movementState. Scene
100/// scripts reach it as Engine_ActorSetDestination (Actor_SetDestination).
102 struct ObjectRuntime *object = ObjectTable_Get(objectId);
103
104 if (object != NULL) {
105 object->movementState = 0;
107 Object_SetMoveTargetFar(object, x << 16, object->y, z << 16);
108 }
109}
110
111/// The event command "move actor and wait": as
112/// ObjectMotion_ResetAndSetPosition, then waits (at most 600 frames) for the
113/// actor to arrive. Scene scripts reach it as Engine_ActorMoveToAndWait
114/// (Actor_MoveToAndWait); the climbing events call it too.
116 struct ObjectRuntime *object = ObjectTable_Get(objectId);
117
118 if (object != NULL) {
119 object->movementState = 0;
121 Object_SetMoveTargetFar(object, x << 16, object->y, z << 16);
123 }
124}
125
126/// The event command "walk actor to": the actor walks (animation 2) toward
127/// (x, z), in pixels. Scene scripts reach it as Engine_ActorWalkTo (OBJ_WALK,
128/// Actor_WalkTo); the link lobby calls it too.
130 struct ObjectRuntime *object = ObjectTable_Get(objectId);
131
132 if (object != NULL) {
133 object->movementState = 0;
136 Object_SetMoveTargetFar(object, x << 16, object->y, z << 16);
137 }
138}
139
140/// The event command "walk actor to and wait": walks the actor to (x, z), in
141/// pixels, waits for it to arrive and stands it still (animation 1). Scene
142/// scripts reach it as Engine_ActorWalkToAndWait (Actor_WalkToAndWait).
144 struct ObjectRuntime *object = ObjectTable_Get(objectId);
145
146 if (object != NULL) {
147 object->movementState = 0;
150 Object_SetMoveTargetFar(object, x << 16, object->y, z << 16);
153 }
154}
155
156/// The event command "center actor and walk": walks the actor sideways to the
157/// middle of its 16-pixel column, sets its sprite priority to priority
158/// (ObjectMotion_SetActionVariant), then sends it zOffset pixels along z.
159/// Kalay's interiors reach it as Engine_ActorCenterAndWalk.
160void ObjectMotion_CenterOnColumn(u32 objectId, s32 priority, s32 zOffset) {
161 struct ObjectRuntime *object;
162 s16 pixelX;
163 s32 columnX;
164 s16 offsetInColumn;
165
166 object = ObjectTable_Get(objectId);
167 if (object != NULL) {
168 // Round down to the column's left edge (toward minus infinity, so the
169 // same holds left of 0); the column's middle is 8 pixels in.
170 pixelX = ((union FieldCoordinate *)&object->x)->part.pixel;
171 columnX = pixelX;
172 if (pixelX < 0) {
173 columnX += 15;
174 }
175 columnX >>= 4;
176 columnX *= 16;
177 offsetInColumn = pixelX - columnX;
178 object->movementState = 0;
181 Object_SetMoveTargetFar(object, object->x + ((8 - offsetInColumn) << 16),
182 object->y, object->z);
184 ObjectMotion_SetActionVariant(objectId, priority);
185 Object_SetMoveTargetFar(object, object->x, object->y,
186 object->z + (zOffset << 16));
187 }
188}
189
190/// The event command "set actor destination offset": the actor heads
191/// (xOffset, zOffset) pixels from where it stands. Scene scripts reach it as
192/// Engine_ActorSetDestinationOffset (Actor_SetDestinationOffset);
193/// Motion_LaunchFromFocusedObject calls it too.
195 s32 zOffset) {
196 struct ObjectRuntime *object = ObjectTable_Get(objectId);
197
198 if (object != NULL) {
199 object->movementState = 0;
201 Object_SetMoveTargetFar(object, object->x + (xOffset << 16), object->y,
202 object->z + (zOffset << 16));
203 }
204}
205
206/// Walks the actor (animation 2) (xOffset, zOffset) pixels from where it
207/// stands. Scene scripts reach it as Engine_ActorWalkBy (Actor_WalkBy);
208/// ObjectMotion_CommitPositionAndActivate calls it too.
210 s32 zOffset) {
211 struct ObjectRuntime *object = ObjectTable_Get(objectId);
212
213 if (object != NULL) {
214 object->movementState = 0;
217 Object_SetMoveTargetFar(object, object->x + (xOffset << 16), object->y,
218 object->z + (zOffset << 16));
219 }
220}
221
222/// Walks the actor (xOffset, zOffset) pixels, waits for it to arrive and
223/// stands it still. Scene scripts reach it as Engine_ActorWalkByAndWait
224/// (Actor_WalkByAndWait); the Lemurian ship calls it by name.
226 s32 zOffset) {
227 struct ObjectRuntime *object = ObjectTable_Get(objectId);
228
229 ObjectMotion_OffsetPositionAndReset(objectId, xOffset, zOffset);
230 if (object != NULL) {
233 }
234}
235
236/// Places an actor on the leader and sends it walking (xOffset, zOffset)
237/// pixels away at speed 0.6 and acceleration 0.3, through the launch script;
238/// the actor then takes action action. Called by the Lemurian ship, Babi
239/// Lighthouse and Lalivero scene scripts.
240void Motion_LaunchFromFocusedObject(u32 objectId, s32 xOffset, s32 zOffset,
241 s32 action) {
242 struct ObjectRuntime *object = ObjectTable_Get(objectId);
243
244 if (object != NULL) {
245 struct ObjectRuntime *leader;
246
247 ObjectMotion_SetSpeedParameters(objectId, 0x9999, 0x4CCC);
249 if (leader != NULL)
251 leader->z);
252 object->movementState = 0;
254 ObjectMotion_OffsetPositionAndResetMotion(objectId, xOffset, zOffset);
257 object->action = action;
258 }
259}
260
261/// The event command "wait for actor": waits (at most 600 frames) for the actor
262/// to arrive and stands it still. Scene scripts reach it as
263/// Engine_ActorWaitForMove (Actor_WaitForMove); the link lobby and the
264/// climbing events call it too.
266 struct ObjectRuntime *object = ObjectTable_Get(objectId);
267
268 if (object != NULL) {
271 }
272}
273
274/// The event command "set actor position": puts the actor at (x, z), 16.16
275/// pixels, at rest. An actor that follows the ground (flag 1) keeps its height
276/// above the terrain at the new place. Clears its velocity and targets. Scene
277/// scripts reach it as Engine_ActorSetPosition (OBJ_POS_SET,
278/// Actor_SetPosition); Motion_LaunchFromFocusedObject calls it too.
280 struct ObjectRuntime *object;
282 s32 tileX;
283 s32 tileZ;
285
286 object = ObjectTable_Get(objectId);
287 if (object != NULL) {
289 SET_VELOCITY(object, 0, 0, 0);
290 object->targetY = ACTOR_NO_TARGET;
291 object->targetX = ACTOR_NO_TARGET;
292 object->x = x;
293 object->z = z;
294 // Swap the old ground's height for the new one, so the actor's height
295 // above the ground is kept. The tile coordinates round toward minus
296 // infinity.
297 if (1 & object->flags) {
298 terrainId = object->terrainId;
299 tileX = x;
300 if (tileX < 0) {
301 tileX += 0xFFFF;
302 }
303 tileX >>= 0x10;
304 tileZ = z;
305 if (tileZ < 0) {
306 tileZ += 0xFFFF;
307 }
308 tileZ >>= 0x10;
309 terrainHeight = Map_GetTerrainHeightFar(terrainId, tileX, tileZ) << 0x10;
310 object->y = (object->y - object->terrainHeight) + terrainHeight;
311 object->terrainHeight = terrainHeight;
312 }
313 }
314}
315
316/// Puts the actor at (x, y, z), 16.16 pixels, at rest; an actor that follows
317/// the ground (flag 1) is raised by the terrain height there. Nothing in ☀️
318/// calls it.
320 struct ObjectRuntime *object;
322 s32 tileX;
323 s32 tileZ;
324
325 object = ObjectTable_Get(objectId);
326 if (object != NULL) {
328 SET_VELOCITY(object, 0, 0, 0);
329 object->targetY = ACTOR_NO_TARGET;
330 object->targetX = ACTOR_NO_TARGET;
331 SET_POSITION(object, x, y, z);
332 if (1 & object->flags) {
333 s32 terrainId = object->terrainId;
334 tileX = x;
335 if (tileX < 0) {
336 tileX += 0xFFFF;
337 }
338 tileX >>= 0x10;
339 tileZ = z;
340 if (tileZ < 0) {
341 tileZ += 0xFFFF;
342 }
343 terrainHeight = Map_GetTerrainHeightFar(terrainId, tileX, tileZ >> 0x10)
344 << 0x10;
345 object->y = (object->y - object->terrainHeight) + terrainHeight;
346 object->terrainHeight = terrainHeight;
347 }
348 }
349}
350
351/// The event command "set actor animation" (1 stands, 2 walks, 3 nods, 4 shakes
352/// the head and so on). Scene scripts reach it as Engine_ActorSetAnimation
353/// (OBJ_MODE, Actor_SetAnimation); Event_AskYesNoWithActorAnimation and
354/// Motion_SetModeAndWaitAnimation call it too.
356 struct ObjectRuntime *object = ObjectTable_Get(objectId);
357
358 if (object != NULL)
360}
361
362/// Sets the animation timer steps of each of an actor's sprites
363/// (AnimationObjects_SetActiveTimerSteps). Called by the Tolbi ship and
364/// Lamakan Desert scene scripts.
365void Object_SetActionById(u32 objectId, s32 steps) {
366 struct ObjectRuntime *object = ObjectTable_Get(objectId);
367
368 if (object != NULL)
370}
371
372/// Waits, at most 90 frames, for an actor's animation to change. Only an actor
373/// drawn as an animation object (animationKind 1) is waited for. Called by
374/// Motion_SetModeAndWaitAnimation, a few scene scripts and the debug level
375/// screen.
377 struct ObjectRuntime *object;
378 struct AnimationObject *sprite;
379 /* FAKEMATCH(volatile): saved lives in a 4-byte frame, stored once and
380 * loaded again for each compare, as the bytes have it; as a plain s32, 29
381 * of 31 instructions differ in tbs-en. */
382 volatile s32 saved;
383 s32 elapsedFrames;
384
385 object = ObjectTable_Get(objectId);
386 if (object != NULL && object->animationKind == 1) {
387 sprite = object->animation;
388 saved = sprite->lastNo;
389 for (elapsedFrames = 0; elapsedFrames <= 89; elapsedFrames++) {
390 WaitFrames(1);
391 if (saved != sprite->lastNo) {
392 break;
393 }
394 }
395 }
396}
397
398/// The event command "set actor animation and wait": plays the animation and
399/// waits for it to end. Scene scripts reach it as
400/// Engine_ActorSetAnimationAndWait (Actor_SetAnimationAndWait).
401void Motion_SetModeAndWaitAnimation(u32 objectId, s32 animation) {
402 Object_SetModeById(objectId, animation);
404}
405
406/// An empty function, reached only through an unnamed veneer in the object
407/// bank's far-call table; nothing in ☀️ names it.
408void ObjectMotion_NoOp(void) {}
409
410/// The event command "actor jump": throws the actor upward at speed pixels per
411/// frame with a jump sound (a higher one above 5), then waits frames frames.
412/// Sets bit 1 of the actor's motion flags and its velocityY. Scene scripts
413/// reach it
414/// as Engine_ActorJump (Actor_Jump), about 40 of them; the scenes of Djinn
415/// joining the party (djinni.c and the four element parts) call it too.
416void ObjectMotion_Launch(u32 objectId, s32 speed, s32 frames) {
417 struct ObjectRuntime *object;
418 u8 *objectFlags;
419 s32 updatedFlags;
420 s32 verticalVelocity;
421
422 object = ObjectTable_Get(objectId);
423 if (object != NULL) {
424 objectFlags = &object->flags;
425 updatedFlags = *objectFlags | 2;
426 verticalVelocity = speed << 16;
427 *objectFlags = updatedFlags;
428 object->velocityY = verticalVelocity;
429 if (speed > 5) {
431 } else {
433 }
434 FieldEvent_WaitFrames(frames);
435 }
436}
437
438/// The event command "start repeated motion": the actor squashes and springs
439/// back count times (1 to 3), through gObjectMotion_VariantScripts. Scene
440/// scripts reach it as Engine_ActorStartRepeatedMotion
441/// (Actor_StartRepeatedMotion).
443 struct ObjectRuntime *object;
444
445 object = ObjectTable_Get(objectId);
446 if (object != NULL && count > 0) {
447 if (count > 3) {
448 count = 3;
449 }
450 // Each count is 32 words of the script; start that many from its end.
452 (struct DispatchObject *)object,
453 (const s32 *)(gObjectMotion_VariantScripts + ((3 - count) << 7)));
454 }
455}
456
457/// The event command "run repeated motion": as ObjectMotion_SetVariantCallback,
458/// then waits for it to end. Scene scripts reach it as
459/// Engine_ActorRunRepeatedMotion (Actor_RunRepeatedMotion); the scenes of
460/// Djinn joining the party call it too.
461void Motion_SetVarCbAndRefresh(u32 objectId, s32 count) {
462 ObjectMotion_SetVariantCallback(objectId, count);
464}
465
466/// Moves a dust puff of FieldFx_SpawnBurstParticle: it drifts with its x and
467/// z velocity (kept in speed and acceleration), which drag slows by 1/18 and
468/// 1/16 each frame, and rises 1/64 pixel a frame. Runs each frame as the
469/// puff's update hook.
471 struct FieldActor *particle = (struct FieldActor *)fieldObject;
473 s32 x;
475 s32 z;
476 s32 y;
477 s32 roundedZ;
478 velocityX = particle->speed;
479 x = particle->x.fixed + velocityX;
480 particle->x.fixed = x;
481 particle->targetX = x;
482 velocityZ = particle->acceleration;
483 z = particle->z.fixed + velocityZ;
484 particle->z.fixed = z;
485 particle->targetZ = z;
486 y = particle->y.fixed + 0x400;
487 particle->y.fixed = y;
488 particle->targetY = y;
489 particle->speed = (velocityX - velocityX / 0x12);
490
491 roundedZ = velocityZ;
492 if (velocityZ < 0) {
493 roundedZ += 0xF;
494 }
495 particle->acceleration = (velocityZ - (roundedZ >> 4));
496}
497
498/// Kicks up a dust puff (object 222) where source stands: it flies off toward
499/// the back at 0.5 to 1.4 pixels a frame and sideways at up to 1.4, with one
500/// of two animations. A nonzero param is given to its sprite parts
501/// (ObjectGroup_SetChildValue). Only Actor_JumpDownLedge calls it.
502void FieldFx_SpawnBurstParticle(struct FieldActor *source, s32 param) {
503 struct FieldActor *object;
504 struct AnimationObject *child;
505 s32 speed;
506
507 object = (struct FieldActor *)Object_CreateFar(
508 222, source->x.fixed, source->y.fixed, source->z.fixed);
509 if (object != 0) {
510 child = object->sprite;
511 switch (Random16() & 1) {
512 case 1:
516 break;
517 default:
521 break;
522 }
523
524 if (param != 0)
525 ObjectGroup_SetChildValue(object, param);
526
527 // speed and acceleration hold the puff's x and z velocity, in steps of
528 // 0x1999 (0.1 pixel): z is -0.5 to -1.4, x -1.4 to 1.4 in steps of 0.2.
529 object->motionFlags = 0;
530 speed = Random16() % 10 + 5;
531 object->acceleration = -0x1999 * speed;
532 speed = Random16() % 15 - 7;
533 speed <<= 1;
534 object->speed = 0x1999 * speed;
535 object->timer = 0;
536 object->update = FieldFx_UpdateParticleLinearMotion;
537 child->flags = 0;
538 child->image.priority = source->sprite->image.priority;
539 }
540}
541
542/// Makes an actor jump down off a ledge in front of it (the field runs it for
543/// the leader when the player presses down at a ledge): it shows pose for 10
544/// frames, hops, spins round while sinking 28 pixels with a dust puff every
545/// other frame (none when param is -1), then jumps 16 pixels forward and lands.
546/// The landing plays the queued sound (BattleFx_PlayQueuedSound). Called by
547/// Field_RunPushTileEvent for a ledge (collision code 0xfc) with pose 6 and
548/// param 0.
549void Actor_JumpDownLedge(s32 actor, s32 pose, s32 param) {
550 s32 nextY;
551 s32 startZ;
552 struct ObjectRuntime *object;
553 u8 *objectFlags;
554
555 object = (struct ObjectRuntime *)Object_GetById(actor);
556 startZ = object->z;
557 if (object != 0) {
560 WaitFrames(10);
561
562 // Hop up and forward 12 pixels.
563 objectFlags = &object->flags;
565 {
566 u8 flags = 2;
567 flags |= *objectFlags;
568 *objectFlags = flags;
569 }
570 object->velocityY = 0x40000;
571 Object_SetMoveTargetFar(object, object->x, object->y, startZ + 0xC0000);
572 WaitFrames(6);
573
574 // Spin and sink 2 pixels a frame for 14 frames, raising dust.
576 // From here pose counts frames.
577 pose = 0;
578 ObjectMotion_ArmCallback(actor, 0x5000, 0);
579 *objectFlags = 0;
580 do {
581 nextY = object->y + 0xFFFE0000;
582 object->y = nextY;
583 object->targetY = nextY;
584 WaitFrames(1);
585 if ((param != -1) && (pose & 1)) {
586 FieldFx_SpawnBurstParticle((struct FieldActor *)object, param);
587 }
588 pose++;
589 } while ((u32)pose <= 0xD);
590
591 // Jump 16 pixels forward and wait (at most 180 frames) to land.
592 *objectFlags = 3;
593 object->velocityY = 0x30000;
594 Object_SetMoveTargetFar(object, object->x, object->y, startZ + 0x100000);
596 for (pose = 0; (u32)pose <= 0xB3 && object->y > object->terrainHeight;
597 pose++) {
598 WaitFrames(1);
599 }
600 WaitFrames(2);
602 }
603}
604
605/// The event command "actor face actor": turns the first actor at once to face
606/// the second, then waits wait frames. Writes the first actor's angle. Scene
607/// scripts reach it as Engine_ActorFaceActor (OBJ_FACE, Actor_FaceActor); the
608/// link lobby calls it too.
609void ObjectMotion_SetAngleToward(s32 firstId, s32 secondId, s32 wait) {
610 struct ObjectRuntime *first;
611 struct ObjectRuntime *second;
612
613 first = ObjectTable_Get(firstId);
614 second = ObjectTable_Get(secondId);
615 if (first != 0 && second != 0) {
616 first->angle = ArcTan2(second->z - first->z, second->x - first->x);
618 }
619}
620
621/// The event command "actors face each other": turns two actors toward each
622/// other, then waits wait frames. Scene scripts reach it as
623/// Engine_ActorFaceEachOther (Actor_FaceEachOther); Scene_TalkToActor turns
624/// the leader and the actor spoken to with it.
625void Object_LinkPair(s32 firstId, s32 secondId, s32 wait) {
626 void *first = ObjectTable_Get(firstId);
627 void *second = ObjectTable_Get(secondId);
628
629 if (first != NULL && second != NULL) {
632 }
633}
634
635/// Turns two actors to face each other, at most 1/16 turn a frame each, until
636/// both do (at most 60 frames). Only Object_LinkPair calls it.
638 struct FacingObject *secondObject) {
639 struct ObjectRuntime *first = (struct ObjectRuntime *)firstObject;
640 struct ObjectRuntime *second = (struct ObjectRuntime *)secondObject;
641 s32 firstTargetAngle;
642 s32 secondTargetAngle;
643 s32 frame;
644 s32 actorsTurning;
645 s32 angleDifference;
646
647 if (first == NULL || second == NULL)
648 return;
649 firstTargetAngle = (u16)ArcTan2(second->z - first->z, second->x - first->x);
650 // The second actor faces the opposite way, half a turn round.
651 secondTargetAngle = firstTargetAngle + 0x8000;
652 for (frame = 0; frame < 60; frame++) {
653 // Each actor that already faces its way takes one off the count; both
654 // facing ends the turn early.
655 actorsTurning = 2;
656 angleDifference = (s16)(firstTargetAngle - first->angle);
657 if (angleDifference != 0) {
658 if (angleDifference > 0x1000)
659 angleDifference = 0x1000;
660 if (angleDifference < -0x1000)
661 angleDifference = -0x1000;
662 first->angle += angleDifference;
663 } else {
664 actorsTurning = 1;
665 }
666 angleDifference = (s16)(secondTargetAngle - second->angle);
667 if (angleDifference != 0) {
668 if (angleDifference > 0x1000)
669 angleDifference = 0x1000;
670 if (angleDifference < -0x1000)
671 angleDifference = -0x1000;
672 second->angle += angleDifference;
673 } else {
674 actorsTurning--;
675 }
676 if (actorsTurning == 0)
677 break;
678 WaitFrames(1);
679 }
680}
681
682#ifndef UBFIX
683/// The event work seen as its actor slots, which the actor commands index by
684/// actor number.
686 u8 unk00[0x14];
688};
689
690STATIC_ASSERT(offsetof(struct ObjectSlotTable, slots) == 0x14);
691#endif
692
693/// The event command "destroy actor": releases the actor and frees its slot,
694/// writing NULL to its place in the field work's actor table. Scene scripts
695/// reach it as Engine_ActorDestroy (about 14 of them).
697 void *object = ObjectTable_Get(index);
698#ifdef UBFIX
699 struct FieldWork *table = (struct FieldWork *)gEventWork;
700 struct ObjectRuntime *empty = NULL;
701#else
702 struct ObjectSlotTable *table = (struct ObjectSlotTable *)gEventWork;
703#endif
704
705 if (object != 0) {
707#ifdef UBFIX
708 // The getter accepts slots through 191, including nonactor storage.
709 // Copy the pointer representation without extending the actor array.
710 memcpy((u8 *)table + 0x14 + index * sizeof(void *), &empty, sizeof(empty));
711#else
712 table->slots[index] = NULL;
713#endif
714 }
715}
716
718
719/// The event command "set actor sprite param": gives every sprite part of the
720/// actor param (ObjectGroup_SetChildValue). With bit 0x100 set the actor
721/// blinks instead (ObjectGroup_ApplyIndexedChildValue, every frame); any other
722/// param also ends a blink, clearing the actor's hook. Scene scripts reach it
723/// as Engine_ActorSetChildValue (Actor_SetChildValue).
725 s32 blink;
726 struct DispatchObject *object;
727
728 object = ObjectTable_Get(objectId);
729 if (object != NULL) {
730 blink = 0x100 & param;
731 if (blink != 0) {
732 ((struct ScriptMotionObject *)object)->hook =
734 return;
735 }
736 ((struct ScriptMotionObject *)object)->hook = NULL;
737 ObjectGroup_SetChildValue((struct FieldActor *)object, param);
738 }
739}
740
741/// Per-frame hook of a blinking actor: sets its sprite parts' param from
742/// gObjectGroup_BlinkChildValues (7 for two frames out of eight, otherwise 0).
743/// ObjectGroup_ConfigureChildValue installs it.
745 struct DispatchObject *object = (struct DispatchObject *)fieldObject;
746
747 if ((object->kind & 0xf) == 1) {
748 u8 param;
749 struct AnimationObject *container;
750 u8 partCount;
751
752 // The table's four entries each last two frames.
753 param = gObjectGroup_BlinkChildValues[(gFrameCount >> 1) & 3];
754 container = object->target.child;
755 partCount = container->count;
756 if (partCount != 0) {
757 struct AnimationEntry **entries = container->entries;
758 s32 remaining = partCount;
759 do {
760 struct AnimationEntry *entry = *entries++;
761 if (entry != 0 && entry->script != 0) {
762 entry->param = param;
763 }
764 remaining--;
765 } while (remaining != 0);
766 }
767 container->dirty = 1;
768 }
769}
770
771/// Sets the param byte of every animated part of an actor's sprite. Scenes set
772/// 0 or 15, and alternate the two to make an actor flash. Marks the sprite
773/// dirty. Called by ObjectGroup_ConfigureChildValue, FieldFx_SpawnBurstParticle
774/// and about 40 scene script sites.
776 struct DispatchObject *object = (struct DispatchObject *)actor;
777
778 if ((object->kind & 0xf) == 1) {
779 struct AnimationObject *container = object->target.child;
780 u8 partCount = container->count;
781
782 if (partCount != 0) {
783 struct AnimationEntry **entry = container->entries;
784 u32 count = partCount;
785 do {
786 struct AnimationEntry *part = *entry++;
787 if (part != NULL && part->script != 0) {
788 part->param = param;
789 }
790 count--;
791 } while (count != 0);
792 }
793 container->dirty = 1;
794 }
795}
796
797/// Links an actor to the actor in the low 8 bits of targetId and starts script
798/// on it. Unless ACTOR_LINK_KEEP_MOTION is set it takes action 40 and the
799/// target's top speed with twice its acceleration, to keep up with it. Called
800/// by Vale's, Bilibin's, Imil's, Kolima's and McCoy's palace scene scripts,
801/// among others.
802void Object_SetTargetAndCallback(u32 objectId, s32 targetId,
803 const void *script) {
804 struct ObjectRuntime *follower = ObjectTable_Get(objectId);
805 struct ObjectRuntime *target = ObjectTable_Get(targetId & 0xff);
806
807 if (follower != NULL && target != NULL) {
808 follower->linkedObject = target;
809 if (!(targetId & ACTOR_LINK_KEEP_MOTION)) {
810 follower->action = 40;
811 follower->acceleration = target->acceleration * 2;
812 follower->speedLimit = target->speedLimit;
813 follower->collisionFlags = 0;
814 }
816 }
817}
818
819/// Script step that turns an actor toward the angle kept in its action: the
820/// whole way when within 1/16 turn, otherwise 1/32 turn. Returns the turn
821/// made, 0 once the actor faces that way. gObjectMotion_StepAngleScript and
822/// gObjectMotion_LaunchScript run it through their script command 34.
824 s32 delta = 0;
825
826 if (object != NULL) {
827 s32 targetAngle = (u16)object->action;
828 s32 currentAngle = object->angle;
829 delta = (s16)(targetAngle - currentAngle);
830 if (delta != 0) {
831 if (delta > 4096)
832 delta = 2048;
833 if (delta < -4096)
834 delta = -2048;
835 object->angle = currentAngle + delta;
836 }
837 }
838 return delta;
839}
840
841/// Clears an actor's destination, puts it under event control and stands it
842/// still. Reached only through an unnamed veneer in the object bank's
843/// far-call table; nothing in ☀️ names it.
845 struct ObjectRuntime *object = ObjectTable_Get(objectId);
846
847 if (object != NULL) {
848 object->targetX = ACTOR_NO_TARGET;
849 object->targetY = ACTOR_NO_TARGET;
850 object->targetZ = ACTOR_NO_TARGET;
853 }
854}
855
856/// The event command "actor face direction": the actor turns toward angle
857/// (0x10000 a full turn; ObjectMotion_StepAngle), then the event waits wait
858/// frames. Writes the angle to the actor's action. Scene scripts reach it as
859/// Engine_ActorFaceDirection (OBJ_DIR, Actor_FaceDirection); the Djinni,
860/// Retreat and climbing events and Actor_JumpDownLedge call it too.
862 struct ObjectRuntime *object = ObjectTable_Get(objectId);
863
864 if (object != NULL) {
865 object->action = angle;
869 }
870}
871
872/// The event command "set actor sprite priority": fixes the priority of the
873/// actor's sprite, which then no longer follows its depth: clears
874/// ACTOR_PRIORITY_AUTOMATIC. Scene scripts reach it as
875/// Engine_ActorSetSpritePriority (Actor_SetSpritePriority);
876/// ObjectMotion_CenterOnColumn calls it too.
877void ObjectMotion_SetActionVariant(s32 objectId, s32 priority) {
878 struct ObjectRuntime *object = ObjectTable_Get(objectId);
879
880 if (object != NULL && (object->animationKind & 0xF) == 1) {
881 struct AnimationObject *sprite = object->animation;
882
883 sprite->image.priority = priority;
884 sprite->shadow.priority = priority;
885 object->priorityFlags &= ~ACTOR_PRIORITY_AUTOMATIC;
886 }
887}
888
889/// Makes the target actor's sprite show the source actor's graphics (its VRAM
890/// block and tile). Neither actor is checked for NULL. Called by the Tolbi
891/// ship deck's scene script.
892void ObjectVisual_CopyAttributes(u32 targetId, u32 sourceId) {
893 struct ObjectRuntime *object;
894 struct AnimationObject *sprite;
895 u8 vramBlock;
896 u32 tile;
897
898 object = (struct ObjectRuntime *)Object_GetById(sourceId);
899 sprite = object->animation;
900 vramBlock = sprite->slot;
901 tile = sprite->image.tile;
902
903 object = (struct ObjectRuntime *)Object_GetById(targetId);
904 sprite = object->animation;
905 sprite->slot = vramBlock;
906 sprite->image.tile = tile;
907}
908
910
911/// The event command "set message": the number of the event's next message,
912/// written to work->message. Scene scripts reach it as
913/// Engine_EventSetMessage (MESSAGE_SET); the field's talk, touch, item and
914/// Psynergy events call it too.
915void Event_SetMessageId(s32 message) {
916 ((struct FieldWork *)gEventWork)->message = message;
917}
918
919/// Returns the sprite (the first animation's id) of the actor in the low 12
920/// bits of actor, or -1 if there is no such animated actor. The message
921/// commands (messages.c) call it to find the speaker's portrait and voice.
923#ifdef UBFIX
924 struct FieldWork *state = (struct FieldWork *)gEventWork;
925 s32 sprite = -1;
926 struct ObjectRuntime *entry;
927
928 actor &= 0x0fff;
929 // BUG: the -1 sentinel becomes index 4095, beyond the event work. All
930 // indices from 66 to 4095 lie outside the actor table.
931 if (actor >= 66)
932 return -1;
933 entry = (struct ObjectRuntime *)state->actors[actor];
934#else
935 struct FieldWork *state = (struct FieldWork *)gEventWork;
936 s32 sprite = -1;
937 struct ObjectRuntime *entry =
938 (struct ObjectRuntime *)state->actors[actor & 0x0fff];
939#endif
940
941 if (entry != 0 && entry->animationKind == 1)
942 sprite = ((struct AnimationObject *)entry->animation)->entries[0]->animId;
943 return sprite;
944}
945
946/// Returns the first scene actor (8 to 65) showing sprite, or -1. Reached
947/// only through an unnamed veneer in the object bank's far-call table;
948/// nothing in ☀️ names it.
950 struct FieldWork *state = (struct FieldWork *)gEventWork;
951 s32 result = -1;
952 s32 index;
953 struct ObjectRuntime *object;
954
955 for (index = 8; index <= 65; index++) {
956 object = (struct ObjectRuntime *)state->actors[index];
957 if (object != 0 && object->animationKind == 1 &&
958 ((struct AnimationObject *)object->animation)->entries[0]->animId ==
959 sprite) {
960 result = index;
961 break;
962 }
963 }
964 return result;
965}
void ObjectMotion_SetSpeedParameters(u32 objectId, s32 speedLimit, s32 acceleration)
The event command "set actor speed": its top speed and acceleration, 16.16 pixels per frame.
void ObjectVisual_CopyAttributes(u32 targetId, u32 sourceId)
Makes the target actor's sprite show the source actor's graphics (its VRAM block and tile).
void ObjectMotion_CommitCurrentPositionAndActivate(u32 objectId)
The event command "wait for actor": waits (at most 600 frames) for the actor to arrive and stands it ...
void ObjectMotion_ResetAndSetPositionInMode2(u32 objectId, s32 x, s32 z)
The event command "walk actor to": the actor walks (animation 2) toward (x, z), in pixels.
void Motion_SetVarCbAndRefresh(u32 objectId, s32 count)
The event command "run repeated motion": as ObjectMotion_SetVariantCallback, then waits for it to end...
void ObjectMotion_NoOp(void)
An empty function, reached only through an unnamed veneer in the object bank's far-call table; nothin...
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...
s32 ObjectMotion_StepAngle(struct ObjectRuntime *object)
Script step that turns an actor toward the angle kept in its action: the whole way when within 1/16 t...
void ObjectMotion_Launch(u32 objectId, s32 speed, s32 frames)
The event command "actor jump": throws the actor upward at speed pixels per frame with a jump sound (...
void Object_ResetTargetAndSetMode1(u32 objectId)
Clears an actor's destination, puts it under event control and stands it still.
void ObjectTable_DestroyById(s32 index)
The event command "destroy actor": releases the actor and frees its slot, writing NULL to its place i...
s32 ObjectTable_ReadActiveValue(s32 actor)
Returns the sprite (the first animation's id) of the actor in the low 12 bits of actor,...
void FieldFx_UpdateParticleLinearMotion(union FieldObject *fieldObject)
Moves a dust puff of FieldFx_SpawnBurstParticle: it drifts with its x and z velocity (kept in speed a...
void ObjectMotion_CenterOnColumn(u32 objectId, s32 priority, s32 zOffset)
The event command "center actor and walk": walks the actor sideways to the middle of its 16-pixel col...
void ObjectGroup_SetChildValue(struct FieldActor *actor, s32 param)
Sets the param byte of every animated part of an actor's sprite.
void Object_SetActionCallbackAndRefreshById(u32 objectId, s32 action)
Starts a built-in action or supplied script, then waits up to 300 frames for its script to end.
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
void ObjectMotion_SetHorizontalPositionWithTerrain(u32 objectId, s32 x, s32 z)
The event command "set actor position": puts the actor at (x, z), 16.16 pixels, at rest.
UNUSED void ObjectVisual_ReservedNoOp(void)
void ObjectMotion_ResetAndSetPosition(u32 objectId, s32 x, s32 z)
The event command "set actor destination": the actor heads for (x, z), in pixels, keeping its current...
void Motion_SetModeAndWaitAnimation(u32 objectId, s32 animation)
The event command "set actor animation and wait": plays the animation and waits for it to end.
void ObjectGroup_ApplyIndexedChildValue(union FieldObject *fieldObject)
Per-frame hook of a blinking actor: sets its sprite parts' param from gObjectGroup_BlinkChildValues (...
void ObjectMotion_EnableActionAndSetCallback(u32 objectId, s32 action)
Gives an actor an action script (ObjectMotion_SetActionCallback) and lets it run: sets bit 0 of its a...
void ObjectMotion_ArmCallback(s32 objectId, s32 angle, s32 wait)
The event command "actor face direction": the actor turns toward angle (0x10000 a full turn; ObjectMo...
void FieldFx_SpawnBurstParticle(struct FieldActor *source, s32 param)
Kicks up a dust puff (object 222) where source stands: it flies off toward the back at 0....
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 Object_SetTargetAndCallback(u32 objectId, s32 targetId, const void *script)
Links an actor to the actor in the low 8 bits of targetId and starts script on it.
void ObjectMotion_CommitPositionAndActivate(u32 objectId, s32 xOffset, s32 zOffset)
Walks the actor (xOffset, zOffset) pixels, waits for it to arrive and stands it still.
void ObjectMotion_OffsetPositionAndResetMotion(u32 objectId, s32 xOffset, s32 zOffset)
The event command "set actor destination offset": the actor heads (xOffset, zOffset) pixels from wher...
void Object_LinkObjectAndSetCallback(u32 objectId, u32 linkedObjectId)
Makes an actor follow another (the linked action script): writes its linkedObject.
void ObjectMotion_SetVariantCallback(u32 objectId, s32 count)
The event command "start repeated motion": the actor squashes and springs back count times (1 to 3),...
void Motion_LaunchFromFocusedObject(u32 objectId, s32 xOffset, s32 zOffset, s32 action)
Places an actor on the leader and sends it walking (xOffset, zOffset) pixels away at speed 0....
s32 ObjectTable_FindActiveByValue(s32 sprite)
Returns the first scene actor (8 to 65) showing sprite, or -1.
void ObjectMotion_SetPositionWithTerrain(u32 objectId, s32 x, s32 y, s32 z)
Puts the actor at (x, y, z), 16.16 pixels, at rest; an actor that follows the ground (flag 1) is rais...
void FacingObject_TurnPairToFaceEachOther(struct FacingObject *firstObject, struct FacingObject *secondObject)
Turns two actors to face each other, at most 1/16 turn a frame each, until both do (at most 60 frames...
void ObjectMotion_SetPositionAndReset(u32 objectId, s32 x, s32 z)
The event command "walk actor to and wait": walks the actor to (x, z), in pixels, waits for it to arr...
void Event_SetMessageId(s32 message)
The event command "set message": the number of the event's next message, written to work->message.
void ObjectMotion_WaitForAnimationChange(u32 objectId)
Waits, at most 90 frames, for an actor's animation to change.
void ObjectMotion_OffsetPositionAndReset(u32 objectId, s32 xOffset, s32 zOffset)
Walks the actor (animation 2) (xOffset, zOffset) pixels from where it stands.
void ObjectMotion_SetPositionAndCommit(u32 objectId, s32 x, s32 z)
The event command "move actor and wait": as ObjectMotion_ResetAndSetPosition, then waits (at most 600...
void ObjectMotion_EnableActionAndResetMotion(u32 objectId)
The event command "stop actor": stops its action and puts it back under event control (dispatch scrip...
void Object_SetActionById(u32 objectId, s32 steps)
Sets the animation timer steps of each of an actor's sprites (AnimationObjects_SetActiveTimerSteps).
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void ObjectMotion_SetAngleToward(s32 firstId, s32 secondId, s32 wait)
The event command "actor face actor": turns the first actor at once to face the second,...
UNUSED void ObjectTable_DestroyNoOp(void)
void Object_SetModeById(u32 objectId, s32 animation)
The event command "set actor animation" (1 stands, 2 walks, 3 nods, 4 shakes the head and so on).
void ObjectGroup_ConfigureChildValue(s32 objectId, s32 param)
The event command "set actor sprite param": gives every sprite part of the actor param (ObjectGroup_S...
void ObjectMotion_SetActionVariant(s32 objectId, s32 priority)
The event command "set actor sprite priority": fixes the priority of the actor's sprite,...
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.
Definition actors.c:462
const u8 gObjectMotion_LinkedActionScript[]
struct ObjectRuntime * Object_CreateFar(s32 id, s32 x, s32 y, s32 z)
Far call to FieldObject_Create.
void ObjectDispatch_ReleaseFar(struct DispatchObject *obj)
s32 Map_GetTerrainHeightFar(s32 layer, s32 x, s32 y)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void ObjectDispatch_InitializeFar(struct DispatchObject *obj, const s32 *script)
void ObjectDispatch_SetAnimationSpeedFar(struct DispatchObject *obj, s32 val)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
void ObjectDispatch_WaitForValue16Far(void *raw)
void FieldObject_WaitForMoveFar(void *fieldObject)
void ObjectDispatch_StartIdleFar(struct DispatchObject *obj)
void AudioCommand_PlayFar(s32 id)
u8 gObjectMotion_LaunchScript
const u8 gObjectMotion_StepAngleScript[]
const u8 gBattleFx_BurstParticleScriptB[]
const u8 gBattleFx_BurstParticleScriptA[]
@ ACTOR_LINK_KEEP_MOTION
Definition field_obj.h:148
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
Definition field_obj.h:153
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
Definition field_obj.h:145
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
Definition frame.c:97
volatile u32 gFrameCount
Frames WaitFrames has finished.
const s32 gObjectMotion_VariantScripts[97]
Squashes as many times as the variant (1 to 3): variant v starts at word (3 - v) * 32 and runs to the...
Definition fxdata.c:300
const u8 gObjectGroup_BlinkChildValues[4]
A child value by frame ((gFrameCount >> 1) & 3).
Definition fxdata.c:344
struct GameState gGameState
#define SET_VELOCITY(p, vx, vy, vz)
Definition macros.h:18
#define SET_POSITION(p, px, py, pz)
Sets the position or the velocity of a particle, a piece of debris or an object in one statement.
Definition macros.h:16
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
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,...
Definition math.c:36
void FieldEvent_WaitFrames(s32 frames)
The event command "wait": waits the requested frames, unless debug fast forward (Event_UpdateDebugSki...
Definition events.c:55
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
Definition requests.c:102
#define SE_217
Definition songs.h:212
#define SE_JUMP
An actor jumps: ObjectMotion_Launch plays the high jump above 5 pixels a frame.
Definition songs.h:147
#define SE_289
Definition songs.h:282
#define SE_HIGH_JUMP
Definition songs.h:148
struct EventWork * gEventWork
#define NULL
Definition bilibin.h:6
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
One animation layer of a sprite: its animation id, frames, running script and timer.
Definition animspr.h:37
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
Definition animspr.h:45
u8 * script
the running script; null when stopped (ANIM_CMD_END)
Definition animspr.h:50
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
struct AnimationSpritePart shadow
Definition animspr.h:110
struct AnimationSpritePart image
Definition animspr.h:109
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
Definition animspr.h:128
u8 lastNo
The animation number last selected, which selecting again skips.
Definition animspr.h:124
u8 slot
VRAM cache entry holding its tiles.
Definition animspr.h:112
struct AnimationEntry * entries[4]
its layers; empty ones null
Definition animspr.h:130
u8 count
layers in use, up to the last one present
Definition animspr.h:129
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
Definition animspr.h:125
u16 tile
first sprite tile in VRAM
Definition animspr.h:99
u16 priority
2 when created
Definition animspr.h:100
A field object as the object dispatcher's far calls take it.
u8 kind
low four bits: 0 no sprite, 1 one, 2 up to four
A field object seen as one that turns toward its facing target: its facing, its ground position and t...
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
s32 speed
speed limit, 16.16 fixed-point pixels per frame
Definition field_obj.h:55
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:59
union FieldCoordinate x
16.16 fixed-point pixels
Definition field_obj.h:35
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:61
s32 velocityX
16.16 fixed-point pixels per frame
Definition field_obj.h:52
union FieldCoordinate y
16.16 fixed-point pixels
Definition field_obj.h:36
union FieldCoordinate z
16.16 fixed-point pixels
Definition field_obj.h:37
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
Definition field_obj.h:58
s32 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
Definition field_obj.h:60
s32 velocityZ
16.16 fixed-point pixels per frame
Definition field_obj.h:54
Full event work allocated by Field_RunScene (heap slot 27).
s16 message
the next message, advanced as each window opens
struct FieldActor * actors[66]
The actors by id: 0 to 7 the party's characters, 8 on the placed actors.
s32 selectedActor
the leader: its unit and its actor
Definition game_state.h:59
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
u16 angle
1/65536 turns
s32 terrainHeight
16.16 fixed-point pixels
s32 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....
u8 collisionFlags
FieldActor.collisionFlags: bit 0 solid, bit 1 the player pushes it, bits 2 to 4 for talk and Psynergy...
s32 * script
the object script it runs; null when the object is free
u8 flags
FieldActor.motionFlags: 3 when created, 4 for a placed actor above the ground; zero is free flight in...
void * animation
its sprite, or its list of four, by animationKind
u16 wait
the object script's wait, in frames
s32 x
16.16 fixed-point pixels
s32 speedLimit
16.16 fixed-point pixels per frame
s32 y
16.16 fixed-point pixels
u8 animationKind
Low four bits: 0 no sprite, 1 one sprite, 2 a group of up to four.
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 ...
u8 terrainId
the map layer its ground height is read from
The event work seen as its actor slots, which the actor commands index by actor number.
struct ObjectRuntime * slots[0]
A field object as the motion code sees it: its script, position, motion toward a target,...
void(*) hook(union FieldObject *object)
Called each frame before its script.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
#define UNUSED
Definition types.h:22
unsigned char u8
Definition types.h:11
A field coordinate, read whole or as its fraction and its whole pixels.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
void * memcpy(void *destination, const void *source, unsigned long size)