14 if (object->
anim != 0xFF) {
43 switch (task->
state) {
47 for (entry = task->
objects; entry->
y != 0; entry++) {
48 if (entry->
anim == 0xFF) {
64 for (i = 0;
object->margin != 0;
object++, i++) {
68 x =
object->anim == 0xFF ?
object->x - 50 :
object->x;
69 y =
object->anim == 0xFF ?
object->y - 100 :
object->y;
70 margin =
object->margin;
71 if (x >= view.x - margin && view.x + view.w >= x && y >= view.y - margin && view.y + view.h >= y) {
72 switch (object->
cycle) {
77 object->frame =
object->cycleFirst;
79 object->cycleTime =
object->cycleDelay << 8;
81 object->cycleTime -= 0x100;
88 object->clutRow =
object->cycleFirst;
90 object->cycleTime =
object->cycleDelay << 8;
92 object->cycleTime -= 0x100;
98 object->cycleTime &= 0x7FFF;
101 object->cycleTime =
object->cycleDelay << 8;
103 object->clutRow =
object->cycleFirst + 1;
107 object->cycleTime -= 0x100;
109 object->cycleTime |= back;
112 object->cycleTime =
object->cycleDelay << 8;
114 object->clutRow =
object->cycleLast - 1;
115 object->cycleTime |= 0x8000;
118 object->cycleTime -= 0x100;
122 if (object->
sortY != 0) {
156 for (; entry->
margin != 0; entry++) {
GfxState GFX
GFX: the graphics state and its 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
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_OBJECTS_CLUT_Y
StageTile * FIELDSTG_objectCursor
FIELDSTG_findNextObject's search of the map objects.
s32 FIELDSTG_objectId
and the id it looks for
FieldState FIELDSTG_state
FileCache FILE_CACHE
The file cache.
HiddenSpots * FIELDSTG_createHiddenSpots(s32 count)
Creates the hidden spots, the map objects of animation 0xFF, and hides the prize in one (or where it ...
MapObjects * FIELDSTG_createMapObjects(s32 sprites, StageTile *objects)
Creates the map's objects, with their sprites.
StageTile * FIELDSTG_findNextObject(void)
The next map object of the animation FIELDSTG_findObject looks for, or NULL.
void FIELDSTG_updateMapObjects(MapObjects *task, HiddenSpots **children)
Animates and draws the map's objects that are in view.
void FIELDSTG_drawMapObject(MapObjects *task, Layer *layer, s32 index)
The layer's sorted callback that draws a map object.
StageTile * FIELDSTG_findObject(s32 anim)
The first map object of an animation, or NULL (FIELDSTG_findNextObject goes on)
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
StageTile * objects
the map objects, up to the first margin 0
CVECTOR spriteColor
the field's sprites' color, unless cd is 0
void *(* getEntry)(u32 fileAndIndex)
struct Layer *(* getLayer)(s32 id)
The map's hidden spots (FIELD_TASK_HIDDEN_SPOTS, FIELDSTG_createHiddenSpots): one of them,...
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
void(* addSortedCallback)()
Animates and draws the map's objects (FIELDSTG_createMapObjects)
struct StageTile * objects
void(* nextState)(struct MapObjects *task)
s32 sprites
their sprite file and entry
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
void(* setAltClut)()
(x, y)
void(* setLayer)()
(layer, depth)
void(* setColor)()
(CVECTOR *)
void(* setLayerId)()
(id, depth)
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 margin
how far off the view it is still drawn; 0 ends the table
s16 cycleTime
in 1/256 frames; bit 15: going back
u8 anim
which of a stage's animations sets frame (1-3); FIELDSTG finds objects by it (its lift,...
u8 cycle
1 cycles the frame, 2 the CLUT row, 3 the row back and forth
s16 sortY
drawn sorted at this y, or 0
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find