some fixes for the add bot code

This commit is contained in:
Scott Brooks 2002-06-12 03:37:38 +00:00
parent 439c0947e8
commit cd9879edcf
3 changed files with 28 additions and 20 deletions

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $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 // Revision 1.10 2002/06/02 22:23:27 makro
// no message // 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" ); Info_SetValueForKey( userinfo, "handicap", "90" );
} }
key = "model";
model = Info_ValueForKey( botinfo, key ); model = Info_ValueForKey( botinfo, "model" );
if ( !*model ) { if ( !*model ) {
// Elder: changed to our default // Elder: changed to our default
model = "grunt/resdog"; model = "grunt/resdog";
} }
Info_SetValueForKey( userinfo, key, model );
key = "team_model";
Info_SetValueForKey( userinfo, key, model );
key = "headmodel"; Info_SetValueForKey( userinfo, "model", model );
headmodel = Info_ValueForKey( botinfo, key );
Info_SetValueForKey( userinfo, "team_model", model );
headmodel = Info_ValueForKey( botinfo, "headmodel" );
if ( !*headmodel ) { if ( !*headmodel ) {
headmodel = model; headmodel = model;
} }
Info_SetValueForKey( userinfo, key, headmodel ); Info_SetValueForKey( userinfo, "headmodel", headmodel );
key = "team_headmodel";
Info_SetValueForKey( userinfo, key, headmodel ); Info_SetValueForKey( userinfo, "team_headmodel", headmodel );
key = "gender"; s = Info_ValueForKey( botinfo, "gender" );
s = Info_ValueForKey( botinfo, key );
if ( !*s ) { if ( !*s ) {
s = "male"; s = "male";
} }
Info_SetValueForKey( userinfo, "sex", s ); Info_SetValueForKey( userinfo, "sex", s );
key = "color1"; s = Info_ValueForKey( botinfo, "color1");
s = Info_ValueForKey( botinfo, key );
if ( !*s ) { if ( !*s ) {
s = "4"; s = "4";
} }
Info_SetValueForKey( userinfo, key, s ); Info_SetValueForKey( userinfo, "color1", s );
key = "color2"; s = Info_ValueForKey( botinfo, "color2" );
s = Info_ValueForKey( botinfo, key );
if ( !*s ) { if ( !*s ) {
s = "5"; s = "5";
} }
Info_SetValueForKey( userinfo, key, s ); Info_SetValueForKey( userinfo, "color2", s );
s = Info_ValueForKey(botinfo, "aifile"); s = Info_ValueForKey(botinfo, "aifile");
if (!*s ) { if (!*s ) {
@ -906,7 +906,6 @@ static void G_LoadBotsFromFile( char *filename ) {
trap_FS_Read( buf, len, f ); trap_FS_Read( buf, len, f );
buf[len] = 0; buf[len] = 0;
trap_FS_FCloseFile( f ); trap_FS_FCloseFile( f );
g_numBots += G_ParseInfos( buf, MAX_BOTS - g_numBots, &g_botInfos[g_numBots] ); g_numBots += G_ParseInfos( buf, MAX_BOTS - g_numBots, &g_botInfos[g_numBots] );
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $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 // Revision 1.88 2002/06/11 23:37:27 blaze
// moved the cheat cvars to be sent at a different time, should work better // 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( model, Info_ValueForKey (userinfo, "model"), sizeof( model ) );
Q_strncpyz( headModel, Info_ValueForKey (userinfo, "headmodel"), sizeof( headModel ) ); 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 (g_gametype.integer == GT_TEAMPLAY) {
if (client->sess.sessionTeam == TEAM_RED) { if (client->sess.sessionTeam == TEAM_RED) {
Q_strncpyz(model2, g_RQ3_team1model.string, sizeof(model)); Q_strncpyz(model2, g_RQ3_team1model.string, sizeof(model));

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $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 // Revision 1.72 2002/06/11 01:43:08 blaze
// g_rq3_cvarfile allows you to change which file holds the restricted cvars // 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)); numdirs = trap_FS_GetFileList("models/players", "/", dirlist, sizeof(dirlist));
dirptr = dirlist; dirptr = dirlist;
modelcount = 0; modelcount = 0;
for (i=0; i < numdirs; i++, dirptr += dirlen+1) { for (i=0; i < numdirs; i++, dirptr += dirlen+1) {
dirlen = strlen(dirptr); dirlen = strlen(dirptr);
if (dirlen && dirptr[dirlen-1]=='/') dirptr[dirlen-1]='\0'; if (dirlen && dirptr[dirlen-1]=='/') dirptr[dirlen-1]='\0';
if (!strcmp(dirptr, ".") || !strcmp(dirptr, "..")) if (!strcmp(dirptr, ".") || !strcmp(dirptr, ".."))
continue; continue;
Com_Printf("models (%s)\n",dirptr);
len = trap_FS_FOpenFile(va("models/players/%s/rq3model.cfg", dirptr), &file, FS_READ); len = trap_FS_FOpenFile(va("models/players/%s/rq3model.cfg", dirptr), &file, FS_READ);
if (file) { if (file) {
trap_FS_Read(buf, len, file); trap_FS_Read(buf, len, file);
buf[len] = 0; buf[len] = 0;
text_p = buf; text_p = buf;
trap_FS_FCloseFile (file); 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); Com_sprintf(legitmodels[modelcount].name, sizeof(legitmodels[modelcount].name), "%s", dirptr);
for (j=0; j < 3; j++) { for (j=0; j < 3; j++) {
token = COM_Parse(&text_p); token = COM_Parse(&text_p);