Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
step_state_animation_once.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, 0xFF once it has ended. depth is 0 for the caller.
4 */
5s32 stepAnimationOnce(AnimState *anim, AnimFrame *frames, s32 depth) {
6 AnimFrame *frame = &frames[anim->index];
8
9 if (dt > 4) {
10 dt = 4;
11 }
12 if (depth == 0) {
13 anim->timer -= dt;
14 }
15 if (anim->timer <= 0) {
16 frame++;
17 anim->index++;
18 anim->timer += frame->duration;
19 if (frame->frame == 0xFF) {
20 return 0xFF;
21 }
22 stepAnimationOnce(anim, frames, depth + 1);
23 }
24 return frame->frame;
25}
signed int s32
Definition common.h:11
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
s32 stepAnimationOnce(AnimState *anim, AnimFrame *frames, s32 depth)
Steps ANIM through FRAMES by the frame time (at most 4) and returns its frame, 0xFF once it has ended...
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