diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index b59ad39a6..2c6999fe1 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -2538,7 +2538,7 @@ struct prop *func0f020b14(struct prop *prop, struct model *model, model->unk01 = 1; chr->model = model; func0f03e538(chr, arg4); - func0001dfac(model, var80062968, 0); + modelSetAnimPlaySpeed(model, var80062968, 0); testpos.x = pos->x; testpos.y = pos->y + 100; @@ -2788,7 +2788,7 @@ void func0f0211a8(f32 arg0) for (i = 0; i < g_NumChrsA; i++) { if (g_ChrsA[i].model) { - func0001dfac(g_ChrsA[i].model, var80062968, 600); + modelSetAnimPlaySpeed(g_ChrsA[i].model, var80062968, 600); } } } diff --git a/src/game/game_0125a0.c b/src/game/game_0125a0.c index ed3e1d20e..9b52cfb3a 100644 --- a/src/game/game_0125a0.c +++ b/src/game/game_0125a0.c @@ -120,7 +120,7 @@ glabel func0f012684 /* f0126f8: 8e240284 */ lw $a0,0x284($s1) /* f0126fc: 44050000 */ mfc1 $a1,$f0 /* f012700: 4406a000 */ mfc1 $a2,$f20 -/* f012704: 0c0077eb */ jal func0001dfac +/* f012704: 0c0077eb */ jal modelSetAnimPlaySpeed /* f012708: 2484045c */ addiu $a0,$a0,0x45c /* f01270c: 3c013f80 */ lui $at,0x3f80 /* f012710: 44810000 */ mtc1 $at,$f0 diff --git a/src/include/lib/lib_1a500.h b/src/include/lib/lib_1a500.h index 68ad13904..81ea29486 100644 --- a/src/include/lib/lib_1a500.h +++ b/src/include/lib/lib_1a500.h @@ -69,7 +69,7 @@ void func0001de1c(struct model *model, f32 speed); u32 func0001de98(void); void modelSetAnimSpeed(struct model *model, f32 speed, f32 startframe); void func0001df04(struct model *model, f32 arg1, f32 arg2); -void func0001dfac(struct model *model, f32 arg1, f32 arg2); +void modelSetAnimPlaySpeed(struct model *model, f32 speed, f32 frame); void modelSetAnim70(struct model *model, void *callback); u32 func0001e018(void); u32 func0001e14c(void); diff --git a/src/include/types.h b/src/include/types.h index 8e3275ef6..85f2513ce 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -142,10 +142,10 @@ struct anim { /*0x6c*/ u32 unk6c; /*0x70*/ void *unk70; // pointer to function /*0x74*/ f32 playspeed; - /*0x78*/ u32 newplay; - /*0x7c*/ u32 oldplay; - /*0x80*/ u32 timeplay; - /*0x84*/ u32 elapseplay; + /*0x78*/ f32 newplay; + /*0x7c*/ f32 oldplay; + /*0x80*/ f32 timeplay; + /*0x84*/ f32 elapseplay; /*0x88*/ f32 animscale; }; diff --git a/src/lib/lib_1a500.c b/src/lib/lib_1a500.c index b2a9c37c6..aeed29fb4 100644 --- a/src/lib/lib_1a500.c +++ b/src/lib/lib_1a500.c @@ -4397,32 +4397,22 @@ glabel func0001df04 /* 1dfa8: 00000000 */ nop ); -GLOBAL_ASM( -glabel func0001dfac -/* 1dfac: 8c820020 */ lw $v0,0x20($a0) -/* 1dfb0: 44857000 */ mtc1 $a1,$f14 -/* 1dfb4: 44866000 */ mtc1 $a2,$f12 -/* 1dfb8: 1040000f */ beqz $v0,.L0001dff8 -/* 1dfbc: 00000000 */ nop -/* 1dfc0: 44800000 */ mtc1 $zero,$f0 -/* 1dfc4: 00000000 */ nop -/* 1dfc8: 460c003c */ c.lt.s $f0,$f12 -/* 1dfcc: 00000000 */ nop -/* 1dfd0: 45020008 */ bc1fl .L0001dff4 -/* 1dfd4: e44e0074 */ swc1 $f14,0x74($v0) -/* 1dfd8: c4440074 */ lwc1 $f4,0x74($v0) -/* 1dfdc: e44c0080 */ swc1 $f12,0x80($v0) -/* 1dfe0: e44e0078 */ swc1 $f14,0x78($v0) -/* 1dfe4: e4400084 */ swc1 $f0,0x84($v0) -/* 1dfe8: 03e00008 */ jr $ra -/* 1dfec: e444007c */ swc1 $f4,0x7c($v0) -/* 1dff0: e44e0074 */ swc1 $f14,0x74($v0) -.L0001dff4: -/* 1dff4: e4400080 */ swc1 $f0,0x80($v0) -.L0001dff8: -/* 1dff8: 03e00008 */ jr $ra -/* 1dffc: 00000000 */ nop -); +void modelSetAnimPlaySpeed(struct model *model, f32 speed, f32 startframe) +{ + struct anim *anim = model->anim; + + if (anim) { + if (startframe > 0) { + anim->timeplay = startframe; + anim->newplay = speed; + anim->elapseplay = 0; + anim->oldplay = anim->playspeed; + } else { + anim->playspeed = speed; + anim->timeplay = 0; + } + } +} void modelSetAnim70(struct model *model, void *callback) {