summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2022-07-06 20:36:27 -0400
committerGitHub <noreply@github.com>2022-07-06 17:36:27 -0700
commitf2eef3b82ee60cd3f1f6b44c035fcb65637fe54d (patch)
tree370ddc5935c90b1f8fd0d791cd93ae44b6257668 /src
parentbf106ede73cc78538d98877e40ba73d5a45c5351 (diff)
Identify some stuff in the Camera struct (#238)
Make a header file for all the camera stuff, refresh a lot of mips_to_c output Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/actors.c72
-rw-r--r--src/camera.c1649
-rw-r--r--src/camera.h55
-rw-r--r--src/camera_junk.c56
-rw-r--r--src/code_80005FD0.c2950
-rw-r--r--src/code_80005FD0.h3
-rw-r--r--src/code_8001F980.c28
-rw-r--r--src/code_8001F980.h1
-rw-r--r--src/code_80027D00.c82
-rw-r--r--src/code_80280000.c31
-rw-r--r--src/code_80281780.c2
-rw-r--r--src/code_80281C40.c4
-rw-r--r--src/main.c2
-rw-r--r--src/math_util.h1
-rw-r--r--src/math_util_2.c2
-rw-r--r--src/race_logic.c6
-rw-r--r--src/render_courses.c6
-rw-r--r--src/skybox_and_splitscreen.c21
18 files changed, 2277 insertions, 2694 deletions
diff --git a/src/actors.c b/src/actors.c
index 07c850a03..8700faec1 100644
--- a/src/actors.c
+++ b/src/actors.c
@@ -551,7 +551,7 @@ void func_802979F8(struct Actor *arg0, f32 arg1) {
void func_80297A50(Camera *camera, Mat4 arg1, struct Actor *arg2) {
u16 temp_t0;
- f32 temp = func_802B80D0(camera->pos, arg2->unk18, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B95F8);
+ f32 temp = func_802B80D0(camera->pos, arg2->unk18, camera->rot[1], 0, D_80150130[camera - camera1], D_802B95F8);
if (temp < 0.0f) { return; }
@@ -780,7 +780,7 @@ void func_80298328(Camera *arg0, Mat4 arg1, struct PiranhaPlant *arg2) {
if (temp & 0x800) { return; }
- temp_f0 = func_802B80D0(arg0->pos, arg2->pos, arg0->rotX[1], 0, D_80150130[arg0 - camera1], D_802B9624);
+ temp_f0 = func_802B80D0(arg0->pos, arg2->pos, arg0->rot[1], 0, D_80150130[arg0 - camera1], D_802B9624);
if (temp_f0 < 0.0f) {
@@ -941,7 +941,7 @@ loop_2:
sp88 = (f32) phi_v0 * gCourseDirection;
sp8C = (f32) phi_s1->unk2;
sp90 = (f32) phi_s1->unk4;
- temp_f0 = func_802B80D0(camera, &sp88, (u16) camera->rotX2, 0.0f, D_80150130[(s32) (camera - camera1) / 184], D_802B9630);
+ temp_f0 = func_802B80D0(camera, &sp88, (u16) camera->rot2, 0.0f, D_80150130[(s32) (camera - camera1) / 184], D_802B9630);
phi_s5_2 = phi_s5_3;
phi_s5_2 = phi_s5_3;
if (temp_f0 > 0.0f) {
@@ -1163,7 +1163,7 @@ loop_5:
spD8 = (f32) phi_s1->unk2;
spDC = (f32) phi_s1->unk_04;
temp_t0 = temp_s0 & 0xF;
- if (func_802B80D0(camera, temp_a1, (u16) camera->rotX2, 0.0f, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), phi_f22) < 0.0f) {
+ if (func_802B80D0(camera, temp_a1, (u16) camera->rot2, 0.0f, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), phi_f22) < 0.0f) {
goto block_29;
}
if (temp_t0 == 6) {
@@ -1231,7 +1231,7 @@ void func_80299144(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B9658);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B9658);
if (temp_f0 < 0.0f) { return; }
@@ -1254,7 +1254,7 @@ void func_8029930C(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B9660);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B9660);
if (temp_f0 < 0.0f) { return; }
@@ -1277,7 +1277,7 @@ void func_802994D4(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B9668);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B9668);
if (temp_f0 < 0.0f) { return; }
@@ -1300,7 +1300,7 @@ void func_8029969C(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B9670);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B9670);
if (temp_f0 < 0.0f) { return; }
@@ -1323,7 +1323,7 @@ void func_80299864(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B9674);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B9674);
if (temp_f0 < 0.0f) { return; }
@@ -1346,7 +1346,7 @@ void func_80299A2C(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B967C);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B967C);
if (temp_f0 < 0.0f) { return; }
@@ -1369,7 +1369,7 @@ void func_80299BF4(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B9684);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B9684);
if (temp_f0 < 0.0f) { return; }
@@ -1392,7 +1392,7 @@ void func_80299DBC(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B968C);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B968C);
if (temp_f0 < 0.0f) { return; }
@@ -1414,7 +1414,7 @@ void func_80299EDC(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B9694);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B9694);
if (temp_f0 < 0.0f) { return; }
@@ -1436,7 +1436,7 @@ void func_80299FFC(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B969C);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B969C);
if (temp_f0 < 0.0f) { return; }
@@ -1458,7 +1458,7 @@ void func_8029A11C(Camera *camera, Mat4 arg1, struct Actor *arg2) {
if ((temp_v0 & 0x800) != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B96A4);
+ temp_f0 = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B96A4);
if (temp_f0 < 0.0f) { return; }
@@ -1505,7 +1505,7 @@ void func_8029A3AC(Camera *camera, Mat4 arg1, struct ShellActor *shell) {
};
uintptr_t phi_t3;
- f32 temp_f0 = func_802B80D0(camera->pos, shell->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B96AC);
+ f32 temp_f0 = func_802B80D0(camera->pos, shell->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B96AC);
if (temp_f0 < 0.0f) {
func_80297230(camera, (struct Actor *)shell);
return;
@@ -1573,7 +1573,7 @@ void func_8029A8F4(Camera *arg0, Mat4 arg1, struct BananaActor *arg2) {
Vec3s sp7C;
Mat4 sp3C;
- f32 temp = func_802B80D0(arg0->pos, arg2->pos, arg0->rotX[1], 0, D_80150130[arg0 - camera1], D_802B96B4);
+ f32 temp = func_802B80D0(arg0->pos, arg2->pos, arg0->rot[1], 0, D_80150130[arg0 - camera1], D_802B96B4);
if (temp < 0.0f) {
func_80297230(arg0, arg2);
return;
@@ -1667,7 +1667,7 @@ extern f32 D_802B96B8;
void func_8029AC18(Camera *camera, Mat4 arg1, struct Actor *arg2) {
f32 temp;
- temp = func_802B80D0(camera->pos, arg2->pos, camera->rotX[1], 0, D_80150130[camera - camera1], D_802B96B8);
+ temp = func_802B80D0(camera->pos, arg2->pos, camera->rot[1], 0, D_80150130[camera - camera1], D_802B96B8);
if (temp < 0.0f) { return; }
arg1[3][0] = arg2->pos[0]; // unk30
@@ -1718,7 +1718,7 @@ void func_8029AE1C(Camera *arg0, struct PaddleWheelBoat *boat, Mat4 arg2, u16 ar
f32 temp;
if ((arg3 > 20) && (arg3 < 25)) { return; }
- temp = func_802B80D0(arg0->pos, boat->pos, arg0->rotX[1], 90000.0f, D_80150130[arg0 - camera1], D_802B96DC);
+ temp = func_802B80D0(arg0->pos, boat->pos, arg0->rot[1], 90000.0f, D_80150130[arg0 - camera1], D_802B96DC);
if (temp < 0.0f) { return; }
@@ -1748,7 +1748,7 @@ void func_8029B06C(Camera *arg0, struct Actor *arg1) {
s32 pad[6];
Mat4 spD8;
s32 pad2[32];
- f32 temp_f0 = func_802B80D0(arg0->pos, arg1->pos, arg0->rotX[1], 2500.0f, D_80150130[arg0 - camera1], D_802B96E0);
+ f32 temp_f0 = func_802B80D0(arg0->pos, arg1->pos, arg0->rot[1], 2500.0f, D_80150130[arg0 - camera1], D_802B96E0);
if (temp_f0 < 0.0f) { return; }
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
@@ -1791,7 +1791,7 @@ void func_8029B2E4(Camera *arg0, struct Actor *arg1) {
s32 pad2[32];
f32 temp_f0;
- temp_f0 = func_802B80D0(arg0->pos, arg1->pos, arg0->rotX[1], 2500.0f, D_80150130[arg0 - camera1], D_802B96F0);
+ temp_f0 = func_802B80D0(arg0->pos, arg1->pos, arg0->rot[1], 2500.0f, D_80150130[arg0 - camera1], D_802B96F0);
if (temp_f0 < 0.0f) { return; }
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
@@ -1821,7 +1821,7 @@ void func_8029B4E0(Camera *arg0, struct Actor *arg1) {
s32 pad[6];
Mat4 spC8;
s32 pad2[32];
- f32 temp_f0 = func_802B80D0(arg0->pos,arg1->pos, arg0->rotX[1], 2500.0f, D_80150130[arg0 - camera1], D_802B9700);
+ f32 temp_f0 = func_802B80D0(arg0->pos,arg1->pos, arg0->rot[1], 2500.0f, D_80150130[arg0 - camera1], D_802B9700);
if (!(temp_f0 < 0.0f)) {
@@ -1854,7 +1854,7 @@ void func_8029B6EC(Camera *camera, struct Actor* arg1) {
s32 pad[6];
Mat4 spC8;
s32 pad2[32];
- f32 temp_f0 = func_802B80D0(camera->pos, arg1->pos, camera->rotX[1], 2500.0f, D_80150130[camera - camera1], D_802B9710);
+ f32 temp_f0 = func_802B80D0(camera->pos, arg1->pos, camera->rot[1], 2500.0f, D_80150130[camera - camera1], D_802B9710);
if (!(temp_f0 < 0.0f)) {
@@ -1889,7 +1889,7 @@ void func_8029B8E8(Camera *camera, struct TrainCar *actor) {
Mat4 spE0;
Mat4 spA0;
- f32 temp_f0 = func_802B80D0(camera->pos, actor->pos, camera->rotX[1], 2500.0f, D_80150130[camera - camera1], D_802B9720);
+ f32 temp_f0 = func_802B80D0(camera->pos, actor->pos, camera->rot[1], 2500.0f, D_80150130[camera - camera1], D_802B9720);
if (temp_f0 < 0.0f) { return; }
@@ -2004,7 +2004,7 @@ void func_8029BFB0(Camera *camera, struct TrainCar *actor) {
Mat4 spE0;
Mat4 spA0;
- f32 temp_f0 = func_802B80D0(camera->pos, actor->pos, camera->rotX[1], 625.0f, D_80150130[camera - camera1], D_802B9730);
+ f32 temp_f0 = func_802B80D0(camera->pos, actor->pos, camera->rot[1], 625.0f, D_80150130[camera - camera1], D_802B9730);
if (temp_f0 < 0.0f) { return; }
@@ -2074,7 +2074,7 @@ void func_8029C3CC(Camera *camera, struct TrainCar *actor) {
Mat4 spE0;
Mat4 spA0;
- f32 temp_f0 = func_802B80D0(camera->pos, actor->pos, camera->rotX[1], 2025.0f, D_80150130[camera - camera1], D_802B9740);
+ f32 temp_f0 = func_802B80D0(camera->pos, actor->pos, camera->rot[1], 2025.0f, D_80150130[camera - camera1], D_802B9740);
if (temp_f0 < 0.0f) { return; }
@@ -2192,7 +2192,7 @@ void func_8029CA90(Camera *camera, struct FallingRock *rock) {
if (rock->respawnTimer != 0) { return; }
- temp_f0 = func_802B80D0(camera->pos, rock->pos, camera->rotX[1], 400.0f, D_80150130[camera - camera1], D_802B9750);
+ temp_f0 = func_802B80D0(camera->pos, rock->pos, camera->rot[1], 400.0f, D_80150130[camera - camera1], D_802B9750);
if (temp_f0 < 0.0f) { return; }
@@ -4423,7 +4423,7 @@ void func_802A171C(Camera *camera, struct Actor *actor) {
temp_a1 = actor->pos;
sp38 = temp_a1;
- if (func_802B80D0(temp_a1, (u16) camera->rotX2, 0x451C4000, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), D_802B99E0) < 0.0f) {
+ if (func_802B80D0(temp_a1, (u16) camera->rot2, 0x451C4000, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), D_802B99E0) < 0.0f) {
func_80297230(camera, actor);
return;
}
@@ -4713,7 +4713,7 @@ void func_802A1EA0(Camera *camera, struct ItemBox *item_box) {
temp_a1 = item_box->pos;
sp38 = temp_a1;
- temp_f0 = func_802B80D0(temp_a1, (u16) camera->rotX2, 0, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), D_802B9A00);
+ temp_f0 = func_802B80D0(temp_a1, (u16) camera->rot2, 0, *(&D_80150130 + (((s32) (camera - camera1) / 184) * 4)), D_802B9A00);
if (!(temp_f0 < 0.0f) && !(D_802B9A04 < temp_f0)) {
temp_a0 = item_box->state;
phi_a0 = temp_a0;
@@ -4949,7 +4949,7 @@ GLOBAL_ASM("asm/non_matchings/actors/func_802A1EA0.s")
void func_802A269C(Camera *arg0, struct Actor *arg1) {
Mat4 sp38;
- f32 unk = func_802B80D0(arg0->pos, arg1->pos, arg0->rotX[1], 0, D_80150130[arg0 - camera1], D_802B9A28);
+ f32 unk = func_802B80D0(arg0->pos, arg1->pos, arg0->rot[1], 0, D_80150130[arg0 - camera1], D_802B9A28);
if (!(unk < 0.0f)) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -4970,7 +4970,7 @@ void func_802A27A0(Camera *arg0, Mat4 arg1, struct YoshiValleyEgg *egg, u16 arg3
f32 temp_f0;
if (D_800DC50C != CREDITS_SEQUENCE) {
- temp_f0 = func_802B80D0(arg0->pos, egg->pos, arg0->rotX[1], 200.0f, D_80150130[arg0 - camera1], D_802B9A2C);
+ temp_f0 = func_802B80D0(arg0->pos, egg->pos, arg0->rot[1], 200.0f, D_80150130[arg0 - camera1], D_802B9A2C);
if (temp_f0 < 0.0f) {
return;
}
@@ -5014,7 +5014,7 @@ void func_802A29BC(Camera *arg0, Mat4 arg1, struct Actor *arg2) {
s16 temp = arg2->flags;
if (temp & 0x800) { return; }
- unk = func_802B80D0(arg0->pos, arg2->pos, arg0->rotX[1], 0, D_80150130[arg0 - camera1], 16000000.0f);
+ unk = func_802B80D0(arg0->pos, arg2->pos, arg0->rot[1], 0, D_80150130[arg0 - camera1], 16000000.0f);
if (!(unk < 0.0f)) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -5031,7 +5031,7 @@ s16 D_802B885C[] = {0, 0, 0};
void func_802A2AD0(Camera *arg0, struct Actor *arg1) {
Vec3s sp80 = {0, 0, 0};
Mat4 sp40;
- f32 unk = func_802B80D0(arg0->pos, arg1->pos, arg0->rotX[1], 0.0f, D_80150130[arg0 - camera1], 4000000.0f);
+ f32 unk = func_802B80D0(arg0->pos, arg1->pos, arg0->rot[1], 0.0f, D_80150130[arg0 - camera1], 4000000.0f);
if (unk < 0.0f) { return; }
func_802B5F74(sp40, arg1->pos, arg1->rot);
@@ -5063,7 +5063,7 @@ void func_802A2C78(Camera *arg0, Mat4 arg1, struct Actor *arg2) {
return;
}
- temp_f0 = func_802B80D0(arg0->pos, arg2->pos, arg0->rotX[1], 0.0f, D_80150130[arg0 - camera1], 4000000.0f);
+ temp_f0 = func_802B80D0(arg0->pos, arg2->pos, arg0->rot[1], 0.0f, D_80150130[arg0 - camera1], 4000000.0f);
if (!(temp_f0 < 0.0f)) {
if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
@@ -5137,8 +5137,8 @@ void func_802A3008(struct UnkStruct_800DC5EC *arg0) {
struct Actor *phi_s0;
Vec3f sp4C = {0.0f, 5.0f, 10.0f};
- f32 sp48 = sins(temp_s1->rotX[1] - 0x8000); // unk26;
- f32 temp_f0 = coss(temp_s1->rotX[1] - 0x8000);
+ f32 sp48 = sins(temp_s1->rot[1] - 0x8000); // unk26;
+ f32 temp_f0 = coss(temp_s1->rot[1] - 0x8000);
D_801502C0[0][0] = temp_f0;
diff --git a/src/camera.c b/src/camera.c
index 004452091..fb9e39da1 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -2,12 +2,7 @@
#include <macros.h>
#include <common_structs.h>
#include <defines.h>
-
-//f32 D_801646C0;
-//f32 D_801646C4;
-//f32 D_801646C8;
-//f32 D_801646CC;
-//s8 D_801646D0[2];
+#include "camera.h"
Camera cameras[4];
Camera *camera1 = &cameras[0];
@@ -15,17 +10,9 @@ Camera *camera2 = &cameras[1];
Camera *camera3 = &cameras[2];
Camera *camera4 = &cameras[3];
-
-extern Player *gPlayerTwo;
-extern Player *gPlayerThree;
-extern Player *gPlayerFour;
-
-
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
? func_80014DE4(s32, s32, s32, Camera *); /* extern */
-? func_802B7F7C(Camera *, f32 *, s16 *, Camera *); /* extern */
-extern ? D_80150130;
extern ? D_80152300;
extern ? D_80164498;
extern ? D_80164678;
@@ -34,44 +21,39 @@ extern ? D_801649E8;
extern ? D_801649F8;
extern ? D_80164A08;
extern ? D_80164A18;
+extern s32 D_80164A2C;
+extern f32 D_80164A30;
extern ? D_80164A38;
extern ? D_80164A48;
extern ? D_80164A78;
+extern s8 D_80164A88;
+extern s8 D_80164A89;
extern ? D_80164A90;
extern ? D_80164AA0;
-static ? D_800DDB30; /* unable to generate initializer */
-static s32 D_800ED50C = 0x4139999A; /* const */
-static s32 D_800ED510 = 0x4199999A; /* const */
-static s32 D_800ED514 = 0x4139999A; /* const */
-static s32 D_800ED518 = 0x4199999A; /* const */
-static s32 D_800ED51C = 0x4119999A; /* const */
-static s32 D_800ED520 = 0x4139999A; /* const */
-static s32 D_800ED524 = 0x4199999A; /* const */
+static ?32 D_800DDB30[4] = { 0x3ECCCCCD, 0x3F19999A, 0x3E8CCCCD, 0x3E99999A };
-void func_8001C4D0(f32 x, f32 y, f32 z, s16 rot, u32 arg4, s32 cameraId) {
- void *sp30;
+void func_8001C4D0(f32 posX, f32 posY, f32 posZ, s16 rot, u32 arg4, s32 cameraId) {
+ Camera *sp30;
s32 sp2C;
s32 sp28;
f32 *sp24;
f32 *sp20;
- f32 *sp1C;
+ ?32 *sp1C;
+ ?32 *temp_t3;
+ Camera *temp_a3;
+ Camera *temp_a3_2;
+ Player *temp_v1;
f32 *temp_t1;
f32 *temp_t2;
- f32 *temp_t3;
f32 *temp_v0_2;
f32 *temp_v0_3;
- f32 *temp_v0_4;
- f32 *temp_v0_5;
s16 *temp_a0;
s32 temp_t6;
s32 temp_t6_2;
s32 temp_v0;
- void *temp_v1;
- f32 *phi_v0;
- s16 phi_v1;
temp_t6 = cameraId * 2;
- *(&D_80152300 + temp_t6) = arg4;
+ *(&D_80152300 + temp_t6) = (s16) arg4;
switch (arg4) {
case 0:
case 1:
@@ -80,19 +62,20 @@ void func_8001C4D0(f32 x, f32 y, f32 z, s16 rot, u32 arg4, s32 cameraId) {
case 9:
case 10:
D_80164A89 = 0;
- cameras[cameraId].posX = x;
- cameras[cameraId].posY = y;
- cameras[cameraId].posZ = z;
- cameras[cameraId].rotZ = 0;
- cameras[cameraId].unk2 = 150.0f;
- cameras[cameraId].unk1 = y - 3.0;
- cameras[cameraId].unk = 0.0f;
- cameras[cameraId].angleX = 0.0f;
- cameras[cameraId].angleZ = 0.0f;
- cameras[cameraId].angleY = 1.0f;
- cameras[cameraId].unkB0 = 0;
- cameras[cameraId].unk25 = (bitwise s32) 0.0f;
- cameras[cameraId].unkAE = cameraId;
+ temp_a3 = &cameras[cameraId];
+ temp_a3->pos[0] = posX;
+ temp_a3->pos[1] = posY;
+ temp_a3->pos[2] = posZ;
+ temp_a3->rotZ = 0;
+ temp_a3->lookAt[2] = 150.0f;
+ temp_a3->lookAt[1] = (f32) ((f64) posY - 3.0);
+ temp_a3->lookAt[0] = 0.0f;
+ temp_a3->up[0] = 0.0f;
+ temp_a3->up[2] = 0.0f;
+ temp_a3->up[1] = 1.0f;
+ temp_a3->unk_B0 = 0;
+ temp_a3->unk_A0 = 0.0f;
+ temp_a3->playerId = (s16) cameraId;
temp_t6_2 = cameraId * 4;
*(&D_801649D8 + temp_t6_2) = 20.0f;
*(&D_801649E8 + temp_t6_2) = 10.0f;
@@ -106,153 +89,145 @@ void func_8001C4D0(f32 x, f32 y, f32 z, s16 rot, u32 arg4, s32 cameraId) {
*(&D_80164A90 + temp_t6_2) = 0.0f;
*(&D_80164AA0 + temp_t6_2) = 0.0f;
temp_t3 = temp_t6_2 + &D_80164A78;
- *temp_t3 = *(&D_800DDB30 + (gActiveScreenMode * 4));
+ *temp_t3 = D_800DDB30[gActiveScreenMode];
*(&D_80164A18 + temp_t6_2) = 0;
*(&D_80164A08 + temp_t6_2) = 0;
*(&D_80164498 + temp_t6_2) = 0.0f;
- cameras[cameraId].unk24_and_a_half = 0;
- cameras[cameraId].unk22 = 0.0f;
- temp_v1 = gPlayerOne + (cameraId * 0xDD8);
- cameras[cameraId].unk2C = temp_v1->unk2E;
- cameras[cameraId].unk28 = temp_v1->unk2E;
+ temp_a3->unk_9C = 0;
+ temp_a3->unk_94 = 0.0f;
+ temp_v1 = &gPlayerOne[cameraId];
+ temp_a3->unk2C = (s16) temp_v1->unk_02E;
+ temp_a3->unk_AC = temp_v1->unk_02E;
temp_v0 = gActiveScreenMode;
- if (temp_v0 != 0) {
- if (temp_v0 != 1) {
- if (temp_v0 != 2) {
- if (temp_v0 != 3) {
-
- } else if (gModeSelection == BATTLE) {
- cameras[cameraId].unk4 = (bitwise s32) 0.0f;
- cameras[cameraId].unk7 = (bitwise s32) 0.0f;
- cameras[cameraId].unk8 = (bitwise s32) 0.0f;
- cameras[cameraId].unk5 = 0x4139999A;
- cameras[cameraId].unk6 = -0x3DE60000;
- cameras[cameraId].unk9 = 0x4199999A;
- } else {
- cameras[cameraId].unk4 = (bitwise s32) 0.0f;
- cameras[cameraId].unk7 = (bitwise s32) 0.0f;
- cameras[cameraId].unk8 = (bitwise s32) 0.0f;
- cameras[cameraId].unk5 = 0x41100000;
- cameras[cameraId].unk6 = -0x3DE00000;
- cameras[cameraId].unk9 = 0x41900000;
- }
- } else {
- goto block_7;
- }
- } else if (gModeSelection == BATTLE) {
- cameras[cameraId].unk4 = (bitwise s32) 0.0f;
- cameras[cameraId].unk7 = (bitwise s32) 0.0f;
- cameras[cameraId].unk8 = (bitwise s32) 0.0f;
- cameras[cameraId].unk5 = 0x4139999A;
- cameras[cameraId].unk6 = -0x3DE60000;
- cameras[cameraId].unk9 = 0x4199999A;
+ switch (temp_v0) { /* switch 1; irregular */
+ case 0: /* switch 1 */
+ case 2: /* switch 1 */
+ if (gModeSelection == 3) {
+ temp_a3->unk_30[0] = 0.0f;
+ temp_a3->unk_3C[0] = 0.0f;
+ temp_a3->unk_3C[1] = 0.0f;
+ temp_a3->unk_30[1] = 11.6f;
+ temp_a3->unk_30[2] = -38.5f;
+ temp_a3->unk_3C[2] = 19.2f;
+ D_80164A88 = 0;
} else {
- cameras[cameraId].unk4 = (bitwise s32) 0.0f;
- cameras[cameraId].unk7 = (bitwise s32) 0.0f;
- cameras[cameraId].unk8 = (bitwise s32) 0.0f;
- cameras[cameraId].unk9 = (bitwise s32) 30.0f;
- cameras[cameraId].unk5 = 0x4119999A;
- cameras[cameraId].unk6 = -0x3DF40000;
+ temp_a3->unk_30[0] = 0.0f;
+ temp_a3->unk_3C[0] = 0.0f;
+ temp_a3->unk_3C[1] = 0.0f;
+ temp_a3->unk_30[1] = 9.5f;
+ temp_a3->unk_30[2] = -50.0f;
+ temp_a3->unk_3C[2] = 70.0f;
}
- } else {
-block_7:
- if (gModeSelection == BATTLE) {
- cameras[cameraId].unk4 = (bitwise s32) 0.0f;
- cameras[cameraId].unk7 = (bitwise s32) 0.0f;
- cameras[cameraId].unk8 = (bitwise s32) 0.0f;
- cameras[cameraId].unk5 = 0x4139999A;
- cameras[cameraId].unk6 = -0x3DE60000;
- cameras[cameraId].unk9 = 0x4199999A;
- D_80164A88 = 0;
+ break;
+ case 1: /* switch 1 */
+ if (gModeSelection == 3) {
+ temp_a3->unk_30[0] = 0.0f;
+ temp_a3->unk_3C[0] = 0.0f;
+ temp_a3->unk_3C[1] = 0.0f;
+ temp_a3->unk_30[1] = 11.6f;
+ temp_a3->unk_30[2] = -38.5f;
+ temp_a3->unk_3C[2] = 19.2f;
+ } else {
+ temp_a3->unk_30[0] = 0.0f;
+ temp_a3->unk_3C[0] = 0.0f;
+ temp_a3->unk_3C[1] = 0.0f;
+ temp_a3->unk_3C[2] = 30.0f;
+ temp_a3->unk_30[1] = 9.6f;
+ temp_a3->unk_30[2] = -35.0f;
+ }
+ break;
+ case 3: /* switch 1 */
+ if (gModeSelection == 3) {
+ temp_a3->unk_30[0] = 0.0f;
+ temp_a3->unk_3C[0] = 0.0f;
+ temp_a3->unk_3C[1] = 0.0f;
+ temp_a3->unk_30[1] = 11.6f;
+ temp_a3->unk_30[2] = -38.5f;
+ temp_a3->unk_3C[2] = 19.2f;
} else {
- cameras[cameraId].unk4 = (bitwise s32) 0.0f;
- cameras[cameraId].unk7 = (bitwise s32) 0.0f;
- cameras[cameraId].unk8 = (bitwise s32) 0.0f;
- cameras[cameraId].unk5 = 0x41180000;
- cameras[cameraId].unk6 = -0x3DB80000;
- cameras[cameraId].unk9 = 0x428C0000;
+ temp_a3->unk_30[0] = 0.0f;
+ temp_a3->unk_3C[0] = 0.0f;
+ temp_a3->unk_3C[1] = 0.0f;
+ temp_a3->unk_30[1] = 9.0f;
+ temp_a3->unk_30[2] = -40.0f;
+ temp_a3->unk_3C[2] = 18.0f;
}
+ break;
}
sp28 = temp_t6_2;
sp2C = temp_t6;
- sp30 = &cameras[cameraId];
+ sp30 = temp_a3;
sp24 = temp_t1;
sp20 = temp_t2;
sp1C = temp_t3;
- func_80014DE4(cameraId, temp_t6_2, temp_t6, &cameras[cameraId]);
+ func_80014DE4(cameraId, temp_t6_2, temp_t6, temp_a3);
temp_a0 = temp_t6 + &D_80164678;
if (*temp_a0 == 0) {
if (D_80164A28 == 1) {
- temp_v0_2 = temp_t6_2 + &D_80150130;
- *temp_v0_2 = 80.0f;
- phi_v0 = temp_v0_2;
+ D_80150130[cameraId] = 80.0f;
} else {
- temp_v0_3 = temp_t6_2 + &D_80150130;
- *temp_v0_3 = 40.0f;
- phi_v0 = temp_v0_3;
+ D_80150130[cameraId] = 40.0f;
}
- cameras[cameraId].unk30 = *phi_v0;
+ temp_a3->unk_B4 = D_80150130[cameraId];
}
- phi_v1 = *temp_a0;
- if (*temp_a0 == 1) {
- temp_v0_4 = temp_t6_2 + &D_80150130;
+ if (*temp_a0 == (s16) 1) {
+ temp_v0_2 = &D_80150130[cameraId];
if (D_80164A28 == 1) {
- *temp_v0_4 = 100.0f;
+ *temp_v0_2 = 100.0f;
} else {
- *temp_v0_4 = 60.0f;
+ *temp_v0_2 = 60.0f;
}
- cameras[cameraId].unk30 = *temp_v0_4;
- phi_v1 = *temp_a0;
+ temp_a3->unk_B4 = *temp_v0_2;
}
- if (phi_v1 == 2) {
- temp_v0_5 = temp_t6_2 + &D_80150130;
+ if (*temp_a0 == 2) {
+ temp_v0_3 = &D_80150130[cameraId];
if (D_80164A28 == 1) {
- *temp_v0_5 = 100.0f;
+ *temp_v0_3 = 100.0f;
} else {
- *temp_v0_5 = 60.0f;
+ *temp_v0_3 = 60.0f;
}
- cameras[cameraId].unk30 = *temp_v0_5;
+ temp_a3->unk_B4 = *temp_v0_3;
*temp_t1 = 20.0f;
*temp_t2 = 1.5f;
- *temp_t3 = 1.0f;
+ *temp_t3 = 0x3F800000;
}
break;
}
- func_802B7F7C(&cameras[cameraId], &cameras[cameraId].unk, &cameras[cameraId].rotX, &cameras[cameraId]);
+ temp_a3_2 = &cameras[cameraId];
+ func_802B7F7C(temp_a3_2->pos, temp_a3_2->lookAt, temp_a3_2->rot);
}
#else
GLOBAL_ASM("asm/non_matchings/camera/func_8001C4D0.s")
#endif
void func_8001CA10(Camera *camera) {
- camera->unk24_and_a_half = 0;
- camera->unk22 = 6.0f;
+ camera->unk_9C = 0;
+ camera->unk_94 = 6.0f;
}
-void func_8001CA24(Player *arg0, f32 arg1) {
+void func_8001CA24(Player *player, f32 arg1) {
Camera *camera = &cameras[0];
- if (arg0 == gPlayerTwo) {
+ if (player == gPlayerTwo) {
camera += 1;
}
- if (arg0 == gPlayerThree) {
+ if (player == gPlayerThree) {
camera += 2;
}
- if (arg0 == gPlayerFour) {
+ if (player == gPlayerFour) {
camera += 3;
}
- camera->unk24_and_a_half = 0;
- camera->unk22 = arg1;
+ camera->unk_9C = 0;
+ camera->unk_94 = arg1;
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-//? move_f32_towards(f32 *, ?, ?); // extern
-//? func_802B63B8(f32 *, f32 *); // extern
-extern u16 gWaypointCountByPathIndex;
+//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
+? func_802B6540(f32 *, ?, f32, ?, s32); /* extern */
extern f32 D_80164A30;
+s16 gCurrentCourseId; /* unable to generate initializer */
-void func_8001CA78(s32 arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32 *arg5) {
+void func_8001CA78(s32 arg0, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5) {
f32 sp74;
f32 sp70;
f32 sp6C;
@@ -268,47 +243,47 @@ void func_8001CA78(s32 arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32 *
f32 temp_f16;
f32 temp_f18;
f32 temp_f2;
- void *temp_s2;
- f32 phi_f14;
- f32 phi_f14_2;
+ f32 var_f14;
+ f32 var_f14_2;
+ struct TrackWayPoint *temp_s2;
- sp68 = arg1->unk30;
- sp6C = arg1->unk34;
- sp70 = arg1->unk38;
- sp5C = arg1->unk3C;
- sp60 = arg1->unk40;
- sp64 = arg1->unk44;
- arg2->unk0 = arg1->unkC;
- temp_s2 = ((gWaypointCountByPathIndex - 0xA) * 8) + D_80164550;
- arg2->unk4 = arg1->unk10;
- arg2->unk8 = arg1->unk14;
- func_802B6540(&sp74, 0.0f, 1.0f, 0.0f, -0x8000);
+ sp68 = camera->unk_30[0];
+ sp6C = camera->unk_30[1];
+ sp70 = camera->unk_30[2];
+ sp5C = camera->unk_3C[0];
+ sp60 = camera->unk_3C[1];
+ sp64 = camera->unk_3C[2];
+ arg2->unk0 = camera->lookAt[0];
+ temp_s2 = &(*D_80164550)[*gWaypointCountByPathIndex - 0xA];
+ arg2->unk4 = (f32) camera->lookAt[1];
+ arg2->unk8 = (f32) camera->lookAt[2];
+ func_802B6540(&sp74, 0, 1.0f, 0, -0x00008000);
func_802B63B8(&sp5C, &sp74);
- if (gCurrentCourseId == 0xA) {
- phi_f14 = sp5C;
+ if (gCurrentCourseId == 0x000A) {
+ var_f14 = sp5C;
} else {
- phi_f14 = sp5C + temp_s2->unk0;
+ var_f14 = sp5C + (f32) temp_s2->wayPointX;
}
- arg2->unk0 = arg2->unk0 + ((phi_f14 - arg1->unkC) * 1.0f);
- arg2->unk4 = arg2->unk4 + (((sp60 + (temp_s2->unk2 + D_80164A30)) - arg1->unk10) * 1.0f);
- arg2->unk8 = arg2->unk8 + (((sp64 + (bitwise f32) D_8016524C) - arg1->unk14) * 1.0f);
+ arg2->unk0 += (var_f14 - camera->lookAt[0]) * 1.0f;
+ arg2->unk4 = (f32) (arg2->unk4 + (((sp60 + ((f32) temp_s2->wayPointY + D_80164A30)) - camera->lookAt[1]) * 1.0f));
+ arg2->unk8 = (f32) (arg2->unk8 + (((sp64 + (bitwise f32) D_8016524C) - camera->lookAt[2]) * 1.0f));
func_802B63B8(&sp68, &sp74);
- if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) {
- phi_f14_2 = sp68;
+ if (gCurrentCourseId == 0x000A) {
+ var_f14_2 = sp68;
} else {
- phi_f14_2 = sp68 + temp_s2->unk0;
+ var_f14_2 = sp68 + (f32) temp_s2->wayPointX;
}
- sp4C = phi_f14_2;
+ sp4C = var_f14_2;
temp_f16 = sp70 + (bitwise f32) D_8016524C;
sp44 = temp_f16;
- temp_f18 = sp6C + (temp_s2->unk2 + D_80164A30 + 6.0f);
+ temp_f18 = sp6C + ((f32) temp_s2->wayPointY + D_80164A30 + 6.0f);
sp48 = temp_f18;
- move_f32_towards(&D_80164A30, 0, 0x3CA3D70A);
- temp_f0 = arg1->unk0;
- *arg3 = ((phi_f14_2 - temp_f0) * 1.0f) + temp_f0;
- temp_f2 = arg1->unk4;
+ move_f32_towards(&D_80164A30, 0.0f, 0.02f);
+ temp_f0 = camera->pos[0];
+ *arg3 = ((var_f14_2 - temp_f0) * 1.0f) + temp_f0;
+ temp_f2 = camera->pos[1];
*arg4 = ((temp_f18 - temp_f2) * 1.0f) + temp_f2;
- temp_f12 = arg1->unk8;
+ temp_f12 = camera->pos[2];
*arg5 = ((temp_f16 - temp_f12) * 1.0f) + temp_f12;
}
#else
@@ -316,28 +291,17 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8001CA78.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? move_f32_towards(f32, f32, f32 *, f32, ?); // extern
-? func_802B63B8(f32 *, f32 *, f32 *, f32 *); // extern
-extern ? D_800DDB30;
-extern f64 D_800ED528;
-extern f64 D_800ED530;
-extern f64 D_800ED538;
-extern f64 D_800ED540;
-extern f64 D_800ED548;
-extern f64 D_800ED550;
-extern f64 D_800ED558;
-extern f64 D_800ED560;
-extern f64 D_800ED568;
-extern f64 D_800ED570;
-extern f64 D_800ED578;
+//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
+? func_802B6540(f32 *, ?, ?, ?, s32); /* extern */
extern ? D_80164A38;
extern ? D_80164A48;
extern ? D_80164A78;
extern ? D_80164A90;
extern ? D_80164AA0;
+static f32 D_800DDB30[4] = { 0.4f, 0.6f, 0.275f, 0.3f };
+s16 gCurrentCourseId; /* unable to generate initializer */
-void func_8001CCEC(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg7, s16 arg8) {
+void func_8001CCEC(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg7, s16 arg8, s16 arg8) {
f32 sp9C;
f32 sp98;
f32 sp94;
@@ -364,194 +328,168 @@ void func_8001CCEC(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32
f32 *temp_a0_7;
f32 *temp_a0_8;
f32 *temp_a0_9;
- f32 *temp_v1_2;
- f32 *temp_v1_3;
+ f32 *var_v1_2;
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f0_3;
f32 temp_f0_4;
- f32 temp_f0_6;
- f32 temp_f0_7;
- f32 temp_f0_8;
+ f32 temp_f0_5;
f32 temp_f12;
- f32 temp_f12_2;
- f32 temp_f14;
f32 temp_f16;
f32 temp_f2;
- f32 temp_f2_2;
- f32 temp_f2_3;
- f64 temp_f0_5;
- s16 temp_v0;
- s16 temp_v1;
- s32 temp_s2;
- s32 temp_s2_2;
- s32 temp_v0_2;
- s16 phi_v1;
- f32 phi_f2;
- s16 phi_v0;
- f32 phi_f0;
- f32 phi_f16;
- f32 phi_f18;
- s32 phi_s2;
- f32 *phi_v1_2;
- f32 phi_f16_2;
+ f32 var_f0;
+ f32 var_f16;
+ f32 var_f16_2;
+ f32 var_f18;
+ f32 var_f2;
+ s16 var_v0;
+ s16 var_v1;
+ s32 temp_v0;
+ s32 var_s2;
- temp_v1 = arg0->unkDB4 + 1;
- temp_f2 = arg0->unkDBC;
- temp_f0 = (temp_v1 * temp_f2) - (D_800ED528 * (temp_v1 * temp_v1));
- phi_v1 = temp_v1;
- phi_f2 = temp_f2;
- phi_f18 = temp_f0;
- if ((temp_v1 != 0) && (temp_f0 < 0.0f)) {
- temp_f2_2 = temp_f2 * D_800ED530;
- phi_v1 = 0;
- phi_f2 = temp_f2_2;
- if (temp_f2_2 <= D_800ED538) {
- phi_f2 = 0.0f;
+ var_v1 = player->unk_DB4 + 1;
+ var_f2 = player->unk_DBC;
+ temp_f0 = (f32) ((f64) ((f32) var_v1 * var_f2) - (0.7 * (f64) (var_v1 * var_v1)));
+ var_f18 = temp_f0;
+ if ((var_v1 != 0) && (temp_f0 < 0.0f)) {
+ var_v1 = 0;
+ var_f2 = (f32) ((f64) var_f2 * 0.8);
+ if ((f64) var_f2 <= 0.1) {
+ var_f2 = 0.0f;
}
}
- if (temp_f0 <= 0.0f) {
- phi_f18 = 0.0f;
+ if (var_f18 <= 0.0f) {
+ var_f18 = 0.0f;
}
- arg0->unkDB4 = phi_v1;
- arg0->unkDBC = phi_f2;
- temp_v0 = arg1->unk9C + 1;
- temp_f0_2 = arg1->unk94;
- temp_s2 = arg8 * 4;
- temp_a0 = temp_s2 + &D_80164A38;
- temp_f12 = (temp_v0 * temp_f0_2) - (1.25 * (temp_v0 * temp_v0));
- phi_v0 = temp_v0;
- phi_f0 = temp_f0_2;
- phi_f16 = temp_f12;
- phi_s2 = temp_s2;
- if ((temp_v0 != 0) && (temp_f12 < 0.0f)) {
- temp_f0_3 = temp_f0_2 * D_800ED540;
- phi_v0 = 0;
- phi_f0 = temp_f0_3;
- if (temp_f0_3 <= D_800ED548) {
- phi_f0 = 0.0f;
+ player->unk_DB4 = var_v1;
+ player->unk_DBC = var_f2;
+ var_v0 = camera->unk_9C + 1;
+ var_f0 = camera->unk_94;
+ var_s2 = arg8 * 4;
+ temp_a0 = var_s2 + &D_80164A38;
+ temp_f12 = (f32) ((f64) ((f32) var_v0 * var_f0) - (1.25 * (f64) (var_v0 * var_v0)));
+ var_f16 = temp_f12;
+ if ((var_v0 != 0) && (temp_f12 < 0.0f)) {
+ var_v0 = 0;
+ var_f0 = (f32) ((f64) var_f0 * 0.9);
+ if ((f64) var_f0 <= 0.1) {
+ var_f0 = 0.0f;
}
}
- if (temp_f12 <= 0.0f) {
- phi_f16 = 0.0f;
+ if (var_f16 <= 0.0f) {
+ var_f16 = 0.0f;
}
- arg1->unk9C = phi_v0;
- arg1->unk94 = phi_f0;
+ camera->unk_9C = var_v0;
+ camera->unk_94 = var_f0;
if ((&D_80164A38 + (arg8 * 2))->unk4678 == 2) {
sp44 = temp_a0;
- sp50 = phi_f16;
- sp5C = phi_f18;
- move_f32_towards(temp_f12, 0.0f, temp_a0, 20.0f, 0x3DCCCCCD);
- temp_a0_2 = temp_s2 + &D_80164A48;
+ sp50 = var_f16;
+ sp5C = var_f18;
+ move_f32_towards(temp_a0, 20.0f, 0.1f);
+ temp_a0_2 = var_s2 + &D_80164A48;
sp40 = temp_a0_2;
- move_f32_towards((bitwise f32) temp_a0_2, 1.5f, 0x3DCCCCCD);
- temp_v1_2 = temp_s2 + &D_80164A78;
- *temp_v1_2 = *temp_v1_2 + D_800ED550;
- phi_v1_2 = temp_v1_2;
- if (*temp_v1_2 >= 1.0f) {
- *temp_v1_2 = 1.0f;
+ move_f32_towards(temp_a0_2, 1.5f, 0.1f);
+ var_v1_2 = var_s2 + &D_80164A78;
+ *var_v1_2 = (f32) ((f64) *var_v1_2 + 0.1);
+ if (*var_v1_2 >= 1.0f) {
+ *var_v1_2 = 1.0f;
}
} else {
- temp_s2_2 = arg8 * 4;
- temp_a0_3 = temp_s2_2 + &D_80164A38;
+ var_s2 = arg8 * 4;
+ temp_a0_3 = var_s2 + &D_80164A38;
sp44 = temp_a0_3;
- sp50 = phi_f16;
- sp5C = phi_f18;
- move_f32_towards(temp_f12, 0.0f, temp_a0_3, 0.0f, 0x3DCCCCCD);
- temp_a0_4 = temp_s2_2 + &D_80164A48;
+ sp50 = var_f16;
+ sp5C = var_f18;
+ move_f32_towards(temp_a0_3, 0.0f, 0.1f);
+ temp_a0_4 = var_s2 + &D_80164A48;
sp40 = temp_a0_4;
- move_f32_towards((bitwise f32) temp_a0_4, 0.0f, 0x3DCCCCCD);
- temp_v1_3 = temp_s2_2 + &D_80164A78;
- *temp_v1_3 = *temp_v1_3 - D_800ED558;
- temp_f0_4 = *(&D_800DDB30 + (gActiveScreenMode * 4));
- phi_s2 = temp_s2_2;
- phi_v1_2 = temp_v1_3;
- if (*temp_v1_3 <= temp_f0_4) {
- *temp_v1_3 = temp_f0_4;
+ move_f32_towards(temp_a0_4, 0.0f, 0.1f);
+ var_v1_2 = var_s2 + &D_80164A78;
+ *var_v1_2 = (f32) ((f64) *var_v1_2 - 0.1);
+ temp_f0_2 = D_800DDB30[gActiveScreenMode];
+ if (*var_v1_2 <= temp_f0_2) {
+ *var_v1_2 = temp_f0_2;
}
}
- if ((arg0->unkCA & 0x100) == 0x100) {
- temp_v0_2 = gActiveScreenMode;
- if ((temp_v0_2 == 1) || (temp_v0_2 == 2) || (temp_v0_2 == 3)) {
- temp_a0_9 = phi_s2 + &D_80164A90;
- sp38 = temp_a0_9;
- sp3C = phi_v1_2;
- move_f32_towards((bitwise f32) temp_a0_9, 20.0f, 0x3CA3D70A);
- temp_a0_10 = phi_s2 + &D_80164AA0;
- sp34 = temp_a0_10;
- move_f32_towards((bitwise f32) temp_a0_10, 10.0f, 0x3CA3D70A);
- } else if (gCurrentCourseId == 4) {
- temp_a0_5 = phi_s2 + &D_80164A90;
+ if ((player->unk_0CA & 0x100) == 0x100) {
+ temp_v0 = gActiveScreenMode;
+ if ((temp_v0 == 1) || (temp_v0 == 2) || (temp_v0 == 3)) {
+ temp_a0_5 = var_s2 + &D_80164A90;
sp38 = temp_a0_5;
- sp3C = phi_v1_2;
- move_f32_towards((bitwise f32) temp_a0_5, 50.0f, 0x3D23D70A);
- temp_a0_6 = phi_s2 + &D_80164AA0;
+ sp3C = var_v1_2;
+ move_f32_towards(temp_a0_5, 20.0f, 0.02f);
+ temp_a0_6 = var_s2 + &D_80164AA0;
sp34 = temp_a0_6;
- move_f32_towards((bitwise f32) temp_a0_6, 35.0f, 0x3D23D70A);
- } else {
- temp_a0_7 = phi_s2 + &D_80164A90;
+ move_f32_towards(temp_a0_6, 10.0f, 0.02f);
+ } else if (gCurrentCourseId == 4) {
+ temp_a0_7 = var_s2 + &D_80164A90;
sp38 = temp_a0_7;
- sp3C = phi_v1_2;
- move_f32_towards((bitwise f32) temp_a0_7, 40.0f, 0x3CA3D70A);
- temp_a0_8 = phi_s2 + &D_80164AA0;
+ sp3C = var_v1_2;
+ move_f32_towards(temp_a0_7, 50.0f, 0.04f);
+ temp_a0_8 = var_s2 + &D_80164AA0;
sp34 = temp_a0_8;
- move_f32_towards((bitwise f32) temp_a0_8, 20.0f, 0x3CA3D70A);
+ move_f32_towards(temp_a0_8, 35.0f, 0.04f);
+ } else {
+ temp_a0_9 = var_s2 + &D_80164A90;
+ sp38 = temp_a0_9;
+ sp3C = var_v1_2;
+ move_f32_towards(temp_a0_9, 40.0f, 0.02f);
+ temp_a0_10 = var_s2 + &D_80164AA0;
+ sp34 = temp_a0_10;
+ move_f32_towards(temp_a0_10, 20.0f, 0.02f);
}
} else {
- temp_a0_11 = phi_s2 + &D_80164A90;
+ temp_a0_11 = var_s2 + &D_80164A90;
sp38 = temp_a0_11;
- sp3C = phi_v1_2;
- move_f32_towards((bitwise f32) temp_a0_11, 0.0f, 0x3D23D70A);
- temp_a0_12 = phi_s2 + &D_80164AA0;
+ sp3C = var_v1_2;
+ move_f32_towards(temp_a0_11, 0.0f, 0.04f);
+ temp_a0_12 = var_s2 + &D_80164AA0;
sp34 = temp_a0_12;
- move_f32_towards((bitwise f32) temp_a0_12, 0.0f, 0x3D23D70A);
+ move_f32_towards(temp_a0_12, 0.0f, 0.04f);
}
- temp_f0_5 = D_800ED560;
- sp90 = arg1->unk30;
- sp94 = *sp34 + ((arg1->unk34 + (arg0->unkDD2 * temp_f0_5)) - *sp40) + (sp50 / 2.0f);
- sp98 = *sp44 + (arg1->unk38 + sp5C);
- sp84 = arg1->unk3C;
- sp88 = arg1->unk40 + (arg0->unkDD2 * temp_f0_5) + sp50;
- sp8C = (arg1->unk44 + sp5C) - *sp38;
- arg2->unk0 = arg1->unkC;
- arg2->unk4 = arg1->unk10;
- arg2->unk8 = arg1->unk14;
- if ((arg0->unkBC & 0x1000000) == 0x1000000) {
+ sp90 = camera->unk_30[0];
+ sp94 = (f32) ((f64) *sp34 + (((f64) camera->unk_30[1] + ((f64) player->unk_DD2 * 0.85)) - (f64) *sp40) + (f64) (sp50 / 2.0f));
+ sp98 = *sp44 + (camera->unk_30[2] + sp5C);
+ sp84 = camera->unk_3C[0];
+ sp88 = (f32) ((f64) camera->unk_3C[1] + ((f64) player->unk_DD2 * 0.85) + (f64) sp50);
+ sp8C = (camera->unk_3C[2] + sp5C) - *sp38;
+ arg2->unk0 = camera->lookAt[0];
+ arg2->unk4 = (f32) camera->lookAt[1];
+ arg2->unk8 = (f32) camera->lookAt[2];
+ if ((player->unk_0BC & 0x01000000) == 0x01000000) {
sp8C /= 3.0f;
}
- sp3C = phi_v1_2;
- func_802B6540(&sp9C, 0.0f, 1.0f, 0.0f, arg7);
+ sp3C = var_v1_2;
+ func_802B6540(&sp9C, 0, 0x3F800000, 0, (s32) arg8);
func_802B63B8(&sp84, &sp9C);
- temp_f12_2 = sp84 + arg0->unk14;
- temp_f14 = sp8C + arg0->unk1C;
- temp_f16 = sp88 + arg0->unk18;
- arg2->unk0 = arg2->unk0 + ((temp_f12_2 - arg1->unkC) * *phi_v1_2);
- arg2->unk8 = arg2->unk8 + ((temp_f14 - arg1->unk14) * *phi_v1_2);
- if ((((arg0->unk94 / 18.0f) * 216.0f) <= 5.0f) && ((arg0->unkBC & 2) == 2)) {
- arg2->unk4 = arg2->unk4 + ((temp_f16 - arg1->unk10) * D_800ED568);
+ temp_f16 = sp88 + player->pos[1];
+ arg2->unk0 += ((sp84 + player->pos[0]) - camera->lookAt[0]) * *sp3C;
+ arg2->unk8 = (f32) (arg2->unk8 + (((sp8C + player->pos[2]) - camera->lookAt[2]) * *sp3C));
+ if ((((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
+ arg2->unk4 = (f32) ((f64) arg2->unk4 + ((f64) (temp_f16 - camera->lookAt[1]) * 0.02));
} else {
- arg2->unk4 = arg2->unk4 + ((temp_f16 - arg1->unk10) * 0.5);
+ arg2->unk4 = (f32) ((f64) arg2->unk4 + ((f64) (temp_f16 - camera->lookAt[1]) * 0.5));
}
- sp3C = phi_v1_2;
- func_802B63B8((bitwise f32 *) temp_f12_2, (bitwise f32 *) temp_f14, &sp90, &sp9C);
- if ((arg0->unkBC & 0x1000000) != 0x1000000) {
- phi_f16_2 = sp94 + arg0->unk18;
+ sp3C = sp3C;
+ func_802B63B8(&sp90, &sp9C);
+ if ((player->unk_0BC & 0x01000000) != 0x01000000) {
+ var_f16_2 = sp94 + player->pos[1];
} else {
- phi_f16_2 = sp94 + (arg0->unk74 + arg0->unk70);
+ var_f16_2 = sp94 + (player->unk_074 + player->boundingBoxSize);
}
- temp_f0_6 = arg1->unk0;
- *arg3 = (*phi_v1_2 * ((sp90 + arg0->unk14) - temp_f0_6)) + temp_f0_6;
- temp_f2_3 = arg1->unk8;
- *arg5 = (*phi_v1_2 * ((sp98 + arg0->unk1C) - temp_f2_3)) + temp_f2_3;
- if ((((arg0->unk94 / 18.0f) * 216.0f) <= 5.0f) && ((arg0->unkBC & 2) == 2)) {
- temp_f0_7 = arg1->unk4;
- *arg4 = ((phi_f16_2 - temp_f0_7) * D_800ED570) + temp_f0_7;
+ temp_f0_3 = camera->pos[0];
+ *arg3 = (*sp3C * ((sp90 + player->pos[0]) - temp_f0_3)) + temp_f0_3;
+ temp_f2 = camera->pos[2];
+ *arg5 = (*sp3C * ((sp98 + player->pos[2]) - temp_f2)) + temp_f2;
+ if ((((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
+ temp_f0_4 = camera->pos[1];
+ *arg4 = (f32) (((f64) (var_f16_2 - temp_f0_4) * 0.01) + (f64) temp_f0_4);
} else {
- temp_f0_8 = arg1->unk4;
- *arg4 = ((phi_f16_2 - temp_f0_8) * D_800ED578) + temp_f0_8;
+ temp_f0_5 = camera->pos[1];
+ *arg4 = (f32) (((f64) (var_f16_2 - temp_f0_5) * 0.15) + (f64) temp_f0_5);
}
- if ((arg0->unkDE & 1) != 0) {
- *arg4 = *(D_801652A0 + phi_s2);
+ if ((player->unk_0DE & 1) != 0) {
+ *arg4 = *(D_801652A0 + var_s2);
}
}
#else
@@ -559,13 +497,12 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8001CCEC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? move_f32_towards(void *, f32, ?); // extern
-? func_802B63B8(f32 *, f32 *, f32 *, f32 *); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_802B6540(f32 *, f32, ?, f32, s32); /* extern */
extern ? D_80164A90;
extern ? D_80164AA0;
-void func_8001D53C(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg6, s16 arg7) {
+void func_8001D53C(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg6, s16 arg7) {
f32 sp74;
f32 sp70;
f32 sp6C;
@@ -575,48 +512,40 @@ void func_8001D53C(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32
f32 sp5C;
f32 sp3C;
s32 sp38;
- f32 temp_f10;
- f32 temp_f10_2;
- f32 temp_f12;
- f32 temp_f6;
- f32 phi_f0;
+ f32 var_f0;
- if ((arg0->unk222 == 0) && (arg1->unkA0 == 0.0f)) {
- arg1->unkA0 = 0.0f;
+ if (((u16) player->unk_222 == 0) && (camera->unk_A0 == 0.0f)) {
+ camera->unk_A0 = 0.0f;
}
- if (arg0->unk222 != 4) {
- move_f32_towards(arg1 + 0xA0, 20.0f, 0x3D75C28F);
+ if ((u16) player->unk_222 != 4) {
+ move_f32_towards(&camera->unk_A0, 20.0f, 0.06f);
} else {
- move_f32_towards(arg1 + 0xA0, 0.0f, 0x3D75C28F);
+ move_f32_towards(&camera->unk_A0, 0.0f, 0.06f);
}
- temp_f6 = D_801652A0[arg7];
- sp3C = temp_f6;
- sp68 = arg1->unk30;
- temp_f10 = arg1->unk34;
- sp6C = temp_f10;
- sp70 = arg1->unk38;
- sp5C = arg1->unk3C;
- sp60 = arg1->unk40 + arg1->unkA0;
- temp_f10_2 = arg1->unk44;
- sp64 = temp_f10_2;
- arg2->unk0 = arg1->unkC;
- arg2->unk4 = arg1->unk10;
- arg2->unk8 = arg1->unk14;
+ sp3C = D_801652A0[arg7];
+ sp68 = camera->unk_30[0];
+ sp6C = camera->unk_30[1];
+ sp70 = camera->unk_30[2];
+ sp5C = camera->unk_3C[0];
+ sp60 = camera->unk_3C[1] + camera->unk_A0;
+ sp64 = camera->unk_3C[2];
+ arg2->unk0 = camera->lookAt[0];
+ arg2->unk4 = (f32) camera->lookAt[1];
+ arg2->unk8 = (f32) camera->lookAt[2];
sp38 = arg7 * 4;
- func_802B6540(&sp74, 0.0f, 1.0f, 0.0f, arg6);
+ func_802B6540(&sp74, 0.0f, 0x3F800000, 0.0f, (s32) arg6);
func_802B63B8(&sp5C, &sp74);
- temp_f12 = temp_f10_2 + arg0->unk1C;
- arg2->unk0 = arg2->unk0 + (((sp5C + arg0->unk14) - arg1->unkC) * 1.0f);
- arg2->unk8 = arg2->unk8 + ((temp_f12 - arg1->unk14) * 1.0f);
- arg2->unk4 = arg2->unk4 + (((sp60 + arg0->unk18) - arg1->unk10) * 1.0f);
- func_802B63B8((bitwise f32 *) temp_f12, (bitwise f32 *) 1.0f, &sp68, &sp74);
- phi_f0 = temp_f10 + (arg0->unk74 + 1.5);
- if ((arg0->unkCA & 1) == 1) {
- phi_f0 = temp_f10 + (temp_f6 + 10.0f);
+ arg2->unk0 += ((sp5C + player->pos[0]) - camera->lookAt[0]) * 1.0f;
+ arg2->unk8 = (f32) (arg2->unk8 + (((sp64 + player->pos[2]) - camera->lookAt[2]) * 1.0f));
+ arg2->unk4 = (f32) (arg2->unk4 + (((sp60 + player->pos[1]) - camera->lookAt[1]) * 1.0f));
+ func_802B63B8(&sp68, &sp74);
+ var_f0 = (f32) ((f64) sp6C + ((f64) player->unk_074 + 1.5));
+ if ((player->unk_0CA & 1) == 1) {
+ var_f0 = sp6C + (sp3C + 10.0f);
}
- *arg3 = sp68 + arg0->unk14;
- *arg4 = phi_f0;
- *arg5 = sp70 + arg0->unk1C;
+ *arg3 = sp68 + player->pos[0];
+ *arg4 = var_f0;
+ *arg5 = sp70 + player->pos[2];
*(&D_80164A90 + sp38) = 0.0f;
*(&D_80164AA0 + sp38) = 0.0f;
}
@@ -625,10 +554,10 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8001D53C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_802B63B8(f32 *, f32 *); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_802B6540(f32 *, ?, f32, ?, s32); /* extern */
-void func_8001D794(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg6) {
+void func_8001D794(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg6) {
f32 sp6C;
f32 sp68;
f32 sp64;
@@ -640,55 +569,43 @@ void func_8001D794(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32
f32 temp_f12;
f32 temp_f2;
- sp60 = arg1->unk30;
- sp64 = arg1->unk34;
- sp68 = arg1->unk38 - 6.0f;
- sp54 = arg1->unk3C;
- sp58 = arg1->unk40;
- sp5C = arg1->unk44;
- arg2->unk0 = arg1->unkC;
- arg2->unk4 = arg1->unk10;
- arg2->unk8 = arg1->unk14;
- func_802B6540(&sp6C, 0.0f, 1.0f, 0.0f, arg6);
+ sp60 = camera->unk_30[0];
+ sp64 = camera->unk_30[1];
+ sp68 = camera->unk_30[2] - 6.0f;
+ sp54 = camera->unk_3C[0];
+ sp58 = camera->unk_3C[1];
+ sp5C = camera->unk_3C[2];
+ arg2->unk0 = camera->lookAt[0];
+ arg2->unk4 = (f32) camera->lookAt[1];
+ arg2->unk8 = (f32) camera->lookAt[2];
+ func_802B6540(&sp6C, 0, 1.0f, 0, (s32) arg6);
func_802B63B8(&sp54, &sp6C);
- arg2->unk0 = arg2->unk0 + (((sp54 + arg0->unk14) - arg1->unkC) * 1.0f);
- arg2->unk4 = arg2->unk4 + (((sp58 + arg0->unk18) - arg1->unk10) * 1.0f);
- arg2->unk8 = arg2->unk8 + (((sp5C + arg0->unk1C) - arg1->unk14) * 1.0f);
+ arg2->unk0 += ((sp54 + player->pos[0]) - camera->lookAt[0]) * 1.0f;
+ arg2->unk4 = (f32) (arg2->unk4 + (((sp58 + player->pos[1]) - camera->lookAt[1]) * 1.0f));
+ arg2->unk8 = (f32) (arg2->unk8 + (((sp5C + player->pos[2]) - camera->lookAt[2]) * 1.0f));
func_802B63B8(&sp60, &sp6C);
- temp_f0 = arg1->unk0;
- *arg3 = (((sp60 + arg0->unk14) - temp_f0) * 1.0f) + temp_f0;
- temp_f2 = arg1->unk4;
- *arg4 = (((sp64 + arg0->unk18) - temp_f2) * 1.0f) + temp_f2;
- temp_f12 = arg1->unk8;
- *arg5 = (((sp68 + arg0->unk1C) - temp_f12) * 1.0f) + temp_f12;
+ temp_f0 = camera->pos[0];
+ *arg3 = (((sp60 + player->pos[0]) - temp_f0) * 1.0f) + temp_f0;
+ temp_f2 = camera->pos[1];
+ *arg4 = (((sp64 + player->pos[1]) - temp_f2) * 1.0f) + temp_f2;
+ temp_f12 = camera->pos[2];
+ *arg5 = (((sp68 + player->pos[2]) - temp_f12) * 1.0f) + temp_f12;
}
#else
GLOBAL_ASM("asm/non_matchings/camera/func_8001D794.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? move_f32_towards(f32, f32, f32 *, f32, ?); // extern
-? func_802B63B8(f32 *, f32 *, f32 *, f32 *); // extern
-extern ? D_800DDB30;
-extern f64 D_800ED580;
-extern f64 D_800ED588;
-extern f64 D_800ED590;
-extern f64 D_800ED598;
-extern f64 D_800ED5A0;
-extern f64 D_800ED5A8;
-extern f64 D_800ED5B0;
-extern f64 D_800ED5B8;
-extern f64 D_800ED5C0;
-extern f64 D_800ED5C8;
-extern f64 D_800ED5D0;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_802B6540(f32 *, ?, ?, ?, s32); /* extern */
extern ? D_80164A38;
extern ? D_80164A48;
extern ? D_80164A78;
extern ? D_80164A90;
extern ? D_80164AA0;
+static f32 D_800DDB30[4] = { 0.4f, 0.6f, 0.275f, 0.3f };
-void func_8001D944(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg7, s16 arg8) {
+void func_8001D944(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg7, s16 arg8, s16 arg8) {
f32 sp9C;
f32 sp98;
f32 sp94;
@@ -711,176 +628,150 @@ void func_8001D944(void *arg0, void *arg1, void *arg2, f32 *arg3, f32 *arg4, f32
f32 *temp_a0_6;
f32 *temp_a0_7;
f32 *temp_a0_8;
- f32 *temp_v0_2;
- f32 *temp_v0_3;
+ f32 *var_v0_2;
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f0_3;
f32 temp_f0_4;
f32 temp_f0_5;
f32 temp_f0_6;
- f32 temp_f0_7;
- f32 temp_f0_8;
f32 temp_f12;
- f32 temp_f12_2;
- f32 temp_f14;
f32 temp_f16;
f32 temp_f2;
- f32 temp_f2_2;
- f32 temp_f2_4;
- f64 temp_f2_3;
- s16 temp_v0;
- s16 temp_v1;
- s32 temp_s2;
- s32 temp_s2_2;
- s16 phi_v1;
- f32 phi_f2;
- s16 phi_v0;
- f32 phi_f0;
- f32 phi_f16;
- f32 phi_f18;
- s32 phi_s2;
- f32 *phi_v0_2;
- f32 phi_f16_2;
+ f32 var_f0;
+ f32 var_f16;
+ f32 var_f16_2;
+ f32 var_f18;
+ f32 var_f2;
+ s16 var_v0;
+ s16 var_v1;
+ s32 var_s2;
- temp_v1 = arg0->unkDB4 + 1;
- temp_f2 = arg0->unkDBC;
- temp_f0 = (temp_v1 * temp_f2) - (D_800ED580 * (temp_v1 * temp_v1));
- phi_v1 = temp_v1;
- phi_f2 = temp_f2;
- phi_f18 = temp_f0;
- if ((temp_v1 != 0) && (temp_f0 < 0.0f)) {
- temp_f2_2 = temp_f2 * D_800ED588;
- phi_v1 = 0;
- phi_f2 = temp_f2_2;
- if (temp_f2_2 <= D_800ED590) {
- phi_f2 = 0.0f;
+ var_v1 = player->unk_DB4 + 1;
+ var_f2 = player->unk_DBC;
+ temp_f0 = (f32) ((f64) ((f32) var_v1 * var_f2) - (0.7 * (f64) (var_v1 * var_v1)));
+ var_f18 = temp_f0;
+ if ((var_v1 != 0) && (temp_f0 < 0.0f)) {
+ var_v1 = 0;
+ var_f2 = (f32) ((f64) var_f2 * 0.8);
+ if ((f64) var_f2 <= 0.1) {
+ var_f2 = 0.0f;
}
}
- if (temp_f0 <= 0.0f) {
- phi_f18 = 0.0f;
+ if (var_f18 <= 0.0f) {
+ var_f18 = 0.0f;
}
- arg0->unkDB4 = phi_v1;
- arg0->unkDBC = phi_f2;
- temp_v0 = arg1->unk9C + 1;
- temp_f0_2 = arg1->unk94;
- temp_s2 = arg8 * 4;
- temp_a0 = temp_s2 + &D_80164A38;
- temp_f12 = (temp_v0 * temp_f0_2) - (1.25 * (temp_v0 * temp_v0));
- phi_v0 = temp_v0;
- phi_f0 = temp_f0_2;
- phi_f16 = temp_f12;
- phi_s2 = temp_s2;
- if ((temp_v0 != 0) && (temp_f12 < 0.0f)) {
- temp_f0_3 = temp_f0_2 * D_800ED598;
- phi_v0 = 0;
- phi_f0 = temp_f0_3;
- if (temp_f0_3 <= D_800ED5A0) {
- phi_f0 = 0.0f;
+ player->unk_DB4 = var_v1;
+ player->unk_DBC = var_f2;
+ var_v0 = camera->unk_9C + 1;
+ var_f0 = camera->unk_94;
+ var_s2 = arg8 * 4;
+ temp_a0 = var_s2 + &D_80164A38;
+ temp_f12 = (f32) ((f64) ((f32) var_v0 * var_f0) - (1.25 * (f64) (var_v0 * var_v0)));
+ var_f16 = temp_f12;
+ if ((var_v0 != 0) && (temp_f12 < 0.0f)) {
+ var_v0 = 0;
+ var_f0 = (f32) ((f64) var_f0 * 0.9);
+ if ((f64) var_f0 <= 0.1) {
+ var_f0 = 0.0f;
}
}
- if (temp_f12 <= 0.0f) {
- phi_f16 = 0.0f;
+ if (var_f16 <= 0.0f) {
+ var_f16 = 0.0f;
}
- arg1->unk9C = phi_v0;
- arg1->unk94 = phi_f0;
+ camera->unk_9C = var_v0;
+ camera->unk_94 = var_f0;
if ((&D_80164A38 + (arg8 * 2))->unk4678 == 2) {
sp48 = temp_a0;
- sp50 = phi_f16;
- sp5C = phi_f18;
- move_f32_towards(temp_f12, 0.0f, temp_a0, 20.0f, 0x3DCCCCCD);
- temp_a0_2 = temp_s2 + &D_80164A48;
+ sp50 = var_f16;
+ sp5C = var_f18;
+ move_f32_towards(temp_a0, 20.0f, 0.1f);
+ temp_a0_2 = var_s2 + &D_80164A48;
sp44 = temp_a0_2;
- move_f32_towards((bitwise f32) temp_a0_2, 1.5f, 0x3DCCCCCD);
- temp_v0_2 = temp_s2 + &D_80164A78;
- *temp_v0_2 = *temp_v0_2 + D_800ED5A8;
- phi_v0_2 = temp_v0_2;
- if (*temp_v0_2 >= 1.0f) {
- *temp_v0_2 = 1.0f;
+ move_f32_towards(temp_a0_2, 1.5f, 0.1f);
+ var_v0_2 = var_s2 + &D_80164A78;
+ *var_v0_2 = (f32) ((f64) *var_v0_2 + 0.1);
+ if (*var_v0_2 >= 1.0f) {
+ *var_v0_2 = 1.0f;
}
} else {
- temp_s2_2 = arg8 * 4;
- temp_a0_3 = temp_s2_2 + &D_80164A38;
+ var_s2 = arg8 * 4;
+ temp_a0_3 = var_s2 + &D_80164A38;
sp48 = temp_a0_3;
- sp50 = phi_f16;
- sp5C = phi_f18;
- move_f32_towards(temp_f12, 0.0f, temp_a0_3, 0.0f, 0x3DCCCCCD);
- temp_a0_4 = temp_s2_2 + &D_80164A48;
+ sp50 = var_f16;
+ sp5C = var_f18;
+ move_f32_towards(temp_a0_3, 0.0f, 0.1f);
+ temp_a0_4 = var_s2 + &D_80164A48;
sp44 = temp_a0_4;
- move_f32_towards((bitwise f32) temp_a0_4, 0.0f, 0x3DCCCCCD);
- temp_v0_3 = temp_s2_2 + &D_80164A78;
- *temp_v0_3 = *temp_v0_3 - D_800ED5B0;
- temp_f0_4 = *(&D_800DDB30 + (gActiveScreenMode * 4));
- phi_s2 = temp_s2_2;
- phi_v0_2 = temp_v0_3;
- if (*temp_v0_3 <= temp_f0_4) {
- *temp_v0_3 = temp_f0_4;
+ move_f32_towards(temp_a0_4, 0.0f, 0.1f);
+ var_v0_2 = var_s2 + &D_80164A78;
+ *var_v0_2 = (f32) ((f64) *var_v0_2 - 0.1);
+ temp_f0_2 = D_800DDB30[gActiveScreenMode];
+ if (*var_v0_2 <= temp_f0_2) {
+ *var_v0_2 = temp_f0_2;
}
}
- if ((arg0->unkCA & 0x100) == 0x100) {
- temp_a0_5 = phi_s2 + &D_80164A90;
+ if ((player->unk_0CA & 0x100) == 0x100) {
+ temp_a0_5 = var_s2 + &D_80164A90;
sp3C = temp_a0_5;
- sp40 = phi_v0_2;
- move_f32_towards((bitwise f32) temp_a0_5, 15.0f, 0x3CA3D70A);
- temp_a0_6 = phi_s2 + &D_80164AA0;
+ sp40 = var_v0_2;
+ move_f32_towards(temp_a0_5, 15.0f, 0.02f);
+ temp_a0_6 = var_s2 + &D_80164AA0;
sp38 = temp_a0_6;
- move_f32_towards((bitwise f32) temp_a0_6, 20.0f, 0x3CA3D70A);
+ move_f32_towards(temp_a0_6, 20.0f, 0.02f);
} else {
- temp_a0_7 = phi_s2 + &D_80164A90;
+ temp_a0_7 = var_s2 + &D_80164A90;
sp3C = temp_a0_7;
- sp40 = phi_v0_2;
- move_f32_towards((bitwise f32) temp_a0_7, 0.0f, 0x3CA3D70A);
- temp_a0_8 = phi_s2 + &D_80164AA0;
+ sp40 = var_v0_2;
+ move_f32_towards(temp_a0_7, 0.0f, 0.02f);
+ temp_a0_8 = var_s2 + &D_80164AA0;
sp38 = temp_a0_8;
- move_f32_towards((bitwise f32) temp_a0_8, 0.0f, 0x3CA3D70A);
+ move_f32_towards(temp_a0_8, 0.0f, 0.02f);
}
- temp_f2_3 = D_800ED5B8;
- sp90 = arg1->unk30;
- temp_f0_5 = *sp38;
- sp94 = temp_f0_5 + ((arg1->unk34 + (arg0->unkDD2 * temp_f2_3)) - *sp44) + (sp50 / 2.0f);
- sp98 = temp_f0_5 + (arg1->unk38 + sp5C + *sp48);
- sp84 = arg1->unk3C;
- sp88 = arg1->unk40 + (arg0->unkDD2 * temp_f2_3) + sp50;
- sp8C = (arg1->unk44 + sp5C) - *sp3C;
- arg2->unk0 = arg1->unkC;
- arg2->unk4 = arg1->unk10;
- arg2->unk8 = arg1->unk14;
- if ((arg0->unkBC & 0x1000000) == 0x1000000) {
+ sp90 = camera->unk_30[0];
+ temp_f0_3 = *sp38;
+ sp94 = (f32) ((f64) temp_f0_3 + (((f64) camera->unk_30[1] + ((f64) player->unk_DD2 * 0.85)) - (f64) *sp44) + (f64) (sp50 / 2.0f));
+ sp98 = temp_f0_3 + (camera->unk_30[2] + sp5C + *sp48);
+ sp84 = camera->unk_3C[0];
+ sp88 = (f32) ((f64) camera->unk_3C[1] + ((f64) player->unk_DD2 * 0.85) + (f64) sp50);
+ sp8C = (camera->unk_3C[2] + sp5C) - *sp3C;
+ arg2->unk0 = camera->lookAt[0];
+ arg2->unk4 = (f32) camera->lookAt[1];
+ arg2->unk8 = (f32) camera->lookAt[2];
+ if ((player->unk_0BC & 0x01000000) == 0x01000000) {
sp8C /= 3.0f;
}
- sp40 = phi_v0_2;
- func_802B6540(&sp9C, 0.0f, 1.0f, 0.0f, arg7);
+ sp40 = var_v0_2;
+ func_802B6540(&sp9C, 0, 0x3F800000, 0, (s32) arg8);
func_802B63B8(&sp84, &sp9C);
- temp_f12_2 = sp84 + arg0->unk14;
- temp_f14 = sp8C + arg0->unk1C;
- temp_f16 = sp88 + arg0->unk18;
- arg2->unk0 = arg2->unk0 + ((temp_f12_2 - arg1->unkC) * *phi_v0_2);
- arg2->unk8 = arg2->unk8 + ((temp_f14 - arg1->unk14) * *phi_v0_2);
- if ((((arg0->unk94 / 18.0f) * 216.0f) <= 5.0f) && ((arg0->unkBC & 2) == 2)) {
- arg2->unk4 = arg2->unk4 + ((temp_f16 - arg1->unk10) * D_800ED5C0);
+ temp_f16 = sp88 + player->pos[1];
+ arg2->unk0 += ((sp84 + player->pos[0]) - camera->lookAt[0]) * *sp40;
+ arg2->unk8 = (f32) (arg2->unk8 + (((sp8C + player->pos[2]) - camera->lookAt[2]) * *sp40));
+ if ((((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
+ arg2->unk4 = (f32) ((f64) arg2->unk4 + ((f64) (temp_f16 - camera->lookAt[1]) * 0.02));
} else {
- arg2->unk4 = arg2->unk4 + ((temp_f16 - arg1->unk10) * 0.5);
+ arg2->unk4 = (f32) ((f64) arg2->unk4 + ((f64) (temp_f16 - camera->lookAt[1]) * 0.5));
}
- sp40 = phi_v0_2;
- func_802B63B8((bitwise f32 *) temp_f12_2, (bitwise f32 *) temp_f14, &sp90, &sp9C);
- if ((arg0->unkBC & 0x1000000) != 0x1000000) {
- phi_f16_2 = sp94 + arg0->unk18;
+ sp40 = sp40;
+ func_802B63B8(&sp90, &sp9C);
+ if ((player->unk_0BC & 0x01000000) != 0x01000000) {
+ var_f16_2 = sp94 + player->pos[1];
} else {
- phi_f16_2 = sp94 + (arg0->unk74 + arg0->unk70);
+ var_f16_2 = sp94 + (player->unk_074 + player->boundingBoxSize);
}
- temp_f0_6 = arg1->unk0;
- *arg3 = (*phi_v0_2 * ((sp90 + arg0->unk14) - temp_f0_6)) + temp_f0_6;
- temp_f2_4 = arg1->unk8;
- *arg5 = (*phi_v0_2 * ((sp98 + arg0->unk1C) - temp_f2_4)) + temp_f2_4;
- if ((((arg0->unk94 / 18.0f) * 216.0f) <= 5.0f) && ((arg0->unkBC & 2) == 2)) {
- temp_f0_7 = arg1->unk4;
- *arg4 = ((phi_f16_2 - temp_f0_7) * D_800ED5C8) + temp_f0_7;
+ temp_f0_4 = camera->pos[0];
+ *arg3 = (*sp40 * ((sp90 + player->pos[0]) - temp_f0_4)) + temp_f0_4;
+ temp_f2 = camera->pos[2];
+ *arg5 = (*sp40 * ((sp98 + player->pos[2]) - temp_f2)) + temp_f2;
+ if ((((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) && ((player->unk_0BC & 2) == 2)) {
+ temp_f0_5 = camera->pos[1];
+ *arg4 = (f32) (((f64) (var_f16_2 - temp_f0_5) * 0.01) + (f64) temp_f0_5);
} else {
- temp_f0_8 = arg1->unk4;
- *arg4 = ((phi_f16_2 - temp_f0_8) * D_800ED5D0) + temp_f0_8;
+ temp_f0_6 = camera->pos[1];
+ *arg4 = (f32) (((f64) (var_f16_2 - temp_f0_6) * 0.15) + (f64) temp_f0_6);
}
- if ((arg0->unkDE & 1) != 0) {
- *arg4 = *(D_801652A0 + phi_s2);
+ if (player->unk_0DE & 1) {
+ *arg4 = *(D_801652A0 + var_s2);
}
}
#else
@@ -888,13 +779,10 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8001D944.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8001CA78(void *, void *, f32 *, f32 *, f32 *, f32 *, s32, s32); // extern
-? func_800224F0(s32, s16, s16, void *); // extern
-s16 func_802ADDC8(void *, f32, f32, f32, f32); // extern
-s16 atan2s(f32, f32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8001CA78(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, s32, s32); /* extern */
-void func_8001E0C4(void *arg0, void *arg1, s8 arg2) {
+void func_8001E0C4(Camera *camera, Player *player, s8 arg2) {
f32 sp84;
f32 sp80;
f32 sp7C;
@@ -907,76 +795,68 @@ void func_8001E0C4(void *arg0, void *arg1, s8 arg2) {
f32 temp_f14;
f32 temp_f2;
f32 temp_f2_2;
- s16 temp_a1;
s16 temp_v0;
- void *temp_a3;
- s16 phi_a2;
+ s16 var_a2;
- temp_v0 = arg1->unk78;
- temp_a3 = arg1;
+ temp_v0 = player->unk_078;
if (temp_v0 == 0) {
- phi_a2 = 0x64;
+ var_a2 = 0x0064;
} else if (temp_v0 < 0) {
- phi_a2 = 0x87 - (temp_v0 / 3);
+ var_a2 = 0x87 - (temp_v0 / 3);
} else {
- phi_a2 = (temp_v0 / 3) + 0x87;
+ var_a2 = (temp_v0 / 3) + 0x87;
}
- temp_a1 = temp_a3->unk2E;
- arg1 = temp_a3;
- func_800224F0(arg0 + 0x2C, temp_a1, phi_a2, temp_a3);
- func_8001CA78(arg1, arg0, &sp60, &sp74, &sp70, &sp6C, arg0->unk2C, arg2);
- arg0->unk2A = arg0->unk2A & 0xFFFB;
- temp_f0 = arg0->unk68;
+ func_800224F0(&camera->unk_2C, player->unk_02E, var_a2);
+ func_8001CA78(player, camera, &sp60, &sp74, &sp70, &sp6C, (s32) camera->unk_2C, (s32) arg2);
+ camera->rotZ = (u16) camera->rotZ & 0xFFFB;
+ func_802ADDC8(&camera->unk_54, (f32) 3, sp74, sp70, sp6C);
+ temp_f0 = camera->unk_54.unk44;
if (temp_f0 < 0.0f) {
- sp74 += -arg0->unk84 * temp_f0 * 1.0f;
- sp70 = sp70 + ((-arg0->unk88 * arg0->unk68) * 0.5);
- sp6C += -arg0->unk8C * arg0->unk68 * 1.0f;
+ sp74 += -camera->unk_54.unk60[0] * temp_f0 * 1.0f;
+ sp70 = (f32) ((f64) sp70 + ((f64) (-camera->unk_54.unk60[1] * camera->unk_54.unk44) * 0.5));
+ sp6C += -camera->unk_54.unk60[2] * camera->unk_54.unk44 * 1.0f;
}
- temp_f2 = arg0->unk60;
+ temp_f2 = camera->unk_54.unk3C;
if (temp_f2 < 0.0f) {
- arg0->unk2A = arg0->unk2A | 6;
- sp74 = sp74 + ((-arg0->unk6C * temp_f2) * 1.5);
- sp70 += -arg0->unk70 * arg0->unk60 * 1.0f;
- sp6C = sp6C + ((-arg0->unk74 * arg0->unk60) * 1.5);
+ camera->rotZ = (u16) camera->rotZ | 6;
+ sp74 = (f32) ((f64) sp74 + ((f64) (-camera->unk_54.unk48[0] * temp_f2) * 1.5));
+ sp70 += -camera->unk_54.unk48[1] * camera->unk_54.unk3C * 1.0f;
+ sp6C = (f32) ((f64) sp6C + ((f64) (-camera->unk_54.unk48[2] * camera->unk_54.unk3C) * 1.5));
}
- temp_f2_2 = arg0->unk64;
+ temp_f2_2 = camera->unk_54.unk40;
if (temp_f2_2 < 0.0f) {
- arg0->unk2A = arg0->unk2A | 6;
- sp74 = sp74 + ((-arg0->unk78 * temp_f2_2) * 1.5);
- sp70 += -arg0->unk7C * arg0->unk64 * 1.0f;
- sp6C = sp6C + ((-arg0->unk80 * arg0->unk64) * 1.5);
+ camera->rotZ = (u16) camera->rotZ | 6;
+ sp74 = (f32) ((f64) sp74 + ((f64) (-camera->unk_54.unk54[0] * temp_f2_2) * 1.5));
+ sp70 += -camera->unk_54.unk54[1] * camera->unk_54.unk40 * 1.0f;
+ sp6C = (f32) ((f64) sp6C + ((f64) (-camera->unk_54.unk54[2] * camera->unk_54.unk40) * 1.5));
}
- if ((func_802ADDC8(arg0 + 0x54, 3, sp74, sp70, sp6C) == 0) && ((arg0->unk2A & 2) != 2)) {
- arg0->unkAC = arg0->unk2C;
+ if (((s16) M2C_ERROR(Read from unset register $v0) == 0) && (((u16) camera->rotZ & 2) != 2)) {
+ camera->unk_AC = camera->unk_2C;
}
- arg0->unkC = sp60;
- arg0->unk10 = sp64;
- arg0->unk14 = sp68;
- arg0->unk0 = sp74;
- arg0->unk4 = sp70;
- temp_f12 = arg0->unkC - arg0->unk0;
- arg0->unk8 = sp6C;
- sp80 = arg0->unk10 - arg0->unk4;
+ camera->lookAt[0] = sp60;
+ camera->lookAt[1] = sp64;
+ camera->lookAt[2] = sp68;
+ camera->pos[0] = sp74;
+ camera->pos[1] = sp70;
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ camera->pos[2] = sp6C;
+ sp80 = camera->lookAt[1] - camera->pos[1];
sp84 = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp7C = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/camera/func_8001E0C4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8001CCEC(void *, void *, f32 *, f32 *, f32 *, f32 *, ? *, s32, s32); // extern
-? func_800224F0(void *, s16, s16, s16); // extern
-? move_s16_towards(void *, ?, ?, s16); // extern
-? func_802ADDC8(void *, f32, f32, f32, f32); // extern
-s16 atan2s(f32, f32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8001CCEC(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, ? *, s32, s32); /* extern */
-void func_8001E45C(void *arg0, void *arg1, s8 arg2) {
+void func_8001E45C(Camera *camera, Player *player, s8 arg2) {
f32 sp94;
f32 sp90;
f32 sp8C;
@@ -993,96 +873,91 @@ void func_8001E45C(void *arg0, void *arg1, s8 arg2) {
s16 temp_a3_3;
s16 temp_v1;
s16 temp_v1_2;
+ s16 var_a3;
s32 temp_v0;
- s16 phi_a3;
- temp_v0 = arg1->unkBC;
+ temp_v0 = player->unk_0BC;
if ((temp_v0 & 0x10) == 0x10) {
- temp_v1 = arg1->unk78;
- phi_a3 = 0x64;
+ temp_v1 = player->unk_078;
+ var_a3 = 0x0064;
if (temp_v1 == 0) {
- arg0->unkB0 = 0;
+ camera->unk_B0 = 0;
} else {
if (temp_v1 < 0) {
temp_a3 = 0xA5 - (temp_v1 / 2);
if ((temp_v0 & 0x20000000) == 0x20000000) {
sp4E = temp_a3;
- move_s16_towards(arg0 + 0xB0, -0xB60, 0x3DCCCCCD, temp_a3);
+ move_s16_towards(&camera->unk_B0, -0x0B60, 0.1f);
} else {
sp4E = temp_a3;
- move_s16_towards(arg0 + 0xB0, -0x888, 0x3DCCCCCD, temp_a3);
+ move_s16_towards(&camera->unk_B0, -0x0888, 0.1f);
}
} else {
temp_a3_2 = (temp_v1 / 2) + 0xA5;
if ((temp_v0 & 0x20000000) == 0x20000000) {
sp4E = temp_a3_2;
- move_s16_towards(arg0 + 0xB0, 0xB60, 0x3DCCCCCD, temp_a3_2);
+ move_s16_towards(&camera->unk_B0, 0x0B60, 0.1f);
} else {
sp4E = temp_a3_2;
- move_s16_towards(arg0 + 0xB0, 0x888, 0x3DCCCCCD, temp_a3_2);
+ move_s16_towards(&camera->unk_B0, 0x0888, 0.1f);
}
}
- phi_a3 = sp4E;
- }
- goto block_26;
- }
- move_s16_towards(arg0 + 0xB0, 0, 0x3D4CCCCD);
- temp_v1_2 = arg1->unk78;
- temp_a3_3 = (arg0->unk2C / 0xB6) - (arg1->unk2E / 0xB6);
- if (temp_v1_2 == 0) {
- if ((arg1->unkBC & 0x20) == 0x20) {
- phi_a3 = 0x2D8;
- } else {
- phi_a3 = 0x1F4;
+ var_a3 = sp4E;
}
} else {
- if (temp_v1_2 < 0) {
+ move_s16_towards(&camera->unk_B0, 0, 0.05f);
+ temp_v1_2 = player->unk_078;
+ temp_a3_3 = ((s16) camera->unk_2C / 182) - ((s16) player->unk_02E / 182);
+ if (temp_v1_2 == 0) {
+ if ((player->unk_0BC & 0x20) == 0x20) {
+ var_a3 = 0x02D8;
+ } else {
+ var_a3 = 0x01F4;
+ }
+ } else if (temp_v1_2 < 0) {
if ((temp_a3_3 < -0x45) || (temp_a3_3 >= 0x46)) {
- phi_a3 = 0xB4 - temp_v1_2;
+ var_a3 = 0xB4 - temp_v1_2;
} else {
- phi_a3 = 0xA5 - (temp_v1_2 / 2);
+ var_a3 = 0xA5 - (temp_v1_2 / 2);
}
} else if ((temp_a3_3 < -0x45) || (temp_a3_3 >= 0x46)) {
- phi_a3 = temp_v1_2 + 0xB4;
+ var_a3 = temp_v1_2 + 0xB4;
} else {
- phi_a3 = (temp_v1_2 / 2) + 0xA5;
+ var_a3 = (temp_v1_2 / 2) + 0xA5;
}
-block_26:
}
- if (((arg1->unkBC & 0x80) == 0x80) || ((arg1->unkBC & 0x40) == 0x40) || ((arg1->unkBC & 0x4000) == 0x4000) || ((arg1->unkBC & 0x80000) == 0x80000) || ((arg1->unkBC & 0x800000) == 0x800000) || (((arg1->unkBC & 0x20) == 0x20) && (arg1->unk78 != 0)) || (arg1->unk11C <= 0.0f) || (arg1->unk120 <= 0.0f) || ((arg1->unkBC & 0x20000) == 0x20000)) {
- func_8001CCEC(arg1, arg0, &sp64, &sp84, &sp80, &sp7C, &sp58, arg0->unk2C, arg2);
+ if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) || ((player->unk_0BC & 0x4000) == 0x4000) || ((player->unk_0BC & 0x80000) == 0x80000) || ((player->unk_0BC & 0x800000) == 0x800000) || (((player->unk_0BC & 0x20) == 0x20) && (player->unk_078 != 0)) || (player->unk_110.unk3C <= 0.0f) || (player->unk_110.unk40 <= 0.0f) || ((player->unk_0BC & 0x20000) == 0x20000)) {
+ func_8001CCEC(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
- func_800224F0(arg0 + 0x2C, arg1->unk2E + arg0->unkB0, phi_a3, phi_a3);
- func_8001CCEC(arg1, arg0, &sp64, &sp84, &sp80, &sp7C, &sp58, arg0->unk2C, arg2);
+ func_800224F0(&camera->unk_2C, (s16) (player->unk_02E + camera->unk_B0), var_a3);
+ func_8001CCEC(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
}
- arg0->unk2A = arg0->unk2A & 0xFFFB;
- func_802ADDC8(arg0 + 0x54, 3, sp84, sp80, sp7C);
- arg0->unk0 = sp84;
- arg0->unk4 = sp80;
- arg0->unk8 = sp7C;
- arg0->unkC = sp64;
- arg0->unk10 = sp68;
- temp_f12 = arg0->unkC - arg0->unk0;
- arg0->unk14 = sp6C;
- sp90 = arg0->unk10 - arg0->unk4;
+ camera->rotZ = (u16) camera->rotZ & 0xFFFB;
+ func_802ADDC8(&camera->unk_54, (f32) 3, sp84, sp80, sp7C);
+ camera->pos[0] = sp84;
+ camera->pos[1] = sp80;
+ camera->pos[2] = sp7C;
+ camera->lookAt[0] = sp64;
+ camera->lookAt[1] = sp68;
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ camera->lookAt[2] = sp6C;
+ sp90 = camera->lookAt[1] - camera->pos[1];
sp94 = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp8C = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/camera/func_8001E45C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8001D53C(void *, void *, f32 *, f32 *, f32 *, f32 *, s32, s32); // extern
-? func_802ADDC8(void *, ?, f32, f32, f32); // extern
-s16 atan2s(f32, f32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8001D53C(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, s32, s32); /* extern */
-void func_8001E8E8(void *arg0, void *arg1, s8 arg2) {
+void func_8001E8E8(Camera *camera, Player *player, s8 arg2) {
f32 sp8C;
f32 sp88;
f32 sp84;
@@ -1093,38 +968,34 @@ void func_8001E8E8(void *arg0, void *arg1, s8 arg2) {
f32 temp_f12;
f32 temp_f14;
- arg0->unkB0 = 0;
- arg0->unk2C = arg1->unk2E;
- func_8001D53C(arg1, arg0, &sp5C, &sp7C, &sp78, &sp74, arg1->unk2E, arg2);
- func_802ADDC8(arg0 + 0x54, 0x40A00000, sp7C, sp78, sp74);
- arg0->unkC = sp5C;
- arg0->unk10 = sp60;
- arg0->unk14 = sp64;
- arg0->unk0 = sp7C;
- arg0->unk4 = sp78;
- temp_f12 = arg0->unkC - arg0->unk0;
- arg0->unk8 = sp74;
- sp88 = arg0->unk10 - arg0->unk4;
+ camera->unk_B0 = 0;
+ camera->unk2C = (s16) player->unk_02E;
+ func_8001D53C(player, camera, &sp5C, &sp7C, &sp78, &sp74, (s32) player->unk_02E, (s32) arg2);
+ func_802ADDC8(&camera->unk_54, 5.0f, sp7C, sp78, sp74);
+ camera->lookAt[0] = sp5C;
+ camera->lookAt[1] = sp60;
+ camera->lookAt[2] = sp64;
+ camera->pos[0] = sp7C;
+ camera->pos[1] = sp78;
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ camera->pos[2] = sp74;
+ sp88 = camera->lookAt[1] - camera->pos[1];
sp8C = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp84 = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/camera/func_8001E8E8.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8001D944(void *, void *, f32 *, f32 *, f32 *, f32 *, ? *, s32, s32); // extern
-? func_800224F0(void *, s16, s16, s16); // extern
-? move_s16_towards(void *, ?, ?, s16); // extern
-? func_802ADDC8(void *, f32, f32, f32, f32); // extern
-s16 atan2s(f32, f32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8001D944(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, ? *, s32, s32); /* extern */
-void func_8001EA0C(void *arg0, void *arg1, s8 arg2) {
+void func_8001EA0C(Camera *camera, Player *player, s8 arg2) {
f32 sp94;
f32 sp90;
f32 sp8C;
@@ -1141,107 +1012,103 @@ void func_8001EA0C(void *arg0, void *arg1, s8 arg2) {
s16 temp_a3_3;
s16 temp_v1;
s16 temp_v1_2;
+ s16 var_a3;
s32 temp_v0;
- s16 phi_a3;
- temp_v0 = arg1->unkBC;
+ temp_v0 = player->unk_0BC;
if ((temp_v0 & 0x10) == 0x10) {
- temp_v1 = arg1->unk78;
- phi_a3 = 0x64;
+ temp_v1 = player->unk_078;
+ var_a3 = 0x0064;
if (temp_v1 == 0) {
- arg0->unkB0 = 0;
+ camera->unk_B0 = 0;
} else {
if (temp_v1 < 0) {
temp_a3 = 0xA5 - (temp_v1 / 2);
if ((temp_v0 & 0x20000000) == 0x20000000) {
sp4E = temp_a3;
- move_s16_towards(arg0 + 0xB0, -0xB60, 0x3DCCCCCD, temp_a3);
+ move_s16_towards(&camera->unk_B0, -0x0B60, 0.1f);
} else {
sp4E = temp_a3;
- move_s16_towards(arg0 + 0xB0, -0x888, 0x3DCCCCCD, temp_a3);
+ move_s16_towards(&camera->unk_B0, -0x0888, 0.1f);
}
} else {
temp_a3_2 = (temp_v1 / 2) + 0xA5;
if ((temp_v0 & 0x20000000) == 0x20000000) {
sp4E = temp_a3_2;
- move_s16_towards(arg0 + 0xB0, 0xB60, 0x3DCCCCCD, temp_a3_2);
+ move_s16_towards(&camera->unk_B0, 0x0B60, 0.1f);
} else {
sp4E = temp_a3_2;
- move_s16_towards(arg0 + 0xB0, 0x888, 0x3DCCCCCD, temp_a3_2);
+ move_s16_towards(&camera->unk_B0, 0x0888, 0.1f);
}
}
- phi_a3 = sp4E;
- }
- goto block_26;
- }
- move_s16_towards(arg0 + 0xB0, 0, 0x3D4CCCCD);
- temp_v1_2 = arg1->unk78;
- temp_a3_3 = (arg0->unk2C / 0xB6) - (arg1->unk2E / 0xB6);
- if (temp_v1_2 == 0) {
- if ((arg1->unkBC & 0x20) == 0x20) {
- phi_a3 = 0x2D8;
- } else {
- phi_a3 = 0x1F4;
+ var_a3 = sp4E;
}
} else {
- if (temp_v1_2 < 0) {
+ move_s16_towards(&camera->unk_B0, 0, 0.05f);
+ temp_v1_2 = player->unk_078;
+ temp_a3_3 = ((s16) camera->unk_2C / 182) - ((s16) player->unk_02E / 182);
+ if (temp_v1_2 == 0) {
+ if ((player->unk_0BC & 0x20) == 0x20) {
+ var_a3 = 0x02D8;
+ } else {
+ var_a3 = 0x01F4;
+ }
+ } else if (temp_v1_2 < 0) {
if ((temp_a3_3 < -0x45) || (temp_a3_3 >= 0x46)) {
- phi_a3 = 0xB4 - temp_v1_2;
+ var_a3 = 0xB4 - temp_v1_2;
} else {
- phi_a3 = 0xA5 - (temp_v1_2 / 2);
+ var_a3 = 0xA5 - (temp_v1_2 / 2);
}
} else if ((temp_a3_3 < -0x45) || (temp_a3_3 >= 0x46)) {
- phi_a3 = temp_v1_2 + 0xB4;
+ var_a3 = temp_v1_2 + 0xB4;
} else {
- phi_a3 = (temp_v1_2 / 2) + 0xA5;
+ var_a3 = (temp_v1_2 / 2) + 0xA5;
}
-block_26:
}
- if (((arg1->unkBC & 0x80) == 0x80) || ((arg1->unkBC & 0x40) == 0x40) || ((arg1->unkBC & 0x4000) == 0x4000) || ((arg1->unkBC & 0x80000) == 0x80000) || ((arg1->unkBC & 0x800000) == 0x800000) || (((arg1->unkBC & 0x20) == 0x20) && (arg1->unk78 != 0)) || (arg1->unk11C <= 0.0f) || (arg1->unk120 <= 0.0f) || ((arg1->unkBC & 0x20000) == 0x20000)) {
- func_8001D944(arg1, arg0, &sp64, &sp84, &sp80, &sp7C, &sp58, arg0->unk2C, arg2);
+ if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) || ((player->unk_0BC & 0x4000) == 0x4000) || ((player->unk_0BC & 0x80000) == 0x80000) || ((player->unk_0BC & 0x800000) == 0x800000) || (((player->unk_0BC & 0x20) == 0x20) && (player->unk_078 != 0)) || (player->unk_110.unk3C <= 0.0f) || (player->unk_110.unk40 <= 0.0f) || ((player->unk_0BC & 0x20000) == 0x20000)) {
+ func_8001D944(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
- func_800224F0(arg0 + 0x2C, arg1->unk2E + arg0->unkB0, phi_a3, phi_a3);
- func_8001D944(arg1, arg0, &sp64, &sp84, &sp80, &sp7C, &sp58, arg0->unk2C, arg2);
+ func_800224F0(&camera->unk_2C, (s16) (player->unk_02E + camera->unk_B0), var_a3);
+ func_8001D944(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
}
- arg0->unk2A = arg0->unk2A & 0xFFFB;
- func_802ADDC8(arg0 + 0x54, 3, sp84, sp80, sp7C);
- arg0->unk0 = sp84;
- arg0->unk4 = sp80;
- arg0->unk8 = sp7C;
- arg0->unkC = sp64;
- arg0->unk10 = sp68;
- temp_f12 = arg0->unkC - arg0->unk0;
- arg0->unk14 = sp6C;
- sp90 = arg0->unk10 - arg0->unk4;
+ camera->rotZ = (u16) camera->rotZ & 0xFFFB;
+ func_802ADDC8(&camera->unk_54, (f32) 3, sp84, sp80, sp7C);
+ camera->pos[0] = sp84;
+ camera->pos[1] = sp80;
+ camera->pos[2] = sp7C;
+ camera->lookAt[0] = sp64;
+ camera->lookAt[1] = sp68;
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ camera->lookAt[2] = sp6C;
+ sp90 = camera->lookAt[1] - camera->pos[1];
sp94 = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp8C = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/camera/func_8001EA0C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80019ED0(); // extern
-? func_8001A0A4(s16 *, s32, void *, s8, s32); // extern
-? func_8001A0DC(s16 *, s32, void *, s8, s32); // extern
-? func_8001A588(u16 *, s32, void *, s8, s32); // extern
-? func_8001E0C4(s32, void *, s8); // extern
-? func_8001E45C(s32, void *, s8); // extern
-? func_8001E8E8(s32, void *, s8); // extern
-? func_8001EA0C(s32, void *, s8); // extern
-? func_8001F87C(s32); // extern
-extern u16 D_800DC5FC;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80019ED0(); /* extern */
+? func_8001A0A4(s16 *, Camera *, Player *, s8, s32); /* extern */
+? func_8001A0DC(s16 *, Camera *, Player *, s8, s32); /* extern */
+? func_8001A588(u16 *, Camera *, Player *, s8, s32); /* extern */
+? func_8001E0C4(Camera *, Player *, s8); /* extern */
+? func_8001E45C(Camera *, Player *, s8); /* extern */
+? func_8001E8E8(Camera *, Player *, s8); /* extern */
+? func_8001EA0C(Camera *, Player *, s8); /* extern */
+? func_8001F87C(s32); /* extern */
extern ? D_80152300;
extern u16 D_8015F894;
extern s8 D_80164A88;
extern s8 D_80164A89;
-void func_8001EE98(void *arg0, s32 arg1, s8 arg2) {
+void func_8001EE98(Player *player, Camera *camera, s8 arg2) {
s32 sp34;
s16 *sp2C;
s16 *temp_a0;
@@ -1253,126 +1120,122 @@ void func_8001EE98(void *arg0, s32 arg1, s8 arg2) {
s16 temp_v0_3;
s16 temp_v0_4;
s32 temp_v0;
+ s32 var_s0;
u16 *temp_a0_7;
u16 temp_v0_2;
- s32 phi_s0;
- s8 phi_v1;
- if (arg1 == camera1) {
+ if (camera == camera1) {
sp34 = 0;
}
- phi_s0 = sp34;
- if (arg1 == camera2) {
- phi_s0 = 1;
+ var_s0 = sp34;
+ if (camera == camera2) {
+ var_s0 = 1;
}
- if (arg1 == camera3) {
- phi_s0 = 2;
+ if (camera == camera3) {
+ var_s0 = 2;
}
- phi_v1 = 1;
- if (arg1 == camera4) {
- phi_s0 = 3;
+ if (camera == camera4) {
+ var_s0 = 3;
}
temp_v0 = gModeSelection;
- if (temp_v0 != GRAND_PRIX) {
- if (temp_v0 != TIME_TRIALS) {
- if (temp_v0 != VERSUS) {
- if (temp_v0 != BATTLE) {
-
- } else if ((D_800DC51C == 1) || ((D_8015F894 == 2) && (D_80164A89 == 1))) {
- if (D_80164A88 == 0) {
- func_80019ED0();
- }
- D_80164A88 = 1;
- D_80152300.unk0 = 3;
- D_80152300.unk2 = 3;
- D_80152300.unk4 = 3;
- D_80152300.unk6 = 3;
- phi_v1 = 1;
- } else {
- D_80164A88 = 0;
- if (D_800DC5FC == 1) {
- temp_a0 = (phi_s0 * 2) + &D_80152300;
- sp2C = temp_a0;
- func_8001A0A4(temp_a0, arg1, arg0, arg2, phi_s0);
- } else {
- temp_a0_2 = (phi_s0 * 2) + &D_80152300;
- sp2C = temp_a0_2;
- func_8001A0DC(temp_a0_2, arg1, arg0, arg2, phi_s0);
- }
- *sp2C = 9;
- phi_v1 = 1;
- }
- } else if (((arg0->unk0 & 0x800) == 0x800) || (D_800DC51C == 1) || (D_8015F894 == 2)) {
- *(&D_80152300 + (phi_s0 * 2)) = 3;
+ switch (temp_v0) { /* irregular */
+ case 0:
+ if (((player->unk_000 & 0x800) == 0x800) || (D_800DC51C == 1)) {
+ *(&D_80152300 + (var_s0 * 2)) = 3;
+ } else if (D_800DC5FC == 1) {
+ func_8001A0A4((var_s0 * 2) + &D_80152300, camera, player, arg2, var_s0);
+ } else {
+ func_8001A0DC((var_s0 * 2) + &D_80152300, camera, player, arg2, var_s0);
+ }
+ break;
+ case 3:
+ if ((D_800DC51C == (u16) 1) || ((D_8015F894 == 2) && (D_80164A89 == 1))) {
+ if (D_80164A88 == 0) {
+ func_80019ED0();
+ }
+ D_80164A88 = 1;
+ D_80152300.unk0 = 3;
+ D_80152300.unk2 = 3;
+ D_80152300.unk4 = 3;
+ D_80152300.unk6 = 3;
+ } else {
+ D_80164A88 = 0;
+ if (D_800DC5FC == (u16) 1) {
+ temp_a0 = (var_s0 * 2) + &D_80152300;
+ sp2C = temp_a0;
+ func_8001A0A4(temp_a0, camera, player, arg2, var_s0);
} else {
- if (D_800DC5FC == 1) {
- temp_a0_3 = (phi_s0 * 2) + &D_80152300;
- sp2C = temp_a0_3;
- func_8001A0A4(temp_a0_3, arg1, arg0, arg2, phi_s0);
- } else {
- temp_a0_4 = (phi_s0 * 2) + &D_80152300;
- sp2C = temp_a0_4;
- func_8001A0DC(temp_a0_4, arg1, arg0, arg2, phi_s0);
- }
- *sp2C = 1;
- phi_v1 = 1;
+ temp_a0_2 = (var_s0 * 2) + &D_80152300;
+ sp2C = temp_a0_2;
+ func_8001A0DC(temp_a0_2, camera, player, arg2, var_s0);
}
- } else if (((gPlayerOne->unk_000 & PLAYER_CINEMATIC_MODE) == PLAYER_CINEMATIC_MODE) || (D_800DC51C == 1)) {
+ *sp2C = 9;
+ }
+ break;
+ case 1:
+ if (((gPlayerOne->unk_000 & 0x800) == 0x800) || (D_800DC51C == (u16) 1)) {
D_80152300.unk0 = 3;
*(&D_80152300 + 2) = 3;
*(&D_80152300 + 4) = 3;
*(&D_80152300 + 6) = 3;
} else {
- if (D_800DC5FC == 1) {
- temp_a0_5 = (phi_s0 * 2) + &D_80152300;
+ if (D_800DC5FC == (u16) 1) {
+ temp_a0_3 = (var_s0 * 2) + &D_80152300;
+ sp2C = temp_a0_3;
+ func_8001A0A4(temp_a0_3, camera, player, arg2, var_s0);
+ } else {
+ temp_a0_4 = (var_s0 * 2) + &D_80152300;
+ sp2C = temp_a0_4;
+ func_8001A0DC(temp_a0_4, camera, player, arg2, var_s0);
+ }
+ *sp2C = 1;
+ }
+ break;
+ case 2:
+ if (((player->unk_000 & 0x800) == 0x800) || (D_800DC51C == (u16) 1) || (D_8015F894 == 2)) {
+ *(&D_80152300 + (var_s0 * 2)) = 3;
+ } else {
+ if (D_800DC5FC == (u16) 1) {
+ temp_a0_5 = (var_s0 * 2) + &D_80152300;
sp2C = temp_a0_5;
- func_8001A0A4(temp_a0_5, arg1, arg0, arg2, phi_s0);
+ func_8001A0A4(temp_a0_5, camera, player, arg2, var_s0);
} else {
- temp_a0_6 = (phi_s0 * 2) + &D_80152300;
+ temp_a0_6 = (var_s0 * 2) + &D_80152300;
sp2C = temp_a0_6;
- func_8001A0DC(temp_a0_6, arg1, arg0, arg2, phi_s0);
+ func_8001A0DC(temp_a0_6, camera, player, arg2, var_s0);
}
*sp2C = 1;
- phi_v1 = 1;
}
- } else if (((arg0->unk0 & 0x800) == 0x800) || (D_800DC51C == 1)) {
- *(&D_80152300 + (phi_s0 * 2)) = 3;
- } else if (D_800DC5FC == 1) {
- func_8001A0A4((phi_s0 * 2) + &D_80152300, arg1, arg0, arg2, phi_s0);
- } else {
- func_8001A0DC((phi_s0 * 2) + &D_80152300, arg1, arg0, arg2, phi_s0);
+ break;
}
if (D_800DC5FC == 0) {
- temp_a0_7 = (phi_s0 * 2) + &D_80152300;
+ temp_a0_7 = (var_s0 * 2) + &D_80152300;
temp_v0_2 = *temp_a0_7;
- if (temp_v0_2 != phi_v1) {
- if (temp_v0_2 != 3) {
- if (temp_v0_2 != 8) {
- if (temp_v0_2 != 9) {
- return;
- }
- temp_v0_3 = arg0->unkCA;
- if ((phi_v1 == (temp_v0_3 & 1)) || ((temp_v0_3 & 2) == 2)) {
- func_8001E8E8(arg1, arg0, arg2);
- return;
- }
- func_8001EA0C(arg1, arg0, arg2);
- // Duplicate return node #60. Try simplifying control flow for better match
- return;
- }
- func_8001E0C4(arg1, arg0, arg2);
- func_8001F87C(phi_s0);
+ switch (temp_v0_2) { /* switch 1; irregular */
+ case 3: /* switch 1 */
+ func_8001A588(temp_a0_7, camera, player, arg2, var_s0);
+ return;
+ case 1: /* switch 1 */
+ temp_v0_3 = player->unk_0CA;
+ if (((temp_v0_3 & 1) == 1) || ((temp_v0_3 & 2) == 2)) {
+ func_8001E8E8(camera, player, arg2);
return;
}
- func_8001A588(temp_a0_7, arg1, arg0, arg2, phi_s0);
+ func_8001E45C(camera, player, arg2);
return;
- }
- temp_v0_4 = arg0->unkCA;
- if ((phi_v1 == (temp_v0_4 & 1)) || ((temp_v0_4 & 2) == 2)) {
- func_8001E8E8(arg1, arg0, arg2);
+ case 8: /* switch 1 */
+ func_8001E0C4(camera, player, arg2);
+ func_8001F87C(var_s0);
return;
+ case 9: /* switch 1 */
+ temp_v0_4 = player->unk_0CA;
+ if (((temp_v0_4 & 1) == 1) || ((temp_v0_4 & 2) == 2)) {
+ func_8001E8E8(camera, player, arg2);
+ return;
+ }
+ func_8001EA0C(camera, player, arg2);
+ break;
}
- func_8001E45C(arg1, arg0, arg2);
}
}
#else
@@ -1380,26 +1243,24 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8001EE98.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-? move_f32_towards(f32, f32 *, ?, ?, s32); /* extern */
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+f32 func_80014EE4(f32, s32, s32); /* extern */
extern ? D_80164498;
extern ? D_80164A08;
void func_8001F394(Player *player, f32 *arg1) {
- s32 playerId;
+ s32 sp2C;
s32 sp1C;
f32 *temp_a0;
- f32 *temp_a0_2;
- f32 *temp_a0_3;
- f32 *temp_a0_4;
- f32 *temp_a0_5;
- f32 *temp_a0_6;
+ f32 *var_a0;
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f0_3;
f32 temp_f0_4;
f32 temp_f0_5;
f32 temp_f0_6;
+ f32 var_f0;
+ f32 var_f2;
s32 *temp_v1;
s32 temp_t3;
s32 temp_v0;
@@ -1407,23 +1268,20 @@ void func_8001F394(Player *player, f32 *arg1) {
s32 temp_v0_3;
s32 temp_v0_4;
s32 temp_v0_5;
- f32 *phi_a0;
- f32 phi_f2;
- f32 phi_f0;
if (player == gPlayerOne) {
- playerId = 0;
+ sp2C = 0;
}
if (player == gPlayerTwo) {
- playerId = 1;
+ sp2C = 1;
}
if (player == gPlayerThree) {
- playerId = 2;
+ sp2C = 2;
}
if (player == gPlayerFour) {
- playerId = 3;
+ sp2C = 3;
}
- temp_t3 = playerId * 4;
+ temp_t3 = sp2C * 4;
temp_v1 = temp_t3 + &D_80164A08;
if (*temp_v1 == 0) {
if (player->unk_00C & 0x40000) {
@@ -1446,34 +1304,32 @@ void func_8001F394(Player *player, f32 *arg1) {
}
switch (*temp_v1) {
case 1:
- temp_a0 = temp_t3 + &D_80164498;
- phi_a0 = temp_a0;
+ var_a0 = temp_t3 + &D_80164498;
if (player->unk_00C & 0x40000) {
sp1C = temp_t3;
- move_f32_towards(0.0f, temp_a0, 0x41A00000, 0x3E4CCCCD, temp_t3);
+ move_f32_towards(var_a0, 20.0f, 0.2f);
} else {
- temp_f0 = *temp_a0;
+ temp_f0 = *var_a0;
if (temp_f0 > 1.0f) {
- *temp_a0 = temp_f0 - 1.0f;
+ *var_a0 = temp_f0 - 1.0f;
} else {
*temp_v1 = 0;
block_51:
- *phi_a0 = 0.0f;
+ *var_a0 = 0.0f;
}
}
break;
case 2:
if ((player->unk_0BC & 0x2000) == 0x2000) {
- if (player->unk_0DC != 0) {
+ if (player->boostTimer != 0) {
sp1C = temp_t3;
- move_f32_towards(0.0f, temp_t3 + &D_80164498, 0x41000000, 0x3E4CCCCD, temp_t3);
+ move_f32_towards(temp_t3 + &D_80164498, 8.0f, 0.2f);
}
} else {
- temp_a0_2 = temp_t3 + &D_80164498;
- temp_f0_2 = *temp_a0_2;
- phi_a0 = temp_a0_2;
+ var_a0 = temp_t3 + &D_80164498;
+ temp_f0_2 = *var_a0;
if (temp_f0_2 > 1.0f) {
- *temp_a0_2 = temp_f0_2 - 2.0f;
+ *var_a0 = temp_f0_2 - 2.0f;
} else {
*temp_v1 = 0;
goto block_51;
@@ -1482,15 +1338,14 @@ block_51:
break;
case 3:
temp_v0_2 = player->unk_0BC;
- temp_a0_3 = temp_t3 + &D_80164498;
- phi_a0 = temp_a0_3;
+ var_a0 = temp_t3 + &D_80164498;
if (((temp_v0_2 & 0x100000) == 0x100000) && ((temp_v0_2 & 8) == 8)) {
sp1C = temp_t3;
- move_f32_towards(0.0f, temp_a0_3, 0x41A00000, 0x3DCCCCCD, temp_t3);
+ move_f32_towards(var_a0, 20.0f, 0.1f);
} else {
- temp_f0_3 = *temp_a0_3;
+ temp_f0_3 = *var_a0;
if (temp_f0_3 > 1.0f) {
- *temp_a0_3 = temp_f0_3 - 1.0f;
+ *var_a0 = temp_f0_3 - 1.0f;
} else {
*temp_v1 = 0;
goto block_51;
@@ -1498,15 +1353,14 @@ block_51:
}
break;
case 4:
- temp_a0_4 = temp_t3 + &D_80164498;
- phi_a0 = temp_a0_4;
+ var_a0 = temp_t3 + &D_80164498;
if ((player->unk_00C & 0x100) == 0x100) {
sp1C = temp_t3;
- move_f32_towards(0.0f, temp_a0_4, 0x41C80000, 0x3F800000, temp_t3);
+ move_f32_towards(var_a0, 25.0f, 1.0f);
} else {
- temp_f0_4 = *temp_a0_4;
+ temp_f0_4 = *var_a0;
if (temp_f0_4 > 1.0f) {
- *temp_a0_4 = temp_f0_4 - 2.0f;
+ *var_a0 = temp_f0_4 - 2.0f;
} else {
*temp_v1 = 0;
goto block_51;
@@ -1515,15 +1369,14 @@ block_51:
break;
case 5:
temp_v0_3 = player->unk_0BC;
- temp_a0_5 = temp_t3 + &D_80164498;
- phi_a0 = temp_a0_5;
+ var_a0 = temp_t3 + &D_80164498;
if (((temp_v0_3 & 0x80) == 0x80) || ((temp_v0_3 & 0x40) == 0x40)) {
sp1C = temp_t3;
- move_f32_towards(0.0f, temp_a0_5, 0x41900000, 0x3E4CCCCD, temp_t3);
+ move_f32_towards(var_a0, 18.0f, 0.2f);
} else {
- temp_f0_5 = *temp_a0_5;
+ temp_f0_5 = *var_a0;
if (temp_f0_5 > 1.0f) {
- *temp_a0_5 = temp_f0_5 - 2.0f;
+ *var_a0 = temp_f0_5 - 2.0f;
} else {
*temp_v1 = 0;
goto block_51;
@@ -1532,74 +1385,74 @@ block_51:
break;
}
temp_v0_4 = gActiveScreenMode;
- if (temp_v0_4 != 0) {
- if ((temp_v0_4 != 1) && (temp_v0_4 != 2) && (temp_v0_4 != 3)) {
- phi_f2 = sp34;
- } else {
- phi_f0 = func_80014EE4(*arg1, playerId, MIPS2C_ERROR(Read from unset register $a2));
- goto block_66;
- }
- } else {
+ switch (temp_v0_4) { /* switch 1; irregular */
+ default: /* switch 1 */
+ var_f2 = sp34;
+ break;
+ case 0: /* switch 1 */
temp_v0_5 = D_80164A28;
if (temp_v0_5 == 1) {
- *(&D_80164498 + (playerId * 4)) = 40.0f;
+ *(&D_80164498 + temp_t3) = 40.0f;
}
- temp_a0_6 = (playerId * 4) + &D_80164498;
+ temp_a0 = temp_t3 + &D_80164498;
if (temp_v0_5 == 2) {
- temp_f0_6 = *temp_a0_6;
+ temp_f0_6 = *temp_a0;
if (temp_f0_6 >= 0.0f) {
- *temp_a0_6 = temp_f0_6 - 0.8;
+ *temp_a0 = (f32) ((f64) temp_f0_6 - 0.8);
}
- if (*temp_a0_6 <= 0.0f) {
+ if (*temp_a0 <= 0.0f) {
D_80164A28 = 0;
- *temp_a0_6 = 0.0f;
+ *temp_a0 = 0.0f;
}
}
- phi_f0 = func_80014EE4(*arg1, playerId, MIPS2C_ERROR(Read from unset register $a2));
+ var_f0 = func_80014EE4(*arg1, (s32) temp_a0, sp2C);
block_66:
- phi_f2 = phi_f0;
+ var_f2 = var_f0;
+ break;
+ case 1: /* switch 1 */
+ case 2: /* switch 1 */
+ case 3: /* switch 1 */
+ var_f0 = func_80014EE4(*arg1, sp2C);
+ goto block_66;
}
- *arg1 = phi_f2;
- cameras[playerId].unk30 = phi_f2;
+ *arg1 = var_f2;
+ cameras[sp2C].unk_B4 = var_f2;
}
#else
GLOBAL_ASM("asm/non_matchings/camera/func_8001F394.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
extern ? D_80152300;
-extern ? cameras;
extern s32 D_80164A2C;
-void func_8001F87C(s32 arg0) {
- s32 temp_a1;
+void func_8001F87C(s32 cameraId) {
+ Camera *temp_v0_2;
+ Player *var_a2;
+ s32 var_a1;
u16 temp_v0;
- void *temp_v0_2;
- Player *phi_a2;
- s32 phi_a1;
if (gActiveScreenMode == 0) {
- phi_a2 = gPlayerOne;
- phi_a1 = 0;
- if (gModeSelection == GRAND_PRIX) {
+ var_a1 = 0;
+ var_a2 = gPlayerOne;
+ if (gModeSelection == 0) {
loop_3:
- temp_v0 = phi_a2->unk_000;
- if (((temp_v0 & 0x200) == 0) && ((temp_v0 & 0x80) == 0)) {
- if (phi_a1 == 0x60E8) {
- D_80164A2C = D_80164A2C + 1;
+ temp_v0 = var_a2->unk_000;
+ if (!(temp_v0 & 0x200) && !(temp_v0 & 0x80)) {
+ if (var_a1 == 0x60E8) {
+ D_80164A2C += 1;
}
- if ((phi_a1 == 0x60E8) && (D_80164A2C == 0x3C)) {
+ if ((var_a1 == 0x60E8) && (D_80164A2C == 0x0000003C)) {
D_80164A28 = 2;
- *(&D_80152300 + (arg0 * 2)) = 1;
- temp_v0_2 = &cameras + (arg0 * 0xB8);
- temp_v0_2->unk26 = phi_a2->unk_02E;
- temp_v0_2->unk2C = phi_a2->unk_02E;
+ *(&D_80152300 + (cameraId * 2)) = 1;
+ temp_v0_2 = &cameras[cameraId];
+ temp_v0_2->rot[1] = var_a2->unk_02E;
+ temp_v0_2->unk2C = (s16) var_a2->unk_02E;
}
- temp_a1 = phi_a1 + 0xDD8;
- phi_a2 += 0xDD8;
- phi_a1 = temp_a1;
- if (temp_a1 != 0x6EC0) {
+ var_a1 += 0xDD8;
+ var_a2 += 0xDD8;
+ if (var_a1 != 0x6EC0) {
goto loop_3;
}
}
diff --git a/src/camera.h b/src/camera.h
new file mode 100644
index 000000000..fba26e8c7
--- /dev/null
+++ b/src/camera.h
@@ -0,0 +1,55 @@
+#ifndef CAMERA_H
+#define CAMERA_H
+
+#include "common_structs.h"
+
+typedef struct {
+ /* 0x00 */ Vec3f pos;
+ /* 0x0C */ Vec3f lookAt;
+ // This is expected to be a normalized vector, indicates what direction is "up" for the camera
+ /* 0x18 */ Vec3f up;
+ // I think these are the "nautical angles" between pos and lookAt
+ // rot[0] = pitch, rot[1] = yaw, rot[2] = roll?
+ /* 0x24 */ Vec3s rot;
+ /* 0x2A */ s16 rotZ;
+ /* 0x2C */ s16 unk_2C;
+ /* 0x2E */ s16 unk_2E;
+ /* 0x30 */ Vec3f unk_30;
+ /* 0x3C */ Vec3f unk_3C;
+ /* 0x48 */ s32 unk_48;
+ /* 0x4C */ s32 unk_4C;
+ /* 0x50 */ s32 unk_50;
+ /* 0x54 */ UnkActorInner unk_54;
+ // When you hit a wall (or another driver) the camera's pos and lookAt bounce up and down. This is the velocity(?) of that bouncing
+ /* 0x94 */ f32 unk_94;
+ /* 0x98 */ s16 unk_98;
+ /* 0x9A */ s16 unk_9A;
+ // Timer for wall-hit bounce. Counts up instead of down
+ /* 0x9C */ s16 unk_9C;
+ /* 0x9E */ s16 pad_9E;
+ /* 0xA0 */ f32 unk_A0;
+ /* 0xA4 */ s32 unk_A4;
+ /* 0xA8 */ s32 unk_A8;
+ /* 0xAC */ s16 unk_AC;
+ // Id of the player the camera is following.
+ /* 0xAE */ s16 playerId;
+ // Seems related to camera movement during drifting
+ /* 0xB0 */ s16 unk_B0;
+ /* 0xB2 */ s16 unk_B2;
+ /* 0xB4 */ f32 unk_B4;
+} Camera; /* size = 0xB8 */
+
+void func_8001CA10(Camera*);
+void func_8001CA24(Player*, f32);
+
+extern Camera cameras[];
+extern Camera *camera1;
+extern Camera *camera2;
+extern Camera *camera3;
+extern Camera *camera4;
+
+extern Player *gPlayerTwo;
+extern Player *gPlayerThree;
+extern Player *gPlayerFour;
+
+#endif
diff --git a/src/camera_junk.c b/src/camera_junk.c
index ed50a8525..6141292a2 100644
--- a/src/camera_junk.c
+++ b/src/camera_junk.c
@@ -1,48 +1,44 @@
#include <ultra64.h>
#include <macros.h>
#include <common_structs.h>
+#include "camera.h"
+#include "math_util.h"
-extern Camera cameras[];
-
-extern u16 atan2s(f32, f32);
+// guPerspective params
+extern f32 D_80150148, D_8015014C, D_80150150;
+extern f32 D_80150130[];
void func_80281610(void) {
- Camera *camera = &cameras[0];
- //f32 sp1C;
- f32 temp_f12;
- f32 temp;
- f32 temp_f14;
+ Camera *camera;
+ f32 x_dist;
+ f32 y_dist;
+ f32 z_dist;
+ camera = &cameras[0];
func_80283648(camera);
- temp_f12 = camera->unk - camera->pos[0];
- temp = camera->unk1 - camera->pos[1];
- temp_f14 = camera->unk2 - camera->pos[2];
- camera->rotX[1] = atan2s(temp_f12, temp_f14);
- camera->rotX[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), temp);
- camera->rotX[2] = 0;
+ x_dist = camera->lookAt[0] - camera->pos[0];
+ y_dist = camera->lookAt[1] - camera->pos[1];
+ z_dist = camera->lookAt[2] - camera->pos[2];
+ camera->rot[1] = atan2s(x_dist, z_dist);
+ camera->rot[0] = atan2s(sqrtf((x_dist * x_dist) + (z_dist * z_dist)), y_dist);
+ camera->rot[2] = 0;
}
-// guPerspective params
-extern f32 D_80150148, D_8015014C, D_80150150;
-extern f32 D_80150130[];
-// rodata
-extern const f32 D_80286B90, D_80286B94, D_80286B98, D_80286B9C, D_80286BA0;
-
// GP Ending sequence camera settings?
void func_802816B8(void) {
- cameras[0].pos[0] = D_80286B90;
+ cameras[0].pos[0] = -3133.0f;
cameras[0].pos[1] = 19.0f;
- cameras[0].pos[2] = D_80286B94;
- cameras[0].unk = D_80286B98;
- cameras[0].unk1 = 21.0f;
- cameras[0].unk2 = -528.0f;
- cameras[0].angleX = 0.0f;
- cameras[0].angleY = 1.0f;
- cameras[0].angleZ = 0.0f;
+ cameras[0].pos[2] = -467.0f;
+ cameras[0].lookAt[0] = -3478.0f;
+ cameras[0].lookAt[1] = 21.0f;
+ cameras[0].lookAt[2] = -528.0f;
+ cameras[0].up[0] = 0.0f;
+ cameras[0].up[1] = 1.0f;
+ cameras[0].up[2] = 0.0f;
D_80150130[0] = 40.0f;
- D_80150148 = D_80286B9C;
+ D_80150148 = 1.33333333f;
D_80150150 = 3.0f;
- D_8015014C = D_80286BA0;
+ D_8015014C = 6800.0f;
func_80283430();
}
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c
index fd733dc0d..964c74ca0 100644
--- a/src/code_80005FD0.c
+++ b/src/code_80005FD0.c
@@ -4,6 +4,7 @@
#include "math_util.h"
#include "memory.h"
#include "waypoints.h"
+#include "camera.h"
#include "code_80005FD0.h"
#include "code_80027D00.h"
#include "variables.h"
@@ -4089,89 +4090,83 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000DBAC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_802ADDC8(? *, ?, f32, f32, f32); // extern
-extern ? D_800DCC08;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
extern ? D_80163DE8;
-extern ? D_80164038;
+extern UnkActorInner D_80164038;
extern ? D_801641F8;
+static struct _struct_D_800DCC08_0xA8 D_800DCC08[0]; /* unable to generate initializer */
+s16 gCurrentCourseId; /* unable to generate initializer */
void func_8000DD78(void) {
- ? *temp_s2;
- f32 temp_f20;
- f32 temp_f22;
+ ? *var_s0;
+ UnkActorInner *var_s2;
+ f32 var_f20;
+ f32 var_f22;
+ f32 var_f2;
s16 temp_v0;
+ s32 var_s3;
+ struct TrackWayPoint *temp_v0_2;
void *temp_s1;
- void *temp_v0_2;
void *temp_v0_3;
- s32 phi_s3;
- f32 phi_f20;
- ? *phi_s0;
- f32 phi_f2;
- f32 phi_f22;
- ? *phi_s2;
- phi_s3 = 0;
- phi_s0 = &D_80163DE8;
- phi_s2 = &D_80164038;
+ var_s2 = &D_80164038;
+ var_s0 = &D_80163DE8;
+ var_s3 = 0;
do {
temp_v0 = gCurrentCourseId;
- temp_s1 = &D_800DCC08 + (temp_v0 * 0xA8) + phi_s3;
+ temp_s1 = &D_800DCC08[temp_v0] + var_s3;
if (temp_v0 != 4) {
- if (temp_v0 != 0x14) {
- temp_v0_2 = D_80164550.unk0 + (temp_s1->unk0 * 8);
- phi_f20 = temp_v0_2->unk0;
- phi_f2 = temp_v0_2->unk2;
- phi_f22 = temp_v0_2->unk4;
+ if (temp_v0 != 0x0014) {
+ temp_v0_2 = &D_80164550->unk0[temp_s1->unk0];
+ var_f20 = (f32) temp_v0_2->wayPointX;
+ var_f2 = (f32) temp_v0_2->wayPointY;
+ var_f22 = (f32) temp_v0_2->wayPointZ;
} else {
- temp_v0_3 = D_80164550.unkC + (temp_s1->unk0 * 8);
- phi_f20 = temp_v0_3->unk0;
- phi_f2 = temp_v0_3->unk2;
- phi_f22 = temp_v0_3->unk4;
+ temp_v0_3 = D_80164550->unkC + (temp_s1->unk0 * 8);
+ var_f20 = (f32) temp_v0_3->unk0;
+ var_f2 = (f32) temp_v0_3->unk2;
+ var_f22 = (f32) temp_v0_3->unk4;
}
} else {
- temp_f22 = temp_s1->unkC;
- temp_f20 = temp_s1->unk8;
- phi_f20 = temp_f20;
- phi_f2 = func_802AE1C0(temp_f20, 2000.0f, temp_f22);
- phi_f22 = temp_f22;
- }
- phi_s0->unk0 = phi_f20;
- phi_s0->unk4 = phi_f2;
- phi_s0->unk8 = phi_f22;
- phi_s0->unkC = phi_f20;
- phi_s0->unk10 = phi_f2;
- phi_s0->unk14 = phi_f22;
- phi_s0->unk18 = phi_f20;
- phi_s0->unk1C = phi_f2;
- phi_s0->unk20 = phi_f22;
- phi_s0->unk24 = phi_f20;
- phi_s0->unk28 = phi_f2;
- phi_s0->unk2C = phi_f22;
- phi_s0->unk30 = phi_f20;
- phi_s0->unk34 = phi_f2;
- phi_s0->unk38 = phi_f22;
- phi_s0->unk42 = temp_s1->unk0;
- phi_s0->unk46 = 0;
- phi_s0->unk48 = 0;
- phi_s0->unk3C = temp_s1->unk4;
- phi_s0->unk4A = 0;
- phi_s0->unk4C = 1;
- phi_s0->unk50 = phi_f2;
- phi_s0->unk44 = temp_s1->unk2;
- func_802ADDC8(phi_s2, 0x40000000, phi_f20, phi_f2, phi_f22);
- temp_s2 = phi_s2 + 0x40;
- phi_s3 += 0x18;
- phi_s0 += 0x54;
- phi_s2 = temp_s2;
- } while (temp_s2 != &D_801641F8);
+ var_f22 = temp_s1->unkC;
+ var_f20 = temp_s1->unk8;
+ var_f2 = func_802AE1C0(var_f20, 2000.0f, var_f22);
+ }
+ var_s0->unk0 = var_f20;
+ var_s0->unk4 = var_f2;
+ var_s0->unk8 = var_f22;
+ var_s0->unkC = var_f20;
+ var_s0->unk10 = var_f2;
+ var_s0->unk14 = var_f22;
+ var_s0->unk18 = var_f20;
+ var_s0->unk1C = var_f2;
+ var_s0->unk20 = var_f22;
+ var_s0->unk24 = var_f20;
+ var_s0->unk28 = var_f2;
+ var_s0->unk2C = var_f22;
+ var_s0->unk30 = var_f20;
+ var_s0->unk34 = var_f2;
+ var_s0->unk38 = var_f22;
+ var_s0->unk42 = (u16) temp_s1->unk0;
+ var_s0->unk46 = 0;
+ var_s0->unk48 = 0;
+ var_s0->unk3C = (f32) temp_s1->unk4;
+ var_s0->unk4A = 0;
+ var_s0->unk4C = 1;
+ var_s0->unk50 = var_f2;
+ var_s0->unk44 = (u16) temp_s1->unk2;
+ func_802ADDC8(var_s2, 2.0f, var_f20, var_f2, var_f22);
+ var_s2 += 0x40;
+ var_s3 += 0x18;
+ var_s0 += 0x54;
+ } while (var_s2 != &D_801641F8);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000DD78.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
extern f32 D_80162FB0;
extern f32 D_80162FC0;
extern s16 D_8016347C;
@@ -4300,7 +4295,7 @@ void func_8000DF8C(s32 arg0) {
var_v0 = gPlayers;
do {
var_a0 += 1;
- if ((var_v0->unk_0BC & 0x80000000) == 0) {
+ if (!(var_v0->unk_0BC & 0x80000000)) {
temp_f0_2 = var_f22 - var_v0->pos[0];
temp_f2_2 = var_f20 - var_v0->pos[1];
temp_f12_2 = var_f24 - var_v0->pos[2];
@@ -5033,8 +5028,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F2DC.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
? func_80011A5C(); /* extern */
? func_80011AB8(s32, s32); /* extern */
? func_8001AB00(? *, s16, u16 *, u16); /* extern */
@@ -5355,7 +5349,7 @@ void func_8000F628(void) {
var_t4 += 4;
var_t5 += 4;
var_ra += 4;
- if ((var_s1->unk-DD8 & 0x4000) != 0) {
+ if (var_s1->unk-DD8 & 0x4000) {
*var_s2 = 3;
} else {
*var_s2 = 0;
@@ -5431,7 +5425,7 @@ void func_8000F628(void) {
var_s2_2->unk-2 = 0;
} while ((u32) var_s2_2 < (u32) &D_80163340);
if (gModeSelection == 2) {
- temp_t6 = cameras->unkAE;
+ temp_t6 = cameras->playerId;
temp_v1_3 = temp_t6 & 0xFFFF;
(&D_80163330)[temp_v1_3] = 1;
*(&D_8016334C + (temp_v1_3 * 2)) = 0;
@@ -5440,7 +5434,7 @@ void func_8000F628(void) {
var_s0_3 = 1;
D_80163344 = temp_t6;
do {
- temp_t6_2 = var_a0_2->unkAE;
+ temp_t6_2 = var_a0_2->playerId;
var_v0_2 += 2;
var_a0_2 += 0xB8;
temp_v1_4 = temp_t6_2 & 0xFFFF;
@@ -7564,10 +7558,9 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80013C74.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
s16 func_8000D6D0(void *, void *, s32, f32, s32, s32); /* extern */
s16 func_8000D940(void *, void *, s32, f32, s32); /* extern */
-? func_800224F0(void *, s16, ?); /* extern */
extern s16 D_8016347A;
void func_80013D20(void *arg0) {
@@ -7615,13 +7608,13 @@ void func_80013D20(void *arg0) {
} else {
var_a1 = func_8000D940(arg0 + 4, arg0 + 0x1C, arg0->unk20, arg0->unk24, 0);
}
- func_800224F0(arg0 + 0x2A, var_a1, 0x64);
+ func_800224F0(arg0 + 0x2A, var_a1, 0x0064);
temp_f0_3 = arg0->unk4 - sp5C;
temp_f2_2 = arg0->unkC - sp54;
sp34 = arg0->unk8;
sp38 = 0.0f;
sp3C = sqrtf((temp_f0_3 * temp_f0_3) + (temp_f2_2 * temp_f2_2));
- func_800224F0(arg0 + 0x28, (s16) (func_802B5224(&sp40, &sp34) * -1), 0x64);
+ func_800224F0(arg0 + 0x28, (s16) (func_802B5224(&sp40, &sp34) * -1), 0x0064);
temp_f0_4 = arg0->unk4;
arg0->unk10 = (f32) (temp_f0_4 - sp5C);
temp_v1 = &gActorList[arg0->unk1E];
@@ -8178,18 +8171,14 @@ void func_80014D08(void) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80014D08.s")
#endif
-#ifdef MIPS_TO_C
-//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
-
void func_80014D30(s32 cameraId, s32 pathIndex) {
+ s16 cameraWayPoint;
struct TrackWayPoint *temp_v0;
- temp_v0 = &D_80164550[wayPointIndex][*(&D_80164668 + (cameraId * 2))];
- func_802ADDC8((cameraId * 0xB8) + 0x54 + cameras, 10.0f, (f32) temp_v0->wayPointX, (f32) temp_v0->wayPointY + 30.0f, (f32) temp_v0->wayPointZ);
+ cameraWayPoint = gNearestWaypointByCameraId[cameraId];
+ temp_v0 = &D_80164550[pathIndex][cameraWayPoint];
+ func_802ADDC8(&cameras[cameraId].unk_54, 10.0f, (f32) temp_v0->wayPointX, (f32) temp_v0->wayPointY + 30.0f, (f32) temp_v0->wayPointZ);
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80014D30.s")
-#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
@@ -8404,30 +8393,27 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800151A4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80015390(void *, Player *, ?, s32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80015390(Camera *, Player *, ?, s32); /* extern */
-void func_80015314(s32 arg0, ? arg1, s32 arg2) {
+void func_80015314(s32 playerId, s32 arg1, s32 cameraId) {
+ Camera *temp_a0;
Player *temp_a1;
- void *temp_a0;
- temp_a1 = &gPlayerOne[arg0];
- temp_a0 = camera1 + (arg2 * 0xB8);
- temp_a0->unk2C = temp_a1->unk_02E;
- func_80015390(temp_a0, temp_a1, 0, arg0);
+ temp_a1 = &gPlayerOne[playerId];
+ temp_a0 = &camera1[cameraId];
+ temp_a0->unk_2C = temp_a1->unk_02E;
+ func_80015390(temp_a0, temp_a1, 0, playerId);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015314.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8001D794(Player *, void *, f32 *, f32 *, f32 *, f32 *, s32); // extern
-? func_800224F0(void *, s16, s16); // extern
-? func_802ADDC8(void *, ?, f32, f32, f32); // extern
-s16 atan2s(f32, f32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8001D794(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, s32); /* extern */
-void func_80015390(void *arg0, ? arg1, ? arg2) {
+void func_80015390(Camera *camera, s32 arg1, s32 arg2) {
f32 sp94;
f32 sp90;
f32 sp8C;
@@ -8439,68 +8425,63 @@ void func_80015390(void *arg0, ? arg1, ? arg2) {
f32 temp_f12;
f32 temp_f14;
s16 temp_v0;
+ s16 var_a2;
s32 temp_v0_2;
- s16 phi_a2;
- temp_s1 = &gPlayerOne[arg0->unkAE];
+ temp_s1 = &gPlayerOne[camera->playerId];
temp_v0 = temp_s1->unk_078;
if (temp_v0 == 0) {
- phi_a2 = 0x64;
+ var_a2 = 0x0064;
} else if (temp_v0 < 0) {
- phi_a2 = 0xA0 - (temp_v0 / 0x10);
+ var_a2 = 0xA0 - (temp_v0 / 16);
} else {
- phi_a2 = (temp_v0 / 0x10) + 0xA0;
+ var_a2 = (temp_v0 / 16) + 0xA0;
}
temp_v0_2 = temp_s1->unk_0BC;
- if (((temp_v0_2 & 0x80) == 0) && ((temp_v0_2 & 0x40) == 0)) {
- func_800224F0(arg0 + 0x2C, temp_s1->unk_02E, phi_a2);
- }
- func_8001D794(temp_s1, arg0, &sp64, &sp84, &sp80, &sp7C, arg0->unk2C);
- func_802ADDC8(arg0 + 0x54, 0x41200000, sp84, sp80, sp7C);
- arg0->unkC = sp64;
- arg0->unk10 = sp68;
- arg0->unk14 = sp6C;
- arg0->unk0 = sp84;
- arg0->unk4 = sp80;
- temp_f12 = arg0->unkC - arg0->unk0;
- arg0->unk8 = sp7C;
- sp90 = arg0->unk10 - arg0->unk4;
+ if (!(temp_v0_2 & 0x80) && !(temp_v0_2 & 0x40)) {
+ func_800224F0(&camera->unk_2C, temp_s1->unk_02E, var_a2);
+ }
+ func_8001D794(temp_s1, camera, &sp64, &sp84, &sp80, &sp7C, (s32) camera->unk_2C);
+ func_802ADDC8(&camera->unk_54, 10.0f, sp84, sp80, sp7C);
+ camera->lookAt[0] = sp64;
+ camera->lookAt[1] = sp68;
+ camera->lookAt[2] = sp6C;
+ camera->pos[0] = sp84;
+ camera->pos[1] = sp80;
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ camera->pos[2] = sp7C;
+ sp90 = camera->lookAt[1] - camera->pos[1];
sp94 = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp8C = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015390.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(f32, s32, f32, s16); // extern
-extern f64 D_800ED218;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(f32, s32, f32, s16); /* extern */
extern ? D_80162FA0;
-extern ? gNearestWaypointByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
-void func_80015544(s32 arg0, f32 arg1, s32 arg2, s16 arg3) {
+void func_80015544(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
s32 sp2C;
s16 *sp28;
f32 *sp24;
f32 *sp20;
f64 sp18;
+ Camera *temp_v0;
f32 *temp_a0;
f32 *temp_a1;
- f32 *temp_v1_2;
- f32 *temp_v1_3;
+ f32 *var_v1;
f32 temp_f0;
f32 temp_f12;
f64 temp_f12_2;
@@ -8508,17 +8489,15 @@ void func_80015544(s32 arg0, f32 arg1, s32 arg2, s16 arg3) {
s16 *temp_v1;
s32 temp_hi;
s32 temp_t7;
- void *temp_v0;
- f32 *phi_v1;
- temp_t7 = arg2 * 4;
- temp_hi = (*(&gNearestWaypointByPlayerId + (arg0 * 2)) + 0xA) % *(&gWaypointCountByPathIndex + (arg3 * 2));
+ temp_t7 = cameraId * 4;
+ temp_hi = (s32) (gNearestWaypointByPlayerId[playerId] + 0xA) % (s32) gWaypointCountByPathIndex[pathIndex];
*(&D_80164688 + temp_t7) = arg1;
- temp_v1 = (arg2 * 2) + &gNearestWaypointByCameraId;
- *temp_v1 = temp_hi;
+ temp_v1 = &gNearestWaypointByCameraId[cameraId];
+ *temp_v1 = (s16) temp_hi;
sp28 = temp_v1;
sp2C = temp_t7;
- func_8000BBD8(arg1, temp_hi & 0xFFFF, arg1, arg3);
+ func_8000BBD8(arg1, temp_hi & 0xFFFF, arg1, pathIndex);
temp_f12 = D_80162FA0.unk0;
temp_f0 = D_80162FA0.unk8;
temp_a0 = temp_t7 + &D_801645F8;
@@ -8527,49 +8506,37 @@ void func_80015544(s32 arg0, f32 arg1, s32 arg2, s16 arg3) {
*temp_a1 = temp_f0;
sp20 = temp_a1;
sp24 = temp_a0;
- temp_f2 = ((&D_80164550)[arg3] + (*temp_v1 * 8))->unk2;
+ temp_f2 = (f64) (f32) D_80164550[(s32) pathIndex][*temp_v1].wayPointY;
sp18 = temp_f2;
- temp_f12_2 = func_802AE1C0(temp_f12, temp_f2 + 30.0, temp_f0);
- if ((temp_f12_2 < (temp_f2 - 20.0)) || (D_800ED218 <= temp_f12_2)) {
- temp_v1_3 = temp_t7 + &D_80164618;
- *temp_v1_3 = temp_f2 + 10.0;
- phi_v1 = temp_v1_3;
+ temp_f12_2 = (f64) func_802AE1C0(temp_f12, (f32) (temp_f2 + 30.0), temp_f0);
+ if ((temp_f12_2 < (temp_f2 - 20.0)) || (temp_f12_2 >= 3000.0)) {
+ var_v1 = temp_t7 + &D_80164618;
+ *var_v1 = (f32) (temp_f2 + 10.0);
} else {
- temp_v1_2 = temp_t7 + &D_80164618;
- *temp_v1_2 = temp_f12_2 + 10.0;
- phi_v1 = temp_v1_2;
+ var_v1 = temp_t7 + &D_80164618;
+ *var_v1 = (f32) (temp_f12_2 + 10.0);
}
*(&D_80164648 + temp_t7) = 0.0f;
- temp_v0 = (arg2 * 0xB8) + &cameras;
- temp_v0->unk0 = *temp_a0;
- temp_v0->unk4 = *phi_v1;
- temp_v0->unk8 = *temp_a1;
+ temp_v0 = &cameras[cameraId];
+ temp_v0->pos[0] = *temp_a0;
+ temp_v0->pos[1] = *var_v1;
+ temp_v0->pos[2] = *temp_a1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015544.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
-s16 func_8000D33C(f32, f32, u16, f32, s16, s32); // extern
-? func_80014D30(s32, s32); // extern
-? func_8001A348(s32, s32, s16); // extern
-s16 atan2s(f32, f32); // extern
-extern f64 D_800ED220;
-extern f64 D_800ED228;
-extern ? D_80163068;
-extern ? gNearestWaypointByPlayerId;
-extern ? gPathIndexByPlayerId;
-extern ? gWaypointCountByPathIndex;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80014D30(s32, s32); /* extern */
+? func_8001A348(s32, s32, s16); /* extern */
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_80164688;
-void func_8001577C(void *arg0, ? arg1, ? arg2, s32 arg3) {
+void func_8001577C(Camera *camera, s32 arg1, s32 arg2, s32 arg3) {
s16 sp8E;
s16 sp8C;
f32 sp84;
@@ -8588,94 +8555,87 @@ void func_8001577C(void *arg0, ? arg1, ? arg2, s32 arg3) {
s16 temp_t2;
s16 temp_t3;
s16 temp_v1;
- s32 temp_t1;
s32 temp_v0;
s32 temp_v0_2;
- s32 temp_v0_3;
s32 temp_v1_2;
s32 temp_v1_3;
- s32 temp_v1_4;
+ s32 var_v1;
u16 temp_a1;
- s32 phi_v1;
- temp_v1 = arg0->unkAE;
- temp_t1 = temp_v1 * 2;
- temp_a1 = *(&gPathIndexByPlayerId + temp_t1);
- temp_v0 = arg3 * 2;
- temp_t0 = temp_v0 + &gNearestWaypointByCameraId;
+ temp_v1 = camera->playerId;
+ temp_a1 = gPathIndexByPlayerId[temp_v1];
+ temp_t0 = &gNearestWaypointByCameraId[arg3];
sp34 = temp_t0;
- sp38 = temp_v0;
- sp3C = temp_t1;
- sp74 = temp_v1;
- sp44 = temp_a1;
+ sp38 = arg3 * 2;
+ sp3C = temp_v1 * 2;
+ sp74 = (s32) temp_v1;
+ sp44 = (s32) temp_a1;
temp_s2 = &gPlayerOne[temp_v1];
- *temp_t0 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t0, temp_a1);
- temp_t2 = *(&gNearestWaypointByPlayerId + temp_t1);
+ *temp_t0 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t0, (s32) temp_a1);
+ temp_t2 = (s16) gNearestWaypointByPlayerId[temp_v1];
temp_t3 = *temp_t0;
sp8C = temp_t2;
sp8E = temp_t3;
- if (func_80007BF8(temp_t2 & 0xFFFF, temp_t3 & 0xFFFF, 0x32, 0xF, *(&gWaypointCountByPathIndex + (sp44 * 2))) <= 0) {
+ if (func_80007BF8(temp_t2 & 0xFFFF, temp_t3 & 0xFFFF, 0x0032U, 0x000FU, (u16) (s32) gWaypointCountByPathIndex[sp44]) <= 0) {
temp_v1_2 = arg3 * 4;
sp3C = temp_v1_2;
func_8001A348(arg3, *(&D_80164680 + temp_v1_2), *(&D_80164688 + sp38));
goto block_10;
}
- temp_f0 = *(&D_80163068 + (temp_v1 * 4));
+ temp_f0 = (f64) D_80163068[temp_v1];
temp_v1_3 = arg3 * 4;
- if ((temp_f0 < D_800ED220) && (temp_v0_2 = temp_t2 - temp_t3, (*(&D_80164688 + temp_v1_3) < -0.5)) && ((temp_v0_2 * temp_v0_2) < 5)) {
- sp3C = temp_v1_3;
- func_8001A348(arg3, 0x3F800000, 3);
- goto block_10;
- }
- temp_v1_4 = arg3 * 4;
- phi_v1 = temp_v1_4;
- if (D_800ED228 < temp_f0) {
- temp_v0_3 = temp_t2 - temp_t3;
- if ((*(&D_80164688 + temp_v1_4) > 0.5) && ((temp_v0_3 * temp_v0_3) < 5)) {
- sp3C = temp_v1_4;
+ if (temp_f0 < -0.7) {
+ temp_v0 = temp_t2 - temp_t3;
+ if (((f64) *(&D_80164688 + temp_v1_3) < -0.5) && ((temp_v0 * temp_v0) < 5)) {
+ sp3C = temp_v1_3;
+ func_8001A348(arg3, 0x3F800000, 3);
+ goto block_10;
+ }
+ }
+ var_v1 = arg3 * 4;
+ if (temp_f0 > 0.7) {
+ temp_v0_2 = temp_t2 - temp_t3;
+ if (((f64) *(&D_80164688 + var_v1) > 0.5) && ((temp_v0_2 * temp_v0_2) < 5)) {
+ sp3C = var_v1;
func_8001A348(arg3, 0xBF800000, 2);
block_10:
- phi_v1 = sp3C;
+ var_v1 = sp3C;
}
}
- arg0->unk0 = *(&D_801645F8 + phi_v1);
- arg0->unk4 = *(&D_80164618 + phi_v1);
- arg0->unk8 = *(&D_80164638 + phi_v1);
- arg0->unkC = temp_s2->posX;
- arg0->unk10 = temp_s2->posY + 6.0;
- arg0->unk14 = temp_s2->posZ;
+ camera->pos[0] = *(&D_801645F8 + var_v1);
+ camera->pos[1] = *(&D_80164618 + var_v1);
+ camera->pos[2] = *(&D_80164638 + var_v1);
+ camera->lookAt[0] = temp_s2->pos[0];
+ camera->lookAt[1] = (f32) ((f64) temp_s2->pos[1] + 6.0);
+ camera->lookAt[2] = temp_s2->pos[2];
func_80014D30(arg3, sp44);
- temp_f12 = arg0->unkC - arg0->unk0;
- sp80 = arg0->unk10 - arg0->unk4;
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ sp80 = camera->lookAt[1] - camera->pos[1];
sp84 = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp7C = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001577C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(f32, s32, f32, s16, s16); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(f32, s32, f32, s16, s16); /* extern */
extern ? D_80162FA0;
-extern ? gNearestWaypointByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
-extern ? gPlayers;
-void func_80015A9C(s32 arg0, f32 arg1, s32 arg2, s16 arg3) {
+void func_80015A9C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
s32 sp20;
s16 *sp1C;
+ Camera *temp_v0;
f32 *temp_a0;
f32 *temp_a1;
f32 *temp_a2_2;
@@ -8686,65 +8646,55 @@ void func_80015A9C(s32 arg0, f32 arg1, s32 arg2, s16 arg3) {
s16 temp_a3;
s32 temp_t3;
s32 temp_t8;
- void *temp_v0;
- temp_a3 = arg3;
- temp_t8 = arg2 * 4;
- temp_v1 = (arg2 * 2) + &gNearestWaypointByCameraId;
+ temp_a3 = pathIndex;
+ temp_t8 = cameraId * 4;
+ temp_v1 = &gNearestWaypointByCameraId[cameraId];
*(&D_80164688 + temp_t8) = arg1;
- *temp_v1 = *(&gNearestWaypointByPlayerId + (arg0 * 2)) + 0xA;
- temp_t3 = *temp_v1 % *(&gWaypointCountByPathIndex + (temp_a3 * 2));
- *temp_v1 = temp_t3;
+ *temp_v1 = gNearestWaypointByPlayerId[playerId] + 0xA;
+ temp_t3 = (s16) *temp_v1 % (s32) gWaypointCountByPathIndex[temp_a3];
+ *temp_v1 = (s16) temp_t3;
temp_a2 = temp_a3;
sp20 = temp_t8;
sp1C = temp_v1;
- arg3 = temp_a3;
+ pathIndex = temp_a3;
func_8000BBD8(arg1, temp_t3 & 0xFFFF, arg1, temp_a2, temp_a3);
temp_a0 = temp_t8 + &D_801645F8;
*temp_a0 = D_80162FA0.unk0;
temp_a1 = temp_t8 + &D_80164618;
temp_a2_2 = temp_t8 + &D_80164638;
- *temp_a1 = ((&D_80164550)[arg3] + (*temp_v1 * 8))->unk2;
+ *temp_a1 = (f32) D_80164550[pathIndex][*temp_v1].wayPointY;
*temp_a2_2 = D_80162FA0.unk8;
- temp_f0 = *(&gPlayers + 0x94 + (arg0 * 0xDD8)) / 5.0f;
+ temp_f0 = *(&gPlayers->unk_094 + (playerId * 0xDD8)) / 5.0f;
temp_t0 = temp_t8 + &D_80164648;
*temp_t0 = temp_f0;
- if (temp_f0 < 0.0) {
+ if ((f64) temp_f0 < 0.0) {
*temp_t0 = 0.0f;
}
- temp_v0 = (arg2 * 0xB8) + &cameras;
- temp_v0->unk0 = *temp_a0;
- temp_v0->unk4 = *temp_a1;
- temp_v0->unk8 = *temp_a2_2;
+ temp_v0 = &cameras[cameraId];
+ temp_v0->pos[0] = *temp_a0;
+ temp_v0->pos[1] = *temp_a1;
+ temp_v0->pos[2] = *temp_a2_2;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015A9C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
-? func_8000BBD8(u16, s32, u16, s16, s32 *); // extern
-s16 func_8000D33C(f32, f32, s16 *, f32, s16, s32); // extern
-? func_80014D30(s32, s32); // extern
-? func_8001A348(s32, s32, s16, s32 *, s32 *); // extern
-s16 atan2s(f32, f32); // extern
-extern f64 D_800ED230;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(u16, s32, u16, s16, s32 *); /* extern */
+? func_80014D30(s32, s32); /* extern */
+? func_8001A348(s32, s32, s16, s32 *, s32 *); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
extern s32 D_80163238;
-extern ? gNearestWaypointByPlayerId;
-extern ? gPathIndexByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_80164688;
-void func_80015C94(void *arg0, ? arg1, ? arg2, s32 arg3) {
+void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 spA8;
f32 spA4;
Player *spA0;
@@ -8757,16 +8707,15 @@ void func_80015C94(void *arg0, ? arg1, ? arg2, s32 arg3) {
s16 sp7A;
u16 sp78;
s32 sp68;
- s32 sp5C;
+ s32 sp5C; /* compiler-managed */
s16 *sp58;
u16 *sp54;
s32 *sp50;
s32 sp44;
f64 sp38;
- f32 *temp_a3_4;
+ f32 *temp_a3_3;
f32 temp_f0_2;
f32 temp_f0_3;
- f32 temp_f12;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f16;
@@ -8775,244 +8724,215 @@ void func_80015C94(void *arg0, ? arg1, ? arg2, s32 arg3) {
f32 temp_f20_2;
f32 temp_f2;
f32 temp_f6;
+ f32 var_f18;
+ f32 var_f20;
f64 temp_f0;
f64 temp_f16_2;
f64 temp_f2_2;
s16 *temp_a1;
s16 *temp_t0;
- s16 *temp_v0_3;
- s16 temp_v0_2;
+ s16 temp_v0;
s16 temp_v1;
s32 *temp_a3;
s32 *temp_a3_2;
- s32 *temp_a3_3;
+ s32 *var_a3;
s32 temp_hi;
- s32 temp_s1;
- s32 temp_s1_2;
- s32 temp_s1_3;
- s32 temp_s1_4;
- s32 temp_v0;
+ s32 var_f12;
+ s32 var_s1;
+ struct TrackWayPoint *temp_v0_2;
u16 *temp_t1_2;
u16 *temp_t2;
u16 temp_t1;
u16 temp_v1_2;
- s32 *phi_a3;
- u16 phi_f12;
- s32 phi_s1;
- f32 phi_f20;
- f32 phi_f18;
- s32 *phi_a3_2;
- temp_v1 = arg0->unkAE;
- D_80163238 = temp_v1;
- temp_s1 = temp_v1 * 2;
- temp_t1 = *(&gPathIndexByPlayerId + temp_s1);
- temp_v0 = arg3 * 2;
- temp_a1 = temp_v0 + &gNearestWaypointByCameraId;
+ temp_v1 = camera->playerId;
+ D_80163238 = (s32) temp_v1;
+ temp_t1 = gPathIndexByPlayerId[temp_v1];
+ temp_a1 = &gNearestWaypointByCameraId[cameraId];
spA0 = &gPlayerOne[temp_v1];
sp58 = temp_a1;
- sp5C = temp_v0;
- sp9C = temp_v1;
- sp68 = temp_t1;
- *sp58 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_a1, temp_t1);
- temp_t2 = (sp68 * 2) + &gWaypointCountByPathIndex;
+ sp5C = cameraId * 2;
+ sp9C = (s32) temp_v1;
+ sp68 = (s32) temp_t1;
+ *sp58 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_a1, (s32) temp_t1);
+ temp_t2 = &gWaypointCountByPathIndex[sp68];
sp54 = temp_t2;
- if (func_80007BF8(*(&gNearestWaypointByPlayerId + temp_s1) & 0xFFFF, *sp58 & 0xFFFF, 0x32, 0xF, *temp_t2) <= 0) {
- temp_s1_2 = arg3 * 4;
- temp_a3 = temp_s1_2 + &D_80164688;
+ if (func_80007BF8((s16) gNearestWaypointByPlayerId[temp_v1] & 0xFFFF, *sp58 & 0xFFFF, 0x0032U, 0x000FU, (u16) (s32) *temp_t2) <= 0) {
+ var_s1 = cameraId * 4;
+ temp_a3 = var_s1 + &D_80164688;
sp50 = temp_a3;
- func_8001A348(arg3, *temp_a3, *(&D_80164680 + sp5C), temp_a3);
- phi_a3_2 = temp_a3;
- phi_s1 = temp_s1_2;
- goto block_8;
- }
- temp_f0 = *(&D_80163068 + (temp_v1 * 4));
- if ((temp_f0 < -0.5) && (temp_s1_3 = arg3 * 4, temp_a3_2 = temp_s1_3 + &D_80164688, phi_s1 = temp_s1_3, (*temp_a3_2 < -0.5))) {
- sp50 = temp_a3_2;
- func_8001A348(arg3, 0x3F800000, 7, temp_a3_2);
- phi_a3_2 = temp_a3_2;
+ func_8001A348(cameraId, *temp_a3, *(&D_80164680 + sp5C), temp_a3);
+ var_a3 = temp_a3;
goto block_8;
}
- temp_s1_4 = arg3 * 4;
- temp_a3_3 = temp_s1_4 + &D_80164688;
- temp_f12 = *temp_a3_3;
- phi_a3 = temp_a3_3;
- phi_f12 = (bitwise u16) temp_f12;
- phi_s1 = temp_s1_4;
- phi_s1 = temp_s1_4;
- if ((temp_f0 > 0.5) && (temp_f12 > 0.5)) {
- sp50 = temp_a3_3;
- func_8001A348((bitwise s32) temp_f12, arg3, 0xBF800000, 6, temp_a3_3);
- phi_a3_2 = temp_a3_3;
+ temp_f0 = (f64) D_80163068[temp_v1];
+ if (temp_f0 < -0.5) {
+ var_s1 = cameraId * 4;
+ temp_a3_2 = var_s1 + &D_80164688;
+ if ((f64) *temp_a3_2 < -0.5) {
+ sp50 = temp_a3_2;
+ func_8001A348(cameraId, 0x3F800000, 7, temp_a3_2);
+ var_a3 = temp_a3_2;
+ goto block_8;
+ }
+ }
+ var_s1 = cameraId * 4;
+ var_a3 = var_s1 + &D_80164688;
+ var_f12 = *var_a3;
+ if ((temp_f0 > 0.5) && ((f64) var_f12 > 0.5)) {
+ sp50 = var_a3;
+ func_8001A348(var_f12, cameraId, 0xBF800000, (s32 *)6, var_a3);
block_8:
- phi_a3 = phi_a3_2;
- phi_f12 = *phi_a3_2;
+ var_f12 = *var_a3;
}
temp_v1_2 = *sp54;
- temp_v0_2 = *sp58;
- sp50 = phi_a3;
- temp_hi = (temp_v0_2 + 1) % temp_v1_2;
- sp78 = (temp_v0_2 + 2) % temp_v1_2;
- sp7A = temp_hi;
- sp44 = sp6A;
- func_8000BBD8(phi_f12, temp_hi & 0xFFFF, phi_f12, sp6A, phi_a3);
- temp_f20 = D_80162FA0.unk0 * 0.5;
- temp_f18 = D_80162FA0.unk8 * 0.5;
+ temp_v0 = *sp58;
+ sp50 = var_a3;
+ temp_hi = (s32) (temp_v0 + 1) % (s32) temp_v1_2;
+ sp78 = (u16) ((s32) (temp_v0 + 2) % (s32) temp_v1_2);
+ sp7A = (s16) temp_hi;
+ sp44 = (s32) unksp6A;
+ func_8000BBD8((u16) var_f12, (s16) temp_hi & 0xFFFF, (u16) var_f12, unksp6A, var_a3);
+ temp_f20 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
+ temp_f18 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp90 = temp_f18;
- func_8000BBD8(sp78, *phi_a3, sp6A, phi_a3);
- temp_v0_3 = (&D_80164550)[sp68];
- temp_a3_4 = phi_s1 + &D_801645F8;
- temp_t0 = phi_s1 + &D_80164618;
- temp_f14 = (temp_f20 + (D_80162FA0.unk0 * 0.5)) - *temp_a3_4;
- temp_t1_2 = phi_s1 + &D_80164638;
- temp_f6 = ((temp_v0_3 + (sp78 * 8))->unk2 + (temp_v0_3 + (sp7A * 8))->unk2) * 0.5;
+ func_8000BBD8(sp78, *var_a3, (u16) unksp6A, (s16) var_a3);
+ temp_v0_2 = D_80164550[sp68];
+ temp_a3_3 = var_s1 + &D_801645F8;
+ temp_t0 = var_s1 + &D_80164618;
+ temp_f14 = (f32) ((f64) temp_f20 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a3_3;
+ temp_t1_2 = var_s1 + &D_80164638;
+ temp_f6 = (f32) ((f64) (temp_v0_2[(s16) sp78].wayPointY + temp_v0_2[sp7A].wayPointY) * 0.5);
sp54 = temp_t1_2;
sp94 = temp_f6;
sp8C = temp_f14;
temp_f16 = temp_f6 - *temp_t0;
sp58 = temp_t0;
- sp5C = temp_a3_4;
- temp_f0_2 = (temp_f18 + (D_80162FA0.unk8 * 0.5)) - *temp_t1_2;
+ sp5C = temp_a3_3;
+ temp_f0_2 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1_2;
sp88 = temp_f16;
sp84 = temp_f0_2;
temp_f0_3 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f0_2 * temp_f0_2));
- if (temp_f0_3 != 0.0) {
- temp_f2 = *(&D_80164648 + phi_s1);
+ if ((f64) temp_f0_3 != 0.0) {
+ temp_f2 = *(&D_80164648 + var_s1);
+ var_f20 = ((temp_f2 * temp_f14) / temp_f0_3) + *temp_a3_3;
sp94 = ((temp_f2 * temp_f16) / temp_f0_3) + *temp_t0;
- phi_f20 = ((temp_f2 * temp_f14) / temp_f0_3) + *temp_a3_4;
- phi_f18 = ((temp_f2 * sp84) / temp_f0_3) + *temp_t1_2;
+ var_f18 = ((temp_f2 * sp84) / temp_f0_3) + *temp_t1_2;
} else {
+ var_f20 = *temp_a3_3;
+ var_f18 = *temp_t1_2;
sp94 = *temp_t0;
- phi_f20 = *temp_a3_4;
- phi_f18 = *temp_t1_2;
}
- arg0->unk0 = phi_f20;
- arg0->unk8 = phi_f18;
- temp_f16_2 = sp94;
+ camera->pos[0] = var_f20;
+ camera->pos[2] = var_f18;
+ temp_f16_2 = (f64) sp94;
sp38 = temp_f16_2;
- sp90 = phi_f18;
+ sp90 = var_f18;
sp54 = temp_t1_2;
sp58 = temp_t0;
- sp5C = temp_a3_4;
- temp_f2_2 = func_802AE1C0(phi_f20, temp_f16_2 + 30.0, phi_f18);
- if ((temp_f2_2 < (temp_f16_2 - 20.0)) || (D_800ED230 <= temp_f2_2)) {
- arg0->unk4 = temp_f16_2 + 10.0;
+ sp5C = temp_a3_3;
+ temp_f2_2 = (f64) func_802AE1C0(var_f20, (f32) (temp_f16_2 + 30.0), var_f18);
+ if ((temp_f2_2 < (temp_f16_2 - 20.0)) || (temp_f2_2 >= 3000.0)) {
+ camera->pos[1] = (f32) (temp_f16_2 + 10.0);
} else {
- arg0->unk4 = temp_f2_2 + 8.0;
+ camera->pos[1] = (f32) (temp_f2_2 + 8.0);
}
- *temp_a3_4 = phi_f20;
- *temp_t1_2 = phi_f18;
+ *temp_a3_3 = var_f20;
+ *temp_t1_2 = var_f18;
*temp_t0 = sp94;
- arg0->unkC = spA0->posX;
- arg0->unk10 = spA0->posY + 6.0;
- arg0->unk14 = spA0->posZ;
- func_80014D30(arg3, sp68);
- temp_f20_2 = arg0->unkC - arg0->unk0;
- spA8 = arg0->unk10 - arg0->unk4;
- temp_f14_2 = arg0->unk14 - arg0->unk8;
+ camera->lookAt[0] = spA0->pos[0];
+ camera->lookAt[1] = (f32) ((f64) spA0->pos[1] + 6.0);
+ camera->lookAt[2] = spA0->pos[2];
+ func_80014D30(cameraId, sp68);
+ temp_f20_2 = camera->lookAt[0] - camera->pos[0];
+ spA8 = camera->lookAt[1] - camera->pos[1];
+ temp_f14_2 = camera->lookAt[2] - camera->pos[2];
spA4 = temp_f14_2;
- arg0->unk26 = atan2s(temp_f20_2, temp_f14_2);
- arg0->unk24 = atan2s(sqrtf((temp_f20_2 * temp_f20_2) + (temp_f14_2 * temp_f14_2)), spA8);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f20_2, temp_f14_2);
+ camera->rot[0] = atan2s(sqrtf((temp_f20_2 * temp_f20_2) + (temp_f14_2 * temp_f14_2)), spA8);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015C94.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(f32, s32, f32, s16, s16); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(f32, s32, f32, s16, s16); /* extern */
extern ? D_80162FA0;
-extern ? gNearestWaypointByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
-extern ? gPlayers;
-void func_800162CC(s32 arg0, f32 arg1, s32 arg2, s16 arg3) {
+void func_800162CC(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) {
s32 sp20;
- u16 *sp1C;
+ s16 *sp1C;
+ Camera *temp_v0;
f32 *temp_a0;
f32 *temp_a1;
f32 temp_f0;
f32 temp_f2;
+ s16 *temp_t0;
s16 temp_a2;
s16 temp_a3;
s32 temp_t8;
s32 temp_t9;
- u16 *temp_t0;
- void *temp_v0;
- temp_t8 = arg2 * 4;
- temp_a3 = arg3;
- temp_t0 = (arg2 * 2) + &gNearestWaypointByCameraId;
+ temp_t8 = cameraId * 4;
+ temp_a3 = pathIndex;
+ temp_t0 = &gNearestWaypointByCameraId[cameraId];
*(&D_80164688 + temp_t8) = arg1;
- *temp_t0 = *(&gNearestWaypointByPlayerId + (arg0 * 2));
- temp_t9 = *temp_t0 % *(&gWaypointCountByPathIndex + (arg3 * 2));
- *temp_t0 = temp_t9;
+ *temp_t0 = (s16) gNearestWaypointByPlayerId[playerId];
+ temp_t9 = (s16) *temp_t0 % (s32) gWaypointCountByPathIndex[pathIndex];
+ *temp_t0 = (s16) temp_t9;
temp_a2 = temp_a3;
sp1C = temp_t0;
sp20 = temp_t8;
- arg3 = temp_a3;
+ pathIndex = temp_a3;
func_8000BBD8(arg1, temp_t9 & 0xFFFF, arg1, temp_a2, temp_a3);
temp_f0 = D_80162FA0.unk0;
*(&D_801645F8 + temp_t8) = temp_f0;
temp_a0 = temp_t8 + &D_80164618;
temp_a1 = temp_t8 + &D_80164638;
- *temp_a0 = ((&D_80164550)[arg3] + (*temp_t0 * 8))->unk2;
+ *temp_a0 = (f32) D_80164550[pathIndex][*temp_t0].wayPointY;
*temp_a1 = D_80162FA0.unk8;
- temp_f2 = *(&gPlayers + 0x94 + (arg0 * 0xDD8));
+ temp_f2 = *(&gPlayers->unk_094 + (playerId * 0xDD8));
*(&D_80164658 + temp_t8) = temp_f2;
- temp_v0 = (arg2 * 0xB8) + &cameras;
+ temp_v0 = &cameras[cameraId];
*(&D_80164648 + temp_t8) = temp_f2;
- temp_v0->unk0 = temp_f0;
- temp_v0->unk4 = *temp_a0;
- temp_v0->unk8 = *temp_a1;
+ temp_v0->pos[0] = temp_f0;
+ temp_v0->pos[1] = *temp_a0;
+ temp_v0->pos[2] = *temp_a1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800162CC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe
-s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
? func_8000BBD8(u16, f32, s16, u16, s16, s16); /* extern */
-s16 func_8000D33C(f32, f32, s32, f32, s16, s32); /* extern */
? func_80014D30(s32, s32); /* extern */
? func_8001A348(s32, f32, s16, ?, ?); /* extern */
-f32 func_802AE1C0(f32, f32, f32, f32 *); /* extern */
-s16 atan2s(f32, f32); /* extern */
-f32 sqrtf(f32, f32, s32); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
extern s32 D_80163238;
-extern ? gNearestWaypointByPlayerId;
-extern ? D_80164550;
-extern ? gPathIndexByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_80164688;
-extern s32 gPlayerOne;
-void func_80016494(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
+void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 spB6;
s16 spB4;
f32 spAC;
f32 spA8;
f32 spA4;
- void *spA0;
+ Player *spA0;
s32 sp9C;
f32 sp98;
f32 sp94;
@@ -9036,15 +8956,14 @@ void func_80016494(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
u16 *sp38;
f64 sp28;
f32 *temp_a3;
- f32 *temp_t0_2;
+ f32 *temp_t0;
f32 *temp_t1_2;
f32 *temp_t1_3;
f32 *temp_t4;
f32 *temp_t5;
f32 *temp_t5_2;
- f32 temp_f0_3;
+ f32 temp_f0_2;
f32 temp_f12;
- f32 temp_f12_2;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f16;
@@ -9057,194 +8976,184 @@ void func_80016494(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
f32 temp_f4;
f32 temp_f6;
f32 temp_f6_2;
+ f32 var_f12;
+ f32 var_f18;
f64 temp_f0;
- f64 temp_f0_2;
f64 temp_f16_2;
f64 temp_f2_6;
+ f64 var_f0;
s16 *temp_t1;
s16 temp_t2;
s16 temp_t3_2;
- s16 temp_v0_2;
+ s16 temp_v0;
s16 temp_v1;
s32 temp_a1;
s32 temp_hi;
s32 temp_ra;
- s32 temp_t0;
- s32 temp_v0;
- s32 temp_v0_3;
+ struct TrackWayPoint *temp_v0_2;
u16 *temp_t7;
u16 temp_t3;
u16 temp_v1_2;
- f64 phi_f0;
- u16 phi_f12;
- f32 phi_f18;
- temp_a1 = arg3 * 4;
+ temp_a1 = cameraId * 4;
temp_t5 = temp_a1 + &D_80164648;
temp_t4 = temp_a1 + &D_80164658;
temp_f2 = *temp_t5;
- temp_v1 = arg0->unkAE;
+ temp_v1 = camera->playerId;
*temp_t5 = temp_f2 + ((*temp_t4 - temp_f2) * 0.5f);
D_80163238 = (s32) temp_v1;
- temp_t0 = temp_v1 * 2;
- temp_t3 = *(&gPathIndexByPlayerId + temp_t0);
+ temp_t3 = gPathIndexByPlayerId[temp_v1];
temp_ra = temp_v1 * 0xDD8;
- temp_v0 = arg3 * 2;
- temp_t1 = temp_v0 + &gNearestWaypointByCameraId;
+ temp_t1 = &gNearestWaypointByCameraId[cameraId];
sp4C = temp_ra;
- spA0 = gPlayerOne + temp_ra;
+ spA0 = &gPlayerOne[temp_v1];
sp44 = temp_t1;
- sp48 = temp_v0;
- sp50 = temp_t0;
+ sp48 = cameraId * 2;
+ sp50 = temp_v1 * 2;
sp58 = temp_t5;
sp54 = temp_t4;
sp5C = temp_a1;
sp9C = (s32) temp_v1;
sp68 = (s32) temp_t3;
- *sp44 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t1, (s32) temp_t3);
- temp_t1_2 = (temp_v1 * 4) + &D_80163068;
+ *sp44 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t1, (s32) temp_t3);
+ temp_t1_2 = &D_80163068[temp_v1];
temp_t5_2 = sp5C + &D_80164688;
temp_f2_2 = *temp_t1_2 - *temp_t5_2;
temp_t3_2 = *sp44;
- temp_t7 = (sp68 * 2) + &gWaypointCountByPathIndex;
+ temp_t7 = &gWaypointCountByPathIndex[sp68];
temp_f2_3 = temp_f2_2 * temp_f2_2;
sp38 = temp_t7;
- temp_t2 = *(&gNearestWaypointByPlayerId + temp_t0);
+ temp_t2 = (s16) gNearestWaypointByPlayerId[temp_v1];
sp3C = temp_t5_2;
sp64 = temp_f2_3;
sp40 = temp_t1_2;
spB6 = temp_t3_2;
spB4 = temp_t2;
- if (func_80007BF8(temp_t2 & 0xFFFF, temp_t3_2 & 0xFFFF, 0xF, 0xF, (s32) *temp_t7) <= 0) {
+ if (func_80007BF8(temp_t2 & 0xFFFF, temp_t3_2 & 0xFFFF, 0x000FU, 0x000FU, (u16) (s32) *temp_t7) <= 0) {
sp3C = temp_t5_2;
- func_8001A348(arg3, *temp_t5_2, *(&D_80164680 + sp48));
- phi_f12 = (bitwise u16) *temp_t5_2;
+ func_8001A348(cameraId, *temp_t5_2, *(&D_80164680 + sp48));
+ var_f12 = *temp_t5_2;
} else {
temp_f0 = (f64) *temp_t1_2;
if ((temp_f0 < 0.0) && ((f64) *temp_t5_2 < 0.0) && ((f64) temp_f2_3 < 0.01)) {
sp3C = temp_t5_2;
- func_8001A348(arg3, 1.0f, 5);
- phi_f12 = (bitwise u16) *temp_t5_2;
+ func_8001A348(cameraId, 1.0f, 5);
+ var_f12 = *temp_t5_2;
} else {
- temp_f12 = *temp_t5_2;
- phi_f12 = (bitwise u16) temp_f12;
- if ((temp_f0 > 0.0) && ((f64) temp_f12 > 0.0) && ((f64) temp_f2_3 < 0.01)) {
+ var_f12 = *temp_t5_2;
+ if ((temp_f0 > 0.0) && ((f64) var_f12 > 0.0) && ((f64) temp_f2_3 < 0.01)) {
sp3C = temp_t5_2;
- func_8001A348((bitwise s32) temp_f12, 0.0f, (s16) arg3, 0xBF800000, 4);
- phi_f12 = (bitwise u16) *temp_t5_2;
+ func_8001A348((bitwise s32) var_f12, 0.0f, (s16) cameraId, 0xBF800000, 4);
+ var_f12 = *temp_t5_2;
} else {
- if (((s32) temp_t3_2 < (s32) temp_t2) && ((temp_t2 - temp_t3_2) < 0xA)) {
+ if ((temp_t3_2 < temp_t2) && ((temp_t2 - temp_t3_2) < 0xA)) {
*temp_t4 = (f32) ((f64) *(&gPlayers->unk_094 + temp_ra) + 0.4);
}
- if (((s32) temp_t2 < (s32) temp_t3_2) && ((temp_t3_2 - temp_t2) < 0xA)) {
+ if ((temp_t2 < temp_t3_2) && ((temp_t3_2 - temp_t2) < 0xA)) {
*temp_t4 = (f32) ((f64) *(&gPlayers->unk_094 + temp_ra) - 0.4);
}
- temp_f0_2 = (f64) *temp_t4;
- phi_f0 = temp_f0_2;
- if (temp_f0_2 > 10.0) {
+ var_f0 = (f64) *temp_t4;
+ if (var_f0 > 10.0) {
*temp_t4 = 10.0f;
- phi_f0 = (f64) *temp_t4;
+ var_f0 = (f64) *temp_t4;
}
- if (phi_f0 < 0.0) {
+ if (var_f0 < 0.0) {
*temp_t4 = 0.0f;
}
}
}
}
temp_v1_2 = *sp38;
- temp_v0_2 = *sp44;
- sp3C = sp5C + &D_80164688;
- temp_hi = (s32) (temp_v0_2 + 1) % (s32) temp_v1_2;
- sp78 = (u16) ((s32) (temp_v0_2 + 2) % (s32) temp_v1_2);
+ temp_v0 = *sp44;
+ sp3C = temp_t5_2;
+ temp_hi = (s32) (temp_v0 + 1) % (s32) temp_v1_2;
+ sp78 = (u16) ((s32) (temp_v0 + 2) % (s32) temp_v1_2);
sp7A = (s16) temp_hi;
sp54 = (f32 *) unksp6A;
- func_8000BBD8(phi_f12, 0.0f, (s16) temp_hi & 0xFFFF, phi_f12, unksp6A, (s16) temp_hi);
+ func_8000BBD8((bitwise u16) var_f12, 0.0f, (s16) temp_hi & 0xFFFF, (bitwise u16) var_f12, unksp6A, (s16) temp_hi);
temp_f6 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
sp98 = temp_f6;
temp_f18 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp90 = temp_f18;
- func_8000BBD8(sp78, *(sp5C + &D_80164688), unksp6A);
- temp_v0_3 = *(&D_80164550 + (sp68 * 4));
+ func_8000BBD8(sp78, *temp_t5_2, unksp6A);
+ temp_v0_2 = D_80164550[sp68];
temp_f4 = (f32) ((f64) temp_f6 + ((f64) D_80162FA0.unk0 * 0.5));
sp98 = temp_f4;
temp_a3 = sp5C + &D_801645F8;
- temp_t0_2 = sp5C + &D_80164618;
+ temp_t0 = sp5C + &D_80164618;
temp_t1_3 = sp5C + &D_80164638;
sp4C = temp_t1_3;
- sp50 = temp_t0_2;
+ sp50 = temp_t0;
sp54 = temp_a3;
temp_f14 = temp_f4 - *temp_a3;
- temp_f6_2 = (f32) ((f64) ((temp_v0_3 + ((s16) sp78 * 8))->unk2 + (temp_v0_3 + (sp7A * 8))->unk2) * 0.5);
+ temp_f6_2 = (f32) ((f64) (temp_v0_2[(s16) sp78].wayPointY + temp_v0_2[sp7A].wayPointY) * 0.5);
temp_f2_4 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1_3;
sp94 = temp_f6_2;
sp8C = temp_f14;
- temp_f16 = temp_f6_2 - *temp_t0_2;
+ temp_f16 = temp_f6_2 - *temp_t0;
sp84 = temp_f2_4;
sp88 = temp_f16;
- temp_f0_3 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f2_4 * temp_f2_4), temp_f14, sp5C);
- if ((f64) temp_f0_3 != 0.0) {
+ temp_f0_2 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f2_4 * temp_f2_4));
+ if ((f64) temp_f0_2 != 0.0) {
temp_f2_5 = *sp58;
- sp98 = ((temp_f2_5 * temp_f14) / temp_f0_3) + *temp_a3;
- sp94 = ((temp_f2_5 * temp_f16) / temp_f0_3) + *temp_t0_2;
- phi_f18 = ((temp_f2_5 * sp84) / temp_f0_3) + *temp_t1_3;
+ sp98 = ((temp_f2_5 * temp_f14) / temp_f0_2) + *temp_a3;
+ sp94 = ((temp_f2_5 * temp_f16) / temp_f0_2) + *temp_t0;
+ var_f18 = ((temp_f2_5 * sp84) / temp_f0_2) + *temp_t1_3;
} else {
+ var_f18 = *temp_t1_3;
sp98 = *temp_a3;
- sp94 = *temp_t0_2;
- phi_f18 = *temp_t1_3;
+ sp94 = *temp_t0;
}
- arg0->unk8 = phi_f18;
- arg0->unk0 = sp98;
+ camera->pos[2] = var_f18;
+ camera->pos[0] = sp98;
temp_f16_2 = (f64) sp94;
sp28 = temp_f16_2;
- sp90 = phi_f18;
+ sp90 = var_f18;
sp4C = temp_t1_3;
- sp50 = temp_t0_2;
+ sp50 = temp_t0;
sp54 = temp_a3;
- temp_f2_6 = (f64) func_802AE1C0(sp98, (f32) (temp_f16_2 + 30.0), phi_f18, temp_a3);
+ temp_f2_6 = (f64) func_802AE1C0(sp98, (f32) (temp_f16_2 + 30.0), var_f18);
if ((temp_f2_6 < (temp_f16_2 - 20.0)) || (temp_f2_6 >= 3000.0)) {
- arg0->unk4 = (f32) (temp_f16_2 + 10.0);
+ camera->pos[1] = (f32) (temp_f16_2 + 10.0);
} else {
- arg0->unk4 = (f32) (temp_f2_6 + 10.0);
+ camera->pos[1] = (f32) (temp_f2_6 + 10.0);
}
- *temp_t1_3 = phi_f18;
+ *temp_t1_3 = var_f18;
*temp_a3 = sp98;
- *temp_t0_2 = sp94;
- arg0->unkC = (f32) spA0->unk14;
- arg0->unk10 = (f32) ((f64) spA0->unk18 + 6.0);
- arg0->unk14 = (f32) spA0->unk1C;
- func_80014D30(arg3, sp68);
- temp_f12_2 = arg0->unkC - arg0->unk0;
- spA8 = arg0->unk10 - arg0->unk4;
- spAC = temp_f12_2;
- temp_f14_2 = arg0->unk14 - arg0->unk8;
+ *temp_t0 = sp94;
+ camera->lookAt[0] = spA0->pos[0];
+ camera->lookAt[1] = (f32) ((f64) spA0->pos[1] + 6.0);
+ camera->lookAt[2] = spA0->pos[2];
+ func_80014D30(cameraId, sp68);
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ spA8 = camera->lookAt[1] - camera->pos[1];
+ spAC = temp_f12;
+ temp_f14_2 = camera->lookAt[2] - camera->pos[2];
spA4 = temp_f14_2;
- arg0->unk26 = atan2s(temp_f12_2, temp_f14_2);
- arg0->unk24 = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2), temp_f14_2), spA8);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14_2);
+ camera->rot[0] = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80016494.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(s32, ?32, ?32, s32); // extern
-extern ?32 D_800ED260;
-extern ?32 D_800ED264;
-extern f32 D_800ED268;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(s32, ?32, ?32, s32); /* extern */
extern ? D_80162FA0;
extern ? D_80163DD8;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
+static ?32 D_800ED260 = 0x3DCCCCCD; /* const */
+static ?32 D_800ED264 = 0xBDCCCCCD; /* const */
+s16 gCurrentCourseId; /* unable to generate initializer */
-void func_80016C3C(s32 arg0, ? arg1, s32 arg2) {
+void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) {
f32 sp5C;
f32 sp54;
u16 sp44;
@@ -9252,14 +9161,13 @@ void func_80016C3C(s32 arg0, ? arg1, s32 arg2) {
s32 *sp34;
f32 *sp2C;
f32 *sp28;
- ?32 *temp_s2;
- ?32 *temp_s2_2;
+ ?32 *var_s2;
+ Camera *temp_v0_2;
f32 *temp_t2;
f32 *temp_t3;
f32 temp_f12;
f32 temp_f2;
s16 *temp_s1;
- s16 *temp_t7;
s16 temp_v1_2;
s16 temp_v1_3;
s32 *temp_v0;
@@ -9267,92 +9175,84 @@ void func_80016C3C(s32 arg0, ? arg1, s32 arg2) {
s32 temp_t6;
s32 temp_t6_2;
s32 temp_t8;
+ s32 var_a3;
+ struct TrackWayPoint *temp_t7;
u16 temp_s0;
- void *temp_v0_2;
- s32 phi_a3;
- ?32 *phi_s2;
-
- if (random_int(0x64) < 0x32) {
- temp_t6 = arg2 * 4;
- temp_s2 = temp_t6 + &D_80164688;
- *temp_s2 = D_800ED260;
- phi_a3 = temp_t6;
- phi_s2 = temp_s2;
+
+ if (random_int(0x0064U) < 0x32) {
+ temp_t6 = cameraId * 4;
+ var_s2 = temp_t6 + &D_80164688;
+ var_a3 = temp_t6;
+ *var_s2 = 0x3DCCCCCD;
} else {
- temp_t8 = arg2 * 4;
- temp_s2_2 = temp_t8 + &D_80164688;
- *temp_s2_2 = D_800ED264;
- phi_a3 = temp_t8;
- phi_s2 = temp_s2_2;
+ temp_t8 = cameraId * 4;
+ var_s2 = temp_t8 + &D_80164688;
+ var_a3 = temp_t8;
+ *var_s2 = 0xBDCCCCCD;
}
- temp_v1 = phi_a3 + &D_80163DD8;
+ temp_v1 = var_a3 + &D_80163DD8;
*temp_v1 = 0;
if (gCurrentCourseId == 4) {
sp34 = temp_v1;
- sp3C = phi_a3;
- *temp_v1 = random_int(4);
- *phi_s2 = 0;
- }
- temp_s1 = (arg2 * 2) + &gNearestWaypointByCameraId;
- temp_s0 = *(&gWaypointCountByPathIndex + (*(phi_a3 + &D_80163DD8) * 2));
- temp_t6_2 = *temp_s1 % temp_s0;
- *temp_s1 = temp_t6_2;
- sp3C = phi_a3;
- func_8000BBD8(temp_t6_2 & 0xFFFF, *phi_s2, 0, phi_a3);
+ sp3C = var_a3;
+ *temp_v1 = random_int(4U);
+ *var_s2 = 0;
+ }
+ temp_s1 = &gNearestWaypointByCameraId[cameraId];
+ temp_s0 = gWaypointCountByPathIndex[*temp_v1];
+ temp_t6_2 = (s16) *temp_s1 % (s32) temp_s0;
+ *temp_s1 = (s16) temp_t6_2;
+ sp3C = var_a3;
+ func_8000BBD8(temp_t6_2 & 0xFFFF, *var_s2, 0, var_a3);
temp_v1_2 = *temp_s1;
- temp_t2 = phi_a3 + &D_80164618;
- temp_v0 = phi_a3 + &D_801645F8;
+ temp_t2 = var_a3 + &D_80164618;
+ temp_v0 = var_a3 + &D_801645F8;
*temp_v0 = D_80162FA0.unk0;
- temp_t3 = phi_a3 + &D_80164638;
+ temp_t3 = var_a3 + &D_80164638;
*temp_t3 = D_80162FA0.unk8;
- *temp_t2 = (D_80164550 + (temp_v1_2 * 8))->unk2;
- *(&D_80164658 + phi_a3) = D_800ED268;
- *(&D_80164648 + phi_a3) = 0.0f;
- sp44 = (temp_v1_2 + 0xB) % temp_s0;
+ *temp_t2 = (f32) (*D_80164550)[temp_v1_2].wayPointY;
+ *(&D_80164658 + var_a3) = 16.666666f;
+ *(&D_80164648 + var_a3) = 0.0f;
+ sp44 = (u16) ((s32) (temp_v1_2 + 0xB) % (s32) temp_s0);
sp28 = temp_t3;
sp2C = temp_t2;
sp34 = temp_v0;
- func_8000BBD8(((temp_v1_2 + 0xA) % temp_s0) & 0xFFFF, *phi_s2, 0, phi_a3);
- temp_f2 = D_80162FA0.unk0 * 0.5;
- temp_f12 = D_80162FA0.unk8 * 0.5;
+ func_8000BBD8((s16) ((s32) (temp_v1_2 + 0xA) % (s32) temp_s0) & 0xFFFF, *var_s2, 0, var_a3);
+ temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
+ temp_f12 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp5C = temp_f2;
sp54 = temp_f12;
- func_8000BBD8((bitwise s32) temp_f12, sp44, *phi_s2, 0);
+ func_8000BBD8((bitwise s32) temp_f12, (?32) sp44, *var_s2, 0);
temp_v1_3 = *temp_s1;
- temp_t7 = D_80164550;
- temp_v0_2 = (arg2 * 0xB8) + &cameras;
- temp_v0_2->unkC = temp_f2 + (D_80162FA0.unk0 * 0.5);
- temp_v0_2->unk14 = temp_f12 + (D_80162FA0.unk8 * 0.5);
- temp_v0_2->unk10 = (((temp_t7 + (((temp_v1_3 + 6) % temp_s0) * 8))->unk2 + (temp_t7 + (((temp_v1_3 + 5) % temp_s0) * 8))->unk2) * 0.5f) + 8.0;
- temp_v0_2->unk0 = *sp34;
- temp_v0_2->unk4 = *sp2C;
- temp_v0_2->unk8 = *sp28;
+ temp_t7 = *D_80164550;
+ temp_v0_2 = &cameras[cameraId];
+ temp_v0_2->lookAt[0] = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5));
+ temp_v0_2->lookAt[2] = (f32) ((f64) temp_f12 + ((f64) D_80162FA0.unk8 * 0.5));
+ temp_v0_2->lookAt[1] = (f32) ((f64) ((f32) (temp_t7[(s16) ((s32) (temp_v1_3 + 6) % (s32) temp_s0)].wayPointY + temp_t7[(s16) ((s32) (temp_v1_3 + 5) % (s32) temp_s0)].wayPointY) * 0.5f) + 8.0);
+ temp_v0_2->pos[0] = (bitwise f32) *sp34;
+ temp_v0_2->pos[1] = *sp2C;
+ temp_v0_2->pos[2] = *sp28;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80016C3C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(u16, s32, s16, s16); // extern
-s16 func_8000D33C(f32, f32, s32 *, s32 *, s16, s32); // extern
-? func_80014D30(s32, s32, f32 *); // extern
-s16 atan2s(f32, f32); // extern
-extern f64 D_800ED270;
-extern f64 D_800ED278;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(u16, s32, s16, s16); /* extern */
+? func_80014D30(s32, s32, f32 *); /* extern */
extern ? D_80162FA0;
extern s32 D_80163238;
extern ? D_80163DD8;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
+s16 gCurrentCourseId; /* unable to generate initializer */
-void func_80017054(void *arg0, ? arg1, ? arg2, s32 arg3) {
+void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 spAC;
f32 spA8;
f32 spA4;
@@ -9375,7 +9275,7 @@ void func_80017054(void *arg0, ? arg1, ? arg2, s32 arg3) {
s32 *sp44;
s16 *sp40;
f32 *sp3C;
- s16 **sp2C;
+ struct TrackWayPoint **sp2C;
f32 *temp_a2;
f32 *temp_t1;
f32 temp_f0;
@@ -9389,12 +9289,11 @@ void func_80017054(void *arg0, ? arg1, ? arg2, s32 arg3) {
f32 temp_f2_2;
f32 temp_f2_3;
f32 temp_f8;
+ f32 var_f14;
+ f32 var_f16;
f64 temp_f0_2;
- s16 **temp_t2_2;
s16 *temp_a1_2;
s16 *temp_t0;
- s16 *temp_t0_2;
- s16 *temp_t0_3;
s16 temp_a3;
s16 temp_a3_2;
s16 temp_a3_3;
@@ -9406,133 +9305,129 @@ void func_80017054(void *arg0, ? arg1, ? arg2, s32 arg3) {
s32 temp_t2;
s32 temp_t6;
s32 temp_v0;
- f32 phi_f14;
- s32 *phi_f16;
+ struct TrackWayPoint **temp_t2_2;
+ struct TrackWayPoint *temp_t0_2;
+ struct TrackWayPoint *temp_t0_3;
- temp_t6 = arg3 * 4;
+ temp_t6 = cameraId * 4;
temp_t1 = temp_t6 + &D_80164648;
temp_f2 = *temp_t1;
temp_a1 = temp_t6 + &D_80163DD8;
temp_t2 = *temp_a1;
*temp_t1 = temp_f2 + ((*(&D_80164658 + temp_t6) - temp_f2) * 0.5f);
- temp_t0 = (arg3 * 2) + &gNearestWaypointByCameraId;
- D_80163238 = arg0->unkAE;
+ temp_t0 = &gNearestWaypointByCameraId[cameraId];
+ D_80163238 = (s32) camera->playerId;
temp_a3 = *temp_t0;
- sp58 = *(&gWaypointCountByPathIndex + (temp_t2 * 2));
+ sp58 = (s32) gWaypointCountByPathIndex[temp_t2];
sp56 = temp_a3;
sp48 = temp_t1;
sp40 = temp_t0;
sp44 = temp_a1;
sp4C = temp_t6;
sp5C = temp_t2;
- *sp40 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, temp_a3, temp_t2);
+ *sp40 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], temp_a3, temp_t2);
if (gCurrentCourseId == 4) {
temp_a3_2 = *sp40;
if ((sp56 != temp_a3_2) && (temp_a3_2 == 1)) {
- temp_v0 = random_int(4);
+ temp_v0 = random_int(4U);
*sp44 = temp_v0;
sp5C = temp_v0;
- *sp40 = func_8000D33C(arg0->unk0, arg0->unk4, arg0->unk8, *sp40, temp_v0);
+ *sp40 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *sp40, temp_v0);
}
}
temp_a3_3 = *sp40;
temp_v1 = sp4C + &D_80164688;
- sp6C = (temp_a3_3 + 0xB) % sp58;
+ sp6C = (u16) ((s32) (temp_a3_3 + 0xB) % sp58);
sp44 = temp_v1;
- sp3C = sp5E;
- func_8000BBD8(((temp_a3_3 + 0xA) % sp58) & 0xFFFF, *temp_v1, sp5E, temp_a3_3);
- sp8C = D_80162FA0.unk0 * 0.5;
- sp84 = D_80162FA0.unk8 * 0.5;
- func_8000BBD8(sp6C, *sp44, sp3E);
- sp8C = sp8C + (D_80162FA0.unk0 * 0.5);
- sp84 = sp84 + (D_80162FA0.unk8 * 0.5);
+ sp3C = (f32 *) unksp5E;
+ func_8000BBD8((s16) ((s32) (temp_a3_3 + 0xA) % sp58) & 0xFFFF, *temp_v1, unksp5E, temp_a3_3);
+ sp8C = (f32) ((f64) D_80162FA0.unk0 * 0.5);
+ sp84 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
+ func_8000BBD8(sp6C, *sp44, unksp3E);
+ sp8C = (f32) ((f64) sp8C + ((f64) D_80162FA0.unk0 * 0.5));
+ sp84 = (f32) ((f64) sp84 + ((f64) D_80162FA0.unk8 * 0.5));
temp_a3_4 = *sp40;
- temp_t2_2 = &(&D_80164550)[sp5C];
+ temp_t2_2 = &D_80164550[sp5C];
temp_t0_2 = *temp_t2_2;
- temp_hi = (temp_a3_4 + 1) % sp58;
- sp88 = ((temp_t0_2 + (((temp_a3_4 + 6) % sp58) * 8))->unk2 + (temp_t0_2 + (((temp_a3_4 + 5) % sp58) * 8))->unk2) * 0.5f;
+ temp_hi = (s32) (temp_a3_4 + 1) % sp58;
+ sp88 = (f32) (temp_t0_2[(s16) ((s32) (temp_a3_4 + 6) % sp58)].wayPointY + temp_t0_2[(s16) ((s32) (temp_a3_4 + 5) % sp58)].wayPointY) * 0.5f;
sp2C = temp_t2_2;
- sp6C = (temp_a3_4 + 2) % sp58;
- sp6E = temp_hi;
- func_8000BBD8(temp_hi & 0xFFFF, *sp44, sp3E, temp_a3_4);
- temp_f14 = D_80162FA0.unk0 * 0.5;
- temp_f16 = D_80162FA0.unk8 * 0.5;
+ sp6C = (u16) ((s32) (temp_a3_4 + 2) % sp58);
+ sp6E = (s16) temp_hi;
+ func_8000BBD8((s16) temp_hi & 0xFFFF, *sp44, unksp3E, temp_a3_4);
+ temp_f14 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
+ temp_f16 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp98 = temp_f14;
sp90 = temp_f16;
- func_8000BBD8(sp6C, *sp44, sp3E);
+ func_8000BBD8(sp6C, *sp44, unksp3E);
temp_t0_3 = *sp2C;
temp_a0 = sp4C + &D_801645F8;
- temp_f10 = ((temp_t0_3 + (sp6C * 8))->unk2 + (temp_t0_3 + (temp_hi * 8))->unk2) * 0.5f;
+ temp_f10 = (f32) (temp_t0_3[(s16) sp6C].wayPointY + temp_t0_3[(s16) temp_hi].wayPointY) * 0.5f;
temp_a1_2 = sp4C + &D_80164618;
- temp_f18 = (temp_f14 + (D_80162FA0.unk0 * 0.5)) - *temp_a0;
+ temp_f18 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a0;
sp94 = temp_f10;
temp_f2_2 = temp_f10 - *temp_a1_2;
temp_a2 = sp4C + &D_80164638;
sp3C = temp_a2;
sp7C = temp_f2_2;
- temp_f8 = (temp_f16 + (D_80162FA0.unk8 * 0.5)) - *temp_a2;
+ temp_f8 = (f32) ((f64) temp_f16 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a2;
sp80 = temp_f18;
sp40 = temp_a1_2;
sp44 = temp_a0;
sp78 = temp_f8;
temp_f0 = sqrtf((temp_f18 * temp_f18) + (temp_f2_2 * temp_f2_2) + (temp_f8 * temp_f8));
- if (temp_f0 != 0.0) {
+ if ((f64) temp_f0 != 0.0) {
temp_f2_3 = *sp48;
+ var_f14 = ((temp_f2_3 * temp_f18) / temp_f0) + (bitwise f32) *temp_a0;
sp94 = ((temp_f2_3 * sp7C) / temp_f0) + *temp_a1_2;
- phi_f14 = ((temp_f2_3 * temp_f18) / temp_f0) + *temp_a0;
- phi_f16 = (bitwise s32 *) (((temp_f2_3 * sp78) / temp_f0) + *temp_a2);
+ var_f16 = ((temp_f2_3 * sp78) / temp_f0) + *temp_a2;
} else {
+ var_f14 = (bitwise f32) *temp_a0;
+ var_f16 = *temp_a2;
sp94 = *temp_a1_2;
- phi_f14 = *temp_a0;
- phi_f16 = (bitwise s32 *) *temp_a2;
}
- temp_f0_2 = phi_f14;
- if (!(temp_f0_2 < D_800ED270) && (D_800ED278 < temp_f0_2)) {
+ temp_f0_2 = (f64) var_f14;
+ if (!(temp_f0_2 < -10000.0) && (temp_f0_2 > 10000.0)) {
}
- arg0->unk0 = phi_f14;
- arg0->unk8 = phi_f16;
- arg0->unk4 = sp94 + 10.0;
- *temp_a0 = phi_f14;
- *temp_a2 = (bitwise f32) phi_f16;
+ camera->pos[0] = var_f14;
+ camera->pos[2] = var_f16;
+ camera->pos[1] = (f32) ((f64) sp94 + 10.0);
+ *temp_a0 = (bitwise s32) var_f14;
+ *temp_a2 = var_f16;
*temp_a1_2 = sp94;
- arg0->unkC = sp8C;
- arg0->unk14 = sp84;
- arg0->unk10 = sp88 + 8.0;
- func_80014D30(arg3, sp5C, temp_a2);
- temp_f12 = arg0->unkC - arg0->unk0;
- spA8 = arg0->unk10 - arg0->unk4;
+ camera->lookAt[0] = sp8C;
+ camera->lookAt[2] = sp84;
+ camera->lookAt[1] = (f32) ((f64) sp88 + 8.0);
+ func_80014D30(cameraId, sp5C, temp_a2);
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ spA8 = camera->lookAt[1] - camera->pos[1];
spAC = temp_f12;
- temp_f14_2 = arg0->unk14 - (bitwise f32) arg0->unk8;
+ temp_f14_2 = camera->lookAt[2] - camera->pos[2];
spA4 = temp_f14_2;
- arg0->unk26 = atan2s(temp_f12, temp_f14_2);
- arg0->unk24 = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14_2);
+ camera->rot[0] = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80017054.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(s32, f32, s16, s16); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(s32, f32, s16, s16); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
-extern ? gNearestWaypointByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
-extern ? gPlayers;
-void func_80017720(s32 arg0, ? arg1, s32 arg2, s16 arg3) {
+void func_80017720(s32 playerId, s32 arg1, s32 cameraId, s16 pathIndex) {
s32 sp1C;
s16 *sp18;
+ Camera *temp_v0;
f32 *temp_a0;
f32 *temp_a1;
f32 temp_f0;
@@ -9543,72 +9438,60 @@ void func_80017720(s32 arg0, ? arg1, s32 arg2, s16 arg3) {
s16 temp_a3;
s32 temp_t3;
s32 temp_t8;
- void *temp_v0;
- temp_a3 = arg3;
- temp_f0 = *(&D_80163068 + (arg0 * 4));
- temp_t8 = arg2 * 4;
- temp_t0 = (arg2 * 2) + &gNearestWaypointByCameraId;
+ temp_a3 = pathIndex;
+ temp_f0 = D_80163068[playerId];
+ temp_t8 = cameraId * 4;
+ temp_t0 = &gNearestWaypointByCameraId[cameraId];
*(&D_80164688 + temp_t8) = temp_f0;
- *temp_t0 = *(&gNearestWaypointByPlayerId + (arg0 * 2)) + 3;
- temp_t3 = *temp_t0 % *(&gWaypointCountByPathIndex + (temp_a3 * 2));
- *temp_t0 = temp_t3;
+ *temp_t0 = gNearestWaypointByPlayerId[playerId] + 3;
+ temp_t3 = (s16) *temp_t0 % (s32) gWaypointCountByPathIndex[temp_a3];
+ *temp_t0 = (s16) temp_t3;
temp_a2 = temp_a3;
sp18 = temp_t0;
sp1C = temp_t8;
- arg3 = temp_a3;
+ pathIndex = temp_a3;
func_8000BBD8(temp_t3 & 0xFFFF, temp_f0, temp_a2, temp_a3);
temp_f0_2 = D_80162FA0.unk0;
*(&D_801645F8 + temp_t8) = temp_f0_2;
temp_a0 = temp_t8 + &D_80164618;
temp_a1 = temp_t8 + &D_80164638;
- *temp_a0 = ((&D_80164550)[arg3] + (*temp_t0 * 8))->unk2;
+ *temp_a0 = (f32) D_80164550[pathIndex][*temp_t0].wayPointY;
*temp_a1 = D_80162FA0.unk8;
- temp_f2 = *(&gPlayers + 0x94 + (arg0 * 0xDD8));
+ temp_f2 = *(&gPlayers->unk_094 + (playerId * 0xDD8));
*(&D_80164658 + temp_t8) = temp_f2;
- temp_v0 = (arg2 * 0xB8) + &cameras;
+ temp_v0 = &cameras[cameraId];
*(&D_80164648 + temp_t8) = temp_f2;
- temp_v0->unk0 = temp_f0_2;
- temp_v0->unk4 = *temp_a0;
- temp_v0->unk8 = *temp_a1;
+ temp_v0->pos[0] = temp_f0_2;
+ temp_v0->pos[1] = *temp_a0;
+ temp_v0->pos[2] = *temp_a1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80017720.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe
-s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
? func_8000BBD8(u16, f32, s16, s32); /* extern */
-s16 func_8000D33C(f32, f32, f32 *, f32, s16, s32); /* extern */
? func_80014D30(s32, s32, f32 *, f32 *); /* extern */
? func_8001A348(s32, f32, s16); /* extern */
-s16 atan2s(f32, f32); /* extern */
-f32 sqrtf(f32, f32, f32 *, f32 *); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
extern s32 D_80163238;
-extern ? gNearestWaypointByPlayerId;
-extern ? D_80164550;
-extern ? gPathIndexByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_80164688;
-extern s32 gPlayerOne;
-void func_800178F4(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
+void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 sp9E;
s16 sp9C;
f32 sp94;
f32 sp90;
f32 sp8C;
- void *sp88;
+ Player *sp88;
f32 sp80;
f32 sp78;
f32 sp74;
@@ -9632,80 +9515,73 @@ void func_800178F4(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
f32 *temp_t6;
f32 *temp_v1;
f32 *temp_v1_2;
- f32 temp_f0_2;
+ f32 temp_f0;
f32 temp_f12;
f32 temp_f14;
f32 temp_f14_2;
- f32 temp_f14_3;
f32 temp_f16;
f32 temp_f16_2;
f32 temp_f16_3;
f32 temp_f2;
- f64 temp_f0;
+ f32 var_f14;
+ f32 var_f18;
+ f32 var_f2;
+ f64 var_f0;
s16 *temp_t1;
s16 temp_t1_2;
s16 temp_v0;
s16 temp_v0_2;
s32 temp_hi;
s32 temp_hi_2;
- s32 temp_t2;
s32 temp_t3;
s32 temp_t4;
- s32 temp_t8;
- s32 temp_v0_3;
+ struct TrackWayPoint *temp_v0_3;
u16 temp_ra;
- f64 phi_f0;
- f32 phi_f2;
- f32 phi_f14;
- f32 phi_f18;
- temp_v0 = arg0->unkAE;
- temp_t4 = arg3 * 4;
+ temp_v0 = camera->playerId;
+ temp_t4 = cameraId * 4;
temp_a1 = temp_t4 + &D_80164688;
temp_t6 = temp_t4 + &D_80164648;
sp3C = temp_t6;
temp_v1 = temp_t4 + &D_80164658;
- *temp_a1 = *(&D_80163068 + (temp_v0 * 4));
+ *temp_a1 = D_80163068[temp_v0];
temp_f16 = *temp_t6;
- temp_t2 = temp_v0 * 2;
temp_t3 = temp_v0 * 0xDD8;
*temp_t6 = temp_f16 + ((*temp_v1 - temp_f16) * 0.5f);
- temp_ra = *(&gPathIndexByPlayerId + temp_t2);
+ temp_ra = gPathIndexByPlayerId[temp_v0];
D_80163238 = (s32) temp_v0;
- sp4C = (s32) *(&gWaypointCountByPathIndex + (temp_ra * 2));
- temp_t8 = arg3 * 2;
- temp_t1 = temp_t8 + &gNearestWaypointByCameraId;
+ sp4C = (s32) gWaypointCountByPathIndex[temp_ra];
+ temp_t1 = &gNearestWaypointByCameraId[cameraId];
sp50 = (s32) temp_ra;
- sp88 = gPlayerOne + temp_t3;
+ sp88 = &gPlayerOne[temp_v0];
sp28 = temp_t1;
- sp2C = temp_t8;
+ sp2C = cameraId * 2;
sp44 = temp_t4;
sp30 = temp_t3;
- sp34 = temp_t2;
+ sp34 = temp_v0 * 2;
sp40 = temp_a1;
sp38 = temp_v1;
- *sp28 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t1, (s32) temp_ra);
+ *sp28 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t1, (s32) temp_ra);
temp_t1_2 = *sp28;
- temp_hi = (s32) (*(&gNearestWaypointByPlayerId + temp_t2) + 3) % sp4C;
+ temp_hi = (s32) (gNearestWaypointByPlayerId[temp_v0] + 3) % sp4C;
sp9C = (s16) temp_hi;
sp9E = temp_t1_2;
- if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 0xD, 1, sp4C) <= 0) {
+ if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 0x000DU, 1U, (u16) sp4C) <= 0) {
sp44 = temp_t4;
- func_8001A348(arg3, *sp40, *(&D_80164680 + sp2C));
+ func_8001A348(cameraId, *sp40, *(&D_80164680 + sp2C));
} else {
- if (((s32) temp_t1_2 < (s32) sp9C) && ((sp9C - temp_t1_2) < 3)) {
+ if ((temp_t1_2 < sp9C) && ((sp9C - temp_t1_2) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) + 0.1);
}
- if (((s32) sp9C < (s32) temp_t1_2) && ((temp_t1_2 - sp9C) < 3)) {
+ if ((sp9C < temp_t1_2) && ((temp_t1_2 - sp9C) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) - 0.1);
}
- temp_f0 = (f64) *temp_v1;
- phi_f0 = temp_f0;
- if (temp_f0 > 10.0) {
+ var_f0 = (f64) *temp_v1;
+ if (var_f0 > 10.0) {
*temp_v1 = 10.0f;
- phi_f0 = (f64) *temp_v1;
+ var_f0 = (f64) *temp_v1;
}
- if (phi_f0 < 0.0) {
+ if (var_f0 < 0.0) {
*temp_v1 = 0.0f;
}
}
@@ -9713,7 +9589,7 @@ void func_800178F4(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
temp_hi_2 = (s32) (temp_v0_2 + 1) % sp4C;
sp60 = (u16) ((s32) (temp_v0_2 + 2) % sp4C);
sp62 = (s16) temp_hi_2;
- sp44 = arg3 * 4;
+ sp44 = temp_t4;
sp38 = (f32 *) unksp52;
func_8000BBD8((s16) temp_hi_2 & 0xFFFF, *sp40, unksp52, sp4C);
temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
@@ -9721,72 +9597,66 @@ void func_800178F4(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
sp80 = temp_f2;
sp78 = temp_f14;
func_8000BBD8(sp60, *sp40, unksp52);
- temp_v0_3 = *(&D_80164550 + (sp50 * 4));
- temp_a2 = (arg3 * 4) + &D_80164618;
- temp_f14_2 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5));
- temp_v1_2 = (arg3 * 4) + &D_801645F8;
- temp_a3 = (arg3 * 4) + &D_80164638;
+ temp_v0_3 = D_80164550[sp50];
+ temp_a2 = temp_t4 + &D_80164618;
+ temp_v1_2 = temp_t4 + &D_801645F8;
+ temp_a3 = temp_t4 + &D_80164638;
temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_v1_2;
sp34 = temp_a3;
sp40 = temp_v1_2;
sp74 = temp_f16_2;
sp38 = temp_a2;
- sp70 = (f32) ((f64) ((temp_v0_3 + ((s16) sp60 * 8))->unk2 + (temp_v0_3 + (sp62 * 8))->unk2) * 0.5) - *temp_a2;
- sp6C = temp_f14_2 - *temp_a3;
- temp_f0_2 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C), temp_f14_2, temp_a2, temp_a3);
- if ((f64) temp_f0_2 != 0.0) {
+ sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].wayPointY + temp_v0_3[sp62].wayPointY) * 0.5) - *temp_a2;
+ sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3;
+ temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C));
+ if ((f64) temp_f0 != 0.0) {
temp_f16_3 = *sp3C;
- phi_f2 = ((temp_f16_3 * sp74) / temp_f0_2) + *temp_v1_2;
- phi_f14 = ((temp_f16_3 * sp6C) / temp_f0_2) + *temp_a3;
- phi_f18 = ((temp_f16_3 * sp70) / temp_f0_2) + *temp_a2;
+ var_f2 = ((temp_f16_3 * sp74) / temp_f0) + *temp_v1_2;
+ var_f18 = ((temp_f16_3 * sp70) / temp_f0) + *temp_a2;
+ var_f14 = ((temp_f16_3 * sp6C) / temp_f0) + *temp_a3;
} else {
- phi_f2 = *temp_v1_2;
- phi_f14 = *temp_a3;
- phi_f18 = *temp_a2;
- }
- arg0->unk0 = phi_f2;
- arg0->unk8 = phi_f14;
- arg0->unk4 = (f32) ((f64) phi_f18 + 10.0);
- *temp_v1_2 = phi_f2;
- *temp_a2 = phi_f18;
- *temp_a3 = phi_f14;
- arg0->unkC = (f32) sp88->unk14;
- arg0->unk10 = (f32) ((f64) sp88->unk18 + 6.0);
- arg0->unk14 = (f32) sp88->unk1C;
- func_80014D30(arg3, sp50, temp_a2, temp_a3);
- temp_f12 = arg0->unkC - arg0->unk0;
- sp90 = arg0->unk10 - arg0->unk4;
+ var_f2 = *temp_v1_2;
+ var_f18 = *temp_a2;
+ var_f14 = *temp_a3;
+ }
+ camera->pos[0] = var_f2;
+ camera->pos[2] = var_f14;
+ camera->pos[1] = (f32) ((f64) var_f18 + 10.0);
+ *temp_v1_2 = var_f2;
+ *temp_a2 = var_f18;
+ *temp_a3 = var_f14;
+ camera->lookAt[0] = sp88->pos[0];
+ camera->lookAt[1] = (f32) ((f64) sp88->pos[1] + 6.0);
+ camera->lookAt[2] = sp88->pos[2];
+ func_80014D30(cameraId, sp50, temp_a2, temp_a3);
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ sp90 = camera->lookAt[1] - camera->pos[1];
sp94 = temp_f12;
- temp_f14_3 = arg0->unk14 - arg0->unk8;
- sp8C = temp_f14_3;
- arg0->unk26 = atan2s(temp_f12, temp_f14_3);
- arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
- arg0->unk28 = 0;
+ temp_f14_2 = camera->lookAt[2] - camera->pos[2];
+ sp8C = temp_f14_2;
+ camera->rot[1] = atan2s(temp_f12, temp_f14_2);
+ camera->rot[0] = atan2s(sqrtf((sp94 * sp94) + (temp_f14_2 * temp_f14_2)), sp90);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800178F4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(s32, f32, s16, s16); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(s32, f32, s16, s16); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
-extern ? gNearestWaypointByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
-extern ? gPlayers;
-void func_80017F10(s32 arg0, ? arg1, s32 arg2, s16 arg3) {
+void func_80017F10(s32 playerId, s32 arg1, s32 cameraId, s16 pathIndex) {
s32 sp1C;
s16 *sp18;
+ Camera *temp_v0_2;
f32 *temp_a0;
f32 *temp_a1;
f32 temp_f0;
@@ -9798,67 +9668,55 @@ void func_80017F10(s32 arg0, ? arg1, s32 arg2, s16 arg3) {
s32 temp_t3;
s32 temp_t9;
u16 temp_v0;
- void *temp_v0_2;
- temp_a3 = arg3;
- temp_v0 = *(&gWaypointCountByPathIndex + (arg3 * 2));
- temp_f0 = *(&D_80163068 + (arg0 * 4));
- temp_t9 = arg2 * 4;
- temp_t0 = (arg2 * 2) + &gNearestWaypointByCameraId;
+ temp_a3 = pathIndex;
+ temp_v0 = gWaypointCountByPathIndex[pathIndex];
+ temp_f0 = D_80163068[playerId];
+ temp_t9 = cameraId * 4;
+ temp_t0 = &gNearestWaypointByCameraId[cameraId];
*(&D_80164688 + temp_t9) = temp_f0;
- *temp_t0 = (*(&gNearestWaypointByPlayerId + (arg0 * 2)) + temp_v0) - 2;
- temp_t3 = *temp_t0 % temp_v0;
- *temp_t0 = temp_t3;
+ *temp_t0 = (gNearestWaypointByPlayerId[playerId] + temp_v0) - 2;
+ temp_t3 = (s16) *temp_t0 % (s32) temp_v0;
+ *temp_t0 = (s16) temp_t3;
temp_a2 = temp_a3;
sp18 = temp_t0;
sp1C = temp_t9;
- arg3 = temp_a3;
+ pathIndex = temp_a3;
func_8000BBD8(temp_t3 & 0xFFFF, temp_f0, temp_a2, temp_a3);
temp_f0_2 = D_80162FA0.unk0;
*(&D_801645F8 + temp_t9) = temp_f0_2;
temp_a0 = temp_t9 + &D_80164618;
temp_a1 = temp_t9 + &D_80164638;
- *temp_a0 = ((&D_80164550)[arg3] + (*temp_t0 * 8))->unk2;
+ *temp_a0 = (f32) D_80164550[pathIndex][*temp_t0].wayPointY;
*temp_a1 = D_80162FA0.unk8;
- temp_f2 = *(&gPlayers + 0x94 + (arg0 * 0xDD8));
+ temp_f2 = *(&gPlayers->unk_094 + (playerId * 0xDD8));
*(&D_80164658 + temp_t9) = temp_f2;
- temp_v0_2 = (arg2 * 0xB8) + &cameras;
+ temp_v0_2 = &cameras[cameraId];
*(&D_80164648 + temp_t9) = temp_f2;
- temp_v0_2->unk0 = temp_f0_2;
- temp_v0_2->unk4 = *temp_a0;
- temp_v0_2->unk8 = *temp_a1;
+ temp_v0_2->pos[0] = temp_f0_2;
+ temp_v0_2->pos[1] = *temp_a0;
+ temp_v0_2->pos[2] = *temp_a1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80017F10.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe
-s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
? func_8000BBD8(u16, f32, s16); /* extern */
-s16 func_8000D33C(f32, f32, f32 *, f32, s16, s32); /* extern */
? func_80014D30(s32, s32, f32 *, f32 *); /* extern */
? func_8001A348(s32, f32, s16); /* extern */
-s16 atan2s(f32, f32); /* extern */
-f32 sqrtf(f32, f32, f32 *, f32 *); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
extern s32 D_80163238;
-extern ? gNearestWaypointByPlayerId;
-extern ? D_80164550;
-extern ? gPathIndexByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_80164688;
-extern s32 gPlayerOne;
-void func_800180F0(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
+void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 sp9E;
s16 sp9C;
f32 sp94;
@@ -9881,100 +9739,91 @@ void func_800180F0(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
s32 sp30;
s32 sp2C;
s16 *sp28;
+ Player *temp_s1;
f32 *temp_a1;
f32 *temp_a2;
f32 *temp_a3;
f32 *temp_t6;
f32 *temp_v1;
f32 *temp_v1_2;
- f32 temp_f0_2;
+ f32 temp_f0;
f32 temp_f12;
f32 temp_f14;
f32 temp_f14_2;
- f32 temp_f14_3;
f32 temp_f16;
f32 temp_f16_2;
f32 temp_f16_3;
f32 temp_f2;
- f64 temp_f0;
+ f32 var_f14;
+ f32 var_f18;
+ f32 var_f2;
+ f64 var_f0;
s16 *temp_t1;
s16 temp_t1_2;
s16 temp_v0;
s16 temp_v0_2;
s32 temp_hi;
s32 temp_hi_2;
- s32 temp_t2;
s32 temp_t3;
s32 temp_t5;
- s32 temp_t6_2;
- s32 temp_v0_3;
- u16 *temp_t4;
+ struct TrackWayPoint *temp_v0_3;
u16 temp_ra;
- u16 temp_t4_2;
- void *temp_s1;
- f64 phi_f0;
- f32 phi_f2;
- f32 phi_f14;
- f32 phi_f18;
+ u16 temp_t4;
- temp_v0 = arg0->unkAE;
- temp_t5 = arg3 * 4;
+ temp_v0 = camera->playerId;
+ temp_t5 = cameraId * 4;
temp_a1 = temp_t5 + &D_80164688;
temp_t6 = temp_t5 + &D_80164648;
sp3C = temp_t6;
temp_v1 = temp_t5 + &D_80164658;
- *temp_a1 = *(&D_80163068 + (temp_v0 * 4));
+ *temp_a1 = D_80163068[temp_v0];
temp_f16 = *temp_t6;
- temp_t2 = temp_v0 * 2;
*temp_t6 = temp_f16 + ((*temp_v1 - temp_f16) * 0.5f);
D_80163238 = (s32) temp_v0;
- temp_ra = *(&gPathIndexByPlayerId + temp_t2);
- temp_t4 = &gWaypointCountByPathIndex + (temp_ra * 2);
- temp_t4_2 = *temp_t4;
- temp_t6_2 = arg3 * 2;
+ temp_ra = gPathIndexByPlayerId[temp_v0];
+ temp_t4 = gWaypointCountByPathIndex[temp_ra];
temp_t3 = temp_v0 * 0xDD8;
- temp_t1 = temp_t6_2 + &gNearestWaypointByCameraId;
+ temp_t1 = &gNearestWaypointByCameraId[cameraId];
sp50 = (s32) temp_ra;
sp28 = temp_t1;
sp30 = temp_t3;
- sp2C = temp_t6_2;
+ sp2C = cameraId * 2;
sp44 = temp_t5;
- sp34 = temp_t2;
+ sp34 = temp_v0 * 2;
sp40 = temp_a1;
sp38 = temp_v1;
- temp_s1 = gPlayerOne + temp_t3;
- sp4C = (s32) temp_t4_2;
- *sp28 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t1, (s32) temp_ra);
+ temp_s1 = &gPlayerOne[temp_v0];
+ sp4C = (s32) temp_t4;
+ *sp28 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t1, (s32) temp_ra);
temp_t1_2 = *sp28;
- temp_hi = (s32) ((*(&gNearestWaypointByPlayerId + temp_t2) + temp_t4_2) - 2) % (s32) temp_t4_2;
+ temp_hi = (s32) ((gNearestWaypointByPlayerId[temp_v0] + temp_t4) - 2) % (s32) temp_t4;
sp9C = (s16) temp_hi;
sp9E = temp_t1_2;
- if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 1, 0xA, (s32) temp_t4_2) <= 0) {
+ if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 1U, 0x000AU, (u16) (s32) temp_t4) <= 0) {
sp44 = temp_t5;
- sp4C = (s32) temp_t4_2;
- func_8001A348(arg3, *sp40, *(&D_80164680 + sp2C));
+ sp4C = (s32) temp_t4;
+ func_8001A348(cameraId, *sp40, *(&D_80164680 + sp2C));
} else {
- if (((s32) temp_t1_2 < (s32) sp9C) && ((sp9C - temp_t1_2) < 3)) {
+ if ((temp_t1_2 < sp9C) && ((sp9C - temp_t1_2) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) + 0.1);
}
- if (((s32) sp9C < (s32) temp_t1_2) && ((temp_t1_2 - sp9C) < 3)) {
+ if ((sp9C < temp_t1_2) && ((temp_t1_2 - sp9C) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) - 0.1);
}
- temp_f0 = (f64) *temp_v1;
- phi_f0 = temp_f0;
- if (temp_f0 > 10.0) {
+ var_f0 = (f64) *temp_v1;
+ if (var_f0 > 10.0) {
*temp_v1 = 10.0f;
- phi_f0 = (f64) *temp_v1;
+ var_f0 = (f64) *temp_v1;
}
- if (phi_f0 < 0.0) {
+ if (var_f0 < 0.0) {
*temp_v1 = 0.0f;
}
}
temp_v0_2 = *sp28;
- temp_hi_2 = (s32) (temp_v0_2 + 1) % (s32) *temp_t4;
- sp60 = (u16) ((s32) (temp_v0_2 + 2) % (s32) *temp_t4);
+ temp_hi_2 = (s32) (temp_v0_2 + 1) % (s32) temp_t4;
+ sp60 = (u16) ((s32) (temp_v0_2 + 2) % (s32) temp_t4);
sp62 = (s16) temp_hi_2;
- sp44 = arg3 * 4;
+ sp44 = temp_t5;
sp38 = (f32 *) unksp52;
func_8000BBD8((s16) temp_hi_2 & 0xFFFF, *sp40, unksp52);
temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
@@ -9982,73 +9831,67 @@ void func_800180F0(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
sp80 = temp_f2;
sp78 = temp_f14;
func_8000BBD8(sp60, *sp40, unksp52);
- temp_v0_3 = *(&D_80164550 + (sp50 * 4));
- temp_a2 = (arg3 * 4) + &D_80164618;
- temp_f14_2 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5));
- temp_v1_2 = (arg3 * 4) + &D_801645F8;
- temp_a3 = (arg3 * 4) + &D_80164638;
+ temp_v0_3 = D_80164550[sp50];
+ temp_a2 = temp_t5 + &D_80164618;
+ temp_v1_2 = temp_t5 + &D_801645F8;
+ temp_a3 = temp_t5 + &D_80164638;
temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_v1_2;
sp34 = temp_a3;
sp40 = temp_v1_2;
sp74 = temp_f16_2;
sp38 = temp_a2;
- sp70 = (f32) ((f64) ((temp_v0_3 + ((s16) sp60 * 8))->unk2 + (temp_v0_3 + (sp62 * 8))->unk2) * 0.5) - *temp_a2;
- sp6C = temp_f14_2 - *temp_a3;
- temp_f0_2 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C), temp_f14_2, temp_a2, temp_a3);
- if ((f64) temp_f0_2 != 0.0) {
+ sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].wayPointY + temp_v0_3[sp62].wayPointY) * 0.5) - *temp_a2;
+ sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3;
+ temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C));
+ if ((f64) temp_f0 != 0.0) {
temp_f16_3 = *sp3C;
- phi_f2 = ((temp_f16_3 * sp74) / temp_f0_2) + *temp_v1_2;
- phi_f14 = ((temp_f16_3 * sp6C) / temp_f0_2) + *temp_a3;
- phi_f18 = ((temp_f16_3 * sp70) / temp_f0_2) + *temp_a2;
+ var_f2 = ((temp_f16_3 * sp74) / temp_f0) + *temp_v1_2;
+ var_f18 = ((temp_f16_3 * sp70) / temp_f0) + *temp_a2;
+ var_f14 = ((temp_f16_3 * sp6C) / temp_f0) + *temp_a3;
} else {
- phi_f2 = *temp_v1_2;
- phi_f14 = *temp_a3;
- phi_f18 = *temp_a2;
- }
- arg0->unk0 = phi_f2;
- arg0->unk8 = phi_f14;
- arg0->unk4 = (f32) ((f64) temp_s1->unk18 + 10.0);
- *temp_v1_2 = phi_f2;
- *temp_a2 = phi_f18;
- *temp_a3 = phi_f14;
- arg0->unkC = (f32) temp_s1->unk14;
- arg0->unk10 = (f32) ((f64) temp_s1->unk18 + 6.0);
- arg0->unk14 = (f32) temp_s1->unk1C;
- func_80014D30(arg3, sp50, temp_a2, temp_a3);
- temp_f12 = arg0->unkC - arg0->unk0;
- sp90 = arg0->unk10 - arg0->unk4;
+ var_f2 = *temp_v1_2;
+ var_f18 = *temp_a2;
+ var_f14 = *temp_a3;
+ }
+ camera->pos[0] = var_f2;
+ camera->pos[2] = var_f14;
+ camera->pos[1] = (f32) ((f64) temp_s1->pos[1] + 10.0);
+ *temp_v1_2 = var_f2;
+ *temp_a2 = var_f18;
+ *temp_a3 = var_f14;
+ camera->lookAt[0] = temp_s1->pos[0];
+ camera->lookAt[1] = (f32) ((f64) temp_s1->pos[1] + 6.0);
+ camera->lookAt[2] = temp_s1->pos[2];
+ func_80014D30(cameraId, sp50, temp_a2, temp_a3);
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ sp90 = camera->lookAt[1] - camera->pos[1];
sp94 = temp_f12;
- temp_f14_3 = arg0->unk14 - arg0->unk8;
- sp8C = temp_f14_3;
- arg0->unk26 = atan2s(temp_f12, temp_f14_3);
- arg0->unk24 = atan2s(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
- arg0->unk28 = 0;
+ temp_f14_2 = camera->lookAt[2] - camera->pos[2];
+ sp8C = temp_f14_2;
+ camera->rot[1] = atan2s(temp_f12, temp_f14_2);
+ camera->rot[0] = atan2s(sqrtf((sp94 * sp94) + (temp_f14_2 * temp_f14_2)), sp90);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800180F0.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BA14(s32, f32, ?, s16); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BA14(s32, f32, ?, s16); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
-extern ? gNearestWaypointByPlayerId;
extern s32 D_8016448C;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
-extern ? gPlayers;
-void func_80018718(s32 arg0, ? arg1, s32 arg2, s16 arg3) {
+void func_80018718(s32 playerId, s32 arg1, s32 cameraId, s16 pathIndex) {
s32 sp1C;
s16 *sp18;
+ Camera *temp_v0_2;
f32 *temp_a0;
f32 *temp_a1;
f32 temp_f0;
@@ -10059,77 +9902,54 @@ void func_80018718(s32 arg0, ? arg1, s32 arg2, s16 arg3) {
s32 temp_hi;
s32 temp_t9;
u16 temp_v0;
- void *temp_v0_2;
- temp_a3 = arg3;
- temp_v0 = *(&gWaypointCountByPathIndex + (arg3 * 2));
- temp_f0 = *(&D_80163068 + (arg0 * 4));
- temp_t9 = arg2 * 4;
- temp_hi = ((*(&gNearestWaypointByPlayerId + (arg0 * 2)) + temp_v0) - 5) % temp_v0;
+ temp_a3 = pathIndex;
+ temp_v0 = gWaypointCountByPathIndex[pathIndex];
+ temp_f0 = D_80163068[playerId];
+ temp_t9 = cameraId * 4;
+ temp_hi = (s32) ((gNearestWaypointByPlayerId[playerId] + temp_v0) - 5) % (s32) temp_v0;
*(&D_80164688 + temp_t9) = temp_f0;
- temp_t0 = (arg2 * 2) + &gNearestWaypointByCameraId;
- *temp_t0 = temp_hi;
+ temp_t0 = &gNearestWaypointByCameraId[cameraId];
+ *temp_t0 = (s16) temp_hi;
sp18 = temp_t0;
sp1C = temp_t9;
- arg3 = temp_a3;
+ pathIndex = temp_a3;
func_8000BA14(temp_hi & 0xFFFF, temp_f0, 0x42700000, temp_a3);
temp_f0_2 = D_80162FA0.unk0;
*(&D_801645F8 + temp_t9) = temp_f0_2;
temp_a0 = temp_t9 + &D_80164618;
temp_a1 = temp_t9 + &D_80164638;
- *temp_a0 = ((&D_80164550)[arg3] + (*temp_t0 * 8))->unk2;
+ *temp_a0 = (f32) D_80164550[pathIndex][*temp_t0].wayPointY;
*temp_a1 = D_80162FA0.unk8;
- temp_f2 = *(&gPlayers + 0x94 + (arg0 * 0xDD8));
+ temp_f2 = *(&gPlayers->unk_094 + (playerId * 0xDD8));
*(&D_80164658 + temp_t9) = temp_f2;
*(&D_80164648 + temp_t9) = temp_f2;
D_8016448C = 1;
- temp_v0_2 = (arg2 * 0xB8) + &cameras;
- temp_v0_2->unk0 = temp_f0_2;
- temp_v0_2->unk4 = *temp_a0;
- temp_v0_2->unk8 = *temp_a1;
+ temp_v0_2 = &cameras[cameraId];
+ temp_v0_2->pos[0] = temp_f0_2;
+ temp_v0_2->pos[1] = *temp_a0;
+ temp_v0_2->pos[2] = *temp_a1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80018718.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
-? func_8000BA14(u16, f32, ?, s16); // extern
-s16 func_8000D33C(f32, f32, s16, f32, s32, s32); // extern
-? func_80014D30(s32, s32); // extern
-? func_8001A348(s32, f32, s16); // extern
-s16 atan2s(f32, f32); // extern
-extern f64 D_800ED2A8;
-extern f64 D_800ED2B0;
-extern f64 D_800ED2B8;
-extern f64 D_800ED2C0;
-extern f32 D_800ED2C8;
-extern f64 D_800ED2D0;
-extern f64 D_800ED2D8;
-extern f64 D_800ED2E0;
-extern f64 D_800ED2E8;
-extern f64 D_800ED2F0;
-extern f32 D_800ED2F8;
-extern f64 D_800ED300;
-extern f64 D_800ED308;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BA14(u16, f32, ?, s16); /* extern */
+? func_80014D30(s32, s32); /* extern */
+? func_8001A348(s32, f32, s16); /* extern */
extern ? D_80162FA0;
-extern ? D_80163068;
extern s32 D_80163238;
-extern ? gNearestWaypointByPlayerId;
extern s32 D_8016448C;
-extern ? gPathIndexByPlayerId;
-extern ? gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_80164688;
-extern ? gPlayers;
-void func_800188F4(void *arg0, ? arg1, ? arg2, s32 arg3) {
+void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 spAC;
f32 spA8;
f32 spA4;
@@ -10158,10 +9978,9 @@ void func_800188F4(void *arg0, ? arg1, ? arg2, s32 arg3) {
f32 *temp_t1;
f32 *temp_t5;
f32 *temp_v1;
- f32 *temp_v1_2;
- f32 *temp_v1_3;
- f32 temp_f0_3;
- f32 temp_f0_4;
+ f32 *var_v1;
+ f32 temp_f0;
+ f32 temp_f0_2;
f32 temp_f10;
f32 temp_f10_2;
f32 temp_f12;
@@ -10171,221 +9990,197 @@ void func_800188F4(void *arg0, ? arg1, ? arg2, s32 arg3) {
f32 temp_f16;
f32 temp_f18;
f32 temp_f2_3;
- f64 temp_f0;
- f64 temp_f0_2;
+ f32 var_f18;
f64 temp_f16_2;
f64 temp_f2;
f64 temp_f2_2;
f64 temp_f2_4;
- s16 *temp_t3;
- s16 *temp_t3_2;
- s16 *temp_v0_2;
+ f64 var_f0;
+ f64 var_f0_2;
+ s16 *var_t3;
s16 temp_a1;
s16 temp_a3;
s16 temp_t0;
s16 temp_t0_2;
s32 temp_hi;
s32 temp_t4;
- s32 temp_t9;
- s32 temp_t9_2;
- s32 temp_v0;
- u16 *temp_t2;
+ s32 var_ra;
+ struct TrackWayPoint *temp_v0;
u16 *temp_t8;
u16 *temp_t8_2;
- u16 temp_t2_2;
+ u16 temp_t2;
u16 temp_t7;
- f64 phi_f0;
- f64 phi_f0_2;
- s32 phi_ra;
- s16 *phi_t3;
- f32 *phi_v1;
- f32 phi_f18;
spA0 = gPlayerOne;
- temp_a1 = arg0->unkAE;
- temp_v0 = temp_a1 * 2;
- temp_t7 = *(&gPathIndexByPlayerId + temp_v0);
- sp68 = temp_t7;
- temp_f12 = *(&gPlayers + 0x94 + (temp_a1 * 0xDD8));
- temp_t2 = &gWaypointCountByPathIndex + (temp_t7 * 2);
- temp_t4 = arg3 * 4;
- temp_t2_2 = *temp_t2;
+ temp_a1 = camera->playerId;
+ temp_t7 = gPathIndexByPlayerId[temp_a1];
+ sp68 = (s32) temp_t7;
+ temp_f12 = *(&gPlayers->unk_094 + (temp_a1 * 0xDD8));
+ temp_t4 = cameraId * 4;
+ temp_t2 = gWaypointCountByPathIndex[temp_t7];
temp_t5 = temp_t4 + &D_80164648;
*temp_t5 = temp_f12;
if (D_8016448C == 0) {
- temp_t8 = temp_v0 + &gNearestWaypointByPlayerId;
- temp_t9 = arg3 * 2;
- temp_t3 = temp_t9 + &gNearestWaypointByCameraId;
+ temp_t8 = &gNearestWaypointByPlayerId[temp_a1];
+ var_t3 = &gNearestWaypointByCameraId[cameraId];
sp3C = temp_t8;
- temp_a3 = *temp_t3;
- phi_ra = temp_t9;
- phi_t3 = temp_t3;
- if (temp_a3 == (((*temp_t8 + temp_t2_2) - 6) % temp_t2_2)) {
+ var_ra = cameraId * 2;
+ temp_a3 = *var_t3;
+ if (temp_a3 == ((s32) ((*temp_t8 + temp_t2) - 6) % (s32) temp_t2)) {
D_8016448C = 1;
}
- temp_f2 = *(&D_80163068 + (temp_a1 * 4));
- temp_v1 = temp_t4 + &D_80164688;
- temp_f0 = *temp_v1;
- phi_f0 = temp_f0;
- phi_v1 = temp_v1;
- if (temp_f0 < (temp_f2 - D_800ED2A8)) {
- *temp_t5 = temp_f12 * D_800ED2B0;
+ temp_f2 = (f64) D_80163068[temp_a1];
+ var_v1 = temp_t4 + &D_80164688;
+ var_f0 = (f64) *var_v1;
+ if (var_f0 < (temp_f2 - 0.2)) {
+ *temp_t5 = (f32) ((f64) temp_f12 * 0.7);
}
- if ((temp_f2 - 0.5) < temp_f0) {
- *temp_v1 = temp_f0 - D_800ED2B8;
- phi_f0 = *temp_v1;
+ if ((temp_f2 - 0.5) < var_f0) {
+ *var_v1 = (f32) (var_f0 - 0.01);
+ var_f0 = (f64) *var_v1;
}
- if (phi_f0 < D_800ED2C0) {
- *temp_v1 = D_800ED2C8;
- *temp_t5 = temp_f12 * D_800ED2D0;
+ if (var_f0 < -0.9) {
+ *var_v1 = -0.9f;
+ *temp_t5 = (f32) ((f64) temp_f12 * 0.8);
}
- sp40 = temp_a3;
+ sp40 = (s32) temp_a3;
} else {
- temp_t8_2 = temp_v0 + &gNearestWaypointByPlayerId;
- temp_t9_2 = arg3 * 2;
- temp_t3_2 = temp_t9_2 + &gNearestWaypointByCameraId;
+ temp_t8_2 = &gNearestWaypointByPlayerId[temp_a1];
+ var_t3 = &gNearestWaypointByCameraId[cameraId];
sp3C = temp_t8_2;
- temp_t0 = *temp_t3_2;
- phi_ra = temp_t9_2;
- phi_t3 = temp_t3_2;
- if (temp_t0 == ((*temp_t8_2 + 6) % temp_t2_2)) {
+ temp_t0 = *var_t3;
+ var_ra = cameraId * 2;
+ if (temp_t0 == ((s32) (*temp_t8_2 + 6) % (s32) temp_t2)) {
D_8016448C = 0;
}
- temp_f2_2 = *(&D_80163068 + (temp_a1 * 4));
- temp_v1_2 = temp_t4 + &D_80164688;
- temp_f0_2 = *temp_v1_2;
- phi_f0_2 = temp_f0_2;
- phi_v1 = temp_v1_2;
- if ((temp_f2_2 + D_800ED2D8) < temp_f0_2) {
- *temp_t5 = temp_f12 * D_800ED2E0;
+ temp_f2_2 = (f64) D_80163068[temp_a1];
+ var_v1 = temp_t4 + &D_80164688;
+ var_f0_2 = (f64) *var_v1;
+ if ((temp_f2_2 + 0.2) < var_f0_2) {
+ *temp_t5 = (f32) ((f64) temp_f12 * 1.3);
}
- if (temp_f0_2 < (temp_f2_2 + 0.5)) {
- *temp_v1_2 = temp_f0_2 + D_800ED2E8;
- phi_f0_2 = *temp_v1_2;
+ if (var_f0_2 < (temp_f2_2 + 0.5)) {
+ *var_v1 = (f32) (var_f0_2 + 0.01);
+ var_f0_2 = (f64) *var_v1;
}
- sp40 = temp_t0;
- if (D_800ED2F0 < phi_f0_2) {
- *temp_v1_2 = D_800ED2F8;
- sp40 = temp_t0;
- *temp_t5 = temp_f12 * D_800ED300;
+ sp40 = (s32) temp_t0;
+ if (var_f0_2 > 0.9) {
+ *var_v1 = 0.9f;
+ sp40 = (s32) temp_t0;
+ *temp_t5 = (f32) ((f64) temp_f12 * 1.2);
}
}
- D_80163238 = temp_a1;
+ D_80163238 = (s32) temp_a1;
spA0 = &spA0[temp_a1];
- sp48 = phi_ra;
+ sp48 = var_ra;
sp54 = temp_t5;
sp58 = temp_t4;
- sp44 = phi_t3;
- sp64 = temp_t2_2;
- sp5C = phi_v1;
- *phi_t3 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, sp40, sp68);
- if (func_80007BF8(*sp3C & 0xFFFF, *phi_t3 & 0xFFFF, 0xF, 0xF, temp_t2_2) <= 0) {
- sp5C = phi_v1;
- sp64 = temp_t2_2;
- sp44 = phi_t3;
+ sp44 = var_t3;
+ sp64 = (s32) temp_t2;
+ sp5C = var_v1;
+ *var_t3 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], (s16) sp40, sp68);
+ if (func_80007BF8((s16) *sp3C & 0xFFFF, *var_t3 & 0xFFFF, 0x000FU, 0x000FU, (u16) (s32) temp_t2) <= 0) {
+ sp5C = var_v1;
+ sp64 = (s32) temp_t2;
+ sp44 = var_t3;
sp58 = temp_t4;
sp54 = temp_t5;
- func_8001A348(arg3, *phi_v1, *(&D_80164680 + phi_ra));
- }
- temp_t0_2 = *phi_t3;
- temp_hi = (temp_t0_2 + 1) % *temp_t2;
- sp78 = (temp_t0_2 + 2) % *temp_t2;
- sp7A = temp_hi;
- sp5C = phi_v1;
- sp58 = arg3 * 4;
- sp54 = temp_t4 + &D_80164648;
- sp50 = sp6A;
- func_8000BA14(temp_hi & 0xFFFF, *phi_v1, 0x42700000, sp6A);
- temp_f10 = D_80162FA0.unk0 * 0.5;
+ func_8001A348(cameraId, *var_v1, *(&D_80164680 + var_ra));
+ }
+ temp_t0_2 = *var_t3;
+ temp_hi = (s32) (temp_t0_2 + 1) % (s32) temp_t2;
+ sp78 = (u16) ((s32) (temp_t0_2 + 2) % (s32) temp_t2);
+ sp7A = (s16) temp_hi;
+ sp5C = var_v1;
+ sp58 = temp_t4;
+ sp54 = temp_t5;
+ sp50 = (f32 *) unksp6A;
+ func_8000BA14((s16) temp_hi & 0xFFFF, *var_v1, 0x42700000, unksp6A);
+ temp_f10 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
sp98 = temp_f10;
- temp_f18 = D_80162FA0.unk8 * 0.5;
+ temp_f18 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp90 = temp_f18;
- func_8000BA14(sp78, *phi_v1, 0x42700000, sp6A);
- temp_v0_2 = (&D_80164550)[sp68];
- temp_f10_2 = temp_f10 + (D_80162FA0.unk0 * 0.5);
+ func_8000BA14(sp78, *var_v1, 0x42700000, unksp6A);
+ temp_v0 = D_80164550[sp68];
+ temp_f10_2 = (f32) ((f64) temp_f10 + ((f64) D_80162FA0.unk0 * 0.5));
sp98 = temp_f10_2;
- temp_v1_3 = (arg3 * 4) + &D_801645F8;
- temp_a3_2 = (arg3 * 4) + &D_80164618;
- temp_f14 = temp_f10_2 - *temp_v1_3;
- temp_t1 = (arg3 * 4) + &D_80164638;
+ temp_v1 = temp_t4 + &D_801645F8;
+ temp_a3_2 = temp_t4 + &D_80164618;
+ temp_f14 = temp_f10_2 - *temp_v1;
+ temp_t1 = temp_t4 + &D_80164638;
sp4C = temp_t1;
sp8C = temp_f14;
sp50 = temp_a3_2;
- sp5C = temp_v1_3;
- temp_f16 = (((temp_v0_2 + (sp78 * 8))->unk2 + (temp_v0_2 + (sp7A * 8))->unk2) * 0.5) - *temp_a3_2;
- temp_f0_3 = (temp_f18 + (D_80162FA0.unk8 * 0.5)) - *temp_t1;
+ sp5C = temp_v1;
+ temp_f16 = (f32) ((f64) (temp_v0[(s16) sp78].wayPointY + temp_v0[sp7A].wayPointY) * 0.5) - *temp_a3_2;
+ temp_f0 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1;
sp88 = temp_f16;
- sp84 = temp_f0_3;
- temp_f0_4 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f0_3 * temp_f0_3));
- if (temp_f0_4 != 0.0) {
- temp_f2_3 = *(temp_t4 + &D_80164648);
- sp98 = ((temp_f2_3 * temp_f14) / temp_f0_4) + *temp_v1_3;
- sp94 = ((temp_f2_3 * temp_f16) / temp_f0_4) + *temp_a3_2;
- phi_f18 = ((temp_f2_3 * sp84) / temp_f0_4) + *temp_t1;
+ sp84 = temp_f0;
+ temp_f0_2 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f0 * temp_f0));
+ if ((f64) temp_f0_2 != 0.0) {
+ temp_f2_3 = *temp_t5;
+ sp98 = ((temp_f2_3 * temp_f14) / temp_f0_2) + *temp_v1;
+ sp94 = ((temp_f2_3 * temp_f16) / temp_f0_2) + *temp_a3_2;
+ var_f18 = ((temp_f2_3 * sp84) / temp_f0_2) + *temp_t1;
} else {
- sp98 = *temp_v1_3;
+ var_f18 = *temp_t1;
+ sp98 = *temp_v1;
sp94 = *temp_a3_2;
- phi_f18 = *temp_t1;
}
- arg0->unk8 = phi_f18;
- arg0->unk0 = sp98;
- temp_f16_2 = sp94;
+ camera->pos[2] = var_f18;
+ camera->pos[0] = sp98;
+ temp_f16_2 = (f64) sp94;
sp28 = temp_f16_2;
- sp90 = phi_f18;
+ sp90 = var_f18;
sp4C = temp_t1;
sp50 = temp_a3_2;
- sp5C = temp_v1_3;
- temp_f2_4 = func_802AE1C0(sp98, temp_f16_2 + 30.0, phi_f18);
- if ((temp_f2_4 < (temp_f16_2 - 20.0)) || (D_800ED308 <= temp_f2_4)) {
- arg0->unk4 = temp_f16_2 + 10.0;
+ sp5C = temp_v1;
+ temp_f2_4 = (f64) func_802AE1C0(sp98, (f32) (temp_f16_2 + 30.0), var_f18);
+ if ((temp_f2_4 < (temp_f16_2 - 20.0)) || (temp_f2_4 >= 3000.0)) {
+ camera->pos[1] = (f32) (temp_f16_2 + 10.0);
} else {
- arg0->unk4 = temp_f2_4 + 8.0;
+ camera->pos[1] = (f32) (temp_f2_4 + 8.0);
}
- *temp_t1 = phi_f18;
- *temp_v1_3 = sp98;
+ *temp_t1 = var_f18;
+ *temp_v1 = sp98;
*temp_a3_2 = sp94;
- arg0->unkC = spA0->posX;
- arg0->unk10 = spA0->posY + 6.0;
- arg0->unk14 = spA0->posZ;
- func_80014D30(arg3, sp68);
- temp_f12_2 = arg0->unkC - arg0->unk0;
- spA8 = arg0->unk10 - arg0->unk4;
+ camera->lookAt[0] = spA0->pos[0];
+ camera->lookAt[1] = (f32) ((f64) spA0->pos[1] + 6.0);
+ camera->lookAt[2] = spA0->pos[2];
+ func_80014D30(cameraId, sp68);
+ temp_f12_2 = camera->lookAt[0] - camera->pos[0];
+ spA8 = camera->lookAt[1] - camera->pos[1];
spAC = temp_f12_2;
- temp_f14_2 = arg0->unk14 - arg0->unk8;
+ temp_f14_2 = camera->lookAt[2] - camera->pos[2];
spA4 = temp_f14_2;
- arg0->unk26 = atan2s(temp_f12_2, temp_f14_2);
- arg0->unk24 = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12_2, temp_f14_2);
+ camera->rot[0] = atan2s(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2)), spA8);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800188F4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8000BBD8(f32, s32, f32, ?, s32); // extern
-extern f64 D_800ED310;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000BBD8(f32, s32, f32, ?, s32); /* extern */
extern ? D_80162FA0;
-extern ? gNearestWaypointByPlayerId;
-extern u16 gWaypointCountByPathIndex;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164688;
-extern ? cameras;
-void func_80019118(s32 arg0, f32 arg1, s32 arg2, ? arg3) {
+void func_80019118(s32 playerId, f32 arg1, s32 cameraId, s32 arg3) {
s32 sp2C;
s16 *sp28;
f32 *sp24;
f32 *sp20;
f64 sp18;
+ Camera *temp_v0_2;
f32 *temp_a0;
f32 *temp_a1;
- f32 *temp_v1;
- f32 *temp_v1_2;
+ f32 *var_v1;
f32 temp_f0;
f32 temp_f12;
f64 temp_f12_2;
@@ -10393,15 +10188,13 @@ void func_80019118(s32 arg0, f32 arg1, s32 arg2, ? arg3) {
s16 *temp_v0;
s32 temp_t5;
s32 temp_t6;
- void *temp_v0_2;
- f32 *phi_v1;
- temp_t6 = arg2 * 4;
- temp_v0 = (arg2 * 2) + &gNearestWaypointByCameraId;
+ temp_t6 = cameraId * 4;
+ temp_v0 = &gNearestWaypointByCameraId[cameraId];
*(&D_80164688 + temp_t6) = arg1;
- *temp_v0 = *(&gNearestWaypointByPlayerId + (arg0 * 2)) + 0xC;
- temp_t5 = *temp_v0 % gWaypointCountByPathIndex;
- *temp_v0 = temp_t5;
+ *temp_v0 = gNearestWaypointByPlayerId[playerId] + 0xC;
+ temp_t5 = (s16) *temp_v0 % (s32) *gWaypointCountByPathIndex;
+ *temp_v0 = (s16) temp_t5;
sp2C = temp_t6;
sp28 = temp_v0;
func_8000BBD8(arg1, temp_t5 & 0xFFFF, arg1, 0, temp_t6);
@@ -10413,49 +10206,37 @@ void func_80019118(s32 arg0, f32 arg1, s32 arg2, ? arg3) {
*temp_a1 = temp_f0;
sp20 = temp_a1;
sp24 = temp_a0;
- temp_f2 = (D_80164550 + (*temp_v0 * 8))->unk2;
+ temp_f2 = (f64) (f32) (*D_80164550)[*temp_v0].wayPointY;
sp18 = temp_f2;
- temp_f12_2 = func_802AE1C0(temp_f12, temp_f2 + 30.0, temp_f0);
- if ((temp_f12_2 < (temp_f2 - 20.0)) || (D_800ED310 <= temp_f12_2)) {
- temp_v1_2 = temp_t6 + &D_80164618;
- *temp_v1_2 = temp_f2 + 10.0;
- phi_v1 = temp_v1_2;
+ temp_f12_2 = (f64) func_802AE1C0(temp_f12, (f32) (temp_f2 + 30.0), temp_f0);
+ if ((temp_f12_2 < (temp_f2 - 20.0)) || (temp_f12_2 >= 3000.0)) {
+ var_v1 = temp_t6 + &D_80164618;
+ *var_v1 = (f32) (temp_f2 + 10.0);
} else {
- temp_v1 = temp_t6 + &D_80164618;
- *temp_v1 = temp_f12_2 + 10.0;
- phi_v1 = temp_v1;
+ var_v1 = temp_t6 + &D_80164618;
+ *var_v1 = (f32) (temp_f12_2 + 10.0);
}
*(&D_80164648 + temp_t6) = 0.0f;
- temp_v0_2 = (arg2 * 0xB8) + &cameras;
- temp_v0_2->unk0 = *temp_a0;
- temp_v0_2->unk4 = *phi_v1;
- temp_v0_2->unk8 = *temp_a1;
+ temp_v0_2 = &cameras[cameraId];
+ temp_v0_2->pos[0] = *temp_a0;
+ temp_v0_2->pos[1] = *var_v1;
+ temp_v0_2->pos[2] = *temp_a1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019118.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_80007BF8(s32, s32, ?, ?, s32); // extern
-s16 func_8000D33C(f32, f32, u16, f32, s16, s32); // extern
-? func_80014D30(s32, s32); // extern
-? func_8001A348(s32, s32, s16); // extern
-s16 atan2s(f32, f32); // extern
-extern f64 D_800ED318;
-extern f64 D_800ED320;
-extern ? D_80163068;
-extern ? gNearestWaypointByPlayerId;
-extern ? gPathIndexByPlayerId;
-extern ? gWaypointCountByPathIndex;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80014D30(s32, s32); /* extern */
+? func_8001A348(s32, s32, s16); /* extern */
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_80164688;
-void func_8001933C(void *arg0, ? arg1, ? arg2, s32 arg3) {
+void func_8001933C(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
s16 sp96;
f32 sp8C;
f32 sp88;
@@ -10470,74 +10251,64 @@ void func_8001933C(void *arg0, ? arg1, ? arg2, s32 arg3) {
f32 temp_f12;
f32 temp_f14;
f64 temp_f0;
- f64 temp_f0_2;
- f64 temp_f2;
s16 *temp_t0;
s16 temp_t3;
s16 temp_v1;
- s32 temp_t2;
- s32 temp_v0;
s32 temp_v1_2;
s32 temp_v1_3;
- s32 temp_v1_4;
+ s32 var_v1;
+ struct TrackWayPoint *temp_v0;
u16 temp_a1;
- void *temp_v0_2;
- s32 phi_v1;
- temp_v1 = arg0->unkAE;
- temp_t2 = temp_v1 * 2;
- temp_a1 = *(&gPathIndexByPlayerId + temp_t2);
- sp44 = *(&gWaypointCountByPathIndex + (temp_a1 * 2));
- temp_v0 = arg3 * 2;
- temp_t0 = temp_v0 + &gNearestWaypointByCameraId;
+ temp_v1 = camera->playerId;
+ temp_a1 = gPathIndexByPlayerId[temp_v1];
+ sp44 = (s32) gWaypointCountByPathIndex[temp_a1];
+ temp_t0 = &gNearestWaypointByCameraId[cameraId];
sp34 = temp_t0;
- sp38 = temp_v0;
- sp3C = temp_t2;
- sp7C = temp_v1;
- sp48 = temp_a1;
+ sp38 = cameraId * 2;
+ sp3C = temp_v1 * 2;
+ sp7C = (s32) temp_v1;
+ sp48 = (s32) temp_a1;
temp_s2 = &gPlayerOne[temp_v1];
- *temp_t0 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t0, 0);
+ *temp_t0 = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], *temp_t0, 0);
temp_t3 = *temp_t0;
sp96 = temp_t3;
- if (func_80007BF8(*(&gNearestWaypointByPlayerId + temp_t2) & 0xFFFF, temp_t3 & 0xFFFF, 0x32, 0x14, sp44) <= 0) {
- temp_v1_2 = arg3 * 4;
+ if (func_80007BF8((s16) gNearestWaypointByPlayerId[temp_v1] & 0xFFFF, temp_t3 & 0xFFFF, 0x0032U, 0x0014U, (u16) sp44) <= 0) {
+ temp_v1_2 = cameraId * 4;
sp3C = temp_v1_2;
- func_8001A348(arg3, *(&D_80164688 + temp_v1_2), *(&D_80164680 + sp38));
+ func_8001A348(cameraId, *(&D_80164688 + temp_v1_2), *(&D_80164680 + sp38));
goto block_8;
}
- temp_f0 = *(&D_80163068 + (temp_v1 * 4));
- temp_v1_3 = arg3 * 4;
- if ((temp_f0 < -0.5) && (*(&D_80164688 + temp_v1_3) < -0.5)) {
+ temp_f0 = (f64) D_80163068[temp_v1];
+ temp_v1_3 = cameraId * 4;
+ if ((temp_f0 < -0.5) && ((f64) *(&D_80164688 + temp_v1_3) < -0.5)) {
sp3C = temp_v1_3;
- func_8001A348(arg3, 0x3F800000, 0xD);
+ func_8001A348(cameraId, 0x3F800000, 0x000D);
goto block_8;
}
- temp_v1_4 = arg3 * 4;
- phi_v1 = temp_v1_4;
- if ((temp_f0 > 0.5) && (*(&D_80164688 + temp_v1_4) > 0.5)) {
- sp3C = temp_v1_4;
- func_8001A348(arg3, 0xBF800000, 0xC);
+ var_v1 = cameraId * 4;
+ if ((temp_f0 > 0.5) && ((f64) *(&D_80164688 + var_v1) > 0.5)) {
+ sp3C = var_v1;
+ func_8001A348(cameraId, 0xBF800000, 0x000C);
block_8:
- phi_v1 = sp3C;
- }
- temp_f0_2 = D_800ED318;
- temp_f2 = D_800ED320;
- arg0->unk0 = *(&D_801645F8 + phi_v1);
- arg0->unk4 = *(&D_80164618 + phi_v1);
- arg0->unk8 = *(&D_80164638 + phi_v1);
- temp_v0_2 = (&D_80164550)[sp48] + (sp96 * 8);
- arg0->unkC = (temp_s2->posX * temp_f0_2) + (temp_f2 * temp_v0_2->unk0);
- arg0->unk10 = (temp_s2->posY * temp_f0_2) + (temp_f2 * temp_v0_2->unk2);
- arg0->unk14 = (temp_s2->posZ * temp_f0_2) + (temp_f2 * temp_v0_2->unk4);
- func_80014D30(arg3, sp48);
- temp_f12 = arg0->unkC - arg0->unk0;
- sp88 = arg0->unk10 - arg0->unk4;
+ var_v1 = sp3C;
+ }
+ camera->pos[0] = *(&D_801645F8 + var_v1);
+ camera->pos[1] = *(&D_80164618 + var_v1);
+ camera->pos[2] = *(&D_80164638 + var_v1);
+ temp_v0 = &D_80164550[sp48][sp96];
+ camera->lookAt[0] = (f32) (((f64) temp_s2->pos[0] * 0.8) + (0.2 * (f64) temp_v0->wayPointX));
+ camera->lookAt[1] = (f32) (((f64) temp_s2->pos[1] * 0.8) + (0.2 * (f64) temp_v0->wayPointY));
+ camera->lookAt[2] = (f32) (((f64) temp_s2->pos[2] * 0.8) + (0.2 * (f64) temp_v0->wayPointZ));
+ func_80014D30(cameraId, sp48);
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ sp88 = camera->lookAt[1] - camera->pos[1];
sp8C = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp84 = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp8C * sp8C) + (temp_f14 * temp_f14)), sp88);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001933C.s")
@@ -10550,78 +10321,72 @@ void func_8001968C(void) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern u16 gWaypointCountByPathIndex;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164678;
-void func_8001969C(s32 arg0, ? arg1, s32 arg2, ? arg3) {
+void func_8001969C(s32 arg0, s32 arg1, s32 cameraId, s32 arg3) {
s16 *temp_v1;
s32 temp_a1;
- s32 temp_v0;
- void *temp_a0;
+ struct TrackWayPoint *temp_a0;
- temp_v0 = arg2 * 2;
- temp_v1 = temp_v0 + &gNearestWaypointByCameraId;
- *temp_v1 = gWaypointCountByPathIndex - 0x12;
- temp_a0 = (*temp_v1 * 8) + D_80164550;
- temp_a1 = arg2 * 4;
- *(&D_801645F8 + temp_a1) = temp_a0->unk0;
- *(&D_80164618 + temp_a1) = temp_a0->unk2 + 10.0;
- *(&D_80164638 + temp_a1) = temp_a0->unk4;
+ temp_v1 = &gNearestWaypointByCameraId[cameraId];
+ *temp_v1 = *gWaypointCountByPathIndex - 0x12;
+ temp_a0 = &(*D_80164550)[*temp_v1];
+ temp_a1 = cameraId * 4;
+ *(&D_801645F8 + temp_a1) = (f32) temp_a0->wayPointX;
+ *(&D_80164618 + temp_a1) = (f32) ((f64) temp_a0->wayPointY + 10.0);
+ *(&D_80164638 + temp_a1) = (f32) temp_a0->wayPointZ;
*(&D_80164648 + temp_a1) = 0.0f;
- *(&D_80164678 + temp_v0) = 0;
+ *(&D_80164678 + (cameraId * 2)) = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001969C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80014D30(s32, ?); // extern
-s16 atan2s(f32, f32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80014D30(s32, ?); /* extern */
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
-extern ? gNearestWaypointByCameraId;
-void func_80019760(void *arg0, ? arg1, ? arg2, s32 arg3) {
+void func_80019760(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) {
f32 sp2C;
f32 sp28;
f32 sp24;
f32 temp_f12;
f32 temp_f14;
s32 temp_v0;
- void *temp_v1;
+ struct TrackWayPoint *temp_v1;
- temp_v0 = arg3 * 4;
- arg0->unk0 = *(&D_801645F8 + temp_v0);
- arg0->unk4 = *(&D_80164618 + temp_v0);
- arg0->unk8 = *(&D_80164638 + temp_v0);
- temp_v1 = (*(&gNearestWaypointByCameraId + (arg3 * 2)) * 8) + D_80164550;
- arg0->unkC = temp_v1->unk0;
- arg0->unk10 = temp_v1->unk2;
- arg0->unk14 = temp_v1->unk4;
- func_80014D30(arg3, 0);
- temp_f12 = arg0->unkC - arg0->unk0;
- sp28 = arg0->unk10 - arg0->unk4;
+ temp_v0 = cameraId * 4;
+ camera->pos[0] = *(&D_801645F8 + temp_v0);
+ camera->pos[1] = *(&D_80164618 + temp_v0);
+ camera->pos[2] = *(&D_80164638 + temp_v0);
+ temp_v1 = &(*D_80164550)[gNearestWaypointByCameraId[cameraId]];
+ camera->lookAt[0] = (f32) temp_v1->wayPointX;
+ camera->lookAt[1] = (f32) temp_v1->wayPointY;
+ camera->lookAt[2] = (f32) temp_v1->wayPointZ;
+ func_80014D30(cameraId, 0);
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ sp28 = camera->lookAt[1] - camera->pos[1];
sp2C = temp_f12;
- temp_f14 = arg0->unk14 - arg0->unk8;
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
sp24 = temp_f14;
- arg0->unk26 = atan2s(temp_f12, temp_f14);
- arg0->unk24 = atan2s(sqrtf((sp2C * sp2C) + (temp_f14 * temp_f14)), sp28);
- arg0->unk28 = 0;
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((sp2C * sp2C) + (temp_f14 * temp_f14)), sp28);
+ camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019760.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
? func_80015314(?, s32); /* extern */
? func_80015544(?, s32, u16); /* extern */
? func_80015A9C(?, s32, s16); /* extern */
@@ -10633,16 +10398,15 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019760.s")
? func_80019118(?, s32, s16); /* extern */
? func_8001969C(?, s32, s16); /* extern */
extern ? D_80163DD8;
-extern ? gPathIndexByPlayerId;
-extern ? gNearestWaypointByCameraId;
extern ? D_80164680;
extern ? D_801646C0;
-void func_80019890(s16 arg0, s32 cameraId) {
- void *sp28;
+void func_80019890(s16 playerId, s32 cameraId) {
+ Camera *sp28;
s32 sp24;
u16 *sp20;
Camera *temp_t6;
+ Camera *temp_t9;
s32 temp_t0;
u16 *temp_t4;
u16 temp_s1;
@@ -10650,15 +10414,16 @@ void func_80019890(s16 arg0, s32 cameraId) {
temp_t6 = camera1;
sp28 = temp_t6;
- sp28 = &temp_t6[cameraId];
- temp_t6[cameraId].unkAE = arg0;
+ temp_t9 = &temp_t6[cameraId];
+ sp28 = temp_t9;
+ temp_t9->playerId = playerId;
temp_t0 = cameraId * 2;
temp_t4 = temp_t0 + &D_80164680;
*(&D_801646C0 + temp_t0) = 0;
sp24 = temp_t0;
sp20 = temp_t4;
temp_t5 = *temp_t4;
- temp_s1 = *(&gPathIndexByPlayerId + (arg0 * 2));
+ temp_s1 = gPathIndexByPlayerId[playerId];
switch (temp_t5) {
case 0:
func_80015314(0, cameraId);
@@ -10670,48 +10435,48 @@ void func_80019890(s16 arg0, s32 cameraId) {
func_80015544(0x3F800000, cameraId, temp_s1);
break;
case 6:
- func_80015A9C(0xBF19999A, cameraId, temp_s1);
+ func_80015A9C(0xBF19999A, cameraId, (s16) temp_s1);
break;
case 7:
- func_80015A9C(0x3F19999A, cameraId, temp_s1);
+ func_80015A9C(0x3F19999A, cameraId, (s16) temp_s1);
break;
case 4:
- func_800162CC(0xBF800000, cameraId, temp_s1);
+ func_800162CC(0xBF800000, cameraId, (s16) temp_s1);
break;
case 5:
- func_800162CC(0x3F800000, cameraId, temp_s1);
+ func_800162CC(0x3F800000, cameraId, (s16) temp_s1);
break;
case 9:
func_80016C3C(0, cameraId);
break;
case 1:
- func_80017720(0, cameraId, temp_s1);
+ func_80017720(0, cameraId, (s16) temp_s1);
break;
case 14:
- func_80017F10(0, cameraId, temp_s1);
+ func_80017F10(0, cameraId, (s16) temp_s1);
break;
case 8:
- func_80018718(0, cameraId, temp_s1);
+ func_80018718(0, cameraId, (s16) temp_s1);
break;
case 12:
- func_80019118(0xBF800000, cameraId, temp_s1);
+ func_80019118(0xBF800000, cameraId, (s16) temp_s1);
break;
case 13:
- func_80019118(0x3F800000, cameraId, temp_s1);
+ func_80019118(0x3F800000, cameraId, (s16) temp_s1);
break;
case 15:
- func_8001969C(0xBF800000, cameraId, temp_s1);
+ func_8001969C(0xBF800000, cameraId, (s16) temp_s1);
break;
case 16:
- func_8001969C(0x3F800000, cameraId, temp_s1);
+ func_8001969C(0x3F800000, cameraId, (s16) temp_s1);
break;
default:
func_80015314(0, cameraId);
break;
}
- *(&gNearestWaypointByCameraId + sp24) = func_8000BD94(sp28->unk0, sp28->unk4, sp28->unk8, temp_s1);
- if (*sp20 == 9) {
- *(&D_80163DD8 + (cameraId * 4)) = temp_s1;
+ *(gNearestWaypointByCameraId + sp24) = func_8000BD94(sp28->pos[0], sp28->pos[1], sp28->pos[2], (s32) temp_s1);
+ if ((s16) *sp20 == 9) {
+ *(&D_80163DD8 + (cameraId * 4)) = (s32) temp_s1;
}
}
#else
@@ -10860,8 +10625,7 @@ void func_80019DE4(void) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern s16 gGPCurrentRacePlayerIdByRank;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
extern s16 D_80164670;
extern s16 D_80164678;
extern s16 D_8016467A;
@@ -10874,7 +10638,7 @@ void func_80019DF4(void) {
D_80164670 = D_8016467C;
D_80164670 = D_8016467A;
D_80164670 = D_80164678;
- camera1->unkAE = gGPCurrentRacePlayerIdByRank;
+ camera1->playerId = *gGPCurrentRacePlayerIdByRank;
D_80164678 = 1;
D_801646CC = 2;
}
@@ -10906,51 +10670,44 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019E58.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80015314(s32, ?, s32); // extern
-extern s32 gPlayerWinningIndex;
-extern s16 gGPCurrentRacePlayerIdByRank;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80015314(s32, ?, s32); /* extern */
extern ? D_80164670;
extern s16 D_80164678;
extern s16 D_80164680;
+extern s32 gPlayerWinningIndex;
void func_80019ED0(void) {
- ? *temp_v0;
- s16 *temp_s0;
- s16 *temp_s0_2;
- s32 temp_s1;
- s32 temp_v0_2;
- s16 *phi_s0;
- ? *phi_v0;
- s16 *phi_s2;
- s32 phi_s1;
- s16 *phi_s0_2;
+ ? *var_v0;
+ s16 *var_s0;
+ s16 *var_s0_2;
+ s16 *var_s2;
+ s16 temp_t6;
+ s32 temp_v0;
+ s32 var_s1;
- phi_s0 = &D_80164678;
- phi_v0 = &D_80164670;
+ var_v0 = &D_80164670;
+ var_s0 = &D_80164678;
do {
- temp_s0 = phi_s0 + 2;
- temp_v0 = phi_v0 + 2;
- temp_v0->unk-2 = *phi_s0;
- phi_s0 = temp_s0;
- phi_v0 = temp_v0;
- } while (temp_s0 < &D_80164680);
- temp_v0_2 = gPlayerWinningIndex;
- gGPCurrentRacePlayerIdByRank = temp_v0_2;
- camera1->unkAE = temp_v0_2;
- phi_s2 = &D_80164680;
- phi_s1 = 0;
- phi_s0_2 = &D_80164678;
+ temp_t6 = *var_s0;
+ var_s0 += 2;
+ var_v0 += 2;
+ var_v0->unk-2 = temp_t6;
+ } while ((u32) var_s0 < (u32) &D_80164680);
+ temp_v0 = gPlayerWinningIndex;
+ *gGPCurrentRacePlayerIdByRank = (s16) temp_v0;
+ var_s2 = &D_80164680;
+ var_s0_2 = &D_80164678;
+ var_s1 = 0;
+ camera1->playerId = (s16) temp_v0;
do {
- *phi_s2 = 0;
- func_80015314(gPlayerWinningIndex, 0, phi_s1);
- temp_s1 = phi_s1 + 1;
- temp_s0_2 = phi_s0_2 + 2;
- temp_s0_2->unk-2 = 1;
- phi_s2 += 2;
- phi_s1 = temp_s1;
- phi_s0_2 = temp_s0_2;
- } while (temp_s1 != 4);
+ *var_s2 = 0;
+ func_80015314(gPlayerWinningIndex, 0, var_s1);
+ var_s1 += 1;
+ var_s0_2 += 2;
+ var_s2 += 2;
+ var_s0_2->unk-2 = 1;
+ } while (var_s1 != 4);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80019ED0.s")
@@ -11034,32 +10791,36 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A0DC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800CA270(); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_800CA270(); /* extern */
extern ? D_80164680;
void func_8001A124(s32 arg0, s32 arg1) {
s32 temp_v0;
temp_v0 = gPlayerPositions[arg0];
- if (temp_v0 != 0) {
- if ((temp_v0 != 1) && (temp_v0 != 2) && (temp_v0 != 3)) {
- if (random_int(0x64) < 0x32) {
- *(&D_80164680 + (arg1 * 2)) = 0xF;
- return;
- }
- *(&D_80164680 + (arg1 * 2)) = 0x10;
- return;
+ switch (temp_v0) { /* irregular */
+ case 0:
+ if (random_int(0x0064U) < 0x32) {
+ *(&D_80164680 + (arg1 * 2)) = 0x000C;
+ } else {
+ *(&D_80164680 + (arg1 * 2)) = 0x000D;
}
+ func_800CA270();
+ return;
+ case 1:
+ case 2:
+ case 3:
*(&D_80164680 + (arg1 * 2)) = 8;
return;
+ default:
+ if (random_int(0x0064U) < 0x32) {
+ *(&D_80164680 + (arg1 * 2)) = 0x000F;
+ return;
+ }
+ *(&D_80164680 + (arg1 * 2)) = 0x0010;
+ return;
}
- if (random_int(0x64) < 0x32) {
- *(&D_80164680 + (arg1 * 2)) = 0xC;
- } else {
- *(&D_80164680 + (arg1 * 2)) = 0xD;
- }
- func_800CA270();
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A124.s")
@@ -11124,34 +10885,23 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A310.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80019890(s32, s32); // extern
-s16 func_8001A310(f32, s16, ?, s32); // extern
-extern ? gNearestWaypointByCameraId;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80019890(s32, s32); /* extern */
+s16 func_8001A310(f32, s16, s32, s32); /* extern */
extern ? D_80164680;
extern ? D_80164688;
-extern ? D_8016479E;
-void func_8001A348(s32 arg0, f32 arg1, ? arg2) {
+void func_8001A348(s32 cameraId, f32 arg1, s32 arg2) {
s32 sp20;
s32 sp1C;
- f32 *temp_at;
- s16 temp_a0;
- s16 temp_t7;
- s32 temp_a3;
s32 temp_v1;
- temp_a3 = arg0;
- temp_v1 = arg0 * 2;
- temp_t7 = *(&D_8016479E + (arg0 * 0xB8));
- temp_at = &D_80164688 + (arg0 * 4);
- temp_a0 = *(&gNearestWaypointByCameraId + temp_v1);
+ temp_v1 = cameraId * 2;
sp1C = temp_v1;
- arg0 = temp_a3;
- sp20 = temp_t7;
- *temp_at = arg1;
- *(&D_80164680 + temp_v1) = func_8001A310(arg1, temp_a0, arg2, temp_a3);
- func_80019890(sp20, arg0);
+ sp20 = (s32) *(&cameras->playerId + (cameraId * 0xB8));
+ *(&D_80164688 + (cameraId * 4)) = arg1;
+ *(&D_80164680 + temp_v1) = func_8001A310(arg1, gNearestWaypointByCameraId[cameraId], arg2, cameraId);
+ func_80019890(sp20, cameraId);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A348.s")
@@ -11181,26 +10931,21 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A3D8.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_80019890(s32, s32, s16 *, s32); // extern
-s16 func_8001A310(s16, s32, s16 *, s32); // extern
-extern ? gNearestWaypointByCameraId;
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_80019890(s32, s32, s16 *, s32); /* extern */
+s16 func_8001A310(s16, s32, s16 *, s32); /* extern */
extern ? D_80164680;
-extern ? gPlayers;
-void func_8001A450(s32 arg0, s32 arg1, s32 arg2) {
+void func_8001A450(s32 playerId, s32 arg1, s32 arg2) {
s32 sp24;
s16 *sp18;
s16 *temp_a2;
s16 temp_v0;
s16 temp_v1;
- s32 temp_a3;
- s32 temp_t9;
- temp_a3 = arg0;
- if (((*(&gPlayers + 0xBC + (arg0 * 0xDD8)) & 0x1000000C) == 0) && ((temp_t9 = arg1 * 2, temp_a2 = temp_t9 + &D_80164680, temp_v1 = *temp_a2, sp18 = temp_a2, arg0 = temp_a3, sp24 = temp_v1, temp_v0 = func_8001A310(*(&gNearestWaypointByCameraId + temp_t9), (temp_v1 + 1) % 0xA, temp_a2, temp_a3), (temp_v0 != temp_v1)) || (arg2 != arg0))) {
+ if (!(*(&gPlayers->unk_0BC + (playerId * 0xDD8)) & 0x1000000C) && ((temp_a2 = (arg1 * 2) + &D_80164680, temp_v1 = *temp_a2, sp18 = temp_a2, sp24 = (s32) temp_v1, temp_v0 = func_8001A310(gNearestWaypointByCameraId[arg1], (s32) (temp_v1 + 1) % 10, temp_a2, playerId), (temp_v0 != temp_v1)) || (arg2 != playerId))) {
*temp_a2 = temp_v0;
- func_80019890(arg2, arg1, temp_a2, arg0);
+ func_80019890(arg2, arg1, temp_a2, playerId);
}
}
#else
@@ -11208,210 +10953,200 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A450.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8001A450(s32, s32, s32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8001A450(s32, s32, s32); /* extern */
extern ? D_80164680;
void func_8001A518(s32 arg0, s32 arg1, s32 arg2) {
- if (arg1 != 0) {
- if ((arg1 != 1) && (arg1 != 2) && (arg1 != 3)) {
- *(&D_80164680 + (arg2 * 2)) = 0;
- return;
- }
+ switch (arg1) { /* irregular */
+ default:
+ *(&D_80164680 + (arg2 * 2)) = 0;
+ return;
+ case 0:
+ *(&D_80164680 + (arg2 * 2)) = 1;
+ return;
+ case 1:
+ case 2:
+ case 3:
func_8001A450(arg2, arg0, arg2);
return;
}
- *(&D_80164680 + (arg2 * 2)) = 1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A518.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-? func_800151A4(void *, s32); /* extern */
-? func_80015390(void *, u16 *, s8, s32); /* extern */
-? func_8001577C(void *, u16 *, s8, s32); /* extern */
-? func_80015C94(void *, u16 *, s8, s32); /* extern */
-? func_80016494(void *, u16 *, s8, s32); /* extern */
-? func_80017054(void *, u16 *, s8, s32); /* extern */
-? func_800178F4(void *, u16 *, s8, s32); /* extern */
-? func_800180F0(void *, u16 *, s8, s32); /* extern */
-? func_800188F4(void *, u16 *, s8, s32); /* extern */
-? func_8001933C(void *, u16 *, s8, s32); /* extern */
-? func_80019760(void *, u16 *, s8, s32); /* extern */
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_800151A4(Camera *, s32); /* extern */
+? func_80015390(Camera *, u16 *, s8, s32); /* extern */
+? func_8001577C(Camera *, u16 *, s8, s32); /* extern */
+? func_80015C94(Camera *, u16 *, s8, s32); /* extern */
+? func_80016494(Camera *, u16 *, s8, s32); /* extern */
+? func_80017054(Camera *, u16 *, s8, s32); /* extern */
+? func_800178F4(Camera *, u16 *, s8, s32); /* extern */
+? func_800180F0(Camera *, u16 *, s8, s32); /* extern */
+? func_800188F4(Camera *, u16 *, s8, s32); /* extern */
+? func_8001933C(Camera *, u16 *, s8, s32); /* extern */
+? func_80019760(Camera *, u16 *, s8, s32); /* extern */
? func_80019890(s32, s32); /* extern */
? func_80019C50(s32); /* extern */
-? func_80019D2C(void *, u16 *, s32, s32); /* extern */
+? func_80019D2C(Camera *, u16 *, s32, s32); /* extern */
? func_80019FB4(s32); /* extern */
? func_8001A124(?, s32, s32); /* extern */
? func_8001A220(?, s32, s32); /* extern */
? func_8001A3D8(s32, ?, s16, s32); /* extern */
? func_8001A450(s32, s32, s32, s32); /* extern */
? func_8001A518(s32, s32, ?, s32); /* extern */
-extern ? gPlayerPositions;
extern ? D_80164680;
extern ? D_801646C0;
+extern u32 D_801646C8;
+extern u16 D_801646CC;
extern ? D_801646D0;
+extern s8 D_8018EDF3;
-void func_8001A588(s32 arg0, void *arg1, u16 *arg2, s8 arg3, s32 cameraId) {
+void func_8001A588(s32 arg0, Camera *camera, u16 *arg2, s8 arg3, s32 arg4) {
s32 sp44;
s16 *sp24;
f64 temp_f0;
f64 temp_f2;
s16 *temp_t8;
- s16 temp_v0_7;
+ s16 temp_v0_6;
s16 temp_v1;
- s32 temp_s0;
+ s16 var_s0;
s32 temp_v0;
s32 temp_v0_2;
- s32 temp_v1_2;
+ s32 var_v1;
u16 temp_t3;
u16 temp_v0_3;
u32 temp_t1;
u32 temp_t4;
+ u32 temp_v0_4;
u32 temp_v0_5;
- u32 temp_v0_6;
- void *temp_v0_4;
- s32 phi_s0;
- u32 *phi_t0;
- s32 phi_s0_2;
- s32 phi_s0_3;
- s32 phi_v1;
- s32 phi_a3;
+ void *temp_v0_7;
- phi_s0 = arg1->unkAE;
- if (gModeSelection == TIME_TRIALS) {
- phi_s0 = 0;
+ var_s0 = camera->playerId;
+ if (gModeSelection == 1) {
+ var_s0 = 0;
}
- func_80019FB4(cameraId);
- temp_f0 = arg1->unk0;
- phi_s0_2 = phi_s0;
- if ((temp_f0 * 10.0) == (arg1->unkC * 10.0)) {
- temp_f2 = arg1->unk8;
- if ((temp_f2 * 10.0) == (arg1->unk14 * 10.0)) {
- arg1->unk0 = temp_f0 + 100.0;
- arg1->unk8 = temp_f2 + 100.0;
+ func_80019FB4(arg4);
+ temp_f0 = (f64) camera->pos[0];
+ if ((s32) (temp_f0 * 10.0) == (s32) ((f64) camera->lookAt[0] * 10.0)) {
+ temp_f2 = (f64) camera->pos[2];
+ if ((s32) (temp_f2 * 10.0) == (s32) ((f64) camera->lookAt[2] * 10.0)) {
+ camera->pos[0] = (f32) (temp_f0 + 100.0);
+ camera->pos[2] = (f32) (temp_f2 + 100.0);
}
}
temp_v0 = gModeSelection;
- if ((temp_v0 != BATTLE) && (*(&D_80164680 + (cameraId * 2)) == -1) && ((*arg2 & 0x800) != 0) && (D_801646CC == 0) && (D_801646C8 == 0)) {
- if (temp_v0 == VERSUS) {
- func_8001A220(0, phi_s0, cameraId);
+ if ((temp_v0 != 3) && (*(&D_80164680 + (arg4 * 2)) == -1) && (*arg2 & 0x800) && (D_801646CC == 0) && (D_801646C8 == 0)) {
+ if (temp_v0 == 2) {
+ func_8001A220(0, (s32) var_s0, arg4);
} else {
- func_8001A124(0, phi_s0, cameraId);
+ func_8001A124(0, (s32) var_s0, arg4);
}
- func_80019890(phi_s0, cameraId);
+ func_80019890((s32) var_s0, arg4);
}
- temp_v0_2 = cameraId * 2;
+ temp_v0_2 = arg4 * 2;
temp_t8 = temp_v0_2 + &D_80164680;
sp24 = temp_t8;
temp_v1 = *temp_t8;
- if ((temp_v1 == 0xE) || (temp_v1 == 0)) {
- func_80019D2C(arg1, arg2, cameraId, cameraId);
+ if ((temp_v1 == 0x000E) || (temp_v1 == 0)) {
+ func_80019D2C(camera, arg2, arg4, arg4);
} else {
*(&D_801646C0 + temp_v0_2) = 0;
- func_800151A4(arg1, cameraId);
+ func_800151A4(camera, arg4);
}
temp_v0_3 = D_801646CC;
- phi_t0 = &D_801646C8;
- phi_a3 = cameraId;
- if (temp_v0_3 != 1) {
- if (temp_v0_3 != 2) {
- temp_v0_4 = (cameraId * 8) + &D_801646D0;
- if (temp_v0_4->unk0 == 1) {
- temp_v0_4->unk0 = 0;
- *(&cameras->unkAE + (cameraId * 0xB8)) = temp_v0_4->unk4;
- func_8001A3D8(cameraId, 0, temp_v0_4->unk2, cameraId);
- goto block_47;
- }
- } else {
- temp_t4 = D_801646C8 + 1;
- D_801646C8 = temp_t4;
- if (temp_t4 >= 0xFB) {
- D_801646C8 = 0;
- }
- if ((cameraId == 0) && (D_801646C8 == 0xA)) {
- func_8001A450(phi_s0, cameraId, phi_s0, cameraId);
- goto block_47;
- }
- }
- } else {
+ switch (temp_v0_3) { /* switch 1; irregular */
+ case 1: /* switch 1 */
temp_t1 = D_801646C8 + 1;
D_801646C8 = temp_t1;
- if (temp_t1 >= 0x1F5) {
+ if (temp_t1 >= 0x1F5U) {
D_801646C8 = 0;
}
- if ((cameraId == 0) && ((temp_v0_5 = D_801646C8, (temp_v0_5 == 0xA)) || (temp_v0_5 == 0xB))) {
- func_8001A518(phi_s0, *(&gPlayerPositions + (phi_s0 * 4)), 0, cameraId);
- phi_t0 = &D_801646C8;
+ if ((arg4 == 0) && ((temp_v0_4 = D_801646C8, (temp_v0_4 == 0x0000000A)) || (temp_v0_4 == 0x0000000B))) {
+ func_8001A518((s32) var_s0, gPlayerPositions[var_s0], 0, arg4);
}
- phi_a3 = cameraId;
- if ((gModeSelection != TIME_TRIALS) && (cameraId == 1) && ((temp_v0_6 = *phi_t0, (temp_v0_6 == 0x104)) || (temp_v0_6 == 0x105))) {
- phi_v1 = 0;
- if (D_8018EDF3 == TWO_PLAYERS_SELECTED) {
- func_8001A518(phi_s0, *(&gPlayerPositions + (phi_s0 * 4)), 1, cameraId);
+ if ((gModeSelection != 1) && (arg4 == 1) && ((temp_v0_5 = D_801646C8, (temp_v0_5 == 0x00000104)) || (temp_v0_5 == 0x00000105))) {
+ var_v1 = 0;
+ if (D_8018EDF3 == 2) {
+ func_8001A518((s32) var_s0, gPlayerPositions[var_s0], 1, arg4);
} else {
- sp44 = phi_s0;
+ sp44 = (s32) var_s0;
loop_34:
- temp_s0 = phi_s0_2 + 1;
- temp_v1_2 = phi_v1 + 1;
- phi_s0_3 = temp_s0;
- phi_v1 = temp_v1_2;
- if (temp_s0 >= 8) {
- phi_s0_3 = 1;
+ var_s0 += 1;
+ var_v1 += 1;
+ if (var_s0 >= 8) {
+ var_s0 = 1;
}
- temp_v0_7 = gPlayers[phi_s0_3].unk_0CA;
- phi_s0_2 = phi_s0_3;
- if ((((temp_v0_7 & 2) != 0) || ((temp_v0_7 & 8) != 0)) && (temp_v1_2 != 8)) {
+ temp_v0_6 = gPlayers[var_s0].unk_0CA;
+ if (((temp_v0_6 & 2) || (temp_v0_6 & 8)) && (var_v1 != 8)) {
goto loop_34;
}
- func_8001A450(sp44, cameraId, phi_s0_3, cameraId);
+ func_8001A450(sp44, arg4, (s32) var_s0, arg4);
}
-block_47:
- phi_a3 = cameraId;
}
+ break;
+ case 2: /* switch 1 */
+ temp_t4 = D_801646C8 + 1;
+ D_801646C8 = temp_t4;
+ if (temp_t4 >= 0xFBU) {
+ D_801646C8 = 0;
+ }
+ if ((arg4 == 0) && (D_801646C8 == 0x0000000A)) {
+ func_8001A450((s32) var_s0, arg4, (s32) var_s0, arg4);
+ }
+ break;
+ default: /* switch 1 */
+ temp_v0_7 = (arg4 * 8) + &D_801646D0;
+ if (temp_v0_7->unk0 == (s16) 1) {
+ temp_v0_7->unk0 = 0;
+ *(&cameras->playerId + (arg4 * 0xB8)) = temp_v0_7->unk4;
+ func_8001A3D8(arg4, 0, temp_v0_7->unk2, arg4);
+ }
+ break;
}
- func_80019C50(phi_a3);
- temp_t3 = *sp24;
+ func_80019C50(arg4);
+ temp_t3 = (u16) *sp24;
switch (temp_t3) {
case 0:
- func_80015390(arg1, arg2, arg3, cameraId);
+ func_80015390(camera, arg2, arg3, arg4);
return;
case 2:
case 3:
- func_8001577C(arg1, arg2, arg3, cameraId);
+ func_8001577C(camera, arg2, arg3, arg4);
return;
case 6:
case 7:
- func_80015C94(arg1, arg2, arg3, cameraId);
+ func_80015C94(camera, arg2, arg3, arg4);
return;
case 4:
case 5:
- func_80016494(arg1, arg2, arg3, cameraId);
+ func_80016494(camera, arg2, arg3, arg4);
return;
case 9:
- func_80017054(arg1, arg2, arg3, cameraId);
+ func_80017054(camera, arg2, arg3, arg4);
return;
case 1:
- func_800178F4(arg1, arg2, arg3, cameraId);
+ func_800178F4(camera, arg2, arg3, arg4);
return;
case 14:
- func_800180F0(arg1, arg2, arg3, cameraId);
+ func_800180F0(camera, arg2, arg3, arg4);
return;
case 8:
- func_800188F4(arg1, arg2, arg3, cameraId);
+ func_800188F4(camera, arg2, arg3, arg4);
return;
case 12:
case 13:
- func_8001933C(arg1, arg2, arg3, cameraId);
+ func_8001933C(camera, arg2, arg3, arg4);
return;
case 15:
case 16:
- func_80019760(arg1, arg2, arg3, cameraId);
+ func_80019760(camera, arg2, arg3, arg4);
return;
default:
- func_80015390(arg1, arg2, arg3, cameraId);
+ func_80015390(camera, arg2, arg3, arg4);
return;
}
}
@@ -11531,34 +11266,23 @@ void func_8001ABEC(struct struct_801642D8 *arg0) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-s32 func_80007BF8(u16, u16, ?, ?, s32); /* extern */
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
? func_8001AB74(s32, void *, s32); /* extern */
-? func_8001ABE0(s32, void *); /* extern */
+? func_8001ABE0(s32, void *, s32 *); /* extern */
? func_8001ABEC(void *, s16); /* extern */
-s32 func_8007AF78(s16, s16, ? *); /* extern */
-? func_8009E5BC(); /* extern */
-? func_800C92CC(s32, ?, s32, void *); /* extern */
-? func_800C98B8(u16 *, u16 *, ?); /* extern */
+s32 func_8007AF78(s16, s16, s32 *); /* extern */
+? func_800C92CC(s32, ?, s32, struct Actor *); /* extern */
? func_800CAC60(s32); /* extern */
? func_800CAD40(u8, s16); /* extern */
-? func_802A1064(void *, s16); /* extern */
-? func_802B0648(void *, s32, s32, void *); /* extern */
-s16 func_802B2D70(u16 *, s16, ? *); /* extern */
-? func_802B2EBC(u16 *, s16); /* extern */
-s32 random_int(?, s16); /* extern */
-extern ? gActorList;
extern ? D_801631E0;
+extern s16 D_80163478;
extern ? D_801642D8;
-extern ? gPlayerPositions;
-extern ? gNearestWaypointByPlayerId;
-extern ? D_80164450;
-extern ? D_80164550;
-extern ? gWaypointCountByPathIndex;
+extern u16 D_801646CC;
-void func_8001AC10(s32 playerId, s32 *arg2) {
- u16 *sp2C;
- void *sp28;
+void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) {
+ Player *sp2C;
+ struct Actor *sp28;
+ Player *temp_t9;
s16 temp_a1;
s16 temp_a2;
s16 temp_v1_2;
@@ -11569,177 +11293,175 @@ void func_8001AC10(s32 playerId, s32 *arg2) {
s16 temp_v1_7;
s16 temp_v1_8;
s16 temp_v1_9;
+ s16 var_v0;
+ s32 *var_a2;
s32 temp_a0;
- s32 temp_t7;
- s32 temp_v0;
s32 temp_v1;
- u16 *temp_t9;
- u16 temp_v0_2;
- void *temp_a3;
- void *temp_a3_10;
- void *temp_a3_11;
- void *temp_a3_12;
- void *temp_a3_13;
- void *temp_a3_2;
- void *temp_a3_3;
- void *temp_a3_4;
- void *temp_a3_5;
- void *temp_a3_6;
- void *temp_a3_7;
- void *temp_a3_8;
- void *temp_a3_9;
+ s32 var_v1;
+ struct Actor *temp_a3;
+ struct Actor *temp_a3_10;
+ struct Actor *temp_a3_11;
+ struct Actor *temp_a3_12;
+ struct Actor *temp_a3_13;
+ struct Actor *temp_a3_2;
+ struct Actor *temp_a3_3;
+ struct Actor *temp_a3_4;
+ struct Actor *temp_a3_5;
+ struct Actor *temp_a3_6;
+ struct Actor *temp_a3_7;
+ struct Actor *temp_a3_8;
+ struct Actor *temp_a3_9;
+ struct TrackWayPoint *temp_v0_2;
+ u16 temp_v0;
void *temp_s0;
- void *temp_v0_3;
- s32 phi_v1;
- s16 phi_v0;
- temp_t9 = (playerId * 0xDD8) + gPlayerOne;
+ var_a2 = arg2;
+ temp_t9 = &gPlayerOne[playerId];
sp2C = temp_t9;
- if ((gModeSelection != TIME_TRIALS) && (D_801646CC != 1) && ((*temp_t9 & 0x800) == 0)) {
+ if ((gModeSelection != (s32) 1) && (D_801646CC != (u16) 1) && !(temp_t9->unk_000 & 0x800)) {
temp_s0 = (playerId * 0x10) + &D_801642D8;
temp_a1 = temp_s0->unk0;
switch (temp_a1) { /* switch 1 */
case 0: /* switch 1 */
temp_s0->unk2 = -1;
- temp_v0 = playerId * 4;
- if ((((playerId * 0x14) + 0x64) < *(&D_80164450 + temp_v0)) && (temp_s0->unk4 >= 0x259) && (temp_s0->unk6 < 3) && (temp_v1 = gLapCountByPlayerId[playerId], ((temp_v1 < 3) != 0))) {
- func_8001AB74(playerId, temp_s0, func_8007AF78(temp_v1, (&gPlayerPositions + temp_v0)->unk2, &gPlayerPositions));
+ if ((((playerId * 0x14) + 0x64) < D_80164450[playerId]) && (temp_s0->unk4 >= 0x259) && (temp_s0->unk6 < 3) && (temp_v1 = gLapCountByPlayerId[playerId], var_a2 = gPlayerPositions, ((temp_v1 < 3) != 0))) {
+ func_8001AB74(playerId, temp_s0, func_8007AF78((s16) temp_v1, gPlayerPositions[playerId].unk2, gPlayerPositions));
} else {
- func_8001ABE0(playerId, temp_s0);
+ func_8001ABE0(playerId, temp_s0, var_a2);
}
default: /* switch 1 */
-block_194:
break;
case 1: /* switch 1 */
- if ((gLapCountByPlayerId[playerId] > 0) && (temp_v1_2 = D_80163478, temp_a0 = *(&gPlayerPositions + (temp_v1_2 * 4)), ((temp_a0 < *(&gPlayerPositions + (playerId * 4))) != 0)) && (temp_a0 == 0)) {
- temp_v0_2 = sp2C->unk254;
- if (temp_v0_2 != 4) {
- if (temp_v0_2 != 6) {
- if (func_80007BF8(*(&gNearestWaypointByPlayerId + (playerId * 2)), *(&gNearestWaypointByPlayerId + (temp_v1_2 * 2)), 0xA, 2, D_80164430) > 0) {
- temp_s0->unk0 = 0x22;
- }
- } else if (func_80007BF8(*(&gNearestWaypointByPlayerId + (playerId * 2)), *(&gNearestWaypointByPlayerId + (temp_v1_2 * 2)), 4, 2, D_80164430) > 0) {
- temp_s0->unk0 = 0x22;
+ if ((gLapCountByPlayerId[playerId] > 0) && (temp_v1_2 = D_80163478, temp_a0 = gPlayerPositions[temp_v1_2], ((temp_a0 < gPlayerPositions[playerId]) != 0)) && (temp_a0 == 0)) {
+ temp_v0 = sp2C->characterId;
+ switch (temp_v0) { /* switch 3; irregular */
+ case 4: /* switch 3 */
+ if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[temp_v1_2], 0x0028U, 2U, (u16) (s32) D_80164430) > 0) {
+ temp_s0->unk0 = 0x0022;
}
- } else if (func_80007BF8(*(&gNearestWaypointByPlayerId + (playerId * 2)), *(&gNearestWaypointByPlayerId + (temp_v1_2 * 2)), 0x28, 2, D_80164430) > 0) {
- temp_s0->unk0 = 0x22;
+ break;
+ case 6: /* switch 3 */
+ if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[temp_v1_2], 4U, 2U, (u16) (s32) D_80164430) > 0) {
+ temp_s0->unk0 = 0x0022;
+ }
+ break;
+ default: /* switch 3 */
+ if (func_80007BF8(gNearestWaypointByPlayerId[playerId], gNearestWaypointByPlayerId[temp_v1_2], 0x000AU, 2U, (u16) (s32) D_80164430) > 0) {
+ temp_s0->unk0 = 0x0022;
+ }
+ break;
}
} else if (temp_a1 == 1) {
- temp_s0->unk2 = func_802B2D70(sp2C, temp_a1, &gPlayerPositions);
+ temp_s0->unk2 = func_802B2D70(sp2C);
temp_v1_3 = temp_s0->unk2;
if ((temp_v1_3 >= 0) && (temp_v1_3 < 0x64)) {
- sp2C->unkC = sp2C->unkC | 0x40000;
+ sp2C->unk_00C |= 0x40000;
temp_s0->unk0 = 2;
temp_s0->unk4 = 0;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- temp_s0->unkE = (random_int(3) * 0x14) + 0xA;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
} else {
temp_s0->unk0 = 0;
temp_s0->unk4 = 0;
}
}
- goto block_194;
+ break;
case 2: /* switch 1 */
- temp_a3 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3->unk2 & 0x8000) == 0) || (temp_a3->unk0 != 6) || (temp_a3->unk6 != 0) || (playerId != temp_a3->unk10)) {
+ temp_a3 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3->flags & 0x8000) || (temp_a3->type != 6) || (temp_a3->state != 0) || (playerId != temp_a3->rot[0])) {
temp_s0->unk0 = 0;
temp_s0->unk4 = 0;
- sp2C->unkC = sp2C->unkC & 0xFFFBFFFF;
- goto block_194;
- }
- if (temp_s0->unkE < temp_s0->unk4) {
+ sp2C->unk_00C &= 0xFFFBFFFF;
+ } else if (temp_s0->unkE < temp_s0->unk4) {
temp_s0->unk0 = 3;
- goto block_194;
}
break;
case 3: /* switch 1 */
- temp_a3_2 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_2->unk2 & 0x8000) == 0) || (temp_a3_2->unk0 != 6) || (temp_a3_2->unk6 != 0) || (playerId != temp_a3_2->unk10)) {
- if (playerId != temp_a3_2->unk10) {
+ temp_a3_2 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_2->flags & 0x8000) || (temp_a3_2->type != 6) || (temp_a3_2->state != 0) || (playerId != temp_a3_2->rot[0])) {
+ if (playerId != temp_a3_2->rot[0]) {
}
} else {
- temp_a3_2->unk6 = 1;
- temp_a3_2->unk24 = 0.0f;
- temp_a3_2->unk28 = 0.0f;
- temp_a3_2->unk2C = 0.0f;
- if (*(&D_801631E0 + (playerId * 2)) == 1) {
+ temp_a3_2->state = 1;
+ temp_a3_2->velocity[0] = 0.0f;
+ temp_a3_2->velocity[1] = 0.0f;
+ temp_a3_2->velocity[2] = 0.0f;
+ if (*(&D_801631E0 + (playerId * 2)) == (u16) 1) {
sp28 = temp_a3_2;
- temp_a3_2->unk1C = func_802AE1C0(sp2C->unk14, sp2C->unk18 + 30.0, (bitwise s16) sp2C->unk1C, (bitwise f32) temp_a3_2) + (temp_a3_2->unkC + 1.0f);
+ temp_a3_2->pos[1] = func_802AE1C0(sp2C->pos[0], (f32) ((f64) sp2C->pos[1] + 30.0), sp2C->pos[2]) + (temp_a3_2->boundingBoxSize + 1.0f);
}
}
- sp2C->unkC = sp2C->unkC & 0xFFFBFFFF;
+ sp2C->unk_00C &= 0xFFFBFFFF;
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- goto block_194;
+ break;
case 34: /* switch 1 */
- temp_s0->unk2 = func_802B2D70(sp2C, temp_a1);
+ temp_s0->unk2 = func_802B2D70(sp2C);
temp_v1_4 = temp_s0->unk2;
if ((temp_v1_4 >= 0) && (temp_v1_4 < 0x64)) {
- temp_a3_3 = (temp_v1_4 * 0x70) + &gActorList;
- temp_a3_3->unk6 = 4;
- sp2C->unkC = sp2C->unkC | 0x40000;
- temp_s0->unk0 = 0x23;
+ temp_a3_3 = &gActorList[temp_v1_4];
+ temp_a3_3->state = 4;
+ sp2C->unk_00C |= 0x40000;
+ temp_s0->unk0 = 0x0023;
temp_s0->unk4 = 0;
- temp_s0->unk6 = temp_s0->unk6 + 1;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
temp_a2 = D_80163478;
- temp_t7 = temp_a2 * 2;
- temp_v0_3 = (((*(&gNearestWaypointByPlayerId + temp_t7) + 0x1E) % *(&gWaypointCountByPathIndex + ((&gPathIndexByPlayerId)[temp_a2] * 2))) * 8) + *(&D_80164550 + (gPathIndexByPlayerId * 4));
- temp_a3_3->unk24 = (temp_v0_3->unk0 - sp2C->unk14) / 20.0;
- temp_a3_3->unk28 = ((temp_v0_3->unk2 - sp2C->unk18) / 20.0) + 4.0;
- temp_a3_3->unk2C = (temp_v0_3->unk4 - sp2C->unk1C) / 20.0;
- temp_a3_3->unk1C = sp2C->unk18;
- func_800C92CC(playerId & 0xFF, 0x29008009, temp_t7, temp_a3_3);
- func_800C98B8(sp2C + 0x14, sp2C + 0x34, 0x19018014);
+ temp_v0_2 = &D_80164550[*gPathIndexByPlayerId][(s32) (gNearestWaypointByPlayerId[temp_a2] + 0x1E) % (s32) gWaypointCountByPathIndex[gPathIndexByPlayerId[temp_a2]]];
+ temp_a3_3->velocity[0] = (f32) ((f64) ((f32) temp_v0_2->wayPointX - sp2C->pos[0]) / 20.0);
+ temp_a3_3->velocity[1] = (f32) (((f64) ((f32) temp_v0_2->wayPointY - sp2C->pos[1]) / 20.0) + 4.0);
+ temp_a3_3->velocity[2] = (f32) ((f64) ((f32) temp_v0_2->wayPointZ - sp2C->pos[2]) / 20.0);
+ temp_a3_3->pos[1] = sp2C->pos[1];
+ func_800C92CC(playerId & 0xFF, 0x29008009, temp_a2 * 2, temp_a3_3);
+ func_800C98B8(sp2C->pos, sp2C->unk_034, 0x19018014U);
} else {
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
}
- goto block_194;
+ break;
case 35: /* switch 1 */
- temp_a3_4 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_4->unk2 & 0x8000) == 0) || (temp_a3_4->unk0 != 6) || (temp_a3_4->unk6 != 4) || (playerId != temp_a3_4->unk10)) {
+ temp_a3_4 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_4->flags & 0x8000) || (temp_a3_4->type != 6) || (temp_a3_4->state != 4) || (playerId != temp_a3_4->rot[0])) {
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- sp2C->unkC = sp2C->unkC & 0xFFFBFFFF;
- goto block_194;
- }
- temp_a3_4->unk18 = temp_a3_4->unk18 + temp_a3_4->unk24;
- temp_a3_4->unk28 = temp_a3_4->unk28 - 0.4;
- temp_a3_4->unk20 = temp_a3_4->unk20 + temp_a3_4->unk2C;
- temp_a3_4->unk1C = temp_a3_4->unk1C + temp_a3_4->unk28;
- if (temp_s0->unk4 >= 0x15) {
- temp_s0->unk0 = 0x24;
- goto block_194;
+ sp2C->unk_00C &= 0xFFFBFFFF;
+ } else {
+ temp_a3_4->pos[0] += temp_a3_4->velocity[0];
+ temp_a3_4->velocity[1] = (f32) ((f64) temp_a3_4->velocity[1] - 0.4);
+ temp_a3_4->pos[2] += temp_a3_4->velocity[2];
+ temp_a3_4->pos[1] += temp_a3_4->velocity[1];
+ if (temp_s0->unk4 >= 0x15) {
+ temp_s0->unk0 = 0x0024;
+ }
}
break;
case 36: /* switch 1 */
- temp_a3_5 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_5->unk2 & 0x8000) == 0) || (temp_a3_5->unk0 != 6) || (temp_a3_5->unk6 != 4) || (playerId != temp_a3_5->unk10)) {
- if (playerId != temp_a3_5->unk10) {
+ temp_a3_5 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_5->flags & 0x8000) || (temp_a3_5->type != 6) || (temp_a3_5->state != 4) || (playerId != temp_a3_5->rot[0])) {
+ if (playerId != temp_a3_5->rot[0]) {
}
} else {
- temp_a3_5->unk6 = 1;
- temp_a3_5->unk24 = 0.0f;
- temp_a3_5->unk28 = 0.0f;
- temp_a3_5->unk2C = 0.0f;
+ temp_a3_5->state = 1;
+ temp_a3_5->velocity[0] = 0.0f;
+ temp_a3_5->velocity[1] = 0.0f;
+ temp_a3_5->velocity[2] = 0.0f;
sp28 = temp_a3_5;
- temp_a3_5->unk1C = func_802AE1C0(temp_a3_5->unk18, temp_a3_5->unk1C + 30.0, temp_a3_5->unk20, (bitwise f32) temp_a3_5) + (temp_a3_5->unkC + 1.0f);
+ temp_a3_5->pos[1] = func_802AE1C0(temp_a3_5->pos[0], (f32) ((f64) temp_a3_5->pos[1] + 30.0), temp_a3_5->pos[2]) + (temp_a3_5->boundingBoxSize + 1.0f);
}
- sp2C->unkC = sp2C->unkC & 0xFFFBFFFF;
+ sp2C->unk_00C &= 0xFFFBFFFF;
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- goto block_194;
+ break;
case 4: /* switch 1 */
- if (gNumActors < 0x50) {
- temp_s0->unk2 = func_802B1C9C(sp2C, temp_a1);
+ if ((s32) gNumActors < 0x50) {
+ temp_s0->unk2 = func_802B1C9C(sp2C);
temp_v1_5 = temp_s0->unk2;
if ((temp_v1_5 >= 0) && (temp_v1_5 < 0x64)) {
temp_s0->unk0 = 5;
temp_s0->unk4 = 0;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- temp_s0->unkE = (random_int(3) * 0x14) + 0xA;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
} else {
goto block_71;
}
@@ -11747,40 +11469,37 @@ block_194:
block_71:
temp_s0->unk0 = 0;
}
- goto block_194;
+ break;
case 5: /* switch 1 */
- temp_a3_6 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_6->unk2 & 0x8000) == 0) || (temp_a3_6->unk0 != 7) || (temp_a3_6->unk6 != 0) || (playerId != temp_a3_6->unk14)) {
+ temp_a3_6 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_6->flags & 0x8000) || (temp_a3_6->type != 7) || (temp_a3_6->state != 0) || (playerId != temp_a3_6->rot[2])) {
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- goto block_194;
- }
- if (temp_s0->unkE < temp_s0->unk4) {
+ } else if (temp_s0->unkE < temp_s0->unk4) {
temp_s0->unk4 = 0;
temp_s0->unk0 = 6;
- goto block_194;
}
break;
case 6: /* switch 1 */
- temp_a3_7 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_7->unk2 & 0x8000) == 0) || (temp_a3_7->unk0 != 7) || (temp_a3_7->unk6 != 0) || (playerId != temp_a3_7->unk14)) {
+ temp_a3_7 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_7->flags & 0x8000) || (temp_a3_7->type != 7) || (temp_a3_7->state != 0) || (playerId != temp_a3_7->rot[2])) {
temp_s0->unk0 = 0;
temp_s0->unk4 = 0;
} else {
- temp_a3_7->unk6 = 1;
+ temp_a3_7->state = 1;
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
}
- goto block_194;
+ break;
case 7: /* switch 1 */
- if (gNumActors < 0x50) {
- temp_s0->unk2 = func_802B1E48(sp2C, temp_a1);
+ if ((s32) gNumActors < 0x50) {
+ temp_s0->unk2 = func_802B1E48(sp2C);
temp_v1_6 = temp_s0->unk2;
if ((temp_v1_6 >= 0) && (temp_v1_6 < 0x64)) {
temp_s0->unk0 = 8;
temp_s0->unk4 = 0;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- temp_s0->unkE = (random_int(3) * 0x14) + 0xA;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
} else {
goto block_92;
}
@@ -11788,40 +11507,37 @@ block_71:
block_92:
temp_s0->unk0 = 0;
}
- goto block_194;
+ break;
case 8: /* switch 1 */
- temp_a3_8 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_8->unk2 & 0x8000) == 0) || (temp_a3_8->unk0 != 8) || (temp_a3_8->unk6 != 0) || (playerId != temp_a3_8->unk14)) {
+ temp_a3_8 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_8->flags & 0x8000) || (temp_a3_8->type != 8) || (temp_a3_8->state != 0) || (playerId != temp_a3_8->rot[2])) {
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- goto block_194;
- }
- if (temp_s0->unkE < temp_s0->unk4) {
+ } else if (temp_s0->unkE < temp_s0->unk4) {
temp_s0->unk0 = 9;
- goto block_194;
}
break;
case 9: /* switch 1 */
func_8001ABEC(temp_s0, temp_a1);
- temp_a3_9 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_9->unk2 & 0x8000) == 0) || (temp_a3_9->unk0 != 8) || (temp_a3_9->unk6 != 0) || (playerId != temp_a3_9->unk14)) {
+ temp_a3_9 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_9->flags & 0x8000) || (temp_a3_9->type != 8) || (temp_a3_9->state != 0) || (playerId != temp_a3_9->rot[2])) {
temp_s0->unk0 = 0;
temp_s0->unk4 = 0;
} else {
- temp_a3_9->unk6 = 1;
+ temp_a3_9->state = 1;
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
}
- goto block_194;
+ break;
case 10: /* switch 1 */
- if (gNumActors < 0x50) {
- temp_s0->unk2 = func_802B17F4(sp2C, temp_a1);
+ if ((s32) gNumActors < 0x50) {
+ temp_s0->unk2 = func_802B17F4(sp2C);
temp_v1_7 = temp_s0->unk2;
if ((temp_v1_7 >= 0) && (temp_v1_7 < 0x64)) {
- temp_s0->unk0 = 0xB;
+ temp_s0->unk0 = 0x000B;
temp_s0->unk4 = 0;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- temp_s0->unkE = (random_int(3) * 0x14) + 0x3C;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0x3C);
} else {
goto block_113;
}
@@ -11829,49 +11545,49 @@ block_92:
block_113:
temp_s0->unk0 = 0;
}
- goto block_194;
+ break;
case 11: /* switch 1 */
- temp_a3_10 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (temp_a3_10->unk6 == 6) {
- phi_v1 = 0;
+ temp_a3_10 = &gActorList[temp_s0->unk2];
+ if (temp_a3_10->state == 6) {
+ var_v1 = 0;
if (temp_a3_10->unk1A != -1) {
- phi_v1 = 1;
+ var_v1 = 1;
}
if (temp_a3_10->unk18 != -1) {
- phi_v1 = 1;
+ var_v1 = 1;
}
- if (temp_a3_10->unk16 != -1) {
- phi_v1 = 1;
+ if (temp_a3_10->unk_16 != -1) {
+ var_v1 = 1;
}
- if (temp_a3_10->unk14 != -1) {
- phi_v1 = 1;
+ if (temp_a3_10->rot[2] != -1) {
+ var_v1 = 1;
}
- if (temp_a3_10->unk12 != -1) {
- phi_v1 = 1;
+ if (temp_a3_10->rot[1] != -1) {
+ var_v1 = 1;
}
- if ((temp_a3_10->unk0 != 0xE) || (phi_v1 == 0)) {
+ if ((temp_a3_10->type != 0x000E) || (var_v1 == 0)) {
temp_s0->unk0 = 0;
goto block_131;
}
if (temp_s0->unkE < temp_s0->unk4) {
- temp_s0->unk0 = 0xC;
+ temp_s0->unk0 = 0x000C;
temp_s0->unk8 = 0;
block_131:
temp_s0->unk4 = 0;
}
}
- goto block_194;
+ break;
case 12: /* switch 1 */
- if ((temp_s0->unk4 % 10) == 0) {
+ if (((s16) temp_s0->unk4 % 10) == 0) {
temp_v1_8 = temp_s0->unk8;
if (temp_v1_8 < 5) {
- temp_a3_11 = (temp_s0->unk2 * 0x70) + &gActorList;
- phi_v0 = 0;
+ var_v0 = 0;
+ temp_a3_11 = &gActorList[temp_s0->unk2];
switch (temp_v1_8) { /* switch 2 */
case 0: /* switch 2 */
if (temp_a3_11->unk1A != -1) {
block_146:
- phi_v0 = 1;
+ var_v0 = 1;
}
break;
case 1: /* switch 2 */
@@ -11880,143 +11596,136 @@ block_146:
}
break;
case 2: /* switch 2 */
- if (temp_a3_11->unk16 != -1) {
+ if (temp_a3_11->unk_16 != -1) {
goto block_146;
}
break;
case 3: /* switch 2 */
- if (temp_a3_11->unk14 != -1) {
+ if (temp_a3_11->rot[2] != -1) {
goto block_146;
}
break;
case 4: /* switch 2 */
- if (temp_a3_11->unk12 != -1) {
+ if (temp_a3_11->rot[1] != -1) {
goto block_146;
}
break;
}
- if ((temp_a3_11->unk0 == 0xE) && (temp_a3_11->unk6 == 6) && (phi_v0 == 1)) {
- func_802B0648(temp_a3_11, 0xE, 6, temp_a3_11);
+ if ((temp_a3_11->type == 0x000E) && (temp_a3_11->state == 6) && (var_v0 == 1)) {
+ func_802B0648((struct BananaBunchParent *) temp_a3_11);
}
- temp_s0->unk8 = temp_s0->unk8 + 1;
+ temp_s0->unk8 = (s16) (temp_s0->unk8 + 1);
} else {
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
}
- goto block_194;
}
break;
case 13: /* switch 1 */
- temp_s0->unk2 = func_802B2C40(sp2C, temp_a1);
+ temp_s0->unk2 = func_802B2C40(sp2C);
temp_v1_9 = temp_s0->unk2;
if ((temp_v1_9 >= 0) && (temp_v1_9 < 0x64)) {
- temp_s0->unk0 = 0xE;
+ temp_s0->unk0 = 0x000E;
temp_s0->unk4 = 0;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- temp_s0->unkE = (random_int(3, 0xE) * 0x14) + 0xA;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA);
} else {
temp_s0->unk0 = 0;
}
- goto block_194;
+ break;
case 14: /* switch 1 */
- temp_a3_12 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_12->unk2 & 0x8000) == 0) || (temp_a3_12->unk0 != 0xD) || (temp_a3_12->unk6 != 0) || (playerId != temp_a3_12->unk24)) {
+ temp_a3_12 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_12->flags & 0x8000) || (temp_a3_12->type != 0x000D) || (temp_a3_12->state != 0) || (playerId != (s32) temp_a3_12->velocity[0])) {
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- goto block_194;
- }
- if (temp_s0->unkE < temp_s0->unk4) {
- temp_s0->unk0 = 0xF;
- goto block_194;
+ } else if (temp_s0->unkE < temp_s0->unk4) {
+ temp_s0->unk0 = 0x000F;
}
break;
case 15: /* switch 1 */
- temp_a3_13 = (temp_s0->unk2 * 0x70) + &gActorList;
- if (((temp_a3_13->unk2 & 0x8000) == 0) || (temp_a3_13->unk0 != 0xD) || (temp_a3_13->unk6 != 0) || (playerId != temp_a3_13->unk24)) {
- if (playerId != temp_a3_13->unk10) {
+ temp_a3_13 = &gActorList[temp_s0->unk2];
+ if (!(temp_a3_13->flags & 0x8000) || (temp_a3_13->type != 0x000D) || (temp_a3_13->state != 0) || (playerId != (s32) temp_a3_13->velocity[0])) {
+ if (playerId != temp_a3_13->rot[0]) {
}
} else {
sp28 = temp_a3_13;
- func_802A1064(temp_a3_13, temp_a1);
+ func_802A1064((struct FakeItemBox *) temp_a3_13);
if (*(&D_801631E0 + (playerId * 2)) == 1) {
sp28 = temp_a3_13;
- temp_a3_13->unk1C = func_802AE1C0(temp_a3_13->unk18, temp_a3_13->unk1C + 30.0, temp_a3_13->unk20, (bitwise f32) temp_a3_13) + temp_a3_13->unkC;
+ temp_a3_13->pos[1] = func_802AE1C0(temp_a3_13->pos[0], (f32) ((f64) temp_a3_13->pos[1] + 30.0), temp_a3_13->pos[2]) + temp_a3_13->boundingBoxSize;
}
}
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- goto block_194;
+ break;
case 22: /* switch 1 */
- func_802B2EBC(sp2C, temp_a1);
+ func_802B2EBC(sp2C);
func_800CAC60(playerId & 0xFF);
func_8009E5BC();
temp_s0->unk4 = 0;
- temp_s0->unk0 = 0x17;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- goto block_194;
+ temp_s0->unk0 = 0x0017;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ break;
case 23: /* switch 1 */
if (temp_s0->unk4 >= 0xF1) {
- func_800CAD40(playerId, temp_a1);
+ func_800CAD40((u8) playerId, temp_a1);
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- goto block_194;
}
break;
case 25: /* switch 1 */
- sp2C->unkC = sp2C->unkC | 0x2000;
+ sp2C->unk_00C |= 0x2000;
temp_s0->unk4 = 0;
- temp_s0->unk0 = 0x1A;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- goto block_194;
+ temp_s0->unk0 = 0x001A;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ break;
case 26: /* switch 1 */
- if ((sp2C->unkBC & 0x200) == 0) {
+ if (!(sp2C->unk_0BC & 0x200)) {
temp_s0->unk0 = 0;
}
temp_s0->unk4 = 0;
- goto block_194;
+ break;
case 27: /* switch 1 */
- sp2C->unkC = sp2C->unkC | 0x800;
+ sp2C->unk_00C |= 0x800;
temp_s0->unk4 = 0;
- temp_s0->unk0 = 0x1C;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- goto block_194;
+ temp_s0->unk0 = 0x001C;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ break;
case 28: /* switch 1 */
- if ((sp2C->unkBC << 0) >= 0) {
+ if ((sp2C->unk_0BC << 0) >= 0) {
temp_s0->unk0 = 0;
}
temp_s0->unk4 = 0;
- goto block_194;
+ break;
case 29: /* switch 1 */
- sp2C->unkC = sp2C->unkC | 0x200;
+ sp2C->unk_00C |= 0x200;
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
- temp_s0->unk6 = temp_s0->unk6 + 1;
- goto block_194;
+ temp_s0->unk6 = (s16) (temp_s0->unk6 + 1);
+ break;
case 30: /* switch 1 */
if (temp_s0->unk4 >= 0x3D) {
- sp2C->unkC = sp2C->unkC | 0x200;
+ sp2C->unk_00C |= 0x200;
temp_s0->unk4 = 0;
- temp_s0->unk0 = 0x1D;
- goto block_194;
+ temp_s0->unk0 = 0x001D;
}
break;
case 31: /* switch 1 */
if (temp_s0->unk4 >= 0x3D) {
- sp2C->unkC = sp2C->unkC | 0x200;
+ sp2C->unk_00C |= 0x200;
temp_s0->unk4 = 0;
- temp_s0->unk0 = 0x1E;
- goto block_194;
+ temp_s0->unk0 = 0x001E;
}
break;
case 32: /* switch 1 */
temp_s0->unk4 = 0;
- temp_s0->unk0 = 0x21;
- temp_s0->unkE = 0x258;
- goto block_194;
+ temp_s0->unk0 = 0x0021;
+ temp_s0->unkE = 0x0258;
+ break;
case 33: /* switch 1 */
- if ((temp_s0->unk4 % 60) == 0) {
- sp2C->unkC = sp2C->unkC | 0x200;
+ if (((s16) temp_s0->unk4 % 60) == 0) {
+ sp2C->unk_00C |= 0x200;
if (temp_s0->unkE < temp_s0->unk4) {
temp_s0->unk4 = 0;
temp_s0->unk0 = 0;
@@ -12025,9 +11734,9 @@ block_146:
break;
}
if (temp_s0->unk4 < 0x2710) {
- temp_s0->unk4 = temp_s0->unk4 + 1;
+ temp_s0->unk4 = (s16) (temp_s0->unk4 + 1);
}
- if ((sp2C->unkBC & 0x80002200) != 0) {
+ if (sp2C->unk_0BC & 0x80002200) {
temp_s0->unk4 = 0;
}
}
@@ -12037,81 +11746,72 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001AC10.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_8003680C(void *, ?); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8000F628(); /* extern */
+? func_8003680C(void *, ?); /* extern */
extern ? D_80163410;
extern ? D_801634F8;
-extern u16 gNearestWaypointByPlayerId;
-extern s16 *D_80164590;
-extern s16 gPathIndexByPlayerId;
void func_8001BE78(void) {
? *sp54;
- ? *temp_v0;
- s16 temp_s2;
- void *temp_s0;
+ ? *var_s4;
+ ? *var_v0;
+ s32 var_s5;
+ struct TrackWayPoint **var_s7;
+ struct TrackWayPoint *temp_s0;
+ u16 **var_fp;
+ u16 *var_s3;
+ u16 *var_s6;
+ u16 var_s2;
void *temp_s1;
- s32 phi_s5;
- s16 phi_s2;
- s16 *phi_s6;
- ? *phi_s4;
- u16 *phi_s3;
- s16 **phi_s7;
- ? *phi_v0;
- s16 **phi_fp;
func_8000F628();
- phi_s5 = 0;
- phi_s2 = 0;
- phi_s6 = &gPathIndexByPlayerId;
- phi_s4 = &D_801634F8;
- phi_s3 = &gNearestWaypointByPlayerId;
- phi_s7 = &D_80164550;
- phi_v0 = &D_80163410;
- phi_fp = &D_80164590;
+ var_v0 = &D_80163410;
+ var_fp = D_80164590;
+ var_s7 = D_80164550;
+ var_s3 = gNearestWaypointByPlayerId;
+ var_s4 = &D_801634F8;
+ var_s6 = gPathIndexByPlayerId;
+ var_s2 = 0;
+ var_s5 = 0;
do {
- temp_s1 = phi_s5 + gPlayerOne;
- temp_s1->unk0 = temp_s1->unk0 & 0xDFFF;
- *phi_s6 = phi_s2;
- phi_s4->unkC = 0.0f;
- phi_s4->unk4 = 0.0f;
- phi_s4->unk0 = 0.0f;
- if (phi_s2 != 0) {
- if (phi_s2 != 1) {
- if (phi_s2 != 2) {
- if (phi_s2 != 3) {
-
- } else {
- *phi_s3 = 1;
- }
- } else {
- *phi_s3 = 6;
- }
- } else {
- *phi_s3 = 1;
- }
- } else {
- *phi_s3 = 6;
- }
- temp_s0 = (*phi_s3 * 8) + *phi_s7;
- temp_s1->unk14 = temp_s0->unk0;
- sp54 = phi_v0;
- temp_s1->unk18 = func_802AE1C0(temp_s0->unk0, 2000.0f, temp_s0->unk4) + temp_s1->unk70;
- temp_s1->unk1C = temp_s0->unk4;
- temp_s1->unk2E = **phi_fp;
+ temp_s1 = var_s5 + gPlayerOne;
+ temp_s1->unk0 = (u16) (temp_s1->unk0 & 0xDFFF);
+ *var_s6 = var_s2;
+ var_s4->unkC = 0.0f;
+ var_s4->unk4 = 0.0f;
+ var_s4->unk0 = 0.0f;
+ switch (var_s2) { /* irregular */
+ case 0:
+ *var_s3 = 6;
+ break;
+ case 1:
+ *var_s3 = 1;
+ break;
+ case 2:
+ *var_s3 = 6;
+ break;
+ case 3:
+ *var_s3 = 1;
+ break;
+ }
+ temp_s0 = &(*var_s7)[*var_s3];
+ temp_s1->unk14 = (f32) temp_s0->wayPointX;
+ sp54 = var_v0;
+ temp_s1->unk18 = (f32) (func_802AE1C0((f32) temp_s0->wayPointX, 2000.0f, (f32) temp_s0->wayPointZ) + temp_s1->unk70);
+ temp_s1->unk1C = (f32) temp_s0->wayPointZ;
+ temp_s1->unk2E = (s16) **var_fp;
func_8003680C(temp_s1, 0);
- temp_s2 = phi_s2 + 1;
- temp_v0 = phi_v0 + 2;
- temp_v0->unk-2 = 0;
- phi_s5 += 0xDD8;
- phi_s2 = temp_s2;
- phi_s6 += 2;
- phi_s4 += 0x10;
- phi_s3 += 2;
- phi_s7 += 4;
- phi_v0 = temp_v0;
- phi_fp += 4;
- } while (temp_s2 != 4);
+ var_s2 += 1;
+ var_s5 += 0xDD8;
+ var_s6 += 2;
+ var_s4 += 0x10;
+ var_s3 += 2;
+ var_s7 += 4;
+ var_fp += 4;
+ var_v0 += 2;
+ var_v0->unk-2 = 0;
+ } while (var_s2 != 4);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001BE78.s")
diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h
index e1cc26261..2c069f53f 100644
--- a/src/code_80005FD0.h
+++ b/src/code_80005FD0.h
@@ -41,7 +41,8 @@ f32 func_80010FA0(f32, f32, f32, s32);
s32 process_path_data(struct TrackWayPoint*, struct TrackWayPoint*);
f32 func_80013C74(s16, s16);
f32 func_800145A8(s16, f32, s16);
-void func_8001968C(void);
+void func_80014D30(s32, s32);
+void func_8001968C();
/* This is where I'd put my static data, if I had any */
// Might belong in menus.h?
diff --git a/src/code_8001F980.c b/src/code_8001F980.c
index 4a3c8883f..d111b58a6 100644
--- a/src/code_8001F980.c
+++ b/src/code_8001F980.c
@@ -963,32 +963,25 @@ void func_80022180(Mtx *arg0, Mat4 arg1) {
arg0->m[3][3] = ((s32) (arg1[3][2] * someMultiplier) << 0x10) | ((s32) (arg1[3][3] * someMultiplier) & 0xFFFF);
}
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800224F0(s16 *arg0, s16 arg1, s16 arg2) {
+s32 func_800224F0(s16 *arg0, s16 arg1, s16 arg2) {
s16 temp_v0;
- s16 temp_v0_2;
- s16 temp_v0_3;
- s16 phi_a2;
temp_v0 = arg1 - *arg0;
- phi_a2 = arg2;
if (arg2 < 0) {
- phi_a2 = arg2 * -1;
+ arg2 *= -1;
}
if (temp_v0 > 0) {
- temp_v0_2 = temp_v0 - phi_a2;
- if (temp_v0_2 >= 0) {
- *arg0 = arg1 - temp_v0_2;
+ temp_v0 -= arg2;
+ if (temp_v0 >= 0) {
+ *arg0 = arg1 - temp_v0;
} else {
- goto block_8;
+ *arg0 = arg1;
}
} else {
- temp_v0_3 = temp_v0 + phi_a2;
- if (temp_v0_3 <= 0) {
- *arg0 = arg1 - temp_v0_3;
+ temp_v0 += arg2;
+ if (temp_v0 <= 0) {
+ *arg0 = arg1 - temp_v0;
} else {
-block_8:
*arg0 = arg1;
}
}
@@ -997,9 +990,6 @@ block_8:
}
return 1;
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_8001F980/func_800224F0.s")
-#endif
void move_s32_towards(s32 *startingValue, s32 targetValue, f32 somePercent) {
*startingValue -= ((*startingValue - targetValue) * somePercent);
diff --git a/src/code_8001F980.h b/src/code_8001F980.h
index 6eda06b69..4e7d88828 100644
--- a/src/code_8001F980.h
+++ b/src/code_8001F980.h
@@ -19,6 +19,7 @@ void func_80021DA8();
void func_80021F84(Mat4, f32);
void func_80021FF8(Mtx*, Mat4);
void func_80022180(Mtx*, Mat4);
+s32 func_800224F0(s16*, s16, s16);
void move_s32_towards(s32*, s32, f32);
void move_f32_towards(f32*, f32, f32);
void move_s16_towards(s16*, s16, f32);
diff --git a/src/code_80027D00.c b/src/code_80027D00.c
index 5a0f8fb0b..0b490da9e 100644
--- a/src/code_80027D00.c
+++ b/src/code_80027D00.c
@@ -2815,19 +2815,16 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002CD48.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800224F0(void *, ?, ?); // extern
-? func_8003680C(f32, void *, s16, s32, s32); // extern
-s32 func_802B5224(s32, f32 *, s32, s32); // extern
+//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
+? func_8003680C(f32, Player *, s16, s16, s32); /* extern */
-void func_8002D028(void *arg0, s8 arg1) {
+void func_8002D028(Player *player, s8 arg1) {
f32 sp54;
f32 sp50;
f32 sp4C;
s16 sp46;
s32 sp34;
s16 *sp2C;
- f32 *temp_a1;
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f2;
@@ -2835,59 +2832,54 @@ void func_8002D028(void *arg0, s8 arg1) {
s16 temp_v0;
s16 temp_v1;
s16 temp_v1_2;
- s32 temp_a3;
+ s16 var_a2;
s32 temp_f18;
s32 temp_f8;
s32 temp_t1;
- s32 phi_a2;
- s32 phi_a2_2;
- temp_a3 = arg1 * 2;
temp_v0 = D_80165270[arg1];
- temp_a1 = &sp4C;
- sp34 = temp_a3;
+ sp34 = arg1 * 2;
sp4C = D_80165210[temp_v0];
sp50 = 0.0f;
sp54 = D_80165230[temp_v0];
temp_f0 = 8.0f * 182.0f;
- temp_v1 = -func_802B5224(arg0 + 0x14, temp_a1, arg1 << 0x18, temp_a3) - arg0->unk2E;
- temp_f8 = temp_f0;
- temp_f18 = -8.0f * 182.0f;
- phi_a2 = temp_v1;
- if (temp_f8 < temp_v1) {
- phi_a2 = temp_f8;
- }
- phi_a2_2 = phi_a2;
- if (phi_a2 < temp_f18) {
- phi_a2_2 = temp_f18;
- }
- temp_v0_2 = &D_80165020[arg1];
+ temp_v1 = -func_802B5224(player->pos, &sp4C) - player->unk_02E;
+ temp_f8 = (s32) temp_f0;
+ var_a2 = temp_v1;
+ temp_f18 = (s32) (-8.0f * 182.0f);
+ if ((s16) temp_f8 < temp_v1) {
+ var_a2 = (s16) temp_f8;
+ }
+ if (var_a2 < (s16) temp_f18) {
+ var_a2 = (s16) temp_f18;
+ }
+ temp_v0_2 = sp34 + D_80165020;
sp2C = temp_v0_2;
- temp_t1 = (*temp_v0_2 + ((phi_a2_2 * 0x35) / temp_f0)) / 2;
- sp46 = temp_t1;
- func_8003680C(182.0f, arg0, temp_t1, phi_a2_2, temp_a3);
- *temp_v0_2 = temp_t1;
- temp_f0_2 = sp54 - arg0->unk1C;
- temp_f2 = sp4C - arg0->unk14;
+ temp_t1 = (s32) (*temp_v0_2 + (s16) (s32) ((f32) (var_a2 * 0x35) / temp_f0)) / 2;
+ sp46 = (s16) temp_t1;
+ func_8003680C(182.0f, player, (s16) temp_t1, var_a2, sp34);
+ *temp_v0_2 = (s16) temp_t1;
+ temp_f0_2 = sp54 - player->pos[2];
+ temp_f2 = sp4C - player->pos[0];
if (sqrtf((temp_f0_2 * temp_f0_2) + (temp_f2 * temp_f2)) <= 8.0f) {
- func_800224F0(arg0 + 0x2E, -0x8000, 0x16C);
- temp_v1_2 = arg0->unk2E;
+ func_800224F0(&player->unk_02E, -0x8000, 0x016C);
+ temp_v1_2 = player->unk_02E;
if ((temp_v1_2 < -0x7F41) || (temp_v1_2 >= 0x7F42)) {
- arg0->unk0 = arg0->unk0 & 0xFDFF;
- }
- arg0->unk8C = 0.0f;
- arg0->unk94 = 0.0f;
- arg0->unk104 = 0.0f;
- arg0->unk240 = 0;
- arg0->unk7C = 0;
- arg0->unk34 = 0.0f;
- arg0->unk38 = 0.0f;
- arg0->unk3C = 0.0f;
- arg0->unkC0 = 0;
- arg0->unk78 = 0;
+ player->unk_000 &= 0xFDFF;
+ }
+ player->unk_08C = 0.0f;
+ player->unk_094 = 0.0f;
+ player->unk_104 = 0.0f;
+ player->unk_240 = 0;
+ player->unk_07C = 0;
+ player->unk_034[0] = 0.0f;
+ player->unk_034[1] = 0.0f;
+ player->unk_034[2] = 0.0f;
+ player->unk_0C0 = 0;
+ player->unk_078 = 0;
return;
}
- arg0->unk8C = 1200.0f;
+ player->unk_08C = 1200.0f;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002D028.s")
diff --git a/src/code_80280000.c b/src/code_80280000.c
index e83c26a6d..83430580e 100644
--- a/src/code_80280000.c
+++ b/src/code_80280000.c
@@ -5,12 +5,11 @@
#include "main.h"
#include "types.h"
+#include "camera.h"
#include "code_80281780.h"
extern Gfx *gDisplayListHead;
-extern Camera cameras[];//, *camera1, *camera2, *camera3, *camera4;
-
extern f32 D_80150148, D_8015014C, D_80150150;
extern f32 D_80150130[4];
extern s16 gCreditsCourseId;
@@ -54,7 +53,7 @@ void func_80280038(void) {
guPerspective(&gGfxPool->mtxPool[1], &sp44[37], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp44[37]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
gCurrentCourseId = gCreditsCourseId;
mtxf_identity(&sp44);
@@ -99,12 +98,12 @@ void func_802802AC(void) {
D_802874FC = 0;
func_80283648(camera);
- temp_f12 = camera->unk - camera->pos[0];
- temp = camera->unk1 - camera->pos[1];
- temp_f14 = camera->unk2 - camera->pos[2];
- camera->rotX[1] = atan2s(temp_f12, temp_f14);
- camera->rotX[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), temp);
- camera->rotX[2] = 0;
+ temp_f12 = camera->lookAt[0] - camera->pos[0];
+ temp = camera->lookAt[1] - camera->pos[1];
+ temp_f14 = camera->lookAt[2] - camera->pos[2];
+ camera->rot[1] = atan2s(temp_f12, temp_f14);
+ camera->rot[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), temp);
+ camera->rot[2] = 0;
if (D_802874A0 != 0) {
D_800DC5E4++;
} else {
@@ -124,7 +123,7 @@ void func_80280420(void) {
D_800DC518 = 1;
func_802A4D18();
func_802A74BC();
- camera->unk30 = 60.0f;
+ camera->unk_B4 = 60.0f;
D_80150130[0] = 60.0f;
D_800DC5EC->screenWidth = 320;
D_800DC5EC->screenHeight = 240;
@@ -152,12 +151,12 @@ void func_80280420(void) {
camera->pos[0] = 1400.0f;
camera->pos[1] = 300.0f;
camera->pos[2] = 1400.0f;
- camera->unk = 0.0f;
- camera->unk1 = 0.0f;
- camera->unk2 = 0.0f;
- camera->angleX = 0.0f;
- camera->angleY = 1.0f;
- camera->angleZ = 0.0f;
+ camera->lookAt[0] = 0.0f;
+ camera->lookAt[1] = 0.0f;
+ camera->lookAt[2] = 0.0f;
+ camera->up[0] = 0.0f;
+ camera->up[1] = 1.0f;
+ camera->up[2] = 0.0f;
func_80283430();
func_80003040();
func_8006E9C0();
diff --git a/src/code_80281780.c b/src/code_80281780.c
index 5b638859c..352154834 100644
--- a/src/code_80281780.c
+++ b/src/code_80281780.c
@@ -97,7 +97,7 @@ void load_ending_sequence_royalraceway(void) {
D_80287554 = 0;
func_802A4D18();
func_802A74BC();
- camera->unk30 = 60.0f;
+ camera->unk_B4 = 60.0f;
D_80150130[0] = 60.0f;
D_800DC5EC->screenWidth = SCREEN_WIDTH;
D_800DC5EC->screenHeight = SCREEN_HEIGHT;
diff --git a/src/code_80281C40.c b/src/code_80281C40.c
index a899f9844..01c2f7bea 100644
--- a/src/code_80281C40.c
+++ b/src/code_80281C40.c
@@ -21,8 +21,6 @@ extern u16 gIsInQuitToMenuTransition;
extern Gfx D_00284F70[];
extern Gfx D_00284EE0[];
-extern Camera cameras[];
-
extern f32 D_80150148, D_8015014C, D_80150150;
extern f32 D_80150130[];
@@ -66,7 +64,7 @@ void func_80281D00(void) {
guPerspective((Mtx*) &gGfxPool->mtxPool[1], &sp64[39], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp64[39]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt((Mtx*) &gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt((Mtx*) &gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
mtxf_identity(&sp64[6]);
func_802B4FF8(&sp64[6], 0);
diff --git a/src/main.c b/src/main.c
index 198570115..abf1f7729 100644
--- a/src/main.c
+++ b/src/main.c
@@ -611,7 +611,7 @@ void func_8000142C(void) {
D_800DC514 = 0;
}
- temp_v0 = camera1->rotX[1];
+ temp_v0 = camera1->rot[1];
D_801625E8 = D_800DC5EC->pathCounter;
if (temp_v0 < 0x2000) {
func_80057A50(40, 100, "SOUTH ", D_801625E8);
diff --git a/src/math_util.h b/src/math_util.h
index 58009f8b8..eb1dc4a70 100644
--- a/src/math_util.h
+++ b/src/math_util.h
@@ -49,6 +49,7 @@ s16 func_802B7D28(f32);
u16 random_u16();
u16 random_int(u16);
s16 func_802B7F34(f32, f32, f32, f32);
+void func_802B7F7C(Vec3f, Vec3f, Vec3s);
f32 sins(u16);
f32 coss(u16);
diff --git a/src/math_util_2.c b/src/math_util_2.c
index 21427de52..c7d2ade71 100644
--- a/src/math_util_2.c
+++ b/src/math_util_2.c
@@ -451,7 +451,7 @@ s32 func_80041980(Vec3f arg0, Camera *arg1, u16 arg2) {
s32 ret;
ret = 0;
- temp_t9 = (func_80041770(arg1->pos[0], arg0[0], arg1->pos[2], arg0[2]) + (arg2 / 2)) - arg1->rotX[1];
+ temp_t9 = (func_80041770(arg1->pos[0], arg0[0], arg1->pos[2], arg0[2]) + (arg2 / 2)) - arg1->rot[1];
if ((temp_t9 >= 0) && (arg2 >= temp_t9)) {
ret = 1;
}
diff --git a/src/race_logic.c b/src/race_logic.c
index f0cc92e13..0619a1023 100644
--- a/src/race_logic.c
+++ b/src/race_logic.c
@@ -5,6 +5,7 @@
#include <config.h>
#include <defines.h>
#include "waypoints.h"
+#include "camera.h"
extern Player *gPlayerTwo;
extern Player *gPlayerThree;
@@ -12,11 +13,6 @@ extern Player *gPlayerFour;
extern Player *gPlayerOneCopy;
extern Player *gPlayerTwoCopy;
-extern struct Camera *camera1;
-extern struct Camera *camera2;
-extern struct Camera *camera3;
-extern struct Camera *camera4;
-
extern struct Controller gControllers[];
extern struct Controller *gControllerOne;
extern struct Controller *gControllerThree;
diff --git a/src/render_courses.c b/src/render_courses.c
index a0752df6b..d25729613 100644
--- a/src/render_courses.c
+++ b/src/render_courses.c
@@ -34,13 +34,13 @@ extern s32 D_802B87CC;
void func_802A7658(s32, s32, s32, s32, u16*, u16*);
s32 func_80290C20(Camera *camera) {
- if (camera->unk14 == 0) {
+ if (camera->unk_54.unk34 == 0) {
return 1;
}
- if ((camera->unk13 == 1) && (camera->collisionY < 3.0f)) {
+ if ((camera->unk_54.unk30 == 1) && (camera->unk_54.unk3C < 3.0f)) {
return 1;
}
- if ((camera->unk13_and_a_half == 1) && (camera->collisionZ < 3.0f)) {
+ if ((camera->unk_54.unk32 == 1) && (camera->unk_54.unk40 < 3.0f)) {
return 1;
}
return 0;
diff --git a/src/skybox_and_splitscreen.c b/src/skybox_and_splitscreen.c
index 89296739a..83076fbc0 100644
--- a/src/skybox_and_splitscreen.c
+++ b/src/skybox_and_splitscreen.c
@@ -6,6 +6,7 @@
#include <common_structs.h>
#include <variables.h>
#include <config.h>
+#include "camera.h"
void func_802A41D4();
@@ -988,8 +989,8 @@ void func_802A59A4(void) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2],
- camera->unk, camera->unk1, camera->unk2, camera->angleX,
- camera->angleY, camera->angleZ);
+ camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0],
+ camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
mtxf_identity(sp5C);
@@ -1036,7 +1037,7 @@ void func_802A5CB4(void) {
guPerspective(&gGfxPool->mtxPool[1], &sp9A[17], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp9A[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
@@ -1085,7 +1086,7 @@ void func_802A5FAC(void) {
guPerspective(&gGfxPool->mtxPool[2], &sp9A[17], D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp9A[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[2]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
//D_801647A8, D_801647AC, D_801647B0, D_801647B4, D_801647B8, D_801647BC, D_801647C0, D_801647C4, D_801647C8);
@@ -1133,7 +1134,7 @@ void func_802A62A4(void) {
guPerspective(&gGfxPool->mtxPool[1], &sp9A[17], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp9A[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
@@ -1181,7 +1182,7 @@ void func_802A65B8(void) {
guPerspective(&gGfxPool->mtxPool[2], &sp9A[17], D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp9A[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[2]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
@@ -1227,7 +1228,7 @@ void func_802A68CC(void) {
guPerspective(&gGfxPool->mtxPool[1], &sp9A[17], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp9A[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
@@ -1274,7 +1275,7 @@ void func_802A6BB0(void) {
gDPHalf1(gDisplayListHead++, sp9A[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[2]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
mtxf_identity(sp58);
@@ -1318,7 +1319,7 @@ void func_802A6E94(void) {
guPerspective(&gGfxPool->mtxPool[3], &sp9A[17], D_80150130[2], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp9A[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[3]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[9], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[9], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[9]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
@@ -1373,7 +1374,7 @@ void func_802A7178(void) {
guPerspective(&gGfxPool->mtxPool[4], &sp92[17], D_80150130[3], D_80150148, D_80150150, D_8015014C, 1.0f);
gDPHalf1(gDisplayListHead++, sp92[17]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[4]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
- guLookAt(&gGfxPool->mtxPool[10], camera->pos[0], camera->pos[1], camera->pos[2], camera->unk, camera->unk1, camera->unk2, camera->angleX, camera->angleY, camera->angleZ);
+ guLookAt(&gGfxPool->mtxPool[10], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[10]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
mtxf_identity(sp50);