1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-07 08:24:55 +00:00

Global Context And General Cleanup (#863)

* door context

* renames

* done

* fix unintended change

* all nb gone

* more nb gone

* merge fishing

* fix size commentX

* door changes suggested by dragorn

* fix accidental semicolon

* another

* change all texture pointers to void*

* error fix and format

* Update src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>

* fix ostime

* correct mistake in SkyboxContext

* probably fix nonmatching

* Update include/z64.h

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* roman's suggestions, fix incorrect type definition in z64scene.h

* typo in struct

* make typedef use u8 array

* forgot one

* pull in master and format.sh

Co-authored-by: Anghelo Carvajal <anghelo.carvajal.14@sansano.usm.cl>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
Zelllll 2021-08-15 18:15:58 -05:00 committed by GitHub
parent 1890e751b9
commit 7551dc2b71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 496 additions and 508 deletions

View file

@ -796,7 +796,7 @@ EntranceInfo gEntranceTable[] = {
#define UNTITLED_SCENE(name, unk_10, config, unk_12) \
{ (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, 0, 0, unk_10, config, unk_12, 0 }
Scene gSceneTable[] = {
SceneTableEntry gSceneTable[] = {
TITLED_SCENE(ydan_scene, g_pn_06, 1, 19, 2),
TITLED_SCENE(ddan_scene, g_pn_08, 1, 20, 3),
TITLED_SCENE(bdan_scene, g_pn_07, 1, 21, 4),
@ -1023,11 +1023,11 @@ void func_80099878(GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead);
gDPPipeSync(displayListHead++);
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->unk_11D30[0]);
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[0]);
gSPEndDisplayList(displayListHead++);
gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead);
gDPPipeSync(displayListHead++);
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->unk_11D30[1]);
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[1]);
gSPEndDisplayList(displayListHead);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4956);
@ -1040,7 +1040,7 @@ void func_80099BD8(GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5069);
temp = globalCtx->unk_11D30[0] / 255.0f;
temp = globalCtx->roomCtx.unk_74[0] / 255.0f;
gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead);
gSPSegment(POLY_OPA_DISP++, 0x08, displayListHead);
@ -1057,7 +1057,7 @@ void func_80099BD8(GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x0A, displayListHead);
gSPSegment(POLY_XLU_DISP++, 0x0A, displayListHead);
gDPPipeSync(displayListHead++);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]);
gSPEndDisplayList(displayListHead++);
gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead);
@ -1065,7 +1065,7 @@ void func_80099BD8(GlobalContext* globalCtx) {
gDPSetPrimColor(displayListHead++, 0, 0, 89 + (u8)(166.0f * temp), 89 + (u8)(166.0f * temp),
89 + (u8)(166.0f * temp), 255);
gDPPipeSync(displayListHead++);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]);
gSPEndDisplayList(displayListHead++);
gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead);
@ -1073,13 +1073,13 @@ void func_80099BD8(GlobalContext* globalCtx) {
gDPSetPrimColor(displayListHead++, 0, 0, 255 + (u8)(179.0f * temp), 255 + (u8)(179.0f * temp),
255 + (u8)(179.0f * temp), 255);
gDPPipeSync(displayListHead++);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]);
gSPEndDisplayList(displayListHead++);
gSPSegment(POLY_OPA_DISP++, 0x0D, displayListHead);
gSPSegment(POLY_XLU_DISP++, 0x0D, displayListHead);
gDPPipeSync(displayListHead++);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[1]);
gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[1]);
gSPEndDisplayList(displayListHead);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5145);
@ -1272,8 +1272,8 @@ void func_8009B0FC(GlobalContext* globalCtx) {
if (1) {} // Necessary to match
spB0 = (globalCtx->unk_11D30[1] >> 8) & 0xFF;
spAC = globalCtx->unk_11D30[1] & 0xFF;
spB0 = (globalCtx->roomCtx.unk_74[1] >> 8) & 0xFF;
spAC = globalCtx->roomCtx.unk_74[1] & 0xFF;
gameplayFrames = globalCtx->gameplayFrames;
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[gSaveContext.nightFlag]));
@ -1345,7 +1345,7 @@ void func_8009B86C(GlobalContext* globalCtx) {
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32));
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, globalCtx->unk_11D30[0]);
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, globalCtx->roomCtx.unk_74[0]);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 145);
@ -1654,7 +1654,7 @@ void func_8009CF84(GlobalContext* globalCtx) {
Gfx_TwoTexScrollPrimColor(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128,
(gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128,
(gameplayFrames * 1) % 128, 32, 32, 255, 255, 255,
globalCtx->unk_11D30[0] + 127));
globalCtx->roomCtx.unk_74[0] + 127));
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
@ -1829,16 +1829,16 @@ void func_8009DA30(GlobalContext* globalCtx) {
gSPEndDisplayList(displayListHead);
} else {
if (gSaveContext.dayTime > 0xC555) {
if (globalCtx->unk_11D30[0] != 255) {
Math_StepToS(&globalCtx->unk_11D30[0], 255, 5);
if (globalCtx->roomCtx.unk_74[0] != 255) {
Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5);
}
} else if (gSaveContext.dayTime >= 0x4000) {
if (globalCtx->unk_11D30[0] != 0) {
Math_StepToS(&globalCtx->unk_11D30[0], 0, 10);
if (globalCtx->roomCtx.unk_74[0] != 0) {
Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10);
}
}
gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->unk_11D30[0]);
gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]);
gSPDisplayList(displayListHead++, &D_03012B20);
gSPEndDisplayList(displayListHead);
}
@ -1922,9 +1922,9 @@ void func_8009E0B8(GlobalContext* globalCtx) {
gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128);
if (gSaveContext.sceneSetupIndex == 4) {
spA3 = 255 - (u8)globalCtx->unk_11D30[0];
spA3 = 255 - (u8)globalCtx->roomCtx.unk_74[0];
} else if (gSaveContext.sceneSetupIndex == 6) {
spA0 = globalCtx->unk_11D30[0] + 500;
spA0 = globalCtx->roomCtx.unk_74[0] + 500;
} else if (((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) && (gSaveContext.eventChkInf[0] & 0x80)) {
spA0 = 2150;
}
@ -1941,8 +1941,8 @@ void func_8009E0B8(GlobalContext* globalCtx) {
gSPEndDisplayList(displayListHead);
gSPSegment(POLY_OPA_DISP++, 0x0C,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16, 1, 0,
(s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16));
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16, 1,
0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16));
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7044);
}
@ -1954,16 +1954,16 @@ void func_8009E54C(GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7058);
if ((gSaveContext.sceneSetupIndex > 3) || (LINK_IS_ADULT && !(gSaveContext.eventChkInf[6] & 0x200))) {
globalCtx->unk_11D30[0] = 87;
globalCtx->roomCtx.unk_74[0] = 87;
}
gameplayFrames = globalCtx->gameplayFrames;
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, 32,
32, 0, 0, 0, globalCtx->unk_11D30[0] + 168));
32, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168));
gSPSegment(POLY_OPA_DISP++, 0x09,
Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0,
16, 64, 0, 0, 0, globalCtx->unk_11D30[0] + 168));
16, 64, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168));
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 128);
@ -2079,12 +2079,12 @@ void func_8009EE44(GlobalContext* globalCtx) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
if ((globalCtx->unk_11D30[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) {
if (globalCtx->unk_11D30[1] == 50) {
if ((globalCtx->roomCtx.unk_74[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) {
if (globalCtx->roomCtx.unk_74[1] == 50) {
func_8002F7DC(&PLAYER->actor, NA_SE_EV_CHICKEN_CRY_M);
globalCtx->unk_11D30[0] = 1;
globalCtx->roomCtx.unk_74[0] = 1;
}
globalCtx->unk_11D30[1]++;
globalCtx->roomCtx.unk_74[1]++;
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7309);
@ -2180,16 +2180,16 @@ void func_8009F5D4(GlobalContext* globalCtx) {
gSPEndDisplayList(displayListHead);
} else {
if (gSaveContext.dayTime > 0xC000) {
if (globalCtx->unk_11D30[0] != 255) {
Math_StepToS(&globalCtx->unk_11D30[0], 255, 5);
if (globalCtx->roomCtx.unk_74[0] != 255) {
Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5);
}
} else if (gSaveContext.dayTime >= 0x4000) {
if (globalCtx->unk_11D30[0] != 0) {
Math_StepToS(&globalCtx->unk_11D30[0], 0, 10);
if (globalCtx->roomCtx.unk_74[0] != 0) {
Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10);
}
}
gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->unk_11D30[0]);
gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]);
gSPDisplayList(displayListHead++, &D_0300AA48);
gSPEndDisplayList(displayListHead);
}
@ -2339,27 +2339,27 @@ void func_8009FE58(GlobalContext* globalCtx) {
1.f + (0.39999998f * temp * Math_CosS(D_8012A3A0)), 1.f + (1 * temp * Math_CosS(D_8012A39C)));
func_800AA7AC(&globalCtx->view, 0.95f);
switch (globalCtx->unk_11D30[0]) {
switch (globalCtx->roomCtx.unk_74[0]) {
case 0:
break;
case 1:
if (globalCtx->unk_11D30[1] < 1200) {
globalCtx->unk_11D30[1] += 200;
if (globalCtx->roomCtx.unk_74[1] < 1200) {
globalCtx->roomCtx.unk_74[1] += 200;
} else {
globalCtx->unk_11D30[0]++;
globalCtx->roomCtx.unk_74[0]++;
}
break;
case 2:
if (globalCtx->unk_11D30[1] > 0) {
globalCtx->unk_11D30[1] -= 30;
if (globalCtx->roomCtx.unk_74[1] > 0) {
globalCtx->roomCtx.unk_74[1] -= 30;
} else {
globalCtx->unk_11D30[1] = 0;
globalCtx->unk_11D30[0] = 0;
globalCtx->roomCtx.unk_74[1] = 0;
globalCtx->roomCtx.unk_74[0] = 0;
}
break;
}
D_8012A398 += 0.15f + (globalCtx->unk_11D30[1] * 0.001f);
D_8012A398 += 0.15f + (globalCtx->roomCtx.unk_74[1] * 0.001f);
}
if (globalCtx->roomCtx.curRoom.num == 2) {