mirror of https://github.com/zeldaret/mm.git
code_0x8017FEB0 OK (#137)
* almost every function * atans ok * import data and rodata * format `atan_first_8th_array` * fix signature and rodata * rename to angle * Rename the functions to match their OoT counterparts * rename code_0x8017FEB0 to sys_math_atan
This commit is contained in:
parent
dea3c8fd79
commit
4d6d9c27a4
|
|
@ -3364,11 +3364,11 @@ s32 Math3d_ColTriTri(TriNorm* tri1, TriNorm* tri2, Vec3f* uParm3);
|
|||
// void func_8017FAA8(void);
|
||||
// void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11);
|
||||
// void func_8017FD44(void);
|
||||
s16 atans_first_8th(f32 opposite, f32 adjacent);
|
||||
s16 atans(f32 opposite, f32 adjacent);
|
||||
f32 atan(f32 opposite, f32 adjacent);
|
||||
u16 Math_GetAtan2Tbl(f32 opposite, f32 adjacent);
|
||||
s16 Math_Atan2S(f32 opposite, f32 adjacent);
|
||||
f32 Math_Atan2F(f32 opposite, f32 adjacent);
|
||||
s16 Math_FAtan2F(f32 adjacent, f32 opposite);
|
||||
s16 atan_flip(f32 adjacent, f32 opposite);
|
||||
f32 Math_Acot2F(f32 adjacent, f32 opposite);
|
||||
void SysMatrix_StateAlloc(GameState* ctxt);
|
||||
void SysMatrix_StatePush(void);
|
||||
void SysMatrix_StatePop(void);
|
||||
|
|
|
|||
|
|
@ -1774,7 +1774,6 @@ extern UNK_PTR D_801D1540;
|
|||
extern f32 D_801D1570[13];
|
||||
extern Vec3f D_801D15B0;
|
||||
// extern UNK_TYPE4 D_801D15BC;
|
||||
extern s16 atan_first_8th_array[1025];
|
||||
extern RSPMatrix D_801D1DE0;
|
||||
extern MtxF D_801D1E20;
|
||||
extern UNK_PTR D_801D1E60;
|
||||
|
|
@ -3130,7 +3129,6 @@ extern f32 Math3D_ColSphereSphereIntersectAndDistance_min_intersect;
|
|||
extern f32 D_801E01CC;
|
||||
extern f32 D_801E01D0;
|
||||
extern f32 D_801E01D4;
|
||||
extern f32 D_801E01E0;
|
||||
extern f32 D_801E01F0;
|
||||
extern f32 D_801E01F4;
|
||||
extern f32 D_801E01F8;
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ SECTIONS
|
|||
build/asm/code/sys_initial_check.o(.text)
|
||||
build/asm/code/code_0x80179300.o(.text)
|
||||
build/asm/code/code_0x801795F0.o(.text)
|
||||
build/src/code/code_0x8017FEB0.o(.text)
|
||||
build/src/code/sys_math_atan.o(.text)
|
||||
build/src/code/sys_matrix.o(.text)
|
||||
build/asm/code/code_0x80182CE0.o(.text)
|
||||
build/src/code/code_0x80183070.o(.text)
|
||||
|
|
@ -555,7 +555,7 @@ SECTIONS
|
|||
build/asm/code/code_data_speed_meter.o(.data)
|
||||
build/asm/code/code_data_0x80179300.o(.data)
|
||||
build/asm/code/code_data_0x801D15B0.o(.data)
|
||||
build/asm/code/code_data_0x8017FEB0.o(.data)
|
||||
build/src/code/sys_math_atan.o(.data)
|
||||
build/asm/code/code_data_sys_matrix.o(.data)
|
||||
build/asm/code/code_data_0x80182CE0.o(.data)
|
||||
build/asm/code/code_data_0x8018B0F0.o(.data)
|
||||
|
|
@ -629,7 +629,7 @@ SECTIONS
|
|||
build/asm/code/code_rodata_sched.o(.rodata)
|
||||
build/asm/code/code_rodata_0x80179300.o(.rodata)
|
||||
build/asm/code/code_rodata_0x801795F0.o(.rodata)
|
||||
build/asm/code/code_rodata_0x8017FEB0.o(.rodata)
|
||||
build/src/code/sys_math_atan.o(.rodata)
|
||||
build/asm/code/code_rodata_sys_matrix.o(.rodata)
|
||||
build/asm/code/code_rodata_0x801830A0.o(.rodata)
|
||||
build/asm/code/code_rodata_sys_flashrom.o(.rodata)
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans_first_8th.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/Math_FAtan2F.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan_flip.asm")
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
u16 sATan2Tbl[] = {
|
||||
0, 10, 20, 31, 41, 51, 61, 71, 81, 92, 102, 112, 122, 132, 143, 153, 163, 173, 183,
|
||||
194, 204, 214, 224, 234, 244, 255, 265, 275, 285, 295, 305, 316, 326, 336, 346, 356, 367, 377,
|
||||
387, 397, 407, 417, 428, 438, 448, 458, 468, 478, 489, 499, 509, 519, 529, 539, 550, 560, 570,
|
||||
580, 590, 600, 610, 621, 631, 641, 651, 661, 671, 681, 692, 702, 712, 722, 732, 742, 752, 763,
|
||||
773, 783, 793, 803, 813, 823, 833, 844, 854, 864, 874, 884, 894, 904, 914, 924, 935, 945, 955,
|
||||
965, 975, 985, 995, 1005, 1015, 1025, 1036, 1046, 1056, 1066, 1076, 1086, 1096, 1106, 1116, 1126, 1136, 1146,
|
||||
1156, 1166, 1177, 1187, 1197, 1207, 1217, 1227, 1237, 1247, 1257, 1267, 1277, 1287, 1297, 1307, 1317, 1327, 1337,
|
||||
1347, 1357, 1367, 1377, 1387, 1397, 1407, 1417, 1427, 1437, 1447, 1457, 1467, 1477, 1487, 1497, 1507, 1517, 1527,
|
||||
1537, 1547, 1557, 1567, 1577, 1587, 1597, 1607, 1617, 1627, 1637, 1646, 1656, 1666, 1676, 1686, 1696, 1706, 1716,
|
||||
1726, 1736, 1746, 1756, 1765, 1775, 1785, 1795, 1805, 1815, 1825, 1835, 1845, 1854, 1864, 1874, 1884, 1894, 1904,
|
||||
1914, 1923, 1933, 1943, 1953, 1963, 1973, 1982, 1992, 2002, 2012, 2022, 2031, 2041, 2051, 2061, 2071, 2080, 2090,
|
||||
2100, 2110, 2120, 2129, 2139, 2149, 2159, 2168, 2178, 2188, 2198, 2207, 2217, 2227, 2237, 2246, 2256, 2266, 2275,
|
||||
2285, 2295, 2305, 2314, 2324, 2334, 2343, 2353, 2363, 2372, 2382, 2392, 2401, 2411, 2421, 2430, 2440, 2450, 2459,
|
||||
2469, 2478, 2488, 2498, 2507, 2517, 2526, 2536, 2546, 2555, 2565, 2574, 2584, 2594, 2603, 2613, 2622, 2632, 2641,
|
||||
2651, 2660, 2670, 2679, 2689, 2699, 2708, 2718, 2727, 2737, 2746, 2756, 2765, 2775, 2784, 2793, 2803, 2812, 2822,
|
||||
2831, 2841, 2850, 2860, 2869, 2879, 2888, 2897, 2907, 2916, 2926, 2935, 2944, 2954, 2963, 2973, 2982, 2991, 3001,
|
||||
3010, 3019, 3029, 3038, 3047, 3057, 3066, 3075, 3085, 3094, 3103, 3113, 3122, 3131, 3141, 3150, 3159, 3168, 3178,
|
||||
3187, 3196, 3206, 3215, 3224, 3233, 3243, 3252, 3261, 3270, 3279, 3289, 3298, 3307, 3316, 3325, 3335, 3344, 3353,
|
||||
3362, 3371, 3380, 3390, 3399, 3408, 3417, 3426, 3435, 3444, 3453, 3463, 3472, 3481, 3490, 3499, 3508, 3517, 3526,
|
||||
3535, 3544, 3553, 3562, 3571, 3580, 3589, 3599, 3608, 3617, 3626, 3635, 3644, 3653, 3662, 3670, 3679, 3688, 3697,
|
||||
3706, 3715, 3724, 3733, 3742, 3751, 3760, 3769, 3778, 3787, 3796, 3804, 3813, 3822, 3831, 3840, 3849, 3858, 3867,
|
||||
3875, 3884, 3893, 3902, 3911, 3920, 3928, 3937, 3946, 3955, 3964, 3972, 3981, 3990, 3999, 4007, 4016, 4025, 4034,
|
||||
4042, 4051, 4060, 4069, 4077, 4086, 4095, 4103, 4112, 4121, 4129, 4138, 4147, 4155, 4164, 4173, 4181, 4190, 4199,
|
||||
4207, 4216, 4224, 4233, 4242, 4250, 4259, 4267, 4276, 4284, 4293, 4302, 4310, 4319, 4327, 4336, 4344, 4353, 4361,
|
||||
4370, 4378, 4387, 4395, 4404, 4412, 4421, 4429, 4438, 4446, 4454, 4463, 4471, 4480, 4488, 4497, 4505, 4513, 4522,
|
||||
4530, 4539, 4547, 4555, 4564, 4572, 4580, 4589, 4597, 4605, 4614, 4622, 4630, 4639, 4647, 4655, 4663, 4672, 4680,
|
||||
4688, 4697, 4705, 4713, 4721, 4730, 4738, 4746, 4754, 4762, 4771, 4779, 4787, 4795, 4803, 4812, 4820, 4828, 4836,
|
||||
4844, 4852, 4860, 4869, 4877, 4885, 4893, 4901, 4909, 4917, 4925, 4933, 4941, 4949, 4958, 4966, 4974, 4982, 4990,
|
||||
4998, 5006, 5014, 5022, 5030, 5038, 5046, 5054, 5062, 5070, 5078, 5086, 5094, 5101, 5109, 5117, 5125, 5133, 5141,
|
||||
5149, 5157, 5165, 5173, 5181, 5188, 5196, 5204, 5212, 5220, 5228, 5235, 5243, 5251, 5259, 5267, 5275, 5282, 5290,
|
||||
5298, 5306, 5313, 5321, 5329, 5337, 5344, 5352, 5360, 5368, 5375, 5383, 5391, 5398, 5406, 5414, 5421, 5429, 5437,
|
||||
5444, 5452, 5460, 5467, 5475, 5483, 5490, 5498, 5505, 5513, 5521, 5528, 5536, 5543, 5551, 5559, 5566, 5574, 5581,
|
||||
5589, 5596, 5604, 5611, 5619, 5626, 5634, 5641, 5649, 5656, 5664, 5671, 5679, 5686, 5694, 5701, 5708, 5716, 5723,
|
||||
5731, 5738, 5745, 5753, 5760, 5768, 5775, 5782, 5790, 5797, 5804, 5812, 5819, 5826, 5834, 5841, 5848, 5856, 5863,
|
||||
5870, 5878, 5885, 5892, 5899, 5907, 5914, 5921, 5928, 5936, 5943, 5950, 5957, 5964, 5972, 5979, 5986, 5993, 6000,
|
||||
6008, 6015, 6022, 6029, 6036, 6043, 6050, 6058, 6065, 6072, 6079, 6086, 6093, 6100, 6107, 6114, 6121, 6128, 6135,
|
||||
6142, 6150, 6157, 6164, 6171, 6178, 6185, 6192, 6199, 6206, 6213, 6220, 6227, 6234, 6240, 6247, 6254, 6261, 6268,
|
||||
6275, 6282, 6289, 6296, 6303, 6310, 6317, 6323, 6330, 6337, 6344, 6351, 6358, 6365, 6371, 6378, 6385, 6392, 6399,
|
||||
6406, 6412, 6419, 6426, 6433, 6440, 6446, 6453, 6460, 6467, 6473, 6480, 6487, 6493, 6500, 6507, 6514, 6520, 6527,
|
||||
6534, 6540, 6547, 6554, 6560, 6567, 6574, 6580, 6587, 6594, 6600, 6607, 6613, 6620, 6627, 6633, 6640, 6646, 6653,
|
||||
6660, 6666, 6673, 6679, 6686, 6692, 6699, 6705, 6712, 6718, 6725, 6731, 6738, 6744, 6751, 6757, 6764, 6770, 6777,
|
||||
6783, 6790, 6796, 6803, 6809, 6815, 6822, 6828, 6835, 6841, 6848, 6854, 6860, 6867, 6873, 6879, 6886, 6892, 6898,
|
||||
6905, 6911, 6917, 6924, 6930, 6936, 6943, 6949, 6955, 6962, 6968, 6974, 6980, 6987, 6993, 6999, 7005, 7012, 7018,
|
||||
7024, 7030, 7037, 7043, 7049, 7055, 7061, 7068, 7074, 7080, 7086, 7092, 7098, 7105, 7111, 7117, 7123, 7129, 7135,
|
||||
7141, 7147, 7154, 7160, 7166, 7172, 7178, 7184, 7190, 7196, 7202, 7208, 7214, 7220, 7226, 7232, 7238, 7244, 7250,
|
||||
7256, 7262, 7268, 7274, 7280, 7286, 7292, 7298, 7304, 7310, 7316, 7322, 7328, 7334, 7340, 7346, 7352, 7358, 7363,
|
||||
7369, 7375, 7381, 7387, 7393, 7399, 7405, 7411, 7416, 7422, 7428, 7434, 7440, 7446, 7451, 7457, 7463, 7469, 7475,
|
||||
7480, 7486, 7492, 7498, 7503, 7509, 7515, 7521, 7526, 7532, 7538, 7544, 7549, 7555, 7561, 7566, 7572, 7578, 7584,
|
||||
7589, 7595, 7601, 7606, 7612, 7618, 7623, 7629, 7635, 7640, 7646, 7651, 7657, 7663, 7668, 7674, 7679, 7685, 7691,
|
||||
7696, 7702, 7707, 7713, 7718, 7724, 7730, 7735, 7741, 7746, 7752, 7757, 7763, 7768, 7774, 7779, 7785, 7790, 7796,
|
||||
7801, 7807, 7812, 7818, 7823, 7828, 7834, 7839, 7845, 7850, 7856, 7861, 7866, 7872, 7877, 7883, 7888, 7893, 7899,
|
||||
7904, 7910, 7915, 7920, 7926, 7931, 7936, 7942, 7947, 7952, 7958, 7963, 7968, 7974, 7979, 7984, 7990, 7995, 8000,
|
||||
8005, 8011, 8016, 8021, 8026, 8032, 8037, 8042, 8047, 8053, 8058, 8063, 8068, 8074, 8079, 8084, 8089, 8094, 8100,
|
||||
8105, 8110, 8115, 8120, 8125, 8131, 8136, 8141, 8146, 8151, 8156, 8161, 8166, 8172, 8177, 8182, 8187, 8192,
|
||||
};
|
||||
|
||||
u16 Math_GetAtan2Tbl(f32 opposite, f32 adjacent) {
|
||||
return sATan2Tbl[(s32)((opposite / adjacent) * 0x400)];
|
||||
}
|
||||
|
||||
s16 Math_Atan2S(f32 opposite, f32 adjacent) {
|
||||
s32 angle;
|
||||
|
||||
if (opposite == 0.0f) {
|
||||
if (adjacent >= 0.0f) {
|
||||
angle = 0;
|
||||
} else {
|
||||
angle = 0x8000;
|
||||
}
|
||||
} else if (adjacent == 0.0f) {
|
||||
if (opposite >= 0.0f) {
|
||||
angle = 0x4000;
|
||||
} else {
|
||||
angle = 0xC000;
|
||||
}
|
||||
} else if (opposite >= 0.0f) {
|
||||
if (adjacent >= 0.0f) {
|
||||
if (opposite <= adjacent) {
|
||||
angle = Math_GetAtan2Tbl(opposite, adjacent);
|
||||
} else {
|
||||
angle = 0x4000 - Math_GetAtan2Tbl(adjacent, opposite);
|
||||
}
|
||||
} else {
|
||||
if (-adjacent < opposite) {
|
||||
angle = Math_GetAtan2Tbl(-adjacent, opposite) + 0x4000;
|
||||
} else {
|
||||
angle = 0x8000 - Math_GetAtan2Tbl(opposite, -adjacent);
|
||||
}
|
||||
}
|
||||
} else if (adjacent < 0.0f) {
|
||||
if (-opposite <= -adjacent) {
|
||||
angle = Math_GetAtan2Tbl(-opposite, -adjacent) + 0x8000;
|
||||
} else {
|
||||
angle = 0xC000 - Math_GetAtan2Tbl(-adjacent, -opposite);
|
||||
}
|
||||
} else {
|
||||
if (adjacent < -opposite) {
|
||||
angle = Math_GetAtan2Tbl(adjacent, -opposite) + 0xC000;
|
||||
} else {
|
||||
angle = -Math_GetAtan2Tbl(-opposite, adjacent);
|
||||
}
|
||||
}
|
||||
return angle;
|
||||
}
|
||||
|
||||
f32 Math_Atan2F(f32 opposite, f32 adjacent) {
|
||||
return Math_Atan2S(opposite, adjacent) * (M_PI / 0x8000);
|
||||
}
|
||||
|
||||
s16 Math_FAtan2F(f32 adjacent, f32 opposite) {
|
||||
return Math_Atan2S(opposite, adjacent);
|
||||
}
|
||||
|
||||
f32 Math_Acot2F(f32 adjacent, f32 opposite) {
|
||||
return Math_Atan2F(opposite, adjacent);
|
||||
}
|
||||
|
|
@ -322,8 +322,8 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Math_Vec3f_Diff(&player->unk368, &this->actor.world.pos, &sp68);
|
||||
sp48 = SQ(sp68.x) + SQ(sp68.z);
|
||||
sp4C = sqrtf(sp48);
|
||||
Matrix_RotateY(atans(sp68.x, sp68.z), MTXMODE_APPLY);
|
||||
SysMatrix_InsertXRotation_s(atans(-sp68.y, sp4C), MTXMODE_APPLY);
|
||||
Matrix_RotateY(Math_Atan2S(sp68.x, sp68.z), MTXMODE_APPLY);
|
||||
SysMatrix_InsertXRotation_s(Math_Atan2S(-sp68.y, sp4C), MTXMODE_APPLY);
|
||||
f0 = sqrtf(SQ(sp68.y) + sp48);
|
||||
Matrix_Scale(0.015f, 0.015f, f0 * 0.01f, MTXMODE_APPLY);
|
||||
gSPMatrix(sp44->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
|
|
|
|||
|
|
@ -3358,11 +3358,11 @@
|
|||
0x8017FAA8:("func_8017FAA8",),
|
||||
0x8017FB1C:("func_8017FB1C",),
|
||||
0x8017FD44:("func_8017FD44",),
|
||||
0x8017FEB0:("atans_first_8th",),
|
||||
0x8017FEE4:("atans",),
|
||||
0x801800CC:("atan",),
|
||||
0x8017FEB0:("Math_GetAtan2Tbl",),
|
||||
0x8017FEE4:("Math_Atan2S",),
|
||||
0x801800CC:("Math_Atan2F",),
|
||||
0x80180100:("Math_FAtan2F",),
|
||||
0x8018012C:("atan_flip",),
|
||||
0x8018012C:("Math_Acot2F",),
|
||||
0x80180160:("Matrix_Init",),
|
||||
0x8018019C:("Matrix_Push",),
|
||||
0x801801CC:("Matrix_Pop",),
|
||||
|
|
|
|||
|
|
@ -2356,7 +2356,7 @@
|
|||
0x801D1570:("D_801D1570","f32","[13]",0x34),
|
||||
0x801D15B0:("D_801D15B0","Vec3f","",0xC),
|
||||
0x801D15BC:("D_801D15BC","UNK_TYPE4","",0x4),
|
||||
0x801D15D0:("atan_first_8th_array","s16","[1025]",0x802),
|
||||
0x801D15D0:("sATan2Tbl","u16","[1025]",0x802),
|
||||
0x801D1DE0:("D_801D1DE0","RSPMatrix","",0x40),
|
||||
0x801D1E20:("D_801D1E20","MtxF","",0x40),
|
||||
0x801D1E60:("D_801D1E60","UNK_PTR","",0x4),
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import argparse
|
|||
# "old": "new"
|
||||
animdict ={
|
||||
"Actor_GetSwitchFlag": "Flags_GetSwitch",
|
||||
"atan_flip": "Math_Acot2F",
|
||||
"atans": "Math_Atan2S",
|
||||
}
|
||||
|
||||
def replace_anim(file):
|
||||
|
|
|
|||
Loading…
Reference in New Issue