From fa9faedee197a2253735ee7b20cde5bf95129852 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 28 Apr 2021 18:49:14 +1000 Subject: [PATCH] Decompile modelInit --- src/game/chr/chraicommands.c | 2 +- src/game/data/data_020df0.c | 17 +++-- src/game/game_0125a0.c | 4 +- src/game/game_097ba0.c | 12 ++-- src/game/game_0abe70.c | 2 +- src/game/game_0b28d0.c | 4 +- src/game/game_0b69d0.c | 8 +-- src/game/game_0f09f0.c | 24 +++---- src/include/data.h | 2 +- src/include/lib/model.h | 6 +- src/include/types.h | 32 +-------- src/lib/model.c | 126 ++++++++++++++--------------------- 12 files changed, 94 insertions(+), 145 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index b28ada178..702e56308 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -5412,7 +5412,7 @@ bool aiObjectDoAnimation(void) #endif } - animInitialise(obj->model->anim); + animInit(obj->model->anim); #if VERSION >= VERSION_PAL_FINAL modelSetAnimPlaySpeed(obj->model, 1.2, 0); #endif diff --git a/src/game/data/data_020df0.c b/src/game/data/data_020df0.c index fb185c800..78f340a35 100644 --- a/src/game/data/data_020df0.c +++ b/src/game/data/data_020df0.c @@ -1472,12 +1472,17 @@ u32 var8007c148; u32 var8007c0b8 = 0x00000000; u32 var8007c0bc = 0x00000000; -u32 var8007c0c0 = (u32) &var8007c0dc; -u32 var8007c0c4 = (u32) &g_ModelType0B; -u32 var8007c0c8 = 0x00000000; -u32 var8007c0cc = 0x00000003; -u32 var8007c0d0 = 0x4224a519; -u32 var8007c0d4 = 0x00000000; + +struct modelfiledata g_PlayerModelFileData = { + (struct modelnode *) &var8007c0dc, + &g_ModelType0B, + NULL, + 0, + 3, + 41.161228179932, + 0, +}; + u32 var8007c0d8 = 0x00000000; u32 var8007c0dc = 0x00010000; diff --git a/src/game/game_0125a0.c b/src/game/game_0125a0.c index afa71c7d8..496fb2eb4 100644 --- a/src/game/game_0125a0.c +++ b/src/game/game_0125a0.c @@ -79,8 +79,8 @@ void currentPlayerInitAnimation(void) { s32 i; - func00022fa4(&g_Vars.currentplayer->model, &var8007c0c0, &g_Vars.currentplayer->unk0494, 0); - animInitialise(g_Vars.currentplayer->model.anim); + modelInit(&g_Vars.currentplayer->model, &g_PlayerModelFileData, g_Vars.currentplayer->bondheadsave, false); + animInit(g_Vars.currentplayer->model.anim); modelSetScale(&g_Vars.currentplayer->model, 0.1000000089407f); modelSetAnimPlaySpeed(&g_Vars.currentplayer->model, (PAL ? 1.2f : 1), 0); diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index f0038c508..e30509a8d 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -8697,7 +8697,7 @@ void func0f09ceac(void) hand->animload = -1; hand->animmode = HANDANIMMODE_IDLE; - animInitialise(&hand->anim); + animInit(&hand->anim); hand->unk09bc.anim = &hand->anim; hand->unk0b8c = &hand->anim; @@ -10718,14 +10718,14 @@ glabel func0f09e4e0 /* f09e918: 02802025 */ or $a0,$s4,$zero /* f09e91c: 8e451590 */ lw $a1,0x1590($s2) /* f09e920: 02a03025 */ or $a2,$s5,$zero -/* f09e924: 0c008be9 */ jal func00022fa4 +/* f09e924: 0c008be9 */ jal modelInit /* f09e928: 00003825 */ or $a3,$zero,$zero /* f09e92c: 8e451594 */ lw $a1,0x1594($s2) /* f09e930: 26040534 */ addiu $a0,$s0,0x534 /* f09e934: 260604b4 */ addiu $a2,$s0,0x4b4 /* f09e938: 50a00004 */ beqzl $a1,.L0f09e94c /* f09e93c: 8e4b15a8 */ lw $t3,0x15a8($s2) -/* f09e940: 0c008be9 */ jal func00022fa4 +/* f09e940: 0c008be9 */ jal modelInit /* f09e944: 00003825 */ or $a3,$zero,$zero /* f09e948: 8e4b15a8 */ lw $t3,0x15a8($s2) .L0f09e94c: @@ -11125,14 +11125,14 @@ glabel func0f09e4e0 /* f09c7c4: 02802025 */ or $a0,$s4,$zero /* f09c7c8: 8e451590 */ lw $a1,0x1590($s2) /* f09c7cc: 02a03025 */ or $a2,$s5,$zero -/* f09c7d0: 0c00900f */ jal func00022fa4 +/* f09c7d0: 0c00900f */ jal modelInit /* f09c7d4: 00003825 */ or $a3,$zero,$zero /* f09c7d8: 8e451594 */ lw $a1,0x1594($s2) /* f09c7dc: 26040534 */ addiu $a0,$s0,0x534 /* f09c7e0: 260604b4 */ addiu $a2,$s0,0x4b4 /* f09c7e4: 50a00004 */ beqzl $a1,.NB0f09c7f8 /* f09c7e8: 8e4c15a8 */ lw $t4,0x15a8($s2) -/* f09c7ec: 0c00900f */ jal func00022fa4 +/* f09c7ec: 0c00900f */ jal modelInit /* f09c7f0: 00003825 */ or $a3,$zero,$zero /* f09c7f4: 8e4c15a8 */ lw $t4,0x15a8($s2) .NB0f09c7f8: @@ -15942,7 +15942,7 @@ void func0f0a1528(void) func0f0abd30(i); - animInitialise(&player->hands[i].anim); + animInit(&player->hands[i].anim); if (player->hands[i].audiohandle && audioIsPlaying(player->hands[i].audiohandle)) { audioStop(player->hands[i].audiohandle); diff --git a/src/game/game_0abe70.c b/src/game/game_0abe70.c index 819728a75..de257d1a7 100644 --- a/src/game/game_0abe70.c +++ b/src/game/game_0abe70.c @@ -3947,7 +3947,7 @@ glabel var7f1acd6c /* f0ae9ec: 27a400c8 */ addiu $a0,$sp,0xc8 /* f0ae9f0: 8fa500f0 */ lw $a1,0xf0($sp) /* f0ae9f4: 00003025 */ or $a2,$zero,$zero -/* f0ae9f8: 0c008be9 */ jal func00022fa4 +/* f0ae9f8: 0c008be9 */ jal modelInit /* f0ae9fc: 24070001 */ addiu $a3,$zero,0x1 /* f0aea00: 8fad00ec */ lw $t5,0xec($sp) /* f0aea04: 3c013980 */ lui $at,0x3980 diff --git a/src/game/game_0b28d0.c b/src/game/game_0b28d0.c index e20fa0cab..490f06ada 100644 --- a/src/game/game_0b28d0.c +++ b/src/game/game_0b28d0.c @@ -577,7 +577,7 @@ glabel func0f0b2b64 /* f0b303c: 8faf003c */ lw $t7,0x3c($sp) /* f0b3040: 10400005 */ beqz $v0,.L0f0b3058 /* f0b3044: ade20020 */ sw $v0,0x20($t7) -/* f0b3048: 0c008c28 */ jal animInitialise +/* f0b3048: 0c008c28 */ jal animInit /* f0b304c: 00402025 */ or $a0,$v0,$zero /* f0b3050: 10000008 */ b .L0f0b3074 /* f0b3054: 8fb9003c */ lw $t9,0x3c($sp) @@ -595,7 +595,7 @@ glabel func0f0b2b64 /* f0b3078: 03202025 */ or $a0,$t9,$zero /* f0b307c: 8fa50040 */ lw $a1,0x40($sp) /* f0b3080: 8fa60038 */ lw $a2,0x38($sp) -/* f0b3084: 0c008be9 */ jal func00022fa4 +/* f0b3084: 0c008be9 */ jal modelInit /* f0b3088: 00003825 */ or $a3,$zero,$zero /* f0b308c: 87ab0036 */ lh $t3,0x36($sp) /* f0b3090: 8fac003c */ lw $t4,0x3c($sp) diff --git a/src/game/game_0b69d0.c b/src/game/game_0b69d0.c index fba86368d..fcd009e46 100644 --- a/src/game/game_0b69d0.c +++ b/src/game/game_0b69d0.c @@ -2006,10 +2006,10 @@ glabel var7f1ad5b4 .L0f0b8ffc: /* f0b8ffc: 8fa500fc */ lw $a1,0xfc($sp) /* f0b9000: 8fa60058 */ lw $a2,0x58($sp) -/* f0b9004: 0c008be9 */ jal func00022fa4 +/* f0b9004: 0c008be9 */ jal modelInit /* f0b9008: 00003825 */ or $a3,$zero,$zero /* f0b900c: 8fa8005c */ lw $t0,0x5c($sp) -/* f0b9010: 0c008c28 */ jal animInitialise +/* f0b9010: 0c008c28 */ jal animInit /* f0b9014: 8d040020 */ lw $a0,0x20($t0) /* f0b9018: 8fb9005c */ lw $t9,0x5c($sp) /* f0b901c: 24180100 */ addiu $t8,$zero,0x100 @@ -2664,10 +2664,10 @@ glabel var7f1ad5b4 .NB0f0b6d14: /* f0b6d14: 8fa500fc */ lw $a1,0xfc($sp) /* f0b6d18: 8fa60058 */ lw $a2,0x58($sp) -/* f0b6d1c: 0c00900f */ jal func00022fa4 +/* f0b6d1c: 0c00900f */ jal modelInit /* f0b6d20: 00003825 */ or $a3,$zero,$zero /* f0b6d24: 8fa8005c */ lw $t0,0x5c($sp) -/* f0b6d28: 0c00904e */ jal animInitialise +/* f0b6d28: 0c00904e */ jal animInit /* f0b6d2c: 8d040020 */ lw $a0,0x20($t0) /* f0b6d30: 8fb9005c */ lw $t9,0x5c($sp) /* f0b6d34: 24180100 */ addiu $t8,$zero,0x100 diff --git a/src/game/game_0f09f0.c b/src/game/game_0f09f0.c index 1f5390068..a22f39472 100644 --- a/src/game/game_0f09f0.c +++ b/src/game/game_0f09f0.c @@ -5415,10 +5415,10 @@ glabel var7f1b3c40pf /* f0f4318: 8e050054 */ lw $a1,0x54($s0) /* f0f431c: afa4003c */ sw $a0,0x3c($sp) /* f0f4320: 26060110 */ addiu $a2,$s0,0x110 -/* f0f4324: 0c008a2a */ jal func00022fa4 +/* f0f4324: 0c008a2a */ jal modelInit /* f0f4328: 24070001 */ li $a3,0x1 /* f0f432c: 26110084 */ addiu $s1,$s0,0x84 -/* f0f4330: 0c008a69 */ jal animInitialise +/* f0f4330: 0c008a69 */ jal animInit /* f0f4334: 02202025 */ move $a0,$s1 /* f0f4338: 240c0100 */ li $t4,0x100 /* f0f433c: a60c0062 */ sh $t4,0x62($s0) @@ -5466,10 +5466,10 @@ glabel var7f1b3c40pf /* f0f43e0: 26040060 */ addiu $a0,$s0,0x60 /* f0f43e4: 8e050054 */ lw $a1,0x54($s0) /* f0f43e8: 26060110 */ addiu $a2,$s0,0x110 -/* f0f43ec: 0c008a2a */ jal func00022fa4 +/* f0f43ec: 0c008a2a */ jal modelInit /* f0f43f0: 24070001 */ li $a3,0x1 /* f0f43f4: 26110084 */ addiu $s1,$s0,0x84 -/* f0f43f8: 0c008a69 */ jal animInitialise +/* f0f43f8: 0c008a69 */ jal animInit /* f0f43fc: 02202025 */ move $a0,$s1 /* f0f4400: 240a0100 */ li $t2,0x100 /* f0f4404: a60a0062 */ sh $t2,0x62($s0) @@ -7017,10 +7017,10 @@ glabel var7f1b2948 /* f0f3bc4: 8e050054 */ lw $a1,0x54($s0) /* f0f3bc8: afa4003c */ sw $a0,0x3c($sp) /* f0f3bcc: 26060110 */ addiu $a2,$s0,0x110 -/* f0f3bd0: 0c008be9 */ jal func00022fa4 +/* f0f3bd0: 0c008be9 */ jal modelInit /* f0f3bd4: 24070001 */ addiu $a3,$zero,0x1 /* f0f3bd8: 26110084 */ addiu $s1,$s0,0x84 -/* f0f3bdc: 0c008c28 */ jal animInitialise +/* f0f3bdc: 0c008c28 */ jal animInit /* f0f3be0: 02202025 */ or $a0,$s1,$zero /* f0f3be4: 24190100 */ addiu $t9,$zero,0x100 /* f0f3be8: a6190062 */ sh $t9,0x62($s0) @@ -7068,10 +7068,10 @@ glabel var7f1b2948 /* f0f3c8c: 26040060 */ addiu $a0,$s0,0x60 /* f0f3c90: 8e050054 */ lw $a1,0x54($s0) /* f0f3c94: 26060110 */ addiu $a2,$s0,0x110 -/* f0f3c98: 0c008be9 */ jal func00022fa4 +/* f0f3c98: 0c008be9 */ jal modelInit /* f0f3c9c: 24070001 */ addiu $a3,$zero,0x1 /* f0f3ca0: 26110084 */ addiu $s1,$s0,0x84 -/* f0f3ca4: 0c008c28 */ jal animInitialise +/* f0f3ca4: 0c008c28 */ jal animInit /* f0f3ca8: 02202025 */ or $a0,$s1,$zero /* f0f3cac: 24180100 */ addiu $t8,$zero,0x100 /* f0f3cb0: a6180062 */ sh $t8,0x62($s0) @@ -8626,10 +8626,10 @@ glabel var7f1b2948 /* f0f0708: 8e250054 */ lw $a1,0x54($s1) /* f0f070c: afa40040 */ sw $a0,0x40($sp) /* f0f0710: 26260110 */ addiu $a2,$s1,0x110 -/* f0f0714: 0c00900f */ jal func00022fa4 +/* f0f0714: 0c00900f */ jal modelInit /* f0f0718: 24070001 */ addiu $a3,$zero,0x1 /* f0f071c: 26300084 */ addiu $s0,$s1,0x84 -/* f0f0720: 0c00904e */ jal animInitialise +/* f0f0720: 0c00904e */ jal animInit /* f0f0724: 02002025 */ or $a0,$s0,$zero /* f0f0728: 24190100 */ addiu $t9,$zero,0x100 /* f0f072c: a6390062 */ sh $t9,0x62($s1) @@ -8677,10 +8677,10 @@ glabel var7f1b2948 /* f0f07d0: 26240060 */ addiu $a0,$s1,0x60 /* f0f07d4: 8e250054 */ lw $a1,0x54($s1) /* f0f07d8: 26260110 */ addiu $a2,$s1,0x110 -/* f0f07dc: 0c00900f */ jal func00022fa4 +/* f0f07dc: 0c00900f */ jal modelInit /* f0f07e0: 24070001 */ addiu $a3,$zero,0x1 /* f0f07e4: 26300084 */ addiu $s0,$s1,0x84 -/* f0f07e8: 0c00904e */ jal animInitialise +/* f0f07e8: 0c00904e */ jal animInit /* f0f07ec: 02002025 */ or $a0,$s0,$zero /* f0f07f0: 24180100 */ addiu $t8,$zero,0x100 /* f0f07f4: a6380062 */ sh $t8,0x62($s1) diff --git a/src/include/data.h b/src/include/data.h index 6e874d689..8d8033c8a 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -384,7 +384,7 @@ extern u8 propexplosiontypes[]; extern struct modeltype g_ModelTypeBasic; extern struct modeltype g_ModelTypeChrGun; extern struct modeltype g_ModelType0B; -extern u32 var8007c0c0; +extern struct modelfiledata g_PlayerModelFileData; extern struct modeltype g_ModelType0A; extern struct modeltype g_ModelType20; extern struct modeltype g_ModelTypeClassicGun; diff --git a/src/include/lib/model.h b/src/include/lib/model.h index 2ab26efc9..48d9e7dc8 100644 --- a/src/include/lib/model.h +++ b/src/include/lib/model.h @@ -96,9 +96,9 @@ u32 func000227a4(void); void func00022a24(void *arg0, u32 arg1, void *arg2); s32 func00022b68(struct modelnode *node); void func00022d24(struct modelfiledata *filedata); -u32 func00022d50(void); -void func00022fa4(struct model *model, u32 *arg1, u32 *arg2, u32 arg3); -void animInitialise(struct anim *anim); +void func00022d50(struct model *model, struct modelnode *node); +void modelInit(struct model *model, struct modelfiledata *filedata, union modelrwdata **rwdatas, bool resetanim); +void animInit(struct anim *anim); u32 func00023108(void); u32 func0002319c(void); u32 func00023314(void); diff --git a/src/include/types.h b/src/include/types.h index 670a71e86..a5970b582 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -656,6 +656,7 @@ struct modelfiledata { struct model { /*0x00*/ u8 unk00; /*0x01*/ u8 unk01; + /*0x02*/ s16 unk02; /*0x04*/ struct chrdata *chr; /*0x08*/ struct modelfiledata *filedata; /*0x0c*/ Mtxf *matrices; @@ -2608,36 +2609,7 @@ struct player { /*0x0488*/ u8 *unk0488; // pointer to vtx buffer? /*0x048c*/ bool aborted; /*0x0490*/ s32 eyespydarts; - /*0x0494*/ u32 unk0494; - /*0x0498*/ u32 unk0498; - /*0x049c*/ u32 unk049c; - /*0x04a0*/ u32 unk04a0; - /*0x04a4*/ u32 unk04a4; - /*0x04a8*/ u32 unk04a8; - /*0x04ac*/ u32 unk04ac; - /*0x04b0*/ u32 unk04b0; - /*0x04b4*/ u32 unk04b4; - /*0x04b8*/ u32 unk04b8; - /*0x04bc*/ u32 unk04bc; - /*0x04c0*/ u32 unk04c0; - /*0x04c4*/ u32 unk04c4; - /*0x04c8*/ u32 unk04c8; - /*0x04cc*/ u32 unk04cc; - /*0x04d0*/ u32 unk04d0; - /*0x04d4*/ u32 unk04d4; - /*0x04d8*/ u32 unk04d8; - /*0x04dc*/ u32 unk04dc; - /*0x04e0*/ u32 unk04e0; - /*0x04e4*/ u32 unk04e4; - /*0x04e8*/ u32 unk04e8; - /*0x04ec*/ u32 unk04ec; - /*0x04f0*/ u32 unk04f0; - /*0x04f4*/ u32 unk04f4; - /*0x04f8*/ u32 unk04f8; - /*0x04fc*/ u32 unk04fc; - /*0x0500*/ u32 unk0500; - /*0x0504*/ u32 unk0504; - /*0x0508*/ u32 unk0508; + /*0x0494*/ union modelrwdata *bondheadsave[30]; /*0x050c*/ u32 unk050c; /*0x0510*/ Mtxf unk0510; /*0x0550*/ Mtxf unk0550; diff --git a/src/lib/model.c b/src/lib/model.c index 3cbad9d7d..0d52db7ee 100644 --- a/src/lib/model.c +++ b/src/lib/model.c @@ -10637,84 +10637,56 @@ glabel var70054634 /* 22fa0: 27bd0030 */ addiu $sp,$sp,0x30 ); -GLOBAL_ASM( -glabel func00022fa4 -/* 22fa4: 27bdffe0 */ addiu $sp,$sp,-32 -/* 22fa8: afbf001c */ sw $ra,0x1c($sp) -/* 22fac: afb10018 */ sw $s1,0x18($sp) -/* 22fb0: afb00014 */ sw $s0,0x14($sp) -/* 22fb4: afa7002c */ sw $a3,0x2c($sp) -/* 22fb8: 3c013f80 */ lui $at,0x3f80 -/* 22fbc: 44812000 */ mtc1 $at,$f4 -/* 22fc0: 240effff */ addiu $t6,$zero,-1 -/* 22fc4: a0800000 */ sb $zero,0x0($a0) -/* 22fc8: ac850008 */ sw $a1,0x8($a0) -/* 22fcc: ac860010 */ sw $a2,0x10($a0) -/* 22fd0: a48e0002 */ sh $t6,0x2($a0) -/* 22fd4: ac800018 */ sw $zero,0x18($a0) -/* 22fd8: ac80001c */ sw $zero,0x1c($a0) -/* 22fdc: e4840014 */ swc1 $f4,0x14($a0) -/* 22fe0: 8ca20000 */ lw $v0,0x0($a1) -/* 22fe4: 00a08825 */ or $s1,$a1,$zero -/* 22fe8: 00808025 */ or $s0,$a0,$zero -/* 22fec: 1040001f */ beqz $v0,.L0002306c -/* 22ff0: 24050017 */ addiu $a1,$zero,0x17 -/* 22ff4: 94430000 */ lhu $v1,0x0($v0) -.L00022ff8: -/* 22ff8: 306f00ff */ andi $t7,$v1,0xff -/* 22ffc: 55e50005 */ bnel $t7,$a1,.L00023014 -/* 23000: 8c430014 */ lw $v1,0x14($v0) -/* 23004: 92180000 */ lbu $t8,0x0($s0) -/* 23008: 37190001 */ ori $t9,$t8,0x1 -/* 2300c: a2190000 */ sb $t9,0x0($s0) -/* 23010: 8c430014 */ lw $v1,0x14($v0) -.L00023014: -/* 23014: 10600003 */ beqz $v1,.L00023024 -/* 23018: 00000000 */ nop -/* 2301c: 10000011 */ b .L00023064 -/* 23020: 00601025 */ or $v0,$v1,$zero -.L00023024: -/* 23024: 1040000f */ beqz $v0,.L00023064 -/* 23028: 00000000 */ nop -/* 2302c: 8e280000 */ lw $t0,0x0($s1) -/* 23030: 8d040008 */ lw $a0,0x8($t0) -.L00023034: -/* 23034: 54440004 */ bnel $v0,$a0,.L00023048 -/* 23038: 8c43000c */ lw $v1,0xc($v0) -/* 2303c: 10000009 */ b .L00023064 -/* 23040: 00001025 */ or $v0,$zero,$zero -/* 23044: 8c43000c */ lw $v1,0xc($v0) -.L00023048: -/* 23048: 50600004 */ beqzl $v1,.L0002305c -/* 2304c: 8c420008 */ lw $v0,0x8($v0) -/* 23050: 10000004 */ b .L00023064 -/* 23054: 00601025 */ or $v0,$v1,$zero -/* 23058: 8c420008 */ lw $v0,0x8($v0) -.L0002305c: -/* 2305c: 1440fff5 */ bnez $v0,.L00023034 -/* 23060: 00000000 */ nop -.L00023064: -/* 23064: 5440ffe4 */ bnezl $v0,.L00022ff8 -/* 23068: 94430000 */ lhu $v1,0x0($v0) -.L0002306c: -/* 2306c: 10c00003 */ beqz $a2,.L0002307c -/* 23070: 02002025 */ or $a0,$s0,$zero -/* 23074: 0c008b54 */ jal func00022d50 -/* 23078: 8e250000 */ lw $a1,0x0($s1) -.L0002307c: -/* 2307c: 8fa9002c */ lw $t1,0x2c($sp) -/* 23080: 51200003 */ beqzl $t1,.L00023090 -/* 23084: 8fbf001c */ lw $ra,0x1c($sp) -/* 23088: ae000020 */ sw $zero,0x20($s0) -/* 2308c: 8fbf001c */ lw $ra,0x1c($sp) -.L00023090: -/* 23090: 8fb00014 */ lw $s0,0x14($sp) -/* 23094: 8fb10018 */ lw $s1,0x18($sp) -/* 23098: 03e00008 */ jr $ra -/* 2309c: 27bd0020 */ addiu $sp,$sp,0x20 -); +void modelInit(struct model *model, struct modelfiledata *filedata, union modelrwdata **rwdatas, bool resetanim) +{ + struct modelnode *node; -void animInitialise(struct anim *anim) + model->unk00 = 0; + model->filedata = filedata; + model->rwdatas = rwdatas; + model->unk02 = -1; + model->scale = 1; + model->attachedto = NULL; + model->unk1c = NULL; + + node = filedata->rootnode; + + while (node) { + u32 type = node->type & 0xff; + + if (type == MODELNODETYPE_HEADSPOT) { + model->unk00 |= 1; + } + + if (node->child) { + node = node->child; + } else { + while (node) { + if (node == filedata->rootnode->parent) { + node = NULL; + break; + } + + if (node->next) { + node = node->next; + break; + } + + node = node->parent; + } + } + } + + if (rwdatas != NULL) { + func00022d50(model, filedata->rootnode); + } + + if (resetanim) { + model->anim = NULL; + } +} + +void animInit(struct anim *anim) { anim->animnum = 0; anim->animnum2 = 0;