Decompile modelAttachHead

This commit is contained in:
Ryan Dwyer 2021-04-27 23:55:23 +10:00
parent bb6d84135d
commit d908de6b5a
6 changed files with 45 additions and 46 deletions

View File

@ -12636,7 +12636,7 @@ glabel func0f0260c4
/* f02641c: 10000005 */ b .L0f026434
/* f026420: 8ca20014 */ lw $v0,0x14($a1)
.L0f026424:
/* f026424: 0c007207 */ jal func0001c81c
/* f026424: 0c007207 */ jal modelAttachHead
/* f026428: afa50110 */ sw $a1,0x110($sp)
/* f02642c: 8fa50110 */ lw $a1,0x110($sp)
/* f026430: 8ca20014 */ lw $v0,0x14($a1)
@ -12924,7 +12924,7 @@ glabel func0f0260c4
/* f026828: 10000006 */ b .L0f026844
/* f02682c: 8ca20014 */ lw $v0,0x14($a1)
.L0f026830:
/* f026830: 0c007207 */ jal func0001c81c
/* f026830: 0c007207 */ jal modelAttachHead
/* f026834: afa50110 */ sw $a1,0x110($sp)
/* f026838: 8fa50110 */ lw $a1,0x110($sp)
/* f02683c: 8fa40128 */ lw $a0,0x128($sp)
@ -13234,7 +13234,7 @@ glabel var7f1a8944
/* f026c0c: 10000005 */ b .L0f026c24
/* f026c10: 8ca20014 */ lw $v0,0x14($a1)
.L0f026c14:
/* f026c14: 0c007207 */ jal func0001c81c
/* f026c14: 0c007207 */ jal modelAttachHead
/* f026c18: afa500fc */ sw $a1,0xfc($sp)
/* f026c1c: 8fa500fc */ lw $a1,0xfc($sp)
/* f026c20: 8ca20014 */ lw $v0,0x14($a1)
@ -13539,7 +13539,7 @@ glabel var7f1a8944
/* f02705c: 10000006 */ b .L0f027078
/* f027060: 8fa500fc */ lw $a1,0xfc($sp)
/* f027064: 00e02025 */ or $a0,$a3,$zero
/* f027068: 0c007207 */ jal func0001c81c
/* f027068: 0c007207 */ jal modelAttachHead
/* f02706c: afa500fc */ sw $a1,0xfc($sp)
/* f027070: 8fa70120 */ lw $a3,0x120($sp)
/* f027074: 8fa500fc */ lw $a1,0xfc($sp)
@ -14090,7 +14090,7 @@ glabel func0f0270f4
/* f027818: 10000006 */ b .L0f027834
/* f02781c: 8ca20014 */ lw $v0,0x14($a1)
.L0f027820:
/* f027820: 0c007207 */ jal func0001c81c
/* f027820: 0c007207 */ jal modelAttachHead
/* f027824: afa500a4 */ sw $a1,0xa4($sp)
/* f027828: 8fa500a4 */ lw $a1,0xa4($sp)
/* f02782c: 8fa40094 */ lw $a0,0x94($sp)

View File

@ -73,7 +73,7 @@ void func0f129210(void *find, void *replacement)
func0001c7d0(obj->model, node);
break;
case MODELNODETYPE_HEADSPOT:
func0001c81c(obj->model, node);
modelAttachHead(obj->model, node);
break;
}

View File

