diff --git a/include/functions.h b/include/functions.h index 86d3be8a87..7d06ad159e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1336,6 +1336,7 @@ s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* tors void SaveContext_Init(void); void GameInfo_Init(void); DebugDispObject* DebugDisplay_Init(void); +void DebugDisplay_DrawObjects(PlayState* play); DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, GraphicsContext* gfxCtx); // void func_800E9C90(void); // void func_800E9CA0(s32 param_1, UNK_TYPE1 param_2, s8* param_3); @@ -1435,7 +1436,7 @@ void Kankyo_Init(PlayState* play, EnvironmentContext* envCtx, s32 arg2); u32 func_800F5954(u8* param_1, u32 param_2, u32 param_3, u8 param_4, u8 param_5); f32 Environment_LerpWeight(u16 max, u16 min, u16 val); // void func_800F5B10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); -// void func_800F5CD0(void); +void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxContext* skyboxCtx); void func_800F6834(PlayState* play, s32 waterLightsIndex); void func_800F694C(PlayState* play); // void func_800F6A04(void); @@ -1454,11 +1455,11 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex PauseContext* pauseCtx, MessageContext* msgCtx, GameOverContext* gameOverCtx, GraphicsContext* gfxCtx); // void func_800F8D84(void); -// void func_800F9728(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); +void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f pos); void func_800F9824(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f vec, f32 arg5, f32 arg6, s8 arg7, s8 arg8); // void func_800FA39C(void); // void func_800FA3C4(void); -// void func_800FA9FC(void); +void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx); void func_800FAAB4(PlayState* play, u8 arg1); // void func_800FAC20(void); // void func_800FAF74(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5); @@ -1467,13 +1468,13 @@ void Environment_AddLightningBolts(PlayState* play, u8 num); // void func_800FB388(void); void func_800FB758(PlayState* play); // void func_800FB9B4(void); -// void func_800FBCBC(void); +void Environment_DrawCustomLensFlare(PlayState* play); void Kankyo_InitGameOverLights(PlayState* play); void Kankyo_FadeInGameOverLights(PlayState* play); void Kankyo_FadeOutGameOverLights(PlayState* play); // void func_800FC3DC(void); -void func_800FC444(GraphicsContext* gfxCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4, UNK_TYPE arg5); -// void func_800FC64C(void); +void Environment_FillScreen(GraphicsContext* gfxCtx, u8 red, u8 green, u8 blue, u8 alpha, u8 drawFlags); +void Environment_DrawSandstorm(PlayState* play, u8 sandstormState); s32 func_800FD2B4(PlayState* play, f32 arg1, f32 arg2, f32 arg3, f32 arg4); void func_800FD538(Color_RGB8* param_1, Color_RGB8* param_2, f32 param_3, Vec3s* param_4); void func_800FD59C(PlayState* play, Color_RGB8* pzParm2, f32 fParm3); @@ -1491,8 +1492,8 @@ void func_800FD928(s32 param_1); // void func_800FD980(void); // void func_800FDAF8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void func_800FDC94(void); -// void func_800FE390(void); -// void func_800FE3E0(void); +void func_800FE390(PlayState* play); +void func_800FE3E0(PlayState* play); void func_800FE484(void); void func_800FE498(void); // void func_800FE4A8(void); @@ -2158,7 +2159,7 @@ void Scene_SetExitFade(PlayState* play); s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header); u16 Entrance_Create(s32 scene, s32 spawn, s32 layer); u16 Entrance_CreateFromSpawn(s32 spawn); -void Scene_ExecuteDrawConfig(PlayState* play); +void Scene_Draw(PlayState* play); void Scene_DrawConfigDefault(PlayState* play); Gfx* AnimatedMat_TexScroll(PlayState* play, AnimatedMatTexScrollParams* params); void AnimatedMat_DrawTexScroll(PlayState* play, s32 segment, void* params); @@ -2503,7 +2504,7 @@ void func_80163D80(TransitionContext* transitionCtx, PlayState* play); void TransitionUnk_Destroy(FbDemoStruct* this); FbDemoStruct* TransitionUnk_Init(FbDemoStruct* this, s32 row, s32 col); // void func_80164438(void); -// void func_8016454C(void); +void TransitionUnk_Draw(FbDemoStruct* this, Gfx**); // void func_80164678(void); void func_801647AC(FbDemoStruct* this); // UNK_TYPE4 func_801647B8(void); @@ -2511,7 +2512,7 @@ void func_801647AC(FbDemoStruct* this); void* TransitionFade_Init(TransitionFade* arg0); void TransitionFade_Destroy(TransitionFade* arg0); void TransitionFade_Update(TransitionFade* thisx, s32 updateRate); -// void TransitionFade_Draw(void); +void TransitionFade_Draw(void* thisx, Gfx** gfxP); // void TransitionFade_IsDone(void); void TransitionFade_SetColor(TransitionFade* arg0, u32 color); void TransitionFade_SetType(TransitionFade* arg0, s32 arg1); diff --git a/include/variables.h b/include/variables.h index ed451ee39e..44958bd1b2 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3196,7 +3196,7 @@ extern Input D_801F6C18; // extern UNK_TYPE1 D_801F6D0C; extern UNK_TYPE4 gTrnsnUnkState; // extern UNK_TYPE1 D_801F6D18; -extern Color_RGBA8 gVisMonoColor; +extern Color_RGBA8_u32 gVisMonoColor; // extern UNK_TYPE1 D_801F6D38; // extern UNK_TYPE4 D_801F6D4C; // extern UNK_TYPE1 D_801F6D50; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index da2b70292d..fb2b41c489 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2411,7 +2411,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { params.player = player; params.play = play; - if (play->unk_18844 != 0) { + if (play->unk_18844) { params.unk_18 = ACTOR_FLAG_200000; } else { params.unk_18 = ACTOR_FLAG_200000 | ACTOR_FLAG_40 | ACTOR_FLAG_10; @@ -2850,7 +2850,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { s32 actorFlags; s32 i; - if (play->unk_18844 != 0) { + if (play->unk_18844) { actorFlags = ACTOR_FLAG_200000; } else { actorFlags = ACTOR_FLAG_200000 | ACTOR_FLAG_40 | ACTOR_FLAG_20; @@ -2921,7 +2921,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { gSPBranchList(ref2, &tmp2[1]); POLY_XLU_DISP = &tmp2[1]; - if (play->unk_18844 == 0) { + if (!play->unk_18844) { Lights_DrawGlow(play); } diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index afb1ae830b..c145087a24 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -11,7 +11,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80164438.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_8016454C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/TransitionUnk_Draw.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80164678.s") diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 492eff0c0b..81fc6c46e4 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -12,7 +12,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F5B10.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F5CD0.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_UpdateSkybox.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F6834.s") @@ -46,7 +46,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F8D84.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F9728.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawSunLensFlare.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F9824.s") @@ -54,7 +54,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FA3C4.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FA9FC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawRain.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FAAB4.s") @@ -72,7 +72,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FB9B4.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBCBC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawCustomLensFlare.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s") @@ -82,9 +82,9 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC3DC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC444.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_FillScreen.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC64C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawSandstorm.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FD2B4.s") diff --git a/src/code/z_play.c b/src/code/z_play.c index 3c02a51758..1e9ff69726 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -5,6 +5,8 @@ #include "overlays/gamestates/ovl_file_choose/z_file_choose.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" +extern Gfx D_0E000140[]; + s32 gDbgCamEnabled = false; u8 D_801D0D54 = false; @@ -15,7 +17,7 @@ extern FbDemoStruct sTrnsnUnk; extern u16* D_801F6D0C; extern s32 gTrnsnUnkState; extern VisMono D_801F6D18; -extern Color_RGBA8 gVisMonoColor; +extern Color_RGBA8_u32 gVisMonoColor; extern Struct_80140E80 D_801F6D38; extern Struct_80140E80* D_801F6D4C; extern HiresoStruct D_801F6D50; @@ -1129,7 +1131,303 @@ void Play_DrawOverlayElements(PlayState* this) { } } +#ifdef NON_MATCHING +void Play_Draw(PlayState* this) { + GraphicsContext* gfxCtx = this->state.gfxCtx; + Lights* sp268; + Vec3f sp25C; + u8 sp25B = false; + f32 var_fv0; // fogFar + + if (SREG(94) >= 4) { + PreRender_ApplyFiltersSlowlyDestroy(&this->pauseBgPreRender); + SREG(94) = 0; + } + + if ((SREG(94) < 2) && (gTrnsnUnkState < 2)) { + if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.currRoom.mesh->type0.type == 1)) { + func_8012CF0C(gfxCtx, 0, 1, 0, 0, 0); + } else { + func_8012CF0C(gfxCtx, 1, 1, this->lightCtx.unk7, this->lightCtx.unk8, this->lightCtx.unk9); + } + } else { + func_8012CF0C(gfxCtx, 0, 0, 0, 0, 0); + } + + OPEN_DISPS(gfxCtx); + + gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); + gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment); + gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + + gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); + gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment); + + gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment); + gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment); + + gSPSegment(POLY_OPA_DISP++, 0x02, this->sceneSegment); + gSPSegment(POLY_XLU_DISP++, 0x02, this->sceneSegment); + gSPSegment(OVERLAY_DISP++, 0x02, this->sceneSegment); + + ShrinkWindow_Draw(gfxCtx); + + POLY_OPA_DISP = func_801660B8(this, POLY_OPA_DISP); + POLY_XLU_DISP = func_801660B8(this, POLY_XLU_DISP); + + // fogFar + var_fv0 = this->lightCtx.unkC; + if (var_fv0 > 12800.0f) { + var_fv0 = 12800.0f; + } + + func_8013F0D0(&this->view, this->view.fovy, this->view.zNear, var_fv0); + + View_RenderView(&this->view, 0xF); + + Matrix_MtxToMtxF(&this->view.viewing, &this->billboardMtxF); + Matrix_MtxToMtxF(&this->view.projection, &this->viewProjectionMtxF); + + this->unk_187F0.x = this->viewProjectionMtxF.xx; + this->unk_187F0.y = this->viewProjectionMtxF.yy; + this->unk_187F0.z = -this->viewProjectionMtxF.zz; + + SkinMatrix_MtxFMtxFMult(&this->viewProjectionMtxF, &this->billboardMtxF, &this->viewProjectionMtxF); + + this->billboardMtxF.mf[3][2] = + (this->billboardMtxF.mf[3][1] = + (this->billboardMtxF.mf[3][0] = + (this->billboardMtxF.mf[2][3] = + (this->billboardMtxF.mf[1][3] = (this->billboardMtxF.mf[0][3] = 0.0f))))); + + Matrix_Transpose(&this->billboardMtxF); + + this->billboardMtx = GRAPH_ALLOC(this->state.gfxCtx, 0x80); + + Matrix_MtxFToMtx(&this->billboardMtxF, this->billboardMtx); + Matrix_RotateYF(((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(this)) + 0x8000)) * 0.0000958738f, MTXMODE_NEW); + Matrix_ToMtx(this->billboardMtx + 1); + + gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx); + gSPSegment(POLY_XLU_DISP++, 0x01, this->billboardMtx); + gSPSegment(OVERLAY_DISP++, 0x01, this->billboardMtx); + + if (1) { + Gfx* sp218; + Gfx* sp214 = POLY_OPA_DISP; + + sp218 = Graph_GfxPlusOne(sp214); + gSPDisplayList(OVERLAY_DISP++, sp218); + + if (((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) || (this->transitionMode == TRANS_TYPE_INSTANT)) || + D_801D0D54) { + View spA8; + + View_Init(&spA8, gfxCtx); + spA8.flags = 0xA; + + SET_FULLSCREEN_VIEWPORT(&spA8); + + func_801400CC(&spA8, &sp218); + this->transitionCtx.draw(&this->transitionCtx.instanceData, &sp218); + } + + TransitionFade_Draw(&this->unk_18E48, &sp218); + + if (gVisMonoColor.a != 0) { + D_801F6D18.primColor.rgba = gVisMonoColor.rgba; + VisMono_Draw(&D_801F6D18, &sp218); + } + + gSPEndDisplayList(sp218++); + Graph_BranchDlist(sp214, sp218); + POLY_OPA_DISP = sp218; + } + + if (gTrnsnUnkState == 3) { + Gfx* sp90 = POLY_OPA_DISP; + + TransitionUnk_Draw(&sTrnsnUnk, &sp90); + POLY_OPA_DISP = sp90; + sp25B = true; + goto Play_Draw_DrawOverlayElements; + } + + PreRender_SetValues(&this->pauseBgPreRender, D_801FBBCC, D_801FBBCE, gfxCtx->curFrameBuffer, gfxCtx->zbuffer); + + if (SREG(94) == 2) { + MsgEvent_SendNullTask(); + if (!gSaveContext.screenScaleFlag) { + PreRender_ApplyFiltersSlowlyInit(&this->pauseBgPreRender); + } + SREG(94) = 3; + SREG(33) |= 1; + } else { + if (SREG(94) == 3) { + Gfx* sp8C = POLY_OPA_DISP; + + if (this->pauseBgPreRender.unk_4D == 2) { + func_80170B28(&this->pauseBgPreRender, &sp8C); + } else { + func_80170798(&this->pauseBgPreRender, &sp8C); + } + + gSPDisplayList(sp8C++, D_0E000140); + POLY_OPA_DISP = sp8C; + sp25B = true; + goto Play_Draw_DrawOverlayElements; + } + + if (!this->unk_18844) { + if (this->skyboxId && !this->envCtx.skyboxDisabled) { + if ((this->skyboxId == 1) || (this->skyboxId == 3)) { + Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx); + SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, this->envCtx.unk_13, this->view.eye.x, + this->view.eye.y, this->view.eye.z); + } else if (!this->skyboxCtx.skyboxShouldDraw) { + SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x, this->view.eye.y, + this->view.eye.z); + } + } + + func_800FE390(this); + sp268 = LightContext_NewLights(&this->lightCtx, gfxCtx); + + if (this->roomCtx.currRoom.enablePosLights || (MREG(93) != 0)) { + sp268->enablePosLights = true; + } + + Lights_BindAll(sp268, this->lightCtx.listHead, NULL, this); + Lights_Draw(sp268, gfxCtx); + + Scene_Draw(this); + + if (this->roomCtx.unk78) { + //! FAKE: Regalloc around here. s64 solves the regalloc, + // but much too large on the stack. Need: + // `if (stuff that evaluates to 0 but not trivially)` + s64 roomDrawFlags = 3; + + Room_Draw(this, &this->roomCtx.currRoom, roomDrawFlags); + Room_Draw(this, &this->roomCtx.prevRoom, roomDrawFlags); + } + + if (this->skyboxCtx.skyboxShouldDraw) { + Vec3f sp78; + + if (1) {} + Camera_GetQuakeOffset(&sp78, GET_ACTIVE_CAM(this)); + SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp78.x, + this->view.eye.y + sp78.y, this->view.eye.z + sp78.z); + } + + // envCtx.precipitation[PRECIP_RAIN_CUR] + if (this->envCtx.unk_F2[1] != 0) { + Environment_DrawRain(this, &this->view, gfxCtx); + } + } + + Environment_FillScreen(gfxCtx, 0, 0, 0, this->bgCoverAlpha, 1); + + Actor_DrawAll(this, &this->actorCtx); + + if (!this->envCtx.sunMoonDisabled) { + sp25C.x = this->view.eye.x + this->envCtx.unk_4; + sp25C.y = this->view.eye.y + this->envCtx.unk_8; + sp25C.z = this->view.eye.z + this->envCtx.unk_C; + Environment_DrawSunLensFlare(this, &this->envCtx, &this->view, gfxCtx, sp25C); + } + + Environment_DrawCustomLensFlare(this); + + if (MREG(64) != 0) { + Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68), 3); + } + + switch (this->envCtx.fillScreen) { + case 1: + Environment_FillScreen(gfxCtx, this->envCtx.screenFillColor[0], this->envCtx.screenFillColor[1], + this->envCtx.screenFillColor[2], this->envCtx.screenFillColor[3], 3); + break; + default: + break; + } + + if (this->envCtx.sandstormState != 0) { + Environment_DrawSandstorm(this, this->envCtx.sandstormState); + } + + if (this->unk_18876 != 0) { + Environment_FillScreen(gfxCtx, 0, 0, 0, this->unk_18876, 3); + } + + DebugDisplay_DrawObjects(this); + func_80165460(this); + + if (((SREG(94) == 1) || (gTrnsnUnkState == 1)) || (SREG(89) == 1)) { + Gfx* sp74; + Gfx* sp70 = POLY_OPA_DISP; + + sp74 = Graph_GfxPlusOne(sp70); + gSPDisplayList(OVERLAY_DISP++, sp74); + this->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer; + + if (SREG(94) == 1) { + SREG(94) = 2; + this->pauseBgPreRender.fbufSave = (u16*)gfxCtx->zbuffer; + this->pauseBgPreRender.cvgSave = this->unk_18E58; + } else if (SREG(89) == 1) { + SREG(89) = 2; + this->pauseBgPreRender.fbufSave = (u16*)gfxCtx->zbuffer; + this->pauseBgPreRender.cvgSave = this->unk_18E58; + } else { + gTrnsnUnkState = 2; + this->pauseBgPreRender.fbufSave = (u16*)gfxCtx->zbuffer; + this->pauseBgPreRender.cvgSave = NULL; + } + + func_801705B4(&this->pauseBgPreRender, &sp74); + + if (this->pauseBgPreRender.cvgSave != NULL) { + func_80170730(&this->pauseBgPreRender, &sp74); + } + + gSPEndDisplayList(sp74++); + Graph_BranchDlist(sp70, sp74); + POLY_OPA_DISP = sp74; + this->unk_18B49 = 2; + SREG(33) |= 1; + } else { + Play_Draw_DrawOverlayElements: + Play_DrawOverlayElements(this); + } + } + + //! Fake: regalloc around here + if (this && this && this) {} + + if ((this->view.unk164 != 0) && !gDbgCamEnabled) { + Vec3s sp4C; + + Camera_Update(&sp4C, GET_ACTIVE_CAM(this)); + func_80140024(&this->view); + this->view.unk164 = 0; + if ((this->skyboxId != 0) && !this->envCtx.skyboxDisabled) { + SkyboxDraw_UpdateMatrix(&this->skyboxCtx, this->view.eye.x, this->view.eye.y, this->view.eye.z); + } + } + + if (!sp25B) { + func_800FE3E0(this); + } + + CLOSE_DISPS(this->state.gfxCtx); +} +#else #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Draw.s") +#endif void func_80168DAC(PlayState* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; @@ -1973,7 +2271,7 @@ void Play_Init(GameState* thisx) { this->unk_18876 = 0; this->bgCoverAlpha = 0; this->haltAllActors = false; - this->unk_18844 = 0; + this->unk_18844 = false; if (gSaveContext.gameMode != 1) { if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) { diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c index 8ddde8a825..d5224067a8 100644 --- a/src/code/z_scene_proc.c +++ b/src/code/z_scene_proc.c @@ -22,7 +22,7 @@ static Gfx sSceneDrawDefaultDL[] = { /** * Executes the current scene draw config handler. */ -void Scene_ExecuteDrawConfig(PlayState* play) { +void Scene_Draw(PlayState* play) { static void (*sceneDrawConfigHandlers[])(PlayState*) = { Scene_DrawConfigDefault, Scene_DrawConfigMatAnim, diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index ae5dcb5700..c99d008a64 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -398,7 +398,7 @@ void func_80A916F0(EnTest6* this, PlayState* play) { Player* player = GET_PLAYER(play); player->actor.freezeTimer = 0; - play->unk_18844 = 0; + play->unk_18844 = false; ActorCutscene_Stop(play->playerActorCsIds[8]); func_800B7298(play, NULL, 6); func_80A90C34(); @@ -470,7 +470,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { func_80A90C08(0x78); Distortion_SetType(0x20); Distortion_SetCountdown(80); - play->unk_18844 = 1; + play->unk_18844 = true; this->unk_274 = 95; } break; @@ -524,7 +524,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { this->unk_14C = 0.1f; func_80A90C34(); Distortion_ClearType(0x20); - play->unk_18844 = 0; + play->unk_18844 = false; if (this->unk_254 != NULL) { ZeldaArena_Free(this->unk_254); } @@ -619,7 +619,7 @@ void func_80A92118(EnTest6* this, PlayState* play) { Player* player = GET_PLAYER(play); player->actor.freezeTimer = 0; - play->unk_18844 = 0; + play->unk_18844 = false; ActorCutscene_Stop(play->playerActorCsIds[8]); func_800B7298(play, NULL, 6); func_80A90C34(); @@ -662,7 +662,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { func_800FD5E0(play, &D_80A94070, 1.0f); func_800FD654(play, &D_80A94068, 1.0f); func_800FD698(play, D_80A94074, D_80A94078, 1.0f); - play->unk_18844 = 1; + play->unk_18844 = true; } if (this->unk_27A == 15) { @@ -670,7 +670,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { func_800FD5E0(play, &D_80A94070, 0.0f); func_800FD654(play, &D_80A94068, 0.0f); func_800FD698(play, D_80A94074, D_80A94078, 0.0f); - play->unk_18844 = 0; + play->unk_18844 = false; } if (this->unk_286 >= 20) { @@ -678,7 +678,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { func_800FD5E0(play, &D_80A94070, this->unk_160); func_800FD654(play, &D_80A94068, this->unk_160); func_800FD698(play, D_80A94074, D_80A94078, this->unk_160); - play->unk_18844 = 0; + play->unk_18844 = false; } func_800B8F98(&player->actor, NA_SE_PL_FLYING_AIR - SFX_FLAG); diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index 83e92d2770..6c6f3bd0fe 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -438,7 +438,7 @@ void func_80AF19A8(EnTest7* this, PlayState* play) { } else { ActorCutscene_Start(play->playerActorCsIds[8], NULL); func_80AF082C(this, func_80AF1A2C); - play->unk_18844 = 1; + play->unk_18844 = true; } } @@ -599,7 +599,7 @@ void func_80AF2030(EnTest7* this, PlayState* play) { MREG(66) = 255; MREG(67) = 255; MREG(68) = 255; - play->unk_18844 = 0; + play->unk_18844 = false; this->unk_144 &= ~4; func_80AF082C(this, func_80AF21E8); func_80165690(); diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 68488b336b..027c57cea0 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -109,7 +109,7 @@ void Title_Draw(GameState* thisx) { 1 << 10, 1 << 10); } - func_800FC444(this->gameState.gfxCtx, 0, 0, 0, this->coverAlpha, 2); + Environment_FillScreen(this->gameState.gfxCtx, 0, 0, 0, this->coverAlpha, 2); titleRotation += 300; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 787f991734..b60a767f5c 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1712,7 +1712,7 @@ 0x800F5954:("func_800F5954",), 0x800F5A8C:("Environment_LerpWeight",), 0x800F5B10:("func_800F5B10",), - 0x800F5CD0:("func_800F5CD0",), + 0x800F5CD0:("Environment_UpdateSkybox",), 0x800F6834:("func_800F6834",), 0x800F694C:("func_800F694C",), 0x800F6A04:("func_800F6A04",), @@ -1729,11 +1729,11 @@ 0x800F8A9C:("func_800F8A9C",), 0x800F8CD4:("Environment_Update",), 0x800F8D84:("func_800F8D84",), - 0x800F9728:("func_800F9728",), + 0x800F9728:("Environment_DrawSunLensFlare",), 0x800F9824:("func_800F9824",), 0x800FA39C:("func_800FA39C",), 0x800FA3C4:("func_800FA3C4",), - 0x800FA9FC:("func_800FA9FC",), + 0x800FA9FC:("Environment_DrawRain",), 0x800FAAB4:("func_800FAAB4",), 0x800FAC20:("func_800FAC20",), 0x800FAF74:("func_800FAF74",), @@ -1742,13 +1742,13 @@ 0x800FB388:("func_800FB388",), 0x800FB758:("func_800FB758",), 0x800FB9B4:("func_800FB9B4",), - 0x800FBCBC:("func_800FBCBC",), + 0x800FBCBC:("Environment_DrawCustomLensFlare",), 0x800FBDEC:("Kankyo_InitGameOverLights",), 0x800FBF3C:("Kankyo_FadeInGameOverLights",), 0x800FC158:("Kankyo_FadeOutGameOverLights",), 0x800FC3DC:("func_800FC3DC",), - 0x800FC444:("func_800FC444",), - 0x800FC64C:("func_800FC64C",), + 0x800FC444:("Environment_FillScreen",), + 0x800FC64C:("Environment_DrawSandstorm",), 0x800FD2B4:("func_800FD2B4",), 0x800FD538:("func_800FD538",), 0x800FD59C:("func_800FD59C",), @@ -2458,7 +2458,7 @@ 0x801306E8:("Scene_ProcessHeader",), 0x80130768:("Entrance_Create",), 0x80130784:("Entrance_CreateFromSpawn",), - 0x801307C0:("Scene_ExecuteDrawConfig",), + 0x801307C0:("Scene_Draw",), 0x801307F4:("Scene_DrawConfigDefault",), 0x80130834:("AnimatedMat_TexScroll",), 0x801308A0:("AnimatedMat_DrawTexScroll",), @@ -2943,7 +2943,7 @@ 0x8016424C:("TransitionUnk_Destroy",), 0x801642D8:("TransitionUnk_Init",), 0x80164438:("func_80164438",), - 0x8016454C:("func_8016454C",), + 0x8016454C:("TransitionUnk_Draw",), 0x80164678:("func_80164678",), 0x801647AC:("func_801647AC",), 0x801647B8:("func_801647B8",), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 70feab60bd..8c986e485c 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1226,7 +1226,7 @@ asm/non_matchings/code/z_kankyo/Kankyo_Init.s,Kankyo_Init,0x800F510C,0x212 asm/non_matchings/code/z_kankyo/func_800F5954.s,func_800F5954,0x800F5954,0x4E asm/non_matchings/code/z_kankyo/Environment_LerpWeight.s,Environment_LerpWeight,0x800F5A8C,0x21 asm/non_matchings/code/z_kankyo/func_800F5B10.s,func_800F5B10,0x800F5B10,0x70 -asm/non_matchings/code/z_kankyo/func_800F5CD0.s,func_800F5CD0,0x800F5CD0,0x2D9 +asm/non_matchings/code/z_kankyo/Environment_UpdateSkybox.s,Environment_UpdateSkybox,0x800F5CD0,0x2D9 asm/non_matchings/code/z_kankyo/func_800F6834.s,func_800F6834,0x800F6834,0x46 asm/non_matchings/code/z_kankyo/func_800F694C.s,func_800F694C,0x800F694C,0x2E asm/non_matchings/code/z_kankyo/func_800F6A04.s,func_800F6A04,0x800F6A04,0xF @@ -1243,11 +1243,11 @@ asm/non_matchings/code/z_kankyo/func_800F8970.s,func_800F8970,0x800F8970,0x4B asm/non_matchings/code/z_kankyo/func_800F8A9C.s,func_800F8A9C,0x800F8A9C,0x8E asm/non_matchings/code/z_kankyo/Environment_Update.s,Environment_Update,0x800F8CD4,0x2C asm/non_matchings/code/z_kankyo/func_800F8D84.s,func_800F8D84,0x800F8D84,0x269 -asm/non_matchings/code/z_kankyo/func_800F9728.s,func_800F9728,0x800F9728,0x3F +asm/non_matchings/code/z_kankyo/Environment_DrawSunLensFlare.s,Environment_DrawSunLensFlare,0x800F9728,0x3F asm/non_matchings/code/z_kankyo/func_800F9824.s,func_800F9824,0x800F9824,0x2DE asm/non_matchings/code/z_kankyo/func_800FA39C.s,func_800FA39C,0x800FA39C,0xA asm/non_matchings/code/z_kankyo/func_800FA3C4.s,func_800FA3C4,0x800FA3C4,0x18E -asm/non_matchings/code/z_kankyo/func_800FA9FC.s,func_800FA9FC,0x800FA9FC,0x2E +asm/non_matchings/code/z_kankyo/Environment_DrawRain.s,Environment_DrawRain,0x800FA9FC,0x2E asm/non_matchings/code/z_kankyo/func_800FAAB4.s,func_800FAAB4,0x800FAAB4,0x5B asm/non_matchings/code/z_kankyo/func_800FAC20.s,func_800FAC20,0x800FAC20,0xD5 asm/non_matchings/code/z_kankyo/func_800FAF74.s,func_800FAF74,0x800FAF74,0x27 @@ -1256,13 +1256,13 @@ asm/non_matchings/code/z_kankyo/Environment_AddLightningBolts.s,Environment_AddL asm/non_matchings/code/z_kankyo/func_800FB388.s,func_800FB388,0x800FB388,0xF4 asm/non_matchings/code/z_kankyo/func_800FB758.s,func_800FB758,0x800FB758,0x97 asm/non_matchings/code/z_kankyo/func_800FB9B4.s,func_800FB9B4,0x800FB9B4,0xC2 -asm/non_matchings/code/z_kankyo/func_800FBCBC.s,func_800FBCBC,0x800FBCBC,0x4C +asm/non_matchings/code/z_kankyo/Environment_DrawCustomLensFlare.s,Environment_DrawCustomLensFlare,0x800FBCBC,0x4C asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s,Kankyo_InitGameOverLights,0x800FBDEC,0x54 asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s,Kankyo_FadeInGameOverLights,0x800FBF3C,0x87 asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s,Kankyo_FadeOutGameOverLights,0x800FC158,0xA1 asm/non_matchings/code/z_kankyo/func_800FC3DC.s,func_800FC3DC,0x800FC3DC,0x1A -asm/non_matchings/code/z_kankyo/func_800FC444.s,func_800FC444,0x800FC444,0x82 -asm/non_matchings/code/z_kankyo/func_800FC64C.s,func_800FC64C,0x800FC64C,0x31A +asm/non_matchings/code/z_kankyo/Environment_FillScreen.s,Environment_FillScreen,0x800FC444,0x82 +asm/non_matchings/code/z_kankyo/Environment_DrawSandstorm.s,Environment_DrawSandstorm,0x800FC64C,0x31A asm/non_matchings/code/z_kankyo/func_800FD2B4.s,func_800FD2B4,0x800FD2B4,0xA1 asm/non_matchings/code/z_kankyo/func_800FD538.s,func_800FD538,0x800FD538,0x19 asm/non_matchings/code/z_kankyo/func_800FD59C.s,func_800FD59C,0x800FD59C,0x11 @@ -1972,7 +1972,7 @@ asm/non_matchings/code/z_scene/Scene_SetExitFade.s,Scene_SetExitFade,0x801306A4, asm/non_matchings/code/z_scene/Scene_ProcessHeader.s,Scene_ProcessHeader,0x801306E8,0x20 asm/non_matchings/code/z_scene/Entrance_Create.s,Entrance_Create,0x80130768,0x7 asm/non_matchings/code/z_scene/Entrance_CreateFromSpawn.s,Entrance_CreateFromSpawn,0x80130784,0xF -asm/non_matchings/code/z_scene_proc/Scene_ExecuteDrawConfig.s,Scene_ExecuteDrawConfig,0x801307C0,0xD +asm/non_matchings/code/z_scene_proc/Scene_Draw.s,Scene_Draw,0x801307C0,0xD asm/non_matchings/code/z_scene_proc/Scene_DrawConfigDefault.s,Scene_DrawConfigDefault,0x801307F4,0x10 asm/non_matchings/code/z_scene_proc/AnimatedMat_TexScroll.s,AnimatedMat_TexScroll,0x80130834,0x1B asm/non_matchings/code/z_scene_proc/AnimatedMat_DrawTexScroll.s,AnimatedMat_DrawTexScroll,0x801308A0,0x28 @@ -2457,7 +2457,7 @@ asm/non_matchings/code/z_fbdemo/func_8016418C.s,func_8016418C,0x8016418C,0x30 asm/non_matchings/code/z_fbdemo/TransitionUnk_Destroy.s,TransitionUnk_Destroy,0x8016424C,0x23 asm/non_matchings/code/z_fbdemo/TransitionUnk_Init.s,TransitionUnk_Init,0x801642D8,0x58 asm/non_matchings/code/z_fbdemo/func_80164438.s,func_80164438,0x80164438,0x45 -asm/non_matchings/code/z_fbdemo/func_8016454C.s,func_8016454C,0x8016454C,0x4B +asm/non_matchings/code/z_fbdemo/TransitionUnk_Draw.s,TransitionUnk_Draw,0x8016454C,0x4B asm/non_matchings/code/z_fbdemo/func_80164678.s,func_80164678,0x80164678,0x4D asm/non_matchings/code/z_fbdemo/func_801647AC.s,func_801647AC,0x801647AC,0x3 asm/non_matchings/code/z_fbdemo/func_801647B8.s,func_801647B8,0x801647B8,0x6