summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2022-10-28 10:09:16 -0700
committerGitHub <noreply@github.com>2022-10-28 14:09:16 -0300
commitfde3a29b1777aa4c54c37dfc404503810ef42b33 (patch)
treeffa7b88f258d3636634e2bf9d58f866a2ca4c679 /src/code
parentf191044a051cc70833e5c496dd1a1fecaea1c03b (diff)
Add ALIGN16 to GRAPH_ALLOC (#1137)
* Add ALIGN16 to GRAPH_ALLOC * format * DebugDisplay_PathDisplayList * 1 more * PR * Format * Reverse gfxHead and gfx * PR
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_actor.c43
-rw-r--r--src/code/z_debug_display.c8
-rw-r--r--src/code/z_eff_blure.c8
-rw-r--r--src/code/z_eff_spark.c94
-rw-r--r--src/code/z_eff_tire_mark.c2
-rw-r--r--src/code/z_player_lib.c6
-rw-r--r--src/code/z_rcp.c96
-rw-r--r--src/code/z_scene_proc.c30
-rw-r--r--src/code/z_skelanime.c8
-rw-r--r--src/code/z_sub_s.c2
10 files changed, 130 insertions, 167 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 05a816594..ced233c54 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -1721,16 +1721,14 @@ void func_800B8050(Actor* actor, PlayState* play, s32 flag) {
Hilite* hilite = func_800BCBF4(&actor->world.pos, play);
if (flag != 0) {
- Gfx* displayListHead;
- Gfx* displayList = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Gfx));
-
- displayListHead = displayList;
+ Gfx* gfxHead = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Gfx));
+ Gfx* gfx = gfxHead;
OPEN_DISPS(play->state.gfxCtx);
- gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10);
- gSPEndDisplayList(displayListHead);
- gSPSegment(POLY_OPA_DISP++, 0x07, displayList);
+ gDPSetHilite1Tile(gfx++, 1, hilite, 0x10, 0x10);
+ gSPEndDisplayList(gfx++);
+ gSPSegment(POLY_OPA_DISP++, 0x07, gfxHead);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1740,16 +1738,14 @@ void func_800B8118(Actor* actor, PlayState* play, s32 flag) {
Hilite* hilite = func_800BCC68(&actor->world.pos, play);
if (flag != 0) {
- Gfx* displayListHead;
- Gfx* displayList = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Gfx));
-
- displayListHead = displayList;
+ Gfx* gfxHead = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Gfx));
+ Gfx* gfx = gfxHead;
OPEN_DISPS(play->state.gfxCtx);
- gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10);
- gSPEndDisplayList(displayListHead);
- gSPSegment(POLY_XLU_DISP++, 0x07, displayList);
+ gDPSetHilite1Tile(gfx++, 1, hilite, 0x10, 0x10);
+ gSPEndDisplayList(gfx++);
+ gSPSegment(POLY_XLU_DISP++, 0x07, gfxHead);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -4190,19 +4186,16 @@ Gfx D_801AEFA0[] = {
};
Gfx* func_800BD9A0(GraphicsContext* gfxCtx) {
- Gfx* displayListHead;
- Gfx* displayList;
-
- displayListHead = displayList = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 2);
+ Gfx* gfxHead = GRAPH_ALLOC(gfxCtx, 2 * sizeof(Gfx));
+ Gfx* gfx = gfxHead;
- gDPSetRenderMode(displayListHead++,
- AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
- G_RM_FOG_SHADE_A,
- AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
- GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
- gSPEndDisplayList(displayListHead++);
+ gDPSetRenderMode(
+ gfx++, AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | G_RM_FOG_SHADE_A,
+ AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
+ GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
+ gSPEndDisplayList(gfx++);
- return displayList;
+ return gfxHead;
}
// unused
diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c
index e7c9dd0be..f98b8636e 100644
--- a/src/code/z_debug_display.c
+++ b/src/code/z_debug_display.c
@@ -148,9 +148,9 @@ Gfx* DebugDisplay_PathDisplayList(GraphicsContext* gfxCtx, Path* path) {
s32 segment; // of path ending at the current point, 1-indexed
if (path != NULL) {
- // count - 1 segments, 1 gSPVertex and 3 gSP2Triangles for each, plus a gSPEndDisplayList
- gfx = GRAPH_ALLOC(gfxCtx, ALIGN16(((path->count - 1) * 4 + 1) * sizeof(Gfx)));
- curVtx = GRAPH_ALLOC(gfxCtx, ALIGN16(path->count * 6 * sizeof(Vtx)));
+ // (count - 1) segments, 1 gSPVertex and 3 gSP2Triangles for each, plus a gSPEndDisplayList
+ gfx = GRAPH_ALLOC(gfxCtx, ((path->count - 1) * 4 + 1) * sizeof(Gfx));
+ curVtx = GRAPH_ALLOC(gfxCtx, path->count * 6 * sizeof(Vtx));
gfxHead = gfx;
curBaseVtx = curVtx;
@@ -202,7 +202,7 @@ Gfx* DebugDisplay_PathDisplayList(GraphicsContext* gfxCtx, Path* path) {
gSPEndDisplayList(gfx++);
} else {
// No path, trivial displaylist
- gfxHead = gfx = GRAPH_ALLOC(gfxCtx, ALIGN16(sizeof(Gfx)));
+ gfx = gfxHead = GRAPH_ALLOC(gfxCtx, sizeof(Gfx));
gSPEndDisplayList(gfx++);
}
return gfxHead;
diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c
index 6ab70f1ef..5f0221969 100644
--- a/src/code/z_eff_blure.c
+++ b/src/code/z_eff_blure.c
@@ -408,7 +408,7 @@ void EffectBlure_DrawElemNoInterpolation(EffectBlure* this, EffectBlureElement*
Math_Vec3s_ToVec3f(&sp6C, &this->elements[0].p2);
- vtx = GRAPH_ALLOC(gfxCtx, sizeof(Vtx[4]));
+ vtx = GRAPH_ALLOC(gfxCtx, 4 * sizeof(Vtx));
if (vtx == NULL) {
} else {
vtx[0].v = baseVtx;
@@ -559,7 +559,7 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
Math_Vec3f_Scale(&sp174, 0.5f);
Math_Vec3f_Scale(&sp168, 0.5f);
- vtx = GRAPH_ALLOC(gfxCtx, sizeof(Vtx[16]));
+ vtx = GRAPH_ALLOC(gfxCtx, 16 * sizeof(Vtx));
if (vtx == NULL) {
} else {
Math_Vec3f_Diff(&sp1CC, &sp138, &sp158);
@@ -849,7 +849,7 @@ void EffectBlure_DrawSimple(EffectBlure* this2, GraphicsContext* gfxCtx) {
if (this->numElements >= 2) {
vtxCount = this->numElements * 4;
- vtx = GRAPH_ALLOC(gfxCtx, ALIGN16(vtxCount * sizeof(Vtx)));
+ vtx = GRAPH_ALLOC(gfxCtx, vtxCount * sizeof(Vtx));
if (vtx == NULL) {
return;
}
@@ -941,7 +941,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
func_8012C560(gfxCtx);
gDPPipeSync(POLY_XLU_DISP++);
- vtx = GRAPH_ALLOC(gfxCtx, sizeof(Vtx[32]));
+ vtx = GRAPH_ALLOC(gfxCtx, 32 * sizeof(Vtx));
if (vtx == NULL) {
} else {
j = 0;
diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c
index fd92516df..fdd25a6b4 100644
--- a/src/code/z_eff_spark.c
+++ b/src/code/z_eff_spark.c
@@ -120,7 +120,7 @@ s32 EffectSpark_Update(void* thisx) {
}
void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
- Vtx* vertices;
+ Vtx* vtx;
EffectSpark* this = (EffectSpark*)thisx;
PlayState* play = Effect_GetPlayState();
s32 i;
@@ -162,8 +162,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
gSPSetGeometryMode(POLY_XLU_DISP++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH);
gDPPipeSync(POLY_XLU_DISP++);
- vertices = GRAPH_ALLOC(gfxCtx, ALIGN16(this->numElements * sizeof(Vtx[4])));
- if (vertices == NULL) {
+ vtx = GRAPH_ALLOC(gfxCtx, this->numElements * (4 * sizeof(Vtx)));
+ if (vtx == NULL) {
goto end;
}
@@ -202,49 +202,49 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
SkinMatrix_MtxFMtxFMult(&spEC, &play->billboardMtxF, &sp6C);
SkinMatrix_MtxFMtxFMult(&sp6C, &spAC, &sp12C);
- vertices[j].v.ob[0] = -32;
- vertices[j].v.ob[1] = -32;
- vertices[j].v.ob[2] = 0;
- vertices[j].v.cn[0] = sp1D3;
- vertices[j].v.cn[1] = sp1D2;
- vertices[j].v.cn[2] = sp1D1;
- vertices[j].v.cn[3] = sp1D0;
- vertices[j].v.tc[0] = 0;
- vertices[j].v.tc[1] = 1024;
- vertices[j].v.flag = 0;
-
- vertices[j + 1].v.ob[0] = 32;
- vertices[j + 1].v.ob[1] = 32;
- vertices[j + 1].v.ob[2] = 0;
- vertices[j + 1].v.cn[0] = sp1CF;
- vertices[j + 1].v.cn[1] = sp1CE;
- vertices[j + 1].v.cn[2] = sp1CD;
- vertices[j + 1].v.cn[3] = sp1CC;
- vertices[j + 1].v.tc[0] = 1024;
- vertices[j + 1].v.tc[1] = 0;
- vertices[j + 1].v.flag = 0;
-
- vertices[j + 2].v.ob[0] = -32;
- vertices[j + 2].v.ob[1] = 32;
- vertices[j + 2].v.ob[2] = 0;
- vertices[j + 2].v.cn[0] = sp1CB;
- vertices[j + 2].v.cn[1] = sp1CA;
- vertices[j + 2].v.cn[2] = sp1C9;
- vertices[j + 2].v.cn[3] = sp1C8;
- vertices[j + 2].v.tc[0] = 0;
- vertices[j + 2].v.tc[1] = 0;
- vertices[j + 2].v.flag = 0;
-
- vertices[j + 3].v.ob[0] = 32;
- vertices[j + 3].v.ob[1] = -32;
- vertices[j + 3].v.ob[2] = 0;
- vertices[j + 3].v.cn[0] = sp1C7;
- vertices[j + 3].v.cn[1] = sp1C6;
- vertices[j + 3].v.cn[2] = sp1C5;
- vertices[j + 3].v.cn[3] = sp1C4;
- vertices[j + 3].v.tc[0] = 1024;
- vertices[j + 3].v.tc[1] = 1024;
- vertices[j + 3].v.flag = 0;
+ vtx[j].v.ob[0] = -32;
+ vtx[j].v.ob[1] = -32;
+ vtx[j].v.ob[2] = 0;
+ vtx[j].v.cn[0] = sp1D3;
+ vtx[j].v.cn[1] = sp1D2;
+ vtx[j].v.cn[2] = sp1D1;
+ vtx[j].v.cn[3] = sp1D0;
+ vtx[j].v.tc[0] = 0;
+ vtx[j].v.tc[1] = 1024;
+ vtx[j].v.flag = 0;
+
+ vtx[j + 1].v.ob[0] = 32;
+ vtx[j + 1].v.ob[1] = 32;
+ vtx[j + 1].v.ob[2] = 0;
+ vtx[j + 1].v.cn[0] = sp1CF;
+ vtx[j + 1].v.cn[1] = sp1CE;
+ vtx[j + 1].v.cn[2] = sp1CD;
+ vtx[j + 1].v.cn[3] = sp1CC;
+ vtx[j + 1].v.tc[0] = 1024;
+ vtx[j + 1].v.tc[1] = 0;
+ vtx[j + 1].v.flag = 0;
+
+ vtx[j + 2].v.ob[0] = -32;
+ vtx[j + 2].v.ob[1] = 32;
+ vtx[j + 2].v.ob[2] = 0;
+ vtx[j + 2].v.cn[0] = sp1CB;
+ vtx[j + 2].v.cn[1] = sp1CA;
+ vtx[j + 2].v.cn[2] = sp1C9;
+ vtx[j + 2].v.cn[3] = sp1C8;
+ vtx[j + 2].v.tc[0] = 0;
+ vtx[j + 2].v.tc[1] = 0;
+ vtx[j + 2].v.flag = 0;
+
+ vtx[j + 3].v.ob[0] = 32;
+ vtx[j + 3].v.ob[1] = -32;
+ vtx[j + 3].v.ob[2] = 0;
+ vtx[j + 3].v.cn[0] = sp1C7;
+ vtx[j + 3].v.cn[1] = sp1C6;
+ vtx[j + 3].v.cn[2] = sp1C5;
+ vtx[j + 3].v.cn[3] = sp1C4;
+ vtx[j + 3].v.tc[0] = 1024;
+ vtx[j + 3].v.tc[1] = 1024;
+ vtx[j + 3].v.flag = 0;
j += 4;
@@ -254,7 +254,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
}
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPVertex(POLY_XLU_DISP++, &vertices[4 * i], 4, 0);
+ gSPVertex(POLY_XLU_DISP++, &vtx[4 * i], 4, 0);
gSP2Triangles(POLY_XLU_DISP++, 2, 0, 3, 0, 2, 3, 1, 0);
}
diff --git a/src/code/z_eff_tire_mark.c b/src/code/z_eff_tire_mark.c
index 532e8e2fb..75b0ecd03 100644
--- a/src/code/z_eff_tire_mark.c
+++ b/src/code/z_eff_tire_mark.c
@@ -226,7 +226,7 @@ void EffectTireMark_Draw(void* thisx, GraphicsContext* gfxCtx) {
OPEN_DISPS(gfxCtx);
if (this->numElements >= 2) {
- vtx = GRAPH_ALLOC(gfxCtx, ALIGN16(this->numElements * sizeof(Vtx[2])));
+ vtx = GRAPH_ALLOC(gfxCtx, this->numElements * (2 * sizeof(Vtx)));
if (vtx != NULL) {
gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index 21753040f..f773e6ff2 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -2322,7 +2322,7 @@ void func_80128388(struct_801F58B0 arg0[], struct_80128388_arg1 arg1[], s32 arg2
void Player_DrawGreatFairysMask(PlayState* play, Player* player) {
s32 pad;
- Mtx* sp90 = GRAPH_ALLOC(play->state.gfxCtx, 6 * sizeof(Mtx));
+ Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, 6 * sizeof(Mtx));
Vec3f sp84;
Vec3f sp78;
Vec3f* iter = D_801C0C0C;
@@ -2332,7 +2332,7 @@ void Player_DrawGreatFairysMask(PlayState* play, Player* player) {
OPEN_DISPS(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x0B, sp90);
+ gSPSegment(POLY_OPA_DISP++, 0x0B, mtx);
Matrix_MultVec3f(&D_801C0C00, &D_801C0C54[1].unk_08);
Math_Vec3f_Lerp(&player->bodyPartsPos[7], &player->bodyPartsPos[0], 0.2f, &D_801C0C54[2].unk_08);
@@ -2346,7 +2346,7 @@ void Player_DrawGreatFairysMask(PlayState* play, Player* player) {
Matrix_Push();
Matrix_Translate(iter->x, iter->y, iter->z, MTXMODE_APPLY);
- func_80128388(D_801F58B0[i], D_801C0C54, 3, &sp90);
+ func_80128388(D_801F58B0[i], D_801C0C54, 3, &mtx);
Matrix_Pop();
iter++;
iter2++;
diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c
index 057424e3c..39f09f1d4 100644
--- a/src/code/z_rcp.c
+++ b/src/code/z_rcp.c
@@ -1108,13 +1108,13 @@ void func_8012CA38(GraphicsContext* gfxCtx) {
}
Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) {
- Gfx* displayList = Graph_DlistAlloc(gfxp, 3 * sizeof(Gfx));
+ Gfx* gfx = Graph_DlistAlloc(gfxp, 3 * sizeof(Gfx));
- gDPTileSync(displayList);
- gDPSetTileSize(displayList + 1, 0, x, y, (x + ((width - 1) << 2)), (y + ((height - 1) << 2)));
- gSPEndDisplayList(displayList + 2);
+ gDPTileSync(&gfx[0]);
+ gDPSetTileSize(&gfx[1], 0, x, y, (x + ((width - 1) << 2)), (y + ((height - 1) << 2)));
+ gSPEndDisplayList(&gfx[2]);
- return displayList;
+ return gfx;
}
void func_8012CB04(Gfx** gfxp, u32 x, u32 y) {
@@ -1126,101 +1126,71 @@ Gfx* func_8012CB28(GraphicsContext* gfxCtx, u32 x, u32 y) {
}
Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height) {
- Gfx* displayList;
-
- {
- Gfx* _g = (Gfx*)gfxCtx->polyOpa.d - 4;
- displayList = _g;
- gfxCtx->polyOpa.d = _g;
- }
+ Gfx* gfx = GRAPH_ALLOC(gfxCtx, 3 * sizeof(Gfx));
x %= 2048;
y %= 2048;
- gDPTileSync(displayList);
- gDPSetTileSize(displayList + 1, 0, x, y, (x + ((width - 1) << 2)), (y + ((height - 1) << 2)));
- gSPEndDisplayList(displayList + 2);
+ gDPTileSync(&gfx[0]);
+ gDPSetTileSize(&gfx[1], 0, x, y, (x + ((width - 1) << 2)), (y + ((height - 1) << 2)));
+ gSPEndDisplayList(&gfx[2]);
- return displayList;
+ return gfx;
}
Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2,
u32 y2, s32 width2, s32 height2) {
- Gfx* displayList;
-
- {
- Gfx* _g = (Gfx*)gfxCtx->polyOpa.d - 6;
- displayList = _g;
- gfxCtx->polyOpa.d = _g;
- }
+ Gfx* gfx = GRAPH_ALLOC(gfxCtx, 5 * sizeof(Gfx));
x1 %= 2048;
y1 %= 2048;
x2 %= 2048;
y2 %= 2048;
- gDPTileSync(displayList);
- gDPSetTileSize(displayList + 1, tile1, x1, y1, (x1 + ((width1 - 1) << 2)), (y1 + ((height1 - 1) << 2)));
- gDPTileSync(displayList + 2);
- gDPSetTileSize(displayList + 3, tile2, x2, y2, (x2 + ((width2 - 1) << 2)), (y2 + ((height2 - 1) << 2)));
- gSPEndDisplayList(displayList + 4);
+ gDPTileSync(&gfx[0]);
+ gDPSetTileSize(&gfx[1], tile1, x1, y1, (x1 + ((width1 - 1) << 2)), (y1 + ((height1 - 1) << 2)));
+ gDPTileSync(&gfx[2]);
+ gDPSetTileSize(&gfx[3], tile2, x2, y2, (x2 + ((width2 - 1) << 2)), (y2 + ((height2 - 1) << 2)));
+ gSPEndDisplayList(&gfx[4]);
- return displayList;
+ return gfx;
}
Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2,
u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a) {
- Gfx* displayList;
-
- {
- Gfx* _g = (Gfx*)gfxCtx->polyOpa.d - 6;
- displayList = _g;
- gfxCtx->polyOpa.d = _g;
- }
+ Gfx* gfx = GRAPH_ALLOC(gfxCtx, 6 * sizeof(Gfx));
x1 %= 2048;
y1 %= 2048;
x2 %= 2048;
y2 %= 2048;
- gDPTileSync(displayList);
- gDPSetTileSize(displayList + 1, tile1, x1, y1, (x1 + ((width1 - 1) << 2)), (y1 + ((height1 - 1) << 2)));
- gDPTileSync(displayList + 2);
- gDPSetTileSize(displayList + 3, tile2, x2, y2, (x2 + ((width2 - 1) << 2)), (y2 + ((height2 - 1) << 2)));
- gDPSetEnvColor(displayList + 4, r, g, b, a);
- gSPEndDisplayList(displayList + 5);
+ gDPTileSync(&gfx[0]);
+ gDPSetTileSize(&gfx[1], tile1, x1, y1, (x1 + ((width1 - 1) << 2)), (y1 + ((height1 - 1) << 2)));
+ gDPTileSync(&gfx[2]);
+ gDPSetTileSize(&gfx[3], tile2, x2, y2, (x2 + ((width2 - 1) << 2)), (y2 + ((height2 - 1) << 2)));
+ gDPSetEnvColor(&gfx[4], r, g, b, a);
+ gSPEndDisplayList(&gfx[5]);
- return displayList;
+ return gfx;
}
Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a) {
- Gfx* displayList;
-
- {
- Gfx* _g = (Gfx*)gfxCtx->polyOpa.d - 2;
- displayList = _g;
- gfxCtx->polyOpa.d = _g;
- }
+ Gfx* gfx = GRAPH_ALLOC(gfxCtx, 2 * sizeof(Gfx));
- gDPSetEnvColor(displayList, r, g, b, a);
- gSPEndDisplayList(displayList + 1);
+ gDPSetEnvColor(&gfx[0], r, g, b, a);
+ gSPEndDisplayList(&gfx[1]);
- return displayList;
+ return gfx;
}
Gfx* Gfx_PrimColor(GraphicsContext* gfxCtx, s32 lodfrac, s32 r, s32 g, s32 b, s32 a) {
- Gfx* displayList;
-
- {
- Gfx* _g = (Gfx*)gfxCtx->polyOpa.d - 2;
- displayList = _g;
- gfxCtx->polyOpa.d = _g;
- }
+ Gfx* gfx = GRAPH_ALLOC(gfxCtx, 2 * sizeof(Gfx));
- gDPSetPrimColor(displayList, 0, lodfrac, r, g, b, a);
- gSPEndDisplayList(displayList + 1);
+ gDPSetPrimColor(&gfx[0], 0, lodfrac, r, g, b, a);
+ gSPEndDisplayList(&gfx[1]);
- return displayList;
+ return gfx;
}
void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g, u8 b) {
diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c
index 4de83bcaa..67f503e58 100644
--- a/src/code/z_scene_proc.c
+++ b/src/code/z_scene_proc.c
@@ -113,23 +113,23 @@ void AnimatedMat_DrawTwoTexScroll(PlayState* play, s32 segment, void* params) {
* Generates a displaylist that sets the prim and env color, and stores it in the provided segment ID.
*/
void AnimatedMat_SetColor(PlayState* play, s32 segment, F3DPrimColor* primColorResult, F3DEnvColor* envColor) {
- Gfx* colorDList = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4);
+ Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, 3 * sizeof(Gfx));
OPEN_DISPS(play->state.gfxCtx);
// clang-format off
- if (sMatAnimFlags & 1) { gSPSegment(POLY_OPA_DISP++, segment, colorDList); }
- if (sMatAnimFlags & 2) { gSPSegment(POLY_XLU_DISP++, segment, colorDList); }
+ if (sMatAnimFlags & 1) { gSPSegment(POLY_OPA_DISP++, segment, gfx); }
+ if (sMatAnimFlags & 2) { gSPSegment(POLY_XLU_DISP++, segment, gfx); }
// clang-format on
- gDPSetPrimColor(colorDList++, 0, primColorResult->lodFrac, primColorResult->r, primColorResult->g,
- primColorResult->b, (u8)(primColorResult->a * sMatAnimAlphaRatio));
+ gDPSetPrimColor(gfx++, 0, primColorResult->lodFrac, primColorResult->r, primColorResult->g, primColorResult->b,
+ (u8)(primColorResult->a * sMatAnimAlphaRatio));
if (envColor != NULL) {
- gDPSetEnvColor(colorDList++, envColor->r, envColor->g, envColor->b, envColor->a);
+ gDPSetEnvColor(gfx++, envColor->r, envColor->g, envColor->b, envColor->a);
}
- gSPEndDisplayList(colorDList++);
+ gSPEndDisplayList(gfx++);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -709,8 +709,8 @@ void Scene_DrawConfigGreatBayTemple(PlayState* play) {
};
s32 lodFrac;
s32 i;
- Gfx* dListHead;
- Gfx* dList;
+ Gfx* gfx;
+ Gfx* gfxHead;
if (Flags_GetSwitch(play, 0x33) && Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) &&
Flags_GetSwitch(play, 0x36)) {
@@ -719,16 +719,16 @@ void Scene_DrawConfigGreatBayTemple(PlayState* play) {
BgCheck_UnsetContextFlags(&play->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW);
}
- dList = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 18);
+ gfxHead = GRAPH_ALLOC(play->state.gfxCtx, 18 * sizeof(Gfx));
AnimatedMat_Draw(play, play->sceneMaterialAnims);
OPEN_DISPS(play->state.gfxCtx);
- for (dListHead = dList, i = 0; i < 9; i++, dListHead += 2) {
+ for (gfx = gfxHead, i = 0; i < 9; i++, gfx += 2) {
lodFrac = 0;
- bcopy(greatBayTempleColorSetDL, dListHead, sizeof(greatBayTempleColorSetDL));
+ bcopy(greatBayTempleColorSetDL, gfx, sizeof(greatBayTempleColorSetDL));
switch (i) {
case 0:
@@ -779,11 +779,11 @@ void Scene_DrawConfigGreatBayTemple(PlayState* play) {
break;
}
- gDPSetPrimColor(dListHead, 0, lodFrac, 255, 255, 255, 255);
+ gDPSetPrimColor(gfx, 0, lodFrac, 255, 255, 255, 255);
}
- gSPSegment(POLY_OPA_DISP++, 0x06, dList);
- gSPSegment(POLY_XLU_DISP++, 0x06, dList);
+ gSPSegment(POLY_OPA_DISP++, 0x06, gfxHead);
+ gSPSegment(POLY_XLU_DISP++, 0x06, gfxHead);
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c
index 088f1469f..e14956905 100644
--- a/src/code/z_skelanime.c
+++ b/src/code/z_skelanime.c
@@ -200,7 +200,7 @@ void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable,
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
+ Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
return;
@@ -418,7 +418,7 @@ void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable,
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
+ Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
return;
@@ -560,7 +560,7 @@ void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* joi
OPEN_DISPS(play->state.gfxCtx);
- mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
+ mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(Mtx));
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
@@ -822,7 +822,7 @@ Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32
return NULL;
}
- mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
+ mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(Mtx));
gSPSegment(gfx++, 0x0D, mtx);
diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c
index efc6774a7..2924fe353 100644
--- a/src/code/z_sub_s.c
+++ b/src/code/z_sub_s.c
@@ -112,7 +112,7 @@ Gfx* SubS_DrawTransformFlex(PlayState* play, void** skeleton, Vec3s* jointTable,
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(dListCount * sizeof(Mtx)));
+ Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
return NULL;