diff options
| author | coco875 <59367621+coco875@users.noreply.github.com> | 2024-03-04 17:02:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-04 09:02:45 -0700 |
| commit | f99e242d97602a67ddcb107627f56effc4afd065 (patch) | |
| tree | 0859f2747159d82cc57f79495d6df30198819715 /src/code_80086E70.c | |
| parent | 1aa6824d3340fc6fb6eca917f8c3ed7c9259af06 (diff) | |
Document render/update objects (#565)
* Document objects related code.
* Including render/update objects code
* Various renamings
Diffstat (limited to 'src/code_80086E70.c')
| -rw-r--r-- | src/code_80086E70.c | 440 |
1 files changed, 220 insertions, 220 deletions
diff --git a/src/code_80086E70.c b/src/code_80086E70.c index a542edf54..869fd78d1 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -9,7 +9,7 @@ #include "math_util.h" #include "math_util_2.h" #include "racing/memory.h" -#include "code_80071F00.h" +#include "update_objects.h" #include "collision.h" #include "audio/external.h" #include "main.h" @@ -18,13 +18,13 @@ void func_80086E70(s32 objectIndex) { gObjectList[objectIndex].unk_0AE = 1;// * 0xE0)) = 1; - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); } void func_80086EAC(s32 objectIndex, s32 arg1, s16 arg2) { gObjectList[objectIndex].unk_0DD = arg1; gObjectList[objectIndex].unk_0AE = arg2; - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); } void func_80086EF0(s32 objectIndex) { @@ -41,7 +41,7 @@ void func_80086F60(s32 objectIndex) { gObjectList[objectIndex].unk_0AE = 0; gObjectList[objectIndex].unk_0DD = 0; gObjectList[objectIndex].unk_0DE = 0; - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); } bool func_80086FA4(s32 objectIndex) { @@ -53,12 +53,12 @@ bool func_80086FA4(s32 objectIndex) { } void func_80086FD4(s32 objectIndex) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); gObjectList[objectIndex].unk_0AE += 1; } void func_8008701C(s32 objectIndex, s32 arg1) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); gObjectList[objectIndex].unk_0AE = arg1; } @@ -66,13 +66,13 @@ s32 func_80087060(s32 objectIndex, s32 arg1) { s32 sp1C; sp1C = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); gObjectList[objectIndex].unk_0B0 = arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); sp1C = 1; } return sp1C; @@ -82,13 +82,13 @@ s32 func_80087104(s32 objectIndex, u16 arg1) { s32 sp24; sp24 = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); gObjectList[objectIndex].unk_0B0 = random_int(arg1); } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); sp24 = 1; } return sp24; @@ -98,13 +98,13 @@ s32 func_800871AC(s32 objectIndex, s32 arg1) { s32 sp24; sp24 = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); gObjectList[objectIndex].unk_0B0 = (s16) arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); func_80086FD4(objectIndex); sp24 = 1; } @@ -112,12 +112,12 @@ s32 func_800871AC(s32 objectIndex, s32 arg1) { } UNUSED void func_80087258(s32 objectIndex, UNUSED s32 arg1, f32 arg2) { - gObjectList[objectIndex].unk_028[1] += arg2; - gObjectList[objectIndex].unk_028[2] -= arg2; + gObjectList[objectIndex].offset[1] += arg2; + gObjectList[objectIndex].offset[2] -= arg2; } -UNUSED s32 func_80087294(s32 objectIndex, Player *player) { - return func_80041770(player->pos[0], gObjectList[objectIndex].pos[0], player->pos[2], gObjectList[objectIndex].pos[2]); +UNUSED s32 get_angle_between_player_object(s32 objectIndex, Player *player) { + return get_angle_between_xy(player->pos[0], gObjectList[objectIndex].pos[0], player->pos[2], gObjectList[objectIndex].pos[2]); } s32 angle_between_object_camera(s32 objectIndex, Camera *camera) { @@ -173,41 +173,41 @@ void func_80087620(s32 objectIndex) { } void func_800876A0(s32 objectIndex) { - gObjectList[objectIndex].unk_028[0] += gObjectList[objectIndex].unk_034 * sins(gObjectList[objectIndex].direction_angle[1]); - gObjectList[objectIndex].unk_028[2] += gObjectList[objectIndex].unk_034 * coss(gObjectList[objectIndex].direction_angle[1]); + gObjectList[objectIndex].offset[0] += gObjectList[objectIndex].unk_034 * sins(gObjectList[objectIndex].direction_angle[1]); + gObjectList[objectIndex].offset[2] += gObjectList[objectIndex].unk_034 * coss(gObjectList[objectIndex].direction_angle[1]); } -void func_80087710(s32 objectIndex) { - gObjectList[objectIndex].unk_028[0] += gObjectList[objectIndex].velocity[0]; - gObjectList[objectIndex].unk_028[1] += gObjectList[objectIndex].velocity[1]; - gObjectList[objectIndex].unk_028[2] += gObjectList[objectIndex].velocity[2]; +void object_add_velocity_offset_xyz(s32 objectIndex) { + gObjectList[objectIndex].offset[0] += gObjectList[objectIndex].velocity[0]; + gObjectList[objectIndex].offset[1] += gObjectList[objectIndex].velocity[1]; + gObjectList[objectIndex].offset[2] += gObjectList[objectIndex].velocity[2]; } -void func_8008775C(s32 objectIndex) { - gObjectList[objectIndex].unk_028[0] += gObjectList[objectIndex].velocity[0]; - gObjectList[objectIndex].unk_028[2] += gObjectList[objectIndex].velocity[2]; +void object_add_velocity_offset_xz(s32 objectIndex) { + gObjectList[objectIndex].offset[0] += gObjectList[objectIndex].velocity[0]; + gObjectList[objectIndex].offset[2] += gObjectList[objectIndex].velocity[2]; } -UNUSED void func_80087798(s32 objectIndex) { - gObjectList[objectIndex].unk_028[0] += gObjectList[objectIndex].velocity[0]; +UNUSED void object_add_velocity_offset_x(s32 objectIndex) { + gObjectList[objectIndex].offset[0] += gObjectList[objectIndex].velocity[0]; } -void func_800877C4(s32 objectIndex) { - gObjectList[objectIndex].unk_028[1] += gObjectList[objectIndex].velocity[1]; +void object_add_velocity_offset_y(s32 objectIndex) { + gObjectList[objectIndex].offset[1] += gObjectList[objectIndex].velocity[1]; } -UNUSED void func_800877F0(s32 objectIndex) { - gObjectList[objectIndex].unk_028[2] += gObjectList[objectIndex].velocity[2]; +UNUSED void object_add_velocity_offset_z(s32 objectIndex) { + gObjectList[objectIndex].offset[2] += gObjectList[objectIndex].velocity[2]; } void func_8008781C(s32 arg0) { func_8008751C(arg0); - func_8008775C(arg0); + object_add_velocity_offset_xz(arg0); } void func_80087844(s32 arg0) { func_8008757C(arg0); - func_80087710(arg0); + object_add_velocity_offset_xyz(arg0); } f32 func_8008786C(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { @@ -218,17 +218,17 @@ s32 func_8008789C(s32 objectIndex, s32 arg1) { s32 sp24; sp24 = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); func_8008751C(objectIndex); gObjectList[objectIndex].unk_0B0 = arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); sp24 = 1; } else { - func_8008775C(objectIndex); + object_add_velocity_offset_xz(objectIndex); } return sp24; } @@ -237,17 +237,17 @@ s32 func_80087954(s32 objectIndex, s32 arg1) { s32 sp24; sp24 = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); func_80087620(objectIndex); gObjectList[objectIndex].unk_0B0 = arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); sp24 = 1; } else { - func_8008775C(objectIndex); + object_add_velocity_offset_xz(objectIndex); } return sp24; } @@ -259,8 +259,8 @@ bool func_80087A0C(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { bool sp2C; sp2C = FALSE; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); temp_v0 = arg2 - arg1; temp_a0 = arg4 - arg3; dist = sqrtf((temp_v0 * temp_v0) + (temp_a0 * temp_a0)); @@ -271,10 +271,10 @@ bool func_80087A0C(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); sp2C = TRUE; } else { - func_8008775C(objectIndex); + object_add_velocity_offset_xz(objectIndex); } return sp2C; } @@ -283,13 +283,13 @@ s32 func_80087B84(s32 objectIndex, f32 arg1, f32 arg2) { s32 sp24; sp24 = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); gObjectList[objectIndex].velocity[1] = -arg1; } - func_800877C4(objectIndex); + object_add_velocity_offset_y(objectIndex); if (gObjectList[objectIndex].pos[1] <= arg2) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); func_80086FD4(objectIndex); sp24 = 1; } @@ -300,19 +300,19 @@ s32 func_80087C48(s32 objectIndex, f32 arg1, f32 arg2, s32 arg3) { s32 sp24; sp24 = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != FALSE) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != FALSE) { + set_object_flag_status_true(objectIndex, 8); gObjectList[objectIndex].velocity[1] = arg1; gObjectList[objectIndex].unk_0B0 = (s16) arg3; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); func_80086FD4(objectIndex); sp24 = 1; } else { gObjectList[objectIndex].velocity[1] -= arg2; - func_800877C4(objectIndex); + object_add_velocity_offset_y(objectIndex); } return sp24; } @@ -321,15 +321,15 @@ s32 func_80087D24(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3) { s32 sp24; sp24 = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != 0) { - set_object_flag_unk_054_true(objectIndex, 8); + if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { + set_object_flag_status_true(objectIndex, 8); gObjectList[objectIndex].velocity[1] = arg1; } gObjectList[objectIndex].velocity[1] -= arg2; - func_800877C4(objectIndex); - if (gObjectList[objectIndex].unk_028[1] <= arg3) { - set_object_flag_unk_054_false(objectIndex, 8); - gObjectList[objectIndex].unk_028[1] = arg3; + object_add_velocity_offset_y(objectIndex); + if (gObjectList[objectIndex].offset[1] <= arg3) { + set_object_flag_status_false(objectIndex, 8); + gObjectList[objectIndex].offset[1] = arg3; func_80086FD4(objectIndex); sp24 = 1; } @@ -341,11 +341,11 @@ bool func_80087E08(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s32 UNUSED s32 pad; sp2C = FALSE; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != 0) { - set_object_flag_unk_054_true(objectIndex, 8); - gObjectList[objectIndex].unk_028[2] = 0.0f; - gObjectList[objectIndex].unk_028[1] = 0.0f; - gObjectList[objectIndex].unk_028[0] = 0.0f; + if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { + set_object_flag_status_true(objectIndex, 8); + gObjectList[objectIndex].offset[2] = 0.0f; + gObjectList[objectIndex].offset[1] = 0.0f; + gObjectList[objectIndex].offset[0] = 0.0f; gObjectList[objectIndex].unk_034 = arg3; gObjectList[objectIndex].velocity[1] = arg1; gObjectList[objectIndex].direction_angle[1] = arg4; @@ -354,12 +354,12 @@ bool func_80087E08(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s32 } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); func_80086FD4(objectIndex); sp2C = TRUE; } else { gObjectList[objectIndex].velocity[1] -= arg2; - func_80087710(objectIndex); + object_add_velocity_offset_xyz(objectIndex); } return sp2C; } @@ -369,24 +369,24 @@ UNUSED s32 func_80087F14(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4 UNUSED s32 stackPadding; sp2C = 0; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != 0) { - set_object_flag_unk_054_true(objectIndex, 8); - gObjectList[objectIndex].unk_028[2] = 0.0f; - gObjectList[objectIndex].unk_028[1] = 0.0f; - gObjectList[objectIndex].unk_028[0] = 0.0f; + if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { + set_object_flag_status_true(objectIndex, 8); + gObjectList[objectIndex].offset[2] = 0.0f; + gObjectList[objectIndex].offset[1] = 0.0f; + gObjectList[objectIndex].offset[0] = 0.0f; gObjectList[objectIndex].unk_034 = arg3; gObjectList[objectIndex].velocity[1] = arg1; gObjectList[objectIndex].direction_angle[1] = arg4; func_8008751C(objectIndex); gObjectList[objectIndex].unk_0B0 = gVBlankTimer; } - if (gObjectList[objectIndex].unk_028[1] <= arg5) { - set_object_flag_unk_054_false(objectIndex, 8); + if (gObjectList[objectIndex].offset[1] <= arg5) { + set_object_flag_status_false(objectIndex, 8); func_80086FD4(objectIndex); sp2C = 1; } else { gObjectList[objectIndex].velocity[1] -= arg2; - func_80087710(objectIndex); + object_add_velocity_offset_xyz(objectIndex); } return sp2C; } @@ -395,13 +395,13 @@ void func_80088038(s32 objectIndex, f32 arg1, u16 arg2) { f32 temp_f4; f32 sp20; - temp_f4 = gObjectList[objectIndex].unk_028[0]; - sp20 = gObjectList[objectIndex].unk_028[2]; + temp_f4 = gObjectList[objectIndex].offset[0]; + sp20 = gObjectList[objectIndex].offset[2]; gObjectList[objectIndex].unk_0C4 += arg2; - gObjectList[objectIndex].unk_028[0] = sins(gObjectList[objectIndex].unk_0C4) * arg1; - gObjectList[objectIndex].unk_028[2] = coss(gObjectList[objectIndex].unk_0C4) * arg1; - gObjectList[objectIndex].velocity[0] = gObjectList[objectIndex].unk_028[0] - temp_f4; - gObjectList[objectIndex].velocity[2] = gObjectList[objectIndex].unk_028[2] - sp20; + gObjectList[objectIndex].offset[0] = sins(gObjectList[objectIndex].unk_0C4) * arg1; + gObjectList[objectIndex].offset[2] = coss(gObjectList[objectIndex].unk_0C4) * arg1; + gObjectList[objectIndex].velocity[0] = gObjectList[objectIndex].offset[0] - temp_f4; + gObjectList[objectIndex].velocity[2] = gObjectList[objectIndex].offset[2] - sp20; } UNUSED void func_800880DC(void) { @@ -449,9 +449,9 @@ void func_80088228(s32 objectIndex) { but for some unholy reason that doesn't match */ temp_v0->unk_084[8] = *((s16*)temp_v0->controlPoints - 1); - temp_v0->unk_028[0] = temp_v0->controlPoints[0].pos[0]; - temp_v0->unk_028[1] = temp_v0->controlPoints[0].pos[1]; - temp_v0->unk_028[2] = temp_v0->controlPoints[0].pos[2]; + temp_v0->offset[0] = temp_v0->controlPoints[0].pos[0]; + temp_v0->offset[1] = temp_v0->controlPoints[0].pos[1]; + temp_v0->offset[2] = temp_v0->controlPoints[0].pos[2]; func_80086FD4(objectIndex); } @@ -463,9 +463,9 @@ s32 func_800882B0(s32 objectIndex, s32 arg1) { s32 var_v1; var_v1 = 0; - temp_f0 = (s32)((D_80165760[1] - gObjectList[objectIndex].unk_028[0]) * (D_80165760[1] - gObjectList[objectIndex].unk_028[0])); - temp_f12 = (s32)((D_80165770[1] - gObjectList[objectIndex].unk_028[1]) * (D_80165770[1] - gObjectList[objectIndex].unk_028[1])); - temp_f2 = (s32)((D_80165780[1] - gObjectList[objectIndex].unk_028[2]) * (D_80165780[1] - gObjectList[objectIndex].unk_028[2])); + temp_f0 = (s32)((D_80165760[1] - gObjectList[objectIndex].offset[0]) * (D_80165760[1] - gObjectList[objectIndex].offset[0])); + temp_f12 = (s32)((D_80165770[1] - gObjectList[objectIndex].offset[1]) * (D_80165770[1] - gObjectList[objectIndex].offset[1])); + temp_f2 = (s32)((D_80165780[1] - gObjectList[objectIndex].offset[2]) * (D_80165780[1] - gObjectList[objectIndex].offset[2])); if ((temp_f0 + temp_f12 + temp_f2 - (arg1 * arg1)) <= 0) { var_v1 = 1; } @@ -509,12 +509,12 @@ s32 func_8008847C(s32 objectIndex) { s32 sp2C; sp2C = 0; - set_object_flag_unk_054_false(objectIndex, 0x00800000); - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000400) != 0) { + set_object_flag_status_false(objectIndex, 0x00800000); + if (is_obj_flag_status_active(objectIndex, 0x00000400) != 0) { func_802ADDC8(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { sp2C = 1; - set_object_flag_unk_054_true(objectIndex, 0x00800000); + set_object_flag_status_true(objectIndex, 0x00800000); } gObjectList[objectIndex].unk_044 = func_802ABE30(gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.unk3A); } @@ -525,12 +525,12 @@ s32 func_80088538(s32 objectIndex) { s32 sp2C; sp2C = 0; - set_object_flag_unk_054_false(objectIndex, 0x00800000); - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000400) != 0) { + set_object_flag_status_false(objectIndex, 0x00800000); + if (is_obj_flag_status_active(objectIndex, 0x00000400) != 0) { func_802ADDC8(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { sp2C = 1; - set_object_flag_unk_054_true(objectIndex, 0x00800000); + set_object_flag_status_true(objectIndex, 0x00800000); } gObjectList[objectIndex].unk_044 = func_802ABE30(gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.unk3A); gObjectList[objectIndex].unk_0B8[0] = atan2s(D_8018C3B0.orientationVector[2], D_8018C3B0.orientationVector[1]) + 0x4000; @@ -543,12 +543,12 @@ s32 func_8008861C(s32 objectIndex) { s32 sp2C; sp2C = 0; - set_object_flag_unk_054_false(objectIndex, 0x00800000); - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000400) != 0) { + set_object_flag_status_false(objectIndex, 0x00800000); + if (is_obj_flag_status_active(objectIndex, 0x00000400) != 0) { func_802ADDC8(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { sp2C = 1; - set_object_flag_unk_054_true(objectIndex, 0x00800000); + set_object_flag_status_true(objectIndex, 0x00800000); } gObjectList[objectIndex].unk_044 = func_802ABE30(gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.unk3A); gObjectList[objectIndex].unk_01C[0] = D_8018C3B0.orientationVector[0]; @@ -561,26 +561,26 @@ s32 func_8008861C(s32 objectIndex) { void func_800886F4(s32 objectIndex) { func_802ADDC8(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { - set_object_flag_unk_054_true(objectIndex, 0x00800000); + set_object_flag_status_true(objectIndex, 0x00800000); gObjectList[objectIndex].unk_044 = func_802ABE30(gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.unk3A); gObjectList[objectIndex].unk_0B8[0] = atan2s(D_8018C3B0.orientationVector[2], D_8018C3B0.orientationVector[1]) + 0x4000; gObjectList[objectIndex].unk_0B8[2] = atan2s(D_8018C3B0.orientationVector[0], D_8018C3B0.orientationVector[1]); return; } - set_object_flag_unk_054_false(objectIndex, 0x00800000); + set_object_flag_status_false(objectIndex, 0x00800000); } void func_800887C0(s32 objectIndex) { func_802ADDC8(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { - set_object_flag_unk_054_true(objectIndex, 0x00800000); + set_object_flag_status_true(objectIndex, 0x00800000); gObjectList[objectIndex].unk_044 = func_802ABE30(gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.unk3A); gObjectList[objectIndex].velocity[0] = D_8018C3B0.orientationVector[0]; gObjectList[objectIndex].velocity[1] = D_8018C3B0.orientationVector[1]; gObjectList[objectIndex].velocity[2] = D_8018C3B0.orientationVector[2]; return; } - set_object_flag_unk_054_false(objectIndex, 0x00800000); + set_object_flag_status_false(objectIndex, 0x00800000); } /** @@ -1038,7 +1038,7 @@ void func_80089474(s32 objectIndex, s32 playerId, f32 arg2, f32 arg3, u32 soundB Player *player; player = &gPlayerOne[playerId]; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } if ((func_8008933C(player, objectIndex, arg2, arg3) >= 4.0) && ((player->type & PLAYER_CPU) != PLAYER_CPU)) { @@ -1063,10 +1063,10 @@ s32 func_800895E4(s32 objectIndex) { var_s6 = 0; player = gPlayerOne; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++) { if ((gObjectList[objectIndex].state != 0) && (has_collided_horizontally_with_player(objectIndex, player) != 0)) { - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } var_s6 = 1; @@ -1081,11 +1081,11 @@ void func_800896D4(s32 objectIndex, f32 arg1, f32 arg2) { s32 var_s1; player = gPlayerOne; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++) { if ((gObjectList[objectIndex].state != 0) && !(player->effects & (STAR_EFFECT | BOO_EFFECT)) && (has_collided_horizontally_with_player(objectIndex, player) != 0)) { func_8008933C(player, objectIndex, arg1, arg2 * 1.1); - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } } @@ -1098,15 +1098,15 @@ void func_80089820(s32 objectIndex, f32 arg1, f32 arg2, u32 arg3) { s32 var_s1; player = gPlayerOne; - set_object_flag_unk_054_false(objectIndex, 0x02000000); - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + set_object_flag_status_false(objectIndex, 0x02000000); + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++) { if ((gObjectList[objectIndex].state != 0) && !(player->effects & BOO_EFFECT)) { if ((player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) && (has_collided_horizontally_with_player(objectIndex, player) != 0)) { if (player->effects & STAR_EFFECT) { - set_object_flag_unk_054_true(objectIndex, 0x02000000); + set_object_flag_status_true(objectIndex, 0x02000000); } else { - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } if ((func_8008933C(player, objectIndex, arg1, arg2 * 1.1) >= 4.0) && ((player->type & PLAYER_CPU) != PLAYER_CPU)) { @@ -1124,11 +1124,11 @@ void func_80089A04(s32 objectIndex, f32 arg1, f32 arg2) { s32 var_s1; player = gPlayerOne; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++) { if ((gObjectList[objectIndex].state != 0) && !(player->effects & (BOO_EFFECT | STAR_EFFECT)) && (has_collided_with_player(objectIndex, player) != 0)) { func_8008933C(player, objectIndex, arg1, arg2 * 1.1); - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } } @@ -1145,12 +1145,12 @@ s32 func_80089B50(s32 objectIndex) { test = 0; sp40 = 0; player = gPlayerOne; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++, test++) { if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x81000000) && (player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) && (has_collided_horizontally_with_player(objectIndex, player) != 0)) { if (!(player->effects & STAR_EFFECT)) { player->soundEffects |= REVERSE_SOUND_EFFECT; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } } else { @@ -1170,13 +1170,13 @@ s32 func_80089CBC(s32 objectIndex, f32 arg1) { var_s7 = 0; player = gPlayerOne; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++) { if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x81000000)) { if ((player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) && (has_collided_with_player_and_within_height(objectIndex, player, arg1) != 0)) { if (!(player->effects & STAR_EFFECT)) { player->soundEffects |= REVERSE_SOUND_EFFECT; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } } @@ -1195,7 +1195,7 @@ s32 func_80089E18(s32 objectIndex) { var_s6 = 0; player = gPlayerOne; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++) { if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x800000C0) && (has_collided_horizontally_with_player(objectIndex, player) != 0)) { if (player->effects & STAR_EFFECT) { @@ -1216,12 +1216,12 @@ s32 func_80089F24(s32 objectIndex) { var_s7 = 0; player = gPlayerOne; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x00000200) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { for (var_s1 = 0; var_s1 < D_8018D158; var_s1++, player++) { if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x800002C0)) { if ((player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) && (has_collided_horizontally_with_player(objectIndex, player) != 0)) { var_s7 = 1; - if (is_obj_index_flag_unk_054_active(objectIndex, 0x04000000) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); } player->soundEffects |= 0x200000; @@ -1262,14 +1262,14 @@ s32 func_8008A0B4(s32 objectIndex, Player *player, Camera *camera, u16 arg3) { return var_t0; } -s32 func_8008A140(s32 objectIndex, Camera *camera, u16 arg2) { +bool is_object_visible_on_camera(s32 objectIndex, Camera *camera, u16 angle) { u16 temp_t2; s32 var_t0; - var_t0 = 0; - temp_t2 = (func_80041770(camera->pos[0], gObjectList[objectIndex].pos[0], camera->pos[2], gObjectList[objectIndex].pos[2]) + ((s32) arg2 / 2)) - camera->rot[1]; - if ((temp_t2 >= 0) && (arg2 >= temp_t2)) { - var_t0 = 1; + var_t0 = FALSE; + temp_t2 = (get_angle_between_xy(camera->pos[0], gObjectList[objectIndex].pos[0], camera->pos[2], gObjectList[objectIndex].pos[2]) + ((s32) angle / 2)) - camera->rot[1]; + if ((temp_t2 >= 0) && (angle >= temp_t2)) { + var_t0 = TRUE; } return var_t0; } @@ -1280,7 +1280,7 @@ void func_8008A1D0(s32 objectIndex, s32 cameraId, s32 arg2, s32 arg3) { Camera *camera; camera = &camera1[cameraId]; - set_object_flag_unk_054_false(objectIndex, 0x00140000); + set_object_flag_status_false(objectIndex, 0x00100000 | VISIBLE); temp_v0 = get_horizontal_distance_to_camera(objectIndex, camera); if (temp_v0 < 0x2711U) { var_a2 = 0x5555; @@ -1289,10 +1289,10 @@ void func_8008A1D0(s32 objectIndex, s32 cameraId, s32 arg2, s32 arg3) { } else { var_a2 = 0x2AAB; } - if ((func_8008A140(objectIndex, camera, var_a2) != 0) && ((u32) (arg3 * arg3) >= temp_v0)) { - set_object_flag_unk_054_true(objectIndex, 0x00040000); + if ((is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) && ((u32) (arg3 * arg3) >= temp_v0)) { + set_object_flag_status_true(objectIndex, VISIBLE); if (temp_v0 >= (u32) (arg2 * arg2)) { - set_object_flag_unk_054_true(objectIndex, 0x00100000); + set_object_flag_status_true(objectIndex, 0x00100000); } } } @@ -1304,7 +1304,7 @@ UNUSED void func_8008A2CC(s32 objectIndex, s32 cameraId, u16 arg2) { u16 var_a2; camera = &camera1[cameraId]; - set_object_flag_unk_054_false(objectIndex, 0x00040000); + set_object_flag_status_false(objectIndex, VISIBLE); if (no_init < 0x2711U) { var_a2 = 0x5555; } else if (no_init < 0x9C41U) { @@ -1312,40 +1312,40 @@ UNUSED void func_8008A2CC(s32 objectIndex, s32 cameraId, u16 arg2) { } else { var_a2 = arg2; } - if (func_8008A140(objectIndex, camera, var_a2) != 0) { - set_object_flag_unk_054_true(objectIndex, 0x00040000); + if (is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) { + set_object_flag_status_true(objectIndex, VISIBLE); } } s32 func_8008A364(s32 objectIndex, s32 cameraId, u16 arg2, s32 arg3) { Camera *camera; - u32 var_v1; + u32 dist; u16 var_a2; camera = &camera1[cameraId]; - set_object_flag_unk_054_false(objectIndex, 0x00060000); - var_v1 = get_horizontal_distance_to_camera(objectIndex, camera); - if (var_v1 < (arg3 * arg3)) { - set_object_flag_unk_054_true(objectIndex, 0x00020000); - if (var_v1 < 0x2711U) { + set_object_flag_status_false(objectIndex, 0x00020000 | VISIBLE); + dist = get_horizontal_distance_to_camera(objectIndex, camera); + if (dist < (arg3 * arg3)) { + set_object_flag_status_true(objectIndex, 0x00020000); + if (dist < 0x2711U) { var_a2 = 0x5555; - } else if (var_v1 < 0x9C41U) { + } else if (dist < 0x9C41U) { var_a2 = 0x4000; } else { var_a2 = arg2; } - if (func_8008A140(objectIndex, camera, var_a2) != 0) { - set_object_flag_unk_054_true(objectIndex, 0x00040000); + if (is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) { + set_object_flag_status_true(objectIndex, VISIBLE); } } - return var_v1; + return dist; } void func_8008A454(s32 objectIndex, s32 cameraId, s32 arg2) { if (get_horizontal_distance_to_camera(objectIndex, &camera1[cameraId]) < (u32) (arg2 * arg2)) { - set_object_flag_unk_054_true(objectIndex, 0x00000020); + set_object_flag_status_true(objectIndex, 0x00000020); } else { - set_object_flag_unk_054_false(objectIndex, 0x00000020); + set_object_flag_status_false(objectIndex, 0x00000020); } } @@ -1353,16 +1353,16 @@ void func_8008A4CC(s32 objectIndex) { s32 loopIndex; Camera *camera; - set_object_flag_unk_054_false(objectIndex, 0x00070000); + set_object_flag_status_false(objectIndex, 0x00070000); for (loopIndex = 0, camera = camera1; loopIndex < gPlayerCountSelection1; loopIndex++, camera++) { if (gObjectList[objectIndex].state != 0) { if ((D_8018CF68[loopIndex] >= (gObjectList[objectIndex].unk_0DF - 1)) && ((gObjectList[objectIndex].unk_0DF + 1) >= D_8018CF68[loopIndex])) { - set_object_flag_unk_054_true(objectIndex, 0x00010000); + set_object_flag_status_true(objectIndex, 0x00010000); if (D_8018CF68[loopIndex] == gObjectList[objectIndex].unk_0DF) { - set_object_flag_unk_054_true(objectIndex, 0x00020000); + set_object_flag_status_true(objectIndex, 0x00020000); } - if (func_8008A140(objectIndex, camera, 0x2AABU) != 0) { - set_object_flag_unk_054_true(objectIndex, 0x00040000); + if (is_object_visible_on_camera(objectIndex, camera, 0x2AABU) != 0) { + set_object_flag_status_true(objectIndex, VISIBLE); } } } @@ -1373,10 +1373,10 @@ UNUSED void func_8008A610(s32 objectIndex) { s32 loopIndex; Camera *camera; - set_object_flag_unk_054_false(objectIndex, 0x00040000); + set_object_flag_status_false(objectIndex, VISIBLE); for (camera = camera1, loopIndex = 0; loopIndex < gPlayerCountSelection1; loopIndex++, camera++) { - if ((gObjectList[objectIndex].state != 0) && (func_8008A140(objectIndex, camera, 0x2AABU) != 0)) { - set_object_flag_unk_054_true(objectIndex, 0x00040000); + if ((gObjectList[objectIndex].state != 0) && (is_object_visible_on_camera(objectIndex, camera, 0x2AABU) != 0)) { + set_object_flag_status_true(objectIndex, VISIBLE); } } } @@ -1386,17 +1386,17 @@ void func_8008A6DC(s32 objectIndex, f32 arg1) { s32 loopIndex; Camera *camera; - set_object_flag_unk_054_false(objectIndex, 0x00060000); + set_object_flag_status_false(objectIndex, 0x00060000); for (camera = camera1, loopIndex = 0; loopIndex < gPlayerCountSelection1; loopIndex++, camera++) { if ((gObjectList[objectIndex].state != 0) && (is_within_horizontal_distance_to_camera(objectIndex, camera, arg1) != 0)) { - set_object_flag_unk_054_true(objectIndex, 0x00020000); + set_object_flag_status_true(objectIndex, 0x00020000); if (arg1 <= 500.0) { var_a2 = 0x4000; } else { var_a2 = 0x2AAB; } - if (func_8008A140(objectIndex, camera, var_a2) != 0) { - set_object_flag_unk_054_true(objectIndex, 0x00040000); + if (is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) { + set_object_flag_status_true(objectIndex, VISIBLE); } } } @@ -1468,9 +1468,9 @@ void func_8008AA3C(s32 objectIndex) { but for some unholy reason that doesn't match */ temp_v0->unk_084[8] = *((s16*)temp_v0->controlPoints - 1); - temp_v0->unk_028[0] = temp_v0->controlPoints[0].pos[0]; - temp_v0->unk_028[1] = temp_v0->controlPoints[0].pos[1]; - temp_v0->unk_028[2] = temp_v0->controlPoints[0].pos[2]; + temp_v0->offset[0] = temp_v0->controlPoints[0].pos[0]; + temp_v0->offset[1] = temp_v0->controlPoints[0].pos[1]; + temp_v0->offset[2] = temp_v0->controlPoints[0].pos[2]; temp_v0->unk_09A = (s16) (10000 / temp_v0->controlPoints[0].velocity); func_8008A920(objectIndex); func_80086FD4(objectIndex); @@ -1481,9 +1481,9 @@ void func_8008AB10(s32 objectIndex) { Objects *temp_v0; temp_v0 = &gObjectList[objectIndex]; - temp_v0->unk_028[0] += temp_v0->velocity[0]; - temp_v0->unk_028[1] += temp_v0->velocity[1]; - temp_v0->unk_028[2] += temp_v0->velocity[2]; + temp_v0->offset[0] += temp_v0->velocity[0]; + temp_v0->offset[1] += temp_v0->velocity[1]; + temp_v0->offset[2] += temp_v0->velocity[2]; temp_v0->timer += (u16)temp_v0->unk_09A; if (temp_v0->timer >= 0x2710) { temp_v0->unk_084[9] = (u16)temp_v0->unk_084[9] + 1; @@ -1611,9 +1611,9 @@ void func_8008B038(s32 objectIndex) { Objects *temp_v0; temp_v0 = &gObjectList[objectIndex]; - temp_v0->unk_028[0] = (D_80183DA8[0] * D_80165760[0]) + (D_80183DA8[1] * D_80165760[1]) + (D_80183DA8[2] * D_80165760[2]) + (D_80183DA8[3] * D_80165760[3]); - temp_v0->unk_028[1] = (D_80183DA8[0] * D_80165770[0]) + (D_80183DA8[1] * D_80165770[1]) + (D_80183DA8[2] * D_80165770[2]) + (D_80183DA8[3] * D_80165770[3]); - temp_v0->unk_028[2] = (D_80183DA8[0] * D_80165780[0]) + (D_80183DA8[1] * D_80165780[1]) + (D_80183DA8[2] * D_80165780[2]) + (D_80183DA8[3] * D_80165780[3]); + temp_v0->offset[0] = (D_80183DA8[0] * D_80165760[0]) + (D_80183DA8[1] * D_80165760[1]) + (D_80183DA8[2] * D_80165760[2]) + (D_80183DA8[3] * D_80165760[3]); + temp_v0->offset[1] = (D_80183DA8[0] * D_80165770[0]) + (D_80183DA8[1] * D_80165770[1]) + (D_80183DA8[2] * D_80165770[2]) + (D_80183DA8[3] * D_80165770[3]); + temp_v0->offset[2] = (D_80183DA8[0] * D_80165780[0]) + (D_80183DA8[1] * D_80165780[1]) + (D_80183DA8[2] * D_80165780[2]) + (D_80183DA8[3] * D_80165780[3]); } void func_8008B17C(s32 objectIndex, f32 arg1) { @@ -1686,7 +1686,7 @@ void func_8008B3E4(s32 objectIndex) { Objects *temp_v0; SplineData *spline; - if (is_obj_index_flag_unk_054_inactive(objectIndex, 8) != 0) { + if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { temp_v0 = &gObjectList[objectIndex]; temp_v0->unk_084[9] = 0; temp_v0->timer = 0; @@ -1698,7 +1698,7 @@ void func_8008B3E4(s32 objectIndex) { */ temp_v0->unk_084[8] = *(((s16*)temp_v0->controlPoints) - 1); - set_object_flag_unk_054_true(objectIndex, 8); + set_object_flag_status_true(objectIndex, 8); } } @@ -1726,7 +1726,7 @@ void func_8008B478(s32 objectIndex, s32 arg1) { sp34 = ((f32)gObjectList[objectIndex].timer / 10000.0); // Calculate the curve at `t` func_8008B17C(objectIndex, sp34); - if (is_obj_index_flag_unk_054_active(objectIndex, 0x800) != 0) { + if (is_obj_flag_status_active(objectIndex, 0x800) != 0) { // Calculate the curve's derivative at `t` func_8008AFE0(objectIndex, sp34); } @@ -1765,7 +1765,7 @@ void func_8008B6A4(s32 objectIndex) { // Have to do it this way due to the u16 cast temp_v0->unk_084[9] = (u16) temp_v0->unk_084[9] + 1; if ((u16)temp_v0->unk_084[9] == (u16)temp_v0->unk_084[8]) { - set_object_flag_unk_054_false(objectIndex, 8); + set_object_flag_status_false(objectIndex, 8); } else { func_8008B44C(objectIndex); } @@ -1801,18 +1801,18 @@ void set_obj_origin_pos(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3) { gObjectList[objectIndex].origin_pos[2] = arg3; } -void func_8008B80C(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3) { - gObjectList[objectIndex].unk_028[0] = arg1; - gObjectList[objectIndex].unk_028[1] = arg2; - gObjectList[objectIndex].unk_028[2] = arg3; +void set_obj_origin_offset(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3) { + gObjectList[objectIndex].offset[0] = arg1; + gObjectList[objectIndex].offset[1] = arg2; + gObjectList[objectIndex].offset[2] = arg3; } void func_8008B844(s32 objectIndex) { f32 temp_f0 = gObjectList[objectIndex].origin_pos[0]; - gObjectList[objectIndex].pos[0] = gObjectList[objectIndex].unk_028[0] + temp_f0; - gObjectList[objectIndex].pos[1] = gObjectList[objectIndex].unk_028[1] + temp_f0; - gObjectList[objectIndex].pos[2] = gObjectList[objectIndex].unk_028[2] + temp_f0; + gObjectList[objectIndex].pos[0] = gObjectList[objectIndex].offset[0] + temp_f0; + gObjectList[objectIndex].pos[1] = gObjectList[objectIndex].offset[1] + temp_f0; + gObjectList[objectIndex].pos[2] = gObjectList[objectIndex].offset[2] + temp_f0; } void set_obj_direction_angle(s32 objectIndex, u16 arg1, u16 arg2, u16 arg3) { @@ -1849,63 +1849,63 @@ void func_8008B928(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, SplineData *sp temp_s0->direction_angle[0] = get_x_direction_angle(objectIndex); } -UNUSED void func_8008BA40(s32 objectIndex, s16 arg1, u16 arg2) { - s16 test; +UNUSED void object_origin_pos_randomize_around_x(s32 objectIndex, s16 x, u16 arg2) { + s16 offset_x; - test = random_int(arg2) - (arg2 / 2); - gObjectList[objectIndex].origin_pos[0] = arg1 + test; + offset_x = random_int(arg2) - (arg2 / 2); + gObjectList[objectIndex].origin_pos[0] = x + offset_x; } -void func_8008BAB4(s32 objectIndex, s16 arg1, u16 arg2) { - s16 test; +void object_origin_pos_randomize_around_y(s32 objectIndex, s16 y, u16 arg2) { + s16 offset_y; - test = random_int(arg2) - (arg2 / 2); - gObjectList[objectIndex].origin_pos[1] = arg1 + test; + offset_y = random_int(arg2) - (arg2 / 2); + gObjectList[objectIndex].origin_pos[1] = y + offset_y; } -UNUSED void func_8008BB28(s32 objectIndex, s16 arg1, u16 arg2) { - s16 test; +UNUSED void object_origin_pos_randomize_around_z(s32 objectIndex, s16 z, u16 arg2) { + s16 offset_z; - test = random_int(arg2) - (arg2 / 2); - gObjectList[objectIndex].origin_pos[2] = arg1 + test; + offset_z = random_int(arg2) - (arg2 / 2); + gObjectList[objectIndex].origin_pos[2] = z + offset_z; } -UNUSED void func_8008BB9C(s32 objectIndex, s16 arg1, s16 arg2, u16 arg3, u16 arg4) { - s16 sp1E; - s16 temp_v0; +UNUSED void object_origin_pos_randomize_around_xy(s32 objectIndex, s16 x, s16 y, u16 arg3, u16 arg4) { + s16 offset_x; + s16 offset_y; - sp1E = random_int(arg3) - ((s32) arg3 / 2); - temp_v0 = random_int(arg4) - ((s32) arg4 / 2); - gObjectList[objectIndex].origin_pos[0] = arg1 + sp1E; - gObjectList[objectIndex].origin_pos[1] = arg2 + temp_v0; + offset_x = random_int(arg3) - ((s32) arg3 / 2); + offset_y = random_int(arg4) - ((s32) arg4 / 2); + gObjectList[objectIndex].origin_pos[0] = x + offset_x; + gObjectList[objectIndex].origin_pos[1] = y + offset_y; } -UNUSED void func_8008BC58(s32 objectIndex, s16 arg1, s16 arg2, u16 arg3, u16 arg4) { - s16 sp1E; - s16 temp_v0; +UNUSED void object_origin_pos_randomize_around_xz(s32 objectIndex, s16 x, s16 z, u16 arg3, u16 arg4) { + s16 offset_x; + s16 offset_z; - sp1E = random_int(arg3) - ((s32) arg3 / 2); - temp_v0 = random_int(arg4) - ((s32) arg4 / 2); - gObjectList[objectIndex].origin_pos[0] = arg1 + sp1E; - gObjectList[objectIndex].origin_pos[2] = arg2 + temp_v0; + offset_x = random_int(arg3) - ((s32) arg3 / 2); + offset_z = random_int(arg4) - ((s32) arg4 / 2); + gObjectList[objectIndex].origin_pos[0] = x + offset_x; + gObjectList[objectIndex].origin_pos[2] = z + offset_z; } -void func_8008BD14(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, u16 arg4, u16 arg5, u16 arg6) { - s16 sp1E; - s16 sp1C; - s16 temp_v0; +void object_origin_pos_randomize_around_xyz(s32 objectIndex, s16 x, s16 y, s16 z, u16 arg4, u16 arg5, u16 arg6) { + s16 offset_x; + s16 offset_y; + s16 offset_z; - sp1E = random_int(arg4) - ((s32) arg4 / 2); - sp1C = random_int(arg5) - ((s32) arg5 / 2); - temp_v0 = random_int(arg6) - ((s32) arg6 / 2); - gObjectList[objectIndex].origin_pos[0] = arg1 + sp1E; - gObjectList[objectIndex].origin_pos[1] = arg2 + sp1C; - gObjectList[objectIndex].origin_pos[2] = arg3 + temp_v0; + offset_x = random_int(arg4) - ((s32) arg4 / 2); + offset_y = random_int(arg5) - ((s32) arg5 / 2); + offset_z = random_int(arg6) - ((s32) arg6 / 2); + gObjectList[objectIndex].origin_pos[0] = x + offset_x; + gObjectList[objectIndex].origin_pos[1] = y + offset_y; + gObjectList[objectIndex].origin_pos[2] = z + offset_z; } -void func_8008BE0C(s32 objectIndex, s16 arg1, u16 arg2) { - gObjectList[objectIndex].origin_pos[0] = gPlayerOneCopy->pos[0] + (sins(arg2) * arg1); - gObjectList[objectIndex].origin_pos[2] = gPlayerOneCopy->pos[2] + (coss(arg2) * arg1); +void object_origin_pos_around_player_one(s32 objectIndex, s16 dist, u16 angle) { + gObjectList[objectIndex].origin_pos[0] = gPlayerOneCopy->pos[0] + (sins(angle) * dist); + gObjectList[objectIndex].origin_pos[2] = gPlayerOneCopy->pos[2] + (coss(angle) * dist); } UNUSED void func_8008BEA4(s32 objectIndex, u16 arg1, u16 arg2) { @@ -1914,13 +1914,13 @@ UNUSED void func_8008BEA4(s32 objectIndex, u16 arg1, u16 arg2) { thing = random_int(arg1); thing2 = camera1->rot[1] + random_int(arg2) - ((s32) arg2 / 2); - func_8008BE0C(objectIndex, thing, thing2); + object_origin_pos_around_player_one(objectIndex, thing, thing2); } -void func_8008BF18(s32 objectIndex) { - gObjectList[objectIndex].pos[0] = gObjectList[objectIndex].origin_pos[0] + gObjectList[objectIndex].unk_028[0]; - gObjectList[objectIndex].pos[1] = gObjectList[objectIndex].origin_pos[1] + gObjectList[objectIndex].unk_028[1]; - gObjectList[objectIndex].pos[2] = gObjectList[objectIndex].origin_pos[2] + gObjectList[objectIndex].unk_028[2]; +void object_calculate_new_pos_offset(s32 objectIndex) { + gObjectList[objectIndex].pos[0] = gObjectList[objectIndex].origin_pos[0] + gObjectList[objectIndex].offset[0]; + gObjectList[objectIndex].pos[1] = gObjectList[objectIndex].origin_pos[1] + gObjectList[objectIndex].offset[1]; + gObjectList[objectIndex].pos[2] = gObjectList[objectIndex].origin_pos[2] + gObjectList[objectIndex].offset[2]; } void func_8008BF64(s32 objectIndex) { |
