diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2023-08-09 14:53:55 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-09 14:53:55 -0600 |
| commit | 870c39ad7772ec2d28686c7a883236be00179dc1 (patch) | |
| tree | dcebf8b48e6fe618b9deae8d5e5ef4612cbacf54 /src/code_80091440.c | |
| parent | ccd33e9e10c0e682ca2e0a176ab94e668b3c8cd0 (diff) | |
Matched code_80091440.c and named gDemoMode variable (#358)
* matched code_80091440.c
* Named gDemoMode
* Remove asm for matching func
* Matched and namings for random_u16_credits func in code_80280650.c
Diffstat (limited to 'src/code_80091440.c')
| -rw-r--r-- | src/code_80091440.c | 109 |
1 files changed, 44 insertions, 65 deletions
diff --git a/src/code_80091440.c b/src/code_80091440.c index ed6c9e66a..61a42b180 100644 --- a/src/code_80091440.c +++ b/src/code_80091440.c @@ -1,5 +1,10 @@ #include "variables.h" #include "code_80091440.h" +#include "camera.h" +#include "math_util.h" +#include "main.h" +#include <actor_types.h> +#include "code_802AAA70.h" void func_80091440(s8 arg0) { if ((gPlayers[arg0].unk_044 & 0x800) == 0) { @@ -15,77 +20,51 @@ void func_800914A0(void) { } } -#ifdef MIPS_TO_C -//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-15-2022 -extern u32 D_8015F718; -static ? D_800E7080; /* unable to generate initializer */ -static ? D_800E708C; /* unable to generate initializer */ +extern u32 D_8015F718[3]; void func_800914E0(void) { - ? sp64; - ? sp58; - s32 sp48; + UNUSED Vec3f sp64 = {0.0f, -20.0f, 150.0f}; + UNUSED Vec3f sp58 = {0.0f, -6.0f, 4.0f}; + uintptr_t segment = SEGMENT_NUMBER2(D_8015F718[0]); + uintptr_t offset = SEGMENT_OFFSET(D_8015F718[0]); + Camera *camera = &cameras[0]; + struct ActorSpawnData *sp48 = (struct ActorSpawnData *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset); + struct ActorSpawnData *tempData; + + s16 temp3 = (s16) D_80152308; + s16 temp2 = (s16) gPlayerOneCopy->unk_006; + s16 temp; f32 sp38; f32 sp34; f32 sp30; - Player **var_t1; - f32 temp_f12; - f32 temp_f14; - f32 temp_f16; - f32 temp_f4; - f32 temp_f8; - s16 temp_a0; - s16 temp_a0_2; - s16 temp_v0; - u16 temp_t0; - void *temp_v0_2; + camera->up[0] = 0; + camera->up[1] = 1; + camera->up[2] = 0; + + if(1) {} // waa? - sp64.unk0 = (s32) D_800E7080.unk0; - sp64.unk4 = (s32) D_800E7080.unk4; - sp64.unk8 = (s32) D_800E7080.unk8; - sp58.unk0 = (s32) D_800E708C.unk0; - sp58.unk4 = (s32) D_800E708C.unk4; - sp58.unk8 = (s32) D_800E708C.unk8; - temp_a0 = D_8015F718 & 0xFFFFFF; - var_t1 = &gPlayerOneCopy; - sp48 = gSegmentTable[(u32) D_8015F718 >> 0x18] + temp_a0 + 0x80000000; - temp_t0 = D_80152308; - temp_v0 = (s16) gPlayerOneCopy->unk_006 - temp_t0; - cameras->up[0] = 0.0f; - cameras->up[2] = 0.0f; - cameras->up[1] = 1.0f; - if (temp_v0 == 7) { - func_800914A0(temp_a0, 7); - goto block_5; - } - if (temp_v0 < 0xE) { - temp_a0_2 = temp_v0 + (s16) D_8015F6F8; - if (temp_a0_2 == 7) { - func_800914A0(temp_a0_2, 7); -block_5: - var_t1 = &gPlayerOneCopy; + temp = temp2 - temp3; + if (temp == 7) { + func_800914A0(); + } else if (temp < 14) { + temp += (s16) D_8015F6F8; + if (temp == 7) { + func_800914A0(); } } - temp_v0_2 = (temp_t0 * 8) + sp48; - temp_f8 = (f32) (temp_v0_2->unk0 + 0xA); - cameras->pos[0] = temp_f8; - temp_f16 = (f32) (temp_v0_2->unk2 + 7); - cameras->pos[1] = temp_f16; - temp_f4 = (f32) (temp_v0_2->unk4 - 0x14); - cameras->pos[2] = temp_f4; - cameras->lookAt[0] = (*var_t1)->pos[0]; - cameras->lookAt[1] = (*var_t1)->pos[1]; - cameras->lookAt[2] = (*var_t1)->pos[2]; - func_802ADDC8(&cameras->unk_54, 20.0f, temp_f8, temp_f16, temp_f4); - temp_f12 = cameras->lookAt[0] - cameras->pos[0]; - sp38 = temp_f12; - temp_f14 = cameras->lookAt[2] - cameras->pos[2]; - sp34 = cameras->lookAt[1] - cameras->pos[1]; - sp30 = temp_f14; - cameras->rot[1] = atan2s(temp_f12, temp_f14); - cameras->rot[0] = atan2s(sqrtf((sp38 * sp38) + (temp_f14 * temp_f14)), sp34); - cameras->rot[2] = 0; + tempData = sp48 + D_80152308; + + camera->pos[0] = (f32) (tempData->pos[0] + 10); + camera->pos[1] = (f32) (tempData->pos[1] + 7); + camera->pos[2] = (f32) (tempData->pos[2] - 20); + camera->lookAt[0] = gPlayerOneCopy->pos[0]; + camera->lookAt[1] = gPlayerOneCopy->pos[1]; + camera->lookAt[2] = gPlayerOneCopy->pos[2]; + func_802ADDC8(&camera->unk_54, 20.0f, camera->pos[0], camera->pos[1], camera->pos[2]); + sp38 = camera->lookAt[0] - camera->pos[0]; + sp34 = camera->lookAt[1] - camera->pos[1]; + sp30 = camera->lookAt[2] - camera->pos[2]; + camera->rot[1] = atan2s(sp38, sp30); + camera->rot[0] = atan2s(sqrtf((sp38 * sp38) + (sp30 * sp30)), sp34); + camera->rot[2] = 0; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091440/func_800914E0.s") -#endif |
