From 56b1365551b9ed1fbe2bfef1e76eb01a793c9cd4 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 1 Mar 2020 00:23:12 +1000 Subject: [PATCH] Decompile currentPlayerGetGrabbedProp --- src/game/game_066310.c | 8 ++++---- src/game/game_0c79f0.c | 25 +++++++++---------------- src/include/constants.h | 2 +- src/include/game/game_0c79f0.h | 2 +- src/include/types.h | 2 +- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/game/game_066310.c b/src/game/game_066310.c index b855c077d..58184e3b6 100644 --- a/src/game/game_066310.c +++ b/src/game/game_066310.c @@ -6769,7 +6769,7 @@ glabel setupParseObject .L0f06b004: /* f06b004: 0fc4a24b */ jal setCurrentPlayerNum /* f06b008: 02002025 */ or $a0,$s0,$zero -/* f06b00c: 0fc31f31 */ jal func0f0c7cc4 +/* f06b00c: 0fc31f31 */ jal currentPlayerGetGrabbedProp /* f06b010: 00000000 */ sll $zero,$zero,0x0 /* f06b014: 8e2b0014 */ lw $t3,0x14($s1) /* f06b018: 104b0006 */ beq $v0,$t3,.L0f06b034 @@ -29085,7 +29085,7 @@ glabel func0f07e758 /* f07f3dc: 00000000 */ sll $zero,$zero,0x0 /* f07f3e0: 10510005 */ beq $v0,$s1,.L0f07f3f8 /* f07f3e4: 00000000 */ sll $zero,$zero,0x0 -/* f07f3e8: 0fc31f31 */ jal func0f0c7cc4 +/* f07f3e8: 0fc31f31 */ jal currentPlayerGetGrabbedProp /* f07f3ec: 00000000 */ sll $zero,$zero,0x0 /* f07f3f0: 54510006 */ bnel $v0,$s1,.L0f07f40c /* f07f3f4: 8e02000c */ lw $v0,0xc($s0) @@ -37602,7 +37602,7 @@ glabel func0f086d60 /* f086db8: 0561000b */ bgez $t3,.L0f086de8 /* f086dbc: 24030001 */ addiu $v1,$zero,0x1 /* f086dc0: afa00028 */ sw $zero,0x28($sp) -/* f086dc4: 0fc31f31 */ jal func0f0c7cc4 +/* f086dc4: 0fc31f31 */ jal currentPlayerGetGrabbedProp /* f086dc8: afa5002c */ sw $a1,0x2c($sp) /* f086dcc: 8fac0030 */ lw $t4,0x30($sp) /* f086dd0: 8fa30028 */ lw $v1,0x28($sp) @@ -43711,7 +43711,7 @@ glabel func0f08c190 /* f08c284: 0000a025 */ or $s4,$zero,$zero /* f08c288: 54410007 */ bnel $v0,$at,.L0f08c2a8 /* f08c28c: 24010003 */ addiu $at,$zero,0x3 -/* f08c290: 0fc31f31 */ jal func0f0c7cc4 +/* f08c290: 0fc31f31 */ jal currentPlayerGetGrabbedProp /* f08c294: 00000000 */ sll $zero,$zero,0x0 /* f08c298: 8c530004 */ lw $s3,0x4($v0) /* f08c29c: 10000009 */ beqz $zero,.L0f08c2c4 diff --git a/src/game/game_0c79f0.c b/src/game/game_0c79f0.c index b7459e437..001192c48 100644 --- a/src/game/game_0c79f0.c +++ b/src/game/game_0c79f0.c @@ -333,21 +333,14 @@ struct prop *currentPlayerGetHoverbike(void) return NULL; } -GLOBAL_ASM( -glabel func0f0c7cc4 -/* f0c7cc4: 3c03800a */ lui $v1,0x800a -/* f0c7cc8: 8c63a244 */ lw $v1,-0x5dbc($v1) -/* f0c7ccc: 24010004 */ addiu $at,$zero,0x4 -/* f0c7cd0: 00001025 */ or $v0,$zero,$zero -/* f0c7cd4: 8c6e01b0 */ lw $t6,0x1b0($v1) -/* f0c7cd8: 15c10003 */ bne $t6,$at,.L0f0c7ce8 -/* f0c7cdc: 00000000 */ sll $zero,$zero,0x0 -/* f0c7ce0: 03e00008 */ jr $ra -/* f0c7ce4: 8c621b5c */ lw $v0,0x1b5c($v1) -.L0f0c7ce8: -/* f0c7ce8: 03e00008 */ jr $ra -/* f0c7cec: 00000000 */ sll $zero,$zero,0x0 -); +struct prop *currentPlayerGetGrabbedProp(void) +{ + if (g_Vars.currentplayer->bondmovemode == MOVEMODE_GRABBEDPROP) { + return g_Vars.currentplayer->grabbedprop; + } + + return NULL; +} GLOBAL_ASM( glabel currentPlayerGrabProp @@ -372,7 +365,7 @@ glabel currentPlayerGrabProp void func0f0c7d30(u32 arg) { - if (g_Vars.currentplayer->bondmovemode == MOVEMODE_HOLDINGPROP) { + if (g_Vars.currentplayer->bondmovemode == MOVEMODE_GRABBEDPROP) { func0f0ccac4(); } else if (g_Vars.currentplayer->bondmovemode == MOVEMODE_HOVERBIKE) { func0f0d2184(); diff --git a/src/include/constants.h b/src/include/constants.h index d3b72ccdf..a9ad9f1d8 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -1129,7 +1129,7 @@ #define MOVEMODE_NORMAL 0 #define MOVEMODE_HOVERBIKE 3 -#define MOVEMODE_HOLDINGPROP 4 +#define MOVEMODE_GRABBEDPROP 4 #define MOVEMODE_CUTSCENE 5 #define MPLOCKTYPE_NONE 0 diff --git a/src/include/game/game_0c79f0.h b/src/include/game/game_0c79f0.h index 430b09db9..6e82aa5db 100644 --- a/src/include/game/game_0c79f0.h +++ b/src/include/game/game_0c79f0.h @@ -15,7 +15,7 @@ bool currentPlayerIsAutoAimXEnabled(void); u32 func0f0c7bd0(void); void currentPlayerUpdateAutoAimXProp(struct prop *prop, f32 autoaimx); struct prop *currentPlayerGetHoverbike(void); -u32 func0f0c7cc4(void); +struct prop *currentPlayerGetGrabbedProp(void); void currentPlayerGrabProp(struct prop *prop); void func0f0c7d30(u32 arg0); void releaseObj(u32 arg0); diff --git a/src/include/types.h b/src/include/types.h index 0be20b267..ab8db1ae7 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2697,7 +2697,7 @@ struct player { /*0x1b50*/ u32 unk1b50; /*0x1b54*/ u32 unk1b54; /*0x1b58*/ u32 unk1b58; - /*0x1b5c*/ u32 unk1b5c; + /*0x1b5c*/ struct prop *grabbedprop; /*0x1b60*/ u32 unk1b60; /*0x1b64*/ u32 unk1b64; /*0x1b68*/ u32 unk1b68;