mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-16 21:37:47 -04:00
Assorted, unrelated matches (#267)
* Assorted matches Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
+108
-148
@@ -4,6 +4,10 @@
|
||||
#include <defines.h>
|
||||
#include "camera.h"
|
||||
#include "math_util.h"
|
||||
#include "memory.h"
|
||||
#include "waypoints.h"
|
||||
#include "variables.h"
|
||||
#include "code_8001F980.h"
|
||||
|
||||
Camera cameras[4];
|
||||
Camera *camera1 = &cameras[0];
|
||||
@@ -11,6 +15,11 @@ Camera *camera2 = &cameras[1];
|
||||
Camera *camera3 = &cameras[2];
|
||||
Camera *camera4 = &cameras[3];
|
||||
|
||||
// Future BSS section, replaces unknown amount of stuff in bss_8001C4D0.s
|
||||
// f32 D_80164A30;
|
||||
// s32 D_80164A2C;
|
||||
// f32 D_8016524C; <- could maybe, maybe be part of spawn_players' bss stuff?
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
|
||||
void func_80014DE4(s32, s32, s32, Camera *); /* extern */
|
||||
@@ -67,7 +76,7 @@ void func_8001C4D0(f32 posX, f32 posY, f32 posZ, s16 rot, u32 arg4, s32 cameraId
|
||||
temp_a3->pos[0] = posX;
|
||||
temp_a3->pos[1] = posY;
|
||||
temp_a3->pos[2] = posZ;
|
||||
temp_a3->rotZ = 0;
|
||||
temp_a3->someBitFlags = 0;
|
||||
temp_a3->lookAt[2] = 150.0f;
|
||||
temp_a3->lookAt[1] = (f32) ((f64) posY - 3.0);
|
||||
temp_a3->lookAt[0] = 0.0f;
|
||||
@@ -221,74 +230,57 @@ void func_8001CA24(Player *player, f32 arg1) {
|
||||
camera->unk_94 = arg1;
|
||||
}
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
|
||||
void func_802B6540(f32 *, ?, f32, ?, s32); /* extern */
|
||||
extern f32 D_80164A30;
|
||||
s16 gCurrentCourseId; /* unable to generate initializer */
|
||||
|
||||
void func_8001CA78(s32 arg0, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5) {
|
||||
f32 sp74;
|
||||
f32 sp70;
|
||||
f32 sp6C;
|
||||
f32 sp68;
|
||||
f32 sp64;
|
||||
f32 sp60;
|
||||
f32 sp5C;
|
||||
f32 sp4C;
|
||||
f32 sp48;
|
||||
f32 sp44;
|
||||
f32 temp_f0;
|
||||
f32 temp_f12;
|
||||
f32 temp_f16;
|
||||
f32 temp_f18;
|
||||
f32 temp_f2;
|
||||
void func_8001CA78(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 huh, s8 wut) {
|
||||
Mat3 sp74;
|
||||
Vec3f sp68;
|
||||
Vec3f sp5C;
|
||||
f32 posX;
|
||||
f32 posY;
|
||||
f32 posZ;
|
||||
f32 var_f14;
|
||||
f32 var_f14_2;
|
||||
f32 temp_f18;
|
||||
f32 temp_f16;
|
||||
s32 stackPadding0;
|
||||
struct TrackWayPoint *temp_s2;
|
||||
|
||||
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 == 0x000A) {
|
||||
var_f14 = sp5C;
|
||||
temp_s2 = &D_80164550[0][gWaypointCountByPathIndex[0] - 10];
|
||||
sp68[0] = camera->unk_30[0];
|
||||
sp68[1] = camera->unk_30[1];
|
||||
sp68[2] = camera->unk_30[2];
|
||||
sp5C[0] = camera->unk_3C[0];
|
||||
sp5C[1] = camera->unk_3C[1];
|
||||
sp5C[2] = camera->unk_3C[2];
|
||||
arg2[0] = camera->lookAt[0];
|
||||
arg2[1] = camera->lookAt[1];
|
||||
arg2[2] = camera->lookAt[2];
|
||||
func_802B6540(sp74, 0, 1, 0, -0x00008000);
|
||||
func_802B63B8(sp5C, sp74);
|
||||
if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) {
|
||||
var_f14 = sp5C[0];
|
||||
} else {
|
||||
var_f14 = sp5C + (f32) temp_s2->wayPointX;
|
||||
var_f14 = sp5C[0] + temp_s2->wayPointX;
|
||||
}
|
||||
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 == 0x000A) {
|
||||
var_f14_2 = sp68;
|
||||
temp_f16 = sp5C[2] + D_8016524C;
|
||||
temp_f18 = sp5C[1] + (temp_s2->wayPointY + D_80164A30);
|
||||
arg2[0] += (var_f14 - camera->lookAt[0]) * 1;
|
||||
arg2[1] += (temp_f18 - camera->lookAt[1]) * 1;
|
||||
arg2[2] += (temp_f16 - camera->lookAt[2]) * 1;
|
||||
func_802B63B8(sp68, sp74);
|
||||
if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) {
|
||||
var_f14 = sp68[0];
|
||||
} else {
|
||||
var_f14_2 = sp68 + (f32) temp_s2->wayPointX;
|
||||
var_f14 = sp68[0] + temp_s2->wayPointX;
|
||||
}
|
||||
sp4C = var_f14_2;
|
||||
temp_f16 = sp70 + (bitwise f32) D_8016524C;
|
||||
sp44 = temp_f16;
|
||||
temp_f18 = sp6C + ((f32) temp_s2->wayPointY + D_80164A30 + 6.0f);
|
||||
sp48 = temp_f18;
|
||||
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 = camera->pos[2];
|
||||
*arg5 = ((temp_f16 - temp_f12) * 1.0f) + temp_f12;
|
||||
temp_f16 = sp68[2] + D_8016524C;
|
||||
temp_f18 = sp68[1] + (temp_s2->wayPointY + D_80164A30 + 6.0f);
|
||||
move_f32_towards(&D_80164A30, 0, 0.02f);
|
||||
posX = camera->pos[0];
|
||||
*arg3 = ((var_f14 - posX) * 1) + posX;
|
||||
posY = camera->pos[1];
|
||||
*arg4 = ((temp_f18 - posY) * 1) + posY;
|
||||
posZ = camera->pos[2];
|
||||
*arg5 = ((temp_f16 - posZ) * 1) + posZ;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/camera/func_8001CA78.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9
|
||||
@@ -496,13 +488,11 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8001CCEC.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
|
||||
void func_802B6540(f32 *, f32, ?, f32, s32); /* extern */
|
||||
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
|
||||
extern ? D_80164A90;
|
||||
extern ? D_80164AA0;
|
||||
|
||||
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;
|
||||
f32 sp68;
|
||||
@@ -532,12 +522,12 @@ void func_8001D53C(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *ar
|
||||
arg2->unk4 = (f32) camera->lookAt[1];
|
||||
arg2->unk8 = (f32) camera->lookAt[2];
|
||||
sp38 = arg7 * 4;
|
||||
func_802B6540(&sp74, 0.0f, 0x3F800000, 0.0f, (s32) arg6);
|
||||
func_802B63B8(&sp5C, &sp74);
|
||||
func_802B6540((f32 (*)[3]) &sp74[0], 0.0f, 1.0f, 0.0f, (s16) (s32) arg6);
|
||||
func_802B63B8(&sp5C, (f32 (*)[3]) &sp74[0]);
|
||||
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);
|
||||
func_802B63B8(&sp68, (f32 (*)[3]) &sp74[0]);
|
||||
var_f0 = (f32) ((f64) sp6C + ((f64) player->unk_074 + 1.5));
|
||||
if ((player->unk_0CA & 1) == 1) {
|
||||
var_f0 = sp6C + (sp3C + 10.0f);
|
||||
@@ -776,79 +766,66 @@ void func_8001D944(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *ar
|
||||
GLOBAL_ASM("asm/non_matchings/camera/func_8001D944.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
|
||||
void func_8001CA78(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, s32, s32); /* extern */
|
||||
|
||||
void func_8001E0C4(Camera *camera, Player *player, s8 arg2) {
|
||||
f32 sp84;
|
||||
s32 stackPadding0[6];
|
||||
f32 temp_f12;
|
||||
f32 sp80;
|
||||
f32 sp7C;
|
||||
f32 temp_f14;
|
||||
s32 stackPadding1;
|
||||
f32 sp74;
|
||||
f32 sp70;
|
||||
f32 sp6C;
|
||||
f32 sp60;
|
||||
f32 temp_f0;
|
||||
f32 temp_f12;
|
||||
f32 temp_f14;
|
||||
f32 temp_f2;
|
||||
f32 temp_f2_2;
|
||||
s16 temp_v0;
|
||||
Vec3f sp60;
|
||||
s16 temp_t7;
|
||||
s16 var_a2;
|
||||
s32 stackPadding2[5];
|
||||
s32 stackPadding3[3];
|
||||
s32 test = 3;
|
||||
|
||||
temp_v0 = player->unk_078;
|
||||
if (temp_v0 == 0) {
|
||||
if (player->unk_078 == 0) {
|
||||
var_a2 = 0x0064;
|
||||
} else if (temp_v0 < 0) {
|
||||
var_a2 = 0x87 - (temp_v0 / 3);
|
||||
} else if (player->unk_078 < 0) {
|
||||
var_a2 = 0x87 - (player->unk_078 / 3);
|
||||
} else {
|
||||
var_a2 = (temp_v0 / 3) + 0x87;
|
||||
var_a2 = (player->unk_078 / 3) + 0x87;
|
||||
}
|
||||
func_800224F0(&camera->unk_2C, player->unk_02C[1], 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 += -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;
|
||||
func_8001CA78(player, camera, sp60, &sp74, &sp70, &sp6C, camera->unk_2C, arg2);
|
||||
camera->someBitFlags &= ~0x0004;
|
||||
temp_t7 = func_802ADDC8(&camera->unk_54, test, sp74, sp70, sp6C);
|
||||
if (camera->unk_54.unk3C[2] < 0.0f) {
|
||||
sp74 += -camera->unk_54.unk60[0] * camera->unk_54.unk3C[2] * 1;
|
||||
sp70 += -camera->unk_54.unk60[1] * camera->unk_54.unk3C[2] * 0.5;
|
||||
sp6C += -camera->unk_54.unk60[2] * camera->unk_54.unk3C[2] * 1;
|
||||
}
|
||||
temp_f2 = camera->unk_54.unk3C;
|
||||
if (temp_f2 < 0.0f) {
|
||||
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));
|
||||
if (camera->unk_54.unk3C[0] < 0.0f) {
|
||||
camera->someBitFlags = camera->someBitFlags | 4 | 2;
|
||||
sp74 += -camera->unk_54.unk48[0] * camera->unk_54.unk3C[0] * 1.5;
|
||||
sp70 += -camera->unk_54.unk48[1] * camera->unk_54.unk3C[0] * 1;
|
||||
sp6C += -camera->unk_54.unk48[2] * camera->unk_54.unk3C[0] * 1.5;
|
||||
}
|
||||
temp_f2_2 = camera->unk_54.unk40;
|
||||
if (temp_f2_2 < 0.0f) {
|
||||
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 (camera->unk_54.unk3C[1] < 0.0f) {
|
||||
camera->someBitFlags = camera->someBitFlags | 4 | 2;
|
||||
sp74 += -camera->unk_54.unk54[0] * camera->unk_54.unk3C[1] * 1.5;
|
||||
sp70 += -camera->unk_54.unk54[1] * camera->unk_54.unk3C[1] * 1;
|
||||
sp6C += -camera->unk_54.unk54[2] * camera->unk_54.unk3C[1] * 1.5;
|
||||
}
|
||||
if (((s16) M2C_ERROR(Read from unset register $v0) == 0) && (((u16) camera->rotZ & 2) != 2)) {
|
||||
if ((temp_t7 == 0) && ((camera->someBitFlags & 2) != 2)) {
|
||||
camera->unk_AC = camera->unk_2C;
|
||||
}
|
||||
camera->lookAt[0] = sp60;
|
||||
camera->lookAt[1] = sp64;
|
||||
camera->lookAt[2] = sp68;
|
||||
camera->lookAt[0] = sp60[0];
|
||||
camera->lookAt[1] = sp60[1];
|
||||
camera->lookAt[2] = sp60[2];
|
||||
camera->pos[0] = sp74;
|
||||
camera->pos[1] = sp70;
|
||||
temp_f12 = camera->lookAt[0] - camera->pos[0];
|
||||
camera->pos[2] = sp6C;
|
||||
temp_f12 = camera->lookAt[0] - camera->pos[0];
|
||||
sp80 = camera->lookAt[1] - camera->pos[1];
|
||||
sp84 = temp_f12;
|
||||
temp_f14 = camera->lookAt[2] - camera->pos[2];
|
||||
sp7C = temp_f14;
|
||||
camera->rot[1] = atan2s(temp_f12, temp_f14);
|
||||
camera->rot[0] = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80);
|
||||
camera->rot[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (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 m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
|
||||
@@ -930,7 +907,7 @@ void func_8001E45C(Camera *camera, Player *player, s8 arg2) {
|
||||
func_800224F0(&camera->unk_2C, (s16) (player->unk_02C[1] + camera->unk_B0), var_a3);
|
||||
func_8001CCEC(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
|
||||
}
|
||||
camera->rotZ = (u16) camera->rotZ & 0xFFFB;
|
||||
camera->someBitFlags = (u16) camera->someBitFlags & 0xFFFB;
|
||||
func_802ADDC8(&camera->unk_54, (f32) 3, sp84, sp80, sp7C);
|
||||
camera->pos[0] = sp84;
|
||||
camera->pos[1] = sp80;
|
||||
@@ -1069,7 +1046,7 @@ void func_8001EA0C(Camera *camera, Player *player, s8 arg2) {
|
||||
func_800224F0(&camera->unk_2C, (s16) (player->unk_02C[1] + camera->unk_B0), var_a3);
|
||||
func_8001D944(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
|
||||
}
|
||||
camera->rotZ = (u16) camera->rotZ & 0xFFFB;
|
||||
camera->someBitFlags = (u16) camera->someBitFlags & 0xFFFB;
|
||||
func_802ADDC8(&camera->unk_54, (f32) 3, sp84, sp80, sp7C);
|
||||
camera->pos[0] = sp84;
|
||||
camera->pos[1] = sp80;
|
||||
@@ -1417,43 +1394,26 @@ block_66:
|
||||
GLOBAL_ASM("asm/non_matchings/camera/func_8001F394.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
|
||||
extern u16 D_80152300;
|
||||
extern s32 D_80164A2C;
|
||||
|
||||
void func_8001F87C(s32 cameraId) {
|
||||
Camera *temp_v0_2;
|
||||
Player *var_a2;
|
||||
s32 var_a1;
|
||||
u16 temp_v0;
|
||||
s32 playerIndex;
|
||||
// Why?
|
||||
s32 test = cameraId;
|
||||
|
||||
if (gActiveScreenMode == SCREEN_MODE_1P) {
|
||||
var_a1 = 0;
|
||||
var_a2 = gPlayerOne;
|
||||
if (gModeSelection == GRAND_PRIX) {
|
||||
loop_3:
|
||||
temp_v0 = var_a2->unk_000;
|
||||
if (!(temp_v0 & 0x200) && !(temp_v0 & 0x80)) {
|
||||
if (var_a1 == 0x60E8) {
|
||||
if(gPlayerOne){}
|
||||
if (gActiveScreenMode == 0) {
|
||||
if (gModeSelection == 0) {
|
||||
for (playerIndex = 0; playerIndex < 8; playerIndex++) {
|
||||
if ((gPlayerOne[playerIndex].unk_000 & 0x200) || (gPlayerOne[playerIndex].unk_000 & 0x80)) break;
|
||||
if (playerIndex == 7) {
|
||||
D_80164A2C += 1;
|
||||
}
|
||||
if ((var_a1 == 0x60E8) && (D_80164A2C == 0x0000003C)) {
|
||||
if ((playerIndex == 7) && (D_80164A2C == 0x0000003C)) {
|
||||
D_80164A28 = 2;
|
||||
*(&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;
|
||||
}
|
||||
var_a1 += 0xDD8;
|
||||
var_a2 += 0xDD8;
|
||||
if (var_a1 != 0x6EC0) {
|
||||
goto loop_3;
|
||||
D_80152300[test] = 1;
|
||||
cameras[test].rot[1] = gPlayerOne[playerIndex].unk_02C[1];
|
||||
cameras[test].unk_2C = gPlayerOne[playerIndex].unk_02C[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/camera/func_8001F87C.s")
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user