summaryrefslogtreecommitdiff
path: root/src/code/code_8006C510.c
diff options
context:
space:
mode:
authorkrimtonz <33664508+krimtonz@users.noreply.github.com>2020-05-19 15:27:25 -0500
committerGitHub <noreply@github.com>2020-05-19 16:27:25 -0400
commitb8b334f90a305229f1462357aa7fe7c1cbc3f6dd (patch)
treec7c5024acd7bb286aaf8b98f5d56289131f240d0 /src/code/code_8006C510.c
parentc599318a17bcc238cfe31b93068816b5119f1a9e (diff)
Decompiles fcurve_skelanime, code_8006C510, and actor MagicWind (#135)
* decompile z_fcurve_skelanime and code_8006C510 * format * Decomp Magic_Wind * PR Updates * add space between ActorFunc and MagicWindFunc * missing pr updates
Diffstat (limited to 'src/code/code_8006C510.c')
-rw-r--r--src/code/code_8006C510.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/code/code_8006C510.c b/src/code/code_8006C510.c
index 20fa80747..8e9f28322 100644
--- a/src/code/code_8006C510.c
+++ b/src/code/code_8006C510.c
@@ -1,6 +1,41 @@
#include <ultra64.h>
#include <global.h>
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C510/func_8006C510.s")
+f32 func_8006C510(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) {
+ char pad[0x1C];
+ f32 sq = SQ(arg0);
+ f32 cube = sq * arg0;
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C510/func_8006C5A8.s")
+ return (((cube + cube) - sq * 3.0f) + 1.0f) * arg2 + (sq * 3.0f - (cube + cube)) * arg3 +
+ ((cube - (sq + sq)) + arg0) * arg4 * arg1 + (cube - sq) * arg5 * arg1;
+}
+
+f32 func_8006C5A8(f32 target, TransformData* transData, s32 refIdx) {
+ s32 i;
+ s32 j;
+
+ if (target <= transData->unk_02) {
+ return transData->unk_08;
+ }
+ if (target >= transData[refIdx - 1].unk_02) {
+ return transData[refIdx - 1].unk_08;
+ }
+
+ for (i = 0;; i++) {
+ j = i + 1;
+ if (transData[j].unk_02 > target) {
+ if (transData[i].unk_00 & 1) {
+ return transData[i].unk_08;
+ } else if (transData[i].unk_00 & 2) {
+ return transData[i].unk_08 +
+ ((target - (f32)transData[i].unk_02) / ((f32)transData[j].unk_02 - (f32)transData[i].unk_02)) *
+ (transData[j].unk_08 - transData[i].unk_08);
+ } else {
+ f32 diff = (f32)transData[j].unk_02 - (f32)transData[i].unk_02;
+ return func_8006C510((target - transData[i].unk_02) / ((f32)transData[j].unk_02 - transData[i].unk_02),
+ diff * (1.0f / 30.0f), transData[i].unk_08, transData[j].unk_08,
+ transData[i].unk_06, transData[j].unk_04);
+ }
+ }
+ }
+}