Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
MoveValue.h
Go to the documentation of this file.
1#ifndef NW4HBM_SND_MOVE_VALUE_H
2#define NW4HBM_SND_MOVE_VALUE_H
3
4#include <revolution/types.h>
5
6namespace nw4hbm {
7 namespace snd {
8 namespace detail {
9
10 template <typename TValue, typename TTime>
11 class MoveValue {
12 public:
14 : mOrigin(TValue()), mTarget(TValue()), mFrame(TTime()), mCounter(TTime()) {}
15
16 void InitValue(TValue t1) {
17 mOrigin = t1;
18 mTarget = t1;
19 mFrame = 0;
20 mCounter = 0;
21 }
22
23 bool IsFinished() const { return mCounter >= mFrame; }
24
25 TValue GetValue() const {
26 if (IsFinished()) {
27 return mTarget;
28 }
29 return mOrigin + mCounter * (mTarget - mOrigin) / mFrame;
30 }
31
32 void Update() {
33 if (mCounter < mFrame) {
34 mCounter++;
35 }
36 }
37
38 void SetTarget(TValue target, TTime frame) {
39 mOrigin = GetValue();
41 mFrame = frame;
42 mCounter = 0;
43 }
44
45 private:
46 /* 0x00 */ TValue mOrigin;
47 /* 0x04 */ TValue mTarget;
48 /* 0x08 */ TTime mFrame;
49 /* 0x0C */ TTime mCounter;
50 };
51
52 } // namespace detail
53 } // namespace snd
54} // namespace nw4hbm
55
56#endif
Definition MoveValue.h:11
MoveValue()
Definition MoveValue.h:13
TValue GetValue() const
Definition MoveValue.h:25
void InitValue(TValue t1)
Definition MoveValue.h:16
TValue mTarget
Definition MoveValue.h:47
bool IsFinished() const
Definition MoveValue.h:23
void Update()
Definition MoveValue.h:32
void SetTarget(TValue target, TTime frame)
Definition MoveValue.h:38
TTime mFrame
Definition MoveValue.h:48
TValue mOrigin
Definition MoveValue.h:46
TTime mCounter
Definition MoveValue.h:49
static void * target
Definition d_a_npc_cd2.cpp:886
static u32 t1
Definition dsp_task.c:8
Definition HBMAnmController.h:6