diff options
| author | Synray <31429825+Synray@users.noreply.github.com> | 2020-04-18 19:56:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-18 22:56:53 -0400 |
| commit | eefbe9afe1891ea27eb39315a3c87e87abef0828 (patch) | |
| tree | 754338c5f5fea1687d4bdb0b9b6025e3311d7b95 /src/code/code_800A9F30.c | |
| parent | 21750d5aee057f5352d945b7cad3c9394efe25b7 (diff) | |
Decompile code_800D2E30 and use struct in code_800A9F30 (#80)
* Match func_800AA000
* Match z_camera/func_800437F0
* Decompile code_800D2E30, use struct in 800A9F30
* Format
* Remove 'U' from literals
* Remove bss, cleanup z_camera
* Review changes, rename temp
* Move externs to variables.h
Diffstat (limited to 'src/code/code_800A9F30.c')
| -rw-r--r-- | src/code/code_800A9F30.c | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/src/code/code_800A9F30.c b/src/code/code_800A9F30.c index 15475e872..ea56f9243 100644 --- a/src/code/code_800A9F30.c +++ b/src/code/code_800A9F30.c @@ -1,12 +1,11 @@ #include <ultra64.h> #include <global.h> -extern u8 D_80160FD0[]; -extern PadMgr gPadMgr; +UnkRumbleStruct D_80160FD0; -void func_800A9F30(s32 a, s32 b) { +void func_800A9F30(PadMgr* a, s32 b) { func_800D2E30(&D_80160FD0); - PadMgr_RumbleSet(a, &D_80160FD0); + PadMgr_RumbleSet(a, D_80160FD0.rumbleEnable); } void func_800A9F6C(f32 a, u8 b, u8 c, u8 d) { @@ -21,20 +20,43 @@ void func_800A9F6C(f32 a, u8 b, u8 c, u8 d) { if ((temp1 < 1000) && (b != 0) && (d != 0)) { temp2 = b - (temp1 * 255) / 1000; if (temp2 > 0) { - D_801610DA = temp2; - D_80160FD0[0x10B] = c; - D_80160FD0[0x10C] = d; + D_80160FD0.unk_10A = temp2; + D_80160FD0.unk_10B = c; + D_80160FD0.unk_10C = d; } } } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800A9F30/func_800AA000.s") -// this function is very similar to the one above but has a loop in it I can't figure out +void func_800AA000(float a, u8 b, u8 c, u8 d) { + s32 temp1; + s32 temp2; + s32 i; + if (1000000.0f < a) { + temp1 = 1000; + } else { + temp1 = sqrtf(a); + } + + if (temp1 < 1000 && b != 0 && d != 0) { + temp2 = b - (temp1 * 255) / 1000; + + for (i = 0; i < 0x40; i++) { + if (D_80160FD0.unk_04[i] == 0) { + if (temp2 > 0) { + D_80160FD0.unk_04[i] = temp2; + D_80160FD0.unk_44[i] = c; + D_80160FD0.unk_84[i] = d; + } + break; + } + } + } +} void func_800AA0B4(void) { func_800D3140(&D_80160FD0); - gPadMgr.retraceCallback = func_800A9F30; + gPadMgr.retraceCallback = (void*)func_800A9F30; gPadMgr.retraceCallbackValue = 0; if (0) {} // Necessary to match @@ -52,17 +74,17 @@ void func_800AA0F0(void) { } u32 func_800AA148(void) { - return ((gPadMgr.pakType[0] ^ 1) == 0); + return gPadMgr.pakType[0] == 1; } void func_800AA15C(void) { - D_801610D4 = 2; + D_80160FD0.unk_104 = 2; } void func_800AA16C(void) { - D_801610D4 = 0; + D_80160FD0.unk_104 = 0; } void func_800AA178(u32 a) { - D_801610D5 = !!a; + D_80160FD0.unk_105 = !!a; } |
