diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 2e0228463..cf1bcee45 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -839,7 +839,7 @@ glabel func0f0c4250 /* f0c45bc: 8fa40074 */ lw $a0,0x74($sp) /* f0c45c0: 8fab0074 */ lw $t3,0x74($sp) /* f0c45c4: 27a50068 */ addiu $a1,$sp,0x68 -/* f0c45c8: 0c006b4d */ jal func0001ad34 +/* f0c45c8: 0c006b4d */ jal modelSetRootPosition /* f0c45cc: 8d640020 */ lw $a0,0x20($t3) /* f0c45d0: 8fac00b8 */ lw $t4,0xb8($sp) /* f0c45d4: 8fa400a8 */ lw $a0,0xa8($sp) diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 2c6999fe1..1af79f9bd 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -2555,7 +2555,7 @@ struct prop *func0f020b14(struct prop *prop, struct model *model, func0f065c44(prop); roomsCopy(rooms, prop->rooms); func0f0220ac(chr); - func0001ad34(model, &prop->pos); + modelSetRootPosition(model, &prop->pos); nodetype = chr->model->unk08->rootnode->type; @@ -3868,7 +3868,7 @@ glabel func0f0220ec /* f0221c0: 312b0800 */ andi $t3,$t1,0x800 /* f0221c4: 5560000f */ bnezl $t3,.L0f022204 /* f0221c8: 8fbf001c */ lw $ra,0x1c($sp) -/* f0221cc: 0c006b43 */ jal func0001ad0c +/* f0221cc: 0c006b43 */ jal modelGetRootPosition /* f0221d0: 24e500c8 */ addiu $a1,$a3,0xc8 /* f0221d4: 02002025 */ or $a0,$s0,$zero /* f0221d8: 8fa50024 */ lw $a1,0x24($sp) @@ -5040,7 +5040,7 @@ glabel var7f1a87d8 /* f023714: 260500c8 */ addiu $a1,$s0,0xc8 /* f023718: 8c990020 */ lw $t9,0x20($a0) /* f02371c: a320000b */ sb $zero,0xb($t9) -/* f023720: 0c006b43 */ jal func0001ad0c +/* f023720: 0c006b43 */ jal modelGetRootPosition /* f023724: afa20204 */ sw $v0,0x204($sp) /* f023728: 0c006cef */ jal func0001b3bc /* f02372c: 8fa40208 */ lw $a0,0x208($sp) @@ -6289,7 +6289,7 @@ glabel func0f024738 /* f024a2c: 8fb90280 */ lw $t9,0x280($sp) .L0f024a30: /* f024a30: 27a50054 */ addiu $a1,$sp,0x54 -/* f024a34: 0c006b43 */ jal func0001ad0c +/* f024a34: 0c006b43 */ jal modelGetRootPosition /* f024a38: 8f240020 */ lw $a0,0x20($t9) /* f024a3c: c6120074 */ lwc1 $f18,0x74($s0) /* f024a40: c7a80054 */ lwc1 $f8,0x54($sp) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index ff34f9786..476316aeb 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -8894,7 +8894,7 @@ glabel var7f1a8dac /* f0377c4: 8fa500f0 */ lw $a1,0xf0($sp) /* f0377c8: 8e040020 */ lw $a0,0x20($s0) /* f0377cc: 24a50008 */ addiu $a1,$a1,0x8 -/* f0377d0: 0c006b4d */ jal func0001ad34 +/* f0377d0: 0c006b4d */ jal modelSetRootPosition /* f0377d4: afa5003c */ sw $a1,0x3c($sp) /* f0377d8: 8e040020 */ lw $a0,0x20($s0) /* f0377dc: 8c8f0008 */ lw $t7,0x8($a0) @@ -14713,7 +14713,7 @@ glabel var7f1a8fc8 /* f03f128: e7b20174 */ swc1 $f18,0x174($sp) /* f03f12c: 8cc40020 */ lw $a0,0x20($a2) .L0f03f130: -/* f03f130: 0c006b43 */ jal func0001ad0c +/* f03f130: 0c006b43 */ jal modelGetRootPosition /* f03f134: e7b00188 */ swc1 $f16,0x188($sp) /* f03f138: 27a90144 */ addiu $t1,$sp,0x144 /* f03f13c: afa90010 */ sw $t1,0x10($sp) @@ -25210,7 +25210,7 @@ bool chrCanSeeTargetWithExtraCheck(struct chrdata *chr) f32 somefloat = func0001af80(model) * 0.8f; func0f0a0c08(&sp68, &sp56); - func0001ad0c(model, &sp44); + modelGetRootPosition(model, &sp44); func00015b64(currentPlayerGetMatrix(), &sp44); if (func0f06b39c(&sp68, &sp56, &sp44, somefloat)) { @@ -26548,7 +26548,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3, func0f065c44(chr->prop); roomsCopy(rooms2, chr->prop->rooms); func0f0220ac(chr); - func0001ad34(chr->model, &pos2); + modelSetRootPosition(chr->model, &pos2); nodetype = chr->model->unk08->rootnode->type; diff --git a/src/game/game_00c490.c b/src/game/game_00c490.c index b0c404aa9..3b7435595 100644 --- a/src/game/game_00c490.c +++ b/src/game/game_00c490.c @@ -2106,7 +2106,7 @@ glabel var7f1a8058 /* f00dfe0: 0c0057c1 */ jal func00015f04 /* f00dfe4: 460a3303 */ div.s $f12,$f6,$f10 /* f00dfe8: 8e040018 */ lw $a0,0x18($s0) -/* f00dfec: 0c006b43 */ jal func0001ad0c +/* f00dfec: 0c006b43 */ jal modelGetRootPosition /* f00dff0: 27a500a4 */ addiu $a1,$sp,0xa4 /* f00dff4: c7b000a4 */ lwc1 $f16,0xa4($sp) /* f00dff8: c7a400a8 */ lwc1 $f4,0xa8($sp) diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 593fa15d0..cc97d89db 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -3607,7 +3607,7 @@ glabel var7f1ad5b4 /* f0b9288: 8c6500bc */ lw $a1,0xbc($v1) /* f0b928c: 8c6400d4 */ lw $a0,0xd4($v1) /* f0b9290: afa60110 */ sw $a2,0x110($sp) -/* f0b9294: 0c006b4d */ jal func0001ad34 +/* f0b9294: 0c006b4d */ jal modelSetRootPosition /* f0b9298: 24a50008 */ addiu $a1,$a1,0x8 /* f0b929c: 8e0d0284 */ lw $t5,0x284($s0) /* f0b92a0: 8fa50114 */ lw $a1,0x114($sp) @@ -3770,7 +3770,7 @@ glabel var7f1ad5b4 /* f0b94f4: 8e030284 */ lw $v1,0x284($s0) /* f0b94f8: 8c6500bc */ lw $a1,0xbc($v1) /* f0b94fc: 8c6400d4 */ lw $a0,0xd4($v1) -/* f0b9500: 0c006b4d */ jal func0001ad34 +/* f0b9500: 0c006b4d */ jal modelSetRootPosition /* f0b9504: 24a50008 */ addiu $a1,$a1,0x8 /* f0b9508: 8e180284 */ lw $t8,0x284($s0) /* f0b950c: 8fa50114 */ lw $a1,0x114($sp) @@ -14242,7 +14242,7 @@ glabel var7f1ad710 /* f0c2748: e7a60084 */ swc1 $f6,0x84($sp) /* f0c274c: c5c80010 */ lwc1 $f8,0x10($t6) /* f0c2750: e7a80088 */ swc1 $f8,0x88($sp) -/* f0c2754: 0c006b43 */ jal func0001ad0c +/* f0c2754: 0c006b43 */ jal modelGetRootPosition /* f0c2758: 8e040020 */ lw $a0,0x20($s0) /* f0c275c: 8fa20100 */ lw $v0,0x100($sp) /* f0c2760: 27a5008c */ addiu $a1,$sp,0x8c @@ -14250,7 +14250,7 @@ glabel var7f1ad710 /* f0c2768: e7aa008c */ swc1 $f10,0x8c($sp) /* f0c276c: c4500010 */ lwc1 $f16,0x10($v0) /* f0c2770: e7b00094 */ swc1 $f16,0x94($sp) -/* f0c2774: 0c006b4d */ jal func0001ad34 +/* f0c2774: 0c006b4d */ jal modelSetRootPosition /* f0c2778: 8e040020 */ lw $a0,0x20($s0) /* f0c277c: 3c017f1b */ lui $at,%hi(var7f1ad708) /* f0c2780: c422d708 */ lwc1 $f2,%lo(var7f1ad708)($at) @@ -14394,7 +14394,7 @@ glabel var7f1ad710 /* f0c2970: 8e040020 */ lw $a0,0x20($s0) /* f0c2974: 5080000c */ beqzl $a0,.L0f0c29a8 /* f0c2978: c6280078 */ lwc1 $f8,0x78($s1) -/* f0c297c: 0c006b43 */ jal func0001ad0c +/* f0c297c: 0c006b43 */ jal modelGetRootPosition /* f0c2980: 27a5005c */ addiu $a1,$sp,0x5c /* f0c2984: 8fae0100 */ lw $t6,0x100($sp) /* f0c2988: 27a5005c */ addiu $a1,$sp,0x5c @@ -14402,7 +14402,7 @@ glabel var7f1ad710 /* f0c2990: e7a4005c */ swc1 $f4,0x5c($sp) /* f0c2994: c5c60010 */ lwc1 $f6,0x10($t6) /* f0c2998: e7a60064 */ swc1 $f6,0x64($sp) -/* f0c299c: 0c006b4d */ jal func0001ad34 +/* f0c299c: 0c006b4d */ jal modelSetRootPosition /* f0c29a0: 8e040020 */ lw $a0,0x20($s0) /* f0c29a4: c6280078 */ lwc1 $f8,0x78($s1) .L0f0c29a8: diff --git a/src/game/game_113220.c b/src/game/game_113220.c index 1b3e6bcd9..752feda22 100644 --- a/src/game/game_113220.c +++ b/src/game/game_113220.c @@ -343,7 +343,7 @@ glabel var7f1b3a74 /* f113b20: c4440420 */ lwc1 $f4,0x420($v0) /* f113b24: e4440410 */ swc1 $f4,0x410($v0) /* f113b28: 8e040284 */ lw $a0,0x284($s0) -/* f113b2c: 0c006b43 */ jal func0001ad0c +/* f113b2c: 0c006b43 */ jal modelGetRootPosition /* f113b30: 2484045c */ addiu $a0,$a0,0x45c /* f113b34: 8e020284 */ lw $v0,0x284($s0) /* f113b38: c7a60034 */ lwc1 $f6,0x34($sp) @@ -355,7 +355,7 @@ glabel var7f1b3a74 /* f113b50: e7aa0034 */ swc1 $f10,0x34($sp) /* f113b54: c4520548 */ lwc1 $f18,0x548($v0) /* f113b58: 46128101 */ sub.s $f4,$f16,$f18 -/* f113b5c: 0c006b4d */ jal func0001ad34 +/* f113b5c: 0c006b4d */ jal modelSetRootPosition /* f113b60: e7a4003c */ swc1 $f4,0x3c($sp) /* f113b64: 44800000 */ mtc1 $zero,$f0 .L0f113b68: diff --git a/src/game/propobj.c b/src/game/propobj.c index 660da57cd..3dd1a1bfb 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -10510,7 +10510,7 @@ glabel func0f06ef44 /* f06efd8: 0fc181a6 */ jal propReparent /* f06efdc: 8fa5017c */ lw $a1,0x17c($sp) /* f06efe0: 8e040018 */ lw $a0,0x18($s0) -/* f06efe4: 0c006b43 */ jal func0001ad0c +/* f06efe4: 0c006b43 */ jal modelGetRootPosition /* f06efe8: 27a50028 */ addiu $a1,$sp,0x28 /* f06efec: c7a40028 */ lwc1 $f4,0x28($sp) /* f06eff0: c7a8002c */ lwc1 $f8,0x2c($sp) @@ -20156,7 +20156,7 @@ glabel var7f1aa454 /* f0778e4: 0fc0882b */ jal func0f0220ac /* f0778e8: 02002025 */ or $a0,$s0,$zero /* f0778ec: 8e040020 */ lw $a0,0x20($s0) -/* f0778f0: 0c006b4d */ jal func0001ad34 +/* f0778f0: 0c006b4d */ jal modelSetRootPosition /* f0778f4: 02402825 */ or $a1,$s2,$zero /* f0778f8: 8e040020 */ lw $a0,0x20($s0) /* f0778fc: 24010001 */ addiu $at,$zero,0x1 diff --git a/src/game/title.c b/src/game/title.c index d0efc1f3a..f8f3474a7 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -1037,7 +1037,7 @@ glabel titleInitPdLogo /* f016de8: 3c053f80 */ lui $a1,0x3f80 /* f016dec: 3c048006 */ lui $a0,%hi(g_TitleModel) /* f016df0: 8c8424f8 */ lw $a0,%lo(g_TitleModel)($a0) -/* f016df4: 0c006b4d */ jal func0001ad34 +/* f016df4: 0c006b4d */ jal modelSetRootPosition /* f016df8: 27a50058 */ addiu $a1,$sp,0x58 /* f016dfc: 3c0d8006 */ lui $t5,%hi(var80062744) /* f016e00: 25ad2744 */ addiu $t5,$t5,%lo(var80062744) @@ -1073,7 +1073,7 @@ glabel titleInitPdLogo /* f016e78: 3c053f80 */ lui $a1,0x3f80 /* f016e7c: 3c048006 */ lui $a0,%hi(g_TitleModel2) /* f016e80: 8c8424fc */ lw $a0,%lo(g_TitleModel2)($a0) -/* f016e84: 0c006b4d */ jal func0001ad34 +/* f016e84: 0c006b4d */ jal modelSetRootPosition /* f016e88: 27a5004c */ addiu $a1,$sp,0x4c /* f016e8c: 3c098006 */ lui $t1,%hi(var80062750) /* f016e90: 25292750 */ addiu $t1,$t1,%lo(var80062750) @@ -1109,7 +1109,7 @@ glabel titleInitPdLogo /* f016f08: 3c053f80 */ lui $a1,0x3f80 /* f016f0c: 3c048006 */ lui $a0,%hi(var80062508) /* f016f10: 8c842508 */ lw $a0,%lo(var80062508)($a0) -/* f016f14: 0c006b4d */ jal func0001ad34 +/* f016f14: 0c006b4d */ jal modelSetRootPosition /* f016f18: 27a50040 */ addiu $a1,$sp,0x40 /* f016f1c: 3c188006 */ lui $t8,%hi(var8006275c) /* f016f20: 2718275c */ addiu $t8,$t8,%lo(var8006275c) @@ -1145,7 +1145,7 @@ glabel titleInitPdLogo /* f016f98: 3c053f80 */ lui $a1,0x3f80 /* f016f9c: 3c048006 */ lui $a0,%hi(var8006250c) /* f016fa0: 8c84250c */ lw $a0,%lo(var8006250c)($a0) -/* f016fa4: 0c006b4d */ jal func0001ad34 +/* f016fa4: 0c006b4d */ jal modelSetRootPosition /* f016fa8: 27a50034 */ addiu $a1,$sp,0x34 /* f016fac: 8e240268 */ lw $a0,0x268($s1) /* f016fb0: 0c006a6f */ jal func0001a9bc @@ -1217,7 +1217,7 @@ glabel titleInitPdLogo // // g_TitleModel = func0f0b3280(g_Props[MODEL_NLOGO].filedata); // modelSetUnk14(g_TitleModel, 1); -// func0001ad34(g_TitleModel, &coord); +// modelSetRootPosition(g_TitleModel, &coord); // } // // { @@ -1230,7 +1230,7 @@ glabel titleInitPdLogo // // g_TitleModel2 = func0f0b3280(g_Props[MODEL_NLOGO2].filedata); // modelSetUnk14(g_TitleModel2, 1); -// func0001ad34(g_TitleModel2, &coord); +// modelSetRootPosition(g_TitleModel2, &coord); // } // // { @@ -1243,7 +1243,7 @@ glabel titleInitPdLogo // // var80062508 = func0f0b30ac(g_Props[MODEL_PDTWO].filedata); // modelSetUnk14(var80062508, 1); -// func0001ad34(var80062508, &coord); +// modelSetRootPosition(var80062508, &coord); // } // // { @@ -1256,7 +1256,7 @@ glabel titleInitPdLogo // // var8006250c = func0f0b30ac(g_Props[MODEL_PDTHREE].filedata); // modelSetUnk14(var8006250c, 1); -// func0001ad34(var8006250c, &coord); +// modelSetRootPosition(var8006250c, &coord); // } // // { @@ -3523,7 +3523,7 @@ void titleInitNintendoLogo(void) func00022d24(g_Props[MODEL_NINTENDOLOGO].filedata); g_TitleModel = func0f0b30ac(g_Props[MODEL_NINTENDOLOGO].filedata); modelSetUnk14(g_TitleModel, 1); - func0001ad34(g_TitleModel, &coord); + modelSetRootPosition(g_TitleModel, &coord); var800624f4 = 1; func00014810(false); } @@ -3902,7 +3902,7 @@ void titleInitRareLogo(void) func00022d24(g_Props[MODEL_RARELOGO].filedata); g_TitleModel = func0f0b30ac(g_Props[MODEL_RARELOGO].filedata); modelSetUnk14(g_TitleModel, 1); - func0001ad34(g_TitleModel, &coord); + modelSetRootPosition(g_TitleModel, &coord); var800624f4 = 1; diff --git a/src/include/lib/lib_1a500.h b/src/include/lib/lib_1a500.h index 5041148ca..ff1d6f627 100644 --- a/src/include/lib/lib_1a500.h +++ b/src/include/lib/lib_1a500.h @@ -18,10 +18,10 @@ struct modelnode *modelGetPart(struct model08 *arg0, s32 partnum); struct modelthing *func0001a9bc(void *modelfiledata, s32 arg1); u32 func0001a9e8(void); void *modelGetNodeData(struct model *model, struct modelnode *node); -void modelNodeGetPosition(struct model *model, struct modelnode *node, struct coord *coord); -void func0001abc4(struct model *model, struct modelnode *node, struct coord *coord); -void func0001ad0c(struct model *model, struct coord *coord); -void func0001ad34(struct model *model, struct coord *coord); +void modelNodeGetPosition(struct model *model, struct modelnode *node, struct coord *pos); +void modelNodeSetPosition(struct model *model, struct modelnode *node, struct coord *pos); +void modelGetRootPosition(struct model *model, struct coord *pos); +void modelSetRootPosition(struct model *model, struct coord *pos); u32 func0001ad5c(void); f32 func0001ae44(struct model *model); void func0001ae90(struct model *model, f32 angle); diff --git a/src/include/types.h b/src/include/types.h index 80c9c8ede..db7d757b5 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -314,19 +314,11 @@ struct modeldata_root { // type 0x01 f32 unk18; u32 unk1c; f32 unk20; // angle - f32 unk24; - f32 unk28; - f32 unk2c; + struct coord unk24; f32 unk30; // angle - f32 unk34; - f32 unk38; - f32 unk3c; - f32 unk40; - f32 unk44; - f32 unk48; - f32 unk4c; - f32 unk50; - f32 unk54; + struct coord unk34; + struct coord unk40; // "2" version of unk24 + struct coord unk4c; // "2" version of unk34 }; struct modeldata_partid { // type 0x12 diff --git a/src/lib/lib_1a500.c b/src/lib/lib_1a500.c index 7c8ce1c78..114ba4094 100644 --- a/src/lib/lib_1a500.c +++ b/src/lib/lib_1a500.c @@ -493,26 +493,26 @@ void modelNodeGetPosition(struct model *model, struct modelnode *node, struct co switch (node->type & 0xff) { case MODELNODETYPE_ROOT: { - struct modeldata_root *data = modelGetNodeData(model, node); - pos->x = data->pos.x; - pos->y = data->pos.y; - pos->z = data->pos.z; + struct modeldata_root *data = modelGetNodeData(model, node); + pos->x = data->pos.x; + pos->y = data->pos.y; + pos->z = data->pos.z; } break; case MODELNODETYPE_POSITION: { - struct modelnode_position *data = node->data.position; - pos->x = data->pos.x; - pos->y = data->pos.y; - pos->z = data->pos.z; + struct modelnode_position *data = node->data.position; + pos->x = data->pos.x; + pos->y = data->pos.y; + pos->z = data->pos.z; } break; case MODELNODETYPE_POSITIONHELD: { - struct modelnode_positionheld *data = node->data.positionheld; - pos->x = data->pos.x; - pos->y = data->pos.y; - pos->z = data->pos.z; + struct modelnode_positionheld *data = node->data.positionheld; + pos->x = data->pos.x; + pos->y = data->pos.y; + pos->z = data->pos.z; } break; default: @@ -523,105 +523,54 @@ void modelNodeGetPosition(struct model *model, struct modelnode *node, struct co } } -GLOBAL_ASM( -glabel func0001abc4 -/* 1abc4: 27bdffd8 */ addiu $sp,$sp,-40 -/* 1abc8: afbf0014 */ sw $ra,0x14($sp) -/* 1abcc: 94a20000 */ lhu $v0,0x0($a1) -/* 1abd0: 24010001 */ addiu $at,$zero,0x1 -/* 1abd4: 304e00ff */ andi $t6,$v0,0xff -/* 1abd8: 11c10007 */ beq $t6,$at,.L0001abf8 -/* 1abdc: 24010002 */ addiu $at,$zero,0x2 -/* 1abe0: 11c10037 */ beq $t6,$at,.L0001acc0 -/* 1abe4: 24010015 */ addiu $at,$zero,0x15 -/* 1abe8: 51c1003e */ beql $t6,$at,.L0001ace4 -/* 1abec: 8ca20004 */ lw $v0,0x4($a1) -/* 1abf0: 10000043 */ b .L0001ad00 -/* 1abf4: 8fbf0014 */ lw $ra,0x14($sp) -.L0001abf8: -/* 1abf8: 0c006a87 */ jal modelGetNodeData -/* 1abfc: afa60030 */ sw $a2,0x30($sp) -/* 1ac00: 8fa60030 */ lw $a2,0x30($sp) -/* 1ac04: c4460008 */ lwc1 $f6,0x8($v0) -/* 1ac08: c4c40000 */ lwc1 $f4,0x0($a2) -/* 1ac0c: 46062201 */ sub.s $f8,$f4,$f6 -/* 1ac10: e7a80018 */ swc1 $f8,0x18($sp) -/* 1ac14: c4500010 */ lwc1 $f16,0x10($v0) -/* 1ac18: c4ca0008 */ lwc1 $f10,0x8($a2) -/* 1ac1c: 46105481 */ sub.s $f18,$f10,$f16 -/* 1ac20: e7b20020 */ swc1 $f18,0x20($sp) -/* 1ac24: c4c40000 */ lwc1 $f4,0x0($a2) -/* 1ac28: c44a0024 */ lwc1 $f10,0x24($v0) -/* 1ac2c: e4440008 */ swc1 $f4,0x8($v0) -/* 1ac30: c4c60004 */ lwc1 $f6,0x4($a2) -/* 1ac34: c444002c */ lwc1 $f4,0x2c($v0) -/* 1ac38: e446000c */ swc1 $f6,0xc($v0) -/* 1ac3c: c4c80008 */ lwc1 $f8,0x8($a2) -/* 1ac40: e4480010 */ swc1 $f8,0x10($v0) -/* 1ac44: c7b00018 */ lwc1 $f16,0x18($sp) -/* 1ac48: 46105480 */ add.s $f18,$f10,$f16 -/* 1ac4c: c44a0034 */ lwc1 $f10,0x34($v0) -/* 1ac50: e4520024 */ swc1 $f18,0x24($v0) -/* 1ac54: c7a60020 */ lwc1 $f6,0x20($sp) -/* 1ac58: 46062200 */ add.s $f8,$f4,$f6 -/* 1ac5c: c444003c */ lwc1 $f4,0x3c($v0) -/* 1ac60: e448002c */ swc1 $f8,0x2c($v0) -/* 1ac64: c7b00018 */ lwc1 $f16,0x18($sp) -/* 1ac68: 46105480 */ add.s $f18,$f10,$f16 -/* 1ac6c: c44a0040 */ lwc1 $f10,0x40($v0) -/* 1ac70: e4520034 */ swc1 $f18,0x34($v0) -/* 1ac74: c7a60020 */ lwc1 $f6,0x20($sp) -/* 1ac78: 46062200 */ add.s $f8,$f4,$f6 -/* 1ac7c: c4440048 */ lwc1 $f4,0x48($v0) -/* 1ac80: e448003c */ swc1 $f8,0x3c($v0) -/* 1ac84: c7b00018 */ lwc1 $f16,0x18($sp) -/* 1ac88: 46105480 */ add.s $f18,$f10,$f16 -/* 1ac8c: c44a004c */ lwc1 $f10,0x4c($v0) -/* 1ac90: e4520040 */ swc1 $f18,0x40($v0) -/* 1ac94: c7a60020 */ lwc1 $f6,0x20($sp) -/* 1ac98: 46062200 */ add.s $f8,$f4,$f6 -/* 1ac9c: c4440054 */ lwc1 $f4,0x54($v0) -/* 1aca0: e4480048 */ swc1 $f8,0x48($v0) -/* 1aca4: c7b00018 */ lwc1 $f16,0x18($sp) -/* 1aca8: 46105480 */ add.s $f18,$f10,$f16 -/* 1acac: e452004c */ swc1 $f18,0x4c($v0) -/* 1acb0: c7a60020 */ lwc1 $f6,0x20($sp) -/* 1acb4: 46062200 */ add.s $f8,$f4,$f6 -/* 1acb8: 10000010 */ b .L0001acfc -/* 1acbc: e4480054 */ swc1 $f8,0x54($v0) -.L0001acc0: -/* 1acc0: 8ca20004 */ lw $v0,0x4($a1) -/* 1acc4: c4ca0000 */ lwc1 $f10,0x0($a2) -/* 1acc8: e44a0000 */ swc1 $f10,0x0($v0) -/* 1accc: c4d00004 */ lwc1 $f16,0x4($a2) -/* 1acd0: e4500004 */ swc1 $f16,0x4($v0) -/* 1acd4: c4d20008 */ lwc1 $f18,0x8($a2) -/* 1acd8: 10000008 */ b .L0001acfc -/* 1acdc: e4520008 */ swc1 $f18,0x8($v0) -/* 1ace0: 8ca20004 */ lw $v0,0x4($a1) -.L0001ace4: -/* 1ace4: c4c40000 */ lwc1 $f4,0x0($a2) -/* 1ace8: e4440000 */ swc1 $f4,0x0($v0) -/* 1acec: c4c60004 */ lwc1 $f6,0x4($a2) -/* 1acf0: e4460004 */ swc1 $f6,0x4($v0) -/* 1acf4: c4c80008 */ lwc1 $f8,0x8($a2) -/* 1acf8: e4480008 */ swc1 $f8,0x8($v0) -.L0001acfc: -/* 1acfc: 8fbf0014 */ lw $ra,0x14($sp) -.L0001ad00: -/* 1ad00: 27bd0028 */ addiu $sp,$sp,0x28 -/* 1ad04: 03e00008 */ jr $ra -/* 1ad08: 00000000 */ nop -); - -void func0001ad0c(struct model *model, struct coord *coord) +void modelNodeSetPosition(struct model *model, struct modelnode *node, struct coord *pos) { - modelNodeGetPosition(model, model->unk08->rootnode, coord); + switch (node->type & 0xff) { + case MODELNODETYPE_ROOT: + { + struct modeldata_root *data = modelGetNodeData(model, node); + struct coord diff[1]; + + diff[0].x = pos->x - data->pos.x; + diff[0].z = pos->z - data->pos.z; + + data->pos.x = pos->x; + data->pos.y = pos->y; + data->pos.z = pos->z; + + data->unk24.x += diff[0].x; data->unk24.z += diff[0].z; + data->unk34.x += diff[0].x; data->unk34.z += diff[0].z; + data->unk40.x += diff[0].x; data->unk40.z += diff[0].z; + data->unk4c.x += diff[0].x; data->unk4c.z += diff[0].z; + } + break; + case MODELNODETYPE_POSITION: + { + struct modelnode_position *data = node->data.position; + data->pos.x = pos->x; + data->pos.y = pos->y; + data->pos.z = pos->z; + } + break; + case MODELNODETYPE_POSITIONHELD: + { + struct modelnode_positionheld *data = node->data.positionheld; + data->pos.x = pos->x; + data->pos.y = pos->y; + data->pos.z = pos->z; + } + break; + } } -void func0001ad34(struct model *model, struct coord *coord) +void modelGetRootPosition(struct model *model, struct coord *pos) { - func0001abc4(model, model->unk08->rootnode, coord); + modelNodeGetPosition(model, model->unk08->rootnode, pos); +} + +void modelSetRootPosition(struct model *model, struct coord *pos) +{ + modelNodeSetPosition(model, model->unk08->rootnode, pos); } GLOBAL_ASM( @@ -3571,12 +3520,12 @@ void modelCopyAnimForMerge(struct model *model, f32 arg1) if (nodetype == MODELNODETYPE_ROOT) { struct modeldata_root *data = modelGetNodeData(model, node); data->unk02 = 1; - data->unk4c = data->unk34; - data->unk50 = data->unk38; - data->unk54 = data->unk3c; - data->unk40 = data->unk24; - data->unk44 = data->unk28; - data->unk48 = data->unk2c; + data->unk4c.x = data->unk34.x; + data->unk4c.y = data->unk34.y; + data->unk4c.z = data->unk34.z; + data->unk40.x = data->unk24.x; + data->unk40.y = data->unk24.y; + data->unk40.z = data->unk24.z; } } else { anim->animnum2 = 0;