diff --git a/src/game/game_02cde0.c b/src/game/game_02cde0.c index 1796b293b..0b1209736 100644 --- a/src/game/game_02cde0.c +++ b/src/game/game_02cde0.c @@ -1053,8 +1053,8 @@ void bodyCalculateHeadOffset(struct modelfiledata *headfiledata, s32 headnum, s3 if (node && node != prev && node->type == MODELNODETYPE_DL) { struct modelrodata_dl *rodata = &node->rodata->dl; - for (i = 0; i < rodata->pcount; i++) { - rodata->ptable[i].unk02 += offset; + for (i = 0; i < rodata->numvertices; i++) { + rodata->vertices[i].y += offset; } } } while (node); diff --git a/src/game/propobj.c b/src/game/propobj.c index 888ca3720..5d9c97e1e 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -51191,7 +51191,7 @@ glabel var7f1aa82c // node = func0f0687e4(obj->model); // dldata1 = &node->data->displaylist; // dldata2 = modelGetNodeRwData(obj->model, node); -// oldcolours = (struct colour *)(((u32)&dldata1->ptable[dldata1->pcount] + 7 | 7) ^ 7); +// oldcolours = (struct colour *)(((u32)&dldata1->vertices[dldata1->numvertices] + 7 | 7) ^ 7); // newcolours = (struct colour *)gfxAllocateColours(dldata1->numcolours); // // for (i = 0; i < dldata1->numcolours; i++) { @@ -69876,43 +69876,19 @@ glabel func0f08cb20 /* f08d3d8: 27bd00b0 */ addiu $sp,$sp,0xb0 ); -GLOBAL_ASM( -glabel func0f08d3dc -/* f08d3dc: 27bdffd0 */ addiu $sp,$sp,-48 -/* f08d3e0: afbf001c */ sw $ra,0x1c($sp) -/* f08d3e4: afb00018 */ sw $s0,0x18($sp) -/* f08d3e8: 0fc1a6d3 */ jal func0f069b4c -/* f08d3ec: 00808025 */ or $s0,$a0,$zero -/* f08d3f0: 960e0070 */ lhu $t6,0x70($s0) -/* f08d3f4: 31cf0004 */ andi $t7,$t6,0x4 -/* f08d3f8: 51e00015 */ beqzl $t7,.L0f08d450 -/* f08d3fc: 8fbf001c */ lw $ra,0x1c($sp) -/* f08d400: 0fc1a1f9 */ jal func0f0687e4 -/* f08d404: 8e040018 */ lw $a0,0x18($s0) -/* f08d408: 8c580004 */ lw $t8,0x4($v0) -/* f08d40c: 00402825 */ or $a1,$v0,$zero -/* f08d410: afb80028 */ sw $t8,0x28($sp) -/* f08d414: 0c006a87 */ jal modelGetNodeRwData -/* f08d418: 8e040018 */ lw $a0,0x18($s0) -/* f08d41c: 8fb90028 */ lw $t9,0x28($sp) -/* f08d420: afa20024 */ sw $v0,0x24($sp) -/* f08d424: 0fc59e59 */ jal gfxAllocateVertices -/* f08d428: 87240010 */ lh $a0,0x10($t9) -/* f08d42c: 8fa30028 */ lw $v1,0x28($sp) -/* f08d430: 8fa80024 */ lw $t0,0x24($sp) -/* f08d434: 02002025 */ or $a0,$s0,$zero -/* f08d438: 00403025 */ or $a2,$v0,$zero -/* f08d43c: ad020000 */ sw $v0,0x0($t0) -/* f08d440: 84670010 */ lh $a3,0x10($v1) -/* f08d444: 0fc232c8 */ jal func0f08cb20 -/* f08d448: 8c65000c */ lw $a1,0xc($v1) -/* f08d44c: 8fbf001c */ lw $ra,0x1c($sp) -.L0f08d450: -/* f08d450: 8fb00018 */ lw $s0,0x18($sp) -/* f08d454: 27bd0030 */ addiu $sp,$sp,0x30 -/* f08d458: 03e00008 */ jr $ra -/* f08d45c: 00000000 */ nop -); +void func0f08d3dc(struct doorobj *door) +{ + func0f069b4c(&door->base); + + if (door->doorflags & DOORFLAG_0004) { + struct modelnode *node = func0f0687e4(door->base.model); + union modelrodata *rodata = node->rodata; + union modelrwdata *rwdata = modelGetNodeRwData(door->base.model, node); + + rwdata->dl.vertices = gfxAllocateVertices(rodata->dl.numvertices); + func0f08cb20(door, rodata->dl.vertices, rwdata->dl.vertices, rodata->dl.numvertices); + } +} GLOBAL_ASM( glabel func0f08d460 diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index c6e351f71..cbd3f0654 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -304,7 +304,7 @@ void doorsCheckAutomatic(void); void func0f08c424(struct doorobj *door, Mtxf *matrix); void doorGetBbox(struct doorobj *door, struct modelrodata_bbox *dst); u32 func0f08c54c(struct doorobj *door); -u32 func0f08cb20(void); +void func0f08cb20(struct doorobj *door, struct gfxvtx *vertices1, struct gfxvtx *vertices2, s32 numvertices); void func0f08d3dc(struct doorobj *door); void func0f08d460(struct doorobj *door); void doorActivatePortal(struct doorobj *door); diff --git a/src/include/types.h b/src/include/types.h index c12e1ccff..66b76cb8c 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -642,21 +642,12 @@ struct modelrodata_headspot { // type 0x17 u16 rwdataindex; }; -struct ptableentry { - s16 unk00; - s16 unk02; - s16 unk04; - s16 unk06; - s16 unk08; - s16 unk0a; -}; - struct modelrodata_dl { // type 0x18 /*0x00*/ Gfx *primary; /*0x04*/ Gfx *secondary; /*0x08*/ u32 *colourtable; - /*0x0c*/ struct ptableentry *ptable; - /*0x10*/ s16 pcount; + /*0x0c*/ struct gfxvtx *vertices; + /*0x10*/ s16 numvertices; /*0x12*/ s16 mcount; /*0x14*/ u16 rwdataindex; /*0x16*/ u16 numcolours; @@ -769,7 +760,7 @@ struct modelrwdata_headspot { // type 0x17 }; struct modelrwdata_dl { // type 0x18 - struct ptableentry *ptable; + struct gfxvtx *vertices; Gfx *gdl; u32 *unk08; }; diff --git a/src/lib/model.c b/src/lib/model.c index 18bcdef49..1e9df9551 100644 --- a/src/lib/model.c +++ b/src/lib/model.c @@ -4648,7 +4648,7 @@ void modelRenderNodeDl(struct modelrenderdata *renderdata, struct model *model, break; } - gSPSegment(renderdata->gdl++, 0x04, osVirtualToPhysical(rwdata->dl.ptable)); + gSPSegment(renderdata->gdl++, 0x04, osVirtualToPhysical(rwdata->dl.vertices)); gSPSegment(renderdata->gdl++, 0x06, osVirtualToPhysical(rwdata->dl.unk08)); gSPDisplayList(renderdata->gdl++, rwdata->dl.gdl); @@ -4671,7 +4671,7 @@ void modelRenderNodeDl(struct modelrenderdata *renderdata, struct model *model, modelApplyCullMode(renderdata); } - gSPSegment(renderdata->gdl++, 0x04, osVirtualToPhysical(rwdata->dl.ptable)); + gSPSegment(renderdata->gdl++, 0x04, osVirtualToPhysical(rwdata->dl.vertices)); gSPSegment(renderdata->gdl++, 0x06, osVirtualToPhysical(rwdata->dl.unk08)); func00020248(renderdata, false); @@ -6181,7 +6181,7 @@ void modelPromoteNodeOffsetsToPointers(struct modelnode *node, u32 vma, u32 file break; case MODELNODETYPE_DL: rodata = node->rodata; - PROMOTE(rodata->dl.ptable); + PROMOTE(rodata->dl.vertices); rodata->dl.colourtable = (void *)fileramaddr; break; case MODELNODETYPE_DISTANCE: @@ -6452,12 +6452,12 @@ void modelInitRwData(struct model *model, struct modelnode *startnode) case MODELNODETYPE_DL: rodata = node->rodata; rwdata = modelGetNodeRwData(model, node); - rwdata->dl.ptable = rodata->dl.ptable; + rwdata->dl.vertices = rodata->dl.vertices; rwdata->dl.gdl = rodata->dl.primary; - rwdata->dl.unk08 = (void *) ALIGN8((u32)(rodata->dl.ptable + rodata->dl.pcount)); - if (rodata->dl.pcount); - if (rodata->dl.pcount); - if (rodata->dl.pcount); + rwdata->dl.unk08 = (void *) ALIGN8((u32)(rodata->dl.vertices + rodata->dl.numvertices)); + if (rodata->dl.numvertices); + if (rodata->dl.numvertices); + if (rodata->dl.numvertices); break; default: break;