diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index 9f1fdc3c0..a69106e12 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -2673,7 +2673,7 @@ glabel func0f0ce924 /* f0cebd4: c7a4007c */ lwc1 $f4,0x7c($sp) /* f0cebd8: 460e3282 */ mul.s $f10,$f6,$f14 /* f0cebdc: 460a2200 */ add.s $f8,$f4,$f10 -/* f0cebe0: 0fc32ed2 */ jal func0f0cbb48 +/* f0cebe0: 0fc32ed2 */ jal currentPlayerUpdateMoveInitSpeed /* f0cebe4: e7a8007c */ swc1 $f8,0x7c($sp) /* f0cebe8: 0fc47b82 */ jal func0f11ee08 /* f0cebec: 00000000 */ sll $zero,$zero,0x0 diff --git a/src/game/game_0c37d0.c b/src/game/game_0c37d0.c index be01d4e0b..5443e5358 100644 --- a/src/game/game_0c37d0.c +++ b/src/game/game_0c37d0.c @@ -3669,7 +3669,7 @@ glabel func0f0c69b8 /* f0c6b80: 25089fc0 */ addiu $t0,$t0,%lo(g_Vars) /* f0c6b84: 8d090284 */ lw $t1,0x284($t0) /* f0c6b88: 27a400cc */ addiu $a0,$sp,0xcc -/* f0c6b8c: 0fc32ed2 */ jal func0f0cbb48 +/* f0c6b8c: 0fc32ed2 */ jal currentPlayerUpdateMoveInitSpeed /* f0c6b90: e53400cc */ swc1 $f20,0xcc($t1) /* f0c6b94: 4405a000 */ mfc1 $a1,$f20 /* f0c6b98: 4407a000 */ mfc1 $a3,$f20 @@ -4008,7 +4008,7 @@ glabel func0f0c69b8 /* f0c706c: e7a800d4 */ swc1 $f8,0xd4($sp) /* f0c7070: 46044180 */ add.s $f6,$f8,$f4 /* f0c7074: e7aa00cc */ swc1 $f10,0xcc($sp) -/* f0c7078: 0fc32ed2 */ jal func0f0cbb48 +/* f0c7078: 0fc32ed2 */ jal currentPlayerUpdateMoveInitSpeed /* f0c707c: e7a600d4 */ swc1 $f6,0xd4($sp) /* f0c7080: 0fc47b82 */ jal func0f11ee08 /* f0c7084: 00000000 */ sll $zero,$zero,0x0 diff --git a/src/game/game_0c79f0.c b/src/game/game_0c79f0.c index 05908a75c..469be797d 100644 --- a/src/game/game_0c79f0.c +++ b/src/game/game_0c79f0.c @@ -4132,96 +4132,26 @@ void func0f0cba88(f32 *a, f32 *b, struct coord *c, f32 mult1, f32 mult2) } } -GLOBAL_ASM( -glabel func0f0cbb48 -.late_rodata -glabel var7f1ad8f0 -.word 0x3a83126f -glabel var7f1ad8f4 -.word 0xba83126f -glabel var7f1ad8f8 -.word 0x3f666666 -glabel var7f1ad8fc -.word 0x3a83126f -glabel var7f1ad900 -.word 0xba83126f -glabel var7f1ad904 -.word 0x3f666666 -.text -/* f0cbb48: 3c03800a */ lui $v1,%hi(g_Vars) -/* f0cbb4c: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars) -/* f0cbb50: 8c620284 */ lw $v0,0x284($v1) -/* f0cbb54: 44801000 */ mtc1 $zero,$f2 -/* f0cbb58: 3c017f1b */ lui $at,%hi(var7f1ad8f0) -/* f0cbb5c: c44001a4 */ lwc1 $f0,0x1a4($v0) -/* f0cbb60: 46001032 */ c.eq.s $f2,$f0 -/* f0cbb64: 00000000 */ sll $zero,$zero,0x0 -/* f0cbb68: 4503001c */ bc1tl .L0f0cbbdc -/* f0cbb6c: c44001ac */ lwc1 $f0,0x1ac($v0) -/* f0cbb70: c424d8f0 */ lwc1 $f4,%lo(var7f1ad8f0)($at) -/* f0cbb74: 3c017f1b */ lui $at,%hi(var7f1ad8f4) -/* f0cbb78: 4604003c */ c.lt.s $f0,$f4 -/* f0cbb7c: 00000000 */ sll $zero,$zero,0x0 -/* f0cbb80: 45000009 */ bc1f .L0f0cbba8 -/* f0cbb84: 00000000 */ sll $zero,$zero,0x0 -/* f0cbb88: c426d8f4 */ lwc1 $f6,%lo(var7f1ad8f4)($at) -/* f0cbb8c: 4600303c */ c.lt.s $f6,$f0 -/* f0cbb90: 00000000 */ sll $zero,$zero,0x0 -/* f0cbb94: 45000004 */ bc1f .L0f0cbba8 -/* f0cbb98: 00000000 */ sll $zero,$zero,0x0 -/* f0cbb9c: e44201a4 */ swc1 $f2,0x1a4($v0) -/* f0cbba0: 1000000d */ beqz $zero,.L0f0cbbd8 -/* f0cbba4: 8c620284 */ lw $v0,0x284($v1) -.L0f0cbba8: -/* f0cbba8: 3c017f1b */ lui $at,%hi(var7f1ad8f8) -/* f0cbbac: c428d8f8 */ lwc1 $f8,%lo(var7f1ad8f8)($at) -/* f0cbbb0: 46080282 */ mul.s $f10,$f0,$f8 -/* f0cbbb4: e44a01a4 */ swc1 $f10,0x1a4($v0) -/* f0cbbb8: 8c6e0284 */ lw $t6,0x284($v1) -/* f0cbbbc: c472004c */ lwc1 $f18,0x4c($v1) -/* f0cbbc0: c4860000 */ lwc1 $f6,0x0($a0) -/* f0cbbc4: c5d001a4 */ lwc1 $f16,0x1a4($t6) -/* f0cbbc8: 46128102 */ mul.s $f4,$f16,$f18 -/* f0cbbcc: 46043200 */ add.s $f8,$f6,$f4 -/* f0cbbd0: e4880000 */ swc1 $f8,0x0($a0) -/* f0cbbd4: 8c620284 */ lw $v0,0x284($v1) -.L0f0cbbd8: -/* f0cbbd8: c44001ac */ lwc1 $f0,0x1ac($v0) -.L0f0cbbdc: -/* f0cbbdc: 3c017f1b */ lui $at,%hi(var7f1ad8fc) -/* f0cbbe0: 46001032 */ c.eq.s $f2,$f0 -/* f0cbbe4: 00000000 */ sll $zero,$zero,0x0 -/* f0cbbe8: 45010019 */ bc1t .L0f0cbc50 -/* f0cbbec: 00000000 */ sll $zero,$zero,0x0 -/* f0cbbf0: c42ad8fc */ lwc1 $f10,%lo(var7f1ad8fc)($at) -/* f0cbbf4: 3c017f1b */ lui $at,%hi(var7f1ad900) -/* f0cbbf8: 460a003c */ c.lt.s $f0,$f10 -/* f0cbbfc: 00000000 */ sll $zero,$zero,0x0 -/* f0cbc00: 45000008 */ bc1f .L0f0cbc24 -/* f0cbc04: 00000000 */ sll $zero,$zero,0x0 -/* f0cbc08: c430d900 */ lwc1 $f16,%lo(var7f1ad900)($at) -/* f0cbc0c: 4600803c */ c.lt.s $f16,$f0 -/* f0cbc10: 00000000 */ sll $zero,$zero,0x0 -/* f0cbc14: 45000003 */ bc1f .L0f0cbc24 -/* f0cbc18: 00000000 */ sll $zero,$zero,0x0 -/* f0cbc1c: 03e00008 */ jr $ra -/* f0cbc20: e44201ac */ swc1 $f2,0x1ac($v0) -.L0f0cbc24: -/* f0cbc24: 3c017f1b */ lui $at,%hi(var7f1ad904) -/* f0cbc28: c432d904 */ lwc1 $f18,%lo(var7f1ad904)($at) -/* f0cbc2c: 46120182 */ mul.s $f6,$f0,$f18 -/* f0cbc30: e44601ac */ swc1 $f6,0x1ac($v0) -/* f0cbc34: 8c6f0284 */ lw $t7,0x284($v1) -/* f0cbc38: c468004c */ lwc1 $f8,0x4c($v1) -/* f0cbc3c: c4900008 */ lwc1 $f16,0x8($a0) -/* f0cbc40: c5e401ac */ lwc1 $f4,0x1ac($t7) -/* f0cbc44: 46082282 */ mul.s $f10,$f4,$f8 -/* f0cbc48: 460a8480 */ add.s $f18,$f16,$f10 -/* f0cbc4c: e4920008 */ swc1 $f18,0x8($a0) -.L0f0cbc50: -/* f0cbc50: 03e00008 */ jr $ra -/* f0cbc54: 00000000 */ sll $zero,$zero,0x0 -); +void currentPlayerUpdateMoveInitSpeed(struct coord *newpos) +{ + if (g_Vars.currentplayer->moveinitspeed.x != 0) { + if (g_Vars.currentplayer->moveinitspeed.x < 0.001f && g_Vars.currentplayer->moveinitspeed.x > -0.001f) { + g_Vars.currentplayer->moveinitspeed.x = 0; + } else { + g_Vars.currentplayer->moveinitspeed.x *= 0.9f; + newpos->x += g_Vars.currentplayer->moveinitspeed.x * g_Vars.lvupdate240freal; + } + } + + if (g_Vars.currentplayer->moveinitspeed.z != 0) { + if (g_Vars.currentplayer->moveinitspeed.z < 0.001f && g_Vars.currentplayer->moveinitspeed.z > -0.001f) { + g_Vars.currentplayer->moveinitspeed.z = 0; + } else { + g_Vars.currentplayer->moveinitspeed.z *= 0.9f; + newpos->z += g_Vars.currentplayer->moveinitspeed.z * g_Vars.lvupdate240freal; + } + } +} GLOBAL_ASM( glabel func0f0cbc58 diff --git a/src/include/game/game_0c79f0.h b/src/include/game/game_0c79f0.h index 983443dc2..5913da6ec 100644 --- a/src/include/game/game_0c79f0.h +++ b/src/include/game/game_0c79f0.h @@ -34,7 +34,7 @@ void func0f0cb89c(struct player *player, s16 *rooms); void func0f0cb8c4(struct player *player); void func0f0cb904(struct coord *coord); void func0f0cba88(f32 *a, f32 *b, struct coord *c, f32 mult1, f32 mult2); -u32 func0f0cbb48(void); +void currentPlayerUpdateMoveInitSpeed(struct coord *newpos); u32 func0f0cbc58(void); u32 func0f0cbf50(void); u32 func0f0cc19c(void); diff --git a/src/include/types.h b/src/include/types.h index 572e21a7d..99aadbe6d 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1126,9 +1126,7 @@ struct player { /*0x0198*/ f32 unk0198; /*0x019c*/ u32 unk019c; /*0x01a0*/ u32 unk01a0; - /*0x01a4*/ u32 unk01a4; - /*0x01a8*/ u32 unk01a8; - /*0x01ac*/ u32 unk01ac; + /*0x01a4*/ struct coord moveinitspeed; /*0x01b0*/ u32 bondmovemode; /*0x01b4*/ u32 unk01b4; /*0x01b8*/ u32 unk01b8;