summaryrefslogtreecommitdiff
path: root/src/update_objects.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/update_objects.c')
-rw-r--r--src/update_objects.c232
1 files changed, 3 insertions, 229 deletions
diff --git a/src/update_objects.c b/src/update_objects.c
index 75e1671de..a8bd556bd 100644
--- a/src/update_objects.c
+++ b/src/update_objects.c
@@ -45,6 +45,7 @@
#include <assets/textures/tracks/rainbow_road/rainbow_road_data.h>
#include "engine/RaceManager.h"
+#include "engine/sky/Sky.h"
float OTRGetAspectRatio(void);
@@ -2210,123 +2211,6 @@ void update_leaf(void) {
}
}
-void func_80077D5C(s32 arg0) {
- s32 objectIndex;
- s32 var_a1;
-
- if (D_8016559C == 0) {
- for (var_a1 = 0; var_a1 < D_8018D1F0; var_a1++) {
- D_8018D17C += 1;
- if (D_8018D17C >= D_8018D1F0) {
- D_8018D17C = 0;
- }
- objectIndex = D_8018CC80[arg0 + D_8018D17C];
- if (gObjectList[objectIndex].state == 0) {
- init_object(objectIndex, 1);
- break;
- }
- }
- }
-}
-
-void func_80077E20(s32 objectIndex) {
- Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_rectangle);
- Object* object;
-
- object = &gObjectList[objectIndex];
- object->activeTexture = D_0D0293D8;
- object->textureList = D_0D0293D8;
- //! @bug frappe snowland There's something up with the handling of common_vtx_rectangle and the loading of 0x10
- //! right here
- // root function: func_80078C70
- object->vertex = vtx;
- object->textureHeight = 0x10;
- object->textureWidth = object->textureHeight;
- object->sizeScaling = 0.15f;
- set_object_flag(objectIndex, 0x00000010);
- func_80086EF0(objectIndex);
- object->primAlpha = 0x00FF;
- object->unk_0D5 = 0;
- object->type = 0;
- object_next_state(objectIndex);
-}
-
-void func_80077EB8(s32 objectIndex, u16 arg1, Camera* camera) {
- s16 temp_v0;
-
- 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(objectIndex, 0x00000010);
- return;
- }
- clear_object_flag(objectIndex, 0x00000010);
-}
-
-void func_80077F64(s32 objectIndex, Camera* camera) {
-
- f64 rand;
-
- switch (gObjectList[objectIndex].unk_0AE) { /* irregular */
- case 1:
- gObjectList[objectIndex].direction_angle[1] = (camera->rot[1] + random_int(0x4000U)) - 0x2000;
- object_origin_pos_randomize_around_y(objectIndex, 0x00B4, 0x0014U);
- rand = random_int(0x0064U);
-
- gObjectList[objectIndex].velocity[1] = (f32) (-0.75 - (f64) (f32) (rand * 0.01));
- gObjectList[objectIndex].offset[0] = 0.0f;
- gObjectList[objectIndex].offset[1] = 0.0f;
- func_80086FD4(objectIndex);
- return;
- case 2:
- func_80077EB8(objectIndex, gObjectList[objectIndex].direction_angle[1], camera);
- object_add_velocity_offset_y(objectIndex);
- object_calculate_new_pos_offset(objectIndex);
- func_8008BFC0(objectIndex);
- if (gObjectList[objectIndex].pos[1] <= 0.0f) {
- func_80086FD4(objectIndex);
- return;
- }
- case 0:
- return;
- case 3:
- func_80086F60(objectIndex);
- break;
- }
-}
-
-void func_800780CC(s32 objectIndex, Camera* camera) {
- switch (gObjectList[objectIndex].state) { /* irregular */
- case 1:
- func_80077E20(objectIndex);
- return;
- case 2:
- func_80077F64(objectIndex, camera);
- if (gObjectList[objectIndex].unk_0AE == 0) {
- object_next_state(objectIndex);
- return;
- }
- case 0:
- return;
- case 3:
- func_80072428(objectIndex);
- break;
- }
-}
-
-void func_80078170(s32 arg0, Camera* arg1) {
- s32 objectIndex;
- s32 i;
-
- func_80077D5C(arg0);
- for (i = 0; i < D_8018D1F0; i++) {
- objectIndex = D_8018CC80[arg0 + i];
- if (gObjectList[objectIndex].state != 0) {
- func_800780CC(objectIndex, arg1);
- }
- }
-}
-
void func_80078220(s32 objectIndex) {
u8* tex = (u8*) LOAD_ASSET(D_0D0293D8);
Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_rectangle);
@@ -2451,119 +2335,9 @@ void update_snowflakes(void) {
}
}
-// This function adjusted to place clouds in the sky correctly
-void func_800788F8(s32 objectIndex, u16 rot, Camera* camera) {
- s16 cameraRot;
- // Adjustable culling factor
- const float cullingFactor = OTRGetAspectRatio();
-
- // Calculate the cloud's rotation relative to the camera
- cameraRot = camera->rot[1] + rot;
-
- // Adjust bounds based on the culling factor
- s16 adjustedLowerBound = (s16) (D_8018D210 * cullingFactor);
- s16 adjustedUpperBound = (s16) (D_8018D208 * cullingFactor);
-
- // Check if the object is within the adjusted bounds
- if ((cameraRot >= adjustedLowerBound) && (adjustedUpperBound >= cameraRot)) {
- // Calculate and update the object's position
- gObjectList[objectIndex].unk_09C = (D_8018D218 + (D_8018D1E8 * cameraRot));
-
- // Mark the object as visible
- set_object_flag(objectIndex, 0x10);
- } else {
- // If outside the bounds, mark the object as not visible
- set_object_flag(objectIndex, 0x10);
- }
-}
-
-void update_clouds(s32 arg0, Camera* arg1, CloudData* cloudList) {
- s32 cloudIndex;
- s32 objectIndex;
- CloudData* cloud;
-
- for (cloudIndex = 0; cloudIndex < D_8018D1F0; cloudIndex++) {
- cloud = &cloudList[cloudIndex];
- objectIndex = D_8018CC80[arg0 + cloudIndex];
- func_800788F8(objectIndex, cloud->rotY, arg1);
- }
-}
-
-void update_stars(s32 arg0, Camera* camera, StarData* starList) {
- s32 starIndex;
- s32 objectIndex;
- StarData* star;
-
- for (starIndex = 0; starIndex < D_8018D1F0; starIndex++) {
- star = &starList[starIndex];
- objectIndex = D_8018CC80[arg0 + starIndex];
- func_800788F8(objectIndex, star->rotY, camera);
- switch (starIndex % 5U) {
- case 0:
- func_80073CB0(objectIndex, &gObjectList[objectIndex].primAlpha, 0x00000028, 0x000000B4, 0x000000FF, 0,
- -1);
- break;
- case 1:
- func_80073CB0(objectIndex, &gObjectList[objectIndex].primAlpha, 0x00000080, 0x000000FF, 0x000000FF, 0,
- -1);
- break;
- case 2:
- func_80073CB0(objectIndex, &gObjectList[objectIndex].primAlpha, 0x00000050, 0x000000C8, 0x000000FF, 0,
- -1);
- break;
- case 3:
- func_80073CB0(objectIndex, &gObjectList[objectIndex].primAlpha, 0, 0x0000009B, 0x000000FF, 0, -1);
- break;
- case 4:
- func_80073CB0(objectIndex, &gObjectList[objectIndex].primAlpha, 0x0000005A, 0x00000080, 0x000000FF, 0,
- -1);
- break;
- }
- }
-}
-
-UNUSED void func_80078C68() {
-}
-
-void func_80078C70(s32 arg0) {
- s32 sp1C;
- Camera* camera;
-
+void func_80078C70() {
if (D_801657C8 == 0) {
- switch (arg0) { /* switch 1 */
- case 0: /* switch 1 */
- sp1C = 0;
- camera = camera1;
- D_8018D200 = camera->fieldOfView + 40.0f;
- break;
- case 1: /* switch 1 */
- sp1C = 0;
- camera = camera1;
- D_8018D200 = camera->fieldOfView + 40.0f;
- break;
- case 2: /* switch 1 */
- camera = camera2;
- sp1C = D_8018D1F0;
- D_8018D200 = camera->fieldOfView + 40.0f;
- break;
- case 3: /* switch 1 */
- sp1C = 0;
- camera = camera1;
- D_8018D200 = camera->fieldOfView + 40.0f;
- break;
- case 4: /* switch 1 */
- camera = camera2;
- sp1C = D_8018D1F0;
- D_8018D200 = camera->fieldOfView + 40.0f;
- break;
- }
-
- D_8018D208 = ((D_8018D200 / 2) * 0xB6) + 0x71C;
- D_8018D210 = (-(D_8018D200 / 2) * 0xB6) - 0x71C;
- D_8018D1E8 = 1.7578125 / D_8018D200;
- D_8018D218 = 0xA0;
-
- CM_TickClouds(sp1C, camera);
+ TickSkyActors();
}
}