# HG changeset patch # User Adam Kaminski # Date 1615149196 18000 # Sun Mar 07 15:33:16 2021 -0500 # Node ID 543e4d579266a955bee3d85c1fd13b8c69532e06 # Parent a797cbcfcd6ebd84de86c9debf40bbcfa0c2005d Added a new property to BOTINFO to specify which color set a bot will use, based on its name. diff -r a797cbcfcd6e -r 543e4d579266 src/bots.cpp --- a/src/bots.cpp Sun Mar 07 09:26:09 2021 -0500 +++ b/src/bots.cpp Sun Mar 07 15:33:16 2021 -0500 @@ -485,6 +485,7 @@ sprintf( botInfo.szFavoriteWeapon, "%s", pBotInfo->szFavoriteWeapon ); sprintf( botInfo.szClassName, "%s", pBotInfo->szClassName ); sprintf( botInfo.szColor, "%s", pBotInfo->szColor ); + sprintf( botInfo.szColorSet, "%s", pBotInfo->szColorSet ); sprintf( botInfo.szGender, "%s", pBotInfo->szGender ); sprintf( botInfo.szSkinName, "%s", pBotInfo->szSkinName ); sprintf( botInfo.szName, "%s", pBotInfo->szName ); @@ -1003,6 +1004,7 @@ sprintf( BotInfo.szFavoriteWeapon, "pistol" ); sprintf( BotInfo.szClassName, "random" ); sprintf( BotInfo.szColor, "00 00 00" ); + sprintf( BotInfo.szColorSet, "custom" ); sprintf( BotInfo.szGender, "male" ); sprintf( BotInfo.szName, "UNNAMED BOT" ); BotInfo.szScriptName[0] = 0; @@ -1191,6 +1193,11 @@ strncpy( BotInfo.szColor, szValue, 15 ); BotInfo.szColor[15] = 0; } + else if ( stricmp( szKey, "colorset" ) == 0 ) + { + strncpy( BotInfo.szColorSet, szValue, 31 ); + BotInfo.szColor[31] = 0; + } else if ( stricmp( szKey, "gender" ) == 0 ) { strncpy( BotInfo.szGender, szValue, 15 ); @@ -1375,6 +1382,16 @@ //***************************************************************************** // +char *BOTINFO_GetColorSet( ULONG ulIdx ) +{ + if ( ulIdx >= g_BotInfo.Size() ) + return ( NULL ); + + return ( g_BotInfo[ulIdx].szColorSet ); +} + +//***************************************************************************** +// char *BOTINFO_GetGender( ULONG ulIdx ) { if ( ulIdx >= g_BotInfo.Size() ) @@ -1720,6 +1737,21 @@ } } + // [AK] Get all the color set indices this bot's class has. + FName playerclass = m_pPlayer->userinfo.GetPlayerClassType( )->TypeName; + TArray colorsets; + P_EnumPlayerColorSets( playerclass, &colorsets ); + + // [AK] See if the given color set name matches one of the class's color sets. + for ( ulIdx = 0; ulIdx < colorsets.Size( ); ulIdx++ ) + { + if ( stricmp( g_BotInfo[m_ulBotInfoIdx].szColorSet, P_GetPlayerColorSet( playerclass, colorsets[ulIdx] )->Name.GetChars( )) == 0 ) + { + m_pPlayer->userinfo.ColorSetChanged ( ulIdx ); + break; + } + } + m_pPlayer->userinfo.RailColorChanged ( g_BotInfo[m_ulBotInfoIdx].ulRailgunColor ); m_pPlayer->userinfo.GenderNumChanged ( D_GenderToInt( g_BotInfo[m_ulBotInfoIdx].szGender ) ); if ( pszTeamName ) diff -r a797cbcfcd6e -r 543e4d579266 src/bots.h --- a/src/bots.h Sun Mar 07 09:26:09 2021 -0500 +++ b/src/bots.h Sun Mar 07 15:33:16 2021 -0500 @@ -426,6 +426,9 @@ // Bot's player color (in form of a string). char szColor[16]; + // Name of the color set this bot will use. + char szColorSet[32]; + // Male/female/it :) char szGender[16]; @@ -654,6 +657,7 @@ char *BOTINFO_GetFavoriteWeapon( ULONG ulIdx ); char *BOTINFO_GetClass( ULONG ulIdx ); char *BOTINFO_GetColor( ULONG ulIdx ); +char *BOTINFO_GetColorSet( ULONG ulIdx ); char *BOTINFO_GetGender( ULONG ulIdx ); char *BOTINFO_GetSkin( ULONG ulIdx ); ULONG BOTINFO_GetRailgunColor( ULONG ulIdx );