Skip to content

Commit af46b9c

Browse files
committed
allow bots to be able to use zombie model
1 parent acc8b3e commit af46b9c

File tree

7 files changed

+55
-8
lines changed

7 files changed

+55
-8
lines changed

src/game/client/tf/c_tf_player.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ class C_TFPlayer : public C_BasePlayer, public IHasAttributes, public IInventory
130130
#ifdef BDSBASE
131131
virtual void PlayStepSound(Vector& vecOrigin, surfacedata_t* psurface, float fvol, bool force);
132132
virtual bool IsServerUsingTheFunnyMVMCvar(void);
133+
virtual bool DoesServerWantBrainz(void);
134+
private:
135+
bool BotModelChangeCheckInternal(void);
136+
137+
public:
133138
#endif
134139

135140
CNewParticleEffect *SpawnHalloweenSpellFootsteps( ParticleAttachment_t eParticleAttachment, int iHalloweenFootstepType );

src/game/server/tf/bot/tf_bot.cpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,10 +1568,11 @@ void CTFBot::HandleCommand_JoinClass(const char* pClassName, bool bAllowSpawn)
15681568

15691569
if (TFGameRules() && !TFGameRules()->IsMannVsMachineMode())
15701570
{
1571+
int nClassIndex = (GetPlayerClass() ? GetPlayerClass()->GetClassIndex() : TF_CLASS_UNDEFINED);
1572+
15711573
if (IsServerUsingTheFunnyMVMCvar())
15721574
{
15731575
// use the nifty new robot model
1574-
int nClassIndex = (GetPlayerClass() ? GetPlayerClass()->GetClassIndex() : TF_CLASS_UNDEFINED);
15751576
if (nClassIndex >= TF_CLASS_SCOUT && nClassIndex <= TF_CLASS_ENGINEER)
15761577
{
15771578
if (g_pFullFileSystem->FileExists(g_szBotModels[nClassIndex]))
@@ -1582,11 +1583,29 @@ void CTFBot::HandleCommand_JoinClass(const char* pClassName, bool bAllowSpawn)
15821583
}
15831584
}
15841585
}
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+
}
15851601
else
15861602
{
1587-
GetPlayerClass()->SetCustomModel(NULL);
1588-
UpdateModel();
1589-
SetBloodColor(BLOOD_COLOR_RED);
1603+
if (GetPlayerClass()->HasCustomModel())
1604+
{
1605+
GetPlayerClass()->SetCustomModel(NULL);
1606+
UpdateModel();
1607+
SetBloodColor(BLOOD_COLOR_RED);
1608+
}
15901609
}
15911610
}
15921611
}

src/game/server/tf/player_vs_environment/tf_mann_vs_machine_logic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void CMannVsMachineLogic::Update( void )
8282
}
8383

8484
#ifdef BDSBASE
85-
tf_bot_force_robot_models.SetValue(0);
85+
tf_bot_models_override.SetValue(0);
8686
#endif
8787

8888
// we don't need to run this check as often as we're calling our update() function

src/game/server/tf/tf_player.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ class CTFPlayer : public CBaseMultiplayerPlayer, public IHasAttributes, public I
196196
virtual void CommitSuicide( bool bExplode = false, bool bForce = false );
197197
#ifdef BDSBASE
198198
virtual void CommitSuicideWithCustomRagdoll(int m_iCustomRagdoll = 0);
199+
199200
virtual bool IsServerUsingTheFunnyMVMCvar(void);
201+
virtual bool DoesServerWantBrainz(void);
202+
private:
203+
bool BotModelChangeCheckInternal(void);
204+
205+
public:
200206
#endif
201207

202208
// Combats

src/game/shared/tf/tf_gamerules.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ ConVar tf_spawn_glows_duration( "tf_spawn_glows_duration", "10", FCVAR_NOTIFY |
728728
#ifdef BDSBASE
729729
ConVar tf_allow_pyroland("tf_allow_pyroland", "0", FCVAR_REPLICATED | FCVAR_NOTIFY, "Enable Pyroland filters on the current map.");
730730
ConVar tf_killeater_demoshield_countotherkills("tf_killeater_demoshield_countotherkills", "0", FCVAR_REPLICATED | FCVAR_NOTIFY, "Allows Strange Demoman shields to count kills from other weapons.");
731-
ConVar tf_bot_force_robot_models("tf_bot_force_robot_models", "0", FCVAR_REPLICATED | FCVAR_NOTIFY, "");
731+
ConVar tf_bot_models_override("tf_bot_models_override", "0", FCVAR_REPLICATED | FCVAR_NOTIFY, "1 = MvM, 2 = zombie");
732732
#endif
733733

734734
#if defined(QUIVER_DLL)

src/game/shared/tf/tf_gamerules.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,14 @@ extern ConVar tf_mvm_defenders_team_size;
100100
#ifdef BDSBASE
101101
extern ConVar tf_mvm_max_invaders;
102102
extern ConVar tf_mvm_disguise_on_backstab_mode;
103-
extern ConVar tf_bot_force_robot_models;
103+
104+
enum BotModelTypes_t
105+
{
106+
MODEL_MVM = 1,
107+
MODEL_ZOMBIE
108+
};
109+
110+
extern ConVar tf_bot_models_override;
104111
#endif
105112

106113
const int kLadder_TeamSize_6v6 = 6;

src/game/shared/tf/tf_player_shared.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13252,9 +13252,19 @@ void CTFPlayer::PlayStepSound(Vector& vecOrigin, surfacedata_t* psurface, float
1325213252
BaseClass::PlayStepSound(vecOrigin, psurface, fvol, force);
1325313253
}
1325413254

13255+
bool CTFPlayer::BotModelChangeCheckInternal(void)
13256+
{
13257+
return (TFGameRules() && !TFGameRules()->IsMannVsMachineMode() && m_bIsABot);
13258+
}
13259+
1325513260
bool CTFPlayer::IsServerUsingTheFunnyMVMCvar(void)
1325613261
{
13257-
return (TFGameRules() && !TFGameRules()->IsMannVsMachineMode() && m_bIsABot && tf_bot_force_robot_models.GetBool());
13262+
return (BotModelChangeCheckInternal() && tf_bot_models_override.GetInt() == MODEL_MVM);
13263+
}
13264+
13265+
bool CTFPlayer::DoesServerWantBrainz(void)
13266+
{
13267+
return (BotModelChangeCheckInternal() && tf_bot_models_override.GetInt() == MODEL_ZOMBIE);
1325813268
}
1325913269
#endif
1326013270

0 commit comments

Comments
 (0)