13 switch (task->
state) {
24 if (dx < 0x80 && dy < 0x80) {
27 }
else if (dx < 0x100 && dy < 0x100) {
43 sprite.
draw(sprites, task->
frame, 0xF8, 0xA8);
44 sprite.
draw(sprites, 0x4F, 0xF8, 0xA8);
46 if (task->
time >= 0x78) {
84 switch (task->
state) {
133 for (i = 0; i < task->
count; i++) {
165 for (;
object->y != 0;
object++, i++) {
166 if (object->
anim == 0xFF) {
194 for (i = 0; i < task->
count; i++) {
214 for (i = 0; i < task->
count; i++) {
244 switch (task->
state) {
247 if (task->
key1 != 0) {
267 if (anim[step * 2 + 1] < time) {
268 time -= anim[step * 2 + 1];
270 if (anim[step * 2] == 0xFF) {
274 task->
frame = anim[step * 2];
278 if (task->
frame != 0) {
293 task->
key1 = forEvent;
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_LAYER_MAP
the map, its objects and characters, and the menus
#define FIELD_TASK_ACTOR
every character (FIELDSTG_createActor)
#define FIELD_TASK_HIDDEN_SPOTS
FIELDSTG.PRO: the field mode, where the player walks around the map.
#define FIELD_SPRITES_X
Where the field keeps its textures in VRAM: the two images of FIELD_SPRITES_FILE (its entries 2 and 3...
#define FIELD_SPRITES_FILE
The field's effect sprites (FIELDSTG_drawSpotEffect): the discs number their files differently.
#define FIELD_SEARCH_FILE
the hidden spots'
u8 FIELDSTG_spotAnim[][2]
animation of FIELDSTG_updateHiddenSpots: (frame, time) pairs up to 0xFF
u8 * FIELDSTG_dirAnims[]
FIELDSTG_updateSpotEffect's animation for each direction.
FieldState FIELDSTG_state
s32 FIELDSTG_dirDepths[]
and its depth offset
FieldBattleFuncs FIELDSTG_battleFuncs
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...
SpotHint * FIELDSTG_createSpotHint(Vec2 from, Vec2 to)
Creates the hint for a search at to, from the prize at from.
void FIELDSTG_hidePrize(HiddenSpots *task)
Hides the prize in one of the hidden spots at random (GAME.prizeSpot keeps it)
HiddenSpots * FIELDSTG_findHiddenSpot(Vec2 *pos, s32 select)
The hidden spots, when one is within 10 pixels of pos (selecting it if select), or NULL.
void FIELDSTG_drawSpotEffect(SpotEffect *task, Layer *layer)
The layer's sorted callback that draws a search's effect.
HiddenSpots * FIELDSTG_createHiddenSpots(s32 count)
Creates the hidden spots, the map objects of animation 0xFF, and hides the prize in one (or where it ...
SpotEffect * FIELDSTG_createSpotEffect(s32 forEvent)
Creates a search's effect, over the event's actor 0x11B if forEvent, else over the player.
void FIELDSTG_showSpotHint(SpotHint *task)
The hint after a search without the prize: a sprite that flashes faster the closer the prize is.
void FIELDSTG_updateSpotEffect(SpotEffect *task)
A search's effect, over the player or, for an event, its actor 0x11B.
void FIELDSTG_searchEventSpot(void)
Searches the hidden spots off the map (x 1000 and up), for an event.
void FIELDSTG_updateHiddenSpots(HiddenSpots *task, HiddenSpotsChildren *children)
The hidden spots' update: a search plays its effect, then starts a battle where the prize is (and hid...
TaskRegistry TASK_REGISTRY
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
A character on the field (FIELDSTG_createActor): the player (kind 0) and the other characters.
void(* startEventBattle)(s32 index)
FIELDSTG_startEventBattle.
StageTile * objects
the map objects, up to the first margin 0
void(* request)(s32 file)
void *(* getEntry)(u32 fileAndIndex)
s32(* getFrameTime)(void)
struct Layer *(* getLayer)(s32 id)
void *(* alloc)(s32 size, s32 tag)
A hidden spot: a map object with anim 0xFF.
s32 hasPrize
the one picked at random (GAME.prizeSpot)
s32 object
its index in FieldState.objects
The children of an HiddenSpots.
struct SpotEffect * effect
The map's hidden spots (FIELD_TASK_HIDDEN_SPOTS, FIELDSTG_createHiddenSpots): one of them,...
void(* setSubstate)(struct HiddenSpots *task, s32 substate)
void(* nextState)(struct HiddenSpots *task)
s32 forEvent
an event's search, without the prize or a hint
s32 selected
the spot searched
void(* setState)(struct HiddenSpots *task, s32 state)
void(* nextSubstate)(struct HiddenSpots *task)
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
void(* addSortedCallback)()
s32(* next)(void)
0 to RANDOM_COUNT - 1
short(* playSound)(s32 id)
returns the voice of a key-on
The effect of searching a hidden spot, in front of the actor that searches (FIELDSTG_createSpotEffect...
void(* setState)(struct SpotEffect *task, s32 state)
void(* nextState)(struct SpotEffect *task)
The hint of a hidden spot that held nothing (FIELDSTG_createSpotHint): its sprite and its palette cyc...
void(* nextState)(struct SpotHint *task)
void(* setState)(struct SpotHint *task, s32 state)
s32 speed
frames per palette step
void(* destroy)(struct SpotHint *task)
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
void(* setLayer)()
(layer, depth)
void(* setLayerId)()
(id, depth)
void(* setFollowScroll)()
(on)
void(* setClutRow)()
(row)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
An object of a map, which FIELDSTG draws: a record of the table at FieldState.objects,...
u8 anim
which of a stage's animations sets frame (1-3); FIELDSTG finds objects by it (its lift,...
void *(* find)(s32 id, s32 key1, s32 key2)
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
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.