Introduce bot quantities

This commit is contained in:
Ryan Dwyer 2022-11-06 16:43:00 +10:00
parent 94717149a0
commit 01af8825cb
7 changed files with 99 additions and 17 deletions

View File

@ -4840,8 +4840,8 @@
"es": "Press START!\n"
},
{
"id": "L_MPMENU_484",
"en": "Searching for Camera!\n",
"id": "L_MPMENU_QUANTITY",
"en": "Quantity\n",
"gb": "Searching for Camera!\n",
"jp": "Calibrating Camera\n",
"it": "Searching for Camera!\n",

View File

@ -272,17 +272,17 @@ Gfx *menuRenderBanner(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, bool big, s32 ms
struct font *font;
static u16 msgs[] = {
L_MPMENU_484, // "Searching for Camera!"
L_MPMENU_485, // "Calibrating Camera"
L_MPMENU_486, // "Downloading Image"
L_MPMENU_487, // "Loading Image"
L_MPMENU_488, // "Saving Image"
L_MPMENU_489, // "Transferring Image"
L_MPMENU_490, // "Uploading Segment"
0, // "Searching for Camera!"
0, // "Calibrating Camera"
0, // "Downloading Image"
0, // "Loading Image"
0, // "Saving Image"
0, // "Transferring Image"
0, // "Uploading Segment"
L_MPMENU_491, // "Checking Controller Pak"
L_MPMENU_492, // "Getting PerfectHead"
L_MPMENU_493, // "Saving PerfectHead"
L_MPMENU_494, // "Auto Camera Adjustment"
0, // "Getting PerfectHead"
0, // "Saving PerfectHead"
0, // "Auto Camera Adjustment"
};
chars = g_CharsHandelGothicSm;

View File

@ -409,6 +409,7 @@ void func0f1881d4(s32 index)
g_BotConfigsArray[index].base.mpbodynum = MPBODY_DARK_COMBAT;
g_BotConfigsArray[index].type = BOTTYPE_GENERAL;
g_BotConfigsArray[index].difficulty = BOTDIFF_DISABLED;
g_BotConfigsArray[index].quantity = 1;
}
void mpInit(void)
@ -4495,6 +4496,7 @@ void mpCreateBotFromProfile(s32 botnum, u8 profilenum)
g_BotConfigsArray[botnum].type = g_BotProfiles[profilenum].type;
g_BotConfigsArray[botnum].difficulty = g_BotProfiles[profilenum].difficulty;
g_BotConfigsArray[botnum].quantity = g_BotQuantity;
if (botnum < 8) {
for (i = 0; i < 4; i++) {
@ -5169,6 +5171,7 @@ void mpApplyConfig(struct mpconfigfull *config)
for (i = 0; i < 8; i++) {
g_BotConfigsArray[i].type = config->config.simulants[i].type;
g_BotConfigsArray[i].quantity = 1;
for (j = 0; j < 4; j++) {
g_MpSimulantDifficultiesPerNumPlayers[i][j] = config->config.simulants[i].difficulties[j];
@ -5249,6 +5252,7 @@ void mpsetupfileLoadWad(struct savebuffer *buffer)
g_BotConfigsArray[i].base.name[0] = '\0';
g_BotConfigsArray[i].type = savebufferReadBits(buffer, 5);
g_BotConfigsArray[i].difficulty = savebufferReadBits(buffer, 3);
g_BotConfigsArray[i].quantity = 1;
for (j = 0; j < 4; j++) {
g_MpSimulantDifficultiesPerNumPlayers[i][j] = g_BotConfigsArray[i].difficulty;

View File

@ -23,6 +23,8 @@
#include "gbiex.h"
#include "types.h"
s32 g_BotQuantity = 1;
struct menuitem g_MpCharacterMenuItems[];
struct menudialogdef g_MpAddSimulantMenuDialog;
struct menudialogdef g_MpChangeSimulantMenuDialog;
@ -2824,6 +2826,42 @@ s32 menuhandlerMpClearAllSimulants(s32 operation, struct menuitem *item, union h
return 0;
}
s32 menuhandlerIndividualBotQuantity(s32 operation, struct menuitem *item, union handlerdata *data)
{
s32 botnum = g_Menus[g_MpPlayerNum].mpsetup.slotindex;
switch (operation) {
case MENUOP_GETSLIDER:
data->slider.value = g_BotConfigsArray[botnum].quantity;
break;
case MENUOP_SET:
g_BotConfigsArray[botnum].quantity = data->slider.value > 0 ? data->slider.value : 1;
break;
case MENUOP_GETSLIDERLABEL:
sprintf(data->slider.label, "%d\n", g_BotConfigsArray[botnum].quantity);
break;
}
return 0;
}
s32 menuhandlerBotQuantity(s32 operation, struct menuitem *item, union handlerdata *data)
{
switch (operation) {
case MENUOP_GETSLIDER:
data->slider.value = g_BotQuantity;
break;
case MENUOP_SET:
g_BotQuantity = data->slider.value > 0 ? data->slider.value : 1;
break;
case MENUOP_GETSLIDERLABEL:
sprintf(data->slider.label, "%d\n", g_BotQuantity);
break;
}
return 0;
}
s32 menuhandlerMpAddSimulant(s32 operation, struct menuitem *item, union handlerdata *data)
{
switch (operation) {
@ -2861,6 +2899,17 @@ s32 menuhandlerMpSimulantSlot(s32 operation, struct menuitem *item, union handle
return 0;
}
char *mpMenuTextAddSimulantsLabel(struct menuitem *item)
{
if (g_BotQuantity == 1) {
return "Add Simulant...\n";
}
sprintf(g_StringPointer, "Add %d Simulants...\n", g_BotQuantity);
return g_StringPointer;
}
char *mpMenuTextSimulantName(struct menuitem *item)
{
s32 index = item->param;
@ -2869,7 +2918,9 @@ char *mpMenuTextSimulantName(struct menuitem *item)
return "";
}
return g_BotConfigsArray[index].base.name;
sprintf(g_StringPointer, "%dx %s", g_BotConfigsArray[index].quantity, g_BotConfigsArray[index].base.name);
return g_StringPointer;
}
s32 menudialogMpSimulants(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data)
@ -2973,6 +3024,14 @@ struct menuitem g_MpEditSimulantMenuItems[] = {
0,
(void *)&g_MpSimulantCharacterMenuDialog,
},
{
MENUITEMTYPE_SLIDER,
0,
MENUITEMFLAG_LOCKABLEMINOR,
L_MPMENU_QUANTITY,
1000,
menuhandlerIndividualBotQuantity,
},
{
MENUITEMTYPE_SEPARATOR,
0,
@ -3010,11 +3069,19 @@ struct menudialogdef g_MpEditSimulantMenuDialog = {
};
struct menuitem g_MpSimulantsMenuItems[] = {
{
MENUITEMTYPE_SLIDER,
0,
MENUITEMFLAG_LOCKABLEMINOR,
L_MPMENU_QUANTITY,
1000,
menuhandlerBotQuantity,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_LOCKABLEMINOR,
L_MPMENU_084, // "Add Simulant..."
(u32)&mpMenuTextAddSimulantsLabel,
0,
menuhandlerMpAddSimulant,
},
@ -3297,6 +3364,12 @@ char *mpMenuTextChrNameForTeamSetup(struct menuitem *item)
struct mpchrconfig *mpchr = mpGetChrConfigBySlotNum(item->param);
if (mpchr) {
if (mpchr >= &g_BotConfigsArray[0].base && mpchr < &g_BotConfigsArray[MAX_BOTS].base) {
struct mpbotconfig *botconfig = (struct mpbotconfig *) mpchr;
sprintf(g_StringPointer, "%dx %s\n", botconfig->quantity, mpchr->name);
return g_StringPointer;
}
return mpchr->name;
}

View File

@ -809,7 +809,7 @@ s32 setupGetNumRequestedBots(void)
if (g_Vars.normmplayerisrunning && mpHasSimulants()) {
for (i = 0; i < MAX_BOTS; i++) {
if ((g_MpSetup.chrslots & (1 << (i + 4))) && mpIsSimSlotEnabled(i)) {
numbots++;
numbots += g_BotConfigsArray[i].quantity;
}
}
}
@ -827,6 +827,7 @@ void setupAllocateEverything(void)
s32 numbotsrequested;
bool haslaptops = false;
s32 i;
s32 j;
// Count how many bots were requested
numbotsrequested = setupGetNumRequestedBots();
@ -862,8 +863,10 @@ void setupAllocateEverything(void)
for (i = 0; i < MAX_BOTS; i++) {
if ((g_MpSetup.chrslots & (1 << (i + 4))) && mpIsSimSlotEnabled(i)) {
botmgrAllocateBot(chrnum, i);
chrnum++;
for (j = 0; j < g_BotConfigsArray[i].quantity; j++) {
botmgrAllocateBot(chrnum, i);
chrnum++;
}
}
}
}

View File

@ -491,6 +491,7 @@ extern s32 var80087260;
extern bool g_MpEnableMusicSwitching;
extern struct mpweapon g_MpWeapons[NUM_MPWEAPONS];
extern struct mphead g_MpHeads[NUM_MPHEADS];
extern s32 g_BotQuantity;
extern struct botprofile g_BotProfiles[18];
extern struct mpbody g_MpBodies[NUM_MPBODIES];
extern struct mppreset g_MpPresets[NUM_MPPRESETS];

View File

@ -4201,6 +4201,7 @@ struct mpbotconfig {
/*0x44*/ u8 unk44[3];
/*0x47*/ u8 type;
/*0x48*/ u8 difficulty;
/*0x4a*/ u16 quantity;
};
struct missionconfig {