diff options
author | Revo <projectrevotpp@hotmail.com> | 2020-11-01 21:06:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-01 21:06:48 -0500 |
commit | 5818130a789d0326c52b72b42240aaf16e5ecbe9 (patch) | |
tree | 72ec747fcc7e7ebeea1fe8e50407a6d074a51718 /src/code_801DD5C8.cpp | |
parent | b78fc344a7db4386fc086e96107ed9f5f6cf45ae (diff) | |
parent | 80b643a784616620e2b8c71ba7abd575a239045b (diff) |
Merge pull request #155 from mparisi20/master
decompile code_801DD5C8.o
Diffstat (limited to 'src/code_801DD5C8.cpp')
-rw-r--r-- | src/code_801DD5C8.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/code_801DD5C8.cpp b/src/code_801DD5C8.cpp new file mode 100644 index 0000000..f91832a --- /dev/null +++ b/src/code_801DD5C8.cpp @@ -0,0 +1,85 @@ +#include "ctorStruct.h"
+#include "code_801DD5C8.h"
+
+static ctorStruct gUnk8063F348(1, 4, 0);
+
+extern "C" {
+
+void func_801DD5C8(gUnkClass7* p1, float p2)
+{
+ if (!p1->unk0 || !(p1->unk6 & 0x1) || (p1->unk6 & 0x8))
+ return;
+ float f3 = p1->unk8;
+ p1->unkC += p2 * f3;
+ if (p1->unkC < 0.0f) {
+ p1->unk6 |= 0x4;
+ switch (p1->unk4) {
+ case 1:
+ while (p1->unkC < 0.0f)
+ p1->unkC += p1->unk0->unk8;
+ break;
+ case 2:
+ p1->unkC = -p1->unkC;
+ float f2 = p1->unk0->unk8;
+ if ((float)p1->unkC > f2) {
+ float f4 = p1->unkC / f2;
+ s32 r5 = (s32)f4;
+ f4 -= r5; // get fractional part
+ if (((r5 & 0x1) ^ ((u32)r5 >> 31 & 0x1)) - ((u32)r5 >> 31 & 0x1) != 0) {
+ p1->unkC = f2 * (1.0f - f4);
+ } else {
+ p1->unkC = f2 * f4;
+ p1->unk8 = -f3;
+ }
+ } else {
+ p1->unk8 = -f3;
+ }
+ break;
+ default:
+ p1->unk6 |= 0x8;
+ p1->unkC = 0.0f;
+ break;
+ }
+ } else if (p1->unkC > p1->unk0->unk8) {
+ p1->unk6 |= 0x4;
+ switch (p1->unk4) {
+ case 1:
+ while (p1->unkC > p1->unk0->unk8)
+ p1->unkC -= p1->unk0->unk8;
+ break;
+ case 2:
+ float f2 = p1->unk0->unk8;
+ float f4 = p1->unkC / f2;
+ s32 r5 = (s32)f4;
+ f4 -= r5;
+ if (((r5 & 0x1) ^ ((u32)r5 >> 31 & 0x1)) - ((u32)r5 >> 31 & 0x1) != 0) {
+ float temp = f2 * (1.0f - f4);
+ p1->unk8 = -f3;
+ p1->unkC = temp;
+ } else {
+ p1->unkC = f2 * f4;
+ }
+ break;
+ default:
+ p1->unk6 |= 0x8;
+ p1->unkC = p1->unk0->unk8;
+ break;
+ }
+ }
+ p1->unk6 |= 0x2;
+}
+
+void func_801DD7FC(gUnkClass7* p1, u32 p2, u32 p3)
+{
+ if (!p1->unk0 || !(p1->unk6 & 0x2))
+ return;
+ gUnkClass9* ptr = p1->unk0->unk4;
+ s32 count = p1->unk0->unk2;
+ for (s32 i = 0; i < count; i++, ptr++)
+ if (ptr->unkC)
+ ptr->unkC(p2, ptr, p3, p1->unkC);
+
+ p1->unk6 &= ~0x2;
+}
+
+} //extern "C"
|