Reimplementing objects

This commit is contained in:
MegaMech
2024-12-11 20:58:18 -07:00
parent a4890f9dfc
commit 95b8cca500
51 changed files with 1306 additions and 935 deletions
+13 -12
View File
@@ -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:
+56 -56
View File
@@ -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);
}
-4
View File
@@ -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 },
-1
View File
@@ -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;
-20
View File
@@ -1,20 +0,0 @@
// #include <libultraship.h>
// #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() { }
-24
View File
@@ -1,24 +0,0 @@
// #pragma once
// #include <libultraship.h>
// 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();
// };
+22 -15
View File
@@ -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 <memory>
//#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<OPenguin> World::AddPenguin(Vec3f pos, u16 direction, OPenguin::
return penguin;
}
std::shared_ptr<OSeagull> World::AddSeagull(Vec3f pos) {
auto seagull = std::make_shared<OSeagull>(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<GameObject> 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() {
+12 -7
View File
@@ -1,16 +1,17 @@
#pragma once
#include <libultraship.h>
//#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 <memory>
#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<GameObject> object);
GameObject* AddObject(GameObject* object);
CProperties* GetCourseProps();
void TickObjects();
@@ -129,7 +131,7 @@ public:
size_t CupIndex = 1;
std::vector<AActor*> Actors;
// std::vector<std::unique_ptr<GameObject>> GameObjects;
std::vector<GameObject*> Objects;
/** Actors */
void AddBoat(f32 speed, uint32_t waypoint);
@@ -151,6 +153,9 @@ public:
std::vector<std::shared_ptr<OPenguin>> Penguins;
std::shared_ptr<OPenguin> AddPenguin(Vec3f pos, u16 direction, OPenguin::PenguinType type, OPenguin::Behaviour behaviour);
std::vector<std::shared_ptr<OSeagull>> Seagulls;
std::shared_ptr<OSeagull> AddSeagull(Vec3f pos);
TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius);
std::vector<std::shared_ptr<TrainCrossing>> Crossings;
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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" {
+1 -1
View File
@@ -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" {
+1 -1
View File
@@ -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" {
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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" {
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+21 -13
View File
@@ -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);
}
}
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+33 -22
View File
@@ -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);
}
}
+3
View File
@@ -2,6 +2,7 @@
#include <libultraship.h>
#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
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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" {
+1 -1
View File
@@ -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" {
+2 -2
View File
@@ -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"
+1 -1
View File
@@ -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" {
+7 -2
View File
@@ -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
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
@@ -1,5 +1,5 @@
#include <libultraship.h>
#include "OBombKart.h"
#include "BombKart.h"
#include <vector>
#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;
+175
View File
@@ -0,0 +1,175 @@
#include <libultraship.h>
#include <libultra/gbi.h>
#include "Crab.h"
#include <vector>
#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);
}
}
+41
View File
@@ -0,0 +1,41 @@
#pragma once
#include <libultraship.h>
#include <vector>
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;
};
+20
View File
@@ -0,0 +1,20 @@
#include <libultraship.h>
#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() { }
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#include <libultraship.h>
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();
};
+422
View File
@@ -0,0 +1,422 @@
#include <libultraship.h>
#include <libultra/gbi.h>
#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);
}
+52
View File
@@ -0,0 +1,52 @@
#pragma once
#include <libultraship.h>
#include <vector>
#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;
};
@@ -1,6 +1,6 @@
#include <libultraship.h>
#include <libultra/gbi.h>
#include "OPenguin.h"
#include "Penguin.h"
#include <vector>
#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
@@ -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 {
+194
View File
@@ -0,0 +1,194 @@
#include <libultraship.h>
#include <libultra/gbi.h>
#include "Seagull.h"
#include "engine/Actor.h"
#include "ObjectReimpl.h"
#include <vector>
#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;
}
}
+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include <libultraship.h>
#include <vector>
#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;
};
@@ -1,6 +1,6 @@
#include <libultraship.h>
#include <libultra/gbi.h>
#include "OThwomp.h"
#include "Thwomp.h"
#include <vector>
#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;
+29 -1
View File
@@ -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) {
+7
View File
@@ -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();
+7 -132
View File
@@ -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;
-1
View File
@@ -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);
+79 -567
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -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);