From 185d0369f115448ba507676763ee8b0348f3425f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 20 Mar 2020 18:01:37 +1000 Subject: [PATCH] Decompile mpMenuTextScorePositionWithSuffix --- src/game/data/data_020df0.c | 4 +-- src/game/game_177e00.c | 43 ++++------------------------- src/include/game/data/data_020df0.h | 2 +- src/include/game/game_177e00.h | 2 +- src/include/types.h | 1 + 5 files changed, 11 insertions(+), 41 deletions(-) diff --git a/src/game/data/data_020df0.c b/src/game/data/data_020df0.c index ef5934cbc..d21ad502b 100644 --- a/src/game/data/data_020df0.c +++ b/src/game/data/data_020df0.c @@ -10208,7 +10208,7 @@ struct menu_dialog menudialog_2a920 = { }; // 2a938 -u16 rankings[] = { +u16 g_OrdinalSuffixes[] = { L_MPMENU(264), // "1st" L_MPMENU(265), // "2nd" L_MPMENU(266), // "3rd" @@ -10225,7 +10225,7 @@ u16 rankings[] = { // 2a950 struct menu_item menuitems_2a950[] = { - { MENUITEMTYPE_LABEL, 0, 0x01000010, (u32)&mpGetCurrentPlayerName, (u32)&func0f17853c, menuhandler001785c4 }, + { MENUITEMTYPE_LABEL, 0, 0x01000010, (u32)&mpGetCurrentPlayerName, (u32)&mpMenuTextScorePositionWithSuffix, menuhandler001785c4 }, { MENUITEMTYPE_LABEL, 0, 0x01000000, L_MPMENU(261), (u32)&mpMenuTextPlayerTitle, menuhandler00178a94 }, // "Title:" { MENUITEMTYPE_SEPARATOR, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, { MENUITEMTYPE_LABEL, 0, 0x00000210, L_MPMENU(262), 0x00000000, NULL }, // "Weapon of Choice:" diff --git a/src/game/game_177e00.c b/src/game/game_177e00.c index 11ccfe23f..b10ced7d8 100644 --- a/src/game/game_177e00.c +++ b/src/game/game_177e00.c @@ -336,43 +336,12 @@ char *mpMenuTextAward2(struct menu_item *item) return g_Vars.players[g_MenuStack[g_MpPlayerNum].playernum]->award2; } -GLOBAL_ASM( -glabel func0f17853c -/* f17853c: 27bdffd0 */ addiu $sp,$sp,-48 -/* f178540: 3c0e8008 */ lui $t6,%hi(rankings) -/* f178544: afbf0014 */ sw $ra,0x14($sp) -/* f178548: afa40030 */ sw $a0,0x30($sp) -/* f17854c: 25ce4918 */ addiu $t6,$t6,%lo(rankings) -/* f178550: 8dc10000 */ lw $at,0x0($t6) -/* f178554: 27a20018 */ addiu $v0,$sp,0x18 -/* f178558: 3c088007 */ lui $t0,%hi(g_MpPlayerNum) -/* f17855c: ac410000 */ sw $at,0x0($v0) -/* f178560: 8dd90004 */ lw $t9,0x4($t6) -/* f178564: 3c0a800b */ lui $t2,%hi(g_MpPlayers+0x1e) -/* f178568: ac590004 */ sw $t9,0x4($v0) -/* f17856c: 8dc10008 */ lw $at,0x8($t6) -/* f178570: ac410008 */ sw $at,0x8($v0) -/* f178574: 8dd9000c */ lw $t9,0xc($t6) -/* f178578: ac59000c */ sw $t9,0xc($v0) -/* f17857c: 8dc10010 */ lw $at,0x10($t6) -/* f178580: ac410010 */ sw $at,0x10($v0) -/* f178584: 8dd90014 */ lw $t9,0x14($t6) -/* f178588: ac590014 */ sw $t9,0x14($v0) -/* f17858c: 8d081448 */ lw $t0,%lo(g_MpPlayerNum)($t0) -/* f178590: 00084880 */ sll $t1,$t0,0x2 -/* f178594: 01284821 */ addu $t1,$t1,$t0 -/* f178598: 00094940 */ sll $t1,$t1,0x5 -/* f17859c: 01495021 */ addu $t2,$t2,$t1 -/* f1785a0: 814ac7d6 */ lb $t2,%lo(g_MpPlayers+0x1e)($t2) -/* f1785a4: 000a5840 */ sll $t3,$t2,0x1 -/* f1785a8: 004b6021 */ addu $t4,$v0,$t3 -/* f1785ac: 0fc5b9f1 */ jal langGet -/* f1785b0: 95840000 */ lhu $a0,0x0($t4) -/* f1785b4: 8fbf0014 */ lw $ra,0x14($sp) -/* f1785b8: 27bd0030 */ addiu $sp,$sp,0x30 -/* f1785bc: 03e00008 */ jr $ra -/* f1785c0: 00000000 */ sll $zero,$zero,0x0 -); +char *mpMenuTextScorePositionWithSuffix(struct menu_item *item) +{ + u16 suffixes[12] = g_OrdinalSuffixes; + + return langGet(suffixes[g_MpPlayers[g_MpPlayerNum].base.scoreposition]); +} GLOBAL_ASM( glabel menuhandler001785c4 diff --git a/src/include/game/data/data_020df0.h b/src/include/game/data/data_020df0.h index 66d1e14ba..8d25458cc 100644 --- a/src/include/game/data/data_020df0.h +++ b/src/include/game/data/data_020df0.h @@ -246,7 +246,7 @@ extern u32 var800845dc; extern u32 var800845f4; extern struct menu_dialog menudialog_2a8b0; extern struct menu_dialog menudialog_2a908; -extern u16 rankings[]; +extern u16 g_OrdinalSuffixes[12]; extern struct menu_dialog menudialog_2aa18; extern struct menu_dialog menudialog_2aa30; extern struct menu_dialog menudialog_2aa48; diff --git a/src/include/game/game_177e00.h b/src/include/game/game_177e00.h index 1b0f439ae..86e490c80 100644 --- a/src/include/game/game_177e00.h +++ b/src/include/game/game_177e00.h @@ -12,7 +12,7 @@ u32 func0f1783a0(void); char *mpMenuTextWeaponOfChoiceName(struct menu_item *item); char *mpMenuTextAward1(struct menu_item *item); char *mpMenuTextAward2(struct menu_item *item); -u32 func0f17853c(void); +char *mpMenuTextScorePositionWithSuffix(struct menu_item *item); s32 menuhandler001785c4(u32, u32, u32 *); s32 menuhandler001786d8(u32, u32, u32 *); s32 menuhandler00178a94(u32, u32, u32 *); diff --git a/src/include/types.h b/src/include/types.h index 6c15ece96..c0d581e8f 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -4358,6 +4358,7 @@ struct mpchr { /*0x14*/ u32 displayoptions; /*0x18*/ u32 unk18; /*0x1c*/ u16 unk1c; + /*0x1c*/ s8 scoreposition; /*0x20*/ u32 unk20; /*0x24*/ s16 unk24[12]; /*0x3c*/ s16 unk3c;