@@ -1513,44 +1513,57 @@ void CTFBot::Spawn()
15131513 GetVisionInterface ()->ForgetAllKnownEntities ();
15141514
15151515#ifdef BDSBASE
1516- if (TFGameRules () && !TFGameRules ()->IsMannVsMachineMode ())
1517- {
1518- if ((tf_bot_difficulty.GetInt () == CTFBot::UNDEFINED || tf_bot_difficulty.GetInt () > CTFBot::EXPERT) && m_difficulty == CTFBot::UNDEFINED)
1519- {
1520- int m_nRandomSeed = RandomInt (0 , 9999 );
1521- CUniformRandomStream randomize;
1522- randomize.SetSeed (m_nRandomSeed);
1516+ ManageModelOverride ();
1517+ #endif
1518+ }
15231519
1524- SetDifficulty ((CTFBot::DifficultyType)randomize.RandomInt (CTFBot::EASY, CTFBot::EXPERT));
1525- }
1520+ #ifdef BDSBASE
1521+ void CTFBot::ManageModelOverride (void )
1522+ {
1523+ if (TFGameRules () && TFGameRules ()->IsMannVsMachineMode ())
1524+ return ;
15261525
1527- DevMsg ( " %s chooses skill %s \n " , GetPlayerName (), DifficultyLevelToString (m_difficulty) );
1526+ int nClassIndex = ( GetPlayerClass () ? GetPlayerClass ()-> GetClassIndex () : TF_CLASS_UNDEFINED );
15281527
1529- if (IsServerUsingTheFunnyMVMCvar ())
1528+ if (IsServerUsingTheFunnyMVMCvar ())
1529+ {
1530+ // use the nifty new robot model
1531+ if (nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER)
15301532 {
1531- // use the nifty new robot model
1532- int nClassIndex = (GetPlayerClass () ? GetPlayerClass ()->GetClassIndex () : TF_CLASS_UNDEFINED);
1533- if (nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER)
1533+ if (g_pFullFileSystem->FileExists (g_szBotModels[nClassIndex]))
15341534 {
1535- if (g_pFullFileSystem->FileExists (g_szBotModels[nClassIndex]))
1536- {
1537- GetPlayerClass ()->SetCustomModel (g_szBotModels[nClassIndex], USE_CLASS_ANIMATIONS);
1538- UpdateModel ();
1539- SetBloodColor (DONT_BLEED);
1540- }
1535+ GetPlayerClass ()->SetCustomModel (g_szBotModels[nClassIndex], USE_CLASS_ANIMATIONS);
1536+ UpdateModel ();
1537+ SetBloodColor (DONT_BLEED);
15411538 }
15421539 }
1543- else
1540+ }
1541+ else if (DoesServerWantBrainz ())
1542+ {
1543+ // set to old model if needed
1544+ if (GetPlayerClass ()->HasCustomModel ())
1545+ {
1546+ GetPlayerClass ()->SetCustomModel (NULL );
1547+ UpdateModel ();
1548+ SetBloodColor (BLOOD_COLOR_RED);
1549+ }
1550+
1551+ // zombies use the original player models
1552+ m_nSkin = 4 ;
1553+ const char * name = g_aRawPlayerClassNamesShort[nClassIndex];
1554+ AddItem (CFmtStr (" Zombie %s" , name));
1555+ }
1556+ else
1557+ {
1558+ if (GetPlayerClass ()->HasCustomModel ())
15441559 {
15451560 GetPlayerClass ()->SetCustomModel (NULL );
15461561 UpdateModel ();
15471562 SetBloodColor (BLOOD_COLOR_RED);
15481563 }
15491564 }
1550- #endif
15511565}
15521566
1553- #ifdef BDSBASE
15541567void CTFBot::Regenerate (bool bRefillHealthAndAmmo)
15551568{
15561569 BaseClass::Regenerate (bRefillHealthAndAmmo);
@@ -1566,48 +1579,7 @@ void CTFBot::HandleCommand_JoinClass(const char* pClassName, bool bAllowSpawn)
15661579
15671580 m_InitialLoadoutLoadTimer.Start (RandomFloat (TFBOT_MIN_LOADOUT_WAIT, TFBOT_MAX_LOADOUT_WAIT) + TFBOT_CLASSSWITCH_LOADOUT_DELAY);
15681581
1569- if (TFGameRules () && !TFGameRules ()->IsMannVsMachineMode ())
1570- {
1571- int nClassIndex = (GetPlayerClass () ? GetPlayerClass ()->GetClassIndex () : TF_CLASS_UNDEFINED);
1572-
1573- if (IsServerUsingTheFunnyMVMCvar ())
1574- {
1575- // use the nifty new robot model
1576- if (nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER)
1577- {
1578- if (g_pFullFileSystem->FileExists (g_szBotModels[nClassIndex]))
1579- {
1580- GetPlayerClass ()->SetCustomModel (g_szBotModels[nClassIndex], USE_CLASS_ANIMATIONS);
1581- UpdateModel ();
1582- SetBloodColor (DONT_BLEED);
1583- }
1584- }
1585- }
1586- else if (DoesServerWantBrainz ())
1587- {
1588- // set to old model if needed
1589- if (GetPlayerClass ()->HasCustomModel ())
1590- {
1591- GetPlayerClass ()->SetCustomModel (NULL );
1592- UpdateModel ();
1593- SetBloodColor (BLOOD_COLOR_RED);
1594- }
1595-
1596- // zombies use the original player models
1597- m_nSkin = 4 ;
1598- const char * name = g_aRawPlayerClassNamesShort[nClassIndex];
1599- AddItem (CFmtStr (" Zombie %s" , name));
1600- }
1601- else
1602- {
1603- if (GetPlayerClass ()->HasCustomModel ())
1604- {
1605- GetPlayerClass ()->SetCustomModel (NULL );
1606- UpdateModel ();
1607- SetBloodColor (BLOOD_COLOR_RED);
1608- }
1609- }
1610- }
1582+ ManageModelOverride ();
16111583}
16121584#endif
16131585
0 commit comments