diff --git a/include/PR/gbi.h b/include/PR/gbi.h index f5d389e38..8e4afb232 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -96,7 +96,7 @@ #define G_VTX 4 #define G_RESERVED1 5 /* not implemeted */ #define G_DL 6 -#define G_RESERVED2 7 /* not implemeted */ +#define G_COL 7 /* new in PD */ #define G_RESERVED3 8 /* not implemeted */ #define G_SPRITE2D_BASE 9 /* sprite command */ @@ -1601,13 +1601,12 @@ typedef union { #define gSPMatrix(pkt, m, p) gDma1p(pkt, G_MTX, m, sizeof(Mtx), p) #define gsSPMatrix(m, p) gsDma1p(G_MTX, m, sizeof(Mtx), p) -#define gSPVertex(pkt, v, n, v0) \ - gDma1p(pkt, G_VTX, v, sizeof(Vtx)*(n),((n)-1)<<4|(v0)) \ +#define gSPVertex(pkt, v, n, v0) \ + gDma1p(pkt, G_VTX, v, sizeof(struct gfxvtx)*(n),((n)-1)<<4|(v0)) #define gsSPVertex(v, n, v0) \ gsDma1p(G_VTX, v, sizeof(Vtx)*(n), ((n)-1)<<4|(v0)) - #define gSPViewport(pkt,v) \ gDma1p((pkt), G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT) diff --git a/src/game/activemenu.c b/src/game/activemenu.c index 3fbd49a81..a9f4ba10d 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -1371,12 +1371,12 @@ Gfx *amRender(Gfx *gdl) colours[0] = 0x22222200; colours[1] = 0x0000004f; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); - gDPTri2(gdl++, 4, 5, 6, 6, 7, 4); - gDPTri4(gdl++, 0, 4, 7, 7, 3, 0, 0, 1, 5, 5, 4, 0); - gDPTri4(gdl++, 1, 2, 6, 6, 5, 1, 6, 2, 3, 3, 7, 6); + gSPTri2(gdl++, 4, 5, 6, 6, 7, 4); + gSPTri4(gdl++, 0, 4, 7, 7, 3, 0, 0, 1, 5, 5, 4, 0); + gSPTri4(gdl++, 1, 2, 6, 6, 5, 1, 6, 2, 3, 3, 7, 6); gdl = func0f0d49c8(gdl); diff --git a/src/game/bg.c b/src/game/bg.c index e0830ff68..b3ead9cc0 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -287,10 +287,10 @@ Gfx *bgRenderXrayData(Gfx *gdl, struct xraydata *xraydata) } count = xraydata->numvertices; - gDPSetColorArray(gdl++, colours, count); + gSPColor(gdl++, colours, count); count = xraydata->numvertices; - gDPSetVerticeArray(gdl++, vertices, count); + gSPVertex(gdl++, vertices, count, 0); numgroups = (xraydata->numtris - 1) / 4 + 1; @@ -308,7 +308,7 @@ Gfx *bgRenderXrayData(Gfx *gdl, struct xraydata *xraydata) #endif for (i = 0; i < numgroups; i++) { - gDPTri4(gdl++, + gSPTri4(gdl++, xraydata->tris[i * 4 + 0][0], xraydata->tris[i * 4 + 0][1], xraydata->tris[i * 4 + 0][2], xraydata->tris[i * 4 + 1][0], xraydata->tris[i * 4 + 1][1], xraydata->tris[i * 4 + 1][2], xraydata->tris[i * 4 + 2][0], xraydata->tris[i * 4 + 2][1], xraydata->tris[i * 4 + 2][2], @@ -4924,7 +4924,7 @@ void bgFindRoomVtxBatches(s32 roomnum) if (gdl != NULL) { while (gdl) { for (i = 0; gdl[i].dma.cmd != G_ENDDL; i++) { - // if gDPSetVerticeArray + // if gSPVertex if (gdl[i].dma.cmd == G_VTX) { batchindex++; } @@ -4939,7 +4939,7 @@ void bgFindRoomVtxBatches(s32 roomnum) while (gdl) { for (i = 0; gdl[i].dma.cmd != G_ENDDL; i++) { - // if gDPSetVerticeArray + // if gSPVertex if (gdl[i].dma.cmd == G_VTX) { xlucount++; } diff --git a/src/game/bondview.c b/src/game/bondview.c index 23d024b2f..9f1cc8b66 100644 --- a/src/game/bondview.c +++ b/src/game/bondview.c @@ -773,12 +773,12 @@ Gfx *bviewDrawEyespySideRect(Gfx *gdl, s32 *points, u8 r, u8 g, u8 b, u8 alpha) vertices[2].colour = 4; vertices[3].colour = 4; - gDPSetColorArray(gdl++, colours, 2); - gDPSetVerticeArray(gdl++, vertices, 4); + gSPColor(gdl++, colours, 2); + gSPVertex(gdl++, vertices, 4, 0); if (colours); - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); return gdl; } diff --git a/src/game/chr.c b/src/game/chr.c index d7db4ee40..a694a4317 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -3909,7 +3909,7 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc u32 addr = gdlptr->words.w1 & 0xffffff; posnode = modelFindNodeByMtxIndex(model, addr / sizeof(Mtxf)); modelNodeGetModelRelativePosition(model, posnode, &spd4); - } else if (op == G_SETCOLOR) { + } else if (op == G_COL) { spac = gdlptr->words.w1 & 0xffffff; } @@ -4207,7 +4207,7 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct u32 addr = gdlptr->words.w1 & 0xffffff; posnode = modelFindNodeByMtxIndex(model, addr / sizeof(Mtxf)); modelNodeGetModelRelativePosition(model, posnode, &spd4); - } else if (op == G_SETCOLOR) { + } else if (op == G_COL) { spac = gdlptr->words.w1 & 0xffffff; } @@ -5516,7 +5516,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop if (side == -7) { colours = gfxAllocateColours(1); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); colours[0].r = 0xff; colours[0].g = 0xff; @@ -5548,9 +5548,9 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop vertices[3].s = 0; vertices[3].t = 512; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); vertices += 4; } @@ -5615,7 +5615,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop if (side == -3 || side == -4 || side == -5 || side == -6) { colours = gfxAllocateColours(1); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); if (side == -3) { colours[0].r = red2; @@ -5675,9 +5675,9 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop vertices[3].s = st1; vertices[3].t = st4; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); vertices += 4; } @@ -5703,7 +5703,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop colours = gfxAllocateColours(3); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); + gSPColor(gdl++, osVirtualToPhysical(colours), 3); colours[0].r = red3; colours[1].r = red3; @@ -5742,9 +5742,9 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop vertices[4].t = (st2 + st4) >> 1; vertices[4].colour = 4; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 5); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 5, 0); - gDPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); + gSPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); vertices += 5; } @@ -5763,7 +5763,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop colours = gfxAllocateColours(1); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); colours[0].r = red1; colours[0].g = green1; @@ -5788,7 +5788,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop colours = gfxAllocateColours(1); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); colours[0].r = red3; colours[0].g = green3; @@ -5855,12 +5855,12 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop vertices[11].s = st3; vertices[11].t = st2; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 12); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 12, 0); - gDPTri4(gdl++, 0, 1, 9, 0, 9, 8, 11, 5, 4, 11, 4, 10); + gSPTri4(gdl++, 0, 1, 9, 0, 9, 8, 11, 5, 4, 11, 4, 10); for (j = 2; j < 6; j++) { - gDPTri2(gdl++, + gSPTri2(gdl++, sp104[j][0], sp104[j][1], sp104[j][2], sp104[j][0], sp104[j][2], sp104[j][3]); } @@ -5886,7 +5886,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop colours = gfxAllocateColours(5); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 5); + gSPColor(gdl++, osVirtualToPhysical(colours), 5); colours[0].r = red1; colours[0].g = green1; @@ -5990,9 +5990,9 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop vertices[4].s = (st1 + st3) >> 1; vertices[4].t = (st2 + st4) >> 1; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 5); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 5, 0); - gDPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); + gSPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); vertices += 5; @@ -6069,9 +6069,9 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop vertices[4].s = (st1 + st3) >> 1; vertices[4].t = (st2 + st4) >> 1; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 5); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 5, 0); - gDPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); + gSPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); vertices += 5; } @@ -6116,9 +6116,9 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop vertices[4].s = (st1 + st3) >> 1; vertices[4].t = (st2 + st4) >> 1; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 5); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 5, 0); - gDPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); + gSPTri4(gdl++, 0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4); } } diff --git a/src/game/credits.c b/src/game/credits.c index 991c395af..9a45c2b53 100644 --- a/src/game/credits.c +++ b/src/game/credits.c @@ -393,11 +393,11 @@ Gfx *creditsDrawBackgroundLayer(Gfx *gdl, u8 type, u8 layernum, f32 arg3, u32 al creditsChooseBgColours(vertices, colours, g_CreditsData->bglayers[layernum].confignum, alpha, arg5 * 90); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 9); + gSPColor(gdl++, osVirtualToPhysical(colours), 3); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 9, 0); - gDPTri4(gdl++, 0, 1, 3, 1, 4, 3, 1, 2, 5, 5, 4, 1); - gDPTri4(gdl++, 3, 4, 7, 7, 6, 3, 4, 5, 7, 5, 8, 7); + gSPTri4(gdl++, 0, 1, 3, 1, 4, 3, 1, 2, 5, 5, 4, 1); + gSPTri4(gdl++, 3, 4, 7, 7, 6, 3, 4, 5, 7, 5, 8, 7); return gdl; } @@ -614,10 +614,10 @@ Gfx *creditsRenderLine(Gfx *gdl, struct coord *from, struct coord *to) colours[0] = 0xffffffff; colours[1] = 0xffffffff; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); return gdl; } @@ -887,7 +887,7 @@ Gfx *creditsDrawParticles(Gfx *gdl) } } - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 60); + gSPColor(gdl++, osVirtualToPhysical(colours), 60); for (confignum = 0; confignum < ARRAYCOUNT(g_CreditParticleConfigs); confignum++) { bool donetexture = false; @@ -971,9 +971,9 @@ Gfx *creditsDrawParticles(Gfx *gdl) vertices[2].colour = offset; vertices[3].colour = offset; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); } } } diff --git a/src/game/explosions.c b/src/game/explosions.c index 293378c0c..75ae6be9c 100644 --- a/src/game/explosions.c +++ b/src/game/explosions.c @@ -1340,7 +1340,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) *colour = var8007e93c; } - gDPSetColorArray(gdl++, osVirtualToPhysical(colour), 1); + gSPColor(gdl++, osVirtualToPhysical(colour), 1); for (i = 14; i >= 0; i--) { gDPSetTextureImage(gdl++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, g_ExplosionTexturePairs[i].texturenum1); @@ -1543,9 +1543,9 @@ Gfx *explosionRenderPart(struct explosion *exp, struct explosionpart *part, Gfx vertices[j].colour = 0; } - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); return gdl; } diff --git a/src/game/game_1531a0.c b/src/game/game_1531a0.c index 6e68b1779..0a4085dc8 100644 --- a/src/game/game_1531a0.c +++ b/src/game/game_1531a0.c @@ -1789,10 +1789,10 @@ Gfx *text0f154f38(Gfx *gdl, s32 *arg1, struct fontchar *curchar, struct fontchar vertices[3].s = sp36; vertices[3].t = sp30; - gDPSetColorArray(gdl++, colours, 1); - gDPSetVerticeArray(gdl++, vertices, 4); + gSPColor(gdl++, colours, 1); + gSPVertex(gdl++, vertices, 4, 0); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); *arg1 += curchar->width; diff --git a/src/game/gunfx.c b/src/game/gunfx.c index 920b81799..6da770825 100644 --- a/src/game/gunfx.c +++ b/src/game/gunfx.c @@ -285,12 +285,12 @@ Gfx *beamRenderGeneric(Gfx *gdl, struct textureconfig *texconfig, gSPClearGeometryMode(gdl++, G_CULL_BACK); gSPMatrix(gdl++, osVirtualToPhysical(spc8), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); texSelect(&gdl, texconfig, 4, 1, 2, true, NULL); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); return gdl; } @@ -1712,22 +1712,22 @@ Gfx *beamRender(Gfx *gdl, struct beam *beam, bool arg2, u8 arg3) gDPSetTextureLOD(gdl++, G_TL_TILE); gDPSetTextureConvert(gdl++, G_TC_FILT); gDPSetCombineMode(gdl++, G_CC_BLENDIA, G_CC_BLENDIA); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); if (beam->weaponnum == WEAPON_LASER) { texSelect(&gdl, &g_TexGroup03Configs[0], 4, arg2, 2, true, NULL); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); - gDPTri2(gdl++, 4, 5, 6, 4, 5, 7); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); + gSPTri2(gdl++, 4, 5, 6, 4, 5, 7); texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL); - gDPTri2(gdl++, 0, 2, 3, 0, 3, 1); + gSPTri2(gdl++, 0, 2, 3, 0, 3, 1); } else { texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); - gDPTri2(gdl++, 0, 2, 3, 0, 3, 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); + gSPTri2(gdl++, 0, 2, 3, 0, 3, 1); } } } @@ -2263,7 +2263,7 @@ Gfx *lasersightRenderDot(Gfx *gdl) colours[0] = 0xff00005f; colours[1] = 0xff00000f; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); if (g_LaserSights[i].unk28 > 0.0f) { if (!(g_LaserSights[i].dotpos.f[0] < 0.0000001f) || !(g_LaserSights[i].dotpos.f[0] > -0.000001f) @@ -2367,9 +2367,9 @@ Gfx *lasersightRenderDot(Gfx *gdl) vertices[3].y = pos.f[1] + (-f20 * f00) + (-f20 * spc8); vertices[3].z = pos.f[2] + (-f20 * f24) + (-f20 * spc4); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); } } } @@ -2480,7 +2480,7 @@ Gfx *lasersightRenderBeam(Gfx *gdl) colours[0] = 0xff00005f; colours[1] = 0xff00000f; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); vertices = gfxAllocateVertices(6); @@ -2528,9 +2528,9 @@ Gfx *lasersightRenderBeam(Gfx *gdl) vertices[5].y = spcc.f[1] + (400 * spb4.f[1]) + (spa8.f[1] * 15.0f); vertices[5].z = spcc.f[2] + (400 * spb4.f[2]) + (spa8.f[2] * 15.0f); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); - gDPTri4(gdl++, 0, 1, 2, 2, 3, 1, 2, 3, 5, 2, 5, 4); + gSPTri4(gdl++, 0, 1, 2, 2, 3, 1, 2, 3, 5, 2, 5, 4); } } diff --git a/src/game/healthbar.c b/src/game/healthbar.c index 13e83eb2c..4ed9c0280 100644 --- a/src/game/healthbar.c +++ b/src/game/healthbar.c @@ -537,32 +537,42 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); gDPSetCombineMode(gdl++, G_CC_SHADE, G_CC_SHADE); + // Same as gSPColor but casts the sizeof to an s32, which is required for a match. +#define gSPColor2(pkt, v, n) \ + gDma1p(pkt, G_COL, v, (s32)sizeof(u32)*(n),((n)-1)<<2) + // Draw shield // There's between 20 and 24 colours and vertices to load here. // The colours are loaded all at once, but the vertices are split into two. numverts = numshieldmarkers * 2; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), numverts); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 14); + gSPColor2(gdl++, osVirtualToPhysical(colours), numverts); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 14, 0); - gDPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); - gDPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); - gDPTri4(gdl++, 8, 9, 10, 9, 10, 11, 10, 11, 12, 11, 12, 13); + gSPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); + gSPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); + gSPTri4(gdl++, 8, 9, 10, 9, 10, 11, 10, 11, 12, 11, 12, 13); // numvertsremaining will be 8-12 numvertsremaining = numverts - 12U; - gDPSetVerticeArrayRaw(gdl++, osVirtualToPhysical(vertices + 12), (numverts - 13) << 4, numvertsremaining * (s32)sizeof(struct gfxvtx)); + // This is a macro expansion of gSPVertex but cases the sizeof to an s32, + // and separates numvertsremaining and numverts - 12. + // Both are required for a match. + gDma1p(gdl++, G_VTX, + osVirtualToPhysical(vertices + 12), + numvertsremaining * (s32) sizeof(struct gfxvtx), + (numverts - 12 - 1) << 4); - gDPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); + gSPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); if (numvertsremaining < 10) { - gDPTri2(gdl++, 4, 5, 6, 5, 6, 7); + gSPTri2(gdl++, 4, 5, 6, 5, 6, 7); } else { - gDPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); + gSPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); if (numvertsremaining >= 12) { - gDPTri2(gdl++, 8, 9, 10, 9, 10, 11); + gSPTri2(gdl++, 8, 9, 10, 9, 10, 11); } } @@ -570,19 +580,19 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg numverts = numarmourmarkers * 2; coloursize = numverts * 4; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours + 24), numverts); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices + 24), numverts); + gSPColor2(gdl++, osVirtualToPhysical(colours + 24), numverts); + gSPVertex(gdl++, osVirtualToPhysical(vertices + 24), numverts, 0); - gDPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); - gDPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); + gSPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); + gSPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); if (coloursize < 56) { - gDPTri2(gdl++, 8, 9, 10, 9, 10, 11); + gSPTri2(gdl++, 8, 9, 10, 9, 10, 11); } else { - gDPTri4(gdl++, 8, 9, 10, 9, 10, 11, 10, 11, 12, 11, 12, 13); + gSPTri4(gdl++, 8, 9, 10, 9, 10, 11, 10, 11, 12, 11, 12, 13); if (coloursize >= 64) { - gDPTri2(gdl++, 12, 13, 14, 13, 14, 15); + gSPTri2(gdl++, 12, 13, 14, 13, 14, 15); } } @@ -590,19 +600,19 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg numverts = numtraumamarkers * 2; coloursize = numverts * 4; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours + 40), numverts); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices + 40), numverts); + gSPColor2(gdl++, osVirtualToPhysical(colours + 40), numverts); + gSPVertex(gdl++, osVirtualToPhysical(vertices + 40), numverts, 0); - gDPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); - gDPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); + gSPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); + gSPTri4(gdl++, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 9); if (coloursize < 56) { - gDPTri2(gdl++, 8, 9, 10, 9, 10, 11); + gSPTri2(gdl++, 8, 9, 10, 9, 10, 11); } else { - gDPTri4(gdl++, 8, 9, 10, 9, 10, 11, 10, 11, 12, 11, 12, 13); + gSPTri4(gdl++, 8, 9, 10, 9, 10, 11, 10, 11, 12, 11, 12, 13); if (coloursize >= 64) { - gDPTri2(gdl++, 12, 13, 14, 13, 14, 15); + gSPTri2(gdl++, 12, 13, 14, 13, 14, 15); } } diff --git a/src/game/menugfx.c b/src/game/menugfx.c index 57ce6ec41..38d0ee2e7 100644 --- a/src/game/menugfx.c +++ b/src/game/menugfx.c @@ -210,10 +210,10 @@ Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) colours[0] = colour; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); return gdl; } @@ -382,13 +382,13 @@ Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) colours[2] = 0x00af0000 | alphas[1]; colours[3] = 0xffff0000 | alphas[1]; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + gSPColor(gdl++, osVirtualToPhysical(colours), 4); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); if (g_20SecIntervalFrac > 0.5f) { - gDPTri4(gdl++, 4, 5, 6, 6, 7, 4, 0, 1, 2, 2, 3, 0); + gSPTri4(gdl++, 4, 5, 6, 6, 7, 4, 0, 1, 2, 2, 3, 0); } else { - gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); + gSPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); } return gdl; @@ -450,10 +450,10 @@ Gfx *menugfxDrawDropdownBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) colours[1] = colour2; colours[2] = colour1 | 0x00003f00; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gSPColor(gdl++, osVirtualToPhysical(colours), 3); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); - gDPTri4(gdl++, 0, 1, 3, 3, 2, 0, 2, 3, 4, 4, 3, 5); + gSPTri4(gdl++, 0, 1, 3, 3, 2, 0, 2, 3, 4, 4, 3, 5); return gdl; } @@ -538,11 +538,11 @@ Gfx *menugfxDrawListGroupHeader(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3 colours[5] = (0x00003f00 | alpha1) & 0xffffff00; colours[6] = 0x6f6f6f00 | alpha1; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 7); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 9); + gSPColor(gdl++, osVirtualToPhysical(colours), 7); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 9, 0); - gDPTri4(gdl++, 0, 1, 3, 3, 2, 0, 2, 3, 4, 4, 3, 5); - gDPTri4(gdl++, 1, 6, 7, 7, 3, 1, 3, 7, 8, 8, 5, 3); + gSPTri4(gdl++, 0, 1, 3, 3, 2, 0, 2, 3, 4, 4, 3, 5); + gSPTri4(gdl++, 1, 6, 7, 7, 3, 1, 3, 7, 8, 8, 5, 3); gdl = menugfxDrawShimmer(gdl, x1, y1, x2, y1 + 1, (alpha1 & 0xff) >> 2, 1, 0x28, 0); gdl = menugfxDrawShimmer(gdl, x1, y2, x2, y2 + 1, (alpha1 & 0xff) >> 2, 0, 0x28, 1); @@ -800,9 +800,9 @@ Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colours colours[2] = colourmid; colours[1] = colourend; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); - gDPTri4(gdl++, 0, 1, 5, 5, 4, 0, 2, 3, 4, 4, 5, 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 3); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); + gSPTri4(gdl++, 0, 1, 5, 5, 4, 0, 2, 3, 4, 4, 5, 2); return gdl; } @@ -859,15 +859,15 @@ Gfx *menugfxRenderSlider(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 markerx, colours[1] = 0xffffffff; colours[2] = 0x0000ff4f; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gSPColor(gdl++, osVirtualToPhysical(colours), 3); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); - gDPTri1(gdl++, 3, 4, 5); + gSPTri1(gdl++, 3, 4, 5); gDPPipeSync(gdl++); gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); - gDPTri1(gdl++, 0, 1, 2); + gSPTri1(gdl++, 0, 1, 2); gDPPipeSync(gdl++); gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2); @@ -956,9 +956,9 @@ Gfx *menugfxDrawTri2(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colours[0] = colour1; colours[1] = colour2; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); return gdl; } @@ -1264,9 +1264,9 @@ Gfx *menugfxDrawCarouselChevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction, colours[0] = colour1; colours[1] = colour2; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 3); - gDPTri1(gdl++, 0, 1, 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 3, 0); + gSPTri1(gdl++, 0, 1, 2); return gdl; } @@ -1358,9 +1358,9 @@ Gfx *menugfxDrawDialogChevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction, u colours[0] = colour1; colours[1] = colour2; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); - gDPTri2(gdl++, 0, 1, 3, 3, 2, 0); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); + gSPTri2(gdl++, 0, 1, 3, 3, 2, 0); return gdl; } @@ -1906,7 +1906,7 @@ Gfx *menugfxRenderBgSuccess(Gfx *gdl) struct coord pos; u32 stack[5]; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 20); + gSPColor(gdl++, osVirtualToPhysical(colours), 20); // Draw the particles for (i = NUM_SUCCESS_PARTICLES - 1; i >= 0; i--) { @@ -1956,9 +1956,9 @@ Gfx *menugfxRenderBgSuccess(Gfx *gdl) vertices[3].colour = (s3 * 4 + (i % 2) * 2 + 1) * 4; vertices[4].colour = (s3 * 4 + (i % 2) * 2 + 1) * 4; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 5); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 5, 0); - gDPTri4(gdl++, 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 1); + gSPTri4(gdl++, 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 1); } } } diff --git a/src/game/nbomb.c b/src/game/nbomb.c index 8f1f70bcb..11b323922 100644 --- a/src/game/nbomb.c +++ b/src/game/nbomb.c @@ -93,10 +93,10 @@ Gfx *func0f006c80(Gfx *gdl, struct coord *arg1, struct coord *arg2, struct coord MAKEVERTEX(1, sp70); MAKEVERTEX(2, sp64); - gDPSetVerticeArrayRaw(gdl++, osVirtualToPhysical(vertices), arg7 | 0x20, 3 * sizeof(struct gfxvtx)); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 3, arg7); if (depth == 0) { - gDPTri4(gdl++, + gSPTri4(gdl++, arg4, arg7, arg7 + 2, arg5, arg7 + 1, arg7, arg6, arg7 + 2, arg7 + 1, @@ -182,8 +182,8 @@ Gfx *func0f0073ac(Gfx *gdl, struct coord *pos, f32 arg2) colours[0] = 0xff00007f; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); gdl = func0f006c80(gdl, &spb0[0], &spb0[4], &spb0[1], 0, 4, 1, 6, 2); gdl = func0f006c80(gdl, &spb0[1], &spb0[4], &spb0[2], 1, 4, 2, 6, 2); @@ -201,7 +201,7 @@ Gfx *func0f0073ac(Gfx *gdl, struct coord *pos, f32 arg2) MAKEVERTEX(4, spb0[4]); MAKEVERTEX(5, spb0[5]); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); gdl = func0f006c80(gdl, &spb0[2], &spb0[4], &spb0[3], 2, 4, 3, 6, 2); gdl = func0f006c80(gdl, &spb0[3], &spb0[4], &spb0[0], 3, 4, 0, 6, 2); @@ -236,7 +236,7 @@ Gfx *func0f008558(Gfx *gdl, s32 depth) MAKEVERTEX(4, sp5c[4]); MAKEVERTEX(5, sp5c[5]); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); gdl = func0f006c80(gdl, &sp5c[0], &sp5c[4], &sp5c[1], 0, 4, 1, 6, depth); gdl = func0f006c80(gdl, &sp5c[1], &sp5c[4], &sp5c[2], 1, 4, 2, 6, depth); @@ -254,7 +254,7 @@ Gfx *func0f008558(Gfx *gdl, s32 depth) MAKEVERTEX(4, sp5c[4]); MAKEVERTEX(5, sp5c[5]); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); gdl = func0f006c80(gdl, &sp5c[2], &sp5c[4], &sp5c[3], 2, 4, 3, 6, depth); gdl = func0f006c80(gdl, &sp5c[3], &sp5c[4], &sp5c[0], 3, 4, 0, 6, depth); @@ -344,7 +344,7 @@ Gfx *nbombCreateGdl(void) vertices[0].x = vertices[0].z; vertices[0].s = vertices[0].t; - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 1, 0); if (index != 0) { u32 stack; @@ -379,7 +379,7 @@ Gfx *nbombRender(Gfx *gdl, struct nbomb *nbomb, Gfx *subgdl) colours[0] = colour; colours[1] = 0xffffff00; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); sp3c.x = 0; sp3c.y = 0; @@ -886,10 +886,10 @@ Gfx *nbombRenderOverlay(Gfx *gdl) colours[0] = finalalpha; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); } if (drawn) { @@ -1088,10 +1088,10 @@ Gfx *gasRender(Gfx *gdl) colours[0] = 0x3faf1100 | alpha; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); - gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); + gSPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); } } diff --git a/src/game/propobj.c b/src/game/propobj.c index 441fd8f38..a5b169cb6 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -13304,9 +13304,9 @@ Gfx *tvscreenRender(struct model *model, struct modelnode *node, struct tvscreen gSPMatrix(gdl++, osVirtualToPhysical(model->matrices), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(gdl++, SPSEGMENT_MODEL_VTX, osVirtualToPhysical(vertices)); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(gdl++, SPSEGMENT_MODEL_VTX << 24, 4); - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(gdl++, SPSEGMENT_MODEL_VTX << 24, 4, 0); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); gSPEndDisplayList(gdl++); gSPBranchList(savedgdl++, gdl); @@ -13522,9 +13522,9 @@ Gfx *gfxRenderRadialShadow(Gfx *gdl, f32 x, f32 y, f32 z, f32 angle, f32 radius, gSPSetGeometryMode(gdl++, G_CULL_BACK); gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); return gdl; } diff --git a/src/game/savebuffer.c b/src/game/savebuffer.c index 2947370a2..a988e1f94 100644 --- a/src/game/savebuffer.c +++ b/src/game/savebuffer.c @@ -364,9 +364,9 @@ Gfx *menugfxDrawPlane(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colours[0] = colour1; colours[1] = colour2; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); - gDPTri2(gdl++, 0, 1, 3, 3, 2, 0); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); + gSPTri2(gdl++, 0, 1, 3, 3, 2, 0); return gdl; } diff --git a/src/game/shards.c b/src/game/shards.c index 905b9c3df..9da8d3a79 100644 --- a/src/game/shards.c +++ b/src/game/shards.c @@ -293,17 +293,17 @@ Gfx *shardsRenderWood(Gfx *gdl) colours[j][3] = g_Shards[g_NextShardNum].colours[j][3] * alphamult; } - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); + gSPColor(gdl++, osVirtualToPhysical(colours), 3); } else { if (g_Shards[i].room != prevroom) { gdl = lightsSetForRoom(gdl, g_Shards[i].room); prevroom = g_Shards[i].room; } - gDPSetColorArray(gdl++, osVirtualToPhysical(g_Shards[i].colours), 3); + gSPColor(gdl++, osVirtualToPhysical(g_Shards[i].colours), 3); } - gDPSetVerticeArray(gdl++, osVirtualToPhysical(g_Shards[i].vertices), 3); + gSPVertex(gdl++, osVirtualToPhysical(g_Shards[i].vertices), 3, 0); gSP1Triangle(gdl++, 0, 1, 2, 0); } } @@ -415,17 +415,17 @@ Gfx *shardsRenderGlass(Gfx *gdl) colours[j][3] = g_Shards[g_NextShardNum].colours[j][3] * alphamult; } - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); + gSPColor(gdl++, osVirtualToPhysical(colours), 3); } else { if (g_Shards[i].room != prevroom) { gdl = lightsSetForRoom(gdl, g_Shards[i].room); prevroom = g_Shards[i].room; } - gDPSetColorArray(gdl++, osVirtualToPhysical(g_Shards[i].colours), 3); + gSPColor(gdl++, osVirtualToPhysical(g_Shards[i].colours), 3); } - gDPSetVerticeArray(gdl++, osVirtualToPhysical(g_Shards[i].vertices), 3); + gSPVertex(gdl++, osVirtualToPhysical(g_Shards[i].vertices), 3, 0); gSP1Triangle(gdl++, 0, 1, 2, 0); } } diff --git a/src/game/sight.c b/src/game/sight.c index 969290312..7a978329a 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -956,9 +956,9 @@ Gfx *sightDrawSkedarTriangle(Gfx *gdl, s32 x, s32 y, s32 dir, u32 colour) vertices[1].colour = 4; vertices[2].colour = 4; - gDPSetColorArray(gdl++, colours, 2); - gDPSetVerticeArray(gdl++, vertices, 3); - gDPTri1(gdl++, 0, 1, 2); + gSPColor(gdl++, colours, 2); + gSPVertex(gdl++, vertices, 3, 0); + gSPTri1(gdl++, 0, 1, 2); return gdl; } @@ -1364,9 +1364,9 @@ Gfx *sightDrawMaian(Gfx *gdl, bool sighton) vertices[7].colour = 4; // Draw the main 4 triangles - gDPSetColorArray(gdl++, colours, 2); - gDPSetVerticeArray(gdl++, vertices, 8); - gDPTri4(gdl++, 0, 4, 5, 5, 3, 6, 7, 6, 1, 4, 7, 2); + gSPColor(gdl++, colours, 2); + gSPVertex(gdl++, vertices, 8, 0); + gSPTri4(gdl++, 0, 4, 5, 5, 3, 6, 7, 6, 1, 4, 7, 2); gdl = func0f0d49c8(gdl); gdl = textSetPrimColour(gdl, 0x00ff0028); diff --git a/src/game/smoke.c b/src/game/smoke.c index 67e70cfb1..a71019b21 100644 --- a/src/game/smoke.c +++ b/src/game/smoke.c @@ -253,10 +253,10 @@ Gfx *smokeRenderPart(struct smoke *smoke, struct smokepart *part, Gfx *gdl, stru vertices[3].t = 1760; vertices[3].colour = 0; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); return gdl; } diff --git a/src/game/sparks.c b/src/game/sparks.c index 591284cdd..4c64913a9 100644 --- a/src/game/sparks.c +++ b/src/game/sparks.c @@ -421,7 +421,7 @@ Gfx *sparksRender(Gfx *gdl) colours[1].a *= frac; } - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); sp120 *= 0.2f; sp120 *= viGetFovY() / 60.0f; @@ -510,7 +510,7 @@ Gfx *sparksRender(Gfx *gdl) break; } - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 3); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 3, 0); gSP1Triangle(gdl++, 0, 1, 2, 0); } diff --git a/src/game/wallhit.c b/src/game/wallhit.c index 6f09f29c2..1d9153b53 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -1239,15 +1239,15 @@ Gfx *wallhitRenderOpaBgHits(s32 roomnum, Gfx *gdl) colours[2] = wallhit->finalcolours[2]; colours[3] = wallhit->finalcolours[3]; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4); + gSPColor(gdl++, osVirtualToPhysical(colours), 4); if (wallhit->vertices2 != NULL) { - gDPSetVerticeArray(gdl++, wallhit->vertices2, 4); + gSPVertex(gdl++, wallhit->vertices2, 4, 0); } else { - gDPSetVerticeArray(gdl++, osVirtualToPhysical(&wallhit->vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(&wallhit->vertices), 4, 0); } - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); } wallhit = wallhit->localnext; @@ -1297,15 +1297,15 @@ Gfx *wallhitRenderXluBgHits(s32 roomnum, Gfx *gdl) colours[2] = wallhit->finalcolours[2]; colours[3] = wallhit->finalcolours[3]; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4); + gSPColor(gdl++, osVirtualToPhysical(colours), 4); if (wallhit->vertices2 != NULL) { - gDPSetVerticeArray(gdl++, wallhit->vertices2, 4); + gSPVertex(gdl++, wallhit->vertices2, 4, 0); } else { - gDPSetVerticeArray(gdl++, osVirtualToPhysical(&wallhit->vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(&wallhit->vertices), 4, 0); } - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); } wallhit = wallhit->localnext; @@ -1384,15 +1384,15 @@ Gfx *wallhitRenderPropHits(Gfx *gdl, struct prop *prop, bool xlu) colours[2] = wallhit->finalcolours[2]; colours[3] = wallhit->finalcolours[3]; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4); + gSPColor(gdl++, osVirtualToPhysical(colours), 4); if (wallhit->vertices2 != NULL) { - gDPSetVerticeArray(gdl++, wallhit->vertices2, 4); + gSPVertex(gdl++, wallhit->vertices2, 4, 0); } else { - gDPSetVerticeArray(gdl++, osVirtualToPhysical(&wallhit->vertices), 4); + gSPVertex(gdl++, osVirtualToPhysical(&wallhit->vertices), 4, 0); } - gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPTri2(gdl++, 0, 1, 2, 0, 2, 3); } wallhit = wallhit->localnext; diff --git a/src/game/weather.c b/src/game/weather.c index c15e5e430..726089857 100644 --- a/src/game/weather.c +++ b/src/game/weather.c @@ -2876,7 +2876,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) colours[0] = var8007f0e4; colours[1] = var8007f0e8; - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); + gSPColor(gdl++, osVirtualToPhysical(colours), 2); spd84[0] = osGetCount(); @@ -3059,8 +3059,8 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) v0_2[2].z = sp198[2].f[2]; if (sp194 == 3) { - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 12); - gDPTri4(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 12, 0); + gSPTri4(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); sp194 = 0; } else { @@ -3076,18 +3076,18 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) } if (sp194 > 0) { - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 12); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 12, 0); if (sp194 == 1) { - gDPTri1(gdl++, 0, 1, 2); + gSPTri1(gdl++, 0, 1, 2); } if (sp194 == 2) { - gDPTri2(gdl++, 0, 1, 2, 3, 4, 5); + gSPTri2(gdl++, 0, 1, 2, 3, 4, 5); } if (sp194 == 3) { - gDPTri3(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8); + gSPTri3(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8); } } @@ -4838,7 +4838,7 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) colours[j] = (var8007f10c & 0xffffff00) | ((0xff * 17 - j * 0xff) / 17); } - gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 16); + gSPColor(gdl++, osVirtualToPhysical(colours), 16); // 51f8 for (s8 = 0; s8 < 500; s8++) { @@ -5087,8 +5087,8 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) vertices[sp198 * 4 + 3].z = sp19c[3].f[2]; if (sp198 == 1) { - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); - gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); + gSPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); sp198 = 0; } else { sp198 = 1; @@ -5100,8 +5100,8 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) } if (sp198 > 0) { - gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); - gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); + gSPTri2(gdl++, 0, 1, 2, 2, 3, 0); } return gdl; diff --git a/src/include/gbiex.h b/src/include/gbiex.h index 56b8cb82b..2b39221b4 100644 --- a/src/include/gbiex.h +++ b/src/include/gbiex.h @@ -1,52 +1,22 @@ #ifndef _IN_GBIEX_H #define _IN_GBIEX_H -#define G_SETCOLOR 0x07 -#define G_TRI4 -79 - /** - * 04 rsp_uc05_vertex + * 07 gSPColor - copy colors from segment + offset into DMEM * * upper word - * 00F00000 number of points - * 0000FFFF number of bytes to grab + * 00FF0000 - number of bytes to copy minus 4 (eg. 4 colours = 0x0c) + * 0000FFFF - nubmer of bytes to copy * * lower word - * 0f000000 segment - * 00ffffff offset in point table + * 0F000000 - segment + * 00FFFFFF - offset in color table */ -#define gDPSetVerticeArrayRaw(pkt, ptr, count, size) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(G_VTX, 24, 8) \ - | _SHIFTL((count), 16, 8) \ - | _SHIFTL((size), 0, 16)); \ - _g->words.w1 = (unsigned int)(ptr); \ -} +#define gSPColor(pkt, v, n) \ + gDma1p(pkt, G_COL, v, sizeof(u32)*(n),((n)-1)<<2) -#define gDPSetVerticeArray(pkt, ptr, numvertices) \ - gDPSetVerticeArrayRaw(pkt, ptr, ((numvertices) - 1) << 4, (numvertices) * sizeof(struct gfxvtx)) - -/** - * 07 rsp_color - * This PD-specific command declares offset to RGBA data - * - * upper word - * 00FF0000 number of bytes to grab, -4 - * 0000FFFF number of bytes to grab - * - * lower word - * 0f000000 segment - * 00ffffff address or offset in file - */ -#define gDPSetColorArray(pkt, ptr, numcolors) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(G_SETCOLOR, 24, 8) \ - | _SHIFTL(((numcolors) - 1) << 2, 16, 8) \ - | _SHIFTL((numcolors) * 4, 0, 16)); \ - _g->words.w1 = (unsigned int)(ptr); \ -} +#define gsSPColor(v, n, v0) \ + gsDma1p(G_COL, v, sizeof(u32)*(n), ((n)-1)<<2) /** * B1 rsp_tri4 @@ -61,41 +31,41 @@ * 0000000F z1 * * lower word - * f0000000 y4 - * 0f000000 x4 - * 00f00000 y3 - * 000f0000 x3 - * 0000f000 y2 - * 00000f00 x2 - * 000000f0 y1 - * 0000000f x1 + * F0000000 y4 + * 0F000000 x4 + * 00F00000 y3 + * 000F0000 x3 + * 0000F000 y2 + * 00000F00 x2 + * 000000F0 y1 + * 0000000F x1 */ -#define gDPTri4(pkt, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(G_TRI4, 24, 8) \ - | _SHIFTL(z4, 12, 4) \ - | _SHIFTL(z3, 8, 4) \ - | _SHIFTL(z2, 4, 4) \ - | _SHIFTL(z1, 0, 4)); \ - _g->words.w1 = (_SHIFTL(y4, 28, 4) \ - | _SHIFTL(x4, 24, 4) \ - | _SHIFTL(y3, 20, 4) \ - | _SHIFTL(x3, 16, 4) \ - | _SHIFTL(y2, 12, 4) \ - | _SHIFTL(x2, 8, 4) \ - | _SHIFTL(y1, 4, 4) \ - | _SHIFTL(x1, 0, 4)); \ +#define gSPTri4(pkt, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \ +{ \ + Gfx *_g = (Gfx *)(pkt); \ + _g->words.w0 = (_SHIFTL(G_TRI4, 24, 8) \ + | _SHIFTL(z4, 12, 4) \ + | _SHIFTL(z3, 8, 4) \ + | _SHIFTL(z2, 4, 4) \ + | _SHIFTL(z1, 0, 4)); \ + _g->words.w1 = (_SHIFTL(y4, 28, 4) \ + | _SHIFTL(x4, 24, 4) \ + | _SHIFTL(y3, 20, 4) \ + | _SHIFTL(x3, 16, 4) \ + | _SHIFTL(y2, 12, 4) \ + | _SHIFTL(x2, 8, 4) \ + | _SHIFTL(y1, 4, 4) \ + | _SHIFTL(x1, 0, 4)); \ } -#define gDPTri3(pkt, x1, y1, z1, x2, y2, z2, x3, y3, z3) \ - gDPTri4(pkt, x1, y1, z1, x2, y2, z2, x3, y3, z3, 0, 0, 0) +#define gSPTri3(pkt, x1, y1, z1, x2, y2, z2, x3, y3, z3) \ + gSPTri4(pkt, x1, y1, z1, x2, y2, z2, x3, y3, z3, 0, 0, 0) -#define gDPTri2(pkt, x1, y1, z1, x2, y2, z2) \ - gDPTri4(pkt, x1, y1, z1, x2, y2, z2, 0, 0, 0, 0, 0, 0) +#define gSPTri2(pkt, x1, y1, z1, x2, y2, z2) \ + gSPTri4(pkt, x1, y1, z1, x2, y2, z2, 0, 0, 0, 0, 0, 0) -#define gDPTri1(pkt, x1, y1, z1) \ - gDPTri4(pkt, x1, y1, z1, 0, 0, 0, 0, 0, 0, 0, 0, 0) +#define gSPTri1(pkt, x1, y1, z1) \ + gSPTri4(pkt, x1, y1, z1, 0, 0, 0, 0, 0, 0, 0, 0, 0) #define gDPLoadTLUT06(pkt, a, b, c, d) \ { \ diff --git a/src/lib/model.c b/src/lib/model.c index 3709f1771..4b79c6611 100644 --- a/src/lib/model.c +++ b/src/lib/model.c @@ -3491,9 +3491,9 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model gSPSetGeometryMode(renderdata->gdl++, G_CULL_BACK); gSPMatrix(renderdata->gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetColorArray(renderdata->gdl++, osVirtualToPhysical(colours), 1); - gDPSetVerticeArray(renderdata->gdl++, osVirtualToPhysical(vertices), 4); - gDPTri2(renderdata->gdl++, 0, 1, 2, 2, 3, 0); + gSPColor(renderdata->gdl++, osVirtualToPhysical(colours), 1); + gSPVertex(renderdata->gdl++, osVirtualToPhysical(vertices), 4, 0); + gSPTri2(renderdata->gdl++, 0, 1, 2, 2, 3, 0); } }