From 1554d08078d414378053d0f7e3b6c359192ee064 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 29 Apr 2021 17:30:54 +1000 Subject: [PATCH] Rename some model types --- src/game/bg.c | 2 +- src/game/chr/chr.c | 18 ++-- src/game/chr/chraction.c | 13 ++- src/game/game_097ba0.c | 4 +- src/game/game_0b69d0.c | 10 +- src/game/game_129210.c | 10 +- src/game/propobj.c | 10 +- src/include/constants.h | 12 +-- src/include/lib/model.h | 10 +- src/include/types.h | 50 +++++----- src/lib/model.c | 208 +++++++++++++++++++-------------------- 11 files changed, 172 insertions(+), 175 deletions(-) diff --git a/src/game/bg.c b/src/game/bg.c index b7c0391a4..ae6910955 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -4732,7 +4732,7 @@ void bgInit(s32 stagenum) if (actualvalue != expectedvalue) { // Copy 0x40 bytes from a random location in ROM to a random // location in RAM. The write address can be anywhere in the - // boot segment or in the lib segment up to func00020f30. + // boot segment or in the lib segment up to modelRenderNodeDl. dmaExec((void *)(PHYS_TO_K0(0x1000) + (random() & 0x1fff8)), random() & 0x1fffe, 0x40); } } diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 4fbaaf517..10d0611cc 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -4543,9 +4543,9 @@ struct prop *func0f020b14(struct prop *prop, struct model *model, nodetype = chr->model->filedata->rootnode->type; - if ((nodetype & 0xff) == MODELNODETYPE_ROOT) { + if ((nodetype & 0xff) == MODELNODETYPE_CHRINFO) { union modelrwdata *rwdata = modelGetNodeRwData(chr->model, chr->model->filedata->rootnode); - rwdata->root.ground = ground; + rwdata->chrinfo.ground = ground; } chr->prevpos.x = prop->pos.x; @@ -11248,7 +11248,7 @@ void chrSetHudpieceVisible(struct chrdata *chr, bool visible) if (node2) { union modelrwdata *rwdata2 = modelGetNodeRwData(chr->model, node2); - rwdata2->partid.visible.u32 = visible; + rwdata2->toggle.visible = visible; } } } @@ -12229,8 +12229,8 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool withalpha) union modelrwdata *data1 = modelGetNodeRwData(model, node1); union modelrwdata *data2 = modelGetNodeRwData(model, node2); - data2->partid.visible.u32 = chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD; - data1->partid.visible.u32 = !data2->partid.visible.u32; + data2->toggle.visible = chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD; + data1->toggle.visible = !data2->toggle.visible; } } @@ -12253,8 +12253,8 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool withalpha) union modelrwdata *data1 = modelGetNodeRwData(model, node1); union modelrwdata *data2 = modelGetNodeRwData(model, node2); - data2->partid.visible.u32 = chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD; - data1->partid.visible.u32 = !data2->partid.visible.u32; + data2->toggle.visible = chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD; + data1->toggle.visible = !data2->toggle.visible; } } } @@ -22346,9 +22346,9 @@ void chrSetDrCarollImages(struct chrdata *drcaroll, s32 imageleft, s32 imagerigh rwdata = modelGetNodeRwData(model, nodes[j]); if (j == 0) { - rwdata->partid.visible.u32 = (imageleft == i) ? true : false; + rwdata->toggle.visible = (imageleft == i) ? true : false; } else { - rwdata->partid.visible.u32 = (imageright == i) ? true : false; + rwdata->toggle.visible = (imageright == i) ? true : false; } } } diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index e36ba2715..ccd4c4067 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -20895,7 +20895,7 @@ void chrTickAttackAmount(struct chrdata *chr) * There are two muzzles, left and right, which is specified using the `right` * argument. */ -void robotSetMuzzleFlash(struct chrdata *chr, bool right, bool enabled) +void robotSetMuzzleFlash(struct chrdata *chr, bool right, bool visible) { struct modelnode *node; union modelrwdata *rwdata; @@ -20913,9 +20913,8 @@ void robotSetMuzzleFlash(struct chrdata *chr, bool right, bool enabled) rwdata = modelGetNodeRwData(chr->model, node); } - // @dangerous: data may be uninitialised if (rwdata) { - rwdata->partid.visible.u16 = enabled; + rwdata->gunfire.visible = visible; } } @@ -31165,9 +31164,9 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle, nodetype = chr->model->filedata->rootnode->type; - if ((nodetype & 0xff) == MODELNODETYPE_ROOT) { + if ((nodetype & 0xff) == MODELNODETYPE_CHRINFO) { rwdata = modelGetNodeRwData(chr->model, chr->model->filedata->rootnode); - rwdata->root.ground = ground; + rwdata->chrinfo.ground = ground; } chr->chrflags |= CHRCFLAG_00000001; @@ -33137,8 +33136,8 @@ void chrToggleModelPart(struct chrdata *chr, s32 partnum) } if (rwdata) { - bool visible = rwdata->partid.visible.u32; - rwdata->partid.visible.u32 = !visible; + bool visible = rwdata->toggle.visible; + rwdata->toggle.visible = !visible; } } } diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 75b6e4bba..9fa8ea572 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -430,7 +430,7 @@ void func0f097e74(s16 partnum, s32 arg1, struct hand *hand, struct modelfiledata node = modelGetPart(g_Vars.currentplayer->gunctrl.unk1594, partnum); if (node) { - struct modelrodata_partid *rodata = &node->rodata->partid; + struct modelrodata_toggle *rodata = &node->rodata->toggle; u32 *ptr = &hand->handsavedata[rodata->rwdataindex]; *ptr = arg1; } @@ -439,7 +439,7 @@ void func0f097e74(s16 partnum, s32 arg1, struct hand *hand, struct modelfiledata node = modelGetPart(arg3, partnum); if (node) { - struct modelrodata_partid *rodata = &node->rodata->partid; + struct modelrodata_toggle *rodata = &node->rodata->toggle; u32 *ptr = &hand->unk0a6c[rodata->rwdataindex]; *ptr = arg1; } diff --git a/src/game/game_0b69d0.c b/src/game/game_0b69d0.c index 301be0e88..84c974007 100644 --- a/src/game/game_0b69d0.c +++ b/src/game/game_0b69d0.c @@ -1344,14 +1344,14 @@ bool currentPlayerAssumeChrForAnti(struct chrdata *hostchr, bool force) chrrootrwdata = modelGetNodeRwData(hostchr->model, hostchr->model->filedata->rootnode); playerrootrwdata = modelGetNodeRwData(playerchr->model, playerchr->model->filedata->rootnode); - playerrootrwdata->root = chrrootrwdata->root; + playerrootrwdata->chrinfo = chrrootrwdata->chrinfo; - if (playerrootrwdata->root.unk34.y < 10) { - playerrootrwdata->root.unk34.y = 10; + if (playerrootrwdata->chrinfo.unk34.y < 10) { + playerrootrwdata->chrinfo.unk34.y = 10; } - if (playerrootrwdata->root.unk24.y < 10) { - playerrootrwdata->root.unk24.y = 10; + if (playerrootrwdata->chrinfo.unk24.y < 10) { + playerrootrwdata->chrinfo.unk24.y = 10; } playerchr->chrwidth = hostchr->chrwidth; diff --git a/src/game/game_129210.c b/src/game/game_129210.c index 685851921..5f42b4665 100644 --- a/src/game/game_129210.c +++ b/src/game/game_129210.c @@ -55,21 +55,21 @@ void func0f129210(union modelrwdata *find, union modelrwdata *replacement) struct model *model = obj->model; struct modelfiledata *filedata = model->filedata; struct modelnode *node = filedata->rootnode; - struct modelrodata_displaylist *rodata; + struct modelrodata_dl *rodata; while (node) { switch (node->type & 0xff) { - case MODELNODETYPE_DISPLAYLIST: - rodata = &node->rodata->displaylist; + case MODELNODETYPE_DL: + rodata = &node->rodata->dl; if (model->rwdatas[rodata->rwdataindex] == find) { model->rwdatas[rodata->rwdataindex] = replacement; } break; - case MODELNODETYPE_NEARFAR: + case MODELNODETYPE_DISTANCE: func0001c784(obj->model, node); break; - case MODELNODETYPE_PARTID: + case MODELNODETYPE_TOGGLE: func0001c7d0(obj->model, node); break; case MODELNODETYPE_HEADSPOT: diff --git a/src/game/propobj.c b/src/game/propobj.c index 1bf24fa2f..3b928699d 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -33359,7 +33359,7 @@ void doorUpdatePortalIfWindowed(struct prop *doorprop, s32 playercount) node = modelGetPart(model->filedata, MODELPART_01); rwdata = modelGetNodeRwData(model, node); - if (rwdata->partid.visible.u32 == 0) { + if (!rwdata->toggle.visible) { canhide = false; } } @@ -47326,7 +47326,7 @@ void func0f07e058(struct prop *prop) union modelrwdata *data = modelGetNodeRwData(model, node); u32 flags = obj->flags; - data->partid.visible.u32 = (flags & OBJFLAG_DEACTIVATED) == 0; + data->toggle.visible = (flags & OBJFLAG_DEACTIVATED) == 0; } } @@ -59247,7 +59247,7 @@ void doorDestroyGlass(struct doorobj *door) node = modelGetPart(model->filedata, 1); rwdata = modelGetNodeRwData(model, node); - rwdata->partid.visible.u32 = 0; + rwdata->toggle.visible = false; } void func0f084f64(struct defaultobj *obj) @@ -59271,7 +59271,7 @@ void func0f084f64(struct defaultobj *obj) func0f13e40c(prop, 1); rwdata = modelGetNodeRwData(model, modelGetPart(model->filedata, 3)); - rwdata->partid.visible.u32 = 0; + rwdata->toggle.visible = false; } void func0f085050(struct prop *prop, f32 damage, struct coord *pos, s32 arg3, s32 arg4) @@ -77915,7 +77915,7 @@ void objSetModelPartVisible(struct defaultobj *obj, s32 partnum, bool visible) visible = false; } - rwdata->partid.visible.u32 = visible; + rwdata->toggle.visible = visible; } } } diff --git a/src/include/constants.h b/src/include/constants.h index 1ea7feb93..dded10aa5 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -1760,23 +1760,23 @@ #define MODEL_CETANDOORSIDE 0x01b7 #define MODEL_BUDDYBRIDGE 0x01b8 -#define MODELNODETYPE_ROOT 0x01 +#define MODELNODETYPE_CHRINFO 0x01 #define MODELNODETYPE_POSITION 0x02 -#define MODELNODETYPE_04 0x04 +#define MODELNODETYPE_GUNDL 0x04 #define MODELNODETYPE_05 0x05 -#define MODELNODETYPE_NEARFAR 0x08 -#define MODELNODETYPE_HAT 0x09 +#define MODELNODETYPE_DISTANCE 0x08 +#define MODELNODETYPE_REORDER 0x09 #define MODELNODETYPE_BBOX 0x0a #define MODELNODETYPE_0B 0x0b #define MODELNODETYPE_GUNFIRE 0x0c #define MODELNODETYPE_0D 0x0d #define MODELNODETYPE_0E 0x0e #define MODELNODETYPE_0F 0x0f -#define MODELNODETYPE_PARTID 0x12 +#define MODELNODETYPE_TOGGLE 0x12 #define MODELNODETYPE_POSITIONHELD 0x15 #define MODELNODETYPE_16 0x16 #define MODELNODETYPE_HEADSPOT 0x17 -#define MODELNODETYPE_DISPLAYLIST 0x18 +#define MODELNODETYPE_DL 0x18 #define MODELPART_00 0x00 #define MODELPART_LENS 0x00 diff --git a/src/include/lib/model.h b/src/include/lib/model.h index c09f50edb..de208bb70 100644 --- a/src/include/lib/model.h +++ b/src/include/lib/model.h @@ -44,7 +44,7 @@ void func0001c784(struct model *model, struct modelnode *node); void func0001c7d0(struct model *model, struct modelnode *node); void modelAttachHead(struct model *model, struct modelnode *node); void func0001c868(struct modelnode *node, bool visible); -void func0001c924(struct model *model, struct modelnode *node); +void modelRenderNodeReorder(struct model *model, struct modelnode *node); void func0001c950(struct model *model, struct modelnode *node); void func0001cb0c(struct model *model, struct modelnode *node); u32 func0001cc20(void); @@ -84,11 +84,11 @@ u32 func0001f890(void); u32 func00020248(void); u32 func00020bdc(void); u32 func00020c90(void); -void func00020d1c(struct modelrenderdata *renderdata, struct model *model, struct modelnode *node); -void func00020f30(struct modelrenderdata *renderdata, struct model *model, struct modelnode *node); -void func0002124c(struct modelrenderdata *renderdata, struct modelnode *node); +void modelRenderNodeGundl(struct modelrenderdata *renderdata, struct model *model, struct modelnode *node); +void modelRenderNodeDl(struct modelrenderdata *renderdata, struct model *model, struct modelnode *node); +void modelRenderNodeType16(struct modelrenderdata *renderdata, struct modelnode *node); u32 func000216cc(void); -void func0002170c(struct modelrenderdata *renderdata, struct model *model, struct modelnode *node); +void modelRenderNodeGunfire(struct modelrenderdata *renderdata, struct model *model, struct modelnode *node); void modelRender(struct modelrenderdata *renderdata, struct model *model); u32 func000220fc(void); s32 func000225d4(struct model *model, struct coord *arg1, struct coord *arg2, u32 *arg3); diff --git a/src/include/types.h b/src/include/types.h index 40e198b8e..2011d9583 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -514,7 +514,7 @@ struct modeltype { u16 *things; }; -struct modelrodata_root { // type 0x01 +struct modelrodata_chrinfo { // type 0x01 u32 modeltype; f32 unk04; u16 rwdataindex; @@ -527,14 +527,14 @@ struct modelrodata_position { // type 0x02 f32 drawdist; }; -struct modelrodata_nearfar { // type 0x08 +struct modelrodata_distance { // type 0x08 f32 near; f32 far; struct modelnode *target; u16 rwdataindex; }; -struct modelrodata_hat { // type 0x09 +struct modelrodata_reorder { // type 0x09 f32 unk00; f32 unk04; f32 unk08; @@ -584,7 +584,7 @@ struct modelrodata_gunfire { // type 0x0c u16 rwdataindex; }; -struct modelrodata_partid { // type 0x12 +struct modelrodata_toggle { // type 0x12 struct modelnode *target; u16 rwdataindex; }; @@ -602,7 +602,7 @@ struct modelrodata_headspot { // type 0x17 u16 rwdataindex; }; -struct modelrodata_displaylist { // type 0x18 +struct modelrodata_dl { // type 0x18 /*0x00*/ u32 primary; /*0x04*/ u32 secondary; /*0x08*/ u32 *colourtable; @@ -614,18 +614,18 @@ struct modelrodata_displaylist { // type 0x18 }; union modelrodata { - struct modelrodata_root root; + struct modelrodata_chrinfo chrinfo; struct modelrodata_position position; - struct modelrodata_nearfar nearfar; - struct modelrodata_hat hat; + struct modelrodata_distance distance; + struct modelrodata_reorder reorder; struct modelrodata_bbox bbox; struct modelrodata_type0b type0b; struct modelrodata_gunfire gunfire; - struct modelrodata_partid partid; + struct modelrodata_toggle toggle; struct modelrodata_positionheld positionheld; struct modelrodata_type16 type16; struct modelrodata_headspot headspot; - struct modelrodata_displaylist displaylist; + struct modelrodata_dl dl; }; struct modelnode { @@ -659,14 +659,14 @@ struct model { /*0x04*/ struct chrdata *chr; /*0x08*/ struct modelfiledata *filedata; /*0x0c*/ Mtxf *matrices; - /*0x10*/ union modelrwdata **rwdatas; // array of pointers to modelrwdata structs + /*0x10*/ union modelrwdata **rwdatas; /*0x14*/ f32 scale; /*0x18*/ struct model *attachedto; /*0x1c*/ struct modelnode *unk1c; /*0x20*/ struct anim *anim; }; -struct modelrwdata_root { // type 0x01 +struct modelrwdata_chrinfo { // type 0x01 u16 unk00; u8 unk02; f32 ground; @@ -688,11 +688,11 @@ struct modelrwdata_05 { // type 0x05 bool unk00; }; -struct modelrwdata_nearfar { // type 0x08 +struct modelrwdata_distance { // type 0x08 bool visible; }; -struct modelrwdata_hat { // type 0x09 +struct modelrwdata_reorder { // type 0x09 bool visible; }; @@ -701,14 +701,12 @@ struct modelrwdata_0b { // type 0x0b }; struct modelrwdata_gunfire { // type 0x0c - u32 unk00; + u16 visible; + u16 unk02; }; -struct modelrwdata_partid { // type 0x12 - union { - u16 u16; - bool u32; - } visible; +struct modelrwdata_toggle { // type 0x12 + bool visible; }; struct modelrwdata_headspot { // type 0x17 @@ -716,22 +714,22 @@ struct modelrwdata_headspot { // type 0x17 void *rwdatas; }; -struct modelrwdata_displaylist { // type 0x18 +struct modelrwdata_dl { // type 0x18 u32 unk00; u32 unk04; u32 unk08; }; union modelrwdata { - struct modelrwdata_root root; + struct modelrwdata_chrinfo chrinfo; struct modelrwdata_05 type05; - struct modelrwdata_nearfar nearfar; - struct modelrwdata_hat hat; + struct modelrwdata_distance distance; + struct modelrwdata_reorder reorder; struct modelrwdata_0b type0b; struct modelrwdata_gunfire gunfire; - struct modelrwdata_partid partid; + struct modelrwdata_toggle toggle; struct modelrwdata_headspot headspot; - struct modelrwdata_displaylist displaylist; + struct modelrwdata_dl dl; }; struct waygroup { diff --git a/src/lib/model.c b/src/lib/model.c index 16a572466..480fdd8c6 100644 --- a/src/lib/model.c +++ b/src/lib/model.c @@ -46,9 +46,9 @@ s32 func0001a524(struct modelnode *node, s32 arg1) while (node) { switch (node->type & 0xff) { - case MODELNODETYPE_ROOT: + case MODELNODETYPE_CHRINFO: rodata1 = node->rodata; - return (s16) rodata1->root.modeltype; + return (s16) rodata1->chrinfo.modeltype; case MODELNODETYPE_POSITION: rodata2 = node->rodata; return rodata2->position.pieces[arg1 == 0x200 ? 2 : (arg1 == 0x100 ? 1 : 0)]; @@ -97,9 +97,9 @@ struct modelnode *func0001a634(struct model *model, s32 arg1) while (node) { switch (node->type & 0xff) { - case MODELNODETYPE_ROOT: + case MODELNODETYPE_CHRINFO: rodata1 = node->rodata; - if (arg1 == (s16)rodata1->root.modeltype) { + if (arg1 == (s16)rodata1->chrinfo.modeltype) { return node; } break; @@ -361,20 +361,20 @@ void *modelGetNodeRwData(struct model *model, struct modelnode *node) union modelrwdata **rwdatas = model->rwdatas; switch (node->type & 0xff) { - case MODELNODETYPE_ROOT: - index = node->rodata->root.rwdataindex; + case MODELNODETYPE_CHRINFO: + index = node->rodata->chrinfo.rwdataindex; break; - case MODELNODETYPE_DISPLAYLIST: - index = node->rodata->displaylist.rwdataindex; + case MODELNODETYPE_DL: + index = node->rodata->dl.rwdataindex; break; - case MODELNODETYPE_NEARFAR: - index = node->rodata->nearfar.rwdataindex; + case MODELNODETYPE_DISTANCE: + index = node->rodata->distance.rwdataindex; break; - case MODELNODETYPE_PARTID: - index = node->rodata->partid.rwdataindex; + case MODELNODETYPE_TOGGLE: + index = node->rodata->toggle.rwdataindex; break; - case MODELNODETYPE_HAT: - index = node->rodata->hat.rwdataindex; + case MODELNODETYPE_REORDER: + index = node->rodata->reorder.rwdataindex; break; case MODELNODETYPE_0B: index = node->rodata->type0b.rwdataindex; @@ -404,9 +404,9 @@ void *modelGetNodeRwData(struct model *model, struct modelnode *node) void modelNodeGetPosition(struct model *model, struct modelnode *node, struct coord *pos) { switch (node->type & 0xff) { - case MODELNODETYPE_ROOT: + case MODELNODETYPE_CHRINFO: { - struct modelrwdata_root *rwdata = modelGetNodeRwData(model, node); + struct modelrwdata_chrinfo *rwdata = modelGetNodeRwData(model, node); pos->x = rwdata->pos.x; pos->y = rwdata->pos.y; pos->z = rwdata->pos.z; @@ -439,9 +439,9 @@ void modelNodeGetPosition(struct model *model, struct modelnode *node, struct co void modelNodeSetPosition(struct model *model, struct modelnode *node, struct coord *pos) { switch (node->type & 0xff) { - case MODELNODETYPE_ROOT: + case MODELNODETYPE_CHRINFO: { - struct modelrwdata_root *rwdata = modelGetNodeRwData(model, node); + struct modelrwdata_chrinfo *rwdata = modelGetNodeRwData(model, node); struct coord diff[1]; diff[0].x = pos->x - rwdata->pos.x; @@ -554,9 +554,9 @@ glabel func0001ad5c f32 func0001ae44(struct model *model) { - if ((model->filedata->rootnode->type & 0xff) == MODELNODETYPE_ROOT) { + if ((model->filedata->rootnode->type & 0xff) == MODELNODETYPE_CHRINFO) { union modelrwdata *rwdata = modelGetNodeRwData(model, model->filedata->rootnode); - return rwdata->root.unk14; + return rwdata->chrinfo.unk14; } return 0; @@ -564,8 +564,8 @@ f32 func0001ae44(struct model *model) void func0001ae90(struct model *model, f32 angle) { - if ((model->filedata->rootnode->type & 0xff) == MODELNODETYPE_ROOT) { - struct modelrwdata_root *rwdata = modelGetNodeRwData(model, model->filedata->rootnode); + if ((model->filedata->rootnode->type & 0xff) == MODELNODETYPE_CHRINFO) { + struct modelrwdata_chrinfo *rwdata = modelGetNodeRwData(model, model->filedata->rootnode); f32 diff = angle - rwdata->unk14; if (diff < 0) { @@ -1090,7 +1090,7 @@ void func0001b3bc(struct model *model) { struct modelnode *node = model->filedata->rootnode; - if (node && (node->type & 0xff) == MODELNODETYPE_ROOT) { + if (node && (node->type & 0xff) == MODELNODETYPE_CHRINFO) { func0001b0e8(model, node); } } @@ -3136,22 +3136,22 @@ void func0001c664(struct model *model, struct modelnode *node) } } - if (distance > rodata->nearfar.near * model->scale || rodata->nearfar.near == 0) { - if (distance <= rodata->nearfar.far * model->scale) { - rwdata->nearfar.visible = true; - node->child = rodata->nearfar.target; + if (distance > rodata->distance.near * model->scale || rodata->distance.near == 0) { + if (distance <= rodata->distance.far * model->scale) { + rwdata->distance.visible = true; + node->child = rodata->distance.target; return; } } - rwdata->nearfar.visible = false; + rwdata->distance.visible = false; node->child = NULL; } void func0001c784(struct model *model, struct modelnode *node) { - struct modelrodata_nearfar *rodata = &node->rodata->nearfar; - struct modelrwdata_nearfar *rwdata = modelGetNodeRwData(model, node); + struct modelrodata_distance *rodata = &node->rodata->distance; + struct modelrwdata_distance *rwdata = modelGetNodeRwData(model, node); if (rwdata->visible) { node->child = rodata->target; @@ -3162,10 +3162,10 @@ void func0001c784(struct model *model, struct modelnode *node) void func0001c7d0(struct model *model, struct modelnode *node) { - struct modelrodata_partid *rodata = &node->rodata->partid; - struct modelrwdata_partid *rwdata = modelGetNodeRwData(model, node); + struct modelrodata_toggle *rodata = &node->rodata->toggle; + struct modelrwdata_toggle *rwdata = modelGetNodeRwData(model, node); - if (rwdata->visible.u32) { + if (rwdata->visible) { node->child = rodata->target; } else { node->child = NULL; @@ -3201,11 +3201,11 @@ void func0001c868(struct modelnode *basenode, bool visible) struct modelnode *loopnode; if (visible) { - node1 = rodata->hat.unk18; - node2 = rodata->hat.unk1c; + node1 = rodata->reorder.unk18; + node2 = rodata->reorder.unk1c; } else { - node1 = rodata->hat.unk1c; - node2 = rodata->hat.unk18; + node1 = rodata->reorder.unk1c; + node2 = rodata->reorder.unk18; } if (node1) { @@ -3247,11 +3247,11 @@ void func0001c868(struct modelnode *basenode, bool visible) } } -void func0001c924(struct model *model, struct modelnode *node) +void modelRenderNodeReorder(struct model *model, struct modelnode *node) { union modelrwdata *rwdata = modelGetNodeRwData(model, node); - func0001c868(node, rwdata->hat.visible); + func0001c868(node, rwdata->reorder.visible); } void func0001c950(struct model *model, struct modelnode *node) @@ -3263,40 +3263,40 @@ void func0001c950(struct model *model, struct modelnode *node) struct coord sp2c; f32 tmp; - if (rodata->hat.unk20 == 0) { - sp38.x = rodata->hat.unk0c[0]; - sp38.y = rodata->hat.unk0c[1]; - sp38.z = rodata->hat.unk0c[2]; + if (rodata->reorder.unk20 == 0) { + sp38.x = rodata->reorder.unk0c[0]; + sp38.y = rodata->reorder.unk0c[1]; + sp38.z = rodata->reorder.unk0c[2]; func00015b10(mtx, &sp38); - } else if (rodata->hat.unk20 == 2) { - sp38.x = mtx->m[1][0] * rodata->hat.unk0c[1]; - sp38.y = mtx->m[1][1] * rodata->hat.unk0c[1]; - sp38.z = mtx->m[1][2] * rodata->hat.unk0c[1]; - } else if (rodata->hat.unk20 == 3) { - sp38.x = mtx->m[2][0] * rodata->hat.unk0c[2]; - sp38.y = mtx->m[2][1] * rodata->hat.unk0c[2]; - sp38.z = mtx->m[2][2] * rodata->hat.unk0c[2]; - } else if (rodata->hat.unk20 == 1) { - sp38.x = mtx->m[0][0] * rodata->hat.unk0c[0]; - sp38.y = mtx->m[0][1] * rodata->hat.unk0c[0]; - sp38.z = mtx->m[0][2] * rodata->hat.unk0c[0]; + } else if (rodata->reorder.unk20 == 2) { + sp38.x = mtx->m[1][0] * rodata->reorder.unk0c[1]; + sp38.y = mtx->m[1][1] * rodata->reorder.unk0c[1]; + sp38.z = mtx->m[1][2] * rodata->reorder.unk0c[1]; + } else if (rodata->reorder.unk20 == 3) { + sp38.x = mtx->m[2][0] * rodata->reorder.unk0c[2]; + sp38.y = mtx->m[2][1] * rodata->reorder.unk0c[2]; + sp38.z = mtx->m[2][2] * rodata->reorder.unk0c[2]; + } else if (rodata->reorder.unk20 == 1) { + sp38.x = mtx->m[0][0] * rodata->reorder.unk0c[0]; + sp38.y = mtx->m[0][1] * rodata->reorder.unk0c[0]; + sp38.z = mtx->m[0][2] * rodata->reorder.unk0c[0]; } - sp2c.x = rodata->hat.unk00; - sp2c.y = rodata->hat.unk04; - sp2c.z = rodata->hat.unk08; + sp2c.x = rodata->reorder.unk00; + sp2c.y = rodata->reorder.unk04; + sp2c.z = rodata->reorder.unk08; func00015b64(mtx, &sp2c); tmp = sp38.f[0] * sp2c.f[0] + sp38.f[1] * sp2c.f[1] + sp38.f[2] * sp2c.f[2]; if (tmp < 0) { - rwdata->hat.visible = true; + rwdata->reorder.visible = true; } else { - rwdata->hat.visible = false; + rwdata->reorder.visible = false; } - func0001c924(model, node); + modelRenderNodeReorder(model, node); } void func0001cb0c(struct model *model, struct modelnode *parent) @@ -3310,7 +3310,7 @@ void func0001cb0c(struct model *model, struct modelnode *parent) bool dochildren = true; switch (type) { - case MODELNODETYPE_ROOT: + case MODELNODETYPE_CHRINFO: case MODELNODETYPE_POSITION: case MODELNODETYPE_0B: case MODELNODETYPE_GUNFIRE: @@ -3320,16 +3320,16 @@ void func0001cb0c(struct model *model, struct modelnode *parent) case MODELNODETYPE_POSITIONHELD: dochildren = false; break; - case MODELNODETYPE_NEARFAR: + case MODELNODETYPE_DISTANCE: func0001c664(model, node); break; - case MODELNODETYPE_HAT: + case MODELNODETYPE_REORDER: func0001c950(model, node); break; case MODELNODETYPE_HEADSPOT: modelAttachHead(model, node); break; - case MODELNODETYPE_DISPLAYLIST: + case MODELNODETYPE_DL: break; } @@ -4131,8 +4131,8 @@ void modelCopyAnimForMerge(struct model *model, f32 arg1) anim->elapsespeed2 = anim->elapsespeed; anim->endframe2 = anim->endframe; - if (nodetype == MODELNODETYPE_ROOT) { - struct modelrwdata_root *rwdata = modelGetNodeRwData(model, node); + if (nodetype == MODELNODETYPE_CHRINFO) { + struct modelrwdata_chrinfo *rwdata = modelGetNodeRwData(model, node); rwdata->unk02 = 1; rwdata->unk4c.x = rwdata->unk34.x; rwdata->unk4c.y = rwdata->unk34.y; @@ -7781,7 +7781,7 @@ glabel func00020c90 ); GLOBAL_ASM( -glabel func00020d1c +glabel modelRenderNodeGundl /* 20d1c: 27bdffc8 */ addiu $sp,$sp,-56 /* 20d20: 3c028006 */ lui $v0,%hi(var8005efc4) /* 20d24: 8c42efc4 */ lw $v0,%lo(var8005efc4)($v0) @@ -7928,7 +7928,7 @@ glabel func00020d1c ); GLOBAL_ASM( -glabel func00020f30 +glabel modelRenderNodeDl /* 20f30: 27bdffb0 */ addiu $sp,$sp,-80 /* 20f34: 3c028006 */ lui $v0,%hi(var8005efc4) /* 20f38: 8c42efc4 */ lw $v0,%lo(var8005efc4)($v0) @@ -8141,7 +8141,7 @@ glabel func00020f30 ); GLOBAL_ASM( -glabel func0002124c +glabel modelRenderNodeType16 /* 2124c: 27bdffb8 */ addiu $sp,$sp,-72 /* 21250: afbf003c */ sw $ra,0x3c($sp) /* 21254: afbe0038 */ sw $s8,0x38($sp) @@ -8459,7 +8459,7 @@ glabel func000216cc ); GLOBAL_ASM( -glabel func0002170c +glabel modelRenderNodeGunfire .late_rodata glabel var70054454 .word 0x40c907a9 @@ -8992,17 +8992,17 @@ void modelRender(struct modelrenderdata *renderdata, struct model *model) type = node->type & 0xff; switch (type) { - case MODELNODETYPE_NEARFAR: - case MODELNODETYPE_PARTID: + case MODELNODETYPE_DISTANCE: + case MODELNODETYPE_TOGGLE: rodata = node->rodata; rwdata = modelGetNodeRwData(model, node); switch (type) { - case MODELNODETYPE_NEARFAR: - node->child = rwdata->nearfar.visible ? rodata->nearfar.target : NULL; + case MODELNODETYPE_DISTANCE: + node->child = rwdata->distance.visible ? rodata->distance.target : NULL; break; - case MODELNODETYPE_PARTID: - node->child = rwdata->partid.visible.u32 ? rodata->partid.target : NULL; + case MODELNODETYPE_TOGGLE: + node->child = rwdata->toggle.visible ? rodata->toggle.target : NULL; break; } break; @@ -9019,22 +9019,22 @@ void modelRender(struct modelrenderdata *renderdata, struct model *model) } } break; - case MODELNODETYPE_HAT: - func0001c924(model, node); + case MODELNODETYPE_REORDER: + modelRenderNodeReorder(model, node); break; case MODELNODETYPE_GUNFIRE: - func0002170c(renderdata, model, node); + modelRenderNodeGunfire(renderdata, model, node); break; - case MODELNODETYPE_04: - func00020d1c(renderdata, model, node); + case MODELNODETYPE_GUNDL: + modelRenderNodeGundl(renderdata, model, node); break; - case MODELNODETYPE_DISPLAYLIST: - func00020f30(renderdata, model, node); + case MODELNODETYPE_DL: + modelRenderNodeDl(renderdata, model, node); break; case MODELNODETYPE_16: - func0002124c(renderdata, node); + modelRenderNodeType16(renderdata, node); break; - case MODELNODETYPE_ROOT: + case MODELNODETYPE_CHRINFO: default: break; } @@ -9881,22 +9881,22 @@ s32 modelCalculateRwDataIndexes(struct modelnode *basenode) u32 type = node->type & 0xff; switch (type) { - case MODELNODETYPE_ROOT: + case MODELNODETYPE_CHRINFO: rodata = node->rodata; - rodata->root.rwdataindex = len; - len += sizeof(struct modelrwdata_root) / 4; + rodata->chrinfo.rwdataindex = len; + len += sizeof(struct modelrwdata_chrinfo) / 4; break; - case MODELNODETYPE_NEARFAR: + case MODELNODETYPE_DISTANCE: rodata = node->rodata; - rodata->nearfar.rwdataindex = len; - len += sizeof(struct modelrwdata_nearfar) / 4; - node->child = rodata->nearfar.target; + rodata->distance.rwdataindex = len; + len += sizeof(struct modelrwdata_distance) / 4; + node->child = rodata->distance.target; break; - case MODELNODETYPE_PARTID: + case MODELNODETYPE_TOGGLE: rodata = node->rodata; - rodata->partid.rwdataindex = len; - len += sizeof(struct modelrwdata_partid) / 4; - node->child = rodata->partid.target; + rodata->toggle.rwdataindex = len; + len += sizeof(struct modelrwdata_toggle) / 4; + node->child = rodata->toggle.target; break; case MODELNODETYPE_HEADSPOT: rodata = node->rodata; @@ -9904,10 +9904,10 @@ s32 modelCalculateRwDataIndexes(struct modelnode *basenode) len += sizeof(struct modelrwdata_headspot) / 4; node->child = NULL; break; - case MODELNODETYPE_HAT: + case MODELNODETYPE_REORDER: rodata = node->rodata; - rodata->hat.rwdataindex = len; - len += sizeof(struct modelrwdata_hat) / 4; + rodata->reorder.rwdataindex = len; + len += sizeof(struct modelrwdata_reorder) / 4; func0001c868(node, false); break; case MODELNODETYPE_0B: @@ -9920,10 +9920,10 @@ s32 modelCalculateRwDataIndexes(struct modelnode *basenode) rodata->gunfire.rwdataindex = len; len += sizeof(struct modelrwdata_gunfire) / 4; break; - case MODELNODETYPE_DISPLAYLIST: + case MODELNODETYPE_DL: rodata = node->rodata; - rodata->displaylist.rwdataindex = len; - len += sizeof(struct modelrwdata_displaylist) / 4; + rodata->dl.rwdataindex = len; + len += sizeof(struct modelrwdata_dl) / 4; break; default: break; @@ -10092,7 +10092,7 @@ glabel var70054634 /* 22e90: 02002825 */ or $a1,$s0,$zero /* 22e94: ac400000 */ sw $zero,0x0($v0) /* 22e98: 02402025 */ or $a0,$s2,$zero -/* 22e9c: 0c007249 */ jal func0001c924 +/* 22e9c: 0c007249 */ jal modelRenderNodeReorder /* 22ea0: 02002825 */ or $a1,$s0,$zero /* 22ea4: 10000022 */ b .L00022f30 /* 22ea8: 8e030014 */ lw $v1,0x14($s0)