From 5255f7c34623a6cca991e560ed791d444417fc1d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 27 May 2023 11:41:59 +1000 Subject: [PATCH] Use Vtx/Col instead of struct gfxvtx, struct colour and u32 --- include/PR/gbi.h | 49 ++++++++------- src/game/activemenu.c | 8 +-- src/game/bg.c | 52 ++++++++-------- src/game/bondgun.c | 4 +- src/game/bondview.c | 8 +-- src/game/camdraw.c | 10 +-- src/game/chr.c | 70 ++++++++++----------- src/game/credits.c | 32 +++++----- src/game/dlights.c | 8 +-- src/game/dyntex.c | 26 ++++---- src/game/explosions.c | 16 ++--- src/game/game_1531a0.c | 6 +- src/game/gfxmemory.c | 10 +-- src/game/gunfx.c | 28 ++++----- src/game/healthbar.c | 30 ++++----- src/game/menugfx.c | 116 +++++++++++++++++------------------ src/game/modeldef.c | 2 +- src/game/nbomb.c | 30 ++++----- src/game/propobj.c | 48 +++++++-------- src/game/savebuffer.c | 8 +-- src/game/shards.c | 66 ++++++++++---------- src/game/sight.c | 16 ++--- src/game/smoke.c | 4 +- src/game/sparks.c | 4 +- src/game/tex.c | 10 +-- src/game/title.c | 30 ++++----- src/game/wallhit.c | 6 +- src/game/weather.c | 22 +++---- src/include/game/bg.h | 10 +-- src/include/game/chr.h | 2 +- src/include/game/dyntex.h | 4 +- src/include/game/gfxmemory.h | 6 +- src/include/game/propobj.h | 2 +- src/include/game/title.h | 2 +- src/include/gbiex.h | 4 +- src/include/lib/model.h | 4 +- src/include/types.h | 70 +++++++-------------- src/lib/model.c | 24 ++++---- 38 files changed, 409 insertions(+), 438 deletions(-) diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 8e4afb232..79401166e 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -977,32 +977,31 @@ * */ -/* - * Vertex (set up for use with colors) - */ typedef struct { - short ob[3]; /* x, y, z */ - unsigned short flag; - short tc[2]; /* texture coord */ - unsigned char cn[4]; /* color & alpha */ -} Vtx_t; - -/* - * Vertex (set up for use with normals) - */ -typedef struct { - short ob[3]; /* x, y, z */ - unsigned short flag; - short tc[2]; /* texture coord */ - signed char n[3]; /* normal */ - unsigned char a; /* alpha */ -} Vtx_tn; + union { + struct { + /*0x00*/ s16 x; + /*0x02*/ s16 y; + /*0x04*/ s16 z; + }; + s16 v[3]; + }; + /*0x06*/ u8 flags; + /*0x07*/ u8 colour; + /*0x08*/ s16 s; + /*0x0a*/ s16 t; +} Vtx; typedef union { - Vtx_t v; /* Use this one for colors */ - Vtx_tn n; /* Use this one for normals */ - long long int force_structure_alignment; -} Vtx; + u32 word; + u8 bytes[4]; + struct { + u8 r; + u8 g; + u8 b; + u8 a; + }; +} Col; /* * Sprite structure @@ -1601,8 +1600,8 @@ 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(struct gfxvtx)*(n),((n)-1)<<4|(v0)) +#define gSPVertex(pkt, v, n, v0) \ + gDma1p(pkt, G_VTX, v, sizeof(Vtx)*(n),((n)-1)<<4|(v0)) #define gsSPVertex(v, n, v0) \ gsDma1p(G_VTX, v, sizeof(Vtx)*(n), ((n)-1)<<4|(v0)) diff --git a/src/game/activemenu.c b/src/game/activemenu.c index a9f4ba10d..18adcc870 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -1253,8 +1253,8 @@ Gfx *amRender(Gfx *gdl) { struct chrdata *chr; u32 flags; - u32 *colours; - struct gfxvtx *vertices; + Col *colours; + Vtx *vertices; s32 mpchrnum; s16 column; s16 row; @@ -1368,8 +1368,8 @@ Gfx *amRender(Gfx *gdl) vertices[6].colour = 4; vertices[7].colour = 4; - colours[0] = 0x22222200; - colours[1] = 0x0000004f; + colours[0].word = 0x22222200; + colours[1].word = 0x0000004f; gSPColor(gdl++, osVirtualToPhysical(colours), 2); gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); diff --git a/src/game/bg.c b/src/game/bg.c index b3ead9cc0..fd6d15283 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -268,8 +268,8 @@ struct drawslot *bgGetRoomDrawSlot(s32 roomnum) Gfx *bgRenderXrayData(Gfx *gdl, struct xraydata *xraydata) { - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; s32 numgroups; s32 i; s32 count; @@ -283,7 +283,7 @@ Gfx *bgRenderXrayData(Gfx *gdl, struct xraydata *xraydata) vertices[i].y = xraydata->vertices[i][1]; vertices[i].z = xraydata->vertices[i][2]; vertices[i].colour = i << 2; - colours[i] = xraydata->colours[i]; + colours[i].word = xraydata->colours[i]; } count = xraydata->numvertices; @@ -1101,7 +1101,7 @@ glabel var7f1b75c4 ); #else // Mismatch: Regalloc and some reordered instructions -Gfx *bgRenderGdlInXray(Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, s16 arg3[3]) +Gfx *bgRenderGdlInXray(Gfx *gdl, Gfx *gdl2, Vtx *vertices, s16 arg3[3]) { s32 i; s32 stack; @@ -1140,7 +1140,7 @@ Gfx *bgRenderGdlInXray(Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, s16 arg3[3] s32 index = gdl2->bytes[1] & 0xf; s32 numvertices = (((u32)gdl2->bytes[1] >> 4)) + 1; s32 offset = (gdl2->words.w1 & 0xffffff); - struct gfxvtx *vtx = (struct gfxvtx *)((uintptr_t)vertices + offset); + Vtx *vtx = (Vtx *)((uintptr_t)vertices + offset); u32 stack[4]; for (i = 0; i < numvertices; i++) { @@ -3102,7 +3102,7 @@ Gfx *bgGetNextGdlInLayer(s32 roomnum, Gfx *start, u32 types) return xlugdl; } -struct gfxvtx *bgFindVerticesForGdl(s32 roomnum, Gfx *gdl) +Vtx *bgFindVerticesForGdl(s32 roomnum, Gfx *gdl) { struct roomblock *block = g_Rooms[roomnum].gfxdata->blocks; uintptr_t end = (uintptr_t)g_Rooms[roomnum].gfxdata->vertices; @@ -4377,11 +4377,11 @@ void bgLoadRoom(s32 roomnum) // Promote offsets to pointers in the gfxdata header if (g_Rooms[roomnum].gfxdata->vertices) { - g_Rooms[roomnum].gfxdata->vertices = (struct gfxvtx *)((uintptr_t)g_Rooms[roomnum].gfxdata->vertices - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); + g_Rooms[roomnum].gfxdata->vertices = (Vtx *)((uintptr_t)g_Rooms[roomnum].gfxdata->vertices - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } if (g_Rooms[roomnum].gfxdata->colours) { - g_Rooms[roomnum].gfxdata->colours = (u32 *)((uintptr_t)g_Rooms[roomnum].gfxdata->colours - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); + g_Rooms[roomnum].gfxdata->colours = (Col *)((uintptr_t)g_Rooms[roomnum].gfxdata->colours - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } if (g_Rooms[roomnum].gfxdata->opablocks) { @@ -4406,10 +4406,10 @@ void bgLoadRoom(s32 roomnum) block1->gdl = (Gfx *)((uintptr_t)block1->gdl - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } if (block1->vertices != 0) { - block1->vertices = (struct gfxvtx *)((uintptr_t)block1->vertices - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); + block1->vertices = (Vtx *)((uintptr_t)block1->vertices - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } if (block1->colours != 0) { - block1->colours = (u32 *)((uintptr_t)block1->colours - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); + block1->colours = (Col *)((uintptr_t)block1->colours - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } break; case ROOMBLOCKTYPE_PARENT: @@ -4420,10 +4420,10 @@ void bgLoadRoom(s32 roomnum) block1->gdl = (Gfx *)((uintptr_t)block1->gdl - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } if (block1->vertices != 0) { - block1->vertices = (struct gfxvtx *)((uintptr_t)block1->vertices - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); + block1->vertices = (Vtx *)((uintptr_t)block1->vertices - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } if (block1->colours != 0) { - block1->colours = (u32 *)((uintptr_t)block1->colours - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); + block1->colours = (Col *)((uintptr_t)block1->colours - g_BgRooms[roomnum].unk00 + (uintptr_t)allocation); } if ((uintptr_t)block1->vertices < end1) { end1 = (uintptr_t)block1->vertices; @@ -4435,7 +4435,7 @@ void bgLoadRoom(s32 roomnum) } // Calculate the number of vertices and colours - g_Rooms[roomnum].gfxdata->numvertices = ((uintptr_t)g_Rooms[roomnum].gfxdata->colours - (uintptr_t)g_Rooms[roomnum].gfxdata->vertices) / sizeof(struct gfxvtx); + g_Rooms[roomnum].gfxdata->numvertices = ((uintptr_t)g_Rooms[roomnum].gfxdata->colours - (uintptr_t)g_Rooms[roomnum].gfxdata->vertices) / sizeof(Vtx); g_Rooms[roomnum].gfxdata->numcolours = ((uintptr_t)bgGetNextGdlInLayer(roomnum, 0, VTXBATCHTYPE_OPA | VTXBATCHTYPE_XLU) - (uintptr_t)g_Rooms[roomnum].gfxdata->colours) / sizeof(u32); // Build arrays of pointers to gfx blocks and vtx blocks @@ -4832,12 +4832,12 @@ Gfx *bgRenderRoomXlu(Gfx *gdl, s32 roomnum) return gdl; } -s32 bgPopulateVtxBatchType(s32 roomnum, struct vtxbatch *batches, Gfx *gdl, s32 batchindex, struct gfxvtx *vertices, s32 type) +s32 bgPopulateVtxBatchType(s32 roomnum, struct vtxbatch *batches, Gfx *gdl, s32 batchindex, Vtx *vertices, s32 type) { s32 i; s32 j; s32 numvertices; - struct gfxvtx *batchvertices; + Vtx *batchvertices; for (i = 0; gdl[i].dma.cmd != G_ENDDL; i++) { if (gdl[i].dma.cmd == G_VTX) { @@ -4851,7 +4851,7 @@ s32 bgPopulateVtxBatchType(s32 roomnum, struct vtxbatch *batches, Gfx *gdl, s32 } numvertices = (((u32)gdl[i].bytes[1] >> 4) & 0xf) + 1; - batchvertices = (struct gfxvtx *)((uintptr_t)vertices + (gdl[i].words.w1 & 0xffffff)); + batchvertices = (Vtx *)((uintptr_t)vertices + (gdl[i].words.w1 & 0xffffff)); for (j = 0; j < numvertices; j++) { f32 x = batchvertices[j].x; @@ -4959,7 +4959,7 @@ void bgFindRoomVtxBatches(s32 roomnum) g_Rooms[roomnum].vtxbatches = batches; while (gdl) { - struct gfxvtx *vertices = bgFindVerticesForGdl(roomnum, gdl); + Vtx *vertices = bgFindVerticesForGdl(roomnum, gdl); batchindex = bgPopulateVtxBatchType(roomnum, batches, gdl, batchindex, vertices, VTXBATCHTYPE_OPA); gdl = bgGetNextGdlInLayer(roomnum, gdl, VTXBATCHTYPE_OPA); } @@ -4968,7 +4968,7 @@ void bgFindRoomVtxBatches(s32 roomnum) gdl = bgGetNextGdlInLayer(roomnum, NULL, VTXBATCHTYPE_XLU); while (gdl) { - struct gfxvtx *vertices = bgFindVerticesForGdl(roomnum, gdl); + Vtx *vertices = bgFindVerticesForGdl(roomnum, gdl); batchindex = bgPopulateVtxBatchType(roomnum, batches, gdl, batchindex, vertices, VTXBATCHTYPE_XLU); gdl = bgGetNextGdlInLayer(roomnum, gdl, VTXBATCHTYPE_XLU); } @@ -5120,7 +5120,7 @@ bool bgTestLineIntersectsBbox(struct coord *arg0, struct coord *arg1, struct coo } bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, Gfx *gdl, - Gfx *gdl2, struct gfxvtx *vertices, struct hitthing *hitthing) + Gfx *gdl2, Vtx *vertices, struct hitthing *hitthing) { s16 stack; s16 triref; @@ -5133,7 +5133,7 @@ bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *point1; struct coord *point2; struct coord *point3; - struct gfxvtx *vtx; + Vtx *vtx; Gfx *imggdl = NULL; s32 texturenum; f32 lowestsqdist = MAXFLOAT; @@ -5162,7 +5162,7 @@ bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, count = gdl->bytes[1] & 0xf; offset = (gdl->words.w1 & 0xffffff); numvertices = (((u32)gdl->bytes[1] >> 4) & 0xf) + 1; - vtx = (struct gfxvtx *)((uintptr_t)vertices + offset); + vtx = (Vtx *)((uintptr_t)vertices + offset); vtx -= count; ptr[0] = vtx->x; @@ -5417,7 +5417,7 @@ bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, } bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, struct coord *arg3, - Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, f32 *sqdistptr, struct hitthing *hitthing) + Gfx *gdl, Gfx *gdl2, Vtx *vertices, f32 *sqdistptr, struct hitthing *hitthing) { s16 triref; s32 i; @@ -5430,7 +5430,7 @@ bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, bool hit; f32 tmp; f32 sqdist; - struct gfxvtx *vtx; + Vtx *vtx; struct coord *point1; struct coord *point2; struct coord *point3; @@ -5463,7 +5463,7 @@ bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, count = (gdl->bytes[1] & 0xf); word = gdl->words.w1 & 0xffffff; numvertices = ((u32)gdl->bytes[1] >> 4) + 1; - vtx = (struct gfxvtx *)((uintptr_t)vertices + word); + vtx = (Vtx *)((uintptr_t)vertices + word); if (count < spdc) { spdc = count; @@ -5714,7 +5714,7 @@ bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *a struct coord spa4; struct coord min; struct coord max; - struct gfxvtx *vtx; + Vtx *vtx; f32 *ptr; Gfx *iter; Gfx *tmpgdl; @@ -5722,7 +5722,7 @@ bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *a vtx = bgFindVerticesForGdl(roomnum, gdl); iter = &gdl[batch->gbicmdindex]; - vtx = (struct gfxvtx *)((iter->words.w1 & 0xffffff) + (s32)vtx); + vtx = (Vtx *)((iter->words.w1 & 0xffffff) + (s32)vtx); numvertices = (((u32)iter->bytes[1] >> 4) & 0xf) + 1; ptr = var800a6470; diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 1ca74adb3..77c112096 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -6392,9 +6392,9 @@ void bgunExecuteModelCmdList(s32 *ptr) break; case 5: rwdata = (union modelrwdata *)ptr[1]; - rwdata->dl.vertices = (struct gfxvtx *)ptr[2]; + rwdata->dl.vertices = (Vtx *)ptr[2]; rwdata->dl.gdl = (Gfx *)ptr[3]; - rwdata->dl.colours = (struct colour *)ptr[4]; + rwdata->dl.colours = (Col *)ptr[4]; ptr += 5; break; } diff --git a/src/game/bondview.c b/src/game/bondview.c index 9f1cc8b66..64a35530c 100644 --- a/src/game/bondview.c +++ b/src/game/bondview.c @@ -746,8 +746,8 @@ Gfx *bviewDrawFisheye(Gfx *gdl, u32 colour, u32 alpha, s32 shuttertime60, s8 sta */ Gfx *bviewDrawEyespySideRect(Gfx *gdl, s32 *points, u8 r, u8 g, u8 b, u8 alpha) { - struct gfxvtx *vertices = gfxAllocateVertices(4); - u32 *colours = gfxAllocateColours(2); + Vtx *vertices = gfxAllocateVertices(4); + Col *colours = gfxAllocateColours(2); vertices[0].x = points[0] * 10.0f; vertices[0].y = points[1] * 10.0f; @@ -765,8 +765,8 @@ Gfx *bviewDrawEyespySideRect(Gfx *gdl, s32 *points, u8 r, u8 g, u8 b, u8 alpha) vertices[3].y = points[7] * 10.0f; vertices[3].z = -10; - colours[0] = r << 0x18 | g << 0x10 | b << 8 | 0xff; - colours[1] = r << 0x18 | g << 0x10 | b << 8 | alpha; + colours[0].word = r << 0x18 | g << 0x10 | b << 8 | 0xff; + colours[1].word = r << 0x18 | g << 0x10 | b << 8 | alpha; vertices[0].colour = 0; vertices[1].colour = 0; diff --git a/src/game/camdraw.c b/src/game/camdraw.c index 346c6e4b9..7eeb9bdeb 100644 --- a/src/game/camdraw.c +++ b/src/game/camdraw.c @@ -2651,7 +2651,7 @@ void func0f14f1d4(s16 *src, s32 len, s32 *dst) } } -s32 func0f14f2b4(struct modeldef *modeldef, struct gfxvtx **dst, u32 *len) +s32 func0f14f2b4(struct modeldef *modeldef, Vtx **dst, u32 *len) { struct modelnode *node1 = modelGetPart(modeldef, MODELPART_HEAD_0190); struct modelnode *node2 = modelGetPart(modeldef, MODELPART_HEAD_0191); @@ -2675,15 +2675,15 @@ s32 func0f14f2b4(struct modeldef *modeldef, struct gfxvtx **dst, u32 *len) s32 size; totalverts = node1numverts + node2numverts + node3numverts; - size = align16(totalverts * sizeof(struct gfxvtx)); + size = align16(totalverts * sizeof(Vtx)); if (*dst == 0) { *dst = func0f149d58(size, 4429, "camdraw.c"); } - memcpy(*dst, node1rodata->vertices, node1numverts * sizeof(struct gfxvtx)); - memcpy(*dst + node1numverts, node2rodata->vertices, node2numverts * sizeof(struct gfxvtx)); - memcpy(*dst + node1numverts + node2numverts, node3rodata->vertices, node3numverts * sizeof(struct gfxvtx)); + memcpy(*dst, node1rodata->vertices, node1numverts * sizeof(Vtx)); + memcpy(*dst + node1numverts, node2rodata->vertices, node2numverts * sizeof(Vtx)); + memcpy(*dst + node1numverts + node2numverts, node3rodata->vertices, node3numverts * sizeof(Vtx)); if (len != NULL) { *len = size; diff --git a/src/game/chr.c b/src/game/chr.c index a694a4317..b17c8d685 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -156,9 +156,9 @@ void chrDeregister(s32 chrnum) } } -struct gfxvtx *chrAllocateVertices(s32 numvertices) +Vtx *chrAllocateVertices(s32 numvertices) { - return (struct gfxvtx *) gfxAllocate(numvertices * sizeof(struct gfxvtx)); + return (Vtx *) gfxAllocate(numvertices * sizeof(Vtx)); } void chrsSetVar8006297c(u32 arg0) @@ -3683,7 +3683,7 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc struct modelnode *curnode; Gfx *gdlptr; Gfx *gdlptr2; - struct gfxvtx *vertices; + Vtx *vertices; struct modelnode *posnode = NULL; struct coord relpos; struct coord spd4; @@ -3722,13 +3722,13 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc // use the space... after the model definition's colour table? // Let's hope that's not being used by other instances... if (rwdata->gdl == rodata->opagdl) { - gdlptr = (Gfx *)((uintptr_t)rodata->colourtable + ((uintptr_t)rodata->opagdl & 0xffffff)); + gdlptr = (Gfx *)((uintptr_t)rodata->colours + ((uintptr_t)rodata->opagdl & 0xffffff)); } else { gdlptr = rwdata->gdl; } if (rodata->xlugdl) { - gdlptr2 = (Gfx *)((uintptr_t)rodata->colourtable + ((uintptr_t)rodata->xlugdl & 0xffffff)); + gdlptr2 = (Gfx *)((uintptr_t)rodata->colours + ((uintptr_t)rodata->xlugdl & 0xffffff)); } else { gdlptr2 = NULL; } @@ -3756,7 +3756,7 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc s32 numverts; s32 i; - vertices = (struct gfxvtx *)((uintptr_t)rodata->vertices + word); + vertices = (Vtx *)((uintptr_t)rodata->vertices + word); numverts = (u32)ptr[1] / 16 + 1; if (posnode) { @@ -3841,13 +3841,13 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc } if (rwdata->gdl == rodata->opagdl) { - gdlptr = (Gfx *)((uintptr_t)rodata->colourtable + ((u32)rodata->opagdl & 0xffffff)); + gdlptr = (Gfx *)((uintptr_t)rodata->colours + ((u32)rodata->opagdl & 0xffffff)); } else { gdlptr = rwdata->gdl; } if (rodata->xlugdl) { - gdlptr2 = (Gfx *)((uintptr_t)rodata->colourtable + ((u32)rodata->xlugdl & 0xffffff)); + gdlptr2 = (Gfx *)((uintptr_t)rodata->colours + ((u32)rodata->xlugdl & 0xffffff)); } else { gdlptr2 = NULL; } @@ -3870,7 +3870,7 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc if (op == G_VTX) { u8 *ptr = (u8 *)&gdlptr->words.w0; u32 word = gdlptr->words.w1 & 0xffffff; - struct gfxvtx *vertices = (struct gfxvtx *)((uintptr_t)rodata->vertices + word); + Vtx *vertices = (Vtx *)((uintptr_t)rodata->vertices + word); s32 numverts = (u32)ptr[1] / 16 + 1; s32 i; @@ -3881,8 +3881,8 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc s32 z = vertices[i].z + (s32)spd4.f[2]; if (x == bestcoords[0] && y == bestcoords[1] && z == bestcoords[2]) { - if ((uintptr_t)rwdata->colours == ALIGN8((uintptr_t)rodata->vertices + rodata->numvertices * sizeof(struct gfxvtx))) { - struct colour *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0); + if ((uintptr_t)rwdata->colours == ALIGN8((uintptr_t)rodata->vertices + rodata->numvertices * sizeof(Vtx))) { + Col *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0); s32 j; if (colours) { @@ -3896,9 +3896,9 @@ void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struc } } - if ((uintptr_t)rwdata->colours != ALIGN8((uintptr_t)rodata->vertices + rodata->numvertices * sizeof(struct gfxvtx))) { - s32 offset = rwdata->vertices[word / sizeof(struct gfxvtx) + i].colour >> 2; - struct colour *colours = (struct colour *) ((uintptr_t)rwdata->colours + spac); + if ((uintptr_t)rwdata->colours != ALIGN8((uintptr_t)rodata->vertices + rodata->numvertices * sizeof(Vtx))) { + s32 offset = rwdata->vertices[word / sizeof(Vtx) + i].colour >> 2; + Col *colours = (Col *) ((uintptr_t)rwdata->colours + spac); colours[offset].a = alpha; } @@ -3955,7 +3955,7 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct bool ok; s32 nodetype; s32 mindist = 0x7fffffff; - struct gfxvtx *vertices; + Vtx *vertices; s32 bestcoords[3]; struct modelnode *curnode; Gfx *gdlptr; @@ -3997,13 +3997,13 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct // use the space... after the model definition's colour table? // Let's hope that's not being used by other instances... if (rwdata->gdl == rodata->opagdl) { - gdlptr = (Gfx *)((uintptr_t)rodata->colourtable + ((u32)rodata->opagdl & 0xffffff)); + gdlptr = (Gfx *)((uintptr_t)rodata->colours + ((u32)rodata->opagdl & 0xffffff)); } else { gdlptr = rwdata->gdl; } if (rodata->xlugdl) { - gdlptr2 = (Gfx *)((uintptr_t)rodata->colourtable + ((u32)rodata->xlugdl & 0xffffff)); + gdlptr2 = (Gfx *)((uintptr_t)rodata->colours + ((u32)rodata->xlugdl & 0xffffff)); } else { gdlptr2 = NULL; } @@ -4031,7 +4031,7 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct s32 numverts; s32 i; - vertices = (struct gfxvtx *)((uintptr_t)rodata->vertices + word); + vertices = (Vtx *)((uintptr_t)rodata->vertices + word); numverts = (u32)ptr[1] / 16 + 1; if (posnode) { @@ -4135,13 +4135,13 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct } if (rwdata->gdl == rodata->opagdl) { - gdlptr = (Gfx *)((uintptr_t)rodata->colourtable + ((u32)rodata->opagdl & 0xffffff)); + gdlptr = (Gfx *)((uintptr_t)rodata->colours + ((u32)rodata->opagdl & 0xffffff)); } else { gdlptr = rwdata->gdl; } if (rodata->xlugdl) { - gdlptr2 = (Gfx *)((uintptr_t)rodata->colourtable + ((u32)rodata->xlugdl & 0xffffff)); + gdlptr2 = (Gfx *)((uintptr_t)rodata->colours + ((u32)rodata->xlugdl & 0xffffff)); } else { gdlptr2 = NULL; } @@ -4164,7 +4164,7 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct if (op == G_VTX) { u8 *ptr = (u8 *)&gdlptr->words.w0; u32 word = gdlptr->words.w1 & 0xffffff; - struct gfxvtx *vertices = (struct gfxvtx *)((uintptr_t)rodata->vertices + word); + Vtx *vertices = (Vtx *)((uintptr_t)rodata->vertices + word); s32 numverts = (u32)ptr[1] / 16 + 1; s32 i; @@ -4179,8 +4179,8 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct coordinate = vertices[i].z + (s32)spd4.f[2]; if (coordinate == bestcoords[2]) { - if ((uintptr_t)rwdata->colours == ALIGN8((u32)rodata->vertices + rodata->numvertices * sizeof(struct gfxvtx))) { - struct colour *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0); + if ((uintptr_t)rwdata->colours == ALIGN8((u32)rodata->vertices + rodata->numvertices * sizeof(Vtx))) { + Col *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0); s32 j; if (colours) { @@ -4192,9 +4192,9 @@ void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct } } - if ((uintptr_t)rwdata->colours != ALIGN8((uintptr_t)rodata->vertices + rodata->numvertices * sizeof(struct gfxvtx))) { - s32 offset = rwdata->vertices[word / sizeof(struct gfxvtx) + i].colour >> 2; - struct colour *colours = (struct colour *) ((uintptr_t)rwdata->colours + spac); + if ((uintptr_t)rwdata->colours != ALIGN8((uintptr_t)rodata->vertices + rodata->numvertices * sizeof(Vtx))) { + s32 offset = rwdata->vertices[word / sizeof(Vtx) + i].colour >> 2; + Col *colours = (Col *) ((uintptr_t)rwdata->colours + spac); colours[offset].a = alpha; } @@ -4262,9 +4262,9 @@ void chrDisfigure(struct chrdata *chr, struct coord *exppos, f32 damageradius) struct modelnode *node; struct modelrodata_dl *rodata; struct modelrwdata_dl *rwdata; - struct colour *colours; + Col *colours; struct model *model = chr->model; - struct gfxvtx *vertices; + Vtx *vertices; u32 stack; Gfx *gdlptr; Gfx *gdlptr2; @@ -4297,7 +4297,7 @@ void chrDisfigure(struct chrdata *chr, struct coord *exppos, f32 damageradius) if (rwdata->vertices == rodata->vertices) { // Copy the vertices from the modeldef to the vtxstore if (rwdata->vertices == rodata->vertices) { - struct gfxvtx *vertices = vtxstoreAllocate(rodata->numvertices, VTXSTORETYPE_CHRVTX, 0, 0); + Vtx *vertices = vtxstoreAllocate(rodata->numvertices, VTXSTORETYPE_CHRVTX, 0, 0); if (vertices) { for (i = 0; i < rodata->numvertices; i++) { @@ -4326,13 +4326,13 @@ void chrDisfigure(struct chrdata *chr, struct coord *exppos, f32 damageradius) if (rwdata->vertices != rodata->vertices && (uintptr_t)rwdata->colours != ALIGN8((uintptr_t)&rodata->vertices[rodata->numvertices])) { if (rwdata->gdl == rodata->opagdl) { - gdlptr = (Gfx *)((uintptr_t)rodata->colourtable + ((s32)rodata->opagdl & 0xffffff)); + gdlptr = (Gfx *)((uintptr_t)rodata->colours + ((s32)rodata->opagdl & 0xffffff)); } else { gdlptr = rwdata->gdl; } if (rodata->xlugdl) { - gdlptr2 = (Gfx *)((uintptr_t)rodata->colourtable + ((s32)rodata->xlugdl & 0xffffff)); + gdlptr2 = (Gfx *)((uintptr_t)rodata->colours + ((s32)rodata->xlugdl & 0xffffff)); } else { gdlptr2 = NULL; } @@ -4359,7 +4359,7 @@ void chrDisfigure(struct chrdata *chr, struct coord *exppos, f32 damageradius) s32 word = gdlptr->words.w1 & 0xffffff; s32 numverts; - vertices = (struct gfxvtx *)((uintptr_t)rwdata->vertices + word); + vertices = (Vtx *)((uintptr_t)rwdata->vertices + word); numverts = (u32)ptr[1] / 16 + 1; if (posnode) { @@ -5410,9 +5410,9 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop struct modelnode *node, s32 side, s32 arg6, s32 arg7, s32 alpha) { struct modelrodata_bbox *bbox = &node->rodata->bbox; - struct gfxvtx vtxtemplate = {0}; - struct gfxvtx *vertices; - struct colour *colours; + Vtx vtxtemplate = {0}; + Vtx *vertices; + Col *colours; Mtxf *modelmtx; s32 i; s32 xmin; diff --git a/src/game/credits.c b/src/game/credits.c index 9a45c2b53..6063c6dde 100644 --- a/src/game/credits.c +++ b/src/game/credits.c @@ -184,7 +184,7 @@ bool g_CreditsScrollStarted = false; bool g_CreditsAltTitleRequested = false; bool g_CreditsUsingAltTitle = false; -void creditsMap4BgVertices(struct gfxvtx *vertices, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) +void creditsMap4BgVertices(Vtx *vertices, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) { f32 a = arg2 * sinf(arg1) + arg3 * cosf(arg1); f32 b = arg2 * cosf(arg1) - arg3 * sinf(arg1); @@ -202,7 +202,7 @@ void creditsMap4BgVertices(struct gfxvtx *vertices, f32 arg1, f32 arg2, f32 arg3 vertices[3].t = (cosf(arg4 + 4.7123889923096f) - sinf(arg4 + 4.7123889923096f)) * arg6 + b; } -void creditsMap9BgVertices(struct gfxvtx *vertices, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) +void creditsMap9BgVertices(Vtx *vertices, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) { f32 a = arg2 * sinf(arg1) + arg3 * cosf(arg1); f32 b = arg2 * cosf(arg1) - arg3 * sinf(arg1); @@ -248,7 +248,7 @@ void creditsMap9BgVertices(struct gfxvtx *vertices, f32 arg1, f32 arg2, f32 arg3 * 7: 0 1800 * 8: 1800 1800 */ -void creditsInitBgVertices(struct gfxvtx *vertices, s32 z) +void creditsInitBgVertices(Vtx *vertices, s32 z) { s32 i; @@ -276,7 +276,7 @@ struct bgconfig g_CreditsBgConfigs[] = { { 0.01, { 2, 1, 2, 1, 0, 1, 2, 1, 2 }, { { 0x00ffff, 0x0000ff, 0x000000 }, { 0xffffff, 0xffffff, 0xffffff }, { 0xffffff, 0xffffff, 0xffffff } } }, }; -void creditsChooseBgColours(struct gfxvtx *vertices, u32 *colours, s32 confignum, s32 alpha, s32 arg4) +void creditsChooseBgColours(Vtx *vertices, Col *colours, s32 confignum, s32 alpha, s32 arg4) { #if PAL s32 iVar1 = (s32)(g_CreditsBgConfigs[confignum].unk00 * g_CreditsCurFrame2 / (10.0f / 3.0f) + arg4) % 180; @@ -307,15 +307,15 @@ void creditsChooseBgColours(struct gfxvtx *vertices, u32 *colours, s32 confignum weightfrac = (iVar1 % 60) / 60.0f; weight = 255.0f * weightfrac; - colours[0] = colourBlend( + colours[0].word = colourBlend( g_CreditsBgConfigs[confignum].colours[colour2index][0] << 8, g_CreditsBgConfigs[confignum].colours[colour1index][0] << 8, weight) | alpha; - colours[1] = colourBlend( + colours[1].word = colourBlend( g_CreditsBgConfigs[confignum].colours[colour2index][1] << 8, g_CreditsBgConfigs[confignum].colours[colour1index][1] << 8, weight) | alpha; - colours[2] = colourBlend( + colours[2].word = colourBlend( g_CreditsBgConfigs[confignum].colours[colour2index][2] << 8, g_CreditsBgConfigs[confignum].colours[colour1index][2] << 8, weight) | alpha; } @@ -346,8 +346,8 @@ struct creditsbgtype g_CreditsBgTypes[] = { Gfx *creditsDrawBackgroundLayer(Gfx *gdl, u8 type, u8 layernum, f32 arg3, u32 alpha, s32 arg5) { - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; u32 stack; f32 pan; f32 b; @@ -584,8 +584,8 @@ Gfx *creditsFillFramebuffer(Gfx *gdl, u32 colour) */ Gfx *creditsRenderLine(Gfx *gdl, struct coord *from, struct coord *to) { - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; colours = gfxAllocateColours(2); vertices = gfxAllocateVertices(4); @@ -611,8 +611,8 @@ Gfx *creditsRenderLine(Gfx *gdl, struct coord *from, struct coord *to) vertices[2].colour = 4; vertices[3].colour = 0; - colours[0] = 0xffffffff; - colours[1] = 0xffffffff; + colours[0].word = 0xffffffff; + colours[1].word = 0xffffffff; gSPColor(gdl++, osVirtualToPhysical(colours), 2); gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); @@ -854,7 +854,7 @@ void creditsGetParticlePos(struct coord *pos, struct particle *particle, s32 par Gfx *creditsDrawParticles(Gfx *gdl) { - u32 *colours; + Col *colours; u32 colour; s32 i; s32 j; @@ -883,7 +883,7 @@ Gfx *creditsDrawParticles(Gfx *gdl) } for (j = 0; j < 15; j++) { - colours[i + j * 4] = (colour & 0xffffff00) | ((colour & 0xff) * (15 - j) / 15); + colours[i + j * 4].word = (colour & 0xffffff00) | ((colour & 0xff) * (15 - j) / 15); } } @@ -897,7 +897,7 @@ Gfx *creditsDrawParticles(Gfx *gdl) s32 offset; u32 stack[3]; struct coord pos; - struct gfxvtx *vertices; + Vtx *vertices; f32 sine = sinf(g_CreditsData->particles[i].rotation); f32 cosine = cosf(g_CreditsData->particles[i].rotation); f32 radius = g_CreditsData->particles[i].size * 10.0f + 25.0f; diff --git a/src/game/dlights.c b/src/game/dlights.c index fc4776f80..2264c1366 100644 --- a/src/game/dlights.c +++ b/src/game/dlights.c @@ -1563,8 +1563,8 @@ void roomHighlight(s32 roomnum) s32 blue; s32 extra; s32 numcolours; - struct colour *src; - struct colour *dst; + Col *src; + Col *dst; u8 br_settled_regional; s32 max; f32 mult; @@ -1583,8 +1583,8 @@ void roomHighlight(s32 roomnum) g_Rooms[roomnum].colours = dst; extra = g_Rooms[roomnum].br_flash; - src = (struct colour *)((uintptr_t)g_Rooms[roomnum].gfxdata->vertices + g_Rooms[roomnum].gfxdata->numvertices * sizeof(struct gfxvtx)); - src = (struct colour *)ALIGN8((uintptr_t)src); + src = (Col *)((uintptr_t)g_Rooms[roomnum].gfxdata->vertices + g_Rooms[roomnum].gfxdata->numvertices * sizeof(Vtx)); + src = (Col *)ALIGN8((uintptr_t)src); if (g_Rooms[roomnum].flags & ROOMFLAG_RENDERALWAYS) { g_Rooms[roomnum].colours = src; diff --git a/src/game/dyntex.c b/src/game/dyntex.c index e02cc0b01..33600ae35 100644 --- a/src/game/dyntex.c +++ b/src/game/dyntex.c @@ -73,45 +73,45 @@ s32 g_DyntexRoomsCount = 0; s32 g_DyntexTypesCount = 0; s32 g_DyntexVerticesCount = 0; -void dyntexUpdateLinear(struct gfxvtx *vertices, struct dyntextype *type) +void dyntexUpdateLinear(Vtx *vertices, struct dyntextype *type) { s16 tmp = (s32) (g_Lv80SecIntervalFrac * 10.0f * 4096.0f) % 4096; s32 i; for (i = 0; i < type->numvertices; i++) { - struct gfxvtx *vertex = (struct gfxvtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); + Vtx *vertex = (Vtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); vertex->t = g_DyntexVertices[type->vertexlistoffset + i].t + tmp; vertex->s = g_DyntexVertices[type->vertexlistoffset + i].s; } } -void dyntexUpdateReset(struct gfxvtx *vertices, struct dyntextype *type) +void dyntexUpdateReset(Vtx *vertices, struct dyntextype *type) { s32 i; for (i = 0; i < type->numvertices; i++) { - struct gfxvtx *vertex = (struct gfxvtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); + Vtx *vertex = (Vtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); vertex->s = 0; vertex->t = 0; } } -void dyntexUpdateMonitor(struct gfxvtx *vertices, struct dyntextype *type) +void dyntexUpdateMonitor(Vtx *vertices, struct dyntextype *type) { s16 tmp = (s32) (g_Lv80SecIntervalFrac * 4.0f * 4096.0f) % 4096; s32 i; for (i = 0; i < type->numvertices; i++) { - struct gfxvtx *vertex = (struct gfxvtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); + Vtx *vertex = (Vtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); vertex->t = g_DyntexVertices[type->vertexlistoffset + i].t - tmp; vertex->s = g_DyntexVertices[type->vertexlistoffset + i].s; } } -void dyntexUpdateOcean(struct gfxvtx *vertices, struct dyntextype *type) +void dyntexUpdateOcean(Vtx *vertices, struct dyntextype *type) { f32 f24 = g_Lv80SecIntervalFrac * 5.0f; f32 angle; @@ -124,7 +124,7 @@ void dyntexUpdateOcean(struct gfxvtx *vertices, struct dyntextype *type) mainOverrideVariable("ripsize", &ripsize); for (i = 0; i < type->numvertices; i++) { - struct gfxvtx *vertex = (struct gfxvtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); + Vtx *vertex = (Vtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); angle = ((g_DyntexVertices[type->vertexlistoffset + i].t % modula) / (f32) modula + f24) * M_BADTAU; vertex->t = g_DyntexVertices[type->vertexlistoffset + i].t + (s16) (sinf(angle) * ripsize); @@ -134,20 +134,20 @@ void dyntexUpdateOcean(struct gfxvtx *vertices, struct dyntextype *type) } } -void dyntexUpdateArrows(struct gfxvtx *vertices, struct dyntextype *type) +void dyntexUpdateArrows(Vtx *vertices, struct dyntextype *type) { s32 tmp = ((s32) ((1.0f - g_Lv80SecIntervalFrac) * 60.0f * 8.0f) % 8) * 256; s32 i; for (i = 0; i < type->numvertices; i++) { - struct gfxvtx *vertex = (struct gfxvtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); + Vtx *vertex = (Vtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); vertex->s = g_DyntexVertices[type->vertexlistoffset + i].s + tmp; vertex->t = g_DyntexVertices[type->vertexlistoffset + i].t; } } -void dyntexTickRoom(s32 roomnum, struct gfxvtx *vertices) +void dyntexTickRoom(s32 roomnum, Vtx *vertices) { s32 index = -1; s32 i; @@ -182,7 +182,7 @@ void dyntexTickRoom(s32 roomnum, struct gfxvtx *vertices) // @bug: Using i for both outer and inner loops for (i = 0; i < type->numvertices; i++) { - struct gfxvtx *vertex = (struct gfxvtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); + Vtx *vertex = (Vtx *)((s32)vertices + g_DyntexVertices[type->vertexlistoffset + i].offset); g_DyntexVertices[type->vertexlistoffset + i].s = vertex->s; g_DyntexVertices[type->vertexlistoffset + i].t = vertex->t; @@ -270,7 +270,7 @@ void dyntexTickRoom(s32 roomnum, struct gfxvtx *vertices) g_DyntexRooms[index].updatedframe = g_Vars.lvframenum; } -void dyntexAddVertex(struct gfxvtx *vertex) +void dyntexAddVertex(Vtx *vertex) { if (g_DyntexCurRoom < 0) { return; diff --git a/src/game/explosions.c b/src/game/explosions.c index 75ae6be9c..275710270 100644 --- a/src/game/explosions.c +++ b/src/game/explosions.c @@ -1289,7 +1289,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) if (roomnum != -1) { struct screenbox screenbox; struct coord *coord = roomGetPosPtr(roomnum); - u32 *colour; + Col *colours; s32 tmp; if (func0f08e5a8(prop->rooms, &screenbox) > 0) { @@ -1305,10 +1305,10 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) gSPDisplayList(gdl++, g_TexGdl2); - colour = gfxAllocateColours(1); + colours = gfxAllocateColours(1); if (USINGDEVICE(DEVICE_NIGHTVISION) || USINGDEVICE(DEVICE_IRSCANNER)) { - *colour = 0xffffffff; + colours[0].word = 0xffffffff; } else if (g_Vars.currentplayer->visionmode == VISIONMODE_XRAY) { u32 alpha = 0x80; u32 red; @@ -1332,15 +1332,15 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) red = expdist * 127.0f; green = (1.0f - expdist) * 127.0f; - *colour = red << 24 | green << 16 | alpha | 0x80800000; + colours[0].word = red << 24 | green << 16 | alpha | 0x80800000; } else { static u32 var8007e93c = 0xffffffff; mainOverrideVariable("ecol", &var8007e93c); - *colour = 0xffffffff; - *colour = var8007e93c; + colours[0].word = 0xffffffff; + colours[0].word = var8007e93c; } - gSPColor(gdl++, osVirtualToPhysical(colour), 1); + gSPColor(gdl++, osVirtualToPhysical(colours), 1); for (i = 14; i >= 0; i--) { gDPSetTextureImage(gdl++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, g_ExplosionTexturePairs[i].texturenum1); @@ -1388,7 +1388,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) Gfx *explosionRenderPart(struct explosion *exp, struct explosionpart *part, Gfx *gdl, struct coord *coord, s32 arg4) { - struct gfxvtx *vertices = gfxAllocateVertices(4); + Vtx *vertices = gfxAllocateVertices(4); Mtxf *mtx = camGetProjectionMtxF(); struct coord spbc; struct coord spb0; diff --git a/src/game/game_1531a0.c b/src/game/game_1531a0.c index 0a4085dc8..634816da1 100644 --- a/src/game/game_1531a0.c +++ b/src/game/game_1531a0.c @@ -1708,8 +1708,8 @@ Gfx *text0f154f38(Gfx *gdl, s32 *arg1, struct fontchar *curchar, struct fontchar s16 sp34; s16 sp32; s16 sp30; - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; s32 tmp; tmp = (font->kerning[prevchar->kerningindex * 13 + curchar->kerningindex] + var8007fac4); @@ -1760,7 +1760,7 @@ Gfx *text0f154f38(Gfx *gdl, s32 *arg1, struct fontchar *curchar, struct fontchar vertices = gfxAllocateVertices(4); colours = gfxAllocateColours(1); - colours[0] = 0xff0000ff; + colours[0].word = 0xff0000ff; vertices[0].z = -10; vertices[1].z = -10; diff --git a/src/game/gfxmemory.c b/src/game/gfxmemory.c index 280bea1e1..a7d6bb9d6 100644 --- a/src/game/gfxmemory.c +++ b/src/game/gfxmemory.c @@ -123,10 +123,10 @@ Gfx *gfxGetMasterDisplayList(void) return (Gfx *)g_GfxBuffers[g_GfxActiveBufferIndex]; } -struct gfxvtx *gfxAllocateVertices(u32 count) +Vtx *gfxAllocateVertices(u32 count) { void *ptr = g_GfxMemPos; - g_GfxMemPos += count * sizeof(struct gfxvtx); + g_GfxMemPos += count * sizeof(Vtx); g_GfxMemPos = (u8 *)ALIGN16((uintptr_t)g_GfxMemPos); return ptr; @@ -145,7 +145,7 @@ void *gfxAllocateMatrix(void) * The function allocates 0x8 for every count, so it could be allocating lights * instead, however it's only used for LookAts so it's named as LookAt. */ -void *gfxAllocateLookAt(s32 count) +LookAt *gfxAllocateLookAt(s32 count) { void *ptr = g_GfxMemPos; g_GfxMemPos += count * (sizeof(LookAt) / 2); @@ -153,10 +153,10 @@ void *gfxAllocateLookAt(s32 count) return ptr; } -void *gfxAllocateColours(s32 count) +Col *gfxAllocateColours(s32 count) { void *ptr = g_GfxMemPos; - count = ALIGN16(count * sizeof(u32)); + count = ALIGN16(count * sizeof(Col)); g_GfxMemPos += count; return ptr; diff --git a/src/game/gunfx.c b/src/game/gunfx.c index 6da770825..fe2e68646 100644 --- a/src/game/gunfx.c +++ b/src/game/gunfx.c @@ -171,11 +171,11 @@ Gfx *beamRenderGeneric(Gfx *gdl, struct textureconfig *texconfig, { struct coord spe4; f32 length; - struct gfxvtx *vertices; + Vtx *vertices; struct coord spd0; struct coord *campos = &g_Vars.currentplayer->cam_pos; Mtxf *spc8; - u32 *colours = gfxAllocateColours(2); + Col *colours = gfxAllocateColours(2); Mtxf sp84; Mtxf *worldtoscreenmtx = camGetWorldToScreenMtxf(); struct coord sp74 = {0, 0, 0}; @@ -225,8 +225,8 @@ Gfx *beamRenderGeneric(Gfx *gdl, struct textureconfig *texconfig, return gdl; } - colours[0] = headcolour; - colours[1] = tailcolour; + colours[0].word = headcolour; + colours[1].word = tailcolour; spd0.f[0] = (spe4.f[1] * (campos->f[2] - (headpos->f[2] + length * spe4.f[2]))) - (spe4.f[2] * (campos->f[1] - (headpos->f[1] + length * spe4.f[1]))); spd0.f[1] = (spe4.f[2] * (campos->f[0] - (headpos->f[0] + length * spe4.f[0]))) - (spe4.f[0] * (campos->f[2] - (headpos->f[2] + length * spe4.f[2]))); @@ -1441,12 +1441,12 @@ Gfx *beamRender(Gfx *gdl, struct beam *beam, bool arg2, u8 arg3) Mtxf sp148; if (arg3 < 5 && beam->age >= 0) { - struct colour *colours = gfxAllocateColours(1); // 144 + Col *colours = gfxAllocateColours(1); // 144 struct coord sp138; struct coord *campos = &g_Vars.currentplayer->cam_pos; // 134 f32 sp130; f32 sp12c = beam->mindist; - struct gfxvtx *vertices; + Vtx *vertices; f32 sp124 = beam->dist; struct coord sp118; struct coord sp10c; @@ -2247,8 +2247,8 @@ Gfx *lasersightRenderDot(Gfx *gdl) if (g_LaserSights[i].id != -1) { struct coord pos; struct coord rot; - u32 *colours; - struct gfxvtx *vertices; + Col *colours; + Vtx *vertices; pos.x = g_LaserSights[i].dotpos.x; pos.y = g_LaserSights[i].dotpos.y; @@ -2260,8 +2260,8 @@ Gfx *lasersightRenderDot(Gfx *gdl) colours = gfxAllocateColours(2); - colours[0] = 0xff00005f; - colours[1] = 0xff00000f; + colours[0].word = 0xff00005f; + colours[1].word = 0xff00000f; gSPColor(gdl++, osVirtualToPhysical(colours), 2); @@ -2431,12 +2431,12 @@ Gfx *lasersightRenderBeam(Gfx *gdl) for (i = 0; i < 4; i++) { if (g_LaserSights[i].id != -1) { - u32 *colours; + Col *colours; struct coord spcc; struct coord spc0; struct coord spb4; struct coord spa8; - struct gfxvtx *vertices; + Vtx *vertices; struct coord sp98; sp98.x = g_LaserSights[i].beamnear.x; @@ -2477,8 +2477,8 @@ Gfx *lasersightRenderBeam(Gfx *gdl) colours = gfxAllocateColours(2); - colours[0] = 0xff00005f; - colours[1] = 0xff00000f; + colours[0].word = 0xff00005f; + colours[1].word = 0xff00000f; gSPColor(gdl++, osVirtualToPhysical(colours), 2); diff --git a/src/game/healthbar.c b/src/game/healthbar.c index 4ed9c0280..8df9d1909 100644 --- a/src/game/healthbar.c +++ b/src/game/healthbar.c @@ -138,14 +138,14 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg s32 shieldmarkerindexes[12]; s32 armourmarkerindexes[8]; s32 traumamarkerindexes[8]; - struct gfxvtx *vertices; - u32 *colours; - u32 *shieldcolours; - u32 *armourcolours; - u32 *traumacolours; - struct gfxvtx *shieldvertices; - struct gfxvtx *armourvertices; - struct gfxvtx *traumavertices; + Vtx *vertices; + Col *colours; + Col *shieldcolours; + Col *armourcolours; + Col *traumacolours; + Vtx *shieldvertices; + Vtx *armourvertices; + Vtx *traumavertices; f32 shieldfillincfade; f32 shieldfillexcfade; f32 armourfillincfade; @@ -449,7 +449,7 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg shieldvertices->colour = (i + i) << 2; shieldvertices++; - *shieldcolours = colour; + shieldcolours->word = colour; shieldcolours++; shieldvertices->x = (s32)marker->x2 + offx; @@ -458,7 +458,7 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg shieldvertices->colour = (i + i + 1) << 2; shieldvertices++; - *shieldcolours = colour; + shieldcolours->word = colour; shieldcolours++; } @@ -483,7 +483,7 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg armourvertices->colour = (i + i) << 2; armourvertices++; - *armourcolours = colour; + armourcolours->word = colour; armourcolours++; armourvertices->x = (s32)marker->x2 + offx; @@ -492,7 +492,7 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg armourvertices->colour = (i + i + 1) << 2; armourvertices++; - *armourcolours = colour; + armourcolours->word = colour; armourcolours++; } @@ -517,7 +517,7 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg traumavertices->colour = (i + i) << 2; traumavertices++; - *traumacolours = colour; + traumacolours->word = colour; traumacolours++; traumavertices->x = (s32)marker->x2 + offx; @@ -526,7 +526,7 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg traumavertices->colour = (i + i + 1) << 2; traumavertices++; - *traumacolours = colour; + traumacolours->word = colour; traumacolours++; } @@ -561,7 +561,7 @@ Gfx *healthbarDraw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracarg // Both are required for a match. gDma1p(gdl++, G_VTX, osVirtualToPhysical(vertices + 12), - numvertsremaining * (s32) sizeof(struct gfxvtx), + numvertsremaining * (s32) sizeof(Vtx), (numverts - 12 - 1) << 4); gSPTri4(gdl++, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5); diff --git a/src/game/menugfx.c b/src/game/menugfx.c index 38d0ee2e7..b1cfad1fb 100644 --- a/src/game/menugfx.c +++ b/src/game/menugfx.c @@ -117,8 +117,8 @@ void menugfxCreateBlur(void) Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) { - u32 *colours; - struct gfxvtx *vertices; + Col *colours; + Vtx *vertices; #if VERSION >= VERSION_PAL_BETA s32 width; s32 height; @@ -208,7 +208,7 @@ Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) vertices[2].colour = 0; vertices[3].colour = 0; - colours[0] = colour; + colours[0].word = colour; gSPColor(gdl++, osVirtualToPhysical(colours), 1); gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); @@ -218,7 +218,7 @@ Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) return gdl; } -void func0f0e0cbc(s32 arg0, s32 arg1, s16 arg2, s16 arg3, struct gfxvtx *vertex, Mtxf *arg5) +void func0f0e0cbc(s32 arg0, s32 arg1, s16 arg2, s16 arg3, Vtx *vertex, Mtxf *arg5) { struct coord sp24; @@ -280,8 +280,8 @@ Gfx *menugfxRenderDialogBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, str Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) { s32 i; - u32 *colours; - struct gfxvtx *vertices; + Col *colours; + Vtx *vertices; u32 alphas[2]; s16 t5; s16 s0; @@ -377,10 +377,10 @@ Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) vertices[6].colour = 8; vertices[7].colour = 8; - colours[0] = 0x00af0000 | alphas[0]; - colours[1] = 0xffff0000 | alphas[0]; - colours[2] = 0x00af0000 | alphas[1]; - colours[3] = 0xffff0000 | alphas[1]; + colours[0].word = 0x00af0000 | alphas[0]; + colours[1].word = 0xffff0000 | alphas[0]; + colours[2].word = 0x00af0000 | alphas[1]; + colours[3].word = 0xffff0000 | alphas[1]; gSPColor(gdl++, osVirtualToPhysical(colours), 4); gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); @@ -396,8 +396,8 @@ Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) Gfx *menugfxDrawDropdownBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) { - u32 *colours = gfxAllocateColours(3); - struct gfxvtx *vertices = gfxAllocateVertices(6); + Col *colours = gfxAllocateColours(3); + Vtx *vertices = gfxAllocateVertices(6); u32 colour1; u32 colour2; @@ -446,9 +446,9 @@ Gfx *menugfxDrawDropdownBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) colour1 = text0f1543ac((x1 + x2) / 2, (y2 + y1) / 2, 0xffffffff) & 0xff; colour2 = (text0f1543ac((x1 + x2) / 2, (y2 + y1) / 2, 0xffffff7f) & 0xff) | 0x00006f00; - colours[0] = colour1 | 0x00006f00; - colours[1] = colour2; - colours[2] = colour1 | 0x00003f00; + colours[0].word = colour1 | 0x00006f00; + colours[1].word = colour2; + colours[2].word = colour1 | 0x00003f00; gSPColor(gdl++, osVirtualToPhysical(colours), 3); gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); @@ -464,8 +464,8 @@ Gfx *menugfxDrawListGroupHeader(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3 Gfx *menugfxDrawListGroupHeader(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3) #endif { - u32 *colours = gfxAllocateColours(7); - struct gfxvtx *vertices = gfxAllocateVertices(9); + Col *colours = gfxAllocateColours(7); + Vtx *vertices = gfxAllocateVertices(9); u32 alpha1; u32 alpha2; @@ -526,17 +526,17 @@ Gfx *menugfxDrawListGroupHeader(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3 alpha2 = text0f1543ac((x1 + x2) / 2, (y1 + y2) / 2, 0xffffff7f) & 0xff; #endif - colours[0] = 0x00006f00 | alpha1; - colours[1] = 0x00006f00 | alpha2; + colours[0].word = 0x00006f00 | alpha1; + colours[1].word = 0x00006f00 | alpha2; #if VERSION >= VERSION_NTSC_1_0 - colours[2] = 0x00003f00 | alpha2; + colours[2].word = 0x00003f00 | alpha2; #else - colours[2] = 0x00003f00 | alpha1; + colours[2].word = 0x00003f00 | alpha1; #endif - colours[3] = 0xffffff00; - colours[4] = (0x00006f00 | alpha2) & 0xffffff00; - colours[5] = (0x00003f00 | alpha1) & 0xffffff00; - colours[6] = 0x6f6f6f00 | alpha1; + colours[3].word = 0xffffff00; + colours[4].word = (0x00006f00 | alpha2) & 0xffffff00; + colours[5].word = (0x00003f00 | alpha1) & 0xffffff00; + colours[6].word = 0x6f6f6f00 | alpha1; gSPColor(gdl++, osVirtualToPhysical(colours), 7); gSPVertex(gdl++, osVirtualToPhysical(vertices), 9, 0); @@ -737,8 +737,8 @@ glabel menugfxRenderGradient // Mismatch: Goal has the if statement with empty contents Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colourstart, u32 colourmid, u32 colourend) { - u32 *colours = gfxAllocateColours(3); - struct gfxvtx *vertices = gfxAllocateVertices(6); + Col *colours = gfxAllocateColours(3); + Vtx *vertices = gfxAllocateVertices(6); s32 ymid; gDPPipeSync(gdl++); @@ -796,9 +796,9 @@ Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colours vertices[5].y = ymid * 10; vertices[5].colour = 8; - colours[0] = colourstart; - colours[2] = colourmid; - colours[1] = colourend; + colours[0].word = colourstart; + colours[2].word = colourmid; + colours[1].word = colourend; gSPColor(gdl++, osVirtualToPhysical(colours), 3); gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); @@ -810,8 +810,8 @@ Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colours Gfx *menugfxRenderSlider(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 markerx, u32 colour) { - u32 *colours = gfxAllocateColours(3); - struct gfxvtx *vertices = gfxAllocateVertices(6); + Col *colours = gfxAllocateColours(3); + Vtx *vertices = gfxAllocateVertices(6); gDPPipeSync(gdl++); gDPSetCycleType(gdl++, G_CYC_1CYCLE); @@ -855,9 +855,9 @@ Gfx *menugfxRenderSlider(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 markerx, vertices[4].colour = 8; vertices[5].colour = 8; - colours[0] = (colour & 0xffffff00) | 0x4f; - colours[1] = 0xffffffff; - colours[2] = 0x0000ff4f; + colours[0].word = (colour & 0xffffff00) | 0x4f; + colours[1].word = 0xffffffff; + colours[2].word = 0x0000ff4f; gSPColor(gdl++, osVirtualToPhysical(colours), 3); gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); @@ -919,8 +919,8 @@ Gfx *menugfx0f0e2498(Gfx *gdl) Gfx *menugfxDrawTri2(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colour2, bool arg7) { - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; colours = gfxAllocateColours(2); vertices = gfxAllocateVertices(4); @@ -953,8 +953,8 @@ Gfx *menugfxDrawTri2(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 vertices[3].colour = 4; } - colours[0] = colour1; - colours[1] = colour2; + colours[0].word = colour1; + colours[1].word = colour2; gSPColor(gdl++, osVirtualToPhysical(colours), 2); gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); @@ -1199,8 +1199,8 @@ Gfx *menugfxDrawFilledRect(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1 */ Gfx *menugfxDrawCarouselChevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction, u32 colour1, u32 colour2) { - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; s16 halfwidth; s16 halfheight; s16 relx; @@ -1261,8 +1261,8 @@ Gfx *menugfxDrawCarouselChevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction, vertices[1].colour = 4; vertices[2].colour = 4; - colours[0] = colour1; - colours[1] = colour2; + colours[0].word = colour1; + colours[1].word = colour2; gSPColor(gdl++, osVirtualToPhysical(colours), 2); gSPVertex(gdl++, osVirtualToPhysical(vertices), 3, 0); @@ -1283,8 +1283,8 @@ Gfx *menugfxDrawCarouselChevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction, Gfx *menugfxDrawDialogChevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction, u32 colour1, u32 colour2, f32 arg7) { u32 stack; - u32 *colours; - struct gfxvtx *vertices; + Col *colours; + Vtx *vertices; s16 halfwidth; s16 halfheight; s16 relx; @@ -1355,8 +1355,8 @@ Gfx *menugfxDrawDialogChevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction, u vertices[2].colour = 4; vertices[3].colour = 4; - colours[0] = colour1; - colours[1] = colour2; + colours[0].word = colour1; + colours[1].word = colour2; gSPColor(gdl++, osVirtualToPhysical(colours), 2); gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); @@ -1753,8 +1753,8 @@ Gfx *menugfxRenderBgSuccess(Gfx *gdl) { Mtxf sp110; Mtxf *modelmtx; - u32 *colours; - u32 *ptr; + Col *colours; + Col *ptr; s32 i; s32 j; f32 f0; @@ -1853,50 +1853,50 @@ Gfx *menugfxRenderBgSuccess(Gfx *gdl) if (gray) { for (j = 0, ptr = colours; j < 5;) { - ptr[0] = 0xffffff00 | ((5 - j) * 127u / 5); + ptr[0].word = 0xffffff00 | ((5 - j) * 127u / 5); ptr += 4; j++; } for (j = 0, ptr = colours; j < 5;) { - ptr[1] = 0xaaaaaa00 | ((5 - j) * 16u / 5); + ptr[1].word = 0xaaaaaa00 | ((5 - j) * 16u / 5); ptr += 4; j++; } for (j = 0, ptr = colours; j < 5;) { - ptr[2] = 0xffffff00 | ((5 - j) * 127u / 5); + ptr[2].word = 0xffffff00 | ((5 - j) * 127u / 5); ptr += 4; j++; } for (j = 0, ptr = colours; j < 5;) { - ptr[3] = 0xaaaaaa00 | ((5 - j) * 16u / 5); + ptr[3].word = 0xaaaaaa00 | ((5 - j) * 16u / 5); ptr += 4; j++; } } else { for (j = 0, ptr = colours; j < 5;) { - ptr[0] = 0xffffff00 | ((5 - j) * 127u / 5); + ptr[0].word = 0xffffff00 | ((5 - j) * 127u / 5); ptr += 4; j++; } for (j = 0, ptr = colours; j < 5;) { - ptr[1] = 0xaaaaff00 | ((5 - j) * 16u / 5); + ptr[1].word = 0xaaaaff00 | ((5 - j) * 16u / 5); ptr += 4; j++; } for (j = 0, ptr = colours; j < 5;) { - ptr[2] = 0xffffff00 | ((5 - j) * 127u / 5); + ptr[2].word = 0xffffff00 | ((5 - j) * 127u / 5); ptr += 4; j++; } for (j = 0, ptr = colours; j < 5;) { if (colours); - ptr[3] = 0xffaaff00 | ((5 - j) * 16u / 5); + ptr[3].word = 0xffaaff00 | ((5 - j) * 16u / 5); ptr += 4; j++; } @@ -1928,7 +1928,7 @@ Gfx *menugfxRenderBgSuccess(Gfx *gdl) f32 invsine2 = -sine; f32 invsine = -sine; f32 invcosine = -cosine; - struct gfxvtx *vertices = gfxAllocateVertices(5); + Vtx *vertices = gfxAllocateVertices(5); vertices[0].x = pos.f[0]; vertices[0].y = pos.f[1]; diff --git a/src/game/modeldef.c b/src/game/modeldef.c index 546c48ebe..ab23eeb6d 100644 --- a/src/game/modeldef.c +++ b/src/game/modeldef.c @@ -117,7 +117,7 @@ void modeldef0f1a7560(struct modeldef *modeldef, u16 filenum, u32 arg2, struct m struct modelnode *node; struct modelnode *prevnode; uintptr_t gdl; - struct gfxvtx *vertices; + Vtx *vertices; allocsize = fileGetAllocationSize(filenum); loadedsize = fileGetLoadedSize(filenum); diff --git a/src/game/nbomb.c b/src/game/nbomb.c index 11b323922..6d3ff25f6 100644 --- a/src/game/nbomb.c +++ b/src/game/nbomb.c @@ -55,7 +55,7 @@ Gfx *func0f006c80(Gfx *gdl, struct coord *arg1, struct coord *arg2, struct coord struct coord sp70; struct coord sp64; f32 dist; - struct gfxvtx *vertices; + Vtx *vertices; sp7c.x = arg2->x + arg1->x; sp7c.y = arg2->y + arg1->y; @@ -114,8 +114,8 @@ Gfx *func0f006c80(Gfx *gdl, struct coord *arg1, struct coord *arg2, struct coord Gfx *func0f0073ac(Gfx *gdl, struct coord *pos, f32 arg2) { Mtxf *modelmtx = gfxAllocateMatrix(); - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; Mtxf sp104; struct coord spf8[1]; struct coord spb0[] = { @@ -180,7 +180,7 @@ Gfx *func0f0073ac(Gfx *gdl, struct coord *pos, f32 arg2) colours = gfxAllocateColours(1); - colours[0] = 0xff00007f; + colours[0].word = 0xff00007f; gSPColor(gdl++, osVirtualToPhysical(colours), 1); gSPVertex(gdl++, osVirtualToPhysical(vertices), 6, 0); @@ -213,7 +213,7 @@ Gfx *func0f0073ac(Gfx *gdl, struct coord *pos, f32 arg2) Gfx *func0f008558(Gfx *gdl, s32 depth) { - struct gfxvtx *vertices; + Vtx *vertices; struct coord sp5c[] = { { 0, 0, 1 }, { 1, 0, 0 }, @@ -309,7 +309,7 @@ s32 nbombCalculateAlpha(struct nbomb *nbomb) */ Gfx *nbombCreateGdl(void) { - struct gfxvtx *vertices; + Vtx *vertices; u32 gdlsizes[] = { 0x0a30, 0x0330 }; // 1 player, 2+ players Gfx *gdlstart; Gfx *gdl; @@ -369,15 +369,15 @@ Gfx *nbombRender(Gfx *gdl, struct nbomb *nbomb, Gfx *subgdl) Mtxf sp48; struct coord sp3c; u32 colour; - u32 *colours; + Col *colours; mtx = gfxAllocateMatrix(); var80061644 = 2000.0f; colour = nbombCalculateAlpha(nbomb); colours = gfxAllocateColours(2); - colours[0] = colour; - colours[1] = 0xffffff00; + colours[0].word = colour; + colours[1].word = 0xffffff00; gSPColor(gdl++, osVirtualToPhysical(colours), 2); @@ -792,8 +792,8 @@ Gfx *nbombRenderOverlay(Gfx *gdl) u32 stack2[2]; bool drawn = false; s32 stack3; - u32 *colours; - struct gfxvtx *vertices; + Col *colours; + Vtx *vertices; s16 viewleft; s16 viewtop; s16 viewright; @@ -884,7 +884,7 @@ Gfx *nbombRenderOverlay(Gfx *gdl) vertices[2].colour = 0; vertices[3].colour = 0; - colours[0] = finalalpha; + colours[0].word = finalalpha; gSPColor(gdl++, osVirtualToPhysical(colours), 1); gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); @@ -977,8 +977,8 @@ Gfx *gasRender(Gfx *gdl) } if (show) { - u32 *colours = gfxAllocateColours(1); - struct gfxvtx *vertices = gfxAllocateVertices(8); + Col *colours = gfxAllocateColours(1); + Vtx *vertices = gfxAllocateVertices(8); s16 viewleft = viGetViewLeft() * 10; s16 viewtop = viGetViewTop() * 10; s16 viewright = (s16) (viGetViewLeft() + viGetViewWidth()) * 10; @@ -1086,7 +1086,7 @@ Gfx *gasRender(Gfx *gdl) alpha = 127.0f * alphafrac; - colours[0] = 0x3faf1100 | alpha; + colours[0].word = 0x3faf1100 | alpha; gSPColor(gdl++, osVirtualToPhysical(colours), 1); gSPVertex(gdl++, osVirtualToPhysical(vertices), 8, 0); diff --git a/src/game/propobj.c b/src/game/propobj.c index a5b169cb6..889b8bd14 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -2858,7 +2858,7 @@ bool func0f06bea0(struct model *model, struct modelnode *endnode, struct modelno f32 sp98 = MAXFLOAT; Gfx *s4; Gfx *s6; - struct gfxvtx *vertices; + Vtx *vertices; struct modelnode *sp88; struct modelnode *sp84 = NULL; bool s7; @@ -2914,13 +2914,13 @@ bool func0f06bea0(struct model *model, struct modelnode *endnode, struct modelno if (rwdata->gdl != NULL) { if (rwdata->gdl == rodata->dl.opagdl) { - s4 = (Gfx *)((uintptr_t)rodata->dl.colourtable + ((uintptr_t)rodata->dl.opagdl & 0xffffff)); + s4 = (Gfx *)((uintptr_t)rodata->dl.colours + ((uintptr_t)rodata->dl.opagdl & 0xffffff)); } else { s4 = rwdata->gdl; } if (rodata->dl.xlugdl != NULL) { - s6 = (Gfx *)((uintptr_t)rodata->dl.colourtable + ((uintptr_t)rodata->dl.xlugdl & 0xffffff)); + s6 = (Gfx *)((uintptr_t)rodata->dl.colours + ((uintptr_t)rodata->dl.xlugdl & 0xffffff)); } vertices = rwdata->vertices; @@ -2938,7 +2938,7 @@ bool func0f06bea0(struct model *model, struct modelnode *endnode, struct modelno s6 = (Gfx *)(base + ((uintptr_t)node->rodata->gundl.xlugdl & 0xffffff)); } - vertices = (struct gfxvtx *)base; + vertices = (Vtx *)base; } } break; @@ -13019,8 +13019,8 @@ struct tvcmd { Gfx *tvscreenRender(struct model *model, struct modelnode *node, struct tvscreen *screen, Gfx *gdl, s32 arg4, s32 arg5) { if (node && (node->type & 0xff) == MODELNODETYPE_DL) { - struct gfxvtx *vertices = gfxAllocateVertices(4); // b4 - struct colour *colours = gfxAllocateColours(1); // b0 + Vtx *vertices = gfxAllocateVertices(4); // b4 + Col *colours = gfxAllocateColours(1); // b0 Gfx *savedgdl = gdl++; // ac union modelrodata *rodata = node->rodata; // a8 union modelrwdata *rwdata = modelGetNodeRwData(model, node); // a4 @@ -13462,8 +13462,8 @@ Gfx *gfxRenderRadialShadow(Gfx *gdl, f32 x, f32 y, f32 z, f32 angle, f32 radius, Mtxf spc0; Mtxf sp80; Mtxf *mtx; - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; struct coord pos; struct textureconfig *tconfig; s32 i; @@ -13479,7 +13479,7 @@ Gfx *gfxRenderRadialShadow(Gfx *gdl, f32 x, f32 y, f32 z, f32 angle, f32 radius, tconfig = &g_TexShadowConfigs[0]; - colours[0] = colour; + colours[0].word = colour; pos.x = x; pos.y = y + 2.0f; @@ -13571,8 +13571,8 @@ Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass) struct modelrodata_dl *dldata1; struct modelrwdata_dl *dldata2; f32 fadedist; - struct colour *oldcolours; - struct colour *newcolours; + Col *oldcolours; + Col *newcolours; f32 objdist; s32 i; @@ -13660,8 +13660,8 @@ Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass) node = func0f0687e4(obj->model); dldata1 = &node->rodata->dl; dldata2 = (struct modelrwdata_dl *) modelGetNodeRwData(obj->model, node); - oldcolours = (struct colour *) ((((uintptr_t) &dldata1->vertices[dldata1->numvertices] + 7) | 7) ^ 7); - newcolours = (struct colour *) gfxAllocateColours(dldata1->numcolours); + oldcolours = (Col *) ((((uintptr_t) &dldata1->vertices[dldata1->numvertices] + 7) | 7) ^ 7); + newcolours = (Col *) gfxAllocateColours(dldata1->numcolours); for (i = 0; i < dldata1->numcolours; i++) { newcolours[i] = oldcolours[i]; @@ -13956,7 +13956,7 @@ void objDeform(struct defaultobj *obj, s32 level) if (modelIsNodeNotTvscreen(modeldef, node) && parentbbox == bbox) { struct modelrodata_dl *rodata = &node->rodata->dl; struct modelrwdata_dl *rwdata = (struct modelrwdata_dl *)&model->rwdatas[rodata->rwdataindex]; - struct gfxvtx *vertices = vtxstoreAllocate(rodata->numvertices, VTXSTORETYPE_OBJVTX, node, objGetDestroyedLevel(obj)); + Vtx *vertices = vtxstoreAllocate(rodata->numvertices, VTXSTORETYPE_OBJVTX, node, objGetDestroyedLevel(obj)); if (vertices) { if (rwdata->vertices != rodata->vertices) { @@ -13979,7 +13979,7 @@ void objDeform(struct defaultobj *obj, s32 level) } if ((uintptr_t)rwdata->colours == ALIGN8((uintptr_t)&rodata->vertices[rodata->numvertices])) { - struct colour *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_OBJCOL, NULL, 0); + Col *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_OBJCOL, NULL, 0); if (colours) { for (i = 0; i < rodata->numcolours; i++) { @@ -14958,7 +14958,7 @@ bool func0f0849dc(struct model *model, struct modelnode *nodearg, struct coord * Mtxf *spd0 = NULL; bool done = false; struct modelnode *node = nodearg; - struct gfxvtx *vertices = NULL; + Vtx *vertices = NULL; while (node && !done) { u32 type = node->type & 0xff; @@ -14973,13 +14973,13 @@ bool func0f0849dc(struct model *model, struct modelnode *nodearg, struct coord * if (rwdata->gdl != NULL) { if (rwdata->gdl == rodata->opagdl) { - s3 = (Gfx *)((uintptr_t)rodata->colourtable + ((u32)rodata->opagdl & 0xffffff)); + s3 = (Gfx *)((uintptr_t)rodata->colours + ((u32)rodata->opagdl & 0xffffff)); } else { s3 = rwdata->gdl; } if (rodata->xlugdl != NULL) { - s5 = (void *)((uintptr_t)rodata->colourtable + ((u32)rodata->xlugdl & 0xffffff)); + s5 = (void *)((uintptr_t)rodata->colours + ((u32)rodata->xlugdl & 0xffffff)); } vertices = rwdata->vertices; @@ -17686,7 +17686,7 @@ void modelFreeVertices(s32 vtxstoretype, struct model *model) rwdata->dl.vertices = rodata->dl.vertices; } - if ((uintptr_t)rwdata->dl.colours != ALIGN8((uintptr_t)rodata->dl.vertices + rodata->dl.numvertices * sizeof(struct gfxvtx))) { + if ((uintptr_t)rwdata->dl.colours != ALIGN8((uintptr_t)rodata->dl.vertices + rodata->dl.numvertices * sizeof(Vtx))) { if (vtxstoretype == VTXSTORETYPE_OBJVTX) { newtype = VTXSTORETYPE_OBJCOL; } else { @@ -17695,7 +17695,7 @@ void modelFreeVertices(s32 vtxstoretype, struct model *model) vtxstoreFree(newtype, rwdata->dl.colours); - rwdata->dl.colours = (struct colour *)ALIGN8((uintptr_t)rodata->dl.vertices + rodata->dl.numvertices * sizeof(struct gfxvtx)); + rwdata->dl.colours = (Col *)ALIGN8((uintptr_t)rodata->dl.vertices + rodata->dl.numvertices * sizeof(Vtx)); } } break; @@ -19190,7 +19190,7 @@ void doorUpdateTiles(struct doorobj *door) #define NEXT2() (j + 2) % 4 #define NEXT3() (j + 3) % 4 -void door0f08cb20(struct doorobj *door, struct gfxvtx *src, struct gfxvtx *dst, s32 numvertices) +void door0f08cb20(struct doorobj *door, Vtx *src, Vtx *dst, s32 numvertices) { s32 i; s32 j; @@ -19207,8 +19207,8 @@ void door0f08cb20(struct doorobj *door, struct gfxvtx *src, struct gfxvtx *dst, } for (i = 0; i < numvertices / 4; i++) { - struct gfxvtx *psrc = &src[i * 4]; - struct gfxvtx *pdst = &dst[i * 4]; + Vtx *psrc = &src[i * 4]; + Vtx *pdst = &dst[i * 4]; for (j = 0; j < 4; j++) { if (j == 0) { @@ -19341,7 +19341,7 @@ struct prop *doorInit(struct doorobj *door, struct coord *pos, Mtxf *mtx, s16 *r if (door->doorflags & DOORFLAG_0004) { struct modelnode *node = func0f0687e4(door->base.model); rodata = node->rodata; - door->unka4 = mempAlloc(ALIGN16(rodata->dl.numvertices * sizeof(struct gfxvtx)), MEMPOOL_STAGE); + door->unka4 = mempAlloc(ALIGN16(rodata->dl.numvertices * sizeof(Vtx)), MEMPOOL_STAGE); } else { door->unka4 = NULL; } diff --git a/src/game/savebuffer.c b/src/game/savebuffer.c index a988e1f94..d7ee77cca 100644 --- a/src/game/savebuffer.c +++ b/src/game/savebuffer.c @@ -184,8 +184,8 @@ Gfx *func0f0d4c80(Gfx *gdl) Gfx *menugfxDrawPlane(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colour2, s32 type) { - u32 *colours; - struct gfxvtx *vertices; + Col *colours; + Vtx *vertices; f32 tmp1; s16 a1; s16 t1; @@ -361,8 +361,8 @@ Gfx *menugfxDrawPlane(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 vertices[3].colour = 4; } - colours[0] = colour1; - colours[1] = colour2; + colours[0].word = colour1; + colours[1].word = colour2; gSPColor(gdl++, osVirtualToPhysical(colours), 2); gSPVertex(gdl++, osVirtualToPhysical(vertices), 4, 0); diff --git a/src/game/shards.c b/src/game/shards.c index 9da8d3a79..5f1fc6dd8 100644 --- a/src/game/shards.c +++ b/src/game/shards.c @@ -148,45 +148,45 @@ void shardCreate(s16 room, struct coord *pos, f32 rotx, f32 size, s32 type) s32 rand = random() % 100; if (rand < 20) { - *(u32 *)g_Shards[g_NextShardNum].colours[0] = 0xbbbbbbf0; - *(u32 *)g_Shards[g_NextShardNum].colours[1] = 0xaaaaaaf0; - *(u32 *)g_Shards[g_NextShardNum].colours[2] = 0x777777f0; + g_Shards[g_NextShardNum].colours[0].word = 0xbbbbbbf0; + g_Shards[g_NextShardNum].colours[1].word = 0xaaaaaaf0; + g_Shards[g_NextShardNum].colours[2].word = 0x777777f0; } else if (rand < 40) { - *(u32 *)g_Shards[g_NextShardNum].colours[0] = 0x000000f0; - *(u32 *)g_Shards[g_NextShardNum].colours[1] = 0x000000f0; - *(u32 *)g_Shards[g_NextShardNum].colours[2] = 0x000000f0; + g_Shards[g_NextShardNum].colours[0].word = 0x000000f0; + g_Shards[g_NextShardNum].colours[1].word = 0x000000f0; + g_Shards[g_NextShardNum].colours[2].word = 0x000000f0; } else if (rand < 60) { - *(u32 *)g_Shards[g_NextShardNum].colours[0] = 0x553311f0; - *(u32 *)g_Shards[g_NextShardNum].colours[1] = 0x553311f0; - *(u32 *)g_Shards[g_NextShardNum].colours[2] = 0x553311f0; + g_Shards[g_NextShardNum].colours[0].word = 0x553311f0; + g_Shards[g_NextShardNum].colours[1].word = 0x553311f0; + g_Shards[g_NextShardNum].colours[2].word = 0x553311f0; } else { - *(u32 *)g_Shards[g_NextShardNum].colours[0] = 0xddaa88f0; - *(u32 *)g_Shards[g_NextShardNum].colours[1] = 0xddaa88f0; - *(u32 *)g_Shards[g_NextShardNum].colours[2] = 0xddaa88f0; + g_Shards[g_NextShardNum].colours[0].word = 0xddaa88f0; + g_Shards[g_NextShardNum].colours[1].word = 0xddaa88f0; + g_Shards[g_NextShardNum].colours[2].word = 0xddaa88f0; } } else { s32 i; s32 j; - g_Shards[g_NextShardNum].colours[0][0] = 0x05; - g_Shards[g_NextShardNum].colours[0][1] = 0x05; - g_Shards[g_NextShardNum].colours[0][2] = 0x7e; + g_Shards[g_NextShardNum].colours[0].r = 0x05; + g_Shards[g_NextShardNum].colours[0].g = 0x05; + g_Shards[g_NextShardNum].colours[0].b = 0x7e; - g_Shards[g_NextShardNum].colours[1][0] = 0x05; - g_Shards[g_NextShardNum].colours[1][1] = 0xfb; - g_Shards[g_NextShardNum].colours[1][2] = 0x7e; + g_Shards[g_NextShardNum].colours[1].r = 0x05; + g_Shards[g_NextShardNum].colours[1].g = 0xfb; + g_Shards[g_NextShardNum].colours[1].b = 0x7e; - g_Shards[g_NextShardNum].colours[2][0] = 0xfb; - g_Shards[g_NextShardNum].colours[2][1] = 0xfb; - g_Shards[g_NextShardNum].colours[2][2] = 0x7e; + g_Shards[g_NextShardNum].colours[2].r = 0xfb; + g_Shards[g_NextShardNum].colours[2].g = 0xfb; + g_Shards[g_NextShardNum].colours[2].b = 0x7e; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { - g_Shards[g_NextShardNum].colours[i][j] = random() % 0xff; + g_Shards[g_NextShardNum].colours[i].bytes[j] = random() % 0xff; } } - g_Shards[g_NextShardNum].colours[0][3] = g_Shards[g_NextShardNum].colours[1][3] = g_Shards[g_NextShardNum].colours[2][3] = 0xff; + g_Shards[g_NextShardNum].colours[0].a = g_Shards[g_NextShardNum].colours[1].a = g_Shards[g_NextShardNum].colours[2].a = 0xff; } g_Shards[g_NextShardNum].rot.x = rotx; @@ -272,7 +272,7 @@ Gfx *shardsRenderWood(Gfx *gdl) gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (g_Vars.currentplayer->visionmode == VISIONMODE_XRAY) { - u8 (*colours)[4] = gfxAllocateColours(3); + Col *colours = gfxAllocateColours(3); if (g_Shards[i].age60 >= TICKS(100)) { f32 frac = g_Shards[i].age60 / (PAL ? 41.666664123535f : 50.0f); @@ -287,10 +287,10 @@ Gfx *shardsRenderWood(Gfx *gdl) alphamult *= 0.5f; for (j = 0; j < 3; j++) { - colours[j][0] = xraydist * 255.0f; - colours[j][1] = (1.0f - xraydist) * 255.0f; - colours[j][2] = 0; - colours[j][3] = g_Shards[g_NextShardNum].colours[j][3] * alphamult; + colours[j].r = xraydist * 255.0f; + colours[j].g = (1.0f - xraydist) * 255.0f; + colours[j].b = 0; + colours[j].a = g_Shards[g_NextShardNum].colours[j].a * alphamult; } gSPColor(gdl++, osVirtualToPhysical(colours), 3); @@ -394,7 +394,7 @@ Gfx *shardsRenderGlass(Gfx *gdl) gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (g_Vars.currentplayer->visionmode == VISIONMODE_XRAY) { - u8 (*colours)[4] = gfxAllocateColours(3); + Col *colours = gfxAllocateColours(3); if (g_Shards[i].age60 >= TICKS(100)) { f32 frac = g_Shards[i].age60 / (PAL ? 41.666664123535f : 50.0f); @@ -409,10 +409,10 @@ Gfx *shardsRenderGlass(Gfx *gdl) alphamult *= 0.5f; for (j = 0; j < 3; j++) { - colours[j][0] = xraydist * 255.0f; - colours[j][1] = (1.0f - xraydist) * 255.0f; - colours[j][2] = 0; - colours[j][3] = g_Shards[g_NextShardNum].colours[j][3] * alphamult; + colours[j].r = xraydist * 255.0f; + colours[j].g = (1.0f - xraydist) * 255.0f; + colours[j].b = 0; + colours[j].a = g_Shards[g_NextShardNum].colours[j].a * alphamult; } gSPColor(gdl++, osVirtualToPhysical(colours), 3); diff --git a/src/game/sight.c b/src/game/sight.c index 7a978329a..df3aa2317 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -889,8 +889,8 @@ Gfx *sightDrawType2(Gfx *gdl, bool sighton) Gfx *sightDrawSkedarTriangle(Gfx *gdl, s32 x, s32 y, s32 dir, u32 colour) { s32 points[6]; - struct gfxvtx *vertices = gfxAllocateVertices(3); - u32 *colours = gfxAllocateColours(2); + Vtx *vertices = gfxAllocateVertices(3); + Col *colours = gfxAllocateColours(2); switch (dir) { case DIR_UP: @@ -949,8 +949,8 @@ Gfx *sightDrawSkedarTriangle(Gfx *gdl, s32 x, s32 y, s32 dir, u32 colour) #define RGBA(r, g, b, a) (((r) & 0xff) << 24 | ((g) & 0xff) << 16 | ((b) & 0xff) << 8 | ((a) & 0xff)) - colours[0] = colour; - colours[1] = RGBA((colour >> 24) & 0xff, (colour >> 16) & 0xff, (colour >> 8) & 0xff, 0x08); + colours[0].word = colour; + colours[1].word = RGBA((colour >> 24) & 0xff, (colour >> 16) & 0xff, (colour >> 8) & 0xff, 0x08); vertices[0].colour = 0; vertices[1].colour = 4; @@ -1295,8 +1295,8 @@ Gfx *sightDrawMaian(Gfx *gdl, bool sighton) s32 viewbottom = viewtop + viewheight - 1; s32 x = (s32)g_Vars.currentplayer->crosspos[0] / g_ScaleX; s32 y = g_Vars.currentplayer->crosspos[1]; - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; s32 inner[4]; bool hasprop = g_Vars.currentplayer->lookingatprop.prop != NULL; u32 colour = 0xff000060; @@ -1351,8 +1351,8 @@ Gfx *sightDrawMaian(Gfx *gdl, bool sighton) vertices[7].y = inner[2] * 10; vertices[7].z = -10; - colours[0] = 0x00ff000f; - colours[1] = hasprop ? colour : 0x00ff0044; + colours[0].word = 0x00ff000f; + colours[1].word = hasprop ? colour : 0x00ff0044; vertices[0].colour = 0; vertices[1].colour = 0; diff --git a/src/game/smoke.c b/src/game/smoke.c index a71019b21..aca83424e 100644 --- a/src/game/smoke.c +++ b/src/game/smoke.c @@ -86,8 +86,8 @@ struct smoketype g_SmokeTypes[NUM_SMOKETYPES] = { Gfx *smokeRenderPart(struct smoke *smoke, struct smokepart *part, Gfx *gdl, struct coord *coord, f32 size) { - struct gfxvtx *vertices = gfxAllocateVertices(4); - struct colour *colours = (struct colour *)gfxAllocateColours(1); + Vtx *vertices = gfxAllocateVertices(4); + Col *colours = (Col *)gfxAllocateColours(1); Mtxf *mtx = camGetProjectionMtxF(); struct coord spa0; struct coord sp94; diff --git a/src/game/sparks.c b/src/game/sparks.c index 4c64913a9..2d0db1212 100644 --- a/src/game/sparks.c +++ b/src/game/sparks.c @@ -311,7 +311,7 @@ Gfx *sparksRender(Gfx *gdl) s32 k; struct coord *campos; struct sparktype *type; - struct colour *colours; + Col *colours; s32 index; f32 sp13c; f32 sp138; @@ -447,7 +447,7 @@ Gfx *sparksRender(Gfx *gdl) struct spark *spark = &g_Sparks[index]; if (spark->ttl != 0) { - struct gfxvtx *vertices = gfxAllocateVertices(3); + Vtx *vertices = gfxAllocateVertices(3); f32 f2; for (k = 0; k < 3; k++) { diff --git a/src/game/tex.c b/src/game/tex.c index b34b3c993..9b3a30403 100644 --- a/src/game/tex.c +++ b/src/game/tex.c @@ -802,7 +802,7 @@ s32 texLoadFromGdl(Gfx *arg0, s32 gdlsizeinbytes, Gfx *arg2, struct texpool *poo bool spe8; s32 spe4; s32 spe0; - struct gfxvtx *spa0[16]; + Vtx *spa0[16]; u8 sp90[16]; s32 i; @@ -975,12 +975,12 @@ s32 texLoadFromGdl(Gfx *arg0, s32 gdlsizeinbytes, Gfx *arg2, struct texpool *poo s32 start; s32 count; u32 offset; - struct gfxvtx *vtx; + Vtx *vtx; if (spe0) { start = s5->bytes[1] & 0xf; count = s5->vtx.unk08 + 1; - vtx = (struct gfxvtx *)(s5->dma.addr & 0x00ffffff); + vtx = (Vtx *)(s5->dma.addr & 0x00ffffff); for (i = start; i < start + count; i++) { if (animated && sp90[i]) { @@ -995,11 +995,11 @@ s32 texLoadFromGdl(Gfx *arg0, s32 gdlsizeinbytes, Gfx *arg2, struct texpool *poo if (spf4 && arg4) { s32 count = s5->vtx.unk08 + 1; - struct gfxvtx *vtx; + Vtx *vtx; s32 i; offset = s5->dma.addr & 0x00ffffff; - vtx = (struct gfxvtx *) (arg4 + offset); + vtx = (Vtx *) (arg4 + offset); for (i = 0; i < count; i++) { vtx[i].s >>= 1; diff --git a/src/game/title.c b/src/game/title.c index 52b8c1b6f..fc2c8a8d8 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -34,8 +34,8 @@ u8 *var8009cca0; u32 var8009cca4; -struct gfxvtx *var8009cca8[2]; -u32 *var8009ccb0[2]; +Vtx *var8009cca8[2]; +Col *var8009ccb0[2]; u32 var8009ccb8; #if VERSION == VERSION_JPN_FINAL @@ -639,7 +639,7 @@ void titleInitPdLogo(void) { struct modelrodata_dl *rodata = (struct modelrodata_dl *)modelGetPartRodata(g_ModelStates[MODEL_PDTWO].modeldef, MODELPART_LOGO_0002); - size = ALIGN8(rodata->numvertices * sizeof(struct gfxvtx)); + size = ALIGN8(rodata->numvertices * sizeof(Vtx)); var8009cca8[0] = (void *)nextaddr; @@ -649,7 +649,7 @@ void titleInitPdLogo(void) nextaddr += size; remaining -= size; - size = ALIGN8(rodata->numcolours * sizeof(struct colour)); + size = ALIGN8(rodata->numcolours * sizeof(Col)); var8009ccb0[0] = (void *)nextaddr; nextaddr += size; @@ -736,14 +736,14 @@ void titleTickPdLogo(void) } } -Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, s32 arg4, f32 arg5, Mtxf *arg6, struct gfxvtx *vertices, u32 *colours) +Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, s32 arg4, f32 arg5, Mtxf *arg6, Vtx *vertices, Col *colours) { struct modelrenderdata renderdata = {NULL, true, 3}; s32 tmp2; s32 i; s32 j; - struct gfxvtx *sp100; - struct colour *spfc; + Vtx *sp100; + Col *spfc; union modelrwdata *tmp; struct modelrwdata_dl *rwdata; struct modelnode *node1; @@ -755,11 +755,11 @@ Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, s32 alpha1; s32 spcc[3]; f32 spc0[3]; - struct gfxvtx *a3; + Vtx *a3; s32 alpha2; - struct gfxvtx *t0; - struct colour *s1; - struct colour *s2; + Vtx *t0; + Col *s1; + Col *s2; Mtxf sp6c; tmp = modelGetNodeRwData(model, modelGetPart(model->definition, MODELPART_LOGO_0000)); @@ -802,7 +802,7 @@ Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, } sp100 = vertices; - spfc = (void *)colours; + spfc = colours; for (i = 0; i < 4; i++) { if (i == 0) { @@ -830,8 +830,8 @@ Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, rwdata = modelGetNodeRwData(model, node2); } - s1 = (struct colour *)ALIGN8(s5rodata->numvertices * sizeof(struct gfxvtx) + (s32)s5rodata->vertices); - s2 = (struct colour *)ALIGN8(s1rodata->numvertices * (s32) sizeof(struct gfxvtx) + (s32)s1rodata->vertices); + s1 = (Col *)ALIGN8(s5rodata->numvertices * sizeof(Vtx) + (s32)s5rodata->vertices); + s2 = (Col *)ALIGN8(s1rodata->numvertices * (s32) sizeof(Vtx) + (s32)s1rodata->vertices); a3 = s5rodata->vertices; t0 = s1rodata->vertices; @@ -874,7 +874,7 @@ Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, spfc[j].a = alpha2; } - sp100 = (void *)ALIGN8(s5rodata->numvertices * sizeof(struct gfxvtx) + (s32)sp100); + sp100 = (void *)ALIGN8(s5rodata->numvertices * sizeof(Vtx) + (s32)sp100); spfc = (void *)ALIGN8(s5rodata->numcolours * sizeof(u32) + (s32)spfc); } } diff --git a/src/game/wallhit.c b/src/game/wallhit.c index 1d9153b53..3ff3f0bfc 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -1199,7 +1199,7 @@ s32 wallhit0f140750(struct coord *coord) Gfx *wallhitRenderOpaBgHits(s32 roomnum, Gfx *gdl) { struct wallhit *wallhit; - struct colour *colours; + Col *colours; s32 prevtexturenum; s32 prev6b; @@ -1262,7 +1262,7 @@ Gfx *wallhitRenderOpaBgHits(s32 roomnum, Gfx *gdl) Gfx *wallhitRenderXluBgHits(s32 roomnum, Gfx *gdl) { struct wallhit *wallhit; - struct colour *colours; + Col *colours; s32 prevtexturenum; s32 prev6b; @@ -1319,7 +1319,7 @@ Gfx *wallhitRenderXluBgHits(s32 roomnum, Gfx *gdl) Gfx *wallhitRenderPropHits(Gfx *gdl, struct prop *prop, bool xlu) { - struct colour *colours; + Col *colours; struct defaultobj *obj = prop->obj; bool hasany = false; struct wallhit *wallhit; diff --git a/src/game/weather.c b/src/game/weather.c index 726089857..18cb7a2aa 100644 --- a/src/game/weather.c +++ b/src/game/weather.c @@ -2513,7 +2513,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) s32 sp708; s32 sp258[50][6]; bool s3; - struct gfxvtx *s3_2; + Vtx *s3_2; s32 s4; struct weatherparticledata *particledata; struct weatherparticle *particle; @@ -2524,7 +2524,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) f32 f0; f32 sp218[2]; f32 sp214; - struct gfxvtx *vertices; // 210 + Vtx *vertices; // 210 f32 frac; s32 a0; Mtxf sp1c8; @@ -2533,8 +2533,8 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) s32 j2; s32 k; - u32 *colours; - struct gfxvtx *v0_2; + Col *colours; + Vtx *v0_2; f32 sp174; s32 numneighbours; s32 j; @@ -2873,8 +2873,8 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) } colours = gfxAllocateColours(2); - colours[0] = var8007f0e4; - colours[1] = var8007f0e8; + colours[0].word = var8007f0e4; + colours[1].word = var8007f0e8; gSPColor(gdl++, osVirtualToPhysical(colours), 2); @@ -4588,7 +4588,7 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) f32 sp264[50][12]; f32 sp260; s32 s7; - u32 *colours; + Col *colours; f32 *fptr; f32 f0; s32 numneighbours; @@ -4601,9 +4601,9 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) f32 sp220; f32 sp21c; Mtxf *mtx; - struct gfxvtx *vertices; // 214 - struct gfxvtx *v0; - struct gfxvtx *v0_2; + Vtx *vertices; // 214 + Vtx *v0; + Vtx *v0_2; Mtxf sp1cc; struct coord sp19c[4]; s32 sp198; @@ -4835,7 +4835,7 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) colours = gfxAllocateColours(16); for (j = 0; j < 16; j++) { - colours[j] = (var8007f10c & 0xffffff00) | ((0xff * 17 - j * 0xff) / 17); + colours[j].word = (var8007f10c & 0xffffff00) | ((0xff * 17 - j * 0xff) / 17); } gSPColor(gdl++, osVirtualToPhysical(colours), 16); diff --git a/src/include/game/bg.h b/src/include/game/bg.h index b2312807f..bc7a54c3f 100644 --- a/src/include/game/bg.h +++ b/src/include/game/bg.h @@ -12,7 +12,7 @@ Gfx *bgRenderXrayData(Gfx *gdl, struct xraydata *xraydata); Gfx *bgAddXrayTri(Gfx *gdl, struct xraydata *xraydata, s16 vertices1[3], s16 vertices2[3], s16 vertices3[3], u32 colour1, u32 colour2, u32 colour3); void bgChooseXrayVtxColour(bool *inrange, s16 vertex[3], u32 *colour, struct xraydata *xraydata); Gfx *bgProcessXrayTri(Gfx *gdl, struct xraydata *xraydata, s16 arg2[3], s16 arg3[3], s16 arg4[3], s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 arg10); -Gfx *bgRenderGdlInXray(Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, s16 arg3[3]); +Gfx *bgRenderGdlInXray(Gfx *gdl, Gfx *gdl2, Vtx *vertices, s16 arg3[3]); Gfx *bgRenderRoomXrayPass(Gfx *gdl, s32 roomnum, struct roomblock *blocks, bool recurse, s16 arg4[3]); Gfx *bgRenderRoomInXray(Gfx *gdl, s32 roomnum); Gfx *bgRenderSceneInXray(Gfx *gdl); @@ -53,7 +53,7 @@ s32 bgFindPortalByVertices(struct portalvertices *pvertices); u32 bgInflate(u8 *src, u8 *dst, u32 len); Gfx *bgGetNextGdlInBlock(struct roomblock *block, Gfx *start, Gfx *end); Gfx *bgGetNextGdlInLayer(s32 roomnum, Gfx *start, u32 types); -struct gfxvtx *bgFindVerticesForGdl(s32 roomnum, Gfx *gdl); +Vtx *bgFindVerticesForGdl(s32 roomnum, Gfx *gdl); void bgLoadRoom(s32 roomnum); void bgUnloadRoom(s32 room); void bgUnloadAllRooms(void); @@ -62,12 +62,12 @@ void bgTickRooms(void); Gfx *bgRenderRoomPass(Gfx *gdl, s32 roomnum, struct roomblock *blocks, bool arg3); Gfx *bgRenderRoomOpaque(Gfx *gdl, s32 roomnum); Gfx *bgRenderRoomXlu(Gfx *gdl, s32 roomnum); -s32 bgPopulateVtxBatchType(s32 roomnum, struct vtxbatch *batches, Gfx *gdl, s32 batchindex, struct gfxvtx *vertices, s32 arg5); +s32 bgPopulateVtxBatchType(s32 roomnum, struct vtxbatch *batches, Gfx *gdl, s32 batchindex, Vtx *vertices, s32 arg5); void bgFindRoomVtxBatches(s32 roomnum); bool bgTestLineIntersectsIntBbox(struct coord *arg0, struct coord *arg1, s32 *arg2, s32 *arg3); bool bgTestLineIntersectsBbox(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *arg3); -bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, struct hitthing *hitthing); -bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, struct coord *arg3, Gfx *arg4, Gfx *arg5, struct gfxvtx *vertices, f32 *arg7, struct hitthing *hitthing); +bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, Gfx *gdl, Gfx *gdl2, Vtx *vertices, struct hitthing *hitthing); +bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, struct coord *arg3, Gfx *arg4, Gfx *arg5, Vtx *vertices, f32 *arg7, struct hitthing *hitthing); bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct vtxbatch *batches, s32 roomnum, struct hitthing *hitthing); s32 bg0f1612e4(struct coord *bbmin, struct coord *bbmax, struct coord *frompos, struct coord *dist, struct coord *arg4, struct coord *arg5); bool bgTestHitInRoom(struct coord *frompos, struct coord *topos, s32 roomnum, struct hitthing *hitthing); diff --git a/src/include/game/chr.h b/src/include/game/chr.h index 22be278e8..41b7654cd 100644 --- a/src/include/game/chr.h +++ b/src/include/game/chr.h @@ -69,7 +69,7 @@ void shieldhitsTick(void); void chrSetDrCarollImages(struct chrdata *drcaroll, s32 imageleft, s32 imageright); s32 chrsGetNumSlots(void); void chrRegister(s32 chrnum, s32 chrindex); -struct gfxvtx *chrAllocateVertices(s32 numvertices); +Vtx *chrAllocateVertices(s32 numvertices); void chrsSetVar8006297c(u32 arg0); u32 chrsGetVar8006297c(void); void chrsSetVar80062980(u32 arg0); diff --git a/src/include/game/dyntex.h b/src/include/game/dyntex.h index f728d8fcf..150bb2226 100644 --- a/src/include/game/dyntex.h +++ b/src/include/game/dyntex.h @@ -4,8 +4,8 @@ #include "data.h" #include "types.h" -void dyntexTickRoom(s32 roomnum, struct gfxvtx *vertices); -void dyntexAddVertex(struct gfxvtx *vertex); +void dyntexTickRoom(s32 roomnum, Vtx *vertices); +void dyntexAddVertex(Vtx *vertex); void dyntexSetCurrentType(s16 type); void dyntexSetCurrentRoom(s16 roomnum); void dyntexReset(void); diff --git a/src/include/game/gfxmemory.h b/src/include/game/gfxmemory.h index 6f65a462b..f8269caaa 100644 --- a/src/include/game/gfxmemory.h +++ b/src/include/game/gfxmemory.h @@ -8,10 +8,10 @@ extern u8 *g_GfxBuffers[3]; void gfxReset(void); Gfx *gfxGetMasterDisplayList(void); -struct gfxvtx *gfxAllocateVertices(u32 count); +Vtx *gfxAllocateVertices(u32 count); void *gfxAllocateMatrix(void); -void *gfxAllocateLookAt(s32 count); -void *gfxAllocateColours(s32 count); +LookAt *gfxAllocateLookAt(s32 count); +Col *gfxAllocateColours(s32 count); void *gfxAllocate(u32 size); void gfxSwapBuffers(void); s32 gfxGetFreeGfx(Gfx *gdl); diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index 8a5f63e84..7b0c009c0 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -302,7 +302,7 @@ void doorsCheckAutomatic(void); void func0f08c424(struct doorobj *door, Mtxf *matrix); void doorGetBbox(struct doorobj *door, struct modelrodata_bbox *dst); void doorUpdateTiles(struct doorobj *door); -void door0f08cb20(struct doorobj *door, struct gfxvtx *src, struct gfxvtx *dst, s32 numvertices); +void door0f08cb20(struct doorobj *door, Vtx *src, Vtx *dst, s32 numvertices); void func0f08d3dc(struct doorobj *door); void func0f08d460(struct doorobj *door); void doorActivatePortal(struct doorobj *door); diff --git a/src/include/game/title.h b/src/include/game/title.h index df5b14334..b65659136 100644 --- a/src/include/game/title.h +++ b/src/include/game/title.h @@ -26,7 +26,7 @@ Gfx *titleRenderLegal(Gfx *gdl); void titleInitPdLogo(void); void titleExitPdLogo(void); void titleTickPdLogo(void); -Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, s32 arg2, f32 arg3, s32 arg4, f32 arg5, Mtxf *arg6, struct gfxvtx *vertices, u32 *colours); +Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, s32 arg2, f32 arg3, s32 arg4, f32 arg5, Mtxf *arg6, Vtx *vertices, Col *colours); void titleSkipToPdTitle(void); Gfx *titleRenderPdLogo(Gfx *gdl); void titleInitRarePresents(void); diff --git a/src/include/gbiex.h b/src/include/gbiex.h index 2b39221b4..4c311964c 100644 --- a/src/include/gbiex.h +++ b/src/include/gbiex.h @@ -13,10 +13,10 @@ * 00FFFFFF - offset in color table */ #define gSPColor(pkt, v, n) \ - gDma1p(pkt, G_COL, v, sizeof(u32)*(n),((n)-1)<<2) + gDma1p(pkt, G_COL, v, sizeof(Col)*(n),((n)-1)<<2) #define gsSPColor(v, n, v0) \ - gsDma1p(G_COL, v, sizeof(u32)*(n), ((n)-1)<<2) + gsDma1p(G_COL, v, sizeof(Col)*(n), ((n)-1)<<2) /** * B1 rsp_tri4 diff --git a/src/include/lib/model.h b/src/include/lib/model.h index 363abfb5f..271b70bfa 100644 --- a/src/include/lib/model.h +++ b/src/include/lib/model.h @@ -5,12 +5,12 @@ #include "types.h" extern bool (*var8005efc4)(struct model *model, struct modelnode *node); -extern struct gfxvtx *(*g_ModelVtxAllocatorFunc)(s32 numvertices); +extern Vtx *(*g_ModelVtxAllocatorFunc)(s32 numvertices); extern void (*g_ModelJointPositionedFunc)(s32 mtxindex, Mtxf *mtx); bool modelasm00018680(struct modelrenderdata *renderdata, struct model *model); void modelSetDistanceScale(f32 value); -void modelSetVtxAllocatorFunc(struct gfxvtx *(*fn)(s32 numvertices)); +void modelSetVtxAllocatorFunc(Vtx *(*fn)(s32 numvertices)); s32 modelFindNodeMtxIndex(struct modelnode *node, s32 arg1); Mtxf *modelFindNodeMtx(struct model *model, struct modelnode *node, s32 arg2); Mtxf *modelGetRootMtx(struct model *model); diff --git a/src/include/types.h b/src/include/types.h index 13b580905..962844aff 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -430,7 +430,7 @@ struct modelrodata_gundl { // type 0x04 Gfx *opagdl; Gfx *xlugdl; void *baseaddr; - struct gfxvtx *vertices; + Vtx *vertices; s16 numvertices; s16 unk12; }; @@ -526,7 +526,7 @@ struct modelrodata_positionheld { // type 0x15 struct modelrodata_stargunfire { // type 0x16 s32 unk00; - struct gfxvtx *vertices; + Vtx *vertices; Gfx *gdl; void *baseaddr; }; @@ -538,8 +538,8 @@ struct modelrodata_headspot { // type 0x17 struct modelrodata_dl { // type 0x18 /*0x00*/ Gfx *opagdl; /*0x04*/ Gfx *xlugdl; - /*0x08*/ u32 *colourtable; - /*0x0c*/ struct gfxvtx *vertices; // colours follow this array + /*0x08*/ Col *colours; + /*0x0c*/ Vtx *vertices; // colours follow this array /*0x10*/ s16 numvertices; /*0x12*/ s16 mcount; /*0x14*/ u16 rwdataindex; @@ -663,23 +663,10 @@ struct modelrwdata_headspot { // type 0x17 void *rwdatas; }; -struct colour { - union { - u32 word; - u8 bytes[4]; - struct { - u8 r; - u8 g; - u8 b; - u8 a; - }; - }; -}; - struct modelrwdata_dl { // type 0x18 - struct gfxvtx *vertices; + Vtx *vertices; Gfx *gdl; - struct colour *colours; + Col *colours; }; union modelrwdata { @@ -1521,7 +1508,7 @@ struct doorobj { // objtype 0x01 union { struct { /*0x98*/ struct coord unk98; - /*0xa4*/ struct gfxvtx *unka4; + /*0xa4*/ Vtx *unka4; }; f32 mtx98[3][3]; }; @@ -3559,8 +3546,8 @@ struct roomblock { union { struct { // type 0 (leaf) Gfx *gdl; - struct gfxvtx *vertices; - u32 *colours; + Vtx *vertices; + Col *colours; }; struct { // type 1 (parent) struct roomblock *child; @@ -3570,8 +3557,8 @@ struct roomblock { }; struct roomgfxdata { - /*0x00*/ struct gfxvtx *vertices; - /*0x04*/ u32 *colours; + /*0x00*/ Vtx *vertices; + /*0x04*/ Col *colours; /*0x08*/ struct roomblock *opablocks; /*0x0c*/ struct roomblock *xlublocks; /*0x10*/ s16 lightsindex; @@ -3650,7 +3637,7 @@ struct room { /*0x52*/ s16 br_flash; /*0x54*/ s16 lightop_timer240; /*0x56*/ u16 hlupdatedframe; - /*0x58*/ struct colour *colours; + /*0x58*/ Col *colours; /*0x5c*/ f32 lightop_cur_frac; /*0x60*/ f32 lightop_to_frac; /*0x64*/ f32 lightop_from_frac; @@ -5641,21 +5628,6 @@ struct var80067e6c { f32 value; }; -struct gfxvtx { - union { - struct { - /*0x00*/ s16 x; - /*0x02*/ s16 y; - /*0x04*/ s16 z; - }; - s16 v[3]; - }; - /*0x06*/ u8 flags; - /*0x07*/ u8 colour; - /*0x08*/ s16 s; - /*0x0a*/ s16 t; -}; - struct shard { /*0x00*/ s16 room; /*0x04*/ s32 age60; @@ -5663,8 +5635,8 @@ struct shard { /*0x14*/ struct coord rot; /*0x20*/ struct coord vel; /*0x2c*/ struct coord rotspeed; - /*0x38*/ struct gfxvtx vertices[3]; - /*0x5c*/ u8 colours[3][4]; + /*0x38*/ Vtx vertices[3]; + /*0x5c*/ Col colours[3]; /*0x68*/ u8 type; }; @@ -5738,13 +5710,13 @@ struct stageheadlimit { }; struct wallhit { - /*0x00*/ struct gfxvtx vertices[4]; - /*0x30*/ struct colour basecolours[4]; // without room lighting applied - /*0x40*/ struct colour finalcolours[4]; // with room lighting applied + /*0x00*/ Vtx vertices[4]; + /*0x30*/ Col basecolours[4]; // without room lighting applied + /*0x40*/ Col finalcolours[4]; // with room lighting applied /*0x50*/ struct coord relpos; // position relative to room or prop's pos /*0x5c*/ struct prop *chrprop; /*0x60*/ struct prop *objprop; - /*0x64*/ struct gfxvtx *vertices2; // overridden vertices for when blood is expanding + /*0x64*/ Vtx *vertices2; // overridden vertices for when blood is expanding /*0x68*/ s16 roomnum; /*0x6a*/ u8 texturenum; /*0x6b*/ u8 unk6b; @@ -6008,9 +5980,9 @@ struct warpparams { struct hitthing { struct coord unk00; struct coord unk0c; - struct gfxvtx *unk18; - struct gfxvtx *unk1c; - struct gfxvtx *unk20; + Vtx *unk18; + Vtx *unk1c; + Vtx *unk20; Gfx *tricmd; s16 unk28; s16 texturenum; diff --git a/src/lib/model.c b/src/lib/model.c index 4b79c6611..152dd52bb 100644 --- a/src/lib/model.c +++ b/src/lib/model.c @@ -95,7 +95,7 @@ bool (*var8005efc4)(struct model *model, struct modelnode *node) = NULL; bool var8005efd8_2 = false; #endif -struct gfxvtx *(*g_ModelVtxAllocatorFunc)(s32 numvertices) = NULL; +Vtx *(*g_ModelVtxAllocatorFunc)(s32 numvertices) = NULL; void (*g_ModelJointPositionedFunc)(s32 mtxindex, Mtxf *mtx) = NULL; void modelSetDistanceChecksDisabled(bool disabled) @@ -108,7 +108,7 @@ void modelSetDistanceScale(f32 scale) g_ModelDistanceScale = scale; } -void modelSetVtxAllocatorFunc(struct gfxvtx *(*fn)(s32 numvertices)) +void modelSetVtxAllocatorFunc(Vtx *(*fn)(s32 numvertices)) { g_ModelVtxAllocatorFunc = fn; } @@ -3213,7 +3213,7 @@ void modelRenderNodeDl(struct modelrenderdata *renderdata, struct model *model, union modelrwdata *rwdata = modelGetNodeRwData(model, node); if (rwdata->dl.gdl) { - gSPSegment(renderdata->gdl++, SPSEGMENT_MODEL_COL1, osVirtualToPhysical(rodata->dl.colourtable)); + gSPSegment(renderdata->gdl++, SPSEGMENT_MODEL_COL1, osVirtualToPhysical(rodata->dl.colours)); if (renderdata->cullmode) { modelApplyCullMode(renderdata); @@ -3251,7 +3251,7 @@ void modelRenderNodeDl(struct modelrenderdata *renderdata, struct model *model, union modelrwdata *rwdata = modelGetNodeRwData(model, node); if (rwdata->dl.gdl && rodata->dl.mcount == 4 && rodata->dl.xlugdl) { - gSPSegment(renderdata->gdl++, SPSEGMENT_MODEL_COL1, osVirtualToPhysical(rodata->dl.colourtable)); + gSPSegment(renderdata->gdl++, SPSEGMENT_MODEL_COL1, osVirtualToPhysical(rodata->dl.colours)); if (renderdata->cullmode) { modelApplyCullMode(renderdata); @@ -3285,8 +3285,8 @@ void modelRenderNodeStarGunfire(struct modelrenderdata *renderdata, struct model s32 i; if (rodata->gdl) { - struct gfxvtx *src = (struct gfxvtx *) rodata->vertices; - struct gfxvtx *dst = g_ModelVtxAllocatorFunc(rodata->unk00 * 4); + Vtx *src = (Vtx *) rodata->vertices; + Vtx *dst = g_ModelVtxAllocatorFunc(rodata->unk00 * 4); gSPSegment(renderdata->gdl++, SPSEGMENT_MODEL_VTX, osVirtualToPhysical(dst)); gSPSegment(renderdata->gdl++, SPSEGMENT_MODEL_COL2, osVirtualToPhysical((void *)ALIGN8((uintptr_t)&rodata->vertices[rodata->unk00 << 2]))); @@ -3353,7 +3353,7 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model f32 negspc0; struct modelrodata_chrgunfire *rodata = &node->rodata->chrgunfire; union modelrwdata *rwdata = modelGetNodeRwData(model, node); - struct gfxvtx *vertices; + Vtx *vertices; f32 spf0; f32 spec; struct coord spe0; @@ -3373,10 +3373,10 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model f32 tmp; struct coord sp9c; struct coord sp90; - struct gfxvtx vtxtemplate = {0}; - struct colour colourtemplate = {0xffffffff}; + Vtx vtxtemplate = {0}; + Col colourtemplate = {0xffffffff}; struct textureconfig *tconfig; - struct colour *colours; + Col *colours; f32 distance; if ((renderdata->flags & MODELRENDERFLAG_XLU) && rwdata->chrgunfire.visible) { @@ -3437,7 +3437,7 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model vertices = g_ModelVtxAllocatorFunc(4); - colours = (struct colour *) gfxAllocateColours(1); + colours = (Col *) gfxAllocateColours(1); vertices[0] = vtxtemplate; vertices[1] = vtxtemplate; @@ -3880,7 +3880,7 @@ void modelPromoteNodeOffsetsToPointers(struct modelnode *node, u32 vma, u32 file case MODELNODETYPE_DL: rodata = node->rodata; PROMOTE(rodata->dl.vertices); - rodata->dl.colourtable = (void *)fileramaddr; + rodata->dl.colours = (void *)fileramaddr; break; case MODELNODETYPE_DISTANCE: rodata = node->rodata;