From fedfe70afe7bc714d0466b09d27d14e52f75159d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 5 May 2020 23:25:03 +1000 Subject: [PATCH] Decompile handGetXOffset --- src/game/game_097ba0.c | 6 +++--- src/game/game_0b0420.c | 19 ++++--------------- src/include/game/game_0b0420.h | 2 +- src/include/types.h | 2 +- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index f914e00ad..7e9cf437e 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -7289,7 +7289,7 @@ glabel var7f1ac628 /* f09d73c: e7aa005c */ swc1 $f10,0x5c($sp) /* f09d740: c61001a8 */ lwc1 $f16,0x1a8($s0) /* f09d744: 46104100 */ add.s $f4,$f8,$f16 -/* f09d748: 0fc2c4bb */ jal func0f0b12ec +/* f09d748: 0fc2c4bb */ jal handGetXOffset /* f09d74c: e7a40060 */ swc1 $f4,0x60($sp) /* f09d750: c7b2005c */ lwc1 $f18,0x5c($sp) /* f09d754: 8e2f0034 */ lw $t7,0x34($s1) @@ -21214,11 +21214,11 @@ void func0f0a93e0(struct coord *coord) { struct player *player = g_Vars.currentplayer; - player->hands[0].unk07f8.x = func0f0b12ec(0) + coord->x; + player->hands[0].unk07f8.x = handGetXOffset(0) + coord->x; player->hands[0].unk07f8.y = coord->y; player->hands[0].unk07f8.z = coord->z; - player->hands[1].unk07f8.x = func0f0b12ec(1) + coord->x; + player->hands[1].unk07f8.x = handGetXOffset(1) + coord->x; player->hands[1].unk07f8.y = coord->y; player->hands[1].unk07f8.z = coord->z; } diff --git a/src/game/game_0b0420.c b/src/game/game_0b0420.c index b89b7161e..f42a63635 100644 --- a/src/game/game_0b0420.c +++ b/src/game/game_0b0420.c @@ -975,21 +975,10 @@ void currentPlayerSetWeaponSway(struct coord *sway) } } -GLOBAL_ASM( -glabel func0f0b12ec -/* f0b12ec: 00047900 */ sll $t7,$a0,0x4 -/* f0b12f0: 01e47823 */ subu $t7,$t7,$a0 -/* f0b12f4: 000f7880 */ sll $t7,$t7,0x2 -/* f0b12f8: 01e47821 */ addu $t7,$t7,$a0 -/* f0b12fc: 3c0e800a */ lui $t6,%hi(g_Vars+0x284) -/* f0b1300: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6) -/* f0b1304: 000f78c0 */ sll $t7,$t7,0x3 -/* f0b1308: 01e47821 */ addu $t7,$t7,$a0 -/* f0b130c: 000f7880 */ sll $t7,$t7,0x2 -/* f0b1310: 01cfc021 */ addu $t8,$t6,$t7 -/* f0b1314: 03e00008 */ jr $ra -/* f0b1318: c70007f4 */ lwc1 $f0,0x7f4($t8) -); +f32 handGetXOffset(u32 hand) +{ + return g_Vars.currentplayer->hands[hand].xoffset; +} GLOBAL_ASM( glabel func0f0b131c diff --git a/src/include/game/game_0b0420.h b/src/include/game/game_0b0420.h index c6e155e52..1e26faccc 100644 --- a/src/include/game/game_0b0420.h +++ b/src/include/game/game_0b0420.h @@ -25,7 +25,7 @@ struct weaponfunc *weaponGetFunction(u8 *arg0, s32 which); struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand); u32 func0f0b11bc(void); struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum); -f32 func0f0b12ec(u32 arg0); +f32 handGetXOffset(u32 arg0); u32 func0f0b131c(void); f32 func0f0b14d8(void); u32 func0f0b1588(void); diff --git a/src/include/types.h b/src/include/types.h index fb33e4dd9..2b18fa776 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1277,7 +1277,7 @@ struct hand { /*0x07e8*/ u32 unk07e8; /*0x07ec*/ u32 unk07ec; /*0x07f0*/ u32 unk07f0; - /*0x07f4*/ u32 unk07f4; + /*0x07f4*/ f32 xoffset; /*0x07f8*/ struct coord unk07f8; /*0x0804*/ u32 unk0804; /*0x0808*/ u32 unk0808;