@ -2841,7 +2841,7 @@ glabel func0f0687e4
/* f068878: 10000004 */ b .L0f06888c
/* f06887c: 8e020014 */ lw $v0,0x14($s0)
.L0f068880:
/* f068880: 0c007207 */ jal func0001c81c
/* f068880: 0c007207 */ jal modelAttachHead
/* f068884: 02002825 */ or $a1,$s0,$zero
/* f068888: 8e020014 */ lw $v0,0x14($s0)
.L0f06888c:
@ -2983,7 +2983,7 @@ glabel func0f068998
/* f068a2c: 10000004 */ b .L0f068a40
/* f068a30: 8e020014 */ lw $v0,0x14($s0)
.L0f068a34:
/* f068a34: 0c007207 */ jal func0001c81c
/* f068a34: 0c007207 */ jal modelAttachHead
/* f068a38: 02002825 */ or $a1,$s0,$zero
/* f068a3c: 8e020014 */ lw $v0,0x14($s0)
.L0f068a40:
@ -8286,7 +8286,7 @@ glabel var7f1aa264
/* f06c148: 10000004 */ b .L0f06c15c
/* f06c14c: 00000000 */ nop
/* f06c150: 02602025 */ or $a0,$s3,$zero
/* f06c154: 0c007207 */ jal func0001c81c
/* f06c154: 0c007207 */ jal modelAttachHead
/* f06c158: 02002825 */ or $a1,$s0,$zero
.L0f06c15c:
/* f06c15c: 12800018 */ beqz $s4,.L0f06c1c0
@ -53304,7 +53304,7 @@ glabel var7f1aa838
/* f082610: 10000005 */ b .L0f082628
/* f082614: 8fa600d0 */ lw $a2,0xd0($sp)
.L0f082618:
/* f082618: 0c007207 */ jal func0001c81c
/* f082618: 0c007207 */ jal modelAttachHead
/* f08261c: 8cc40018 */ lw $a0,0x18($a2)
/* f082620: 8fc20014 */ lw $v0,0x14($s8)
/* f082624: 8fa600d0 */ lw $a2,0xd0($sp)
@ -54018,7 +54018,7 @@ glabel var7f1aa838
/* f081084: 10000005 */ beqz $zero,.NB0f08109c
/* f081088: 8fa600d8 */ lw $a2,0xd8($sp)
.NB0f08108c:
/* f08108c: 0c007627 */ jal func0001c81c
/* f08108c: 0c007627 */ jal modelAttachHead
/* f081090: 8cc40018 */ lw $a0,0x18($a2)
/* f081094: 8ec20014 */ lw $v0,0x14($s6)
/* f081098: 8fa600d8 */ lw $a2,0xd8($sp)
@ -59045,7 +59045,7 @@ glabel var7f1aaa00
/* f084b24: 10000004 */ b .L0f084b38
/* f084b28: 00000000 */ nop
/* f084b2c: 02c02025 */ or $a0,$s6,$zero
/* f084b30: 0c007207 */ jal func0001c81c
/* f084b30: 0c007207 */ jal modelAttachHead
/* f084b34: 02002825 */ or $a1,$s0,$zero
.L0f084b38:
/* f084b38: 12600043 */ beqz $s3,.L0f084c48
@ -66645,7 +66645,7 @@ glabel func0f089a94
/* f089bec: 10000004 */ b .L0f089c00
/* f089bf0: 8e020014 */ lw $v0,0x14($s0)
.L0f089bf4:
/* f089bf4: 0c007207 */ jal func0001c81c
/* f089bf4: 0c007207 */ jal modelAttachHead
/* f089bf8: 02002825 */ or $a1,$s0,$zero
/* f089bfc: 8e020014 */ lw $v0,0x14($s0)
.L0f089c00:

View File

@ -42,7 +42,7 @@ u32 func0001c5b4(void);
u32 func0001c664(void);
void func0001c784(struct model *model, struct modelnode *node);
void func0001c7d0(struct model *model, struct modelnode *node);
void func0001c81c(struct model *model, struct modelnode *node);
void modelAttachHead(struct model *model, struct modelnode *node);
u32 func0001c868(void);
u32 func0001c924(void);
u32 func0001c950(void);

View File

