From d4bcc4a621f17b92278b7632ffeb11d0d165b981 Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Sat, 17 May 2025 19:25:40 -0300 Subject: [PATCH] Vec3f update_objects.c --- src/update_objects.c | 154 +++++++++++++++++++++---------------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/src/update_objects.c b/src/update_objects.c index c726e7ec1..f667b9ed4 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -1322,9 +1322,9 @@ void func_800750D8(s32 objectIndex, s32 arg1, Vec3f arg2, s32 arg3, s32 arg4) { object->velocity.y = ((f64) (f32) temp_v0 * (0.05 * 1.0)) + 2.0; object->unk_034 = ((f64) (f32) (temp_v0 % 5) * 0.1) + 1.0; object->direction_angle[1] = (arg1 << 0x10) / arg4; - object->origin_pos[0] = (arg2[0] + (temp_v0 / 2)) - 12.0f; - object->origin_pos[1] = (arg2[1] - 10.0) + random_int(0x000AU); - object->origin_pos[2] = (arg2[2] + (temp_v0 / 2)) - 12.0f; + object->origin_pos.x = (arg2.x + (temp_v0 / 2)) - 12.0f; + object->origin_pos.y = (arg2.y - 10.0) + random_int(0x000AU); + object->origin_pos.z = (arg2.z + (temp_v0 / 2)) - 12.0f; object->orientation[0] = sp24 << 7; object->orientation[1] = temp_v0 * 0x50; object->orientation[2] = temp_v0 * 0x50; @@ -1359,9 +1359,9 @@ void init_train_smoke(s32 objectIndex, Vec3f pos, f32 velocity) { init_object(objectIndex, 0); object = &gObjectList[objectIndex]; - object->origin_pos[0] = pos.x; - object->origin_pos[1] = pos.y; - object->origin_pos[2] = pos.z; + object->origin_pos.x = pos.x; + object->origin_pos.y = pos.y; + object->origin_pos.z = pos.z; object->velocity.y = velocity; object->type = random_int(0x0064U) + 0x1E; } @@ -1391,9 +1391,9 @@ void func_80075698(s32 objectIndex) { gObjectList[objectIndex].direction_angle[1] = 0; gObjectList[objectIndex].orientation[0] = 0; gObjectList[objectIndex].orientation[2] = 0; - gObjectList[objectIndex].offset[0] = 0.0f; - gObjectList[objectIndex].offset[1] = 0.0f; - gObjectList[objectIndex].offset[2] = 0.0f; + gObjectList[objectIndex].offset.x = 0.0f; + gObjectList[objectIndex].offset.y = 0.0f; + gObjectList[objectIndex].offset.z = 0.0f; gObjectList[objectIndex].sizeScaling = 0.5f; object_next_state(objectIndex); } @@ -1405,7 +1405,7 @@ void func_80075714(s32 objectIndex) { break; case 2: gObjectList[objectIndex].velocity.y -= 0.03; - f32_step_up_towards(&gObjectList[objectIndex].offset[1], 100.0f, gObjectList[objectIndex].velocity.y); + f32_step_up_towards(&gObjectList[objectIndex].offset.y, 100.0f, gObjectList[objectIndex].velocity.y); func_8007415C(objectIndex, &gObjectList[objectIndex].sizeScaling, 0.55f, 1.0f, 0.1f, 1, 0); if (func_80073B00(objectIndex, &gObjectList[objectIndex].primAlpha, 0xFF, 0x1E, 7, 0, 0) != 0) { object_next_state(objectIndex); @@ -1478,9 +1478,9 @@ void init_ferry_smoke(s32 objectIndex, Vec3f pos, f32 velocity) { init_object(objectIndex, 0); object = &gObjectList[objectIndex]; - object->origin_pos[0] = pos.x; - object->origin_pos[1] = pos.y; - object->origin_pos[2] = pos.z; + object->origin_pos.x = pos.x; + object->origin_pos.y = pos.y; + object->origin_pos.z = pos.z; object->velocity.y = velocity; object->type = 0x00FF; object->unk_0A2 = 0x0096; @@ -1512,9 +1512,9 @@ void func_80075B08(s32 objectIndex) { gObjectList[objectIndex].direction_angle[1] = 0; gObjectList[objectIndex].orientation[0] = 0; gObjectList[objectIndex].orientation[2] = 0; - gObjectList[objectIndex].offset[0] = 0.0f; - gObjectList[objectIndex].offset[1] = 0.0f; - gObjectList[objectIndex].offset[2] = 0.0f; + gObjectList[objectIndex].offset.x = 0.0f; + gObjectList[objectIndex].offset.y = 0.0f; + gObjectList[objectIndex].offset.z = 0.0f; gObjectList[objectIndex].sizeScaling = 0.5f; object_next_state(objectIndex); } @@ -1526,7 +1526,7 @@ void func_80075B84(s32 objectIndex) { break; case 2: gObjectList[objectIndex].velocity.y -= 0.03; - f32_step_up_towards(&gObjectList[objectIndex].offset[1], 100.0f, gObjectList[objectIndex].velocity.y); + f32_step_up_towards(&gObjectList[objectIndex].offset.y, 100.0f, gObjectList[objectIndex].velocity.y); func_8007415C(objectIndex, &gObjectList[objectIndex].sizeScaling, 0.55f, 1.0f, 0.1f, 1, 0); if (func_80073B00(objectIndex, &gObjectList[objectIndex].primAlpha, 0xFF, 0x1E, 7, 0, 0) != 0) { object_next_state(objectIndex); @@ -1601,9 +1601,9 @@ void func_80075E5C(s32 objectIndex, Vec3f arg1, u16 arg2, f32 arg3, s32 arg4) { object = &gObjectList[objectIndex]; object->sizeScaling = 0.5f; object->unk_0D5 = 5; - object->origin_pos[0] = arg1[0]; - object->origin_pos[1] = arg1[1]; - object->origin_pos[2] = arg1[2]; + object->origin_pos.x = arg1.x; + object->origin_pos.y = arg1.y; + object->origin_pos.z = arg1.z; object->direction_angle[0] = 0x0C00; object->direction_angle[2] = 0; object->unk_034 = arg3 * 4.0; @@ -1686,9 +1686,9 @@ void func_80076194(s32 objectIndex, Vec3f arg1, f32 arg2, s32 arg3) { object = &gObjectList[objectIndex]; object->unk_0D5 = 4; object->sizeScaling = 1.0f; - object->origin_pos[0] = arg1[0]; - object->origin_pos[1] = arg1[1]; - object->origin_pos[2] = arg1[2]; + object->origin_pos.x = arg1.x; + object->origin_pos.y = arg1.y; + object->origin_pos.z = arg1.z; object->direction_angle[0] = 0x0C00; object->direction_angle[2] = 0; object->direction_angle[1] = 0x2100; @@ -1840,9 +1840,9 @@ void func_8007675C(s32 objectIndex, Vec3s arg1, s32 arg2) { object = &gObjectList[objectIndex]; object->unk_0D5 = 9; object->sizeScaling = 1.0f; - object->origin_pos[0] = arg1[0]; - object->origin_pos[1] = arg1[1]; - object->origin_pos[2] = arg1[2]; + object->origin_pos.x = arg1.x; + object->origin_pos.y = arg1.y; + object->origin_pos.z = arg1.z; object->direction_angle[0] = 0x0C00; object->direction_angle[1] = 0x2100; object->direction_angle[2] = 0; @@ -1991,7 +1991,7 @@ void init_object_smoke_particle(s32 objectIndex, Vec3f arg1, s16 arg2) { object->activeTexture = common_texture_particle_smoke[0]; object->textureList = common_texture_particle_smoke[0]; object->sizeScaling = 0.3f; - set_obj_origin_pos(objectIndex, arg1[0], arg1[1], arg1[2]); + set_obj_origin_pos(objectIndex, arg1.x, arg1.y, arg1.z); object->type = 0x00FF; object->unk_034 = 0.0f; set_obj_orientation(objectIndex, 0U, 0U, 0U); @@ -2070,9 +2070,9 @@ void init_object_smoke_particle2(s32 objectIndex, s32 flameIndex) { gObjectList[objectIndex].textureList = common_texture_particle_smoke[0]; gObjectList[objectIndex].sizeScaling = 0.8f; - gObjectList[objectIndex].origin_pos[0] = (f32) * (gTorchSpawns + (flameIndex * 3) + 0) * xOrientation; - gObjectList[objectIndex].origin_pos[1] = (f32) * (gTorchSpawns + (flameIndex * 3) + 1); - gObjectList[objectIndex].origin_pos[2] = (f32) * (gTorchSpawns + (flameIndex * 3) + 2); + gObjectList[objectIndex].origin_pos.x = (f32) * (gTorchSpawns + (flameIndex * 3) + 0) * xOrientation; + gObjectList[objectIndex].origin_pos.y = (f32) * (gTorchSpawns + (flameIndex * 3) + 1); + gObjectList[objectIndex].origin_pos.z = (f32) * (gTorchSpawns + (flameIndex * 3) + 2); gObjectList[objectIndex].unk_034 = 0; gObjectList[objectIndex].type = 255; gObjectList[objectIndex].unk_0A2 = 255; @@ -2104,22 +2104,22 @@ void init_object_leaf_particle(s32 objectIndex, Vec3f arg1, s32 num) { gObjectList[objectIndex].activeTLUT = (u8*) common_texture_particle_leaf; gObjectList[objectIndex].tlutList = (u8*) common_texture_particle_leaf; gObjectList[objectIndex].sizeScaling = 0.1f; - gObjectList[objectIndex].surfaceHeight = arg1[1]; + gObjectList[objectIndex].surfaceHeight = arg1.y; if (GetCourse() == GetMarioRaceway()) { - object_origin_pos_randomize_around_xyz(objectIndex, arg1[0], arg1[1] + 25.0, arg1[2], 0x14, 0x1E, 0x14); + object_origin_pos_randomize_around_xyz(objectIndex, arg1.x, arg1.y + 25.0, arg1.z, 0x14, 0x1E, 0x14); gObjectList[objectIndex].unk_034 = 1.5f; gObjectList[objectIndex].velocity.y = 1.5f; } else if (GetCourse() == GetYoshiValley()) { - object_origin_pos_randomize_around_xyz(objectIndex, arg1[0], arg1[1] + 25.0, arg1[2], 0x14, 0x1E, 0x14); + object_origin_pos_randomize_around_xyz(objectIndex, arg1.x, arg1.y + 25.0, arg1.z, 0x14, 0x1E, 0x14); gObjectList[objectIndex].unk_034 = 2.0f; gObjectList[objectIndex].velocity.y = 2.0f; } else if (GetCourse() == GetRoyalRaceway()) { - object_origin_pos_randomize_around_xyz(objectIndex, arg1[0], arg1[1] + 30.0, arg1[2], 0x10, 0x28, 0x10); + object_origin_pos_randomize_around_xyz(objectIndex, arg1.x, arg1.y + 30.0, arg1.z, 0x10, 0x28, 0x10); gObjectList[objectIndex].unk_034 = 2.0f; gObjectList[objectIndex].velocity.y = 2.0f; } else if (GetCourse() == GetLuigiRaceway()) { - object_origin_pos_randomize_around_xyz(objectIndex, arg1[0], arg1[1] + 25.0, arg1[2], 0x14, 0x1E, 0x14); + object_origin_pos_randomize_around_xyz(objectIndex, arg1.x, arg1.y + 25.0, arg1.z, 0x14, 0x1E, 0x14); gObjectList[objectIndex].unk_034 = 1.5f; gObjectList[objectIndex].velocity.y = 1.0f; } @@ -2261,7 +2261,7 @@ void func_80077EB8(s32 objectIndex, u16 arg1, Camera* camera) { temp_v0 = camera->rot.y - arg1; if ((temp_v0 >= D_8018D210) || (D_8018D208 >= temp_v0)) { - gObjectList[objectIndex].offset[0] = D_8018D218 + (D_8018D1E8 * (f32) temp_v0); + gObjectList[objectIndex].offset.x = D_8018D218 + (D_8018D1E8 * (f32) temp_v0); set_object_flag(objectIndex, 0x00000010); return; } @@ -2279,8 +2279,8 @@ void func_80077F64(s32 objectIndex, Camera* camera) { rand = random_int(0x0064U); gObjectList[objectIndex].velocity.y = (f32) (-0.75 - (f64) (f32) (rand * 0.01)); - gObjectList[objectIndex].offset[0] = 0.0f; - gObjectList[objectIndex].offset[1] = 0.0f; + gObjectList[objectIndex].offset.x = 0.0f; + gObjectList[objectIndex].offset.x = 0.0f; func_80086FD4(objectIndex); return; case 2: @@ -2362,34 +2362,34 @@ void func_80078288(s32 objectIndex) { sp3E = (random_int(0x000FU) - sp3A) + 0x2D; sp3C = random_int(0x012CU) + 0x1E; temp_t6 = camera1->rot.y + ((s32) (random_int(0x3000U) - 0x1800) / (s16) ((sp3A / 15) + 1)); - gObjectList[objectIndex].origin_pos[0] = gPlayerOneCopy->pos.x + (sins(temp_t6) * sp3C); - gObjectList[objectIndex].origin_pos[1] = sp3E + gPlayerOneCopy->unk_074; - gObjectList[objectIndex].origin_pos[2] = gPlayerOneCopy->pos.z + (coss(temp_t6) * sp3C); + gObjectList[objectIndex].origin_pos.x = gPlayerOneCopy->pos.x + (sins(temp_t6) * sp3C); + gObjectList[objectIndex].origin_pos.y = sp3E + gPlayerOneCopy->unk_074; + gObjectList[objectIndex].origin_pos.z = gPlayerOneCopy->pos.z + (coss(temp_t6) * sp3C); gObjectList[objectIndex].unk_0C4 = random_int(0x0400U) + 0x100; - gObjectList[objectIndex].unk_01C[0] = (f32) (((f32) random_int(0x0064U) * 0.03) + 2.0); + gObjectList[objectIndex].unk_01C.x = (f32) (((f32) random_int(0x0064U) * 0.03) + 2.0); gObjectList[objectIndex].velocity.y = (f32) (-0.3 - (f64) (f32) (random_int(0x0032U) * 0.01)); - gObjectList[objectIndex].offset[0] = 0.0f; - gObjectList[objectIndex].offset[1] = 0.0f; + gObjectList[objectIndex].offset.x = 0.0f; + gObjectList[objectIndex].offset.y = 0.0f; func_80086FD4(objectIndex); } else { sp3C = random_int(0x0064U) + 0x28; temp_t6 = camera1->rot.y + random_int(0x3000U) - 0x1800; - gObjectList[objectIndex].origin_pos[0] = camera1->pos.x + (sins(temp_t6) * sp3C); - gObjectList[objectIndex].origin_pos[1] = camera1->pos.y + 45.0; - gObjectList[objectIndex].origin_pos[2] = camera1->pos.z + (coss(temp_t6) * sp3C); + gObjectList[objectIndex].origin_pos.x = camera1->pos.x + (sins(temp_t6) * sp3C); + gObjectList[objectIndex].origin_pos.y = camera1->pos.y + 45.0; + gObjectList[objectIndex].origin_pos.z = camera1->pos.z + (coss(temp_t6) * sp3C); gObjectList[objectIndex].unk_0C4 = random_int(0x0400U) + 0x100; - gObjectList[objectIndex].unk_01C[0] = (f32) (((f32) random_int(0x0064U) * 0.03) + 2.0); + gObjectList[objectIndex].unk_01C.x = (f32) (((f32) random_int(0x0064U) * 0.03) + 2.0); gObjectList[objectIndex].velocity.y = (f32) (-0.6 - (f64) (f32) (random_int(0x0032U) * 0.01)); - gObjectList[objectIndex].offset[0] = 0.0f; - gObjectList[objectIndex].offset[1] = 0.0f; + gObjectList[objectIndex].offset.x = 0.0f; + gObjectList[objectIndex].offset.y = 0.0f; func_80086FD4(objectIndex); } break; case 2: object_add_velocity_offset_y(objectIndex); gObjectList[objectIndex].direction_angle[0] += gObjectList[objectIndex].unk_0C4; - gObjectList[objectIndex].offset[0] = - sins(gObjectList[objectIndex].direction_angle[0]) * gObjectList[objectIndex].unk_01C[0]; + gObjectList[objectIndex].offset.x = + sins(gObjectList[objectIndex].direction_angle[0]) * gObjectList[objectIndex].unk_01C.x; object_calculate_new_pos_offset(objectIndex); if ((f64) gObjectList[objectIndex].pos.y <= 0.0) { func_80086FD4(objectIndex); @@ -3503,7 +3503,7 @@ void func_8007CE0C(s32 objectIndex) { func_80086EF0(objectIndex); object->direction_angle[2] = 0x8000; object->direction_angle[1] = - atan2s(D_8018CF1C->pos.x - object->origin_pos[0], D_8018CF1C->pos.z - object->origin_pos[2]); + atan2s(D_8018CF1C->pos.x - object->origin_pos.x, D_8018CF1C->pos.z - object->origin_pos.z); } void func_8007CEDC(s32 objectIndex) { @@ -3579,11 +3579,11 @@ void func_8007D070(void) { temp_s2 = random_int(0x012CU); temp_s3 = random_int(0x1000U) - 0x800; temp_t5 = random_int(0x000FU) - 5; - gObjectList[objectIndex].direction_angle[1] = D_8018CF1C->rotation[1] + 0x8000; + gObjectList[objectIndex].direction_angle[1] = D_8018CF1C->rotation.y + 0x8000; temp_t2 = (D_8018CF14->rot.y + temp_s3); - gObjectList[objectIndex].origin_pos[0] = D_8018CF1C->pos.x + (sins(temp_t2) * temp_s2); - gObjectList[objectIndex].origin_pos[1] = temp_t5; - gObjectList[objectIndex].origin_pos[2] = D_8018CF1C->pos.z + (coss(temp_t2) * temp_s2); + gObjectList[objectIndex].origin_pos.x = D_8018CF1C->pos.x + (sins(temp_t2) * temp_s2); + gObjectList[objectIndex].origin_pos.y = temp_t5; + gObjectList[objectIndex].origin_pos.z = D_8018CF1C->pos.z + (coss(temp_t2) * temp_s2); gObjectList[objectIndex].spline = &D_800E5D54; } } @@ -3594,11 +3594,11 @@ void func_8007D070(void) { func_8007CEDC(objectIndex); func_8008B724(objectIndex); gObjectList[objectIndex].pos.x = - gObjectList[objectIndex].origin_pos[0] + gObjectList[objectIndex].offset[0]; + gObjectList[objectIndex].origin_pos.x + gObjectList[objectIndex].offset.x; gObjectList[objectIndex].pos.y = - D_8018CF1C->unk_074 + gObjectList[objectIndex].origin_pos[1] + gObjectList[objectIndex].offset[1]; + D_8018CF1C->unk_074 + gObjectList[objectIndex].origin_pos.y + gObjectList[objectIndex].offset.y; gObjectList[objectIndex].pos.z = - gObjectList[objectIndex].origin_pos[2] + gObjectList[objectIndex].offset[2]; + gObjectList[objectIndex].origin_pos.z + gObjectList[objectIndex].offset.z; func_8007C420(objectIndex, D_8018CF1C, D_8018CF14); if (is_obj_flag_status_active(objectIndex, 0x00000080) != 0) { gObjectList[objectIndex].vertex = D_800E44B0; @@ -3611,28 +3611,28 @@ void func_8007D070(void) { void func_8007D360(s32 objectIndex, s32 arg1) { if (arg1 == 1) { - gObjectList[objectIndex].origin_pos[0] = (f32) ((-1775.0 - random_int(0x001EU)) * (f64) xOrientation); - gObjectList[objectIndex].origin_pos[1] = (f32) (random_int(0x0019U) + 25.0); - gObjectList[objectIndex].origin_pos[2] = (f32) (random_int(0x001EU) + 130.0); - gObjectList[objectIndex].unk_01C[0] = (f32) ((f64) xOrientation * -2500.0); - gObjectList[objectIndex].unk_01C[1] = 0.0f; - gObjectList[objectIndex].unk_01C[2] = (f32) (220.0 - random_int(0x0096U)); + gObjectList[objectIndex].origin_pos.x = (f32) ((-1775.0 - random_int(0x001EU)) * (f64) xOrientation); + gObjectList[objectIndex].origin_pos.y = (f32) (random_int(0x0019U) + 25.0); + gObjectList[objectIndex].origin_pos.z = (f32) (random_int(0x001EU) + 130.0); + gObjectList[objectIndex].unk_01C.x = (f32) ((f64) xOrientation * -2500.0); + gObjectList[objectIndex].unk_01C.y = 0.0f; + gObjectList[objectIndex].unk_01C.z = (f32) (220.0 - random_int(0x0096U)); gObjectList[objectIndex].direction_angle[0] = 0xDC00; gObjectList[objectIndex].unk_0C6 = 0x0800; } if (arg1 == 2) { - gObjectList[objectIndex].origin_pos[0] = (f32) (-0x55B - random_int(0x001EU)) * xOrientation; - gObjectList[objectIndex].origin_pos[1] = (f32) (random_int(0x0019U) + 0xF); - gObjectList[objectIndex].origin_pos[2] = (f32) (random_int(0x001EU) - 0xE8); - gObjectList[objectIndex].unk_01C[0] = (f32) ((f64) xOrientation * -2100.0); - gObjectList[objectIndex].unk_01C[1] = 0.0f; - gObjectList[objectIndex].unk_01C[2] = (f32) (random_int(0x00C8U) + -290.0); + gObjectList[objectIndex].origin_pos.x = (f32) (-0x55B - random_int(0x001EU)) * xOrientation; + gObjectList[objectIndex].origin_pos.y = (f32) (random_int(0x0019U) + 0xF); + gObjectList[objectIndex].origin_pos.z = (f32) (random_int(0x001EU) - 0xE8); + gObjectList[objectIndex].unk_01C.x = (f32) ((f64) xOrientation * -2100.0); + gObjectList[objectIndex].unk_01C.y = 0.0f; + gObjectList[objectIndex].unk_01C.z = (f32) (random_int(0x00C8U) + -290.0); gObjectList[objectIndex].direction_angle[0] = 0; gObjectList[objectIndex].unk_0C6 = 0; } gObjectList[objectIndex].direction_angle[1] = - get_angle_between_xy(gObjectList[objectIndex].origin_pos[0], gObjectList[objectIndex].unk_01C[0], - gObjectList[objectIndex].origin_pos[2], gObjectList[objectIndex].unk_01C[2]); + get_angle_between_xy(gObjectList[objectIndex].origin_pos.x, gObjectList[objectIndex].unk_01C.x, + gObjectList[objectIndex].origin_pos.z, gObjectList[objectIndex].unk_01C.z); gObjectList[objectIndex].direction_angle[2] = 0; set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); gObjectList[objectIndex].unk_0B0 = 0; @@ -3835,9 +3835,9 @@ void func_80083FD0(s32 objectIndex, s32 arg1, s32 playerId) { object->velocity.y = ((f32) random_int(0x0032U) * 0.05) + 1.0; object->unk_034 = ((f32) random_int(0x000AU) * 0.1) + 1.0; object->direction_angle[1] = D_801657A2 * arg1; - object->origin_pos[0] = (sp20->pos.x + random_int(0x0014U)) - 10.0f; - object->origin_pos[1] = (sp20->pos.y - 10.0) + random_int(0x000AU); - object->origin_pos[2] = (sp20->pos.z + random_int(0x0014U)) - 10.0f; + object->origin_pos.x = (sp20->pos.x + random_int(0x0014U)) - 10.0f; + object->origin_pos.y = (sp20->pos.y - 10.0) + random_int(0x000AU); + object->origin_pos.z = (sp20->pos.z + random_int(0x0014U)) - 10.0f; } void func_8008421C(UNUSED s32 arg0, s32 playerId) {