Alchemy
Loading...
Searching...
No Matches

actor_motion.c File Reference

Actor scripts: moving, turning and the built-in actions. More...

Go to the source code of this file.

Functions

s32 Object_ClearChildAndCollisionFlags (void *obj)
 Script step: clears an object's sprite flags and its collision flags.
s32 ObjectMotion_MoveTowardTarget (struct ObjectRuntime *object)
 Script step of action 5: follows the linked object.
s32 ObjectMotion_TurnTowardLinkedTarget (struct ObjectRuntime *object)
 Script step of action 6: turns the object toward its linked object, at most 1/16 turn a frame.
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, 6 face the leader, 7 reset.
struct ObjectRuntime * Object_FindNearestFacingTarget (struct ObjectRuntime *self, s32 sprite)
 Finds the nearest animated object to self within 40 pixels and 48 pixels of height, ignoring objects more than 3/16 turn to either side once they are over 23 pixels away.

Detailed Description

Actor scripts: moving, turning and the built-in actions.

Part of psynergy_effects.c, compiled only through it.

Definition in file actor_motion.c.

Function Documentation

◆ Object_ClearChildAndCollisionFlags()

s32 Object_ClearChildAndCollisionFlags ( void * obj)

Script step: clears an object's sprite flags and its collision flags.

Definition at line 8 of file actor_motion.c.

Referenced by Object_ClearChildAndCollisionFlags().

◆ ObjectMotion_MoveTowardTarget()

s32 ObjectMotion_MoveTowardTarget ( struct ObjectRuntime * object)

Script step of action 5: follows the linked object.

While at least action pixels away the object walks toward it (a step of 16 / action of the distance, in 16-pixel units); closer, it stands.

Definition at line 17 of file actor_motion.c.

Referenced by ObjectMotion_MoveTowardTarget().

◆ ObjectMotion_TurnTowardLinkedTarget()

s32 ObjectMotion_TurnTowardLinkedTarget ( struct ObjectRuntime * object)

Script step of action 6: turns the object toward its linked object, at most 1/16 turn a frame.

Definition at line 56 of file actor_motion.c.

Referenced by ObjectMotion_TurnTowardLinkedTarget().

◆ ObjectMotion_SetActionCallback()

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, 6 face the leader, 7 reset.

Any other value is itself the script to run.

Definition at line 82 of file actor_motion.c.

Referenced by Event_SpawnObjectTable(), Object_LinkObjectAndSetCallback(), Object_SetActionCallbackAndRefreshById(), ObjectMotion_EnableActionAndSetCallback(), ObjectMotion_SetActionCallback(), and Scene_TalkToActor().

◆ Object_FindNearestFacingTarget()

struct ObjectRuntime * Object_FindNearestFacingTarget ( struct ObjectRuntime * self,
s32 sprite )

Finds the nearest animated object to self within 40 pixels and 48 pixels of height, ignoring objects more than 3/16 turn to either side once they are over 23 pixels away.

Returns it if it shows sprite, otherwise NULL.

Definition at line 117 of file actor_motion.c.

Referenced by Field_TryJumpForward(), and Object_FindNearestFacingTarget().