1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-20 14:01:15 +00:00

Cleanup gSPMatrix, rename Matrix_New -> Matrix_Finalize, add MATRIX_FINALIZE_AND_LOAD (#1983)

* clean up gSPMatrix usage

* add weird hybrid macro gSPMATRIX_SET_NEW

* Matrix_NewMtx, MATRIX_NEW -> Matrix_Finalize, MATRIX_FINALIZE

* gSPMATRIX_SET_NEW -> MATRIX_FINALIZE_AND_LOAD

* format
This commit is contained in:
Dragorn421 2024-09-11 09:59:23 +02:00 committed by GitHub
parent 2e79b83bb8
commit 5441559b30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
268 changed files with 702 additions and 1272 deletions

View file

@ -1662,10 +1662,8 @@ void DemoEffect_DrawJewel(Actor* thisx, PlayState* play2) {
if (!frames) {}
gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, (u8)frames, (u8)frames, 16, 16));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2597),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2599),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2597);
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2599);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
func_8002ED80(&this->actor, play, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1],
@ -1706,24 +1704,21 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, PlayState* play) {
Matrix_RotateY(0.0f, MTXMODE_APPLY);
Matrix_RotateX(DEG_TO_RAD(11), MTXMODE_APPLY);
Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2661),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2661);
gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL);
Matrix_Pop();
Matrix_Push();
Matrix_RotateY(DEG_TO_RAD(120), MTXMODE_APPLY);
Matrix_RotateX(DEG_TO_RAD(11), MTXMODE_APPLY);
Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2672),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2672);
gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL);
Matrix_Pop();
Matrix_Push();
Matrix_RotateY(DEG_TO_RAD(240), MTXMODE_APPLY);
Matrix_RotateX(DEG_TO_RAD(11), MTXMODE_APPLY);
Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2683),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2683);
gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL);
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2688);
@ -1737,8 +1732,7 @@ void DemoEffect_DrawFireBall(Actor* thisx, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 64, 64, 255, 200, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2709),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2709);
gSPMatrix(POLY_XLU_DISP++, play->billboardMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 32, 1, 0,
@ -1781,8 +1775,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) {
gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Matrix_Push();
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2801),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2801);
gSPDisplayList(POLY_XLU_DISP++, gGoldenGoddessAuraDL);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
func_8002EBCC(&this->actor, play, 0);
@ -1798,8 +1791,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) {
Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -140.0f, 0.0f, MTXMODE_APPLY);
Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2824),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2824);
gSPDisplayList(POLY_OPA_DISP++, gGoldenGoddessBodyDL);
}
@ -1829,14 +1821,12 @@ void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) {
Matrix_Push();
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(DEG_TO_RAD(this->light.rotation), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2866),
G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2866);
gSPDisplayList(POLY_XLU_DISP++, flashDList);
Matrix_Pop();
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(DEG_TO_RAD(-(f32)this->light.rotation), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2874),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2874);
gSPDisplayList(POLY_XLU_DISP++, flashDList);
}
}
@ -1854,8 +1844,7 @@ void DemoEffect_DrawBlueOrb(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD(this->blueOrb.rotation), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2901),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2901);
this->blueOrb.rotation += 0x01F4;
gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL);
CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2907);
@ -1870,8 +1859,7 @@ void DemoEffect_DrawLgtShower(Actor* thisx, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 64, 64, 255, 255, 160, this->lgtShower.alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 50, 200, 0, 255);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2927),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2927);
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (frames * 5) % 1024, 0, 256, 64, 1,
(frames * 10) % 128, 512 - ((frames * 50) % 512), 32, 16));
@ -1889,8 +1877,7 @@ void DemoEffect_DrawLightRing(Actor* thisx, PlayState* play2) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 170, 255, 255, this->lightRing.alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 255);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2963),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2963);
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (frames * 5) % 64, 512 - ((frames * 2) % 512) - 1,
16, 128, 1, 0, 0, 8, 1024));
@ -1913,8 +1900,7 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EV_AURORA - SFX_FLAG);
Matrix_Push();
Matrix_Scale(1.0f, 2.4f, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 3011),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 3011);
gSPSegment(POLY_XLU_DISP++, 9,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 256 - ((frames * 4) % 256) - 1, 64, 64,
1, 0, 256 - ((frames * 2) % 256) - 1, 64, 32));
@ -1928,16 +1914,14 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) {
if (this->triforceSpot.triforceSpotOpacity != 0) {
Actor_PlaySfx(&this->actor, NA_SE_EV_TRIFORCE - SFX_FLAG);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 3042),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 3042);
if (this->triforceSpot.triforceSpotOpacity < 250) {
func_8002ED80(&this->actor, play, 0);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2);
Matrix_RotateY(BINANG_TO_RAD(this->triforceSpot.rotation), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 3053),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 3053);
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 16, 1, 0, 0, 16, 8));
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 160, this->triforceSpot.triforceSpotOpacity);
@ -1948,8 +1932,7 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_AA_ZB_OPA_SURF2);
Matrix_RotateY(BINANG_TO_RAD(this->triforceSpot.rotation), MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 3085),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 3085);
gSPSegment(POLY_OPA_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 16, 1, 0, 0, 16, 8));
gDPSetPrimColor(POLY_OPA_DISP++, 128, 128, 255, 255, 160, 255);