Debloating z64.h 1: Introducing z64skybox.h (#1150)

* z64skybox.h

* Add a few placeholder values on the enum

* Remove unused structs on z64.h

* Update include/z64skybox.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* move skybox functions

* format

* Revert ARRAY_COUNT(msg)

* bss

* whoops

* Update include/z64.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* SkyboxDraw -> Skybox_

* use enum in z_play

* format

---------

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2023-02-21 16:31:11 -03:00
committed by GitHub
parent 5bc388b9a9
commit a7fd595136
11 changed files with 102 additions and 120 deletions
+11 -11
View File
@@ -991,7 +991,7 @@ void Play_UpdateMain(PlayState* this) {
Room_nop8012D510(this, &this->roomCtx.curRoom, &input[1], 0);
Room_nop8012D510(this, &this->roomCtx.prevRoom, &input[1], 1);
SkyboxDraw_Update(&this->skyboxCtx);
Skybox_Update(&this->skyboxCtx);
if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
KaleidoScopeCall_Update(this);
@@ -1264,14 +1264,14 @@ void Play_DrawMain(PlayState* this) {
if (this->unk_18844 == 0) {
if (1) {
if (this->skyboxId && !this->envCtx.skyboxDisabled) {
if ((this->skyboxId == 1) || (this->skyboxId == 3)) {
if ((this->skyboxId != SKYBOX_NONE) && !this->envCtx.skyboxDisabled) {
if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_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);
Skybox_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);
Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x, this->view.eye.y,
this->view.eye.z);
}
}
@@ -1302,8 +1302,8 @@ void Play_DrawMain(PlayState* this) {
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);
Skybox_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]
@@ -1414,8 +1414,8 @@ void Play_DrawMain(PlayState* this) {
Camera_Update(&sp4C, GET_ACTIVE_CAM(this));
View_UpdateViewingMatrix(&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 ((this->skyboxId != SKYBOX_NONE) && !this->envCtx.skyboxDisabled) {
Skybox_UpdateMatrix(&this->skyboxCtx, this->view.eye.x, this->view.eye.y, this->view.eye.z);
}
}
+5 -5
View File
@@ -191,7 +191,7 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId)
skyboxCtx->rotZ = 0.0f;
switch (skyboxId) {
case 1:
case SKYBOX_NORMAL_SKY:
// Send a DMA request for the cloudy sky texture
skyboxCtx->staticSegments[0] = &D_80025D00;
size = SEGMENT_ROM_SIZE(d2_cloud_static);
@@ -224,7 +224,7 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId)
}
break;
case 2:
case SKYBOX_2:
break;
default:
@@ -236,7 +236,7 @@ void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
size_t size;
switch (skyboxId) {
case 1:
case SKYBOX_NORMAL_SKY:
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1);
if (play->envCtx.unk_10 == 0) {
@@ -293,10 +293,10 @@ void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) {
Skybox_Setup(gameState, skyboxCtx, skyboxId);
if (skyboxId != 0) {
if (skyboxId != SKYBOX_NONE) {
skyboxCtx->dListBuf = THA_AllocEndAlign16(&gameState->heap, 0x3840);
if (skyboxId == 5) {
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
// Allocate enough space for the vertices for a 6 sided skybox (cube)
skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6);
func_80143148(skyboxCtx, 6);
+4 -4
View File
@@ -2,7 +2,7 @@
Mtx* sSkyboxDrawMatrix;
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
Mtx* Skybox_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
Matrix_Translate(x, y, z, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
Matrix_RotateXFApply(skyboxCtx->rotX);
@@ -11,7 +11,7 @@ Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
return Matrix_ToMtx(sSkyboxDrawMatrix);
}
void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) {
void Skybox_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) {
skyboxCtx->primR = primR;
skyboxCtx->primG = primG;
skyboxCtx->primB = primB;
@@ -20,7 +20,7 @@ void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB
skyboxCtx->envB = envB;
}
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
OPEN_DISPS(gfxCtx);
func_8012C6AC(gfxCtx);
@@ -63,5 +63,5 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb
CLOSE_DISPS(gfxCtx);
}
void SkyboxDraw_Update(SkyboxContext* skyboxCtx) {
void Skybox_Update(SkyboxContext* skyboxCtx) {
}