Skip to content

Commit 6510690

Browse files
committed
Implement #798
1 parent f0ff52d commit 6510690

File tree

2 files changed

+46
-6
lines changed

2 files changed

+46
-6
lines changed

src/game/client/tf/tf_hud_tournament.cpp

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include "c_tf_objective_resource.h"
3636
#include "tf_time_panel.h"
3737
#include "tf_hud_match_status.h"
38+
#ifdef BDSBASE
39+
#include "engine/IEngineSound.h"
40+
#endif
3841

3942
#include "tf_gc_client.h"
4043
#include "tf_lobby_server.h"
@@ -109,7 +112,7 @@ CHudTournament::~CHudTournament()
109112
{
110113
m_pPlayerPanelKVs->deleteThis();
111114
m_pPlayerPanelKVs = NULL;
112-
}
115+
}
113116
}
114117

115118
//-----------------------------------------------------------------------------
@@ -142,6 +145,12 @@ void CHudTournament::PlaySounds( int nTime )
142145

143146
bool bCompetitiveMode = TFGameRules() && TFGameRules()->IsCompetitiveMode();
144147

148+
#ifdef BDSBASE
149+
bool bAdminCanTalk = gpGlobals->curtime > m_flNextActionTime;
150+
#else
151+
bool bAdminCanTalk = true;
152+
#endif
153+
145154
switch( nTime )
146155
{
147156
case 60:
@@ -162,32 +171,60 @@ void CHudTournament::PlaySounds( int nTime )
162171
}
163172
case 10:
164173
{
174+
#ifdef BDSBASE
175+
const char* pszEntryName = "";
176+
#endif
165177
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() )
166178
{
167179
if ( TFObjectiveResource()->GetMannVsMachineWaveCount() >= TFObjectiveResource()->GetMannVsMachineMaxWaveCount() )
168180
{
181+
#ifdef BDSBASE
182+
pszEntryName = UTIL_GetRandomSoundFromEntry("Announcer.MVM_Final_Wave_Start");
183+
#else
169184
pLocalPlayer->EmitSound( "Announcer.MVM_Final_Wave_Start" );
185+
#endif
170186
}
171187
else if ( TFObjectiveResource()->GetMannVsMachineWaveCount() <= 1 )
172188
{
173189
if ( GTFGCClientSystem()->GetLobby() && IsMannUpGroup( GTFGCClientSystem()->GetLobby()->GetMatchGroup() ) )
174190
{
191+
#ifdef BDSBASE
192+
pszEntryName = UTIL_GetRandomSoundFromEntry("Announcer.MVM_Manned_Up");
193+
#else
175194
pLocalPlayer->EmitSound( "Announcer.MVM_Manned_Up" );
195+
#endif
176196
}
177197
else
178198
{
199+
#ifdef BDSBASE
200+
pszEntryName = UTIL_GetRandomSoundFromEntry("Announcer.MVM_First_Wave_Start");
201+
#else
179202
pLocalPlayer->EmitSound( "Announcer.MVM_First_Wave_Start" );
203+
#endif
180204
}
181205
}
182206
else
183207
{
208+
#ifdef BDSBASE
209+
pszEntryName = UTIL_GetRandomSoundFromEntry("Announcer.MVM_Wave_Start");
210+
#else
184211
pLocalPlayer->EmitSound( "Announcer.MVM_Wave_Start" );
212+
#endif
185213
}
186214
}
187215
else
188216
{
217+
#ifdef BDSBASE
218+
pszEntryName = UTIL_GetRandomSoundFromEntry(bCompetitiveMode ? "Announcer.CompGame1Begins10Seconds" : "Announcer.RoundBegins10Seconds");
219+
#else
189220
pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGame1Begins10Seconds" : "Announcer.RoundBegins10Seconds" );
221+
#endif
190222
}
223+
#ifdef BDSBASE
224+
float flDelay = enginesound->GetSoundDuration(pszEntryName); // Pulling sound length
225+
pLocalPlayer->EmitSound(pszEntryName); // Playing sound
226+
m_flNextActionTime = gpGlobals->curtime + flDelay; // Determining min time for admin to not talk over herself
227+
#endif
191228
break;
192229
}
193230
case 9:
@@ -227,27 +264,27 @@ void CHudTournament::PlaySounds( int nTime )
227264
}
228265
case 5:
229266
{
230-
pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins05Seconds" : "Announcer.RoundBegins5Seconds" );
267+
if (bAdminCanTalk) pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins05Seconds" : "Announcer.RoundBegins5Seconds" );
231268
break;
232269
}
233270
case 4:
234271
{
235-
pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins04Seconds" : "Announcer.RoundBegins4Seconds" );
272+
if (bAdminCanTalk) pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins04Seconds" : "Announcer.RoundBegins4Seconds" );
236273
break;
237274
}
238275
case 3:
239276
{
240-
pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins03Seconds" : "Announcer.RoundBegins3Seconds" );
277+
if (bAdminCanTalk) pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins03Seconds" : "Announcer.RoundBegins3Seconds" );
241278
break;
242279
}
243280
case 2:
244281
{
245-
pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins02Seconds" : "Announcer.RoundBegins2Seconds" );
282+
if (bAdminCanTalk) pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins02Seconds" : "Announcer.RoundBegins2Seconds" );
246283
break;
247284
}
248285
case 1:
249286
{
250-
pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins01Seconds" : "Announcer.RoundBegins1Seconds" );
287+
if (bAdminCanTalk) pLocalPlayer->EmitSound( bCompetitiveMode ? "Announcer.CompGameBegins01Seconds" : "Announcer.RoundBegins1Seconds" );
251288
break;
252289
}
253290
}

src/game/client/tf/tf_hud_tournament.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class CHudTournament : public CHudElement, public EditablePanel
6060
bool m_bShouldBeVisible;
6161

6262
float m_flNextUpdate;
63+
#ifdef BDSBASE
64+
float m_flNextActionTime; // new addition for bugfix
65+
#endif
6366

6467
bool m_bTeamReady[MAX_TEAMS];
6568

0 commit comments

Comments
 (0)