Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
step_animation.inc.c
Go to the documentation of this file.
1/*
2 * Steps ANIM through FRAMES by the frame time (at most 4) and returns its
3 * frame: at the end (frame 0xFF) it loops, or returns 0xFF if once. depth
4 * is 0 for the caller.
5 */
6s32 stepAnimation(AnimState *anim, AnimFrame *frames, s32 once, s32 depth) {
7 AnimFrame *frame = &frames[anim->index];
9
10 if (dt > 4) {
11 dt = 4;
12 }
13 if (depth == 0) {
14 anim->timer -= dt;
15 }
16 if (anim->timer <= 0) {
17 frame++;
18 anim->index++;
19 anim->timer += frame->duration;
20 if (once) {
21 if (frame->frame == 0xFF) {
22 return 0xFF;
23 }
24 } else if (frame->frame == 0xFF) {
25 frame = frames;
26 anim->index = 0;
27 anim->timer += frame->duration;
28 }
29 stepAnimation(anim, frames, once, depth + 1);
30 }
31 return frame->frame;
32}
signed int s32
Definition common.h:11
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
s32 stepAnimation(AnimState *anim, AnimFrame *frames, s32 once, s32 depth)
Steps ANIM through FRAMES by the frame time (at most 4) and returns its frame: at the end (frame 0xFF...
One frame of a sprite animation; frame 0xFF ends it (or loops it)
Definition gfx.h:296
s16 frame
Definition gfx.h:297
s16 duration
Definition gfx.h:298
s16 index
Definition gfx.h:302
s16 timer
Definition gfx.h:303
s32(* getFrameTime)(void)
Definition gfx.h:32
GfxFuncs funcs
Definition gfx.h:77