From c863898de50405c93bcb6e0917568e1f0106f967 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 12 May 2023 20:27:36 +1000 Subject: [PATCH] Remove osGetCount calls from weather and lighting code --- src/game/dlights.c | 8 -------- src/game/weather.c | 41 ----------------------------------------- 2 files changed, 49 deletions(-) diff --git a/src/game/dlights.c b/src/game/dlights.c index 1f84d6567..5092ca71d 100644 --- a/src/game/dlights.c +++ b/src/game/dlights.c @@ -559,8 +559,6 @@ void func0f001c0c(void) s32 j; s32 stack[4]; - osGetCount(); - var80061440 = 0; func0f0023b8(); @@ -578,8 +576,6 @@ void func0f001c0c(void) table4size = ALIGN16((u32)var8009cae0 * (u32)var8009cae0); sp68 = ALIGN16(g_Vars.roomcount * 8); - mempGetStageFree(); - ptr = mblurGetAllocation(); var80061434 = (f32 *)ptr; @@ -667,10 +663,6 @@ void func0f001c0c(void) for (i = 1; i < g_Vars.roomcount; i++) { g_Rooms[i].flags &= ~ROOMFLAG_ONSCREEN; } - - osGetCount(); - - if (sp68); } static f32 func0f002334(s32 roomnum, f32 mult, s32 portalnum1, s32 portalnum2); diff --git a/src/game/weather.c b/src/game/weather.c index eef28ede6..05cefd67f 100644 --- a/src/game/weather.c +++ b/src/game/weather.c @@ -755,11 +755,9 @@ static bool weatherIsRoomWeatherProof(s32 room) static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) { u8 stack[0x10]; - s32 spdb0[10]; Mtxf *mtx; s32 i; s32 s0; - s32 spd84[8]; s32 spd80; s32 spcb8[50]; struct coord spca8; @@ -829,12 +827,6 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) spd80 = 0; } - osGetCount(); - - for (i = 0; i != 10; i++) { - spdb0[i] = 0; - } - texSelect(&gdl, &g_TexGeneralConfigs[1], 2, 1, 2, 1, NULL); gDPSetCycleType(gdl++, G_CYC_1CYCLE); @@ -1132,22 +1124,16 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); - spd84[0] = osGetCount(); - // 3ca4 for (p = 0; p < 500; p++) { s3 = 1; if (particledata->particles[p].active & 3) { - spd84[7] = osGetCount(); - sp108.f[0] = particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]; sp108.f[1] = particledata->unk3e80.f[1] + particledata->particles[p].pos.f[1]; sp108.f[2] = particledata->unk3e80.f[2] + particledata->particles[p].pos.f[2]; if (cam0f0b5b9c(&sp108, 150)) { - spdb0[7] = spdb0[7] + osGetCount() - spd84[7]; - sp218[0] = particledata->particles[p].pos.f[0]; sp218[1] = particledata->particles[p].pos.f[2]; @@ -1176,9 +1162,6 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) sp198[j].f[2] = particledata->particles[p].pos.f[2]; } - spd84[1] = osGetCount(); - spd84[2] = osGetCount(); - // 3e0c if (var8007f0f4 && sp708 > 0) { spca8.f[0] = spc90.f[0] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]) * spc84; @@ -1212,8 +1195,6 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) spc9c.f[2] = tmp3; } - spd84[3] = osGetCount(); - // 3f84 for (s0 = 0; s0 < sp708; s0++) { if (spc9c.f[0] <= g_Rooms[spbbc[s0]].bbmax[0] @@ -1227,16 +1208,10 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) s3 = 0; } } - - spdb0[3] = spdb0[3] + osGetCount() - spd84[3]; } - spdb0[2] = spdb0[2] + osGetCount() - spd84[2]; - // 40b8 if (s3) { - spd84[4] = osGetCount(); - temp_f2_7 = 1.0f + sp214 / (var8007f0f0 / 10.0f); sp198[0].f[0] += -sp218[1] * -temp_f2_7; @@ -1282,9 +1257,6 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) } } - spdb0[4] = spdb0[4] + osGetCount() - spd84[4]; - spd84[5] = osGetCount(); - v0_2[0].s = 0; v0_2[0].t = 256; @@ -1297,9 +1269,6 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) v0_2[3].s = 0; v0_2[3].t = 0; - spdb0[5] = spdb0[5] + osGetCount() - spd84[5]; - spd84[6] = osGetCount(); - v0_2[0].x = sp198[0].f[0]; v0_2[0].y = sp198[0].f[1]; v0_2[0].z = sp198[0].f[2]; @@ -1320,9 +1289,6 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) } else { sp194++; } - - spdb0[6] = spdb0[6] + osGetCount() - spd84[6]; - spdb0[1] = spdb0[1] + osGetCount() - spd84[1]; } } } @@ -1345,8 +1311,6 @@ static Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) } } - osGetCount(); - return gdl; } @@ -1629,16 +1593,11 @@ static Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) s1 = true; if (particledata->particles[s8].active & 3) { - sp1354 = osGetCount(); - sp124.f[0] = particledata->particles[s8].pos.f[0] + particledata->unk3e80.f[0]; sp124.f[1] = particledata->particles[s8].pos.f[1] + particledata->unk3e80.f[1]; sp124.f[2] = particledata->particles[s8].pos.f[2] + particledata->unk3e80.f[2]; if (cam0f0b5b9c(&sp124, 5)) { - s32 count = osGetCount(); - sp137c = sp137c + count - sp1354; - sp21c = particledata->particles[s8].pos.f[0]; sp220 = particledata->particles[s8].pos.f[2];