Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
update_sprite_pair.inc.c
Go to the documentation of this file.
1/*
2 * Plays the two sprites of a StageSpritePair once with the stage's
3 * updateSpritePairFrames, the first 0xF0 above y and the second 0x14 below;
4 * the task ends when both have ended
5 */
8 s32 done;
9 s32 i;
10 s32 frame;
11 s32 y;
12 void (*draw)();
13
14 switch (task->state) {
15 case TASK_INIT:
16 default:
17 task->anims[0].index = 0;
19 task->anims[1].index = 0;
21 task->nextState(task);
22 break;
23 case TASK_RUN:
24 done = 0;
25 i = 0;
26 draw = drawPairSprite;
27 for (; i < 2; i++) {
28 frame = stepAnimationOnce(&task->anims[i], updateSpritePairFrames[i], 0);
29 switch (frame) {
30 case 0xFF:
31 task->sprites[i].frame = 0;
32 done++;
33 break;
34 case 0x12C:
35 task->sprites[i].frame = 0;
36 break;
37 default:
38 task->sprites[i].frame = frame;
39 break;
40 }
41 if (task->sprites[i].frame != 0) {
42 y = task->y;
43 if (i == 0) {
44 y -= 0xF0;
45 } else {
46 y += 0x14;
47 }
48 layer->addSortedCallback(layer, draw, task, y, i);
49 }
50 }
51 if (done == 2) {
52 task->setState(task, TASK_KILL);
53 }
54 break;
55 case TASK_DONE:
56 case TASK_KILL:
57 break;
58 }
59}
signed int s32
Definition common.h:11
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
void drawPairSprite(StageSpritePair *task, void *arg, s32 idx)
Draws sprite idx at (x, y)
#define TASK_RUN
Definition task.h:35
#define TASK_KILL
Definition task.h:37
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Definition task.h:34
#define TASK_DONE
Definition task.h:36
#define FIELD_LAYER_MAP
the map, its objects and characters, and the menus
Definition field_map.h:20
s32 stepAnimationOnce(StageTileAnim *obj, AnimFrame *frames, s32 depth)
Steps OBJ's animation through FRAMES by the frame time (at most 4) and returns its frame,...
s16 duration
Definition gfx.h:298
s16 index
Definition gfx.h:302
s16 timer
Definition gfx.h:303
struct Layer *(* getLayer)(s32 id)
Definition gfx.h:28
GfxFuncs funcs
Definition gfx.h:77
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
void(* addSortedCallback)()
Definition gfx.h:160
A trap's effect over a partner it leaves at 1 HP (events 9000 to 9015 of WSTAG740 and WSTAG741,...
Definition stage.h:220
AnimState anims[2]
Definition stage.h:225
void(* nextState)(struct StageSpritePair *task)
Definition stage.h:221
StageSprite sprites[2]
Definition stage.h:226
void(* setState)(struct StageSpritePair *task, s32 state)
Definition stage.h:221
s16 frame
Definition stage.h:70
void updateSpritePair(StageSpritePair *task)
Plays the two sprites of a StageSpritePair once with the stage's updateSpritePairFrames,...
AnimFrame * updateSpritePairFrames[]
Definition wstag740.c:247
AnimFrame updateSpritePairFrames_1[]
Definition wstag740.c:241
AnimFrame updateSpritePairFrames_0[]
Definition wstag740.c:237