11 for (i = 0; i < 3; i++) {
24 for (i = 0; i < 3; i++) {
36 out->
x = actor->
tile.
x + delta->
x;
37 out->
y = actor->
tile.
y + delta->
y;
46 switch (actor->
state) {
50 if (actor->
key2 == 0) {
77 if (actor->
voice != -1) {
145 actor->
speed = 0x400;
147 actor->
speed = 0x4CC;
150 actor->
speed = 0x400;
180 }
else if (kind & 0xE) {
185 }
else if (kind == 4) {
192 keepsDir = key1 == 0x28;
225 actor->
entry = entry;
void FIELDSTG_followLeader(Actor *actor)
A partner's control: records the leader's steps in the trail while it moves, and follows them.
void FIELDSTG_warpActor(Actor *actor, SlotDest *dest, s32 kind)
Warps the player (SLOT_WARP0 and SLOT_WARP1): the field task plays the warp's effect and cutscene of ...
void FIELDSTG_controlFlight(Actor *actor)
The player's flight: it rises unless triangle is held (ACTOR_FLY), left and right turn,...
void FIELDSTG_drawActor(void *data, void *drawLayer)
The layer's sorted callback that draws an actor: its frame from its image, mirrored for the direction...
void FIELDSTG_startActorGauge(Actor *actor, s32 dir, Vec2 offset)
Starts the gauge game at an offset from an actor, turning the partners its way.
void FIELDSTG_setActorPose(Actor *actor, s32 set, s32 dir)
Puts an actor in an event's pose: an animation set and a direction (ACTOR_POSED)
void FIELDSTG_startDrop(Actor *actor, s32 dir, Vec2 pos, s32 height)
Starts a drop from a ledge of height.
void FIELDSTG_runActorAction(Actor *actor, ActorChildren *children)
Runs an actor's action, its substate (ACTOR_STAND...): the walks, the climbs and the drop from ACTOR_...
void FIELDSTG_drainTrail(Actor *actor)
A follower's update while its trail runs out: it finds the leader (FIELD_TASK_ACTOR) if it has none,...
void FIELDSTG_launchActor(Actor *actor, SlotDest *dest)
Sends the player flying to the tile at dest from the nearest launcher (FIELDSTG_createLaunch)
void FIELDSTG_resetActorControl(Actor *actor)
Gives an actor its kind's control back: the pad for the player, none for kind 1, the trail for the pa...
void FIELDSTG_walkActorInDir(Actor *actor, s32 dir)
Walks an actor out through an exit, in a direction (ACTOR_WALK_OUT)
void FIELDSTG_startActorSlide(Actor *actor, s32 dir)
Starts an actor sliding in a direction (SLOT_SLIDE)
s32 FIELDSTG_isActorWalking(Actor *actor)
Whether an actor is still walking to its goal.
void FIELDSTG_startClimbDown(Actor *actor, s32 dir, s32 x, s32 y, s32 height)
Starts the climb down a wall of height from its top, at (x, y)
void FIELDSTG_startActorWalk(Actor *actor)
Starts an actor walking to its goal.
void FIELDSTG_setActorAnim(Actor *actor, s32 set)
Starts an actor's animation set from its first frame.
void FIELDSTG_controlPlayer(Actor *actor)
The player's update while it walks (Actor.control) when no menu, event or transition is running: the ...
void FIELDSTG_setActorDir(Actor *actor, s32 dir)
Turns an actor to a direction.
void FIELDSTG_animateActor(Actor *actor)
Plays an actor's animation: when its set (animSet) changes, it loads the set's animations for the fiv...
s32 FIELDSTG_isActorAnimDone(Actor *actor)
Whether an actor's animation has played to its end.
void FIELDSTG_startClimbUp(Actor *actor, s32 dir, s32 x, s32 y, s32 height)
The climbs (SLOT_CLIMB_UP and SLOT_CLIMB_DOWN) and the drop (SLOT_DROP): the actor goes onto the wall...
void FIELDSTG_stopActorSlide(Actor *actor)
Stops a sliding actor (SLOT_STOP_SLIDE)
void FIELDSTG_setActorGoal(Actor *actor, s32 x, s32 y, s32 dir)
Sets the tile an actor walks to and the direction it ends facing (FIELDSTG_walkToGoal)
ActorIcon * FIELDSTG_createActorIcon(Actor *actor)
Creates the player's icon, in the modes before MODE_NEW_GAME only.
GfxState GFX
GFX: the graphics state and its methods.
GameState GAME
The save data, the game mode and the methods.
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
s32 NTSC_MODE
The European version runs at 50 Hz (PAL) unless NTSC_MODE is set; its clocks then advance 0x133,...
void FIELDSTG_resumePartners(void)
Makes the partners follow the player again (FIELDSTG_followLeader)
Actor * FIELDSTG_createActor(s32 key1, s32 kind, s32 image, FieldActorEntry *entry)
Creates a character (FIELD_TASK_ACTOR): key1 is the character, key2 its kind (0 the player,...
void FIELDSTG_updateActor(Actor *actor, ActorChildren *children)
An actor's update: waits for its animation file (and gives the player its icon), then runs its contro...
static void takePartyDepth(Actor *actor)
Puts the player or a follower on GAME.playerDepth's layer, or on layer 4 and back to it when the temp...
void FIELDSTG_getFacingTile(Actor *actor, Vec2 *out)
The tile in front of an actor, one step in its direction.
void FIELDSTG_haltPartners(void)
Makes the partners stop following: each walks out the rest of its trail (FIELDSTG_drainTrail)
static void setActorMethods(Actor *actor)
Gives a new character its methods.
#define FIELD_LAYER_MAP
the map, its objects and characters, and the menus
#define FIELD_TASK_ACTOR
every character (FIELDSTG_createActor)
FIELDSTG.PRO: the field mode, where the player walks around the map.
#define ACTOR_ANIM_STAND
The animation sets that the actions play (FIELDSTG_setActorAnim), by the substate that plays them.
#define SOUND_SUB_MOVE
held
s32 FIELDSTG_haltedPartners[]
s32 FIELDSTG_followingPartners[]
Vec2 FIELDSTG_dirSteps[]
tile offset of each direction
FieldState FIELDSTG_state
FileCache FILE_CACHE
The file cache.
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
TaskRegistry TASK_REGISTRY
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
The children of an actor (FIELDSTG_updateActor)
struct ActorIcon * icon
FIELDSTG_createActorIcon's.
A character on the field (FIELDSTG_createActor): the player (kind 0) and the other characters.
s32 keepsDir
doesn't turn to the one who talks to it (characters 0x28-0x2A, 0x3E and 0x11A)
s32 animSet
the animation set it plays (setAnim)
void(* walkInDir)(struct Actor *, s32 dir)
s32 z
how high it is off the ground, in 1/256 pixels (drawn that much higher)
void(* setGoal)(struct Actor *, s32, s32, s32)
void(* warp)(struct Actor *, SlotDest *dest, s32 kind)
struct ActorImage * image
void(* startWalk)(struct Actor *)
s32 depth
the layer's ordering table entry
struct Trail * trail
a follower's: the leader's steps
void(* getFacingTile)(struct Actor *, Vec2 *out)
void(* launch)(struct Actor *, SlotDest *dest)
s16 voice
a sound voice, or -1
s32(* isAnimDone)(struct Actor *)
s32 flying
the flying player (FIELDSTG_controlFlight)
s32 climbHeight
how high it has climbed, in 1/256 pixels (its shadow stays below)
s32(* isWalking)(struct Actor *)
void(* startSlide)(struct Actor *, s32 dir)
s32 animFile
its animations' file and index (FIELDSTG_fileEntries), or 0
struct FieldImage * fieldImage
the field's image, for the shadow
void(* resetControl)(struct Actor *)
s32 halfWidth
half its width (FIELDSTG_actorWidths): its box's half width, and half that its half height
void(* setPose)(struct Actor *, s32, s32 dir)
void(* control)(struct Actor *)
its update by kind, or NULL (resetControl)
s32 hasShadow
drawn with a shadow
void(* nextState)(struct Actor *task)
void(* setDir)(struct Actor *, s32 dir)
s32 speed
0x400, 0x4CC in PAL's 50 Hz
void(* stopSlide)(struct Actor *)
struct FieldActorEntry * entry
what created it, or NULL
void(* setAnim)(struct Actor *, s32)
A character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
s32 frozen
no control, triggers or encounters for the player: while the area name banner shows (FIELDSTG_createB...
s32 defaultStartDir
and its direction
Vec2 start
where the player starts
ActorImage * actors
then the actors', from actors[2]
s32(* getFileEntry)(s32 character)
FIELDSTG_fileEntries's.
s32(* getActorWidth)(s32 character)
FIELDSTG_actorWidths's.
s32 startDir
and its direction
Vec2 defaultStart
where the player starts without a mode argument
union FieldState::@12 images
FieldImage * field
the field's image (the first two ActorImages)
s32(* isLoading)(s32 file)
void(* request)(s32 file)
struct Layer *(* getLayer)(s32 id)
void *(* allocZeroed)(s32 size, s32 tag)
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
void(* addSortedCallback)()
void(* keyOff)(s32 id, s16 voice)
void *(* find)(s32 id, s32 key1, s32 key2)
void * createTaskWithId(void(*update)(), s32 size, s32 childrenSize, s32 id)
Allocates a zeroed task of size bytes (header included) with room for childrenSize / 4 child tasks.