From 3b969e558cab49df33b1e0847d67afb94a67ae4b Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 19 Jan 2020 20:25:18 +1000 Subject: [PATCH] Decompile mpGetBodyName --- src/game/game_176d70.c | 2 +- src/game/game_187770.c | 29 +++++++++-------------------- src/include/game/game_187770.h | 2 +- src/include/types.h | 2 +- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/game/game_176d70.c b/src/game/game_176d70.c index 8b94481b7..c9ba6d57b 100644 --- a/src/game/game_176d70.c +++ b/src/game/game_176d70.c @@ -5430,7 +5430,7 @@ glabel func0f17b8b0 /* f17b8cc: 3c04800b */ lui $a0,0x800b /* f17b8d0: afbf0014 */ sw $ra,0x14($sp) /* f17b8d4: 008f2021 */ addu $a0,$a0,$t7 -/* f17b8d8: 0fc62f0c */ jal func0f18bc30 +/* f17b8d8: 0fc62f0c */ jal mpGetBodyName /* f17b8dc: 9084c7c8 */ lbu $a0,-0x3838($a0) /* f17b8e0: 8fbf0014 */ lw $ra,0x14($sp) /* f17b8e4: 27bd0018 */ addiu $sp,$sp,0x18 diff --git a/src/game/game_187770.c b/src/game/game_187770.c index d5d3965ef..2c3292db6 100644 --- a/src/game/game_187770.c +++ b/src/game/game_187770.c @@ -5194,26 +5194,15 @@ glabel func0f18bbd8 /* f18bc2c: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f18bc30 -/* f18bc30: 308500ff */ andi $a1,$a0,0xff -/* f18bc34: 27bdffe8 */ addiu $sp,$sp,-24 -/* f18bc38: 28a1003e */ slti $at,$a1,0x3e -/* f18bc3c: afbf0014 */ sw $ra,0x14($sp) -/* f18bc40: 14200002 */ bnez $at,.L0f18bc4c -/* f18bc44: afa40018 */ sw $a0,0x18($sp) -/* f18bc48: 00002825 */ or $a1,$zero,$zero -.L0f18bc4c: -/* f18bc4c: 000570c0 */ sll $t6,$a1,0x3 -/* f18bc50: 3c048008 */ lui $a0,0x8008 -/* f18bc54: 008e2021 */ addu $a0,$a0,$t6 -/* f18bc58: 0fc5b9f1 */ jal textGet -/* f18bc5c: 848477be */ lh $a0,0x77be($a0) -/* f18bc60: 8fbf0014 */ lw $ra,0x14($sp) -/* f18bc64: 27bd0018 */ addiu $sp,$sp,0x18 -/* f18bc68: 03e00008 */ jr $ra -/* f18bc6c: 00000000 */ sll $zero,$zero,0x0 -); +char *mpGetBodyName(u8 bodynum) +{ + // Possible @bug: This should probably be >= + if (bodynum > NUM_MPBODIES) { + bodynum = 0; + } + + return textGet(g_MpBodies[bodynum].name); +} u8 mpGetBodyUnk06(u8 bodynum) { diff --git a/src/include/game/game_187770.h b/src/include/game/game_187770.h index 4b0abd20d..5c0736ae4 100644 --- a/src/include/game/game_187770.h +++ b/src/include/game/game_187770.h @@ -53,7 +53,7 @@ u32 func0f18bb64(void); u32 mpGetNumBodies(void); u32 func0f18bb90(void); u32 func0f18bbd8(void); -u32 func0f18bc30(void); +char *mpGetBodyName(u8 bodynum); u8 mpGetBodyUnk06(u8 bodynum); s32 func0f18bc9c(s32 arg0); u32 func0f18bee8(void); diff --git a/src/include/types.h b/src/include/types.h index 7635ff812..f0a1f5426 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2875,7 +2875,7 @@ struct mpsimulant { struct mpbody { u16 slot; - u16 name; + s16 name; u16 unk04; u8 unk06; };