Remove As Much Code As Possible and Still Pass Tests (#732)

* Update render_objects.c

* Remove unused HUD texture function declarations

Removed several unused function declarations related to HUD textures.

* Update skybox_and_splitscreen.c

* Remove unused set_viewport2 function declaration

Removed unused function declaration for set_viewport2.

* Update code_80005FD0.c

* Remove set_bomb_kart_spawn_positions function declaration

* Update skybox_and_splitscreen.c

* Update skybox_and_splitscreen.h

* Modify Draw function to adjust crab visibility

Commented out code to prevent premature disappearance of the crab when the camera rotates.

* Update Crab.cpp

* Update Crab.h

* Update Crab.cpp

* Delete unused texture rendering functions

Removed unused functions related to texture rendering.

* Update render_objects.h
This commit is contained in:
MegaMech
2026-08-01 23:19:52 -06:00
committed by GitHub
parent 8629bec320
commit 97f2833432
8 changed files with 7 additions and 354 deletions
-56
View File
@@ -2978,62 +2978,6 @@ s16 update_vehicle_following_path(Vec3f pos, s16* waypointIndex, f32 speed) {
return get_angle_between_path(sp38, pos);
}
void set_bomb_kart_spawn_positions(void) {
UNUSED struct Collision* var_s2;
f32 startingXPos;
f32 startingZPos;
f32 startingYPos;
s32 var_s3;
TrackPathPoint* temp_v0;
UNUSED BombKart* var_s0;
BombKartSpawn* bombKartSpawn;
for (var_s3 = 0; var_s3 < NUM_BOMB_KARTS_VERSUS; var_s3++) {
bombKartSpawn = NULL;
// bombKartSpawn = &gBombKartSpawns[gCurrentCourseId][var_s3];
if (IsYoshiValley()) {
startingXPos = bombKartSpawn->startingXPos;
startingZPos = bombKartSpawn->startingZPos;
startingYPos = spawn_actor_on_surface(startingXPos, 2000.0f, startingZPos);
} else if (IsPodiumCeremony()) {
temp_v0 = &gTrackPaths[3][bombKartSpawn->waypointIndex];
startingXPos = temp_v0->x;
startingYPos = temp_v0->y;
startingZPos = temp_v0->z;
} else {
temp_v0 = &gTrackPaths[0][bombKartSpawn->waypointIndex];
startingXPos = temp_v0->x;
startingYPos = temp_v0->y;
startingZPos = temp_v0->z;
}
gBombKarts[var_s3].bombPos[0] = startingXPos;
gBombKarts[var_s3].bombPos[1] = startingYPos;
gBombKarts[var_s3].bombPos[2] = startingZPos;
gBombKarts[var_s3].wheel1Pos[0] = startingXPos;
gBombKarts[var_s3].wheel1Pos[1] = startingYPos;
gBombKarts[var_s3].wheel1Pos[2] = startingZPos;
gBombKarts[var_s3].wheel2Pos[0] = startingXPos;
gBombKarts[var_s3].wheel2Pos[1] = startingYPos;
gBombKarts[var_s3].wheel2Pos[2] = startingZPos;
gBombKarts[var_s3].wheel3Pos[0] = startingXPos;
gBombKarts[var_s3].wheel3Pos[1] = startingYPos;
gBombKarts[var_s3].wheel3Pos[2] = startingZPos;
gBombKarts[var_s3].wheel4Pos[0] = startingXPos;
gBombKarts[var_s3].wheel4Pos[1] = startingYPos;
gBombKarts[var_s3].wheel4Pos[2] = startingZPos;
gBombKarts[var_s3].waypointIndex = bombKartSpawn->waypointIndex;
gBombKarts[var_s3].unk_3C = bombKartSpawn->unk_04;
gBombKarts[var_s3].bounceTimer = 0;
gBombKarts[var_s3].circleTimer = 0;
gBombKarts[var_s3].state = bombKartSpawn->startingState;
gBombKarts[var_s3].unk_4A = 0;
gBombKarts[var_s3].unk_4C = 1;
gBombKarts[var_s3].yPos = startingYPos;
check_bounding_collision(&gBombKartCollision[var_s3], 2.0f, startingXPos, startingYPos, startingZPos);
}
}
void func_8000DF8C(s32 bombKartId) {
UNUSED s32 stackPadding0;
f32 sp118;
-1
View File
@@ -155,7 +155,6 @@ void determine_ideal_cpu_position_offset(s32, u16);
s16 func_8000D6D0(Vec3f, s16*, f32, f32, s16, s16);
s16 func_8000D940(Vec3f, s16*, f32, f32, s16);
s16 update_vehicle_following_path(Vec3f, s16*, f32);
void set_bomb_kart_spawn_positions(void);
void func_8000DF8C(s32);
s32 add_actor_in_unexpired_actor_list(s32, s16);
+7 -28
View File
@@ -74,6 +74,13 @@ Vtx common_vtx_crab[] = {
void OCrab::Draw(s32 cameraId) {
Camera* camera;
s32 objectIndex = _objectIndex;
// With this the crab disappears too early when the camera is rotating away from the crab
// func_8008A364(objectIndex, cameraId, 0x2AABU, 800);
// if (is_obj_flag_status_active(objectIndex, VISIBLE) == 0) {
// return;
// }
if (gObjectList[objectIndex].state >= 2) {
camera = &camera1[cameraId];
FrameInterpolation_RecordOpenChild("crab", (_idx << 5) | cameraId);
@@ -94,34 +101,6 @@ void OCrab::Draw(s32 cameraId) {
}
}
void OCrab::DrawModel(s32 cameraId) {
s32 someIndex;
s32 objectIndex = _objectIndex;
func_8008A364(objectIndex, cameraId, 0x2AABU, 800);
if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) {
Camera* camera;
if (gObjectList[objectIndex].state >= 2) {
camera = &camera1[cameraId];
FrameInterpolation_RecordOpenChild("crab3", (_idx << 5) | cameraId);
func_8004A6EC(objectIndex, 0.5f);
FrameInterpolation_RecordCloseChild();
gObjectList[objectIndex].orientation[1] =
func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos);
FrameInterpolation_RecordOpenChild("crab4", (_idx << 5) | cameraId);
rsp_set_matrix_transformation(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation,
gObjectList[objectIndex].sizeScaling);
gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D007D78);
gDPLoadTLUT_pal256(gDisplayListHead++, gObjectList[objectIndex].activeTLUT);
rsp_load_texture((u8*) gObjectList[objectIndex].activeTexture, 64, 64);
gSPVertex(gDisplayListHead++, (uintptr_t) common_vtx_crab, 4, 0);
gSPDisplayList(gDisplayListHead++, (Gfx*) common_rectangle_display);
gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF);
FrameInterpolation_RecordCloseChild();
}
}
}
void OCrab::init_ktb_crab(s32 objectIndex) {
Object* object;
-2
View File
@@ -52,8 +52,6 @@ public:
virtual void SetSpawnParams(SpawnParams& params) override;
virtual void DrawEditorProperties() override;
void DrawModel(s32 cameraId);
void init_ktb_crab(s32 objectIndex);
void func_80082B34(s32 objectIndex);
void func_80082C30(s32 objectIndex);
-24
View File
@@ -240,30 +240,6 @@ void init_rdp(void) {
gSPClipRatio(gDisplayListHead++, FRUSTRATIO_1);
}
UNUSED void func_802A40A4(void) {
}
UNUSED void func_802A40AC(void) {
}
UNUSED void func_802A40B4(void) {
}
UNUSED void func_802A40BC(void) {
}
UNUSED void func_802A40C4(void) {
}
UNUSED void func_802A40CC(void) {
}
UNUSED void func_802A40D4(void) {
}
UNUSED void func_802A40DC(void) {
}
UNUSED void set_viewport2(void) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gScreenOneCtx->viewport));
gSPClearGeometryMode(gDisplayListHead++, G_CLEAR_ALL_MODES);
gSPSetGeometryMode(gDisplayListHead++,
G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH | G_CLIPPING);
}
void set_viewport(void) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
gSPClearGeometryMode(gDisplayListHead++, G_CLEAR_ALL_MODES);
-9
View File
@@ -18,15 +18,6 @@ void func_802A38B4(void);
void func_802A39E0(ScreenContext*);
void init_z_buffer(void);
void init_rdp(void);
void func_802A40A4(void);
void func_802A40AC(void);
void func_802A40B4(void);
void func_802A40BC(void);
void func_802A40C4(void);
void func_802A40CC(void);
void func_802A40D4(void);
void func_802A40DC(void);
void set_viewport2(void);
void set_viewport(void);
void select_framebuffer(void);
void func_802A4300(void);
-205
View File
@@ -2133,14 +2133,6 @@ void draw_hud_2d_texture_8x8(s32 x, s32 y, u8* texture) {
}
}
UNUSED void draw_hud_2d_texture_8x16(s32 x, s32 y, u8* texture) {
draw_hud_2d_texture_wide(x, y, 8, 16, texture);
}
UNUSED void draw_hud_2d_texture_16x16(s32 x, s32 y, u8* texture) {
draw_hud_2d_texture_wide(x, y, 16, 16, texture);
}
void draw_hud_2d_texture_32x8(s32 x, s32 y, u8* texture) {
draw_hud_2d_texture_wide(x, y, 32, 8, texture);
}
@@ -2149,107 +2141,6 @@ void draw_hud_2d_texture_32x16(s32 x, s32 y, u8* texture) {
draw_hud_2d_texture_wide(x, y, 32, 16, texture);
}
UNUSED void func_8004CBC0(s32 arg0, s32 arg1, f32 arg2, u8* texture) {
func_8004CA58(arg0, arg1, arg2, texture, 32, 16);
}
UNUSED void draw_hud_2d_texture_32x32(s32 x, s32 y, u8* texture) {
draw_hud_2d_texture_wide(x, y, 32, 32, texture);
}
UNUSED void func_8004CC24(s32 arg0, s32 arg1, u8* texture) {
func_8004C628(arg0, arg1, 32, 32, texture);
}
UNUSED void draw_hud_2d_texture_40x32(s32 x, s32 y, u8* texture) {
draw_hud_2d_texture_wide(x, y, 40, 32, texture);
}
UNUSED void func_8004CC84(s32 x, s32 y, u8* texture) {
func_8004C91C(x, y, texture, 48, 48, 24);
}
UNUSED void func_8004CCB4(s32 x, s32 y, u8* texture) {
draw_hud_2d_texture_wide(x, y, 64, 32, texture);
}
UNUSED void func_8004CCE4(s32 arg0, s32 arg1, f32 arg2, u8* texture) {
func_8004CA58(arg0, arg1, arg2, texture, 64, 32);
}
UNUSED void func_8004CD18(s32 arg0, s32 arg1, u8* texture) {
func_8004C91C(arg0, arg1, texture, 64, 64, 32);
}
UNUSED void func_8004CD48(s32 arg0, s32 arg1, u8* texture, s32 width, s32 arg4, s32 height) {
UNUSED s32 pad;
s32 var_s0;
s32 i;
// img was never initialized; the (formerly UNUSED) texture param is
// clearly what the loop was meant to walk.
u8* img = texture;
var_s0 = arg1 - (arg4 / 2);
gSPDisplayList(gDisplayListHead++, D_0D007FE0);
for (i = 0; i < arg4 / height; i++) {
load_texture_block_ia16_nomirror(img, width, height);
func_8004B97C_wide(arg0 - (width / 2), var_s0, width, height, 1);
img += width * height * 2;
var_s0 += height;
}
}
UNUSED void func_8004CE8C(s32 arg0, s32 arg1, u8* texture, s32 width, s32 arg4, s32 height) {
s32 var_s0 = arg1 - (arg4 / 2);
s32 i;
u8* img = texture;
for (i = 0; i < arg4 / height; i++) {
load_texture_block_ia8_nomirror(img, width, height);
func_8004B97C_wide(arg0 - (width / 2), var_s0, width, height, 1);
img += width * height;
var_s0 += height;
}
}
UNUSED void func_8004CF9C(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4, UNUSED s32 arg5, s32 arg6) {
gSPDisplayList(gDisplayListHead++, D_0D007FE0);
func_8004CE8C(arg0, arg1, texture, arg3, arg4, arg6);
}
UNUSED void func_8004CFF0(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4, UNUSED s32 arg5, s32 arg6) {
gSPDisplayList(gDisplayListHead++, D_0D008000);
func_8004CE8C(arg0, arg1, texture, arg3, arg4, arg6);
}
UNUSED void func_8004D044(s32 arg0, s32 arg1, u8* texture, s32 red, s32 green, s32 blue, s32 alpha, s32 arg7, s32 arg8,
UNUSED s32 arg9, s32 argA) {
gSPDisplayList(gDisplayListHead++, D_0D007FE0);
func_8004B35C(red, green, blue, alpha);
func_8004CE8C(arg0, arg1, texture, arg7, arg8, argA);
}
UNUSED void func_8004D0CC(void) {
}
UNUSED void func_8004D0D4(s32 arg0, s32 arg1, u8* texture, s32 width, s32 arg4, s32 height) {
s32 var_s0;
u8* img;
s32 i;
var_s0 = arg1 - (arg4 / 2);
img = texture;
gSPDisplayList(gDisplayListHead++, D_0D007FE0);
for (i = 0; i < arg4 / height; i++) {
func_80044924(img, width, height);
func_8004B97C_wide(arg0 - (width / 2), var_s0, width, height, 1);
img += width * height;
var_s0 += height;
}
}
void func_8004D210(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 width, s32 arg8,
UNUSED s32 arg9, s32 height) {
s32 var_s3;
@@ -2384,102 +2275,6 @@ void func_8004D93C(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4) {
}
}
UNUSED void func_8004DAB8(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4) {
f32 temp_f20;
s16 temp_s7;
s16 var_s1;
u16 temp_s0;
s32 temp_s6;
u8* img;
s32 var_s4;
s32 var;
s32 i;
D_801656B0 += D_80165710;
temp_f20 = D_8018D00C;
temp_s7 = D_80165708;
var_s1 = (s16) D_801656B0;
img = texture;
var = arg3 / 2;
var_s4 = arg1 - (arg4 / 2);
gSPDisplayList(gDisplayListHead++, D_0D007FE0);
for (i = 0; i < arg4; i++) {
temp_s0 = var_s1;
temp_s6 = (s32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - (var)));
sins(temp_s0);
func_80044924(img, arg3, 1);
func_8004B97C_wide(temp_s6, var_s4, arg3, 1, 1);
var_s1 += temp_s7;
img += arg3;
var_s4 += 1;
}
}
UNUSED void func_8004DC34(s32 arg0, s32 arg1, u8* texture) {
func_8004CF9C(arg0, arg1, texture, 8, 160, 8, 160);
}
UNUSED void func_8004DC6C(s32 arg0, s32 arg1, u8* texture) {
func_8004CF9C(arg0, arg1, texture, 12, 160, 12, 160);
}
UNUSED void func_8004DCA4(s32 arg0, s32 arg1, u8* texture) {
func_8004CF9C(arg0, arg1, texture, 12, 192, 12, 192);
}
UNUSED void func_8004DCDC(s32 arg0, s32 arg1, u8* texture) {
func_8004CD48(arg0, arg1, texture, 16, 16, 16);
}
UNUSED void func_8004DD0C(s32 arg0, s32 arg1, u8* texture) {
func_8004CF9C(arg0, arg1, texture, 16, 160, 16, 160);
}
UNUSED void func_8004DD44(s32 arg0, s32 arg1, u8* texture) {
func_8004CD48(arg0, arg1, texture, 32, 32, 32);
}
UNUSED void func_8004DD74(s32 arg0, s32 arg1, u8* texture) {
func_8004CF9C(arg0, arg1, texture, 32, 32, 32, 32);
}
UNUSED void func_8004DDAC(s32 arg0, s32 arg1, u8* texture) {
func_8004D0D4(arg0, arg1, texture, 32, 32, 32);
}
UNUSED void func_8004DDDC(s32 arg0, s32 arg1, u8* texture) {
func_8004D7B4(arg0, arg1, texture, 32, 32);
}
UNUSED void func_8004DE04(s32 arg0, s32 arg1, u8* texture) {
func_8004D93C(arg0, arg1, texture, 32, 32);
}
UNUSED void func_8004DE2C(s32 arg0, s32 arg1, u8* arg2) {
func_8004DAB8(arg0, arg1, arg2, 32, 32);
}
UNUSED void func_8004DE54(s32 arg0, s32 arg1, u8* arg2) {
func_8004CD48(arg0, arg1, arg2, 64, 32, 32);
}
UNUSED void func_8004DE84(s32 arg0, s32 arg1, u8* arg2) {
func_8004CD48(arg0, arg1, arg2, 64, 64, 32);
}
UNUSED void func_8004DEB4(s32 arg0, s32 arg1, u8* texture) {
func_8004CF9C(arg0, arg1, texture, 64, 96, 64, 48);
}
UNUSED void func_8004DEEC(s32 arg0, s32 arg1, u8* arg2) {
func_8004CF9C(arg0, arg1, arg2, 112, 32, 112, 32);
}
UNUSED void func_8004DF24(s32 arg0, s32 arg1, u8* arg2) {
func_8004CF9C(arg0, arg1, arg2, 128, 32, 128, 32);
}
// Positions the item box on screen
void func_8004DF5C(s32 arg0, s32 arg1, u8* texture, s32 width, s32 arg4, s32 height) {
s32 var_s0 = var_s0 = arg1 - (arg4 / 2);
-29
View File
@@ -231,41 +231,12 @@ void draw_hud_2d_texture_8x16(s32, s32, u8*);
void draw_hud_2d_texture_16x16(s32, s32, u8*);
void draw_hud_2d_texture_32x8(s32, s32, u8*);
void draw_hud_2d_texture_32x16(s32, s32, u8*);
void func_8004CBC0(s32, s32, f32, u8*);
void draw_hud_2d_texture_32x32(s32, s32, u8*);
void func_8004CC24(s32, s32, u8*);
void draw_hud_2d_texture_40x32(s32, s32, u8*);
void func_8004CC84(s32, s32, u8*);
void func_8004CCB4(s32, s32, u8*);
void func_8004CCE4(s32, s32, f32, u8*);
void func_8004CD18(s32, s32, u8*);
void func_8004CF9C(s32, s32, u8*, s32, s32, s32, s32);
void func_8004CFF0(s32, s32, u8*, s32, s32, s32, s32);
void func_800450C8(u8*, s32, s32);
void func_80044F34(u8*, s32, s32);
void func_8004D044(s32, s32, u8*, s32, s32, s32, s32, s32, s32, s32, s32);
void func_8004D0CC(void);
void func_8004D0D4(s32, s32, u8*, s32, s32, s32);
void func_8004D210(s32, s32, u8*, s32, s32, s32, s32, s32, s32, s32, s32);
void func_8004D37C(s32, s32, u8*, s32, s32, s32, s32, s32, s32, s32, s32);
void func_8004D4E8(s32, s32, u8*, s32, s32, s32, s32, s32, s32, s32, s32);
void func_8004DC34(s32, s32, u8*);
void func_8004DC6C(s32, s32, u8*);
void func_8004DCA4(s32, s32, u8*);
void func_8004DCDC(s32, s32, u8*);
void func_8004DD0C(s32, s32, u8*);
void func_8004DD44(s32, s32, u8*);
void func_8004DD74(s32, s32, u8*);
void func_8004DDAC(s32, s32, u8*);
void func_8004DDDC(s32, s32, u8*);
void func_8004DE04(s32, s32, u8*);
void func_8004DE2C(s32, s32, u8*);
void func_8004DE54(s32, s32, u8*);
void func_8004DE84(s32, s32, u8*);
void func_8004DEB4(s32, s32, u8*);
void func_8004DEEC(s32, s32, u8*);
void func_8004DF24(s32, s32, u8*);
void func_8004F6D0(s32);
void func_8004E238(void);