Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
interp.c
Go to the documentation of this file.
1/* FIGHTSTG's interpolation (FIGHTSTG_interp). */
2
4#include "engine/gte.h"
5
6/* FIGHTSTG_interp.nop: empty, and nothing calls it */
8}
9
10/* FIGHTSTG_interp.lerp: out is from moved t (0-0x1000) of the way to `to`,
11 on the GTE */
12void FIGHTSTG_lerpVector(SVECTOR *from, SVECTOR *to, s32 t, SVECTOR *out) {
13 SVECTOR diff;
14 SVECTOR step;
15
16 gte_lddp(t);
17 diff.vx = to->vx - from->vx;
18 diff.vy = to->vy - from->vy;
19 diff.vz = to->vz - from->vz;
20 gte_ldsv(&diff);
21 gte_gpf12();
22 *out = *from;
23 gte_stsv(&step);
24 out->vx += step.vx;
25 out->vy += step.vy;
26 out->vz += step.vz;
27}
28
29/* Returns value scaled by the sine of t (4096 is 1.0) on the given curve: 0 a
30 * quarter of t, 1 the same as a cosine, 2 half of t. */
31s32 FIGHTSTG_ease(s32 curve, s32 t, s32 value) {
32 switch (curve) {
33 case 0:
34 default:
35 return rsin(t >> 2) * value / 4096;
36 case 1:
37 return rsin((t >> 2) + 0x400) * value / 4096;
38 case 2:
39 return rsin(t >> 1) * value / 4096;
40 }
41}
42
43/* the functions that go between values */
FIGHTSTG.PRO: the battle.
signed int s32
Definition common.h:11
The GTE instructions that C can't say, as the SDK's inline_c.h has them but with the real encodings i...
#define gte_lddp(r0)
the interpolation factor (IR0)
Definition gte.h:10
#define gte_ldsv(r0)
an SVECTOR into IR1-IR3
Definition gte.h:16
#define gte_stsv(r0)
IR1-IR3 into an SVECTOR.
Definition gte.h:34
#define gte_gpf12()
IR1-IR3 = IR0 * IR1-IR3 >> 12.
Definition gte.h:28
void FIGHTSTG_interpNop(void)
FIGHTSTG_interp.nop: empty, and nothing calls it.
Definition interp.c:7
s32 FIGHTSTG_ease(s32 curve, s32 t, s32 value)
Returns value scaled by the sine of t (4096 is 1.0) on the given curve: 0 a quarter of t,...
Definition interp.c:31
void FIGHTSTG_lerpVector(SVECTOR *from, SVECTOR *to, s32 t, SVECTOR *out)
FIGHTSTG_interp.lerp: out is from moved t (0-0x1000) of the way to to, on the GTE.
Definition interp.c:12
InterpFuncs FIGHTSTG_interp
the functions that go between values
Definition interp.c:44
FIGHTSTG_interp: the functions that go between values.
Definition model.h:193