Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Unofficial Quake III Arena gamecode patch
* damage-based hitsounds
* colored skins
* high-quality proportional font renderer
* added `handicap` parameter to `addbot` command
* single-line cvar declaration, improved cvar code readability and development efficiency
* single-line event (EV_*) declaration
* single-line mean of death (MOD_*) declaration
Expand Down
36 changes: 25 additions & 11 deletions code/game/g_bot.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ qboolean G_BotConnect( int clientNum, qboolean restart ) {
G_AddBot
===============
*/
static void G_AddBot( const char *name, float skill, const char *team, int delay, const char *altname ) {
static void G_AddBot( const char *name, float skill, const char *team, int delay,
const char *altname, const char *handicap ) {
int clientNum;
char *botinfo;
gentity_t *bot;
Expand Down Expand Up @@ -601,14 +602,18 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
Info_SetValueForKey( userinfo, "snaps", va( "%i", sv_fps.integer ) );
Info_SetValueForKey( userinfo, "skill", va("%1.2f", skill) );

if ( skill >= 1 && skill < 2 ) {
Info_SetValueForKey( userinfo, "handicap", "50" );
}
else if ( skill >= 2 && skill < 3 ) {
Info_SetValueForKey( userinfo, "handicap", "70" );
}
else if ( skill >= 3 && skill < 4 ) {
Info_SetValueForKey( userinfo, "handicap", "90" );
if ( strlen( handicap ) ) {
Info_SetValueForKey( userinfo, "handicap", handicap );
} else {
if ( skill >= 1 && skill < 2 ) {
Info_SetValueForKey( userinfo, "handicap", "50" );
}
else if ( skill >= 2 && skill < 3 ) {
Info_SetValueForKey( userinfo, "handicap", "70" );
}
else if ( skill >= 3 && skill < 4 ) {
Info_SetValueForKey( userinfo, "handicap", "90" );
}
}

key = "model";
Expand Down Expand Up @@ -707,6 +712,7 @@ void Svcmd_AddBot_f( void ) {
char altname[MAX_TOKEN_CHARS];
char string[MAX_TOKEN_CHARS];
char team[MAX_TOKEN_CHARS];
char handicap[32];

// are bots enabled?
if ( !trap_Cvar_VariableIntegerValue( "bot_enable" ) ) {
Expand All @@ -716,7 +722,7 @@ void Svcmd_AddBot_f( void ) {
// name
trap_Argv( 1, name, sizeof( name ) );
if ( !name[0] ) {
trap_Print( "Usage: Addbot <botname> [skill 1-5] [team] [msec delay] [altname]\n" );
trap_Print( "Usage: Addbot <botname> [skill 1-5] [team] [msec delay] [altname] [handicap]\n" );
return;
}

Expand Down Expand Up @@ -748,7 +754,15 @@ void Svcmd_AddBot_f( void ) {
// alternative name
trap_Argv( 5, altname, sizeof( altname ) );

G_AddBot( name, skill, team, delay, altname );
trap_Argv( 6, handicap, sizeof( handicap ) );
if ( !g_cheats.integer ) {
if ( strlen( handicap ) ) {
G_Printf( S_COLOR_YELLOW "addbot: setting handicap for bots is cheat protected, will use default\n" );
}
handicap[0] = '\0';
}

G_AddBot( name, skill, team, delay, altname, handicap );

// if this was issued during gameplay and we are playing locally,
// go ahead and load the bot's media immediately
Expand Down