From cd9879edcfb1acc42559f418fca36d22ef6ecf1a Mon Sep 17 00:00:00 2001 From: Scott Brooks Date: Wed, 12 Jun 2002 03:37:38 +0000 Subject: [PATCH] some fixes for the add bot code --- reaction/game/g_bot.c | 37 ++++++++++++++++++------------------- reaction/game/g_client.c | 5 ++++- reaction/game/g_main.c | 6 ++++++ 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/reaction/game/g_bot.c b/reaction/game/g_bot.c index f658c7a6..784e33d6 100644 --- a/reaction/game/g_bot.c +++ b/reaction/game/g_bot.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.11 2002/06/12 03:37:38 blaze +// some fixes for the add bot code +// // Revision 1.10 2002/06/02 22:23:27 makro // no message // @@ -616,45 +619,42 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay Info_SetValueForKey( userinfo, "handicap", "90" ); } - key = "model"; - model = Info_ValueForKey( botinfo, key ); + + model = Info_ValueForKey( botinfo, "model" ); if ( !*model ) { // Elder: changed to our default model = "grunt/resdog"; } - Info_SetValueForKey( userinfo, key, model ); - key = "team_model"; - Info_SetValueForKey( userinfo, key, model ); - key = "headmodel"; - headmodel = Info_ValueForKey( botinfo, key ); + Info_SetValueForKey( userinfo, "model", model ); + + Info_SetValueForKey( userinfo, "team_model", model ); + + headmodel = Info_ValueForKey( botinfo, "headmodel" ); if ( !*headmodel ) { headmodel = model; } - Info_SetValueForKey( userinfo, key, headmodel ); - key = "team_headmodel"; - Info_SetValueForKey( userinfo, key, headmodel ); + Info_SetValueForKey( userinfo, "headmodel", headmodel ); + + Info_SetValueForKey( userinfo, "team_headmodel", headmodel ); - key = "gender"; - s = Info_ValueForKey( botinfo, key ); + s = Info_ValueForKey( botinfo, "gender" ); if ( !*s ) { s = "male"; } Info_SetValueForKey( userinfo, "sex", s ); - key = "color1"; - s = Info_ValueForKey( botinfo, key ); + s = Info_ValueForKey( botinfo, "color1"); if ( !*s ) { s = "4"; } - Info_SetValueForKey( userinfo, key, s ); + Info_SetValueForKey( userinfo, "color1", s ); - key = "color2"; - s = Info_ValueForKey( botinfo, key ); + s = Info_ValueForKey( botinfo, "color2" ); if ( !*s ) { s = "5"; } - Info_SetValueForKey( userinfo, key, s ); + Info_SetValueForKey( userinfo, "color2", s ); s = Info_ValueForKey(botinfo, "aifile"); if (!*s ) { @@ -906,7 +906,6 @@ static void G_LoadBotsFromFile( char *filename ) { trap_FS_Read( buf, len, f ); buf[len] = 0; trap_FS_FCloseFile( f ); - g_numBots += G_ParseInfos( buf, MAX_BOTS - g_numBots, &g_botInfos[g_numBots] ); } diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index b629b028..202f0934 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.89 2002/06/12 03:37:38 blaze +// some fixes for the add bot code +// // Revision 1.88 2002/06/11 23:37:27 blaze // moved the cheat cvars to be sent at a different time, should work better // @@ -1030,7 +1033,7 @@ void ClientUserinfoChanged( int clientNum ) { Q_strncpyz( model, Info_ValueForKey (userinfo, "model"), sizeof( model ) ); Q_strncpyz( headModel, Info_ValueForKey (userinfo, "headmodel"), sizeof( headModel ) ); } - + //Com_Printf("%s model=(%s)\n",client->pers.netname, model); if (g_gametype.integer == GT_TEAMPLAY) { if (client->sess.sessionTeam == TEAM_RED) { Q_strncpyz(model2, g_RQ3_team1model.string, sizeof(model)); diff --git a/reaction/game/g_main.c b/reaction/game/g_main.c index c90f9fbb..ecbdb0be 100644 --- a/reaction/game/g_main.c +++ b/reaction/game/g_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.73 2002/06/12 03:37:38 blaze +// some fixes for the add bot code +// // Revision 1.72 2002/06/11 01:43:08 blaze // g_rq3_cvarfile allows you to change which file holds the restricted cvars // @@ -733,17 +736,20 @@ void RQ3_loadmodels (void) numdirs = trap_FS_GetFileList("models/players", "/", dirlist, sizeof(dirlist)); dirptr = dirlist; modelcount = 0; + for (i=0; i < numdirs; i++, dirptr += dirlen+1) { dirlen = strlen(dirptr); if (dirlen && dirptr[dirlen-1]=='/') dirptr[dirlen-1]='\0'; if (!strcmp(dirptr, ".") || !strcmp(dirptr, "..")) continue; + Com_Printf("models (%s)\n",dirptr); len = trap_FS_FOpenFile(va("models/players/%s/rq3model.cfg", dirptr), &file, FS_READ); if (file) { trap_FS_Read(buf, len, file); buf[len] = 0; text_p = buf; trap_FS_FCloseFile (file); + Com_Printf("Adding %s as a legit model\n",dirptr); Com_sprintf(legitmodels[modelcount].name, sizeof(legitmodels[modelcount].name), "%s", dirptr); for (j=0; j < 3; j++) { token = COM_Parse(&text_p);