@ -685,6 +685,10 @@ struct modeldata_root { // type 0x01
u32 unk5c;
};
struct modeldata_nearfar { // type 0x08
bool visible;
};
struct modeldata_partid { // type 0x12
union {
u16 u16;

View File

@ -3266,9 +3266,9 @@ glabel func0001c664
void func0001c784(struct model *model, struct modelnode *node)
{
struct modelnode_nearfar *data1 = &node->data->nearfar;
u32 *data2 = modelGetNodeData(model, node);
struct modeldata_nearfar *data2 = modelGetNodeData(model, node);
if (*data2) {
if (data2->visible) {
node->child = data1->target;
} else {
node->child = NULL;
@ -3278,40 +3278,35 @@ void func0001c784(struct model *model, struct modelnode *node)
void func0001c7d0(struct model *model, struct modelnode *node)
{
struct modelnode_partid *data1 = &node->data->partid;
struct modelnode_partid *data2 = modelGetNodeData(model, node);
struct modeldata_partid *data2 = modelGetNodeData(model, node);
if (data2->target) {
if (data2->visible.u32) {
node->child = data1->target;
} else {
node->child = NULL;
}
}
GLOBAL_ASM(
glabel func0001c81c
/* 1c81c: 27bdffe8 */ addiu $sp,$sp,-24
/* 1c820: afbf0014 */ sw $ra,0x14($sp)
/* 1c824: 0c006a87 */ jal modelGetNodeData
/* 1c828: afa5001c */ sw $a1,0x1c($sp)
/* 1c82c: 8c440000 */ lw $a0,0x0($v0)
/* 1c830: 8fa5001c */ lw $a1,0x1c($sp)
/* 1c834: 50800009 */ beqzl $a0,.L0001c85c
/* 1c838: 8fbf0014 */ lw $ra,0x14($sp)
/* 1c83c: 8c830000 */ lw $v1,0x0($a0)
/* 1c840: 10600005 */ beqz $v1,.L0001c858
/* 1c844: aca30014 */ sw $v1,0x14($a1)
/* 1c848: ac650008 */ sw $a1,0x8($v1)
.L0001c84c:
/* 1c84c: 8c63000c */ lw $v1,0xc($v1)
/* 1c850: 5460fffe */ bnezl $v1,.L0001c84c
/* 1c854: ac650008 */ sw $a1,0x8($v1)
.L0001c858:
/* 1c858: 8fbf0014 */ lw $ra,0x14($sp)
.L0001c85c:
/* 1c85c: 27bd0018 */ addiu $sp,$sp,0x18
/* 1c860: 03e00008 */ jr $ra
/* 1c864: 00000000 */ nop
);
/**
* Attach a head model to its placeholder on the body model.
*
* The given modelnode is assumed to be of type MODELNODETYPE_HEADSPOT.
*/
void modelAttachHead(struct model *model, struct modelnode *bodynode)
{
struct modeldata_headspot *data = modelGetNodeData(model, bodynode);
if (data->modelfiledata) {
struct modelnode *headnode = data->modelfiledata->rootnode;
bodynode->child = headnode;
while (headnode) {
headnode->parent = bodynode;
headnode = headnode->next;
}
}
}
GLOBAL_ASM(
glabel func0001c868
@ -3626,7 +3621,7 @@ glabel var700543b8
/* 1cb90: 10000004 */ b .L0001cba4
/* 1cb94: 00000000 */ nop
/* 1cb98: 02402025 */ or $a0,$s2,$zero
/* 1cb9c: 0c007207 */ jal func0001c81c
/* 1cb9c: 0c007207 */ jal modelAttachHead
/* 1cba0: 02002825 */ or $a1,$s0,$zero
.L0001cba4:
/* 1cba4: 12200006 */ beqz $s1,.L0001cbc0
@ -3729,7 +3724,7 @@ glabel var700543e0
/* 1cca4: 10000007 */ b .L0001ccc4
/* 1cca8: 8e020014 */ lw $v0,0x14($s0)
/* 1ccac: 02202025 */ or $a0,$s1,$zero
/* 1ccb0: 0c007207 */ jal func0001c81c
/* 1ccb0: 0c007207 */ jal modelAttachHead
/* 1ccb4: 02002825 */ or $a1,$s0,$zero
/* 1ccb8: 10000002 */ b .L0001ccc4
/* 1ccbc: 8e020014 */ lw $v0,0x14($s0)
@ -3873,7 +3868,7 @@ glabel var70054440
/* 1cdec: 10000007 */ b .L0001ce0c
/* 1cdf0: 8e020014 */ lw $v0,0x14($s0)
/* 1cdf4: 02202025 */ or $a0,$s1,$zero
/* 1cdf8: 0c007207 */ jal func0001c81c
/* 1cdf8: 0c007207 */ jal modelAttachHead
/* 1cdfc: 02002825 */ or $a1,$s0,$zero
/* 1ce00: 10000002 */ b .L0001ce0c
/* 1ce04: 8e020014 */ lw $v0,0x14($s0)