1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-05 15:34:41 +00:00

Decompile z_kankyo (#956)

* working

* start color switch

* progress

* progress

* progress on bgm func

* progress

* game over matched (except the rodata meme)

* start update

* progress

* lightning docs done

* progress

* progress

* progress

* progress

* progress

* can compile at least

* suns state, progress on kankyo_update

* some new names

* progress

* progress

* progress

* new functions

* cleanup

* more matches

* another match

* now functional

* format

* better match

* hugely improved update

* cleanup/review

* remove old changes

* review2

* review3

* missed one

* review4

* change asm filenames

* update doorwarp1

* review5

* Kankyo_ -> Environment_

* format

* merge master and format functions.h

Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com>
Co-authored-by: fig <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
petrie911 2021-09-20 11:51:35 -05:00 committed by GitHub
parent 50095d427c
commit e51f50f0ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
139 changed files with 3478 additions and 6277 deletions

View file

@ -1355,9 +1355,9 @@ void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) {
Gfx* displayListHead;
Gfx* displayList;
lightDir.x = globalCtx->envCtx.unk_2A;
lightDir.y = globalCtx->envCtx.unk_2B;
lightDir.z = globalCtx->envCtx.unk_2C;
lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x;
lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y;
lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z;
if (HREG(80) == 6) {
osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", globalCtx->view.eye.x,
@ -1386,9 +1386,9 @@ void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) {
Gfx* displayListHead;
Gfx* displayList;
lightDir.x = globalCtx->envCtx.unk_2A;
lightDir.y = globalCtx->envCtx.unk_2B;
lightDir.z = globalCtx->envCtx.unk_2C;
lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x;
lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y;
lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z;
hilite = func_8002EB44(&actor->world.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx);
@ -3568,9 +3568,9 @@ void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s1
Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) {
Vec3f lightDir;
lightDir.x = globalCtx->envCtx.unk_2A;
lightDir.y = globalCtx->envCtx.unk_2B;
lightDir.z = globalCtx->envCtx.unk_2C;
lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x;
lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y;
lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z;
return func_8002EABC(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx);
}
@ -3578,9 +3578,9 @@ Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) {
Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx) {
Vec3f lightDir;
lightDir.x = globalCtx->envCtx.unk_2A;
lightDir.y = globalCtx->envCtx.unk_2B;
lightDir.z = globalCtx->envCtx.unk_2C;
lightDir.x = globalCtx->envCtx.dirLight1.params.dir.x;
lightDir.y = globalCtx->envCtx.dirLight1.params.dir.y;
lightDir.z = globalCtx->envCtx.dirLight1.params.dir.z;
return func_8002EB44(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx);
}

View file

