diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 564a32d9d..ee82cd511 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -700,10 +700,13 @@ void render_player_snow_effect_four(void) { void render_object_for_player(s32 cameraId) { - CourseManager_RenderCourseObjects(cameraId); - CourseManager_TrainSmokeDraw(cameraId); - CourseManager_DrawThwomps(cameraId); - CourseManager_DrawPenguins(cameraId); + CourseManager_DrawObjects(cameraId); + + // CourseManager_RenderCourseObjects(cameraId); + // CourseManager_TrainSmokeDraw(cameraId); + // CourseManager_DrawThwomps(cameraId); + // CourseManager_DrawPenguins(cameraId); + // CourseManager_DrawSeagulls(cameraId); // switch (gCurrentCourseId) { // case COURSE_MARIO_RACEWAY: @@ -1338,7 +1341,6 @@ void func_80059D00(void) { func_80059820(PLAYER_TWO); func_80078C70(2); } - update_object(); break; case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: randomize_seed_from_controller(PLAYER_ONE); @@ -1357,7 +1359,6 @@ void func_80059D00(void) { } func_80078C70(2); func_8005D1F4(1); - update_object(); break; case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: randomize_seed_from_controller(PLAYER_ONE); @@ -1376,7 +1377,6 @@ void func_80059D00(void) { } func_80078C70(4); func_8005D1F4(1); - update_object(); break; case SCREEN_MODE_3P_4P_SPLITSCREEN: randomize_seed_from_controller(PLAYER_ONE); @@ -1409,9 +1409,9 @@ void func_80059D00(void) { } func_8005D1F4(3); } - update_object(); break; } + CourseManager_TickObjects(); func_800744CC(); } } @@ -1431,7 +1431,7 @@ void func_8005A070(void) { } else if (gGamestate == CREDITS_SEQUENCE) { func_80059820(PLAYER_ONE); func_80078C70(0); - update_object(); + CourseManager_TickObjects(); } else { func_80059D00(); } @@ -1579,9 +1579,10 @@ void func_8005A71C(void) { void update_object(void) { - CourseManager_UpdateCourseObjects(); - CourseManager_TrainSmokeTick(); - CourseManager_TickPenguins(); + // CourseManager_UpdateCourseObjects(); + // CourseManager_TrainSmokeTick(); + // CourseManager_TickPenguins(); + // CourseManager_TickSeagulls(); // switch (gCurrentCourseId) { // case COURSE_MARIO_RACEWAY: diff --git a/src/code_80086E70.c b/src/code_80086E70.c index 4f3393944..490e8e32c 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -19,13 +19,13 @@ void func_80086E70(s32 objectIndex) { gObjectList[objectIndex].unk_0AE = 1; // * 0xE0)) = 1; - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); } void func_80086EAC(s32 objectIndex, s32 arg1, s16 arg2) { gObjectList[objectIndex].unk_0DD = arg1; gObjectList[objectIndex].unk_0AE = arg2; - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); } void func_80086EF0(s32 objectIndex) { @@ -42,7 +42,7 @@ void func_80086F60(s32 objectIndex) { gObjectList[objectIndex].unk_0AE = 0; gObjectList[objectIndex].unk_0DD = 0; gObjectList[objectIndex].unk_0DE = 0; - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); } bool func_80086FA4(s32 objectIndex) { @@ -54,12 +54,12 @@ bool func_80086FA4(s32 objectIndex) { } void func_80086FD4(s32 objectIndex) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); gObjectList[objectIndex].unk_0AE += 1; } void func_8008701C(s32 objectIndex, s32 arg1) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); gObjectList[objectIndex].unk_0AE = arg1; } @@ -68,12 +68,12 @@ s32 func_80087060(s32 objectIndex, s32 arg1) { sp1C = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); gObjectList[objectIndex].unk_0B0 = arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); sp1C = 1; } return sp1C; @@ -84,12 +84,12 @@ s32 func_80087104(s32 objectIndex, u16 arg1) { sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); gObjectList[objectIndex].unk_0B0 = random_int(arg1); } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); sp24 = 1; } return sp24; @@ -100,12 +100,12 @@ s32 func_800871AC(s32 objectIndex, s32 arg1) { sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); gObjectList[objectIndex].unk_0B0 = (s16) arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); func_80086FD4(objectIndex); sp24 = 1; } @@ -235,13 +235,13 @@ s32 func_8008789C(s32 objectIndex, s32 arg1) { sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); func_8008751C(objectIndex); gObjectList[objectIndex].unk_0B0 = arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); sp24 = 1; } else { object_add_velocity_offset_xz(objectIndex); @@ -254,13 +254,13 @@ s32 func_80087954(s32 objectIndex, s32 arg1) { sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); func_80087620(objectIndex); gObjectList[objectIndex].unk_0B0 = arg1; } gObjectList[objectIndex].unk_0B0--; if (gObjectList[objectIndex].unk_0B0 < 0) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); sp24 = 1; } else { object_add_velocity_offset_xz(objectIndex); @@ -276,7 +276,7 @@ bool func_80087A0C(s32 objectIndex, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { sp2C = false; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); temp_v0 = arg2 - arg1; temp_a0 = arg4 - arg3; dist = sqrtf((temp_v0 * temp_v0) + (temp_a0 * temp_a0)); @@ -287,7 +287,7 @@ 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_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); sp2C = true; } else { object_add_velocity_offset_xz(objectIndex); @@ -300,12 +300,12 @@ s32 func_80087B84(s32 objectIndex, f32 arg1, f32 arg2) { sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); gObjectList[objectIndex].velocity[1] = -arg1; } object_add_velocity_offset_y(objectIndex); if (gObjectList[objectIndex].pos[1] <= arg2) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); func_80086FD4(objectIndex); sp24 = 1; } @@ -317,13 +317,13 @@ s32 func_80087C48(s32 objectIndex, f32 arg1, f32 arg2, s32 arg3) { sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != false) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(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_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); func_80086FD4(objectIndex); sp24 = 1; } else { @@ -338,13 +338,13 @@ s32 func_80087D24(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3) { sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); gObjectList[objectIndex].velocity[1] = arg1; } gObjectList[objectIndex].velocity[1] -= arg2; object_add_velocity_offset_y(objectIndex); if (gObjectList[objectIndex].offset[1] <= arg3) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); gObjectList[objectIndex].offset[1] = arg3; func_80086FD4(objectIndex); sp24 = 1; @@ -358,7 +358,7 @@ bool func_80087E08(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s32 sp2C = false; if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); gObjectList[objectIndex].offset[2] = 0.0f; gObjectList[objectIndex].offset[1] = 0.0f; gObjectList[objectIndex].offset[0] = 0.0f; @@ -370,7 +370,7 @@ 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_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); func_80086FD4(objectIndex); sp2C = true; } else { @@ -386,7 +386,7 @@ UNUSED s32 func_80087F14(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4 sp2C = 0; if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); gObjectList[objectIndex].offset[2] = 0.0f; gObjectList[objectIndex].offset[1] = 0.0f; gObjectList[objectIndex].offset[0] = 0.0f; @@ -397,7 +397,7 @@ UNUSED s32 func_80087F14(s32 objectIndex, f32 arg1, f32 arg2, f32 arg3, s16 arg4 gObjectList[objectIndex].unk_0B0 = gVBlankTimer; } if (gObjectList[objectIndex].offset[1] <= arg5) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); func_80086FD4(objectIndex); sp2C = 1; } else { @@ -526,13 +526,13 @@ s32 func_8008847C(s32 objectIndex) { s32 sp2C; sp2C = 0; - set_object_flag_status_false(objectIndex, 0x00800000); + clear_object_flag(objectIndex, 0x00800000); if (is_obj_flag_status_active(objectIndex, 0x00000400) != 0) { check_bounding_collision(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { sp2C = 1; - set_object_flag_status_true(objectIndex, 0x00800000); + set_object_flag(objectIndex, 0x00800000); } gObjectList[objectIndex].surfaceHeight = calculate_surface_height( gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.meshIndexZX); @@ -544,13 +544,13 @@ s32 func_80088538(s32 objectIndex) { s32 sp2C; sp2C = 0; - set_object_flag_status_false(objectIndex, 0x00800000); + clear_object_flag(objectIndex, 0x00800000); if (is_obj_flag_status_active(objectIndex, 0x00000400) != 0) { check_bounding_collision(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { sp2C = 1; - set_object_flag_status_true(objectIndex, 0x00800000); + set_object_flag(objectIndex, 0x00800000); } gObjectList[objectIndex].surfaceHeight = calculate_surface_height( gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.meshIndexZX); @@ -565,13 +565,13 @@ s32 func_8008861C(s32 objectIndex) { s32 sp2C; sp2C = 0; - set_object_flag_status_false(objectIndex, 0x00800000); + clear_object_flag(objectIndex, 0x00800000); if (is_obj_flag_status_active(objectIndex, 0x00000400) != 0) { check_bounding_collision(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { sp2C = 1; - set_object_flag_status_true(objectIndex, 0x00800000); + set_object_flag(objectIndex, 0x00800000); } gObjectList[objectIndex].surfaceHeight = calculate_surface_height( gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.meshIndexZX); @@ -586,7 +586,7 @@ void func_800886F4(s32 objectIndex) { check_bounding_collision(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { - set_object_flag_status_true(objectIndex, 0x00800000); + set_object_flag(objectIndex, 0x00800000); gObjectList[objectIndex].surfaceHeight = calculate_surface_height( gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.meshIndexZX); gObjectList[objectIndex].unk_0B8[0] = @@ -594,14 +594,14 @@ void func_800886F4(s32 objectIndex) { gObjectList[objectIndex].unk_0B8[2] = atan2s(D_8018C3B0.orientationVector[0], D_8018C3B0.orientationVector[1]); return; } - set_object_flag_status_false(objectIndex, 0x00800000); + clear_object_flag(objectIndex, 0x00800000); } void func_800887C0(s32 objectIndex) { check_bounding_collision(&D_8018C3B0, 10.0f, gObjectList[objectIndex].pos[0], 20.0f, gObjectList[objectIndex].pos[2]); if (D_8018C3B0.unk34 == 1) { - set_object_flag_status_true(objectIndex, 0x00800000); + set_object_flag(objectIndex, 0x00800000); gObjectList[objectIndex].surfaceHeight = calculate_surface_height( gObjectList[objectIndex].pos[0], 0.0f, gObjectList[objectIndex].pos[2], D_8018C3B0.meshIndexZX); gObjectList[objectIndex].velocity[0] = D_8018C3B0.orientationVector[0]; @@ -609,7 +609,7 @@ void func_800887C0(s32 objectIndex) { gObjectList[objectIndex].velocity[2] = D_8018C3B0.orientationVector[2]; return; } - set_object_flag_status_false(objectIndex, 0x00800000); + clear_object_flag(objectIndex, 0x00800000); } /** @@ -1131,14 +1131,14 @@ void func_80089820(s32 objectIndex, f32 arg1, f32 arg2, u32 arg3) { s32 var_s1; player = gPlayerOne; - set_object_flag_status_false(objectIndex, 0x02000000); + clear_object_flag(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_status_true(objectIndex, 0x02000000); + set_object_flag(objectIndex, 0x02000000); } else { if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { func_80072180(); @@ -1328,7 +1328,7 @@ void func_8008A1D0(s32 objectIndex, s32 cameraId, s32 arg2, s32 arg3) { Camera* camera; camera = &camera1[cameraId]; - set_object_flag_status_false(objectIndex, 0x00100000 | VISIBLE); + clear_object_flag(objectIndex, 0x00100000 | VISIBLE); temp_v0 = get_horizontal_distance_to_camera(objectIndex, camera); if (CVarGetInteger("gNoCulling", 0) == 1) { temp_v0 = MIN(temp_v0, arg3 * arg3); @@ -1341,9 +1341,9 @@ void func_8008A1D0(s32 objectIndex, s32 cameraId, s32 arg2, s32 arg3) { var_a2 = 0x2AAB; } if ((is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) && ((u32) (arg3 * arg3) >= temp_v0)) { - set_object_flag_status_true(objectIndex, VISIBLE); + set_object_flag(objectIndex, VISIBLE); if (temp_v0 >= (u32) (arg2 * arg2)) { - set_object_flag_status_true(objectIndex, 0x00100000); + set_object_flag(objectIndex, 0x00100000); } } } @@ -1355,7 +1355,7 @@ UNUSED void func_8008A2CC(s32 objectIndex, s32 cameraId, u16 arg2) { u16 var_a2; camera = &camera1[cameraId]; - set_object_flag_status_false(objectIndex, VISIBLE); + clear_object_flag(objectIndex, VISIBLE); if (no_init < 0x2711U) { var_a2 = 0x5555; } else if (no_init < 0x9C41U) { @@ -1364,7 +1364,7 @@ UNUSED void func_8008A2CC(s32 objectIndex, s32 cameraId, u16 arg2) { var_a2 = arg2; } if (is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) { - set_object_flag_status_true(objectIndex, VISIBLE); + set_object_flag(objectIndex, VISIBLE); } } @@ -1374,13 +1374,13 @@ s32 func_8008A364(s32 objectIndex, s32 cameraId, u16 arg2, s32 arg3) { u16 var_a2; camera = &camera1[cameraId]; - set_object_flag_status_false(objectIndex, 0x00020000 | VISIBLE); + clear_object_flag(objectIndex, 0x00020000 | VISIBLE); dist = get_horizontal_distance_to_camera(objectIndex, camera); if (CVarGetInteger("gNoCulling", 0) == 1) { dist = MIN(dist, (arg3 * arg3) - 1); } if (dist < (arg3 * arg3)) { - set_object_flag_status_true(objectIndex, 0x00020000); + set_object_flag(objectIndex, 0x00020000); if (dist < 0x2711U) { var_a2 = 0x5555; } else if (dist < 0x9C41U) { @@ -1389,7 +1389,7 @@ s32 func_8008A364(s32 objectIndex, s32 cameraId, u16 arg2, s32 arg3) { var_a2 = arg2; } if (is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) { - set_object_flag_status_true(objectIndex, VISIBLE); + set_object_flag(objectIndex, VISIBLE); } } return dist; @@ -1397,9 +1397,9 @@ s32 func_8008A364(s32 objectIndex, s32 cameraId, u16 arg2, s32 arg3) { void func_8008A454(s32 objectIndex, s32 cameraId, s32 arg2) { if (get_horizontal_distance_to_camera(objectIndex, &camera1[cameraId]) < (u32) (arg2 * arg2)) { - set_object_flag_status_true(objectIndex, 0x00000020); + set_object_flag(objectIndex, 0x00000020); } else { - set_object_flag_status_false(objectIndex, 0x00000020); + clear_object_flag(objectIndex, 0x00000020); } } @@ -1407,10 +1407,10 @@ UNUSED void func_8008A610(s32 objectIndex) { s32 loopIndex; Camera* camera; - set_object_flag_status_false(objectIndex, VISIBLE); + clear_object_flag(objectIndex, VISIBLE); for (camera = camera1, loopIndex = 0; loopIndex < gPlayerCountSelection1; loopIndex++, camera++) { if ((gObjectList[objectIndex].state != 0) && (is_object_visible_on_camera(objectIndex, camera, 0x2AABU) != 0)) { - set_object_flag_status_true(objectIndex, VISIBLE); + set_object_flag(objectIndex, VISIBLE); } } } @@ -1420,18 +1420,18 @@ void func_8008A6DC(s32 objectIndex, f32 arg1) { s32 loopIndex; Camera* camera; - set_object_flag_status_false(objectIndex, 0x00060000); + clear_object_flag(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_status_true(objectIndex, 0x00020000); + set_object_flag(objectIndex, 0x00020000); if (arg1 <= 500.0) { var_a2 = 0x4000; } else { var_a2 = 0x2AAB; } if (is_object_visible_on_camera(objectIndex, camera, var_a2) != 0) { - set_object_flag_status_true(objectIndex, VISIBLE); + set_object_flag(objectIndex, VISIBLE); } } } @@ -1723,7 +1723,7 @@ void func_8008B3E4(s32 objectIndex) { */ object->unk_084[8] = *(((s16*) object->controlPoints) - 1); - set_object_flag_status_true(objectIndex, 8); + set_object_flag(objectIndex, 8); } } @@ -1790,7 +1790,7 @@ void func_8008B6A4(s32 objectIndex) { // Have to do it this way due to the u16 cast object->unk_084[9] = (u16) object->unk_084[9] + 1; if ((u16) object->unk_084[9] == (u16) object->unk_084[8]) { - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 8); } else { func_8008B44C(objectIndex); } diff --git a/src/data/some_data.c b/src/data/some_data.c index 3b01da911..431e60247 100644 --- a/src/data/some_data.c +++ b/src/data/some_data.c @@ -561,10 +561,6 @@ SplineData D_800E6280 = { 0x0016, { { 0xffce, 0x00aa, 0xfe0c }, 0x0028 }, } }; -// Note the use of the plain SplineData type here. Since these are pointers, we don't care -// about their internal array size -SplineData* D_800E633C[] = { &D_800E6034, &D_800E60F0, &D_800E61B4, &D_800E6280 }; - // Might be Cheep Cheep related? Vec3s D_800E634C[] = { { 0xf37e, 0x0013, 0xfe22 }, diff --git a/src/data/some_data.h b/src/data/some_data.h index dc56a53fd..90b9b13ac 100644 --- a/src/data/some_data.h +++ b/src/data/some_data.h @@ -60,7 +60,6 @@ extern SplineData D_800E6034; extern SplineData D_800E60F0; extern SplineData D_800E61B4; extern SplineData D_800E6280; -extern SplineData* D_800E633C[]; extern Vec3s D_800E634C[]; extern MoleSpawnUnion gMoleSpawns; extern SplineData D_800E641C; diff --git a/src/engine/GameObject.cpp b/src/engine/GameObject.cpp deleted file mode 100644 index fc7c03344..000000000 --- a/src/engine/GameObject.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// #include -// #include "GameObject.h" - -// #include "World.h" - -// extern "C" { -// #include "camera.h" -// } - - -// //GameActor() - -// GameObject::GameObject() {} - -// // Virtual functions to be overridden by derived classes -// void GameObject::Tick() { } -// void GameObject::Draw(Camera* camera) { } -// void GameObject::Collision() {} -// void GameObject::Expire() { } -// void GameObject::Destroy() { } diff --git a/src/engine/GameObject.h b/src/engine/GameObject.h deleted file mode 100644 index b6ac8c559..000000000 --- a/src/engine/GameObject.h +++ /dev/null @@ -1,24 +0,0 @@ -// #pragma once - -// #include - -// extern "C" { -// #include "camera.h" -// #include "objects.h" -// } - -// class GameObject { -// public: -// uint8_t uuid[16]; -// Object o; - -// virtual ~GameObject() = default; - -// explicit GameObject(); - -// virtual void Tick(); -// virtual void Draw(Camera* camera); -// virtual void Collision(); -// virtual void Expire(); -// virtual void Destroy(); -// }; diff --git a/src/engine/World.cpp b/src/engine/World.cpp index ecaad485d..ead375a24 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -9,11 +9,11 @@ #include "vehicles/Bus.h" #include "vehicles/TankerTruck.h" #include "vehicles/Car.h" -#include "objects/OBombKart.h" -#include "objects/OPenguin.h" +#include "objects/BombKart.h" +#include "objects/Penguin.h" #include "TrainCrossing.h" #include -//#include "objects/GameObject.h" +#include "objects/GameObject.h" extern "C" { #include "camera.h" @@ -49,6 +49,7 @@ static size_t cars; static size_t boats; static size_t thwomps; static size_t penguins; +static size_t seagulls; /** * Note that you can only remove the tender if there are no carriages @@ -113,6 +114,13 @@ std::shared_ptr World::AddPenguin(Vec3f pos, u16 direction, OPenguin:: return penguin; } +std::shared_ptr World::AddSeagull(Vec3f pos) { + auto seagull = std::make_shared(seagulls, pos); + Seagulls.push_back(seagull); + seagulls++; + return seagull; +} + u32 World::GetCupIndex() { return this->CupIndex; } @@ -185,12 +193,6 @@ void World::PreviousCourse() { gWorldInstance.CurrentCourse = Courses[CourseIndex]; } -// Object* World::AddObject(std::unique_ptr object) { -// GameObject* rawPtr = object.get(); -// GameObjects.push_back(std::move(object)); -// return &rawPtr->o; -// } - AActor* World::AddActor(AActor* actor) { Actors.push_back(actor); return Actors.back(); @@ -240,16 +242,21 @@ void RemoveExpiredActors() { // Actors.end()); } +GameObject* World::AddObject(GameObject* object) { + Objects.push_back(object); + return Objects.back(); +} + void World::TickObjects() { - //for (const auto& object : this->GameObjects) { - // object->Tick(); - //} + for (const auto& object : Objects) { + object->Tick(); + } } void World::DrawObjects(Camera *camera) { - //for (const auto& object : this->GameObjects) { - // object->Draw(camera); - //} + for (const auto& object : Objects) { + object->Draw(camera); + } } void World::ExpiredObjects() { diff --git a/src/engine/World.h b/src/engine/World.h index 0df9e7278..2ae4462f4 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -1,16 +1,17 @@ #pragma once #include -//#include "objects/GameObject.h" +#include "objects/GameObject.h" #include "Cup.h" #include "vehicles/Vehicle.h" #include "vehicles/Train.h" #include "vehicles/Car.h" -#include "objects/OBombKart.h" +#include "objects/BombKart.h" #include "vehicles/Train.h" #include "TrainCrossing.h" -#include "objects/OThwomp.h" -#include "objects/OPenguin.h" +#include "objects/Thwomp.h" +#include "objects/Penguin.h" +#include "objects/Seagull.h" #include #include "Actor.h" @@ -20,7 +21,7 @@ extern "C" { #include "engine/Engine.h" }; -//class GameObject; +class GameObject; class Cup; // <-- Forward declaration class Course; class AVehicle; @@ -28,6 +29,7 @@ class ATrain; class ACar; class TrainCrossing; class OThwomp; +class OSeagull; class World { @@ -93,7 +95,7 @@ public: AActor* ConvertActorToAActor(Actor* actor); Actor* ConvertAActorToActor(AActor* actor); -// Object* AddObject(std::unique_ptr object); + GameObject* AddObject(GameObject* object); CProperties* GetCourseProps(); void TickObjects(); @@ -129,7 +131,7 @@ public: size_t CupIndex = 1; std::vector Actors; -// std::vector> GameObjects; + std::vector Objects; /** Actors */ void AddBoat(f32 speed, uint32_t waypoint); @@ -151,6 +153,9 @@ public: std::vector> Penguins; std::shared_ptr AddPenguin(Vec3f pos, u16 direction, OPenguin::PenguinType type, OPenguin::Behaviour behaviour); + std::vector> Seagulls; + std::shared_ptr AddSeagull(Vec3f pos); + TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius); std::vector> Crossings; diff --git a/src/engine/courses/BansheeBoardwalk.cpp b/src/engine/courses/BansheeBoardwalk.cpp index 04ed6caf0..9983ac0b7 100644 --- a/src/engine/courses/BansheeBoardwalk.cpp +++ b/src/engine/courses/BansheeBoardwalk.cpp @@ -6,7 +6,7 @@ #include "BansheeBoardwalk.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/banshee_boardwalk_data.h" #include "assets/boo_frames.h" diff --git a/src/engine/courses/BigDonut.cpp b/src/engine/courses/BigDonut.cpp index d4597fe7b..c3abe1add 100644 --- a/src/engine/courses/BigDonut.cpp +++ b/src/engine/courses/BigDonut.cpp @@ -5,7 +5,7 @@ #include "BigDonut.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/big_donut_data.h" extern "C" { diff --git a/src/engine/courses/BlockFort.cpp b/src/engine/courses/BlockFort.cpp index 6178dcc5c..948eaf5e0 100644 --- a/src/engine/courses/BlockFort.cpp +++ b/src/engine/courses/BlockFort.cpp @@ -5,7 +5,7 @@ #include "BlockFort.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/block_fort_data.h" extern "C" { diff --git a/src/engine/courses/BowsersCastle.cpp b/src/engine/courses/BowsersCastle.cpp index 9e9c85d61..d5766b668 100644 --- a/src/engine/courses/BowsersCastle.cpp +++ b/src/engine/courses/BowsersCastle.cpp @@ -6,7 +6,7 @@ #include "BowsersCastle.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "bowsers_castle_data.h" extern "C" { diff --git a/src/engine/courses/ChocoMountain.cpp b/src/engine/courses/ChocoMountain.cpp index b497b2431..292d12076 100644 --- a/src/engine/courses/ChocoMountain.cpp +++ b/src/engine/courses/ChocoMountain.cpp @@ -5,7 +5,7 @@ #include "ChocoMountain.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "choco_mountain_data.h" #include "engine/actors/AFinishline.h" diff --git a/src/engine/courses/DKJungle.cpp b/src/engine/courses/DKJungle.cpp index ccf2af4b9..941ccdb22 100644 --- a/src/engine/courses/DKJungle.cpp +++ b/src/engine/courses/DKJungle.cpp @@ -6,7 +6,7 @@ #include "DKJungle.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/dks_jungle_parkway_data.h" #include "engine/vehicles/Utils.h" diff --git a/src/engine/courses/DoubleDeck.cpp b/src/engine/courses/DoubleDeck.cpp index 37064a059..d5fe16763 100644 --- a/src/engine/courses/DoubleDeck.cpp +++ b/src/engine/courses/DoubleDeck.cpp @@ -5,7 +5,7 @@ #include "DoubleDeck.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/double_deck_data.h" extern "C" { diff --git a/src/engine/courses/FrappeSnowland.cpp b/src/engine/courses/FrappeSnowland.cpp index 23fa73460..9095a19d0 100644 --- a/src/engine/courses/FrappeSnowland.cpp +++ b/src/engine/courses/FrappeSnowland.cpp @@ -6,7 +6,7 @@ #include "FrappeSnowland.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/frappe_snowland_data.h" #include "assets/boo_frames.h" diff --git a/src/engine/courses/KalimariDesert.cpp b/src/engine/courses/KalimariDesert.cpp index 405abbce4..2440e8b01 100644 --- a/src/engine/courses/KalimariDesert.cpp +++ b/src/engine/courses/KalimariDesert.cpp @@ -6,7 +6,7 @@ #include "KalimariDesert.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "kalimari_desert_data.h" #include "engine/vehicles/Utils.h" diff --git a/src/engine/courses/KoopaTroopaBeach.cpp b/src/engine/courses/KoopaTroopaBeach.cpp index 7fe30085b..eb4c3c45f 100644 --- a/src/engine/courses/KoopaTroopaBeach.cpp +++ b/src/engine/courses/KoopaTroopaBeach.cpp @@ -6,7 +6,7 @@ #include "KoopaTroopaBeach.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/koopa_troopa_beach_data.h" extern "C" { @@ -185,37 +185,45 @@ void KoopaTroopaBeach::InitCourseObjects() { gObjectList[objectId].unk_01C[2] = gCrabSpawns[i].patrolZ; } } - for (i = 0; i < NUM_SEAGULLS; i++) { - objectId = indexObjectList2[i]; - init_object(objectId, 0); - if (i < (NUM_SEAGULLS / 2)) { - gObjectList[objectId].unk_0D5 = 0; - } else { - gObjectList[objectId].unk_0D5 = 1; + + if (gGamestate == CREDITS_SEQUENCE) { + Vec3f pos = {-360.0f, 60.0f, -1300.0f}; + for (size_t i = 0; i < NUM_SEAGULLS; i++) { + gWorldInstance.AddSeagull(pos); + } + } else { // Normal gameplay + Vec3f pos = {-985.0f, 15.0f, 1200.0f}; + for (size_t i = 0; i < 4; i++) { + gWorldInstance.AddSeagull(pos); + } + + Vec3f pos2 = {328.0f, 20.0f, 2541.0f}; + for (size_t i = 0; i < 6; i++) { + gWorldInstance.AddSeagull(pos2); } } } void KoopaTroopaBeach::UpdateCourseObjects() { if (gGamestate != CREDITS_SEQUENCE) { - update_crabs(); + //update_crabs(); } if ((gPlayerCount == 1) || (gPlayerCount == 2) || (gGamestate == CREDITS_SEQUENCE)) { - update_seagulls(); + //update_seagulls(); } } void KoopaTroopaBeach::RenderCourseObjects(s32 cameraId) { if (gGamestate != CREDITS_SEQUENCE) { - render_object_crabs(cameraId); + //render_object_crabs(cameraId); } if (gGamestate != CREDITS_SEQUENCE) { if ((gPlayerCount == 1) || (gPlayerCount == 2)) { - render_object_seagulls(cameraId); + //render_object_seagulls(cameraId); } } else { - render_object_seagulls(cameraId); + //render_object_seagulls(cameraId); } } diff --git a/src/engine/courses/LuigiRaceway.cpp b/src/engine/courses/LuigiRaceway.cpp index 65506cd99..7740ebf49 100644 --- a/src/engine/courses/LuigiRaceway.cpp +++ b/src/engine/courses/LuigiRaceway.cpp @@ -5,7 +5,7 @@ #include "LuigiRaceway.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/luigi_raceway_data.h" #include "engine/actors/AFinishline.h" diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index f16caeeaf..05a4cc438 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -6,7 +6,7 @@ #include "MarioRaceway.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" extern "C" { #include "main.h" diff --git a/src/engine/courses/MooMooFarm.cpp b/src/engine/courses/MooMooFarm.cpp index 1c7854c6c..f46f263ee 100644 --- a/src/engine/courses/MooMooFarm.cpp +++ b/src/engine/courses/MooMooFarm.cpp @@ -6,8 +6,9 @@ #include "MooMooFarm.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/moo_moo_farm_data.h" +#include "engine/objects/Mole.h" extern "C" { #include "main.h" @@ -223,27 +224,37 @@ void MooMooFarm::InitCourseObjects() { D_8018D1D0 = 6; D_8018D1D8 = 6; } - for (i = 0; i < NUM_GROUP1_MOLES; i++) { + + Vec3f pos = {0, 22, 0}; + for (size_t i = 0; i < NUM_GROUP1_MOLES; i++) { D_8018D198[i] = 0; - find_unused_obj_index(&indexObjectList1[i]); - } - for (i = 0; i < NUM_GROUP2_MOLES; i++) { - D_8018D1A8[i] = 0; - find_unused_obj_index(&indexObjectList1[i]); - } - for (i = 0; i < NUM_GROUP3_MOLES; i++) { - D_8018D1B8[i] = 0; - find_unused_obj_index(&indexObjectList1[i]); - } - for (i = 0; i < NUM_TOTAL_MOLES; i++) { - find_unused_obj_index(&gObjectParticle1[i]); - objectId = gObjectParticle1[i]; - init_object(objectId, 0); - gObjectList[objectId].pos[0] = gMoleSpawns.asVec3sList[i][0] * xOrientation; - gObjectList[objectId].pos[2] = gMoleSpawns.asVec3sList[i][2]; - func_800887C0(objectId); - gObjectList[objectId].sizeScaling = 0.7f; + gWorldInstance.AddObject(new OMole(pos)); + } + + // for (i = 0; i < NUM_GROUP1_MOLES; i++) { + // D_8018D198[i] = 0; + // find_unused_obj_index(&indexObjectList1[i]); + // } + // for (i = 0; i < NUM_GROUP2_MOLES; i++) { + // D_8018D1A8[i] = 0; + // find_unused_obj_index(&indexObjectList1[i]); + // } + // for (i = 0; i < NUM_GROUP3_MOLES; i++) { + // D_8018D1B8[i] = 0; + // find_unused_obj_index(&indexObjectList1[i]); + // } + // for (i = 0; i < NUM_TOTAL_MOLES; i++) { + // find_unused_obj_index(&gObjectParticle1[i]); + // objectId = gObjectParticle1[i]; + // init_object(objectId, 0); + // gObjectList[objectId].pos[0] = gMoleSpawns.asVec3sList[i][0] * xOrientation; + // gObjectList[objectId].pos[2] = gMoleSpawns.asVec3sList[i][2]; + // func_800887C0(objectId); + // gObjectList[objectId].sizeScaling = 0.7f; + // } + + for (i = 0; i < gObjectParticle2_SIZE; i++) { find_unused_obj_index(&gObjectParticle2[i]); } @@ -252,13 +263,13 @@ void MooMooFarm::InitCourseObjects() { void MooMooFarm::UpdateCourseObjects() { if (gGamestate != CREDITS_SEQUENCE) { - update_moles(); + //update_moles(); } } void MooMooFarm::RenderCourseObjects(s32 cameraId) { if (gGamestate != CREDITS_SEQUENCE) { - render_object_moles(cameraId); + //render_object_moles(cameraId); } } diff --git a/src/engine/courses/MooMooFarm.h b/src/engine/courses/MooMooFarm.h index fb27ef725..5815db8c7 100644 --- a/src/engine/courses/MooMooFarm.h +++ b/src/engine/courses/MooMooFarm.h @@ -2,6 +2,7 @@ #include #include "Course.h" +#include "engine/objects/Mole.h" extern "C" { #include "assets/moo_moo_farm_vertices.h" @@ -15,6 +16,8 @@ extern "C" { extern const course_texture moo_moo_farm_textures[]; } +class OMole; + class MooMooFarm : public Course { public: virtual ~MooMooFarm() = default; // Virtual destructor for proper cleanup in derived classes diff --git a/src/engine/courses/PodiumCeremony.cpp b/src/engine/courses/PodiumCeremony.cpp index e2e5a1262..e05b54e51 100644 --- a/src/engine/courses/PodiumCeremony.cpp +++ b/src/engine/courses/PodiumCeremony.cpp @@ -5,7 +5,7 @@ #include "PodiumCeremony.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/royal_raceway_data.h" #include "assets/ceremony_data.h" diff --git a/src/engine/courses/RainbowRoad.cpp b/src/engine/courses/RainbowRoad.cpp index e13b3229b..4cc7e2a51 100644 --- a/src/engine/courses/RainbowRoad.cpp +++ b/src/engine/courses/RainbowRoad.cpp @@ -6,7 +6,7 @@ #include "RainbowRoad.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/rainbow_road_data.h" extern "C" { diff --git a/src/engine/courses/RoyalRaceway.cpp b/src/engine/courses/RoyalRaceway.cpp index 8fe5eec32..733d42a92 100644 --- a/src/engine/courses/RoyalRaceway.cpp +++ b/src/engine/courses/RoyalRaceway.cpp @@ -6,7 +6,7 @@ #include "RoyalRaceway.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/royal_raceway_data.h" extern "C" { diff --git a/src/engine/courses/SherbetLand.cpp b/src/engine/courses/SherbetLand.cpp index df2be3f2d..fd97ba95e 100644 --- a/src/engine/courses/SherbetLand.cpp +++ b/src/engine/courses/SherbetLand.cpp @@ -6,9 +6,9 @@ #include "SherbetLand.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/sherbet_land_data.h" -#include "engine/objects/OPenguin.h" +#include "engine/objects/Penguin.h" extern "C" { #include "main.h" diff --git a/src/engine/courses/Skyscraper.cpp b/src/engine/courses/Skyscraper.cpp index b95c15899..da3cca777 100644 --- a/src/engine/courses/Skyscraper.cpp +++ b/src/engine/courses/Skyscraper.cpp @@ -5,7 +5,7 @@ #include "Skyscraper.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/skyscraper_data.h" extern "C" { diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index b636600ec..74f7fee13 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -6,7 +6,7 @@ #include "TestCourse.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/mario_raceway_data.h" #include "assets/bowsers_castle_data.h" #include "assets/bowsers_castle_displaylists.h" @@ -187,8 +187,13 @@ void TestCourse::SpawnActors() { ACTOR_RAILROAD_CROSSING)); rrxing->crossingTrigger = crossing1; - //Vec3f pos = {-80, 7, -20}; + Vec3f pos = {0, 80, 0}; //gWorldInstance.AddActor(new ACloud(pos)); + + gWorldInstance.AddActor(new OSeagull(0, pos)); + gWorldInstance.AddActor(new OSeagull(1, pos)); + gWorldInstance.AddActor(new OSeagull(2, pos)); + gWorldInstance.AddActor(new OSeagull(3, pos)); } // Likely sets minimap boundaries diff --git a/src/engine/courses/ToadsTurnpike.cpp b/src/engine/courses/ToadsTurnpike.cpp index cbac2d4e5..4acdcd466 100644 --- a/src/engine/courses/ToadsTurnpike.cpp +++ b/src/engine/courses/ToadsTurnpike.cpp @@ -5,7 +5,7 @@ #include "ToadsTurnpike.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/toads_turnpike_data.h" #include "engine/actors/AFinishline.h" diff --git a/src/engine/courses/WarioStadium.cpp b/src/engine/courses/WarioStadium.cpp index 78bdf3079..a71b670f1 100644 --- a/src/engine/courses/WarioStadium.cpp +++ b/src/engine/courses/WarioStadium.cpp @@ -5,7 +5,7 @@ #include "WarioStadium.h" #include "World.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/wario_stadium_data.h" #include "engine/actors/AWarioSign.h" #include "engine/actors/AFinishline.h" diff --git a/src/engine/courses/YoshiValley.cpp b/src/engine/courses/YoshiValley.cpp index 1d7bb0d6a..770e5ae1d 100644 --- a/src/engine/courses/YoshiValley.cpp +++ b/src/engine/courses/YoshiValley.cpp @@ -6,7 +6,7 @@ #include "YoshiValley.h" #include "World.h" #include "engine/actors/AFinishline.h" -#include "engine/objects/OBombKart.h" +#include "engine/objects/BombKart.h" #include "assets/yoshi_valley_data.h" #include "assets/boo_frames.h" diff --git a/src/engine/objects/OBombKart.cpp b/src/engine/objects/BombKart.cpp similarity index 99% rename from src/engine/objects/OBombKart.cpp rename to src/engine/objects/BombKart.cpp index e51340b8f..42506f826 100644 --- a/src/engine/objects/OBombKart.cpp +++ b/src/engine/objects/BombKart.cpp @@ -1,5 +1,5 @@ #include -#include "OBombKart.h" +#include "BombKart.h" #include #include "port/Game.h" @@ -358,7 +358,7 @@ void OBombKart::Draw(s32 cameraId) { } else if (gGamestate != ENDING) { Unk_4A = 1; } - set_object_flag_status_false(ObjectIndex, 0x00200000); + clear_object_flag(ObjectIndex, 0x00200000); } // huh??? @@ -369,7 +369,7 @@ void OBombKart::Draw(s32 cameraId) { gObjectList[ObjectIndex].pos[2] = Pos[2]; temp_s4 = func_8008A364(ObjectIndex, cameraId, 0x31C4U, 0x000001F4); if (is_obj_flag_status_active(ObjectIndex, VISIBLE) != 0) { - set_object_flag_status_true(ObjectIndex, 0x00200000); + set_object_flag(ObjectIndex, 0x00200000); D_80183E80[0] = 0; D_80183E80[1] = func_800418AC(Pos[0], Pos[2], camera->pos); D_80183E80[2] = 0x8000; diff --git a/src/engine/objects/OBombKart.h b/src/engine/objects/BombKart.h similarity index 100% rename from src/engine/objects/OBombKart.h rename to src/engine/objects/BombKart.h diff --git a/src/engine/objects/Crab.cpp b/src/engine/objects/Crab.cpp new file mode 100644 index 000000000..cfb84f259 --- /dev/null +++ b/src/engine/objects/Crab.cpp @@ -0,0 +1,175 @@ +#include +#include +#include "Crab.h" +#include + +#include "port/Game.h" + +extern "C" { +#include "macros.h" +#include "main.h" +#include "defines.h" +#include "camera.h" +#include "update_objects.h" +#include "render_objects.h" +#include "actors.h" +#include "code_80057C60.h" +#include "code_80086E70.h" +#include "math_util.h" +#include "math_util_2.h" +#include "code_80005FD0.h" +#include "some_data.h" +#include "ceremony_and_credits.h" +#include "assets/koopa_troopa_beach_data.h" +} + +OCrab::OCrab(s32 i, Vec3f pos) { + s32 objectId; + //for (i = 0; i < NUM_CRABS; i++) { + _idx = i; + objectId = indexObjectList1[i]; + init_object(objectId, 0); + gObjectList[objectId].pos[0] = gObjectList[objectId].origin_pos[0] = + gCrabSpawns[i].startX * xOrientation; + + gObjectList[objectId].unk_01C[0] = gCrabSpawns[i].patrolX * xOrientation; + + gObjectList[objectId].pos[2] = gObjectList[objectId].origin_pos[2] = gCrabSpawns[i].startZ; + gObjectList[objectId].unk_01C[2] = gCrabSpawns[i].patrolZ; +} + +void OCrab::Tick(void) { + s32 objectIndex; + + //for (var_s1 = 0; var_s1 < NUM_CRABS; var_s1++) { + objectIndex = indexObjectList1[_idx]; + if (gObjectList[objectIndex].state != 0) { + OCrab::func_80082B34(objectIndex); + func_8008A6DC(objectIndex, 500.0f); + OCrab::func_80082C30(objectIndex); + OCrab::func_80082E18(objectIndex); + } + //} +} + +void OCrab::Draw(s32 objectIndex, s32 cameraId) { + Camera* camera; + + if (gObjectList[objectIndex].state >= 2) { + Vtx* vtx = (Vtx*) LOAD_ASSET_RAW(common_vtx_hedgehog); + camera = &camera1[cameraId]; + func_8004A6EC(objectIndex, 0.5f); + gObjectList[objectIndex].orientation[1] = + func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos); + draw_2d_texture_at(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, + gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, + (uint8_t*)gObjectList[objectIndex].activeTexture, vtx, 64, 64, + 64, 32); + } +} + +void OCrab::DrawModel(s32 cameraId) { + s32 someIndex; + s32 test; + + //for (someIndex = 0; someIndex < NUM_CRABS; someIndex++) { + test = indexObjectList1[_idx]; + func_8008A364(test, cameraId, 0x2AABU, 800); + if (is_obj_flag_status_active(test, VISIBLE) != 0) { + Camera *camera; + s32 objectIndex; + + if (gObjectList[objectIndex].state >= 2) { + camera = &camera1[cameraId]; + func_8004A6EC(objectIndex, 0.5f); + gObjectList[objectIndex].orientation[1] = func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos); + draw_2d_texture_at(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, (u8*)gObjectList[objectIndex].activeTexture, (Vtx*)common_vtx_hedgehog, 0x00000040, 0x00000040, 0x00000040, 0x00000020); + } + } + //} +} + +void OCrab::init_ktb_crab(s32 objectIndex) { + Object* object; + + init_texture_object(objectIndex, (uint8_t*) d_course_koopa_troopa_beach_crab_tlut, + (const char**) d_course_koopa_troopa_beach_crab_frames, 64, (u16) 64); + object = &gObjectList[objectIndex]; + object->sizeScaling = 0.15f; + object->textureListIndex = 0; + object_next_state(objectIndex); + object->boundingBoxSize = 1; + set_object_flag(objectIndex, 0x04000420); + func_80086EAC(objectIndex, 0, 1); + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + set_obj_orientation(objectIndex, 0U, 0U, 0x8000U); + object->unk_034 = 1.5f; + set_object_flag(objectIndex, 0x00000200); +} + +void OCrab::func_80082B34(s32 objectIndex) { + switch (gObjectList[objectIndex].state) { /* irregular */ + case 0: + break; + case 1: + OCrab::init_ktb_crab(objectIndex); + break; + case 2: + func_80072E54(objectIndex, 0, 3, 1, 2, -1); + break; + case 3: + func_80072E54(objectIndex, 4, 6, 1, 2, -1); + break; + } + if (gObjectList[objectIndex].state >= 2) { + func_80073514(objectIndex); + } +} + +void OCrab::func_80082C30(s32 objectIndex) { + switch (gObjectList[objectIndex].unk_0AE) { + case 1: + if (func_80087A0C(objectIndex, gObjectList[objectIndex].origin_pos[0], gObjectList[objectIndex].unk_01C[0], + gObjectList[objectIndex].origin_pos[2], gObjectList[objectIndex].unk_01C[2]) != 0) { + func_800726CC(objectIndex, 3); + func_80086FD4(objectIndex); + } + break; + case 2: + if (func_80087104(objectIndex, 0x003CU) != 0) { + gObjectList[objectIndex].unk_034 = 0.8f; + func_800726CC(objectIndex, 2); + func_80086FD4(objectIndex); + } + break; + case 3: + if (func_80087954(objectIndex, 0x0000003C) != 0) { + func_80086FD4(objectIndex); + func_800726CC(objectIndex, 3); + } + break; + case 4: + if (func_80087104(objectIndex, 0x003CU) != 0) { + func_800726CC(objectIndex, 2); + func_80086FD4(objectIndex); + } + break; + case 5: + if (func_8008789C(objectIndex, 0x0000003C) != 0) { + func_800726CC(objectIndex, 3); + func_8008701C(objectIndex, 2); + } + break; + } + object_calculate_new_pos_offset(objectIndex); + if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { + func_80088538(objectIndex); + gObjectList[objectIndex].pos[1] = (f32) (gObjectList[objectIndex].surfaceHeight + 2.5); + } +} + +void OCrab::func_80082E18(s32 objectIndex) { + if (gObjectList[objectIndex].state >= 2) { + func_80089F24(objectIndex); + } +} diff --git a/src/engine/objects/Crab.h b/src/engine/objects/Crab.h new file mode 100644 index 000000000..697a8bd7b --- /dev/null +++ b/src/engine/objects/Crab.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include + +extern "C" { +#include "macros.h" +#include "main.h" +#include "vehicles.h" +#include "waypoints.h" +#include "common_structs.h" +#include "objects.h" +#include "course_offsets.h" +#include "some_data.h" +} + + +class OCrab { +public: + enum Behaviour : uint16_t { + }; + +public: + f32 Diameter = 0.0f; // Waddle in a circle around the spawn point at this diameter. + uint16_t MirrorModeAngleOffset; + + explicit OCrab(s32 i, Vec3f pos); + + void Tick(); + void Draw(s32 objectIndex, s32 cameraId); + void DrawModel(s32 cameraId); + + void init_ktb_crab(s32 objectIndex); + void func_80082B34(s32 objectIndex); + void func_80082C30(s32 objectIndex); + void func_80082E18(s32 objectIndex); + +private: + + s32 _idx; +}; diff --git a/src/engine/objects/GameObject.cpp b/src/engine/objects/GameObject.cpp new file mode 100644 index 000000000..c7be32769 --- /dev/null +++ b/src/engine/objects/GameObject.cpp @@ -0,0 +1,20 @@ +#include +#include "GameObject.h" + +#include "World.h" + +extern "C" { + #include "camera.h" +} + + + //GameActor() + +GameObject::GameObject() {} + + // Virtual functions to be overridden by derived classes +void GameObject::Tick() { } +void GameObject::Draw(Camera* camera) { } +void GameObject::Collision() {} +void GameObject::Expire() { } +void GameObject::Destroy() { } diff --git a/src/engine/objects/GameObject.h b/src/engine/objects/GameObject.h new file mode 100644 index 000000000..19d5301cd --- /dev/null +++ b/src/engine/objects/GameObject.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +extern "C" { + #include "camera.h" + #include "objects.h" +} + +class GameObject { +public: + uint8_t uuid[16]; + Object o; + + virtual ~GameObject() = default; + + explicit GameObject(); + + virtual void Tick(); + virtual void Draw(Camera* camera); + virtual void Collision(); + virtual void Expire(); + virtual void Destroy(); +}; diff --git a/src/engine/objects/Mole.cpp b/src/engine/objects/Mole.cpp new file mode 100644 index 000000000..9ef7f40ef --- /dev/null +++ b/src/engine/objects/Mole.cpp @@ -0,0 +1,422 @@ +#include +#include +#include "Mole.h" + +extern "C" { +#include "macros.h" +#include "main.h" +#include "defines.h" +#include "camera.h" +#include "update_objects.h" +#include "render_objects.h" +#include "actors.h" +#include "code_80057C60.h" +#include "code_80086E70.h" +#include "math_util.h" +#include "math_util_2.h" +#include "code_80005FD0.h" +#include "some_data.h" +#include "ceremony_and_credits.h" +#include "assets/moo_moo_farm_data.h" +#include "sounds.h" +#include "external.h" +} + +OMole::OMole(Vec3f pos) { + + find_unused_obj_index(&indexObjectList1[0]); +} + +void OMole::Tick() { + s32 var_s1; + s32 objectIndex; + + for (var_s1 = 0; var_s1 < D_8018D1C8; var_s1++) { + objectIndex = indexObjectList1[var_s1]; + if (gObjectList[objectIndex].state == 0) { + if (func_8008A8B0(8, 9) != 0) { + func_80081FF4(objectIndex, 1); + } + } else { + OMole::func_800821AC(objectIndex, 1); + } + } + + for (var_s1 = 0; var_s1 < D_8018D1D0; var_s1++) { + objectIndex = indexObjectList2[var_s1]; + if (gObjectList[objectIndex].state == 0) { + if (func_8008A8B0(0x0010, 0x0013) != 0) { + OMole::func_80081FF4(objectIndex, 2); + } + } else { + OMole::func_800821AC(objectIndex, 2); + } + } + + for (var_s1 = 0; var_s1 < D_8018D1D8; var_s1++) { + objectIndex = indexObjectList3[var_s1]; + if (gObjectList[objectIndex].state == 0) { + if (func_8008A8B0(0x0011, 0x0014) != 0) { + func_80081FF4(objectIndex, 3); + } + } else { + OMole::func_800821AC(objectIndex, 3); + } + } + + for (var_s1 = 0; var_s1 < gObjectParticle2_SIZE; var_s1++) { + objectIndex = gObjectParticle2[var_s1]; + if (gObjectList[objectIndex].state != 0) { + OMole::func_80081790(objectIndex); + } + } +} + +void OMole::Draw(Camera* camera) { + +} + +void OMole::func_80081790(s32 objectIndex) { + switch (gObjectList[objectIndex].state) { + case 0: + break; /* irregular */ + case 1: + if (func_80087E08(objectIndex, gObjectList[objectIndex].velocity[1], 0.3f, gObjectList[objectIndex].unk_034, + gObjectList[objectIndex].orientation[1], 0x00000032) != 0) { + object_next_state(objectIndex); + } + object_calculate_new_pos_offset(objectIndex); + break; + case 2: + func_80072428(objectIndex); + func_80086F60(objectIndex); + break; + } +} + + + + + +void OMole::func_80081AFC(s32 objectIndex, s32 arg1) { + s8* sp2C; + Object* object; + + object = &gObjectList[objectIndex]; + switch (object->state) { + case 0x1: + OMole::func_80081848(objectIndex); + break; + case 0x2: + if (object->unk_04C == 0) { + func_80086EAC(objectIndex, 2, 1); + object_next_state(objectIndex); + set_object_flag(objectIndex, 0x00000200); + } else { + object->unk_04C--; + } + break; + case 0x3: + if (object->unk_0AE == 0) { + func_80086EAC(objectIndex, 2, 4); + func_8008153C(objectIndex); + object_next_state(objectIndex); + func_800C98B8(object->pos, object->velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x07)); + } + break; + case 0x4: + if (func_80072E54(objectIndex, 1, 6, 1, 2, 0) != 0) { + func_800726CC(objectIndex, 0x00000064); + } + break; + case 0xA: + func_80072E54(objectIndex, 1, 6, 1, 0, -1); + if (object->unk_0AE == 0) { + func_800726CC(objectIndex, 0x00000064); + } + break; + case 0x64: + if (object->unk_0AE == 0) { + clear_object_flag(objectIndex, 0x00000200); + func_80072428(objectIndex); + switch (arg1) { /* switch 1; irregular */ + case 1: /* switch 1 */ + sp2C = D_8018D198; + break; + case 2: /* switch 1 */ + sp2C = D_8018D1A8; + break; + case 3: /* switch 1 */ + sp2C = D_8018D1B8; + break; + } + sp2C[object->type] = 0; + } + break; + case 0: + default: + break; + } + if (object->state >= 2) { + func_80073514(objectIndex); + } +} + +void OMole::func_80081D34(s32 objectIndex) { + Player* player; + Camera* var_s4; + s32 var_s2; + s32 var_s5; + Object* object; + + var_s5 = 0; + player = gPlayerOne; + var_s4 = camera1; + for (var_s2 = 0; var_s2 < D_8018D158; var_s2++, player++, var_s4++) { + if ((is_obj_flag_status_active(objectIndex, 0x00000200) != 0) && !(player->effects & 0x80000000) && + (has_collided_with_player(objectIndex, player) != 0)) { + if ((player->type & 0x8000) && !(player->type & 0x100)) { + var_s5 = 1; + object = &gObjectList[objectIndex]; + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { + func_80072180(); + } + if (player->effects & 0x200) { + func_800C9060(var_s2, 0x1900A046U); + } else { + player->soundEffects |= 2; + } + object->direction_angle[1] = var_s4->rot[1]; + object->velocity[1] = (player->unk_094 / 2) + 3.0; + object->unk_034 = player->unk_094 + 1.0; + if (object->velocity[1] >= 5.0) { + object->velocity[1] = 5.0f; + } + if (object->unk_034 >= 4.0) { + object->velocity[1] = 4.0f; + } + } + } + } + if (var_s5 != 0) { + object = &gObjectList[objectIndex]; + clear_object_flag(objectIndex, 0x00000200); + func_80086F60(objectIndex); + set_obj_origin_pos(objectIndex, object->pos[0], object->pos[1], object->pos[2]); + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + func_80086EAC(objectIndex, 2, 0x000A); + func_800726CC(objectIndex, 0x0000000A); + } +} + + +void OMole::func_80081FF4(s32 objectIndex, s32 arg1) { + UNUSED s32 stackPadding0; + UNUSED s32 stackPadding1; + s32 moleCount; + s16 var_v1; + s16 offset; + s32 var_a0; + s8* var_a2; + + init_object(objectIndex, 0); + gObjectList[objectIndex].unk_04C = random_int(0x001EU) + 5; + switch (arg1) { /* irregular */ + case 1: + var_a2 = D_8018D198; + moleCount = NUM_GROUP1_MOLES; + offset = 0; + break; + case 2: + var_a2 = D_8018D1A8; + moleCount = NUM_GROUP2_MOLES; + offset = 24; + // offset = NUM_GROUP1_MOLES; + break; + case 3: + var_a2 = D_8018D1B8; + moleCount = NUM_GROUP3_MOLES; + offset = 57; + // offset = NUM_GROUP1_MOLES + NUM_GROUP2_MOLES; + break; + } + var_v1 = random_int(moleCount); + for (var_a0 = 0; var_a0 < moleCount; var_a0++) { + if (var_a2[var_v1] != 0) { + var_v1++; + if (var_v1 == moleCount) { + var_v1 = 0; + } + } else { + var_a2[var_v1] = 1; + gObjectList[objectIndex].type = var_v1; + break; + } + } + /* + Ideally `gMoleSpawns` wouldn't be a union at all and its just be a list of Vec3s + Even more ideally each mole group would have its own array for its spawns + gObjectList[objectIndex].origin_pos[0] = gMoleSpawns.asVec3sList[offset + var_v1][0] * xOrientation; + gObjectList[objectIndex].origin_pos[1] = gMoleSpawns.asVec3sList[offset + var_v1][1] - 9.0; + gObjectList[objectIndex].origin_pos[2] = gMoleSpawns.asVec3sList[offset + var_v1][2]; + */ + gObjectList[objectIndex].origin_pos[0] = gMoleSpawns.asFlatList[offset + (var_v1 * 3) + 0] * xOrientation; + gObjectList[objectIndex].origin_pos[1] = gMoleSpawns.asFlatList[offset + (var_v1 * 3) + 1] - 9.0; + gObjectList[objectIndex].origin_pos[2] = gMoleSpawns.asFlatList[offset + (var_v1 * 3) + 2]; +} + +void OMole::func_80081848(s32 objectIndex) { + u8* mole = (u8*) LOAD_ASSET_RAW(d_course_moo_moo_farm_mole_frames); + u8* tlut = (u8*) LOAD_ASSET_RAW(d_course_moo_moo_farm_mole_tlut); + init_texture_object(objectIndex, (u8*)d_course_moo_moo_farm_mole_tlut, (const char**) mole, 0x20U, (u16) 0x00000040); + gObjectList[objectIndex].sizeScaling = 0.15f; + gObjectList[objectIndex].textureListIndex = 0; + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + set_obj_direction_angle(objectIndex, 0U, 0U, 0U); + set_obj_orientation(objectIndex, 0U, 0U, 0x8000U); + gObjectList[objectIndex].boundingBoxSize = 6; + gObjectList[objectIndex].velocity[1] = 4.0f; + set_object_flag(objectIndex, 0x04000000); + object_next_state(objectIndex); +} + + +void OMole::func_80081924(s32 objectIndex) { + switch (gObjectList[objectIndex].unk_0AE) { + case 1: + if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], 9.0f, 0.7f) != 0) { + func_80086FD4(objectIndex); + } + break; + case 2: + func_800871AC(objectIndex, 0x0000000A); + break; + case 3: + if (f32_step_down_towards(&gObjectList[objectIndex].offset[1], 3.0f, 1.0f) != 0) { + func_80086F60(objectIndex); + } + break; + case 4: + func_80087D24(objectIndex, 3.6f, 0.25f, 0.0f); + break; + case 5: + func_80086F60(objectIndex); + break; + case 10: + gObjectList[objectIndex].orientation[2] += 0x1000; + gObjectList[objectIndex].velocity[1] -= 0.184; + func_8008751C(objectIndex); + object_add_velocity_offset_xyz(objectIndex); + if (gObjectList[objectIndex].pos[1] <= -10.0) { + func_80086F60(objectIndex); + } + break; + case 0: + default: + break; + } +} + + +void OMole::func_80081A88(s32 objectIndex) { + switch (gObjectList[objectIndex].unk_0DD) { /* irregular */ + case 0: + break; + case 1: + func_8008B724(objectIndex); + break; + case 2: + OMole::func_80081924(objectIndex); + break; + } + object_calculate_new_pos_offset(objectIndex); +} + +void OMole::func_800821AC(s32 objectIndex, s32 arg1) { + if (gObjectList[objectIndex].state != 0) { + OMole::func_80081AFC(objectIndex, arg1); + OMole::func_80081A88(objectIndex); + OMole::func_80081D34(objectIndex); + } +} + +void OMole::func_80054E10(s32 objectIndex) { + if (gObjectList[objectIndex].state > 0) { + if (is_obj_flag_status_active(objectIndex, 0x00800000) != 0) { + D_80183E50[0] = gObjectList[objectIndex].pos[0]; + D_80183E50[1] = gObjectList[objectIndex].surfaceHeight + 0.8; + D_80183E50[2] = gObjectList[objectIndex].pos[2]; + D_80183E70[0] = gObjectList[objectIndex].velocity[0]; + D_80183E70[1] = gObjectList[objectIndex].velocity[1]; + D_80183E70[2] = gObjectList[objectIndex].velocity[2]; + func_8004A9B8(gObjectList[objectIndex].sizeScaling); + } + } +} + +// Almost certainly responsible for spawning/handling the moles on Moo Moo farm +void OMole::func_80054EB8() { + s32 someIndex; + + for (someIndex = 0; someIndex < NUM_TOTAL_MOLES; someIndex++) { + func_80054E10(gObjectParticle1[someIndex]); + } +} + +void OMole::func_80054D00(s32 objectIndex, s32 cameraId) { + Camera* camera; + + camera = &camera1[cameraId]; + if (gObjectList[objectIndex].state >= 3) { + func_8008A364(objectIndex, cameraId, 0x2AABU, 0x0000012C); + if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { + D_80183E80[0] = (s16) gObjectList[objectIndex].orientation[0]; + D_80183E80[1] = + func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos); + D_80183E80[2] = (u16) gObjectList[objectIndex].orientation[2]; + func_80048130(gObjectList[objectIndex].pos, (u16*) D_80183E80, gObjectList[objectIndex].sizeScaling, + (u8*) gObjectList[objectIndex].activeTLUT, (u8*)gObjectList[objectIndex].activeTexture, + (Vtx*)LOAD_ASSET_RAW(D_0D0062B0), 0x00000020, 0x00000040, 0x00000020, 0x00000040, 5); + } + } +} + +void OMole::func_80054F04(s32 cameraId) { + s32 var_s2; + s32 objectIndex; + Camera* sp44; + Object* object; + + sp44 = &camera1[cameraId]; + gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0079C8); + load_texture_block_rgba16_mirror((u8*) LOAD_ASSET_RAW(d_course_moo_moo_farm_mole_dirt), 0x00000010, 0x00000010); + for (var_s2 = 0; var_s2 < gObjectParticle2_SIZE; var_s2++) { + objectIndex = gObjectParticle2[var_s2]; + object = &gObjectList[objectIndex]; + if (object->state > 0) { + func_8008A364(objectIndex, cameraId, 0x2AABU, 0x000000C8); + if ((is_obj_flag_status_active(objectIndex, VISIBLE) != 0) && (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { + object->orientation[1] = func_800418AC(object->pos[0], object->pos[2], sp44->pos); + rsp_set_matrix_gObjectList(objectIndex); + gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D006980); + } + } + } + gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); +} + +void OMole::render_object_moles(s32 cameraId) { + s32 i; + + for (i = 0; i < NUM_GROUP1_MOLES; i++) { + OMole::func_80054D00(indexObjectList1[i], cameraId); + } + for (i = 0; i < NUM_GROUP2_MOLES; i++) { + OMole::func_80054D00(indexObjectList2[i], cameraId); + } + for (i = 0; i < NUM_GROUP3_MOLES; i++) { + OMole::func_80054D00(indexObjectList3[i], cameraId); + } + OMole::func_80054EB8(); + OMole::func_80054F04(cameraId); +} \ No newline at end of file diff --git a/src/engine/objects/Mole.h b/src/engine/objects/Mole.h new file mode 100644 index 000000000..d5d605fa5 --- /dev/null +++ b/src/engine/objects/Mole.h @@ -0,0 +1,52 @@ +#pragma once + +#include +#include +#include "GameObject.h" + +extern "C" { +#include "macros.h" +#include "main.h" +#include "vehicles.h" +#include "waypoints.h" +#include "common_structs.h" +#include "objects.h" +#include "course_offsets.h" +#include "some_data.h" +} + + +class OMole : public GameObject { +public: + enum Behaviour : uint16_t { + }; + +public: + explicit OMole(Vec3f pos); + + virtual void Tick() override; + virtual void Draw(Camera*) override; + + void func_80054E10(s32 objectIndex); + void func_80054EB8(); + void func_80054F04(s32 cameraId); + void render_object_moles(s32 cameraId); + void func_80054D00(s32 objectIndex, s32 cameraId); + void func_800821AC(s32 objectIndex, s32 arg1); + void func_80081FF4(s32 objectIndex, s32 arg1); + void func_80081D34(s32 objectIndex); + void func_80081AFC(s32 objectIndex, s32 arg1); + void func_80081A88(s32 objectIndex); + void func_80081924(s32 objectIndex); + void func_80081848(s32 objectIndex); + void func_80081790(s32 objectIndex); + +private: + s32 _idx; + s32 _state; + s32 _timer; + s32 _status; + bool _toggle; + + SplineData *spline; +}; diff --git a/src/engine/objects/OPenguin.cpp b/src/engine/objects/Penguin.cpp similarity index 98% rename from src/engine/objects/OPenguin.cpp rename to src/engine/objects/Penguin.cpp index 944ec38fd..c126174a1 100644 --- a/src/engine/objects/OPenguin.cpp +++ b/src/engine/objects/Penguin.cpp @@ -1,6 +1,6 @@ #include #include -#include "OPenguin.h" +#include "Penguin.h" #include #include "port/Game.h" @@ -98,7 +98,7 @@ void OPenguin::Tick(void) { if ((is_obj_flag_status_active(objectIndex, 0x02000000) != 0) && (func_80072354(objectIndex, 0x00000020) != 0)) { func_800722A4(objectIndex, 0x00000060); - set_object_flag_status_false(objectIndex, 0x02000000); + clear_object_flag(objectIndex, 0x02000000); } } @@ -315,7 +315,7 @@ void OPenguin::InitEmperorPenguin(s32 objectIndex) { object->unk_0DD = 1; func_80086EF0(objectIndex); object->spline = D_800E672C[0]; - set_object_flag_status_true(objectIndex, 0x04000800); + set_object_flag(objectIndex, 0x04000800); object->type = get_animation_length(d_course_sherbet_land_unk_data11, 0); object_next_state(objectIndex); } @@ -377,7 +377,7 @@ void OPenguin::InitOtherPenguin(s32 objectIndex) { //object->boundingBoxSize = 4; object->unk_09C = 2; object->unk_04C = random_int(0x012CU); - set_object_flag_status_true(objectIndex, 0x04000220); + set_object_flag(objectIndex, 0x04000220); // This code has been significantly refactored from the original func_800845C8 // Into a switch statement instead of checking for the index of the penguin diff --git a/src/engine/objects/OPenguin.h b/src/engine/objects/Penguin.h similarity index 70% rename from src/engine/objects/OPenguin.h rename to src/engine/objects/Penguin.h index 5df5ef9ea..0e9c36f49 100644 --- a/src/engine/objects/OPenguin.h +++ b/src/engine/objects/Penguin.h @@ -13,19 +13,6 @@ extern "C" { #include "course_offsets.h" } -//! @todo Make shadow size bigger if thwomp is scaled up -//! @todo make adjustable properties for squishSize and boundingBoxSize - - /** - * Thwomp GameObject - * - * The game automatically places the actor on the ground so you do not need to provide a Y coordinate value. - * - * @arg direction the rotational direction the thwomp is facing. - * @arg behaviour the behaviour of the thwomp, uses values 1-6. - * @arg primAlpha unknown - * @arg boundingBoxSize optional. The size of the bounding box for the thwomp. Default value is 12 - */ class OPenguin { public: enum PenguinType : uint32_t { diff --git a/src/engine/objects/Seagull.cpp b/src/engine/objects/Seagull.cpp new file mode 100644 index 000000000..4b36bbf31 --- /dev/null +++ b/src/engine/objects/Seagull.cpp @@ -0,0 +1,194 @@ +#include +#include +#include "Seagull.h" +#include "engine/Actor.h" +#include "ObjectReimpl.h" +#include + +#include "port/Game.h" + +extern "C" { +#include "macros.h" +#include "main.h" +#include "defines.h" +#include "camera.h" +#include "update_objects.h" +#include "render_objects.h" +#include "actors.h" +#include "code_80057C60.h" +#include "code_80086E70.h" +#include "math_util.h" +#include "math_util_2.h" +#include "code_80005FD0.h" +#include "some_data.h" +#include "ceremony_and_credits.h" +extern SplineData D_800E6034; +extern SplineData D_800E60F0; +extern SplineData D_800E61B4; +extern SplineData D_800E6280; +} + +SplineData* D_800E633C[] = { &D_800E6034, &D_800E60F0, &D_800E61B4, &D_800E6280 }; + +OSeagull::OSeagull(s32 i, Vec3f pos) { + size_t objectId; + _idx = i; + + s16 randZ; + s16 randX; + s16 randY; + randX = random_int(200) + -100.0; + randY = random_int(20); + randZ = random_int(200) + -100.0; + + SpawnPos[0] = pos[0] + randX; + SpawnPos[1] = pos[1] + randY; + SpawnPos[2] = pos[2] + randZ; + + //for (i = 0; i < NUM_SEAGULLS; i++) { + + + //objectId = indexObjectList2[i]; + //init_object(objectId, 0); + + + //set_obj_origin_pos(objectId, pos[0], pos[1], pos[2]); + //if (i < (NUM_SEAGULLS / 2)) { + //gObjectList[objectId].unk_0D5 = 0; + //} else { + // gObjectList[objectId].unk_0D5 = 1; + //} + //} +} + +bool OSeagull::IsMod() { return true; } + +void OSeagull::Tick() { + Object* object; + UNUSED s32* var_s4; + s32 temp_s0; + + //for (var_s3 = 0; var_s3 < NUM_SEAGULLS; var_s3++) { + //temp_s0 = indexObjectList2[_idx]; + + //object = &gObjectList[temp_s0]; + if (_state == 0) { + return; + } + + OSeagull::func_80082714(temp_s0, _idx); + OSeagull::func_8008275C(temp_s0); + if (_toggle) { + _toggle = false; + if (D_80165A90 != 0) { + D_80165A90 = 0; + D_80183E40[0] = 0.0f; + D_80183E40[1] = 0.0f; + D_80183E40[2] = 0.0f; + if (gGamestate != CREDITS_SEQUENCE) { + func_800C98B8(Pos, D_80183E40, SOUND_ARG_LOAD(0x19, 0x01, 0x70, 0x43)); + } else { + //temp_s0 = indexObjectList2[1]; + //! @todo confirm this is equivallent to indexObjectList2[1]; + if (_idx == 1) { + if (gCutsceneShotTimer <= 150) { + //object = &gObjectList[temp_s0]; + func_800C98B8(Pos, D_80183E40, SOUND_ARG_LOAD(0x19, 0x01, 0x70, 0x43)); + } + } + } + } + } + //} + if (D_80165900 != 0) { + D_80165900 -= 1; + } else { + if (gGamestate != CREDITS_SEQUENCE) { + D_80165900 = 60; + } else { + D_80165900 = 15; + } + if ((D_80165908 != 0) && (D_80165A90 == 0)) { + D_80165A90 = 1; + } + } + D_80165908 = 0; +} + +void OSeagull::Draw(Camera* camera) { // render_object_seagulls + s32 var_s1; + //for (i = 0; i < NUM_SEAGULLS; i++) { + var_s1 = indexObjectList2[_idx]; + //! @todo: Quick hack to let seagull work in actor system. Should be cameraId not camera->playerId + //if (func_8008A364(var_s1, camera->playerId, 0x5555U, 0x000005DC) < 0x9C401 && CVarGetInteger("gNoCulling", 0) == 0) { + D_80165908 = 1; + _toggle = true; + //} + //if (is_obj_flag_status_active(var_s1, VISIBLE) != 0) { + func_800552BC(var_s1); + //} + //} +} + +void OSeagull::func_8008275C(s32 objectIndex) { + UNUSED s32 stackPadding; + switch (gObjectList[objectIndex].unk_0DD) { + case 1: + func_8008B78C(objectIndex); + ObjectImpl::CalculateNewPosOffset(this); + break; + case 2: + func_8008B78C(objectIndex); + vec3f_copy(gObjectList[objectIndex].unk_01C, gObjectList[objectIndex].pos); + func_8000D940(SpawnPos, (s16*) &gObjectList[objectIndex].unk_0C6, + gObjectList[objectIndex].unk_034, 0.0f, 0); + Offset[0] *= 2.0; + Offset[1] *= 2.5; + Offset[2] *= 2.0; + ObjectImpl::CalculateNewPosOffset(this); + gObjectList[objectIndex].direction_angle[1] = + get_angle_between_two_vectors(gObjectList[objectIndex].unk_01C, gObjectList[objectIndex].pos); + break; + } + func_800873F4(objectIndex); +} + +void OSeagull::func_8008241C(s32 objectIndex, s32 arg1) { + UNUSED s16 stackPadding0; + + gObjectList[objectIndex].unk_0D8 = 1; + gObjectList[objectIndex].model = (Gfx*) d_course_koopa_troopa_beach_unk4; + gObjectList[objectIndex].vertex = (Vtx*) d_course_koopa_troopa_beach_unk_data5; + gObjectList[objectIndex].sizeScaling = 0.2f; + gObjectList[objectIndex].unk_0DD = 1; + // if (gGamestate == CREDITS_SEQUENCE) { + // set_obj_origin_pos(objectIndex, randX + -360.0, randY + 60.0, randZ + -1300.0); + // } else if (gObjectList[objectIndex].unk_0D5 != 0) { + // set_obj_origin_pos(objectIndex, (randX + 328.0) * xOrientation, randY + 20.0, randZ + 2541.0); + // } else { + // set_obj_origin_pos(objectIndex, (randX + -985.0) * xOrientation, randY + 15.0, randZ + 1200.0); + // } + set_obj_direction_angle(objectIndex, 0U, 0U, 0U); + gObjectList[objectIndex].unk_034 = 1.0f; + func_80086EF0(objectIndex); + //gObjectList[objectIndex].spline = D_800E633C[arg1 % 4]; + spline = D_800E633C[arg1 % 4]; + //set_object_flag(objectIndex, 0x800); + //object_next_state(objectIndex); + _status |= 0x800; + _timer = 0; + _status &= ~0x2000; + _state++; +} + + +void OSeagull::func_80082714(s32 objectIndex, s32 arg1) { + switch (gObjectList[objectIndex].state) { + case 1: + OSeagull::func_8008241C(objectIndex, arg1); + break; + case 0: + default: + break; + } +} \ No newline at end of file diff --git a/src/engine/objects/Seagull.h b/src/engine/objects/Seagull.h new file mode 100644 index 000000000..798d25f8d --- /dev/null +++ b/src/engine/objects/Seagull.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include "engine/Actor.h" + +extern "C" { +#include "macros.h" +#include "main.h" +#include "vehicles.h" +#include "waypoints.h" +#include "common_structs.h" +#include "objects.h" +#include "course_offsets.h" +#include "some_data.h" +} + + +class OSeagull : public AActor { +public: + enum Behaviour : uint16_t { + }; + +public: + explicit OSeagull(s32 i, Vec3f pos); + + virtual void Tick() override; + virtual void Draw(Camera*) override; + + void func_8008275C(s32 objectIndex); + void func_8008241C(s32 objectIndex, s32 arg1); + void func_80082714(s32 objectIndex, s32 arg1); + virtual bool IsMod() override; + Vec3f Offset; + Vec3f SpawnPos; +private: + s32 _idx; + s32 _state; + s32 _timer; + s32 _status; + bool _toggle; + + SplineData *spline; +}; diff --git a/src/engine/objects/OThwomp.cpp b/src/engine/objects/Thwomp.cpp similarity index 98% rename from src/engine/objects/OThwomp.cpp rename to src/engine/objects/Thwomp.cpp index 558b00534..87d670cfd 100644 --- a/src/engine/objects/OThwomp.cpp +++ b/src/engine/objects/Thwomp.cpp @@ -1,6 +1,6 @@ #include #include -#include "OThwomp.h" +#include "Thwomp.h" #include #include "port/Game.h" @@ -305,17 +305,17 @@ void OThwomp::SetVisibility(s32 objectIndex) { // func_8008A4CC s32 loopIndex; Camera* camera; - set_object_flag_status_false(objectIndex, 0x00070000); + clear_object_flag(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_status_true(objectIndex, 0x00010000); + set_object_flag(objectIndex, 0x00010000); if (D_8018CF68[loopIndex] == gObjectList[objectIndex].unk_0DF) { - set_object_flag_status_true(objectIndex, 0x00020000); + set_object_flag(objectIndex, 0x00020000); } if (is_object_visible_on_camera(objectIndex, camera, 0x2AABU) != 0) { - set_object_flag_status_true(objectIndex, VISIBLE); + set_object_flag(objectIndex, VISIBLE); } } } @@ -619,7 +619,7 @@ void OThwomp::func_80080B28(s32 objectIndex, s32 playerId) { } OThwomp::func_80080DE4(objectIndex); func_80075304(gObjectList[objectIndex].pos, 3, 3, D_8018D3C4); - set_object_flag_status_false(objectIndex, 0x00000200); + clear_object_flag(objectIndex, 0x00000200); func_800722A4(objectIndex, 0x00000040); func_80086F60(objectIndex); func_800726CC(objectIndex, 0x000000C8); @@ -666,7 +666,7 @@ void OThwomp::Draw(s32 cameraId) { camera = &camera1[cameraId]; if (cameraId == PLAYER_ONE) { objectIndex = indexObjectList1[_idx]; - set_object_flag_status_false(objectIndex, 0x00070000); + clear_object_flag(objectIndex, 0x00070000); func_800722CC(objectIndex, 0x00000110); } @@ -831,7 +831,7 @@ void OThwomp::func_8007EC30(s32 objectIndex) { 0x10U, (u16) 0x00000040); object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; object->unk_01C[1] = 30.0f; - set_object_flag_status_true(objectIndex, 0x05000220); + set_object_flag(objectIndex, 0x05000220); object->type = 0; object->unk_0DF = 6; func_800724DC(objectIndex); @@ -868,7 +868,7 @@ void OThwomp::func_8007EE5C(s32 objectIndex) { 0x10U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - set_object_flag_status_true(objectIndex, 0x04000220); + set_object_flag(objectIndex, 0x04000220); object->type = 0; object->unk_0DF = 6; func_80086E70(objectIndex); @@ -921,7 +921,7 @@ void OThwomp::func_8007FA08(s32 objectIndex) { 0x10U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - set_object_flag_status_true(objectIndex, 0x04000220); + set_object_flag(objectIndex, 0x04000220); object->type = 0; object->surfaceHeight = 0.0f; object->origin_pos[1] = 0.0f; @@ -1087,7 +1087,7 @@ void OThwomp::func_80080078(s32 objectIndex) { // func_80080078 0x10U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - set_object_flag_status_true(objectIndex, 0x04000220); + set_object_flag(objectIndex, 0x04000220); object->type = 2; object->unk_0DF = 8; set_obj_direction_angle(objectIndex, 0U, 0U, 0U); @@ -1159,7 +1159,7 @@ void OThwomp::func_800802C0(s32 objectIndex) { object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; object->textureListIndex = 0; //object->sizeScaling = 1.5f; - set_object_flag_status_true(objectIndex, 0x05000220); + set_object_flag(objectIndex, 0x05000220); object->type = 1; object->unk_0DF = 6; set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); @@ -1269,7 +1269,7 @@ void OThwomp::func_80080524(s32 objectIndex) { object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; object->textureListIndex = 0; - set_object_flag_status_true(objectIndex, 0x04000220); + set_object_flag(objectIndex, 0x04000220); object->type = 0; object->unk_0DF = 0x0A; func_80086E70(objectIndex); @@ -1302,7 +1302,7 @@ void OThwomp::func_8007E63C(s32 objectIndex) { case 0x32: if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], gObjectList[objectIndex].unk_01C[1] + 15.0, 1.5f) != 0) { - set_object_flag_status_true(objectIndex, 0x00000200); + set_object_flag(objectIndex, 0x00000200); func_800722A4(objectIndex, 1); func_800722CC(objectIndex, 2); object_next_state(objectIndex); @@ -1345,7 +1345,7 @@ void OThwomp::func_8007E63C(s32 objectIndex) { } if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], gObjectList[objectIndex].unk_01C[1], 0.5f) != 0) { - set_object_flag_status_false(objectIndex, 0x00000200); + clear_object_flag(objectIndex, 0x00000200); func_8007266C(objectIndex); } break; @@ -1417,7 +1417,7 @@ void OThwomp::func_8007E63C(s32 objectIndex) { case 0x6C: if (set_and_run_timer_object(objectIndex, 0x00000064) != 0) { func_800722CC(objectIndex, 2); - set_object_flag_status_false(objectIndex, 0x00000200); + clear_object_flag(objectIndex, 0x00000200); func_8007266C(objectIndex); } break; diff --git a/src/engine/objects/OThwomp.h b/src/engine/objects/Thwomp.h similarity index 100% rename from src/engine/objects/OThwomp.h rename to src/engine/objects/Thwomp.h diff --git a/src/port/Game.cpp b/src/port/Game.cpp index 337321662..300deed9f 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -32,7 +32,7 @@ #include "engine/courses/PodiumCeremony.h" #include "engine/TrainCrossing.h" -#include "src/engine/objects/OBombKart.h" +#include "src/engine/objects/BombKart.h" #include "Smoke.h" @@ -378,6 +378,18 @@ extern "C" { } } + void CourseManager_TickObjects() { + if (gWorldInstance.CurrentCourse) { + gWorldInstance.TickObjects(); + } + } + + void CourseManager_DrawObjects(Camera* camera) { + if (gWorldInstance.CurrentCourse) { + gWorldInstance.DrawObjects(camera); + } + } + // Helps prevents users from forgetting to add a finishline to their course bool cm_DoesFinishlineExist() { for (AActor* actor : gWorldInstance.Actors) { @@ -522,6 +534,22 @@ extern "C" { } } + void CourseManager_DrawSeagulls(s32 cameraId) { + for (auto& seagull : gWorldInstance.Seagulls) { + if (seagull) { + // seagull->Draw(cameraId); + } + } + } + + void CourseManager_TickSeagulls(void) { + for (auto& seagull : gWorldInstance.Seagulls) { + if (seagull) { + //seagull->Tick(); + } + } + } + void CourseManager_DrawPenguins(s32 cameraId) { for (auto& penguin : gWorldInstance.Penguins) { if (penguin) { diff --git a/src/port/Game.h b/src/port/Game.h index 6e19b1b63..0cf450c34 100644 --- a/src/port/Game.h +++ b/src/port/Game.h @@ -49,6 +49,9 @@ void CourseManager_InitClouds(); void CourseManager_DrawActor(Camera* camera, struct Actor* actor); +void CourseManager_TickObjects(); +void CourseManager_DrawObjects(Camera* camera); + void CourseManager_UpdateClouds(s32 arg0, Camera* camera); void CourseManager_Waypoints(Player* player, int8_t playerId); @@ -100,6 +103,10 @@ void CourseManager_DrawThwomps(s32 cameraId); void CourseManager_TickThwomps(); +void CourseManager_DrawSeagulls(s32 cameraId); + +void CourseManager_TickSeagulls(); + void CourseManager_DrawPenguins(s32 cameraId); void CourseManager_TickPenguins(); diff --git a/src/render_objects.c b/src/render_objects.c index a5b828f0f..a56e91c0d 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -4015,86 +4015,6 @@ void func_80054BE8(s32 cameraId) { } } -void func_80054D00(s32 objectIndex, s32 cameraId) { - Camera* camera; - - camera = &camera1[cameraId]; - if (gObjectList[objectIndex].state >= 3) { - func_8008A364(objectIndex, cameraId, 0x2AABU, 0x0000012C); - if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { - D_80183E80[0] = (s16) gObjectList[objectIndex].orientation[0]; - D_80183E80[1] = - func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos); - D_80183E80[2] = (u16) gObjectList[objectIndex].orientation[2]; - func_80048130(gObjectList[objectIndex].pos, (u16*) D_80183E80, gObjectList[objectIndex].sizeScaling, - (u8*) gObjectList[objectIndex].activeTLUT, gObjectList[objectIndex].activeTexture, - LOAD_ASSET(D_0D0062B0), 0x00000020, 0x00000040, 0x00000020, 0x00000040, 5); - } - } -} - -void func_80054E10(s32 objectIndex) { - if (gObjectList[objectIndex].state > 0) { - if (is_obj_flag_status_active(objectIndex, 0x00800000) != 0) { - D_80183E50[0] = gObjectList[objectIndex].pos[0]; - D_80183E50[1] = gObjectList[objectIndex].surfaceHeight + 0.8; - D_80183E50[2] = gObjectList[objectIndex].pos[2]; - D_80183E70[0] = gObjectList[objectIndex].velocity[0]; - D_80183E70[1] = gObjectList[objectIndex].velocity[1]; - D_80183E70[2] = gObjectList[objectIndex].velocity[2]; - func_8004A9B8(gObjectList[objectIndex].sizeScaling); - } - } -} - -// Almost certainly responsible for spawning/handling the moles on Moo Moo farm -void func_80054EB8(UNUSED s32 unused) { - s32 someIndex; - - for (someIndex = 0; someIndex < NUM_TOTAL_MOLES; someIndex++) { - func_80054E10(gObjectParticle1[someIndex]); - } -} - -void func_80054F04(s32 cameraId) { - s32 var_s2; - s32 objectIndex; - Camera* sp44; - Object* object; - - sp44 = &camera1[cameraId]; - gSPDisplayList(gDisplayListHead++, D_0D0079C8); - load_texture_block_rgba16_mirror((u8*) LOAD_ASSET(d_course_moo_moo_farm_mole_dirt), 0x00000010, 0x00000010); - for (var_s2 = 0; var_s2 < gObjectParticle2_SIZE; var_s2++) { - objectIndex = gObjectParticle2[var_s2]; - object = &gObjectList[objectIndex]; - if (object->state > 0) { - func_8008A364(objectIndex, cameraId, 0x2AABU, 0x000000C8); - if ((is_obj_flag_status_active(objectIndex, VISIBLE) != 0) && (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { - object->orientation[1] = func_800418AC(object->pos[0], object->pos[2], sp44->pos); - rsp_set_matrix_gObjectList(objectIndex); - gSPDisplayList(gDisplayListHead++, D_0D006980); - } - } - } - gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); -} - -void render_object_moles(s32 cameraId) { - s32 i; - - for (i = 0; i < NUM_GROUP1_MOLES; i++) { - func_80054D00(indexObjectList1[i], cameraId); - } - for (i = 0; i < NUM_GROUP2_MOLES; i++) { - func_80054D00(indexObjectList2[i], cameraId); - } - for (i = 0; i < NUM_GROUP3_MOLES; i++) { - func_80054D00(indexObjectList3[i], cameraId); - } - func_80054EB8(cameraId); - func_80054F04(cameraId); -} void func_80055164(s32 objectIndex) { if (gObjectList[objectIndex].state >= 2) { @@ -4141,51 +4061,6 @@ void func_800552BC(s32 objectIndex) { } } -void render_object_seagulls(s32 arg0) { - s32 i; - s32 var_s1; - - for (i = 0; i < NUM_SEAGULLS; i++) { - var_s1 = indexObjectList2[i]; - if (func_8008A364(var_s1, arg0, 0x5555U, 0x000005DC) < 0x9C401 && CVarGetInteger("gNoCulling", 0) == 0) { - D_80165908 = 1; - func_800722A4(var_s1, 2); - } - if (is_obj_flag_status_active(var_s1, VISIBLE) != 0) { - func_800552BC(var_s1); - } - } -} - -void draw_crabs(s32 objectIndex, s32 cameraId) { - Camera* camera; - - if (gObjectList[objectIndex].state >= 2) { - Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_hedgehog); - camera = &camera1[cameraId]; - func_8004A6EC(objectIndex, 0.5f); - gObjectList[objectIndex].orientation[1] = - func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos); - draw_2d_texture_at(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, - gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, - gObjectList[objectIndex].activeTexture, vtx, 64, 64, - 64, 32); - } -} - -void render_object_crabs(s32 arg0) { - s32 someIndex; - s32 test; - - for (someIndex = 0; someIndex < NUM_CRABS; someIndex++) { - test = indexObjectList1[someIndex]; - func_8008A364(test, arg0, 0x2AABU, 0x00000320); - if (is_obj_flag_status_active(test, VISIBLE) != 0) { - draw_crabs(test, arg0); - } - } -} - void func_800555BC(s32 objectIndex, s32 cameraId) { Camera* camera; @@ -4212,14 +4087,14 @@ void render_object_hedgehogs(s32 arg0) { something = MIN(something, 0x52211U - 1); } if (is_obj_flag_status_active(test, VISIBLE) != 0) { - set_object_flag_status_true(test, 0x00200000); + set_object_flag(test, 0x00200000); if (something < 0x2711U) { - set_object_flag_status_true(test, 0x00000020); + set_object_flag(test, 0x00000020); } else { - set_object_flag_status_false(test, 0x00000020); + clear_object_flag(test, 0x00000020); } if (something < 0x57E41U) { - set_object_flag_status_true(test, 0x00400000); + set_object_flag(test, 0x00400000); } if (something < 0x52211U) { func_800555BC(test, arg0); @@ -4382,7 +4257,7 @@ void render_object_hot_air_balloon(s32 arg0) { func_80055CCC(objectIndex, arg0); } } else { - set_object_flag_status_false(objectIndex, 0x00100000); + clear_object_flag(objectIndex, 0x00100000); func_80055CCC(objectIndex, arg0); } } @@ -4682,7 +4557,7 @@ void render_bomb_karts(s32 cameraId) { } else if (gGamestate != 5) { gBombKarts[i].unk_4A = 1; } - set_object_flag_status_false(objectIndex, 0x00200000); + clear_object_flag(objectIndex, 0x00200000); } } @@ -4697,7 +4572,7 @@ void render_bomb_karts(s32 cameraId) { gObjectList[objectIndex].pos[2] = var_s1_2->bombPos[2]; temp_s4 = func_8008A364(objectIndex, cameraId, 0x31C4U, 0x000001F4); if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { - set_object_flag_status_true(objectIndex, 0x00200000); + set_object_flag(objectIndex, 0x00200000); D_80183E80[0] = 0; D_80183E80[1] = func_800418AC(var_s1_2->bombPos[0], var_s1_2->bombPos[2], camera->pos); D_80183E80[2] = 0x8000; diff --git a/src/render_objects.h b/src/render_objects.h index 9a6ffd1e9..b77d7ce18 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -372,7 +372,6 @@ void func_80055164(s32); void func_80055228(s32); void func_800552BC(s32); void render_object_seagulls(s32); -void draw_crabs(s32, s32); void render_object_crabs(s32); void func_800555BC(s32, s32); void render_object_hedgehogs(s32); diff --git a/src/update_objects.c b/src/update_objects.c index f06012939..e441e2392 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -201,7 +201,7 @@ void func_80072120(s32* arg0, s32 arg1) { s32 i; for (i = 0; i < arg1; i++) { - set_object_flag_status_false(*arg0, 0x00600000); + clear_object_flag(*arg0, 0x00600000); arg0++; } } @@ -215,11 +215,11 @@ void func_80072180(void) { } } -void set_object_flag_status_true(s32 objectIndex, s32 flag) { +void set_object_flag(s32 objectIndex, s32 flag) { gObjectList[objectIndex].status |= flag; } -void set_object_flag_status_false(s32 objectIndex, s32 flag) { +void clear_object_flag(s32 objectIndex, s32 flag) { gObjectList[objectIndex].status &= ~flag; } @@ -302,7 +302,7 @@ void func_80072428(s32 objectIndex) { void object_next_state(s32 objectIndex) { set_object_timer_state(objectIndex, 0); - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x2000); gObjectList[objectIndex].state++; } @@ -322,8 +322,8 @@ s16 func_80072530(s32 objectIndex) { void func_80072568(s32 objectIndex, s32 arg1) { set_object_timer_state(objectIndex, 0); - set_object_flag_status_false(objectIndex, 0x2000); - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 0x2000); + clear_object_flag(objectIndex, 8); object_next_state(objectIndex); func_800724F8(objectIndex, gObjectList[objectIndex].state); gObjectList[objectIndex].state = arg1; @@ -331,8 +331,8 @@ void func_80072568(s32 objectIndex, s32 arg1) { void func_800725E8(s32 objectIndex, s32 arg1, s32 arg2) { set_object_timer_state(objectIndex, 0); - set_object_flag_status_false(objectIndex, 0x2000); - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 0x2000); + clear_object_flag(objectIndex, 8); gObjectList[objectIndex].state = arg2; func_800724F8(objectIndex, gObjectList[objectIndex].state); gObjectList[objectIndex].state = arg1; @@ -342,14 +342,14 @@ s16 func_80072530(s32); // extern void func_8007266C(s32 objectIndex) { set_object_timer_state(objectIndex, 0); - set_object_flag_status_false(objectIndex, 0x2000); - set_object_flag_status_false(objectIndex, 8); + clear_object_flag(objectIndex, 0x2000); + clear_object_flag(objectIndex, 8); gObjectList[objectIndex].state = func_80072530(objectIndex); } void func_800726CC(s32 objectIndex, s32 arg1) { set_object_timer_state(objectIndex, 0); - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x2000); gObjectList[objectIndex].state = arg1; } @@ -499,14 +499,14 @@ s32 func_80072B48(s32 objectIndex, s32 arg1) { phi_v1 = 0; if (gObjectList[objectIndex].isTimerActive == 0) { set_object_timer_state(objectIndex, 1); - set_object_flag_status_true(objectIndex, 0x80000); + set_object_flag(objectIndex, 0x80000); gObjectList[objectIndex].textureListIndex = D_8018D140; gObjectList[objectIndex].timer = arg1; } gObjectList[objectIndex].timer--; if (gObjectList[objectIndex].timer < 0) { - set_object_flag_status_false(objectIndex, 0x80000); + clear_object_flag(objectIndex, 0x80000); set_object_timer_state(objectIndex, 0); object_next_state(objectIndex); phi_v1 = 1; @@ -521,16 +521,16 @@ void func_80072C00(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3) { gObjectList[objectIndex].textureListIndex = arg1; gObjectList[objectIndex].unk_0D4 = 1; gObjectList[objectIndex].unk_0CC = arg3; - set_object_flag_status_true(objectIndex, 0x2000); + set_object_flag(objectIndex, 0x2000); } else { gObjectList[objectIndex].timer--; if (gObjectList[objectIndex].timer < 0) { gObjectList[objectIndex].timer = arg2; gObjectList[objectIndex].unk_0D4--; if ((gObjectList[objectIndex].unk_0D4 & 1) != 0) { - set_object_flag_status_false(objectIndex, 0x80000); + clear_object_flag(objectIndex, 0x80000); } else { - set_object_flag_status_true(objectIndex, 0x80000); + set_object_flag(objectIndex, 0x80000); } if (gObjectList[objectIndex].unk_0D4 < 0) { @@ -541,7 +541,7 @@ void func_80072C00(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3) { } if (gObjectList[objectIndex].unk_0CC == 0) { - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x2000); object_next_state(objectIndex); } } @@ -555,7 +555,7 @@ void func_80072D3C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { gObjectList[objectIndex].textureListIndex = arg1; gObjectList[objectIndex].unk_0D4 = 1; gObjectList[objectIndex].unk_0CC = arg4; - set_object_flag_status_true(objectIndex, 0x2000); + set_object_flag(objectIndex, 0x2000); return; } @@ -576,7 +576,7 @@ void func_80072D3C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { } if (gObjectList[objectIndex].unk_0CC == 0) { - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x2000); object_next_state(objectIndex); } } @@ -592,7 +592,7 @@ s32 func_80072E54(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 a gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; set_object_timer_state(objectIndex, 1); - set_object_flag_status_true(objectIndex, 0x2000); + set_object_flag(objectIndex, 0x2000); } else { gObjectList[objectIndex].timer--; if (gObjectList[objectIndex].timer <= 0) { @@ -605,7 +605,7 @@ s32 func_80072E54(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 a } if (gObjectList[objectIndex].unk_0CC == 0) { gObjectList[objectIndex].textureListIndex = arg2; - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x2000); set_object_timer_state(objectIndex, 0); object_next_state(objectIndex); sp24 = 1; @@ -627,7 +627,7 @@ bool func_80072F88(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; set_object_timer_state(objectIndex, 1); - set_object_flag_status_true(objectIndex, 0x2000); + set_object_flag(objectIndex, 0x2000); } else { gObjectList[objectIndex].timer--; if (gObjectList[objectIndex].timer <= 0) { @@ -639,7 +639,7 @@ bool func_80072F88(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 } if (gObjectList[objectIndex].unk_0CC == 0) { gObjectList[objectIndex].textureListIndex = arg2; - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x2000); set_object_timer_state(objectIndex, 0); object_next_state(objectIndex); sp24 = true; @@ -661,8 +661,8 @@ bool func_800730BC(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; set_object_timer_state(objectIndex, 1); - set_object_flag_status_true(objectIndex, 0x2000); - set_object_flag_status_false(objectIndex, 0x4000); + set_object_flag(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x4000); } else { gObjectList[objectIndex].timer--; if (gObjectList[objectIndex].timer <= 0) { @@ -671,7 +671,7 @@ bool func_800730BC(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 gObjectList[objectIndex].textureListIndex += arg3; if (gObjectList[objectIndex].textureListIndex >= arg2) { gObjectList[objectIndex].textureListIndex = arg2; - set_object_flag_status_true(objectIndex, 0x4000); + set_object_flag(objectIndex, 0x4000); } } else { gObjectList[objectIndex].textureListIndex -= arg3; @@ -682,14 +682,14 @@ bool func_800730BC(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 } if (gObjectList[objectIndex].unk_0CC == 0) { - set_object_flag_status_false(objectIndex, 0x80); - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x80); + clear_object_flag(objectIndex, 0x2000); set_object_timer_state(objectIndex, 0); object_next_state(objectIndex); sp24 = true; } else { - set_object_flag_status_false(objectIndex, 0x4000); - set_object_flag_status_true(objectIndex, 0x80); + clear_object_flag(objectIndex, 0x4000); + set_object_flag(objectIndex, 0x80); } } } @@ -707,8 +707,8 @@ s32 func_8007326C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 a gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; set_object_timer_state(objectIndex, 1); - set_object_flag_status_true(objectIndex, 0x2000); - set_object_flag_status_false(objectIndex, 0x4000); + set_object_flag(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x4000); } else { gObjectList[objectIndex].timer--; if (gObjectList[objectIndex].timer <= 0) { @@ -717,7 +717,7 @@ s32 func_8007326C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 a gObjectList[objectIndex].textureListIndex -= arg3; if (arg2 >= gObjectList[objectIndex].textureListIndex) { gObjectList[objectIndex].textureListIndex = arg2; - set_object_flag_status_true(objectIndex, 0x4000); + set_object_flag(objectIndex, 0x4000); } } else { gObjectList[objectIndex].textureListIndex += arg3; @@ -727,12 +727,12 @@ s32 func_8007326C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 a gObjectList[objectIndex].unk_0CC--; } if (gObjectList[objectIndex].unk_0CC == 0) { - set_object_flag_status_false(objectIndex, 0x2000); + clear_object_flag(objectIndex, 0x2000); set_object_timer_state(objectIndex, 0); object_next_state(objectIndex); sp24 = 1; } else { - set_object_flag_status_false(objectIndex, 0x4000); + clear_object_flag(objectIndex, 0x4000); } } } @@ -811,26 +811,26 @@ void func_80073600(s32 objectIndex) { set_object_timer_state(objectIndex, 0); gObjectList[objectIndex].unk_0D6 = 0; gObjectList[objectIndex].unk_04C = -1; - set_object_flag_status_false(objectIndex, 0x8000); + clear_object_flag(objectIndex, 0x8000); } void func_80073654(s32 objectIndex) { - set_object_flag_status_false(objectIndex, 0x8000); + clear_object_flag(objectIndex, 0x8000); ++gObjectList[objectIndex].unk_0D6; } UNUSED void func_8007369C(s32 objectIndex, s32 arg1) { - set_object_flag_status_false(objectIndex, 0x8000); + clear_object_flag(objectIndex, 0x8000); gObjectList[objectIndex].unk_0D6 = arg1; } void func_800736E0(s32 objectIndex) { - set_object_flag_status_false(objectIndex, 0x8000); + clear_object_flag(objectIndex, 0x8000); gObjectList[objectIndex].unk_0D6 = 1; } void func_80073720(s32 objectIndex) { - set_object_flag_status_false(objectIndex, 0x8000); + clear_object_flag(objectIndex, 0x8000); gObjectList[objectIndex].unk_0D6 = 0; } @@ -840,11 +840,11 @@ bool func_8007375C(s32 objectIndex, s32 arg1) { sp24 = false; if (is_obj_index_flag_status_inactive(objectIndex, 0x00008000) != 0) { gObjectList[objectIndex].unk_04C = arg1; - set_object_flag_status_true(objectIndex, 0x00008000); + set_object_flag(objectIndex, 0x00008000); } gObjectList[objectIndex].unk_04C--; if (gObjectList[objectIndex].unk_04C < 0) { - set_object_flag_status_false(objectIndex, 0x00008000); + clear_object_flag(objectIndex, 0x00008000); func_80073654(objectIndex); sp24 = true; } @@ -2513,7 +2513,7 @@ void func_80077E20(s32 objectIndex) { object->textureHeight = 0x10; object->textureWidth = object->textureHeight; object->sizeScaling = 0.15f; - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); func_80086EF0(objectIndex); object->primAlpha = 0x00FF; object->unk_0D5 = 0; @@ -2527,10 +2527,10 @@ void func_80077EB8(s32 objectIndex, u16 arg1, Camera* camera) { temp_v0 = camera->rot[1] - arg1; if ((temp_v0 >= D_8018D210) || (D_8018D208 >= temp_v0)) { gObjectList[objectIndex].offset[0] = D_8018D218 + (D_8018D1E8 * (f32) temp_v0); - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); return; } - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); } void func_80077F64(s32 objectIndex, Camera* camera) { @@ -2727,15 +2727,15 @@ void func_800788F8(s32 objectIndex, u16 rot, Camera* camera) { temp_v0 = camera->rot[1] + rot; if ((temp_v0 >= D_8018D210) && (D_8018D208 >= temp_v0)) { gObjectList[objectIndex].unk_09C = (D_8018D218 + (D_8018D1E8 * temp_v0)); - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); return; } if (CVarGetInteger("gNoCulling", 0) == 1) { gObjectList[objectIndex].unk_09C = (D_8018D218 + (D_8018D1E8 * temp_v0)); - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); return; } - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); } void update_clouds(s32 arg0, Camera* arg1, CloudData* cloudList) { @@ -2979,7 +2979,7 @@ void init_obj_lakitu_red_flag_countdown(s32 objectIndex, s32 playerId) { Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_lakitu); gObjectList[objectIndex].vertex = vtx; gObjectList[objectIndex].sizeScaling = 0.15f; - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); object_next_state(objectIndex); gObjectList[objectIndex].unk_048 = D_8018D180; } @@ -2999,7 +2999,7 @@ void update_object_lakitu_countdown(s32 objectIndex, s32 arg1) { } break; case 3: - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); func_80086F10(objectIndex, 1, &D_800E67B8); // set a spline object_next_state(objectIndex); break; @@ -3094,7 +3094,7 @@ void init_obj_lakitu_red_flag(s32 objectIndex, s32 playerIndex) { object->pos[0] = 5000.0f; object->sizeScaling = 0.15f; func_80086F10(objectIndex, 2, &D_800E6834); - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); object_next_state(objectIndex); } @@ -3106,7 +3106,7 @@ void update_object_lakitu_red_flag(s32 objectIndex, s32 playerIndex) { init_obj_lakitu_red_flag(objectIndex, playerIndex); break; case 2: - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); object_next_state(objectIndex); break; case 3: @@ -3169,7 +3169,7 @@ void init_obj_lakitu_red_flag_fishing(s32 objectIndex, s32 arg1) { gObjectList[objectIndex].vertex = vtx; gObjectList[objectIndex].sizeScaling = 0.15f; func_80086E70(objectIndex); - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); func_80073720(objectIndex); object_next_state(objectIndex); func_800C8F80((u8) arg1, 0x0100FA28); @@ -3211,7 +3211,7 @@ void update_object_lakitu_fishing(s32 objectIndex, s32 playerId) { init_obj_lakitu_red_flag_fishing(objectIndex, playerId); break; case 2: /* switch 1 */ - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); func_800736E0(objectIndex); object_next_state(objectIndex); break; @@ -3265,7 +3265,7 @@ void update_object_lakitu_fishing2(s32 objectIndex, s32 playerId) { init_obj_lakitu_red_flag_fishing(objectIndex, playerId); break; case 2: /* switch 1 */ - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); func_800736E0(objectIndex); player->unk_0CA |= 0x80; object_next_state(objectIndex); @@ -3356,7 +3356,7 @@ void func_8007A060(s32 objectIndex, s32 playerIndex) { object->pos[1] = 5000.0f; object->pos[0] = 5000.0f; object->sizeScaling = 0.15f; - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); func_80086F10(objectIndex, 5, &D_800E694C); object_next_state(objectIndex); } @@ -3369,7 +3369,7 @@ void update_object_lakitu_second_lap(s32 objectIndex, s32 playerIndex) { func_8007A060(objectIndex, playerIndex); break; case 2: - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); object_next_state(objectIndex); break; case 3: @@ -3415,7 +3415,7 @@ void func_8007A228(s32 objectIndex, s32 playerIndex) { object->pos[1] = 5000.0f; object->pos[0] = 5000.0f; object->sizeScaling = 0.15f; - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); func_80086F10(objectIndex, 5, &D_800E694C); object_next_state(objectIndex); } @@ -3428,7 +3428,7 @@ void update_object_lakitu_final_lap(s32 objectIndex, s32 playerIndex) { func_8007A228(objectIndex, playerIndex); break; case 2: - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); object_next_state(objectIndex); break; case 3: @@ -3472,7 +3472,7 @@ void func_8007A3F0(s32 objectIndex, s32 arg1) { gObjectList[objectIndex].pos[1] = var; gObjectList[objectIndex].pos[0] = var; gObjectList[objectIndex].sizeScaling = 0.15f; - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); func_80086F10(objectIndex, 6, &D_800E69B0); gObjectList[objectIndex].unk_0D6 = 0; object_next_state(objectIndex); @@ -3489,7 +3489,7 @@ void update_object_lakitu_reverse(s32 objectIndex, s32 playerId) { func_8007A3F0(objectIndex, playerId); break; case 2: - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); gObjectList[objectIndex].unk_0D6 = 1; object_next_state(objectIndex); break; @@ -4504,7 +4504,7 @@ void func_8007BBBC(s32 objectIndex) { switch (object->state) { /* irregular */ case 1: func_800735BC(objectIndex, d_course_banshee_boardwalk_dl_cheep_cheep, 2.0f); - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); object->unk_0D5 = 0; break; case 2: @@ -4576,7 +4576,7 @@ void func_8007BEC8(s32 objectIndex) { break; case 2: if (set_and_run_timer_object(objectIndex, 0x0000003C) != 0) { - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); func_80086E70(objectIndex); } break; @@ -4656,7 +4656,7 @@ void func_8007BFB0(s32 objectIndex) { case 7: object->sizeScaling = (f32) ((f64) object->sizeScaling - 0.05); if ((f64) object->sizeScaling <= 0.01) { - set_object_flag_status_false(objectIndex, 0x00000010); + clear_object_flag(objectIndex, 0x00000010); object->sizeScaling = 0.000001f; func_80086FD4(objectIndex); } @@ -4707,10 +4707,10 @@ void func_8007C360(s32 objectIndex, Camera* camera) { u16 temp = ((u16) (gObjectList[objectIndex].direction_angle[1] - rot + 0x8000) * 0x24) / 0x10000; if (temp < 0x13) { - set_object_flag_status_false(objectIndex, 0x80); + clear_object_flag(objectIndex, 0x80); gObjectList[objectIndex].textureListIndex = temp; } else { - set_object_flag_status_true(objectIndex, 0x80); + set_object_flag(objectIndex, 0x80); gObjectList[objectIndex].textureListIndex = 0x24 - temp; } } @@ -4735,10 +4735,10 @@ void func_8007C4A4(s32 objectIndex) { var_t9 = gObjectList[objectIndex].direction_angle[1] * 0x24 / 0x10000; if (var_t9 < 0x13) { - set_object_flag_status_false(objectIndex, 0x80); + clear_object_flag(objectIndex, 0x80); gObjectList[objectIndex].textureListIndex = var_t9; } else { - set_object_flag_status_true(objectIndex, 0x80); + set_object_flag(objectIndex, 0x80); gObjectList[objectIndex].textureListIndex = 0x24 - var_t9; } } @@ -4758,7 +4758,7 @@ void func_8007C5B4(s32 objectIndex) { object->pos[0] = 0.0f; object->pos[1] = 0.0f; object->pos[2] = 0.0f; - set_object_flag_status_true(objectIndex, 0x00000020); + set_object_flag(objectIndex, 0x00000020); object_next_state(objectIndex); object->primAlpha = 0; func_80073844(objectIndex); @@ -4766,7 +4766,7 @@ void func_8007C5B4(s32 objectIndex) { object->unk_034 = 1.0f; func_80073FD4(objectIndex); func_80086EF0(objectIndex); - set_object_flag_status_true(objectIndex, 0x00000800); + set_object_flag(objectIndex, 0x00000800); object->orientation[0] = 0; object->orientation[2] = 0x8000; } @@ -5114,7 +5114,7 @@ void func_8007D6A8(s32 objectIndex, s32 arg1) { object->unk_0D5 = 0x0D; func_8007D360(objectIndex, arg1); object->sizeScaling = 0.1f; - set_object_flag_status_true(objectIndex, 0x00000200); + set_object_flag(objectIndex, 0x00000200); object->boundingBoxSize = 3; } @@ -5542,521 +5542,33 @@ void func_8008153C(s32 objectIndex) { } } -void func_80081790(s32 objectIndex) { - switch (gObjectList[objectIndex].state) { - case 0: - break; /* irregular */ - case 1: - if (func_80087E08(objectIndex, gObjectList[objectIndex].velocity[1], 0.3f, gObjectList[objectIndex].unk_034, - gObjectList[objectIndex].orientation[1], 0x00000032) != 0) { - object_next_state(objectIndex); - } - object_calculate_new_pos_offset(objectIndex); - break; - case 2: - func_80072428(objectIndex); - func_80086F60(objectIndex); - break; - } -} -void func_80081848(s32 objectIndex) { - u8* mole = (u8*) LOAD_ASSET(d_course_moo_moo_farm_mole_frames); - u8* tlut = (u8*) LOAD_ASSET(d_course_moo_moo_farm_mole_tlut); - init_texture_object(objectIndex, d_course_moo_moo_farm_mole_tlut, (u8*) mole, 0x20U, (u16) 0x00000040); - gObjectList[objectIndex].sizeScaling = 0.15f; - gObjectList[objectIndex].textureListIndex = 0; - set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); - set_obj_direction_angle(objectIndex, 0U, 0U, 0U); - set_obj_orientation(objectIndex, 0U, 0U, 0x8000U); - gObjectList[objectIndex].boundingBoxSize = 6; - gObjectList[objectIndex].velocity[1] = 4.0f; - set_object_flag_status_true(objectIndex, 0x04000000); - object_next_state(objectIndex); -} -void func_80081924(s32 objectIndex) { - switch (gObjectList[objectIndex].unk_0AE) { - case 1: - if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], 9.0f, 0.7f) != 0) { - func_80086FD4(objectIndex); - } - break; - case 2: - func_800871AC(objectIndex, 0x0000000A); - break; - case 3: - if (f32_step_down_towards(&gObjectList[objectIndex].offset[1], 3.0f, 1.0f) != 0) { - func_80086F60(objectIndex); - } - break; - case 4: - func_80087D24(objectIndex, 3.6f, 0.25f, 0.0f); - break; - case 5: - func_80086F60(objectIndex); - break; - case 10: - gObjectList[objectIndex].orientation[2] += 0x1000; - gObjectList[objectIndex].velocity[1] -= 0.184; - func_8008751C(objectIndex); - object_add_velocity_offset_xyz(objectIndex); - if (gObjectList[objectIndex].pos[1] <= -10.0) { - func_80086F60(objectIndex); - } - break; - case 0: - default: - break; - } -} -void func_80081A88(s32 objectIndex) { - switch (gObjectList[objectIndex].unk_0DD) { /* irregular */ - case 0: - break; - case 1: - func_8008B724(objectIndex); - break; - case 2: - func_80081924(objectIndex); - break; - } - object_calculate_new_pos_offset(objectIndex); -} -void func_80081AFC(s32 objectIndex, s32 arg1) { - s8* sp2C; - Object* object; - object = &gObjectList[objectIndex]; - switch (object->state) { /* irregular */ - case 0x1: - func_80081848(objectIndex); - break; - case 0x2: - if (object->unk_04C == 0) { - func_80086EAC(objectIndex, 2, 1); - object_next_state(objectIndex); - set_object_flag_status_true(objectIndex, 0x00000200); - } else { - object->unk_04C--; - } - break; - case 0x3: - if (object->unk_0AE == 0) { - func_80086EAC(objectIndex, 2, 4); - func_8008153C(objectIndex); - object_next_state(objectIndex); - func_800C98B8(object->pos, object->velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x07)); - } - break; - case 0x4: - if (func_80072E54(objectIndex, 1, 6, 1, 2, 0) != 0) { - func_800726CC(objectIndex, 0x00000064); - } - break; - case 0xA: - func_80072E54(objectIndex, 1, 6, 1, 0, -1); - if (object->unk_0AE == 0) { - func_800726CC(objectIndex, 0x00000064); - } - break; - case 0x64: - if (object->unk_0AE == 0) { - set_object_flag_status_false(objectIndex, 0x00000200); - func_80072428(objectIndex); - switch (arg1) { /* switch 1; irregular */ - case 1: /* switch 1 */ - sp2C = D_8018D198; - break; - case 2: /* switch 1 */ - sp2C = D_8018D1A8; - break; - case 3: /* switch 1 */ - sp2C = D_8018D1B8; - break; - } - sp2C[object->type] = 0; - } - break; - case 0: - default: - break; - } - if (object->state >= 2) { - func_80073514(objectIndex); - } -} -void func_80081D34(s32 objectIndex) { - Player* player; - Camera* var_s4; - s32 var_s2; - s32 var_s5; - Object* object; - var_s5 = 0; - player = gPlayerOne; - var_s4 = camera1; - for (var_s2 = 0; var_s2 < D_8018D158; var_s2++, player++, var_s4++) { - if ((is_obj_flag_status_active(objectIndex, 0x00000200) != 0) && !(player->effects & 0x80000000) && - (has_collided_with_player(objectIndex, player) != 0)) { - if ((player->type & 0x8000) && !(player->type & 0x100)) { - var_s5 = 1; - object = &gObjectList[objectIndex]; - if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { - func_80072180(); - } - if (player->effects & 0x200) { - func_800C9060(var_s2, 0x1900A046U); - } else { - player->soundEffects |= 2; - } - object->direction_angle[1] = var_s4->rot[1]; - object->velocity[1] = (player->unk_094 / 2) + 3.0; - object->unk_034 = player->unk_094 + 1.0; - if (object->velocity[1] >= 5.0) { - object->velocity[1] = 5.0f; - } - if (object->unk_034 >= 4.0) { - object->velocity[1] = 4.0f; - } - } - } - } - if (var_s5 != 0) { - object = &gObjectList[objectIndex]; - set_object_flag_status_false(objectIndex, 0x00000200); - func_80086F60(objectIndex); - set_obj_origin_pos(objectIndex, object->pos[0], object->pos[1], object->pos[2]); - set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); - func_80086EAC(objectIndex, 2, 0x000A); - func_800726CC(objectIndex, 0x0000000A); - } -} -void func_80081FF4(s32 objectIndex, s32 arg1) { - UNUSED s32 stackPadding0; - UNUSED s32 stackPadding1; - s32 moleCount; - s16 var_v1; - s16 offset; - s32 var_a0; - s8* var_a2; - init_object(objectIndex, 0); - gObjectList[objectIndex].unk_04C = random_int(0x001EU) + 5; - switch (arg1) { /* irregular */ - case 1: - var_a2 = D_8018D198; - moleCount = NUM_GROUP1_MOLES; - offset = 0; - break; - case 2: - var_a2 = D_8018D1A8; - moleCount = NUM_GROUP2_MOLES; - offset = 24; - // offset = NUM_GROUP1_MOLES; - break; - case 3: - var_a2 = D_8018D1B8; - moleCount = NUM_GROUP3_MOLES; - offset = 57; - // offset = NUM_GROUP1_MOLES + NUM_GROUP2_MOLES; - break; - } - var_v1 = random_int(moleCount); - for (var_a0 = 0; var_a0 < moleCount; var_a0++) { - if (var_a2[var_v1] != 0) { - var_v1++; - if (var_v1 == moleCount) { - var_v1 = 0; - } - } else { - var_a2[var_v1] = 1; - gObjectList[objectIndex].type = var_v1; - break; - } - } - /* - Ideally `gMoleSpawns` wouldn't be a union at all and its just be a list of Vec3s - Even more ideally each mole group would have its own array for its spawns - gObjectList[objectIndex].origin_pos[0] = gMoleSpawns.asVec3sList[offset + var_v1][0] * xOrientation; - gObjectList[objectIndex].origin_pos[1] = gMoleSpawns.asVec3sList[offset + var_v1][1] - 9.0; - gObjectList[objectIndex].origin_pos[2] = gMoleSpawns.asVec3sList[offset + var_v1][2]; - */ - gObjectList[objectIndex].origin_pos[0] = gMoleSpawns.asFlatList[offset + (var_v1 * 3) + 0] * xOrientation; - gObjectList[objectIndex].origin_pos[1] = gMoleSpawns.asFlatList[offset + (var_v1 * 3) + 1] - 9.0; - gObjectList[objectIndex].origin_pos[2] = gMoleSpawns.asFlatList[offset + (var_v1 * 3) + 2]; -} -void func_800821AC(s32 objectIndex, s32 arg1) { - if (gObjectList[objectIndex].state != 0) { - func_80081AFC(objectIndex, arg1); - func_80081A88(objectIndex); - func_80081D34(objectIndex); - } -} -void update_moles(void) { - s32 var_s1; - s32 objectIndex; - UNUSED s32 stackPadding; - for (var_s1 = 0; var_s1 < D_8018D1C8; var_s1++) { - objectIndex = indexObjectList1[var_s1]; - if (gObjectList[objectIndex].state == 0) { - if (func_8008A8B0(8, 9) != 0) { - func_80081FF4(objectIndex, 1); - } - } else { - func_800821AC(objectIndex, 1); - } - } - for (var_s1 = 0; var_s1 < D_8018D1D0; var_s1++) { - objectIndex = indexObjectList2[var_s1]; - if (gObjectList[objectIndex].state == 0) { - if (func_8008A8B0(0x0010, 0x0013) != 0) { - func_80081FF4(objectIndex, 2); - } - } else { - func_800821AC(objectIndex, 2); - } - } - for (var_s1 = 0; var_s1 < D_8018D1D8; var_s1++) { - objectIndex = indexObjectList3[var_s1]; - if (gObjectList[objectIndex].state == 0) { - if (func_8008A8B0(0x0011, 0x0014) != 0) { - func_80081FF4(objectIndex, 3); - } - } else { - func_800821AC(objectIndex, 3); - } - } - for (var_s1 = 0; var_s1 < gObjectParticle2_SIZE; var_s1++) { - objectIndex = gObjectParticle2[var_s1]; - if (gObjectList[objectIndex].state != 0) { - func_80081790(objectIndex); - } - } -} -void func_8008241C(s32 objectIndex, s32 arg1) { - UNUSED s16 stackPadding0; - s16 temp_f4; - s16 sp22; - s16 sp20; - gObjectList[objectIndex].unk_0D8 = 1; - gObjectList[objectIndex].model = (Gfx*) d_course_koopa_troopa_beach_unk4; - gObjectList[objectIndex].vertex = (Vtx*) d_course_koopa_troopa_beach_unk_data5; - gObjectList[objectIndex].sizeScaling = 0.2f; - gObjectList[objectIndex].unk_0DD = 1; - sp22 = random_int(0x00C8) + -100.0; - sp20 = random_int(0x0014); - temp_f4 = random_int(0x00C8) + -100.0; - if (gGamestate == 9) { - set_obj_origin_pos(objectIndex, sp22 + -360.0, sp20 + 60.0, temp_f4 + -1300.0); - } else if (gObjectList[objectIndex].unk_0D5 != 0) { - set_obj_origin_pos(objectIndex, (sp22 + 328.0) * xOrientation, sp20 + 20.0, temp_f4 + 2541.0); - } else { - set_obj_origin_pos(objectIndex, (sp22 + -985.0) * xOrientation, sp20 + 15.0, temp_f4 + 1200.0); - } - set_obj_direction_angle(objectIndex, 0U, 0U, 0U); - gObjectList[objectIndex].unk_034 = 1.0f; - func_80086EF0(objectIndex); - gObjectList[objectIndex].spline = D_800E633C[arg1 % 4]; - set_object_flag_status_true(objectIndex, 0x00000800); - object_next_state(objectIndex); -} -void func_80082714(s32 objectIndex, s32 arg1) { - switch (gObjectList[objectIndex].state) { - case 1: - func_8008241C(objectIndex, arg1); - break; - case 0: - default: - break; - } -} -void func_8008275C(s32 objectIndex) { - UNUSED s32 stackPadding; - switch (gObjectList[objectIndex].unk_0DD) { /* irregular */ - case 1: - func_8008B78C(objectIndex); - object_calculate_new_pos_offset(objectIndex); - break; - case 2: - func_8008B78C(objectIndex); - vec3f_copy(gObjectList[objectIndex].unk_01C, gObjectList[objectIndex].pos); - func_8000D940(gObjectList[objectIndex].origin_pos, (s16*) &gObjectList[objectIndex].unk_0C6, - gObjectList[objectIndex].unk_034, 0.0f, 0); - gObjectList[objectIndex].offset[0] *= 2.0; - gObjectList[objectIndex].offset[1] *= 2.5; - gObjectList[objectIndex].offset[2] *= 2.0; - object_calculate_new_pos_offset(objectIndex); - gObjectList[objectIndex].direction_angle[1] = - get_angle_between_two_vectors(gObjectList[objectIndex].unk_01C, gObjectList[objectIndex].pos); - break; - } - func_800873F4(objectIndex); -} -void update_seagulls(void) { - Object* object; - UNUSED s32* var_s4; - s32 temp_s0; - s32 var_s3; - for (var_s3 = 0; var_s3 < NUM_SEAGULLS; var_s3++) { - temp_s0 = indexObjectList2[var_s3]; - object = &gObjectList[temp_s0]; - if (object->state == 0) { - continue; - } - func_80082714(temp_s0, var_s3); - func_8008275C(temp_s0); - if (func_80072320(temp_s0, 2) != 0) { - func_800722CC(temp_s0, 2); - if (D_80165A90 != 0) { - D_80165A90 = 0; - D_80183E40[0] = 0.0f; - D_80183E40[1] = 0.0f; - D_80183E40[2] = 0.0f; - if (gGamestate != CREDITS_SEQUENCE) { - func_800C98B8(object->pos, D_80183E40, SOUND_ARG_LOAD(0x19, 0x01, 0x70, 0x43)); - } else { - temp_s0 = indexObjectList2[1]; - if (gCutsceneShotTimer < 0x97) { - object = &gObjectList[temp_s0]; - func_800C98B8(object->pos, D_80183E40, SOUND_ARG_LOAD(0x19, 0x01, 0x70, 0x43)); - } - } - } - } - } - if (D_80165900 != 0) { - D_80165900 -= 1; - } else { - if (gGamestate != 9) { - D_80165900 = 0x003C; - } else { - D_80165900 = 0x000F; - } - if ((D_80165908 != 0) && (D_80165A90 == 0)) { - D_80165A90 = 1; - } - } - D_80165908 = 0; -} -void init_ktb_crab(s32 objectIndex) { - Object* object; - init_texture_object(objectIndex, d_course_koopa_troopa_beach_crab_tlut, - (u8*) d_course_koopa_troopa_beach_crab_frames, 64, (u16) 64); - object = &gObjectList[objectIndex]; - object->sizeScaling = 0.15f; - object->textureListIndex = 0; - object_next_state(objectIndex); - object->boundingBoxSize = 1; - set_object_flag_status_true(objectIndex, 0x04000420); - func_80086EAC(objectIndex, 0, 1); - set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); - set_obj_orientation(objectIndex, 0U, 0U, 0x8000U); - object->unk_034 = 1.5f; - set_object_flag_status_true(objectIndex, 0x00000200); -} -void func_80082B34(s32 objectIndex, UNUSED s32 unused) { - switch (gObjectList[objectIndex].state) { /* irregular */ - case 0: - break; - case 1: - init_ktb_crab(objectIndex); - break; - case 2: - func_80072E54(objectIndex, 0, 3, 1, 2, -1); - break; - case 3: - func_80072E54(objectIndex, 4, 6, 1, 2, -1); - break; - } - if (gObjectList[objectIndex].state >= 2) { - func_80073514(objectIndex); - } -} -void func_80082C30(s32 objectIndex) { - switch (gObjectList[objectIndex].unk_0AE) { - case 1: - if (func_80087A0C(objectIndex, gObjectList[objectIndex].origin_pos[0], gObjectList[objectIndex].unk_01C[0], - gObjectList[objectIndex].origin_pos[2], gObjectList[objectIndex].unk_01C[2]) != 0) { - func_800726CC(objectIndex, 3); - func_80086FD4(objectIndex); - } - break; - case 2: - if (func_80087104(objectIndex, 0x003CU) != 0) { - gObjectList[objectIndex].unk_034 = 0.8f; - func_800726CC(objectIndex, 2); - func_80086FD4(objectIndex); - } - break; - case 3: - if (func_80087954(objectIndex, 0x0000003C) != 0) { - func_80086FD4(objectIndex); - func_800726CC(objectIndex, 3); - } - break; - case 4: - if (func_80087104(objectIndex, 0x003CU) != 0) { - func_800726CC(objectIndex, 2); - func_80086FD4(objectIndex); - } - break; - case 5: - if (func_8008789C(objectIndex, 0x0000003C) != 0) { - func_800726CC(objectIndex, 3); - func_8008701C(objectIndex, 2); - } - break; - } - object_calculate_new_pos_offset(objectIndex); - if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { - func_80088538(objectIndex); - gObjectList[objectIndex].pos[1] = (f32) (gObjectList[objectIndex].surfaceHeight + 2.5); - } -} - -void func_80082E18(s32 objectIndex) { - if (gObjectList[objectIndex].state >= 2) { - func_80089F24(objectIndex); - } -} - -void update_crabs(void) { - s32 objectIndex; - s32 var_s1; - - for (var_s1 = 0; var_s1 < NUM_CRABS; var_s1++) { - objectIndex = indexObjectList1[var_s1]; - if (gObjectList[objectIndex].state != 0) { - func_80082B34(objectIndex, var_s1); - func_8008A6DC(objectIndex, 500.0f); - func_80082C30(objectIndex); - func_80082E18(objectIndex); - } - } -} #ifdef NON_MATCHING // https://decomp.me/scratch/PYAg4 @@ -6124,7 +5636,7 @@ void func_8008311C(s32 objectIndex, s32 arg1) { set_obj_orientation(objectIndex, 0U, 0U, 0x8000U); object->unk_034 = ((arg1 % 6) * 0.1) + 0.5; func_80086E70(objectIndex); - set_object_flag_status_true(objectIndex, 0x04000600); + set_object_flag(objectIndex, 0x04000600); object->boundingBoxSize = 2; } @@ -6274,7 +5786,7 @@ void func_80083868(s32 objectIndex) { object->primAlpha = random_int(0x2000U) - 0x1000; func_80086E70(objectIndex); object->unk_034 = 1.5f; - set_object_flag_status_true(objectIndex, 0x00000200); + set_object_flag(objectIndex, 0x00000200); } void func_80083948(s32 objectIndex) { @@ -6338,7 +5850,7 @@ void func_80083B0C(s32 objectIndex) { gObjectList[objectIndex].orientation[2] = 0x8000; gObjectList[objectIndex].boundingBoxSize = 2; gObjectList[objectIndex].unk_034 = 1.5f; - set_object_flag_status_true(objectIndex, 0x04000210); + set_object_flag(objectIndex, 0x04000210); } void func_80083BE4(s32 objectIndex) { @@ -6365,7 +5877,7 @@ void func_80083C04(s32 objectIndex) { break; case 11: if (set_and_run_timer_object(objectIndex, 0x0000000A) != 0) { - set_object_flag_status_true(objectIndex, 0x00000010); + set_object_flag(objectIndex, 0x00000010); object->sizeScaling = 0.001f; } break; @@ -6376,7 +5888,7 @@ void func_80083C04(s32 objectIndex) { break; case 13: func_800726CC(objectIndex, 2); - set_object_flag_status_false(objectIndex, 0x00001000); + clear_object_flag(objectIndex, 0x00001000); break; } if (object->state >= 2) { @@ -6418,8 +5930,8 @@ void update_snowmen(void) { if (is_obj_index_flag_status_inactive(var_s4, 0x00001000) != 0) { object = &gObjectList[var_s4]; if ((func_8008A8B0(object->unk_0D5 - 1, object->unk_0D5 + 1) != 0) && (func_80089B50(var_s4) != 0)) { - set_object_flag_status_true(var_s4, 0x00001000); - set_object_flag_status_false(var_s4, 0x00000010); + set_object_flag(var_s4, 0x00001000); + clear_object_flag(var_s4, 0x00000010); func_800726CC(var_s4, 0x0000000A); func_8008701C(var_s3, 0x0000000A); func_800836F0(object->pos); @@ -6618,7 +6130,7 @@ void func_80085878(s32 objectIndex, s32 arg1) { object->vertex = (Vtx*) d_rainbow_road_unk3; object->sizeScaling = 0.03f; object->boundingBoxSize = 0x000A; - set_object_flag_status_true(objectIndex, 0x04000200); + set_object_flag(objectIndex, 0x04000200); object->unk_084[8] = (arg1 * 0x12C) + 0x1F4; set_obj_origin_pos(objectIndex, 0.0f, -15.0f, 0.0f); temp_v0 = &D_80164490[(u16) object->unk_084[8]]; diff --git a/src/update_objects.h b/src/update_objects.h index ddaa5b0c1..3e7d184b5 100644 --- a/src/update_objects.h +++ b/src/update_objects.h @@ -17,8 +17,8 @@ s32 add_unused_obj_index(s32*, s32*, s32); void delete_object_wrapper(s32*); void func_80072120(s32*, s32); void func_80072180(void); -void set_object_flag_status_true(s32, s32); -void set_object_flag_status_false(s32, s32); +void set_object_flag(s32, s32); +void clear_object_flag(s32, s32); void func_80072214(s32, s32); bool is_obj_flag_status_active(s32, s32); s32 is_obj_index_flag_status_inactive(s32, s32);