SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
DynamicJointCtrl.cpp
1#include "Game/LiveActor/DynamicJointCtrl.hpp"
2#include "Game/Util.hpp"
3
4#ifdef NON_MATCHING
5// scheduling issues
6JointCtrlRate::JointCtrlRate() {
7 _8 = -1;
8 _0 = 1.0f;
9 _4 = 0;
10 _C = -1;
11}
12#endif
13
14#ifdef NON_MATCHING
15// way too many diffs to note here
16void JointCtrlRate::update() {
17 u32 temp;
18 if (_8 < 0) {
19 if (_C >= 0) {
20 temp = _4;
21 _4 = temp - 1;
22
23 if (temp - 1 >= 0) {
24 _0 = ((f32)(_4 - 1) / (f32)(_4 - 1));
25 }
26 else {
27 _C = -1;
28 _0 = 0.0f;
29 }
30 }
31 }
32 else {
33 temp = _4;
34 _4 = temp - 1;
35
36 if ((temp - 1) >= 0) {
37 _0 = ((f32)(_8 - (temp - 1) / _8));
38 }
39 else {
40 _8 = -1;
41 _0 = 1.0f;
42 }
43 }
44}
45#endif
46
47void JointCtrlRate::startCtrl(s32 val) {
48 if (val < 0) {
49 val = 0xA;
50 }
51
52 _8 = val;
53 _C = -1;
54 _4 = val;
55 _0 = 0.0f;
56}
57
58void JointCtrlRate::endCtrl(s32 val) {
59 if (val < 0) {
60 val = 0xA;
61 }
62
63 _8 = val;
64 _C = -1;
65 _4 = val;
66 _0 = 1.0f;
67}
68
69void DynamicJointCtrlKeeper::update() {
70 for (s32 i = 0; i < _4; i++) {
71 mControls[i]->update();
72 }
73}
74
75void DynamicJointCtrlKeeper::setCallBackFunction() {
76 for (s32 i = 0; i < _4; i++) {
77 mControls[i]->setCallBackFunction();
78 }
79}
80
81void DynamicJointCtrlKeeper::startCtrl(const char *pName, s32 a2) {
82 findJointCtrl(pName)->mControlRate->startCtrl(a2);
83}
84
85void DynamicJointCtrlKeeper::endCtrl(const char *pName, s32 a2) {
86 findJointCtrl(pName)->mControlRate->endCtrl(a2);
87}
88
89void DynamicJointCtrlKeeper::reset() {
90 for (s32 i = 0; i < _4; i++) {
91 mControls[i]->reset();
92 }
93}
94
95DynamicJointCtrl* DynamicJointCtrlKeeper::findJointCtrl(const char *pName) {
96 for (s32 i = 0; i < _4; i++) {
97 if (MR::isEqualString(mControls[i]->mName, pName)) {
98 return mControls[i];
99 }
100 }
101
102 return mControls[0];
103}