diff --git a/src/game/bg.c b/src/game/bg.c index 7b36e4d98..3f14e6061 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -1358,6 +1358,20 @@ void bgReset(s32 stagenum) } } + if (g_Vars.stagenum == STAGE_AIRFORCEONE) { + // Remove two unnecessary portals that cause rooms to be rendered when they needn't be + s32 i; + s32 numportals = 0; + + for (i = 0; g_BgPortals[i].verticesoffset != 0; i++) { + numportals++; + } + + g_BgPortals[0x13] = g_BgPortals[numportals - 1]; // unlink rooms F and 13 + g_BgPortals[0x15] = g_BgPortals[numportals - 2]; // unlink rooms 10 and 13 + g_BgPortals[numportals - 2].verticesoffset = 0; + } + g_BgAlwaysRoom = -1; if (stagenum == STAGE_INFILTRATION @@ -1457,6 +1471,11 @@ void bgBuildTables(s32 stagenum) offset = numportals * sizeof(struct bgportal); offset += sizeof(struct bgportal); + if (g_Vars.stagenum == STAGE_AIRFORCEONE) { + // Compensate for the two removed portals in bgReset + offset += sizeof(struct bgportal) * 2; + } + // Because each group of vertices is variable length, the portals can't // be iterated in order and have their offset calculated. The vertice // data has to be iterated in storage order, then iterate all portals to