Alchemy
Loading...
Searching...
No Matches

update.c File Reference

Go to the source code of this file.

Macros

#define OBJECT_SLOTS   8
 script-driven objects updated each frame
#define TARGET_UNSET   ((s32)0x80000000)
 no movement target
#define TURN_MAX   0x1000
 the most an object turns in one frame
#define IWRAM_ENTRY(type, offset)
 Calls a resident IWRAM routine at its absolute address, which this code still reaches when it runs from its copy in RAM.
#define IwramSqrt   IWRAM_ENTRY(s32 (*)(s32 value), Iwram_SqrtOffset)
#define IwramRatioMulQ14   IWRAM_ENTRY(s32 (*)(s32 divisor, s32 value), Iwram_RatioMulQ14Offset)

Functions

s32 ArcTan2FarArm (s32 z, s32 x)
s32 IwramSqrtFarArm (s32 value)
s32 IwramRatioMulQ14FarArm (s32 divisor, s32 value)
void Object_UpdateAll (void)
 Advances the eight script-driven objects by one frame.

Variables

struct ScriptMotionObject * gObjectSlots

Macro Definition Documentation

◆ OBJECT_SLOTS

#define OBJECT_SLOTS   8

script-driven objects updated each frame

Definition at line 10 of file update.c.

Referenced by Object_UpdateAll().

◆ TARGET_UNSET

#define TARGET_UNSET   ((s32)0x80000000)

no movement target

Definition at line 11 of file update.c.

◆ TURN_MAX

#define TURN_MAX   0x1000

the most an object turns in one frame

Definition at line 12 of file update.c.

Referenced by Object_UpdateAll().

◆ IWRAM_ENTRY

#define IWRAM_ENTRY ( type,
offset )
Value:
((type)(IwramIrqMain + (offset)))
u8 IwramIrqMain[]

Calls a resident IWRAM routine at its absolute address, which this code still reaches when it runs from its copy in RAM.

Definition at line 16 of file update.c.

◆ IwramSqrt

#define IwramSqrt   IWRAM_ENTRY(s32 (*)(s32 value), Iwram_SqrtOffset)

Definition at line 17 of file update.c.

Referenced by Object_ApproachLinkedObject(), and Object_UpdateAll().

◆ IwramRatioMulQ14

#define IwramRatioMulQ14   IWRAM_ENTRY(s32 (*)(s32 divisor, s32 value), Iwram_RatioMulQ14Offset)

Definition at line 18 of file update.c.

Referenced by Object_UpdateAll().

Function Documentation

◆ ArcTan2FarArm()

s32 ArcTan2FarArm ( s32 z,
s32 x )

Referenced by ArcTan2FarArm(), and Object_UpdateAll().

◆ IwramSqrtFarArm()

s32 IwramSqrtFarArm ( s32 value)

◆ IwramRatioMulQ14FarArm()

s32 IwramRatioMulQ14FarArm ( s32 divisor,
s32 value )

◆ Object_UpdateAll()

void Object_UpdateAll ( void )

Advances the eight script-driven objects by one frame.

For each live one: run its hook, then its script (unless it waits or is paused); steer it towards its target, or brake it when it has none; apply gravity and bounce off the ground; detect arrival at the target; and turn it to face the way it moves. Copied to RAM and run from there. Writes each object's position, velocity and facing, and unsets its target on arrival. Only Object_RunUpdateAllFromHeap copies and runs it, and nothing calls that; the field runs Object_UpdateAllThumb instead.

Definition at line 36 of file update.c.

Referenced by Object_RunUpdateAllFromHeap(), and Object_UpdateAll().

Variable Documentation

◆ gObjectSlots