Calculate MP chr names dynamically
This commit is contained in:
parent
73808c232b
commit
e1c70fc9aa
|
|
@ -160,6 +160,7 @@ s32 amPickTargetMenuList(s32 operation, struct menuitem *item, union handlerdata
|
|||
s32 chrindex = -1;
|
||||
struct chrdata *botchr = g_MpChrs[g_Vars.currentplayer->aibuddynums[g_AmMenus[g_AmIndex].screenindex - 2]].chr;
|
||||
struct chrdata *playerchr = g_Vars.currentplayer->prop->chr;
|
||||
char namebuffer[32];
|
||||
|
||||
do {
|
||||
chrindex++;
|
||||
|
|
@ -185,8 +186,10 @@ s32 amPickTargetMenuList(s32 operation, struct menuitem *item, union handlerdata
|
|||
x = renderdata->x + 10;
|
||||
y = renderdata->y + 1;
|
||||
|
||||
mpGetChrName(namebuffer, &g_MpChrs[chrindex]);
|
||||
|
||||
gdl = text0f153628(gdl);
|
||||
gdl = textRenderProjected(gdl, &x, &y, g_MpChrs[chrindex].config->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, viGetWidth(), viGetHeight(), 0, 0);
|
||||
gdl = textRenderProjected(gdl, &x, &y, namebuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, viGetWidth(), viGetHeight(), 0, 0);
|
||||
gdl = text0f153780(gdl);
|
||||
return (s32)gdl;
|
||||
}
|
||||
|
|
@ -870,7 +873,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||
s32 textheight;
|
||||
s32 weaponnum;
|
||||
char *weaponname;
|
||||
char *aibotname;
|
||||
char namebuffer[32];
|
||||
s32 offset = 0;
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
bool wide = false;
|
||||
|
|
@ -897,7 +900,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||
|
||||
if (!g_AmMenus[g_AmIndex].allbots) {
|
||||
buddynum = g_Vars.currentplayer->aibuddynums[buddynum];
|
||||
aibotname = g_MpChrs[buddynum].config->name;
|
||||
mpGetChrName(namebuffer, &g_MpChrs[buddynum]);
|
||||
|
||||
if (g_MpChrs[buddynum].chr->aibot) {
|
||||
weaponnum = g_MpChrs[buddynum].chr->aibot->weaponnum;
|
||||
|
|
@ -911,7 +914,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||
weaponname = bgunGetShortName(weaponnum);
|
||||
}
|
||||
|
||||
textMeasure(&textheight, &textwidth, aibotname, g_AmFont1, g_AmFont2, 0);
|
||||
textMeasure(&textheight, &textwidth, namebuffer, g_AmFont1, g_AmFont2, 0);
|
||||
|
||||
x = viGetViewLeft() / g_ScaleX
|
||||
+ (s32)(viGetViewWidth() / g_ScaleX * 0.5f)
|
||||
|
|
@ -931,12 +934,12 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
|
|||
#endif
|
||||
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
gdl = func0f1574d0jf(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
||||
gdl = func0f1574d0jf(gdl, &x, &y, namebuffer, g_AmFont1, g_AmFont2, -1,
|
||||
0x000000ff, 320, 240, 0, 0);
|
||||
|
||||
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||
#else
|
||||
gdl = textRender(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
|
||||
gdl = textRender(gdl, &x, &y, namebuffer, g_AmFont1, g_AmFont2, -1,
|
||||
0x000000ff, 320, 240, 0, 0);
|
||||
|
||||
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
|
||||
|
|
|
|||
|
|
@ -3480,7 +3480,9 @@ Gfx *menuitemRankingRender(Gfx *gdl, struct menurendercontext *context)
|
|||
gdl = textRenderProjected(gdl, &x, &y, g_BossFile.teamnames[ranking->teamnum],
|
||||
g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0);
|
||||
} else {
|
||||
gdl = textRenderProjected(gdl, &x, &y, ranking->mpchr->config->name,
|
||||
char namebuffer[32];
|
||||
mpGetChrName(namebuffer, ranking->mpchr);
|
||||
gdl = textRenderProjected(gdl, &x, &y, namebuffer,
|
||||
g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -3573,6 +3575,7 @@ Gfx *menuitemPlayerStatsRender(Gfx *gdl, struct menurendercontext *context)
|
|||
u32 weight;
|
||||
s32 gap;
|
||||
s32 ypos = 0;
|
||||
char namebuffer[32];
|
||||
|
||||
mpchr = MPCHR(playernum);
|
||||
|
||||
|
|
@ -3594,7 +3597,8 @@ Gfx *menuitemPlayerStatsRender(Gfx *gdl, struct menurendercontext *context)
|
|||
x = context->x + 2;
|
||||
y = context->y + 1;
|
||||
|
||||
gdl = textRenderProjected(gdl, &x, &y, mpchr->config->name, g_CharsHandelGothicSm, g_FontHandelGothicSm,
|
||||
mpGetChrName(namebuffer, mpchr);
|
||||
gdl = textRenderProjected(gdl, &x, &y, namebuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm,
|
||||
selectioncolour, context->width, context->height, 0, 0);
|
||||
|
||||
// "Suicides" heading
|
||||
|
|
@ -3772,7 +3776,8 @@ Gfx *menuitemPlayerStatsRender(Gfx *gdl, struct menurendercontext *context)
|
|||
// Name
|
||||
x = context->x + 29;
|
||||
y = context->y + ypos;
|
||||
gdl = textRenderProjected(gdl, &x, &y, loopmpchr->config->name, g_CharsHandelGothicSm, g_FontHandelGothicSm,
|
||||
mpGetChrName(namebuffer, loopmpchr);
|
||||
gdl = textRenderProjected(gdl, &x, &y, namebuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm,
|
||||
0x00ffffff, context->width, context->height, 0, 0);
|
||||
|
||||
// Num deaths
|
||||
|
|
|
|||
|
|
@ -30,12 +30,15 @@ struct menudialogdef g_MpEndscreenSavePlayerMenuDialog;
|
|||
|
||||
s32 mpStatsForPlayerDropdownHandler(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
char buffer[32];
|
||||
|
||||
switch (operation) {
|
||||
case MENUOP_GETOPTIONCOUNT:
|
||||
data->list.value = g_MpNumChrs;
|
||||
break;
|
||||
case MENUOP_GETOPTIONTEXT:
|
||||
return (s32) g_MpChrs[data->list.value].config->name;
|
||||
mpGetChrName(g_StringPointer, &g_MpChrs[data->list.value]);
|
||||
return (s32) g_StringPointer;
|
||||
case MENUOP_SET:
|
||||
g_MpSelectedPlayersForStats[g_MpPlayerNum] = data->list.value;
|
||||
break;
|
||||
|
|
@ -375,9 +378,11 @@ char *mpMenuTextWeaponDescription(struct menuitem *item)
|
|||
char *mpMenuTitleStatsFor(struct menudialogdef *dialogdef)
|
||||
{
|
||||
struct mpchr *mpchr = MPCHR(g_MpSelectedPlayersForStats[g_MpPlayerNum]);
|
||||
char namebuffer[32];
|
||||
|
||||
// "Stats for %s"
|
||||
sprintf(g_StringPointer, langGet(L_MPMENU_280), mpchr->config->name);
|
||||
mpGetChrName(namebuffer, mpchr);
|
||||
sprintf(g_StringPointer, langGet(L_MPMENU_280), namebuffer);
|
||||
return g_StringPointer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "lib/str.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
#include "data.h"
|
||||
#include "string.h"
|
||||
#include "types.h"
|
||||
|
||||
// bss
|
||||
|
|
@ -4421,6 +4422,24 @@ s32 mpGetNumChrs(void)
|
|||
return g_MpNumChrs;
|
||||
}
|
||||
|
||||
void mpGetChrName(char *buffer, struct mpchr *mpchr)
|
||||
{
|
||||
if (mpchr->isbot) {
|
||||
char basename[16];
|
||||
s32 len;
|
||||
|
||||
// mpchr->config->name is something like "MeatSim\n"
|
||||
// The line break must be removed
|
||||
strcpy(basename, mpchr->config->name);
|
||||
len = strlen(basename);
|
||||
basename[len - 1] = '\0';
|
||||
|
||||
sprintf(buffer, "%s:%d\n", basename, mpchr->chr->aibot->aibotnum + 1);
|
||||
} else {
|
||||
strcpy(buffer, mpchr->config->name);
|
||||
}
|
||||
}
|
||||
|
||||
u8 mpFindUnusedTeamNum(void)
|
||||
{
|
||||
u8 teamnum = 0;
|
||||
|
|
@ -4605,52 +4624,17 @@ s32 mpFindBotProfile(s32 type, s32 difficulty)
|
|||
|
||||
void mpGenerateBotNames(void)
|
||||
{
|
||||
s32 counts[ARRAYCOUNT(g_BotProfiles)];
|
||||
s32 profilenum;
|
||||
s32 i;
|
||||
char name[16];
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_BotProfiles); i++) {
|
||||
counts[i] = 0;
|
||||
}
|
||||
|
||||
// Count the number of bots using each profile (MeatSim, TurtleSim etc)
|
||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - 4].type, g_BotConfigsArray[i - 4].difficulty);
|
||||
|
||||
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
||||
counts[profilenum]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Profiles with only one bot don't need to have to number appended to the
|
||||
// name, so mark those as -1. For profiles with multiple bots, reset them
|
||||
// to 0 because they'll be a counter for the final loop.
|
||||
for (i = 0; i < ARRAYCOUNT(g_BotProfiles); i++) {
|
||||
if (counts[i] <= 1) {
|
||||
counts[i] = -1;
|
||||
} else {
|
||||
counts[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 4; i < MAX_MPCHRS; i++) {
|
||||
if (g_MpSetup.chrslots & (1 << i)) {
|
||||
profilenum = mpFindBotProfile(g_BotConfigsArray[i - 4].type, g_BotConfigsArray[i - 4].difficulty);
|
||||
|
||||
if (profilenum >= 0 && profilenum < ARRAYCOUNT(g_BotProfiles)) {
|
||||
if (counts[profilenum] >= 0) {
|
||||
// Multiple bots using this profile - append the number
|
||||
counts[profilenum]++;
|
||||
sprintf(name, "%s:%d\n", langGet(g_BotProfiles[profilenum].name), counts[profilenum]);
|
||||
strcpy(g_BotConfigsArray[i - 4].base.name, name);
|
||||
} else {
|
||||
// One bots using this profile - just use the profile name
|
||||
sprintf(name, "%s\n", langGet(g_BotProfiles[profilenum].name));
|
||||
strcpy(g_BotConfigsArray[i - 4].base.name, name);
|
||||
}
|
||||
sprintf(name, "%s\n", langGet(g_BotProfiles[profilenum].name));
|
||||
strcpy(g_BotConfigsArray[i - 4].base.name, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1096,6 +1096,7 @@ s32 scenarioPickUpBriefcase(struct chrdata *chr, struct prop *prop)
|
|||
char text1[64];
|
||||
char text2[64];
|
||||
char text3[64];
|
||||
char namebuffer[32];
|
||||
struct mpchr *mpchr;
|
||||
|
||||
if (g_MpSetup.scenario == MPSCENARIO_HOLDTHEBRIEFCASE) {
|
||||
|
|
@ -1116,7 +1117,9 @@ s32 scenarioPickUpBriefcase(struct chrdata *chr, struct prop *prop)
|
|||
}
|
||||
|
||||
// "%shas the\n%s"
|
||||
sprintf(text1, langGet(L_MPWEAPONS_000), mpchr->config->name, bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
mpGetChrName(namebuffer, mpchr);
|
||||
|
||||
sprintf(text1, langGet(L_MPWEAPONS_000), namebuffer, bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
|
||||
prevplayernum = g_Vars.currentplayernum;
|
||||
|
||||
|
|
@ -1172,14 +1175,16 @@ s32 scenarioPickUpBriefcase(struct chrdata *chr, struct prop *prop)
|
|||
invRemoveItemByNum(WEAPON_BRIEFCASE2);
|
||||
}
|
||||
|
||||
mpGetChrName(namebuffer, mpchr);
|
||||
|
||||
// "You captured the %s%s"
|
||||
sprintf(text1, langGet(L_MPWEAPONS_004), g_BossFile.teamnames[i], bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
|
||||
// "%scaptured our %s"
|
||||
sprintf(text2, langGet(L_MPWEAPONS_005), mpchr->config->name, bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
sprintf(text2, langGet(L_MPWEAPONS_005), namebuffer, bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
|
||||
// "%scaptured the %s%s"
|
||||
sprintf(text3, langGet(L_MPWEAPONS_006), mpchr->config->name, g_BossFile.teamnames[i], bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
sprintf(text3, langGet(L_MPWEAPONS_006), namebuffer, g_BossFile.teamnames[i], bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
|
||||
prevplayernum = g_Vars.currentplayernum;
|
||||
|
||||
|
|
@ -1218,11 +1223,13 @@ s32 scenarioPickUpBriefcase(struct chrdata *chr, struct prop *prop)
|
|||
|
||||
g_ScenarioData.ctc.tokens[weapon->team] = chr->prop;
|
||||
|
||||
mpGetChrName(namebuffer, mpchr);
|
||||
|
||||
// "%shas the %s%s"
|
||||
sprintf(text1, langGet(L_MPWEAPONS_001), mpchr->config->name, g_BossFile.teamnames[weapon->team], bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
sprintf(text1, langGet(L_MPWEAPONS_001), namebuffer, g_BossFile.teamnames[weapon->team], bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
|
||||
// "%shas our %s"
|
||||
sprintf(text2, langGet(L_MPWEAPONS_002), mpchr->config->name, bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
sprintf(text2, langGet(L_MPWEAPONS_002), namebuffer, bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
|
||||
// "Got the %s%s"
|
||||
sprintf(text3, langGet(L_MPWEAPONS_003), g_BossFile.teamnames[weapon->team], bgunGetShortName(WEAPON_BRIEFCASE2));
|
||||
|
|
@ -1326,6 +1333,7 @@ s32 scenarioPickUpUplink(struct chrdata *chr, struct prop *prop)
|
|||
{
|
||||
s32 i;
|
||||
char message[64];
|
||||
char namebuffer[32];
|
||||
struct mpchr *mpchr;
|
||||
u32 playernum;
|
||||
|
||||
|
|
@ -1342,8 +1350,10 @@ s32 scenarioPickUpUplink(struct chrdata *chr, struct prop *prop)
|
|||
mpchr = MPCHR(g_Vars.playerstats[g_Vars.currentplayernum].mpindex);
|
||||
}
|
||||
|
||||
mpGetChrName(namebuffer, mpchr);
|
||||
|
||||
// "%shas the\n%s"
|
||||
sprintf(message, langGet(L_MPWEAPONS_000), mpchr->config->name, bgunGetShortName(WEAPON_DATAUPLINK));
|
||||
sprintf(message, langGet(L_MPWEAPONS_000), namebuffer, bgunGetShortName(WEAPON_DATAUPLINK));
|
||||
|
||||
playernum = g_Vars.currentplayernum;
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ void pacApplyNextVictim(void)
|
|||
struct scenariodata_pac *data = &g_ScenarioData.pac;
|
||||
s32 vplayernum;
|
||||
char text[64];
|
||||
char namebuffer[32];
|
||||
s32 i;
|
||||
|
||||
data->victimindex++;
|
||||
|
|
@ -209,9 +210,11 @@ void pacApplyNextVictim(void)
|
|||
if (vplayernum == i) {
|
||||
sprintf(text, langGet(L_MPWEAPONS_013)); // "You are the victim!"
|
||||
} else if (scenarioChrsAreSameTeam(vplayernum, i)) {
|
||||
sprintf(text, langGet(L_MPWEAPONS_014), g_MpChrs[vplayernum].config->name); // "Protect %s!"
|
||||
mpGetChrName(namebuffer, &g_MpChrs[vplayernum]);
|
||||
sprintf(text, langGet(L_MPWEAPONS_014), namebuffer); // "Protect %s!"
|
||||
} else {
|
||||
sprintf(text, langGet(L_MPWEAPONS_015), g_MpChrs[vplayernum].config->name); // "Get %s!"
|
||||
mpGetChrName(namebuffer, &g_MpChrs[vplayernum]);
|
||||
sprintf(text, langGet(L_MPWEAPONS_015), namebuffer); // "Get %s!"
|
||||
}
|
||||
|
||||
scenarioCreateHudmsg(i, text);
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ void mpstatsRecordDeath(s32 aplayernum, s32 vplayernum)
|
|||
struct mpchr *ampchr = NULL;
|
||||
s32 prevplayernum;
|
||||
char text[256];
|
||||
char namebuffer[32];
|
||||
|
||||
if (g_Vars.normmplayerisrunning && g_MpSetup.scenario == MPSCENARIO_POPACAP) {
|
||||
pacHandleDeath(aplayernum, vplayernum);
|
||||
|
|
@ -246,7 +247,8 @@ void mpstatsRecordDeath(s32 aplayernum, s32 vplayernum)
|
|||
|
||||
if (g_Vars.normmplayerisrunning && aplayernum >= 0) {
|
||||
// "Killed by %s"
|
||||
sprintf(text, "%s %s", langGet(L_MISC_183), g_MpChrs[aplayernum].config->name);
|
||||
mpGetChrName(namebuffer, &g_MpChrs[aplayernum]);
|
||||
sprintf(text, "%s %s", langGet(L_MISC_183), namebuffer);
|
||||
hudmsgCreate(text, HUDMSGTYPE_DEFAULT);
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +268,8 @@ void mpstatsRecordDeath(s32 aplayernum, s32 vplayernum)
|
|||
|
||||
if (g_Vars.normmplayerisrunning && vplayernum >= 0) {
|
||||
// "Killed %s"
|
||||
sprintf(text, "%s %s", langGet(L_MISC_184), g_MpChrs[vplayernum].config->name);
|
||||
mpGetChrName(namebuffer, &g_MpChrs[vplayernum]);
|
||||
sprintf(text, "%s %s", langGet(L_MISC_184), namebuffer);
|
||||
hudmsgCreate(text, HUDMSGTYPE_DEFAULT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ struct mpchrconfig *mpGetChrConfigBySlotNum(s32 slot);
|
|||
s32 mpGetChrIndexBySlotNum(s32 slot);
|
||||
s32 mpGetNumConfigs(void);
|
||||
s32 mpGetNumChrs(void);
|
||||
void mpGetChrName(char *buffer, struct mpchr *mpchr);
|
||||
u8 mpFindUnusedTeamNum(void);
|
||||
void mpCreateBotFromProfile(s32 botnum, u8 difficulty);
|
||||
void mpSetBotDifficulty(s32 botnum, s32 difficulty);
|
||||
|
|
|
|||
Loading…
Reference in New Issue