@ -547,7 +547,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) {
if (waterY < chkPos->y) {
// the water's y position is below the check position
// the aka the position is NOT in the water.
// meaning the position is NOT in the water.
return BGCHECK_Y_MIN;
}
@ -1778,7 +1778,7 @@ s32 Camera_Normal2(Camera* camera) {
if (camera->status == CAM_STAT_ACTIVE) {
bgChk.pos = *eyeNext;
if ((camera->globalCtx->envCtx.skyDisabled == 0) || norm2->interfaceFlags & 0x10) {
if (!camera->globalCtx->envCtx.skyboxDisabled || norm2->interfaceFlags & 0x10) {
Camera_BGCheckInfo(camera, at, &bgChk);
*eye = bgChk.pos;
} else {
@ -2110,7 +2110,7 @@ s32 Camera_Parallel1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8);
if (camera->status == CAM_STAT_ACTIVE) {
sp6C.pos = *eyeNext;
if (camera->globalCtx->envCtx.skyDisabled == 0 || para1->interfaceFlags & 0x10) {
if (!camera->globalCtx->envCtx.skyboxDisabled || para1->interfaceFlags & 0x10) {
Camera_BGCheckInfo(camera, at, &sp6C);
*eye = sp6C.pos;
} else {
@ -2903,7 +2903,7 @@ s32 Camera_Battle1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spB4);
spBC.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if (camera->globalCtx->envCtx.skyDisabled == 0 || batt1->flags & 1) {
if (!camera->globalCtx->envCtx.skyboxDisabled || batt1->flags & 1) {
Camera_BGCheckInfo(camera, at, &spBC);
} else if (batt1->flags & 2) {
func_80043F94(camera, at, &spBC);
@ -3225,7 +3225,7 @@ s32 Camera_KeepOn1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spD8);
sp8C.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if ((camera->globalCtx->envCtx.skyDisabled == 0) || keep1->interfaceFlags & 1) {
if (!camera->globalCtx->envCtx.skyboxDisabled || keep1->interfaceFlags & 1) {
Camera_BGCheckInfo(camera, at, &sp8C);
} else if (keep1->interfaceFlags & 2) {
func_80043F94(camera, at, &sp8C);
@ -4205,7 +4205,7 @@ s32 Camera_Subj3(Camera* camera) {
*eye = *eyeNext;
anim->animTimer--;
if (camera->globalCtx->envCtx.skyDisabled == 0) {
if (!camera->globalCtx->envCtx.skyboxDisabled) {
Camera_BGCheck(camera, at, eye);
} else {
func_80044340(camera, at, eye);
@ -7047,7 +7047,7 @@ void Camera_PrintSettings(Camera* camera) {
s32 Camera_CheckWater(Camera* camera) {
f32 waterY;
s16 newQuakeId;
s32 waterBoxProp;
s32 waterLightsIndex;
s32* waterPrevCamSetting = &camera->waterPrevCamSetting;
s16 waterCamIdx;
s16* quakeId = (s16*)&camera->waterQuakeId;
@ -7115,12 +7115,12 @@ s32 Camera_CheckWater(Camera* camera) {
}
}
if (waterY = Camera_GetWaterSurface(camera, &camera->eye, &waterBoxProp), waterY != BGCHECK_Y_MIN) {
if (waterY = Camera_GetWaterSurface(camera, &camera->eye, &waterLightsIndex), waterY != BGCHECK_Y_MIN) {
camera->waterYPos = waterY;
if (!(camera->unk_14C & 0x100)) {
camera->unk_14C |= 0x100;
osSyncPrintf("kankyo changed water, sound on\n");
func_80070600(camera->globalCtx, waterBoxProp);
Environment_EnableUnderwaterLights(camera->globalCtx, waterLightsIndex);
camera->unk_150 = 0x50;
}
@ -7152,7 +7152,7 @@ s32 Camera_CheckWater(Camera* camera) {
if (camera->unk_14C & 0x100) {
camera->unk_14C &= ~0x100;
osSyncPrintf("kankyo changed water off, sound off\n");
func_800706A0(camera->globalCtx);
Environment_DisableUnderwaterLights(camera->globalCtx);
if (*quakeId != 0) {
Quake_RemoveFromIdx(*quakeId);
}
@ -7567,7 +7567,7 @@ void Camera_Finish(Camera* camera) {
camera->childCamIdx = camera->parentCamIdx = SUBCAM_FREE;
camera->timer = -1;
camera->globalCtx->envCtx.unk_E1 = 0;
camera->globalCtx->envCtx.fillScreen = false;
Gameplay_ClearCamera(camera->globalCtx, camera->thisIdx);
}

View file

@ -15,7 +15,7 @@ void SaveContext_Init(void) {
gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = 0;
gSaveContext.nextDayTime = 0xFFFF;
gSaveContext.environmentTime = 0;
gSaveContext.skyboxTime = 0;
gSaveContext.dogIsLost = true;
gSaveContext.nextTransition = 0xFF;
gSaveContext.unk_13EE = 50;

View file

@ -10,7 +10,7 @@ void func_801109B0(GlobalContext* globalCtx) {
u16 doActionOffset;
u8 temp;
gSaveContext.unk_1422 = 0;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0;
View_Init(&interfaceCtx->view, globalCtx->state.gfxCtx);

View file

@ -170,7 +170,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
return;
}
temp = func_8006F93C(cmd->endFrame - 1, cmd->startFrame, csCtx->frames);
temp = Environment_LerpWeight(cmd->endFrame - 1, cmd->startFrame, csCtx->frames);
if (csCtx->frames == cmd->startFrame) {
sp3F = 1;
@ -187,9 +187,9 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
case 2:
if (sp3F != 0) {
func_800F6D58(0xF, 0, 0);
func_800753C4(globalCtx, 3);
Environment_AddLightningBolts(globalCtx, 3);
if (1) {}
D_8015FD70 = 1;
gLightningStrike.state = LIGHTNING_STRIKE_START;
}
break;
case 3:
@ -201,14 +201,14 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
}
break;
case 6:
if (globalCtx->envCtx.unk_A0 < 0x3200) {
globalCtx->envCtx.unk_A0 += 0x23;
if (globalCtx->envCtx.adjFogFar < 12800) {
globalCtx->envCtx.adjFogFar += 35;
}
break;
case 7:
if (sp3F != 0) {
globalCtx->envCtx.unk_19 = 1;
globalCtx->envCtx.gloomySky = 1;
globalCtx->envCtx.unk_17 = 1;
globalCtx->envCtx.unk_18 = 0;
globalCtx->envCtx.unk_1A = 0x3C;
globalCtx->envCtx.unk_21 = 1;
@ -279,12 +279,12 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
break;
case 18:
globalCtx->envCtx.unk_EE[0] = 0;
globalCtx->envCtx.gloomySkyEvent = 2;
globalCtx->envCtx.gloomySkyMode = 2;
if (gSaveContext.dayTime < 0x4AAB) {
gSaveContext.dayTime += 30;
}
if (globalCtx->envCtx.unk_EE[1] == 0) {
D_8011FB30 = 0;
gWeatherMode = 0;
func_800F6D58(14, 1, 0);
}
break;
@ -331,16 +331,16 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
break;
case 27:
if (globalCtx->state.frames & 8) {
if (globalCtx->envCtx.unk_8C[0][0] < 40) {
globalCtx->envCtx.unk_8C[0][0] += 2;
globalCtx->envCtx.unk_8C[1][1] -= 3;
globalCtx->envCtx.unk_8C[1][2] -= 3;
if (globalCtx->envCtx.adjAmbientColor[0] < 40) {
globalCtx->envCtx.adjAmbientColor[0] += 2;
globalCtx->envCtx.adjLight1Color[1] -= 3;
globalCtx->envCtx.adjLight1Color[2] -= 3;
}
} else {
if (globalCtx->envCtx.unk_8C[0][0] > 2) {
globalCtx->envCtx.unk_8C[0][0] -= 2;
globalCtx->envCtx.unk_8C[1][1] += 3;
globalCtx->envCtx.unk_8C[1][2] += 3;
if (globalCtx->envCtx.adjAmbientColor[0] > 2) {
globalCtx->envCtx.adjAmbientColor[0] -= 2;
globalCtx->envCtx.adjLight1Color[1] += 3;
globalCtx->envCtx.adjLight1Color[2] += 3;
}
}
break;
@ -358,18 +358,18 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
break;
case 32:
if (sp3F != 0) {
globalCtx->envCtx.unk_E6 = 1;
globalCtx->envCtx.sandstormState = 1;
}
func_800788CC(NA_SE_EV_SAND_STORM - SFX_FLAG);
break;
case 33:
gSaveContext.unk_1422 = 1;
gSaveContext.sunsSongState = SUNSSONG_START;
break;
case 34:
if (IS_DAY) {
gSaveContext.dayTime -= D_8011FB40;
gSaveContext.dayTime -= gTimeIncrement;
} else {
gSaveContext.dayTime -= D_8011FB40 * 2;
gSaveContext.dayTime -= gTimeIncrement * 2;
}
break;
case 35:
@ -433,7 +433,7 @@ void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTim
temp2 = (cmd->minute + 1) / (360.0f / 0x4000);
gSaveContext.dayTime = temp1 + temp2;
gSaveContext.environmentTime = temp1 + temp2;
gSaveContext.skyboxTime = temp1 + temp2;
}
}
@ -1174,7 +1174,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
break;
case 119:
gSaveContext.dayTime = 0x8000;
gSaveContext.environmentTime = 0x8000;
gSaveContext.skyboxTime = 0x8000;
globalCtx->nextEntranceIndex = 0x05F0;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->fadeTransition = 3;
@ -1188,17 +1188,17 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs
f32 temp;
if ((csCtx->frames >= cmd->startFrame) && (csCtx->frames <= cmd->endFrame)) {
globalCtx->envCtx.unk_E1 = 1;
temp = func_8006F93C(cmd->endFrame, cmd->startFrame, csCtx->frames);
globalCtx->envCtx.fillScreen = true;
temp = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames);
switch (cmd->base) {
case 1:
case 5:
globalCtx->envCtx.unk_E2[0] = 0xA0;
globalCtx->envCtx.unk_E2[1] = 0xA0;
globalCtx->envCtx.unk_E2[2] = 0xA0;
globalCtx->envCtx.screenFillColor[0] = 160;
globalCtx->envCtx.screenFillColor[1] = 160;
globalCtx->envCtx.screenFillColor[2] = 160;
if (cmd->base == 1) {
globalCtx->envCtx.unk_E2[3] = 255.0f * temp;
globalCtx->envCtx.screenFillColor[3] = 255.0f * temp;
if ((temp == 0.0f) && (gSaveContext.entranceIndex == 0x006B)) {
Audio_PlaySoundGeneral(NA_SE_SY_WHITE_OUT_S, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
@ -1211,40 +1211,40 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs
func_800788CC(NA_SE_EV_WHITE_OUT);
}
} else {
globalCtx->envCtx.unk_E2[3] = (1.0f - temp) * 255.0f;
globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f;
}
break;
case 2:
case 6:
globalCtx->envCtx.unk_E2[0] = 0;
globalCtx->envCtx.unk_E2[1] = 0;
globalCtx->envCtx.unk_E2[2] = 0xFF;
globalCtx->envCtx.screenFillColor[0] = 0;
globalCtx->envCtx.screenFillColor[1] = 0;
globalCtx->envCtx.screenFillColor[2] = 255;
if (cmd->base == 2) {
globalCtx->envCtx.unk_E2[3] = 255.0f * temp;
globalCtx->envCtx.screenFillColor[3] = 255.0f * temp;
} else {
globalCtx->envCtx.unk_E2[3] = (1.0f - temp) * 255.0f;
globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f;
}
break;
case 3:
case 7:
globalCtx->envCtx.unk_E2[0] = 0xFF;
globalCtx->envCtx.unk_E2[1] = 0;
globalCtx->envCtx.unk_E2[2] = 0;
globalCtx->envCtx.screenFillColor[0] = 255;
globalCtx->envCtx.screenFillColor[1] = 0;
globalCtx->envCtx.screenFillColor[2] = 0;
if (cmd->base == 3) {
globalCtx->envCtx.unk_E2[3] = (1.0f - temp) * 255.0f;
globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f;
} else {
globalCtx->envCtx.unk_E2[3] = 255.0f * temp;
globalCtx->envCtx.screenFillColor[3] = 255.0f * temp;
}
break;
case 4:
case 8:
globalCtx->envCtx.unk_E2[0] = 0;
globalCtx->envCtx.unk_E2[1] = 0xFF;
globalCtx->envCtx.unk_E2[2] = 0;
globalCtx->envCtx.screenFillColor[0] = 0;
globalCtx->envCtx.screenFillColor[1] = 255;
globalCtx->envCtx.screenFillColor[2] = 0;
if (cmd->base == 4) {
globalCtx->envCtx.unk_E2[3] = (1.0f - temp) * 255.0f;
globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f;
} else {
globalCtx->envCtx.unk_E2[3] = 255.0f * temp;
globalCtx->envCtx.screenFillColor[3] = 255.0f * temp;
}
break;
case 9:
@ -1252,23 +1252,23 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs
break;
case 10:
case 11:
globalCtx->envCtx.unk_E2[0] = 0;
globalCtx->envCtx.unk_E2[1] = 0;
globalCtx->envCtx.unk_E2[2] = 0;
globalCtx->envCtx.screenFillColor[0] = 0;
globalCtx->envCtx.screenFillColor[1] = 0;
globalCtx->envCtx.screenFillColor[2] = 0;
if (cmd->base == 10) {
globalCtx->envCtx.unk_E2[3] = (1.0f - temp) * 255.0f;
globalCtx->envCtx.screenFillColor[3] = (1.0f - temp) * 255.0f;
} else {
globalCtx->envCtx.unk_E2[3] = 255.0f * temp;
globalCtx->envCtx.screenFillColor[3] = 255.0f * temp;
}
break;
case 12:
gSaveContext.unk_1410 = 255.0f - (155.0f * temp);
break;
case 13:
globalCtx->envCtx.unk_E2[0] = 0;
globalCtx->envCtx.unk_E2[1] = 0;
globalCtx->envCtx.unk_E2[2] = 0;
globalCtx->envCtx.unk_E2[3] = 255.0f - ((1.0f - temp) * 155.0f);
globalCtx->envCtx.screenFillColor[0] = 0;
globalCtx->envCtx.screenFillColor[1] = 0;
globalCtx->envCtx.screenFillColor[2] = 0;
globalCtx->envCtx.screenFillColor[3] = 255.0f - ((1.0f - temp) * 155.0f);
break;
}
}

View file

@ -56,7 +56,7 @@ void func_80026608(GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 159);
gDPPipeSync(POLY_OPA_DISP++);
POLY_OPA_DISP = func_800BC8A0(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 164);
}
@ -115,7 +115,7 @@ void func_80026A6C(GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 217);
gDPPipeSync(POLY_XLU_DISP++);
POLY_XLU_DISP = func_800BC8A0(globalCtx, POLY_XLU_DISP);
POLY_XLU_DISP = Gameplay_SetFog(globalCtx, POLY_XLU_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 222);
}

View file

@ -1036,7 +1036,7 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1594);
POLY_OPA_DISP = func_800BC8A0(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);
if (this->actor.params == ITEM00_BOMBS_SPECIAL) {
texIndex = 1;

View file

@ -7,7 +7,7 @@ void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) {
/**
* Frame advance allows you to advance through the game one frame at a time on command.
* To enable, hold R and press Dpad Down on the provided controller.
* To enable, hold R and press Dpad Down on the specified controller.
* To advance a frame, hold Z and press R.
* Holding Z and R will advance a frame every half second.
*

View file

@ -9,7 +9,7 @@ void GameOver_FadeInLights(GlobalContext* globalCtx) {
if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) ||
(gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) {
Kankyo_FadeInGameOverLights(globalCtx);
Environment_FadeInGameOverLights(globalCtx);
}
}
@ -74,7 +74,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
Kankyo_InitGameOverLights(globalCtx);
Environment_InitGameOverLights(globalCtx);
D_80153D80 = 20;
if (1) {}
v90 = VREG(90);
@ -103,7 +103,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
case GAMEOVER_REVIVE_START:
gameOverCtx->state++;
D_80153D80 = 0;
Kankyo_InitGameOverLights(globalCtx);
Environment_InitGameOverLights(globalCtx);
ShrinkWindow_SetVal(0x20);
return;
@ -139,7 +139,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
break;
case GAMEOVER_REVIVE_FADE_OUT:
Kankyo_FadeOutGameOverLights(globalCtx);
Environment_FadeOutGameOverLights(globalCtx);
D_80153D80--;
if (D_80153D80 == 0) {

File diff suppressed because it is too large Load diff

View file

@ -198,29 +198,29 @@ s32 Lights_FreeNode(LightNode* light) {
void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx) {
LightContext_InitList(globalCtx, lightCtx);
LightContext_SetAmbientColor(lightCtx, 80, 80, 80);
func_8007A698(lightCtx, 0, 0, 0, 0x3E4, 0x3200);
LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800);
bzero(&sLightsBuffer, sizeof(sLightsBuffer));
}
void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b) {
lightCtx->ambient.r = r;
lightCtx->ambient.g = g;
lightCtx->ambient.b = b;
lightCtx->ambientColor[0] = r;
lightCtx->ambientColor[1] = g;
lightCtx->ambientColor[2] = b;
}
void func_8007A698(LightContext* lightCtx, u8 arg1, u8 arg2, u8 arg3, s16 numLights, s16 arg5) {
lightCtx->unk_07 = arg1;
lightCtx->unk_08 = arg2;
lightCtx->unk_09 = arg3;
lightCtx->unk_0A = numLights;
lightCtx->unk_0C = arg5;
void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 fogNear, s16 fogFar) {
lightCtx->fogColor[0] = r;
lightCtx->fogColor[1] = g;
lightCtx->fogColor[2] = b;
lightCtx->fogNear = fogNear;
lightCtx->fogFar = fogFar;
}
/**
* Allocate a new Lights group and initilize the ambient color with that provided by LightContext
*/
Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) {
return Lights_New(gfxCtx, lightCtx->ambient.r, lightCtx->ambient.g, lightCtx->ambient.b);
return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]);
}
void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx) {

View file

@ -212,8 +212,8 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) {
interfaceCtx->mapRoomNum = 0;
}
if (gSaveContext.unk_1422 != 2) {
gSaveContext.unk_1422 = 0;
if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) {
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
}
}
@ -559,7 +559,7 @@ void Map_Update(GlobalContext* globalCtx) {
osSyncPrintf("階層切替=%x\n", interfaceCtx->mapRoomNum);
osSyncPrintf(VT_RST);
Map_InitData(globalCtx, interfaceCtx->mapRoomNum);
gSaveContext.unk_1422 = 0;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
Map_SavePlayerInitialInfo(globalCtx);
}
}

View file

@ -3789,7 +3789,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
void Interface_Update(GlobalContext* globalCtx) {
static u8 D_80125B60 = 0;
static s16 D_80125B64 = 0;
static s16 sPrevTimeIncrement = 0;
MessageContext* msgCtx = &globalCtx->msgCtx;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
Player* player = GET_PLAYER(globalCtx);
@ -4098,30 +4098,32 @@ void Interface_Update(GlobalContext* globalCtx) {
}
}
if (gSaveContext.unk_1422 != 0) {
if ((msgCtx->unk_E3F0 != 0x31) && (gSaveContext.unk_1422 == 1)) {
if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE) {
// exit out of ocarina mode after suns song finishes playing
if ((msgCtx->unk_E3F0 != 0x31) && (gSaveContext.sunsSongState == SUNSSONG_START)) {
globalCtx->msgCtx.unk_E3EE = 4;
}
if (globalCtx->envCtx.unk_02 != 0) {
if (gSaveContext.unk_1422 != 2) {
// handle suns song in areas where time moves
if (globalCtx->envCtx.timeIncrement != 0) {
if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) {
D_80125B60 = 0;
if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) {
D_80125B60 = 1;
}
gSaveContext.unk_1422 = 2;
D_80125B64 = D_8011FB40;
D_8011FB40 = 400;
gSaveContext.sunsSongState = SUNSSONG_SPEED_TIME;
sPrevTimeIncrement = gTimeIncrement;
gTimeIncrement = 400;
} else if (D_80125B60 == 0) {
if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) {
gSaveContext.unk_1422 = 0;
D_8011FB40 = D_80125B64;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gTimeIncrement = sPrevTimeIncrement;
globalCtx->msgCtx.unk_E3EE = 4;
}
} else if (gSaveContext.dayTime > 0xC001) {
gSaveContext.unk_1422 = 0;
D_8011FB40 = D_80125B64;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gTimeIncrement = sPrevTimeIncrement;
globalCtx->msgCtx.unk_E3EE = 4;
}
} else if ((globalCtx->roomCtx.curRoom.unk_03 != 1) && (interfaceCtx->restrictions.sunsSong != 3)) {
@ -4145,12 +4147,12 @@ void Interface_Update(GlobalContext* globalCtx) {
gSaveContext.respawnFlag = -2;
globalCtx->nextEntranceIndex = gSaveContext.entranceIndex;
globalCtx->sceneLoadFlag = 0x14;
gSaveContext.unk_1422 = 0;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
func_800F6964(30);
gSaveContext.seqIndex = 0xFF;
gSaveContext.nightSeqIndex = 0xFF;
} else {
gSaveContext.unk_1422 = 3;
gSaveContext.sunsSongState = SUNSSONG_SPECIAL;
}
}
}

View file

@ -135,9 +135,9 @@ void func_800BC88C(GlobalContext* globalCtx) {
globalCtx->transitionCtx.transitionType = -1;
}
Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* gfx) {
return Gfx_SetFog2(gfx, globalCtx->lightCtx.unk_07, globalCtx->lightCtx.unk_08, globalCtx->lightCtx.unk_09, 0,
globalCtx->lightCtx.unk_0A, 1000);
Gfx* Gameplay_SetFog(GlobalContext* globalCtx, Gfx* gfx) {
return Gfx_SetFog2(gfx, globalCtx->lightCtx.fogColor[0], globalCtx->lightCtx.fogColor[1],
globalCtx->lightCtx.fogColor[2], 0, globalCtx->lightCtx.fogNear, 1000);
}
void Gameplay_Destroy(GameState* thisx) {
@ -246,7 +246,7 @@ void Gameplay_Init(GameState* thisx) {
if (gSaveContext.nextDayTime != 0xFFFFU) {
gSaveContext.dayTime = gSaveContext.nextDayTime;
gSaveContext.environmentTime = gSaveContext.nextDayTime;
gSaveContext.skyboxTime = gSaveContext.nextDayTime;
}
if (gSaveContext.dayTime > 0xC000 || gSaveContext.dayTime < 0x4555) {
@ -306,8 +306,8 @@ void Gameplay_Init(GameState* thisx) {
if (gSaveContext.nextDayTime != 0xFFFF) {
if (gSaveContext.nextDayTime == 0x8001) {
gSaveContext.numDays++;
gSaveContext.unk_18++;
gSaveContext.totalDays++;
gSaveContext.bgsDayCount++;
gSaveContext.dogIsLost = true;
if (Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) ||
Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO)) {
@ -606,21 +606,21 @@ void Gameplay_Update(GlobalContext* globalCtx) {
switch (globalCtx->transitionMode) {
case 4:
D_801614C8 = 0;
globalCtx->envCtx.unk_E1 = 1;
globalCtx->envCtx.unk_E2[0] = 0xA0;
globalCtx->envCtx.unk_E2[1] = 0xA0;
globalCtx->envCtx.unk_E2[2] = 0xA0;
globalCtx->envCtx.fillScreen = true;
globalCtx->envCtx.screenFillColor[0] = 160;
globalCtx->envCtx.screenFillColor[1] = 160;
globalCtx->envCtx.screenFillColor[2] = 160;
if (globalCtx->sceneLoadFlag != -0x14) {
globalCtx->envCtx.unk_E2[3] = 0;
globalCtx->envCtx.screenFillColor[3] = 0;
globalCtx->transitionMode = 5;
} else {
globalCtx->envCtx.unk_E2[3] = 0xFF;
globalCtx->envCtx.screenFillColor[3] = 255;
globalCtx->transitionMode = 6;
}
break;
case 5:
globalCtx->envCtx.unk_E2[3] = (D_801614C8 / 20.0f) * 255.0f;
globalCtx->envCtx.screenFillColor[3] = (D_801614C8 / 20.0f) * 255.0f;
if (D_801614C8 >= 20 && 1) {
globalCtx->state.running = 0;
SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext);
@ -633,13 +633,13 @@ void Gameplay_Update(GlobalContext* globalCtx) {
break;
case 6:
globalCtx->envCtx.unk_E2[3] = (1 - D_801614C8 / 20.0f) * 255.0f;
globalCtx->envCtx.screenFillColor[3] = (1 - D_801614C8 / 20.0f) * 255.0f;
if (D_801614C8 >= 20 && 1) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->envCtx.unk_E1 = 0;
globalCtx->envCtx.fillScreen = false;
} else {
D_801614C8++;
}
@ -647,15 +647,15 @@ void Gameplay_Update(GlobalContext* globalCtx) {
case 7:
D_801614C8 = 0;
globalCtx->envCtx.unk_E1 = 1;
globalCtx->envCtx.unk_E2[0] = 0xAA;
globalCtx->envCtx.unk_E2[1] = 0xA0;
globalCtx->envCtx.unk_E2[2] = 0x96;
globalCtx->envCtx.fillScreen = true;
globalCtx->envCtx.screenFillColor[0] = 170;
globalCtx->envCtx.screenFillColor[1] = 160;
globalCtx->envCtx.screenFillColor[2] = 150;
if (globalCtx->sceneLoadFlag != -0x14) {
globalCtx->envCtx.unk_E2[3] = 0;
globalCtx->envCtx.screenFillColor[3] = 0;
globalCtx->transitionMode = 5;
} else {
globalCtx->envCtx.unk_E2[3] = 0xFF;
globalCtx->envCtx.screenFillColor[3] = 255;
globalCtx->transitionMode = 6;
}
break;
@ -683,12 +683,12 @@ void Gameplay_Update(GlobalContext* globalCtx) {
case 12:
if (globalCtx->sceneLoadFlag != -0x14) {
globalCtx->envCtx.unk_E6 = 1;
globalCtx->envCtx.sandstormState = 1;
globalCtx->transitionMode = 13;
} else {
globalCtx->envCtx.unk_E6 = 2;
globalCtx->envCtx.unk_E7 = 0xFF;
globalCtx->envCtx.unk_E8 = 0xFF;
globalCtx->envCtx.sandstormState = 2;
globalCtx->envCtx.sandstormPrimA = 255;
globalCtx->envCtx.sandstormEnvA = 255;
globalCtx->transitionMode = 13;
}
break;
@ -697,14 +697,14 @@ void Gameplay_Update(GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (globalCtx->sceneLoadFlag == -0x14) {
if (globalCtx->envCtx.unk_E7 < 0x6E) {
if (globalCtx->envCtx.sandstormPrimA < 110) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
}
} else {
if (globalCtx->envCtx.unk_E8 == 0xFF) {
if (globalCtx->envCtx.sandstormEnvA == 255) {
globalCtx->state.running = 0;
SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext);
gSaveContext.entranceIndex = globalCtx->nextEntranceIndex;
@ -716,9 +716,9 @@ void Gameplay_Update(GlobalContext* globalCtx) {
case 14:
if (globalCtx->sceneLoadFlag == -0x14) {
globalCtx->envCtx.unk_E6 = 4;
globalCtx->envCtx.unk_E7 = 0xFF;
globalCtx->envCtx.unk_E8 = 0xFF;
globalCtx->envCtx.sandstormState = 4;
globalCtx->envCtx.sandstormPrimA = 255;
globalCtx->envCtx.sandstormEnvA = 255;
// "It's here!!!!!!!!!"
LOG_STRING("来た!!!!!!!!!!!!!!!!!!!!!", "../z_play.c", 3471);
globalCtx->transitionMode = 15;
@ -731,7 +731,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (globalCtx->sceneLoadFlag == -0x14) {
if (globalCtx->envCtx.unk_E7 <= 0) {
if (globalCtx->envCtx.sandstormPrimA <= 0) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
@ -742,17 +742,17 @@ void Gameplay_Update(GlobalContext* globalCtx) {
case 16:
D_801614C8 = 0;
globalCtx->envCtx.unk_E1 = 1;
globalCtx->envCtx.unk_E2[0] = 0;
globalCtx->envCtx.unk_E2[1] = 0;
globalCtx->envCtx.unk_E2[2] = 0;
globalCtx->envCtx.unk_E2[3] = 0xFF;
globalCtx->envCtx.fillScreen = true;
globalCtx->envCtx.screenFillColor[0] = 0;
globalCtx->envCtx.screenFillColor[1] = 0;
globalCtx->envCtx.screenFillColor[2] = 0;
globalCtx->envCtx.screenFillColor[3] = 255;
globalCtx->transitionMode = 17;
break;
case 17:
if (gSaveContext.unk_1410 != 0) {
globalCtx->envCtx.unk_E2[3] = gSaveContext.unk_1410;
globalCtx->envCtx.screenFillColor[3] = gSaveContext.unk_1410;
if (gSaveContext.unk_1410 < 0x65) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
@ -813,11 +813,12 @@ void Gameplay_Update(GlobalContext* globalCtx) {
osSyncPrintf("FINISH=%d\n", globalCtx->actorCtx.freezeFlashTimer);
if ((globalCtx->actorCtx.freezeFlashTimer > 0) &&
((globalCtx->actorCtx.freezeFlashTimer % 2) != 0)) {
globalCtx->envCtx.unk_E1 = 1;
globalCtx->envCtx.unk_E2[0] = globalCtx->envCtx.unk_E2[1] = globalCtx->envCtx.unk_E2[2] = 150;
globalCtx->envCtx.unk_E2[3] = 80;
globalCtx->envCtx.fillScreen = true;
globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] =
globalCtx->envCtx.screenFillColor[2] = 150;
globalCtx->envCtx.screenFillColor[3] = 80;
} else {
globalCtx->envCtx.unk_E1 = 0;
globalCtx->envCtx.fillScreen = false;
}
} else {
if (1 && HREG(63)) {
@ -1031,8 +1032,8 @@ skip:
LOG_NUM("1", 1, "../z_play.c", 3816);
}
func_80070C24(globalCtx, &globalCtx->envCtx, &globalCtx->lightCtx, &globalCtx->pauseCtx, &globalCtx->msgCtx,
&globalCtx->gameOverCtx, globalCtx->state.gfxCtx);
Environment_Update(globalCtx, &globalCtx->envCtx, &globalCtx->lightCtx, &globalCtx->pauseCtx, &globalCtx->msgCtx,
&globalCtx->gameOverCtx, globalCtx->state.gfxCtx);
}
void Gameplay_DrawOverlayElements(GlobalContext* globalCtx) {
@ -1081,10 +1082,10 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
func_80095248(gfxCtx, 0, 0, 0);
if ((HREG(80) != 10) || (HREG(82) != 0)) {
POLY_OPA_DISP = func_800BC8A0(globalCtx, POLY_OPA_DISP);
POLY_XLU_DISP = func_800BC8A0(globalCtx, POLY_XLU_DISP);
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);
POLY_XLU_DISP = Gameplay_SetFog(globalCtx, POLY_XLU_DISP);
func_800AA460(&globalCtx->view, globalCtx->view.fovy, globalCtx->view.zNear, globalCtx->lightCtx.unk_0C);
func_800AA460(&globalCtx->view, globalCtx->view.fovy, globalCtx->view.zNear, globalCtx->lightCtx.fogFar);
func_800AAA50(&globalCtx->view, 15);
Matrix_MtxToMtxF(&globalCtx->view.viewing, &globalCtx->mf_11DA0);
@ -1092,12 +1093,8 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
Matrix_Mult(&globalCtx->mf_11D60, MTXMODE_NEW);
Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY);
Matrix_Get(&globalCtx->mf_11D60);
globalCtx->mf_11DA0.mf[3][2] = 0.0f;
globalCtx->mf_11DA0.mf[3][1] = 0.0f;
globalCtx->mf_11DA0.mf[3][0] = 0.0f;
globalCtx->mf_11DA0.mf[2][3] = 0.0f;
globalCtx->mf_11DA0.mf[1][3] = 0.0f;
globalCtx->mf_11DA0.mf[0][3] = 0.0f;
globalCtx->mf_11DA0.mf[0][3] = globalCtx->mf_11DA0.mf[1][3] = globalCtx->mf_11DA0.mf[2][3] =
globalCtx->mf_11DA0.mf[3][0] = globalCtx->mf_11DA0.mf[3][1] = globalCtx->mf_11DA0.mf[3][2] = 0.0f;
Matrix_Transpose(&globalCtx->mf_11DA0);
globalCtx->unk_11DE0 = Matrix_MtxFToMtx(Matrix_CheckFloats(&globalCtx->mf_11DA0, "../z_play.c", 4005),
Graph_Alloc(gfxCtx, sizeof(Mtx)));
@ -1165,12 +1162,12 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
if ((HREG(80) != 10) || (HREG(83) != 0)) {
if (globalCtx->skyboxId && (globalCtx->skyboxId != SKYBOX_UNSET_1D) &&
!globalCtx->envCtx.skyDisabled) {
!globalCtx->envCtx.skyboxDisabled) {
if ((globalCtx->skyboxId == SKYBOX_NORMAL_SKY) ||
(globalCtx->skyboxId == SKYBOX_CUTSCENE_MAP)) {
func_8006FC88(globalCtx->skyboxId, &globalCtx->envCtx, &globalCtx->skyboxCtx);
Environment_UpdateSkybox(globalCtx->skyboxId, &globalCtx->envCtx, &globalCtx->skyboxCtx);
SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId,
globalCtx->envCtx.unk_13, globalCtx->view.eye.x, globalCtx->view.eye.y,
globalCtx->envCtx.skyboxBlend, globalCtx->view.eye.x, globalCtx->view.eye.y,
globalCtx->view.eye.z);
} else if (globalCtx->skyboxCtx.unk_140 == 0) {
SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, 0,
@ -1181,17 +1178,17 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
if ((HREG(80) != 10) || (HREG(90) & 2)) {
if (!globalCtx->envCtx.sunMoonDisabled) {
func_800730DC(globalCtx);
Environment_DrawSunAndMoon(globalCtx);
}
}
if ((HREG(80) != 10) || (HREG(90) & 1)) {
func_80074D6C(globalCtx);
Environment_DrawSkyboxFilters(globalCtx);
}
if ((HREG(80) != 10) || (HREG(90) & 4)) {
func_800750C0(globalCtx);
func_8007542C(globalCtx, 0);
Environment_UpdateLightningStrike(globalCtx);
Environment_DrawLightning(globalCtx, 0);
}
if ((HREG(80) != 10) || (HREG(90) & 8)) {
@ -1226,11 +1223,11 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
}
if (globalCtx->envCtx.unk_EE[1] != 0) {
func_80074704(globalCtx, &globalCtx->view, gfxCtx);
Environment_DrawRain(globalCtx, &globalCtx->view, gfxCtx);
}
if ((HREG(80) != 10) || (HREG(84) != 0)) {
func_8007672C(gfxCtx, 0, 0, 0, globalCtx->unk_11E18, 1);
Environment_FillScreen(gfxCtx, 0, 0, 0, globalCtx->unk_11E18, FILL_SCREEN_OPA);
}
if ((HREG(80) != 10) || (HREG(85) != 0)) {
@ -1239,23 +1236,26 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
if ((HREG(80) != 10) || (HREG(86) != 0)) {
if (!globalCtx->envCtx.sunMoonDisabled) {
sp21C.x = globalCtx->view.eye.x + globalCtx->envCtx.unk_04.x;
sp21C.y = globalCtx->view.eye.y + globalCtx->envCtx.unk_04.y;
sp21C.z = globalCtx->view.eye.z + globalCtx->envCtx.unk_04.z;
func_80073988(globalCtx, &globalCtx->envCtx, &globalCtx->view, gfxCtx, sp21C, 0);
sp21C.x = globalCtx->view.eye.x + globalCtx->envCtx.sunPos.x;
sp21C.y = globalCtx->view.eye.y + globalCtx->envCtx.sunPos.y;
sp21C.z = globalCtx->view.eye.z + globalCtx->envCtx.sunPos.z;
Environment_DrawSunLensFlare(globalCtx, &globalCtx->envCtx, &globalCtx->view, gfxCtx, sp21C, 0);
}
func_80075E68(globalCtx);
Environment_DrawCustomLensFlare(globalCtx);
}
if ((HREG(80) != 10) || (HREG(87) != 0)) {
if (MREG(64) != 0) {
func_8007672C(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68), 3);
Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68),
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
}
switch (globalCtx->envCtx.unk_E1) {
switch (globalCtx->envCtx.fillScreen) {
case 1:
func_8007672C(gfxCtx, globalCtx->envCtx.unk_E2[0], globalCtx->envCtx.unk_E2[1],
globalCtx->envCtx.unk_E2[2], globalCtx->envCtx.unk_E2[3], 3);
Environment_FillScreen(
gfxCtx, globalCtx->envCtx.screenFillColor[0], globalCtx->envCtx.screenFillColor[1],
globalCtx->envCtx.screenFillColor[2], globalCtx->envCtx.screenFillColor[3],
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
break;
default:
break;
@ -1263,8 +1263,8 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
}
if ((HREG(80) != 10) || (HREG(88) != 0)) {
if (globalCtx->envCtx.unk_E6 != 0) {
func_80076934(globalCtx, globalCtx->envCtx.unk_E6);
if (globalCtx->envCtx.sandstormState != 0) {
Environment_DrawSandstorm(globalCtx, globalCtx->envCtx.sandstormState);
}
}
@ -1274,7 +1274,6 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
if ((R_PAUSE_MENU_MODE == 1) || (gTrnsnUnkState == 1)) {
Gfx* sp70 = OVERLAY_DISP;
s32 pad[4];
globalCtx->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer;
globalCtx->pauseBgPreRender.fbufSave = (u16*)gZBuffer;
@ -1303,7 +1302,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
Camera_Update(GET_ACTIVE_CAM(globalCtx));
func_800AB944(&globalCtx->view);
globalCtx->view.unk_124 = 0;
if (globalCtx->skyboxId && (globalCtx->skyboxId != SKYBOX_UNSET_1D) && !globalCtx->envCtx.skyDisabled) {
if (globalCtx->skyboxId && (globalCtx->skyboxId != SKYBOX_UNSET_1D) && !globalCtx->envCtx.skyboxDisabled) {
SkyboxDraw_UpdateMatrix(&globalCtx->skyboxCtx, globalCtx->view.eye.x, globalCtx->view.eye.y,
globalCtx->view.eye.z);
}
@ -1439,9 +1438,9 @@ void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
return allocp;
}
void Gameplay_InitSkybox(GlobalContext* globalCtx, s16 skyboxId) {
void Gameplay_InitEnvironment(GlobalContext* globalCtx, s16 skyboxId) {
Skybox_Init(globalCtx, &globalCtx->skyboxCtx, skyboxId);
func_8006F140(globalCtx, &globalCtx->envCtx, 0);
Environment_Init(globalCtx, &globalCtx->envCtx, 0);
}
void Gameplay_InitScene(GlobalContext* globalCtx, s32 spawn) {
@ -1460,7 +1459,7 @@ void Gameplay_InitScene(GlobalContext* globalCtx, s32 spawn) {
YREG(15) = 0;
gSaveContext.worldMapArea = 0;
Scene_ExecuteCommands(globalCtx, globalCtx->sceneSegment);
Gameplay_InitSkybox(globalCtx, globalCtx->skyboxId);
Gameplay_InitEnvironment(globalCtx, globalCtx->skyboxId);
}
void Gameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) {

View file

@ -847,51 +847,52 @@ Gfx gEmptyDL[] = {
gsSPEndDisplayList(),
};
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) {
if (f == n) {
f++;
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far) {
if (far == near) {
far++;
}
ASSERT(n != f, "n != f", "../z_rcp.c", 1155);
ASSERT(near != far, "n != f", "../z_rcp.c", 1155);
gDPSetFogColor(gfx++, r, g, b, a);
if (n >= 1000) {
if (near >= 1000) {
gSPFogFactor(gfx++, 0, 0);
} else if (n >= 997) {
} else if (near >= 997) {
gSPFogFactor(gfx++, 0x7FFF, 0x8100);
} else if (n < 0) {
} else if (near < 0) {
gSPFogFactor(gfx++, 0, 255);
} else {
gSPFogPosition(gfx++, n, f);
gSPFogPosition(gfx++, near, far);
}
return gfx;
}
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) {
if (f == n) {
f++;
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far) {
if (far == near) {
far++;
}
ASSERT(n != f, "n != f", "../z_rcp.c", 1187);
ASSERT(near != far, "n != f", "../z_rcp.c", 1187);
gDPPipeSync(gfx++);
gDPSetFogColor(gfx++, r, g, b, a);
if (n >= 1000) {
if (near >= 1000) {
gSPFogFactor(gfx++, 0, 0);
} else if (n >= 997) {
} else if (near >= 997) {
gSPFogFactor(gfx++, 0x7FFF, 0x8100);
} else if (n < 0) {
} else if (near < 0) {
gSPFogFactor(gfx++, 0, 255);
} else {
gSPFogPosition(gfx++, n, f);
gSPFogPosition(gfx++, near, far);
}
return gfx;
}
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) {
return Gfx_SetFog(gfx, r, g, b, a, n, f);
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far) {
return Gfx_SetFog(gfx, r, g, b, a, near, far);
}
Gfx* Gfx_CallSetupDLImpl(Gfx* gfx, u32 i) {

View file

@ -131,7 +131,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &sp90, &sp84, &sp80);
if (-(f32)polygonDlist->unk_06 < sp84.z) {
temp_f2 = sp84.z - polygonDlist->unk_06;
if (temp_f2 < globalCtx->lightCtx.unk_0C) {
if (temp_f2 < globalCtx->lightCtx.fogFar) {
phi_v0 = spB4;
spA4->unk_00 = polygonDlist;
spA4->unk_04 = temp_f2;

View file

@ -343,67 +343,63 @@ void func_80098CC8(GlobalContext* globalCtx, SceneCmd* cmd) {
// Scene Command 0x11: Skybox Settings
void func_80098D1C(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->skyboxId = cmd->skyboxSettings.skyboxId;
globalCtx->envCtx.gloomySky = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk_05;
globalCtx->envCtx.unk_1E = cmd->skyboxSettings.unk_06;
globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk_05;
globalCtx->envCtx.indoors = cmd->skyboxSettings.unk_06;
}
// Scene Command 0x12: Skybox Disables
void func_80098D5C(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.skyDisabled = cmd->skyboxDisables.unk_04;
globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04;
globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05;
}
// Scene Command 0x10: Time Settings
void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) {
u32 dayTime;
if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) {
gSaveContext.environmentTime = gSaveContext.dayTime =
((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / (360.0f / 0x4000);
gSaveContext.skyboxTime = gSaveContext.dayTime =
((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000);
}
if (cmd->timeSettings.unk_06 != 0xFF) {
globalCtx->envCtx.unk_02 = cmd->timeSettings.unk_06;
globalCtx->envCtx.timeIncrement = cmd->timeSettings.unk_06;
} else {
globalCtx->envCtx.unk_02 = 0;
globalCtx->envCtx.timeIncrement = 0;
}
if (gSaveContext.unk_1422 == 0) {
D_8011FB40 = globalCtx->envCtx.unk_02;
if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) {
gTimeIncrement = globalCtx->envCtx.timeIncrement;
}
dayTime = gSaveContext.dayTime;
globalCtx->envCtx.unk_04.x = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f;
dayTime = gSaveContext.dayTime;
globalCtx->envCtx.unk_04.y = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f;
dayTime = gSaveContext.dayTime;
globalCtx->envCtx.unk_04.z = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f;
globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f;
if (((globalCtx->envCtx.unk_02 == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
if (((globalCtx->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
(gSaveContext.entranceIndex == 0x0604)) {
gSaveContext.environmentTime = gSaveContext.dayTime;
if ((gSaveContext.environmentTime >= 0x2AAC) && (gSaveContext.environmentTime < 0x4555)) {
gSaveContext.environmentTime = 0x3556;
} else if ((gSaveContext.environmentTime >= 0x4555) && (gSaveContext.environmentTime < 0x5556)) {
gSaveContext.environmentTime = 0x5556;
} else if ((gSaveContext.environmentTime >= 0xAAAB) && (gSaveContext.environmentTime < 0xB556)) {
gSaveContext.environmentTime = 0xB556;
} else if ((gSaveContext.environmentTime >= 0xC001) && (gSaveContext.environmentTime < 0xCAAC)) {
gSaveContext.environmentTime = 0xCAAC;
gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime);
if ((gSaveContext.skyboxTime >= 0x2AAC) && (gSaveContext.skyboxTime < 0x4555)) {
gSaveContext.skyboxTime = 0x3556;
} else if ((gSaveContext.skyboxTime >= 0x4555) && (gSaveContext.skyboxTime < 0x5556)) {
gSaveContext.skyboxTime = 0x5556;
} else if ((gSaveContext.skyboxTime >= 0xAAAB) && (gSaveContext.skyboxTime < 0xB556)) {
gSaveContext.skyboxTime = 0xB556;
} else if ((gSaveContext.skyboxTime >= 0xC001) && (gSaveContext.skyboxTime < 0xCAAC)) {
gSaveContext.skyboxTime = 0xCAAC;
}
}
}
// Scene Command 0x05: Wind Settings
void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) {
s8 temp1 = cmd->windSettings.unk_04;
s8 temp2 = cmd->windSettings.unk_05;
s8 temp3 = cmd->windSettings.unk_06;
s8 x = cmd->windSettings.x;
s8 y = cmd->windSettings.y;
s8 z = cmd->windSettings.z;
globalCtx->envCtx.unk_A8 = temp1;
globalCtx->envCtx.unk_AA = temp2;
globalCtx->envCtx.unk_AC = temp3;
globalCtx->envCtx.unk_B0 = cmd->windSettings.unk_07;
globalCtx->envCtx.windDirection.x = x;
globalCtx->envCtx.windDirection.y = y;
globalCtx->envCtx.windDirection.z = z;
globalCtx->envCtx.windSpeed = cmd->windSettings.unk_07;
}
// Scene Command 0x13: Exit List
@ -501,13 +497,6 @@ void (*gSceneCmdHandlers[])(GlobalContext*, SceneCmd*) = {
func_80099140, func_8009918C, func_8009934C, func_800991A0, func_800993C0,
};
#define ROM_FILE(name) \
{ (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd }
#define ROM_FILE_EMPTY(name) \
{ (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomStart }
#define ROM_FILE_UNSET \
{ 0 }
RomFile sNaviMsgFiles[] = {
ROM_FILE(elf_message_field),
ROM_FILE(elf_message_ydan),

View file

@ -1088,10 +1088,10 @@ void func_80099BD8(GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5145);
if (gSaveContext.sceneSetupIndex == 5) {
D_8015FCF0 = 1;
D_8015FCF8.x = -20.0f;
D_8015FCF8.y = 1220.0f;
D_8015FCF8.z = -684.0f;
gCustomLensFlareOn = true;
gCustomLensFlarePos.x = -20.0f;
gCustomLensFlarePos.y = 1220.0f;
gCustomLensFlarePos.z = -684.0f;
D_8015FD06 = 10;
D_8015FD08 = 8.0f;
D_8015FD0C = 200;

View file

@ -63,8 +63,8 @@ typedef struct {
/* 0x08 */ s32 cutsceneIndex;
/* 0x0C */ u16 dayTime; // "zelda_time"
/* 0x10 */ s32 nightFlag;
/* 0x14 */ s32 numDays;
/* 0x18 */ s32 unk_18; // increments with numDays, gets reset by goron for bgs and one other use
/* 0x14 */ s32 totalDays;
/* 0x18 */ s32 unk_18; // increments with totalDays, gets reset by goron for bgs and one other use
/* 0x1C */ SaveInfo info; // "information"
} Save; // size = 0x1354
@ -161,8 +161,8 @@ void Sram_InitNewSave(void) {
SaveContext* temp = &gSaveContext;
bzero(&SAVE_INFO, sizeof(SaveInfo));
gSaveContext.numDays = 0;
gSaveContext.unk_18 = 0;
gSaveContext.totalDays = 0;
gSaveContext.bgsDayCount = 0;
SAVE_PLAYER_DATA = sNewSavePlayerData;
gSaveContext.equips = sNewSaveEquips;
@ -250,8 +250,8 @@ void Sram_InitDebugSave(void) {
SaveContext* temp = &gSaveContext;
bzero(&SAVE_INFO, sizeof(SaveInfo));
gSaveContext.numDays = 0;
gSaveContext.unk_18 = 0;
gSaveContext.totalDays = 0;
gSaveContext.bgsDayCount = 0;
SAVE_PLAYER_DATA = sDebugSavePlayerData;
gSaveContext.equips = sDebugSaveEquips;
@ -561,8 +561,8 @@ void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChooseCtx, SramContext* s
// note that gSaveContext.dayTime is not actually the sizeof(s32)
bzero(&gSaveContext.dayTime, sizeof(s32));
bzero(&gSaveContext.nightFlag, sizeof(s32));
bzero(&gSaveContext.numDays, sizeof(s32));
bzero(&gSaveContext.unk_18, sizeof(s32));
bzero(&gSaveContext.totalDays, sizeof(s32));
bzero(&gSaveContext.bgsDayCount, sizeof(s32));
if (!slotNum) {
Sram_InitDebugSave();

View file

@ -1,5 +1,6 @@
#include "global.h"
#include "vt.h"
#include "z64environment.h"
typedef struct {
/* 0x000 */ s32 unk_0;
@ -11,17 +12,7 @@ typedef struct {
extern Struct_8012AF0C D_8012AF0C[6];
extern Struct_8012AF0C D_8012AEBC[4];
typedef struct {
/* 0x00 */ u16 unk_0; // start
/* 0x02 */ u16 unk_2; // end
/* 0x04 */ u8 unk_4;
/* 0x05 */ u8 unk_5; // img idx 1
/* 0x06 */ u8 unk_6; // img idx 2
/* 0x07 */ char unk_7[0x1];
} Struct_8011FC1C; // size = 0x8
extern Struct_8011FC1C D_8011FC1C[8][9];
extern struct_8011FC1C D_8011FC1C[][9];
typedef struct {
/* 0x00 */ u32 unk_0; // start
@ -30,8 +21,6 @@ typedef struct {
/* 0x0C */ u32 unk_C; // pal end
} Struct_8011FD3C; // size = 0x10
extern Struct_8011FD3C D_8011FD3C[];
s32 func_800ADBB0(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32, UNK_TYPE, UNK_TYPE, UNK_TYPE, UNK_TYPE, UNK_TYPE, s32,
s32);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800ADBB0.s")
@ -85,64 +74,69 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
switch (skyboxId) {
case SKYBOX_NORMAL_SKY:
phi_v1 = 0;
if (gSaveContext.unk_13C3 != 0 && gSaveContext.sceneSetupIndex < 4 && D_8011FB30 > 0 && D_8011FB30 < 6) {
if (gSaveContext.unk_13C3 != 0 && gSaveContext.sceneSetupIndex < 4 && gWeatherMode > 0 &&
gWeatherMode < 6) {
phi_v1 = 1;
}
for (i = 0; i < 9; i++) {
if (gSaveContext.environmentTime >= D_8011FC1C[phi_v1][i].unk_0 &&
(gSaveContext.environmentTime < D_8011FC1C[phi_v1][i].unk_2 ||
D_8011FC1C[phi_v1][i].unk_2 == 0xFFFF)) {
globalCtx->envCtx.unk_10 = sp41 = D_8011FC1C[phi_v1][i].unk_5;
globalCtx->envCtx.unk_11 = sp40 = D_8011FC1C[phi_v1][i].unk_6;
if (D_8011FC1C[phi_v1][i].unk_4 != 0) {
globalCtx->envCtx.unk_13 =
func_8006F93C(D_8011FC1C[phi_v1][i].unk_2, D_8011FC1C[phi_v1][i].unk_0,
((void)0, gSaveContext.environmentTime)) *
if (gSaveContext.skyboxTime >= D_8011FC1C[phi_v1][i].startTime &&
(gSaveContext.skyboxTime < D_8011FC1C[phi_v1][i].endTime ||
D_8011FC1C[phi_v1][i].endTime == 0xFFFF)) {
globalCtx->envCtx.skybox1Index = sp41 = D_8011FC1C[phi_v1][i].skybox1Index;
globalCtx->envCtx.skybox2Index = sp40 = D_8011FC1C[phi_v1][i].skybox2Index;
if (D_8011FC1C[phi_v1][i].blend != 0) {
globalCtx->envCtx.skyboxBlend =
Environment_LerpWeight(D_8011FC1C[phi_v1][i].endTime, D_8011FC1C[phi_v1][i].startTime,
((void)0, gSaveContext.skyboxTime)) *
255.0f;
} else {
globalCtx->envCtx.unk_13 = 0;
globalCtx->envCtx.skyboxBlend = 0;
}
break;
}
}
size = D_8011FD3C[sp41].unk_4 - D_8011FD3C[sp41].unk_0;
size = gSkyboxFiles[sp41].file.vromEnd - gSkyboxFiles[sp41].file.vromStart;
skyboxCtx->staticSegments[0] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1054);
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
1055);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[0], D_8011FD3C[sp41].unk_0, size, "../z_vr_box.c", 1058);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[0], gSkyboxFiles[sp41].file.vromStart, size, "../z_vr_box.c",
1058);
size = D_8011FD3C[sp40].unk_4 - D_8011FD3C[sp40].unk_0;
size = gSkyboxFiles[sp40].file.vromEnd - gSkyboxFiles[sp40].file.vromStart;
skyboxCtx->staticSegments[1] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1060);
ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c",
1061);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[1], D_8011FD3C[sp40].unk_0, size, "../z_vr_box.c", 1064);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[1], gSkyboxFiles[sp40].file.vromStart, size, "../z_vr_box.c",
1064);
// reorderings in the rest of this case
if (((u8)(sp41 & 4) >> 2) != (sp41 & 1)) {
size = D_8011FD3C[sp41].unk_C - D_8011FD3C[sp41].unk_8;
size = gSkyboxFiles[sp41].pallete.vromEnd - gSkyboxFiles[sp41].pallete.vromStart;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1072);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1073);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], D_8011FD3C[sp41].unk_8, size, "../z_vr_box.c", 1075);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, D_8011FD3C[sp40].unk_8, size,
"../z_vr_box.c", 1077);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], gSkyboxFiles[sp41].pallete.vromStart, size,
"../z_vr_box.c", 1075);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, gSkyboxFiles[sp40].pallete.vromStart,
size, "../z_vr_box.c", 1077);
} else {
size = D_8011FD3C[sp41].unk_C - D_8011FD3C[sp41].unk_8;
size = gSkyboxFiles[sp41].pallete.vromEnd - gSkyboxFiles[sp41].pallete.vromStart;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1085);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1086);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], D_8011FD3C[sp40].unk_8, size, "../z_vr_box.c", 1088);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, D_8011FD3C[sp41].unk_8, size,
"../z_vr_box.c", 1090);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], gSkyboxFiles[sp40].pallete.vromStart, size,
"../z_vr_box.c", 1088);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, gSkyboxFiles[sp41].pallete.vromStart,
size, "../z_vr_box.c", 1090);
}
break;

View file

@ -11,7 +11,7 @@ Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
return Matrix_ToMtx(sSkyboxDrawMatrix, "../z_vr_box_draw.c", 42);
}
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 alpha, f32 x, f32 y, f32 z) {
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
OPEN_DISPS(gfxCtx, "../z_vr_box_draw.c", 52);
func_800945A0(gfxCtx);
@ -20,7 +20,7 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb
gSPSegment(POLY_OPA_DISP++, 0x8, skyboxCtx->staticSegments[1]);
gSPSegment(POLY_OPA_DISP++, 0x9, skyboxCtx->staticSegments[2]);
gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 0, 0, 0, alpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 0, 0, 0, blend);
gSPTexture(POLY_OPA_DISP++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
sSkyboxDrawMatrix = Graph_Alloc(gfxCtx, sizeof(Mtx));