Browse Source

Merge branch 'bot10-yggverse' into respawn-bots-configured-2

respawn-bots-configured-2
d47081 11 months ago committed by GitHub
parent
commit
fa56588b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      dlls/bot/bot.cpp
  2. 4
      dlls/client.cpp

17
dlls/bot/bot.cpp

@ -56,22 +56,25 @@ respawn_t bot_respawn[32] = {
{FALSE, BOT_IDLE, "", "", "", NULL}, {FALSE, BOT_IDLE, "", "", "", NULL}, {FALSE, BOT_IDLE, "", "", "", NULL}, {FALSE, BOT_IDLE, "", "", "", NULL},
{FALSE, BOT_IDLE, "", "", "", NULL}, {FALSE, BOT_IDLE, "", "", "", NULL}}; {FALSE, BOT_IDLE, "", "", "", NULL}, {FALSE, BOT_IDLE, "", "", "", NULL}};
#define MAX_SKINS 10 #define MAX_SKINS 11
// indicate which models are currently used for random model allocation // indicate which models are currently used for random model allocation
BOOL skin_used[MAX_SKINS] = { BOOL skin_used[MAX_SKINS] = {
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
FALSE, FALSE, FALSE, FALSE, FALSE}; FALSE, FALSE, FALSE, FALSE, FALSE,
FALSE};
// store the names of the models... // store the names of the models...
const char *bot_skins[MAX_SKINS] = { const char *bot_skins[MAX_SKINS] = {
"barney", "gina", "gman", "gordon", "helmet", "barney", "gina", "gman", "gordon", "helmet",
"hgrunt", "recon", "robo", "scientist", "zombie"}; "hgrunt", "recon", "robo", "scientist", "zombie",
"huylo"};
// store the player names for each of the models... // store the player names for each of the models...
const char *bot_names[MAX_SKINS] = { const char *bot_names[MAX_SKINS] = {
"Barney", "Gina", "G-Man", "Gordon", "Helmet", "Barney", "Gina", "G-Man", "Gordon", "Helmet",
"H-Grunt", "Recon", "Robo", "Scientist", "Zombie"}; "H-Grunt", "Recon", "Robo", "Scientist", "Zombie",
"Huylo"};
// how often (out of 1000 times) the bot will pause, based on bot skill // how often (out of 1000 times) the bot will pause, based on bot skill
float pause_frequency[5] = {4, 7, 10, 15, 20}; float pause_frequency[5] = {4, 7, 10, 15, 20};
@ -140,7 +143,7 @@ void BotCreate(const char *skin, const char *name, const char *skill)
if ((skin == NULL) || (*skin == 0)) if ((skin == NULL) || (*skin == 0))
{ {
// pick a random skin // pick a random skin
index = RANDOM_LONG(0, 9); // there are ten possible skins index = RANDOM_LONG(0, 10); // there are ten possible skins
// check if this skin has already been used... // check if this skin has already been used...
while (skin_used[index] == TRUE) while (skin_used[index] == TRUE)
@ -228,9 +231,9 @@ void BotCreate(const char *skin, const char *name, const char *skill)
if (IS_DEDICATED_SERVER()) if (IS_DEDICATED_SERVER())
printf("use barney, gina, gman, gordon, helmet, hgrunt,\n"); printf("use barney, gina, gman, gordon, helmet, hgrunt,\n");
UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_ClientPrintAll( HUD_PRINTNOTIFY,
" recon, robo, scientist, or zombie\n"); " recon, robo, scientist, zombie or huylo\n");
if (IS_DEDICATED_SERVER()) if (IS_DEDICATED_SERVER())
printf(" recon, robo, scientist, or zombie\n"); printf(" recon, robo, scientist, zombie or huylo\n");
return; return;
} }
} }

4
dlls/client.cpp

@ -1368,7 +1368,7 @@ void StartFrame( void )
// if there are currently less than the maximum number of "players" // if there are currently less than the maximum number of "players"
// then add another bot using the default skill level... // then add another bot using the default skill level...
if( count < max_bots ) if( ( count < max_bots ) && ( gpGlobals->time >= respawn_time ) )
{ {
for( i = 0; i < 32; i++ ) for( i = 0; i < 32; i++ )
{ {
@ -1378,6 +1378,8 @@ void StartFrame( void )
bot_respawn[index].is_used = FALSE; // free up this slot bot_respawn[index].is_used = FALSE; // free up this slot
BotCreate( bot_respawn[i].skin, bot_respawn[i].name, bot_respawn[i].skill ); BotCreate( bot_respawn[i].skin, bot_respawn[i].name, bot_respawn[i].skill );
respawn_time = gpGlobals->time + 1.0; // set next respawn time
break; break;
} }
} }

Loading…
Cancel
Save