48 shake = task->
shake + 1;
49 if (task->
voice == -1) {
52 }
else if (task->
voice != -1) {
65 switch (task->
state) {
79 if ((task->
step == 0) & (task->
snap == 0)) {
86 if ((task->
step == 0) & (task->
snap == 0)) {
91 if (task->
step == 1) {
104 if (delta.
x != 0 && delta.
y != 0) {
107 }
else if (delta.
x > 2) {
115 }
else if (delta.
y > 2) {
130 if (task->
voice != -1) {
void FIELDSTG_updateCamera(Camera *task)
The camera's update: it follows its target actor (substate 0) or looks at a spot (1),...
void FIELDSTG_scrollCamera(Camera *task)
Scrolls the map layer to the camera's center, kept inside the map, and shakes it while shaking with i...
void FIELDSTG_followWithCamera(s32 snap, s32 id)
Points the camera at the actor id, at once if snap.
void FIELDSTG_shakeCamera(s32 shaking)
Starts or stops the camera's shake.
void FIELDSTG_pointCamera(s32 snap, s32 x, s32 y)
Points the camera at the spot (x, y), at once if snap.
Camera * FIELDSTG_createCamera(void)
Creates the camera.
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...
#define FIELD_TASK_MAP
The ids of the field's tasks (createTaskWithId, TASK_REGISTRY.funcs.find)
#define FIELD_LAYER_MAP
the map, its objects and characters, and the menus
#define FIELD_TASK_CAMERA
#define FIELD_TASK_ACTOR
every character (FIELDSTG_createActor)
FIELDSTG.PRO: the field mode, where the player walks around the map.
#define SOUND_COMCD203
held while the camera shakes
Vec2 FIELDSTG_shakeOffsets[]
the camera's shake offsets
#define SCREEN_WIDTH
The screen the modes draw on (setDisplayMode, their layers' rects)
TaskRegistry TASK_REGISTRY
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
s32 z
how high it is off the ground, in 1/256 pixels (drawn that much higher)
The camera (FIELD_TASK_CAMERA, FIELDSTG_createCamera): it centers the field's layer on an actor or a ...
s32 shake
the step of the shake, 0-3
s32 snap
goes to center at once instead of panning
void(* nextStep)(struct Camera *task)
void(* nextState)(struct Camera *task)
Vec2 center
where it looks
s32 unk7C
cleared with each new target; nothing reads it
s16 voice
of the shaking sound, or -1
Vec2 pan
where it looks while it pans to center
Vec2 bounds
the map's size
Actor * target
the actor it follows (substate 0)
void(* setSubstate)(struct Camera *task, s32 substate)
s32 spotX
the spot it looks at (substate 1)
s32 targetId
the target's character (Actor.key1)
struct Layer *(* getLayer)(s32 id)
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
The task that streams the map's tiles from the CD around the view (FIELDSTG_runMapStreamer,...
Vec2 *(* getSize)(struct MapStreamer *)
in pixels (FIELDSTG_getMapSize)
short(* playSound)(s32 id)
returns the voice of a key-on
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.