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
+1 -1
View File
@@ -163,6 +163,6 @@ void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
osSetEventMesg(0xE, &irqmgr->irqQueue, (OSMesg)0x29D);
osViSetEvent(&irqmgr->irqQueue, (OSMesg)0x29A, retraceCount);
osCreateThread(&irqmgr->thread, Z_THREAD_ID_IRQMGR, (osCreateThread_func)IrqMgr_ThreadEntry, irqmgr, stack, pri);
osCreateThread(&irqmgr->thread, Z_THREAD_ID_IRQMGR, IrqMgr_ThreadEntry, irqmgr, stack, pri);
osStartThread(&irqmgr->thread);
}
+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) {
}
+3 -3
View File
@@ -1288,17 +1288,17 @@ void Boss02_Static_Update(Actor* thisx, PlayState* play) {
this->unk_1D74 = KREG(23) + -15.0f;
D_801F4E30 = 0;
play->envCtx.lightSettingOverride = 1;
play->skyboxId = 1;
play->skyboxId = SKYBOX_NORMAL_SKY;
} else if (!sIsInGiantMode) {
this->unk_1D74 = 0.0f;
D_801F4E30 = this->unk_1D7C;
play->envCtx.lightSettingOverride = 0;
play->skyboxId = 2;
play->skyboxId = SKYBOX_2;
} else {
this->unk_1D74 = KREG(23) + -15.0f;
D_801F4E30 = ((KREG(24) * 0.1f) + 1.0f) * this->unk_1D7C;
play->envCtx.lightSettingOverride = 1;
play->skyboxId = 1;
play->skyboxId = SKYBOX_NORMAL_SKY;
}
Math_ApproachS(&this->unk_1D7C, this->unk_1D7E, 1, 3);
+1 -1
View File
@@ -30,7 +30,7 @@ typedef struct {
/* 0x1A */ s16 rotX;
} PowderKegFuseSegment; // size = 0x1C
static PowderKegFuseSegment sPowderKegFuseSegments[16];
PowderKegFuseSegment sPowderKegFuseSegments[16];
ActorInit En_Bom_InitVars = {
ACTOR_EN_BOM,
@@ -94,7 +94,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) {
break;
case WEATHERTAG_TYPE_UNK5:
func_800BC154(play, &play->actorCtx, &this->actor, 7);
play->skyboxId = 3;
play->skyboxId = SKYBOX_3;
play->envCtx.unk_1F = 5;
play->envCtx.unk_20 = 5;
D_801F4E74 = 1.0f;
@@ -231,10 +231,10 @@ void EnWeatherTag_Die(EnWeatherTag* this, PlayState* play) {
// this tag stops spawning after STT cleared?
void func_80966B08(EnWeatherTag* this, PlayState* play) {
if (func_80966608(this, play, 0, 0, play->envCtx.unk_1F, 5, 100, 2) || (gWeatherMode == 2)) {
play->skyboxId = 3;
play->skyboxId = SKYBOX_3;
EnWeatherTag_SetupAction(this, func_80966D20);
} else if (D_801F4E74 <= 0.01f) {
play->skyboxId = 1;
play->skyboxId = SKYBOX_NORMAL_SKY;
} else {
Math_SmoothStepToF(&D_801F4E74, 0.0f, 0.2f, 0.02f, 0.001f);
}