Skip to content

Commit 6374d0b

Browse files
committed
Reapply "Implement ValveSoftware#974"
This reverts commit f30eac7.
1 parent 5d793ea commit 6374d0b

File tree

11 files changed

+179
-1
lines changed

11 files changed

+179
-1
lines changed

src/game/client/hud.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ void CHud::LevelInit( void )
533533
group->bHidden = false;
534534
group->m_pLockingElements.Purge();
535535
}
536+
537+
#ifdef BDSBASE
538+
RefreshHudTextures();
539+
#endif
536540
}
537541

538542
//-----------------------------------------------------------------------------
@@ -801,7 +805,11 @@ CHudTexture *CHud::GetIcon( const char *szIcon )
801805
//-----------------------------------------------------------------------------
802806
// Purpose:
803807
//-----------------------------------------------------------------------------
808+
#ifdef BDSBASE
809+
void CHud::RefreshHudTextures(const char* customKillIconFile /* = "\0" */)
810+
#else
804811
void CHud::RefreshHudTextures()
812+
#endif
805813
{
806814
if ( !m_bHudTexturesLoaded )
807815
{
@@ -811,6 +819,20 @@ void CHud::RefreshHudTextures()
811819

812820
CUtlDict< CHudTexture *, int > textureList;
813821

822+
#ifdef BDSBASE
823+
// loading custom kill icons, presumably packed into the map and because of an input to the gamerules entity
824+
if (FStrEq(customKillIconFile, "") == false)
825+
{
826+
LoadHudTextures(textureList, customKillIconFile, NULL);
827+
int co = textureList.Count();
828+
for (int index = 0; index < co; index++)
829+
{
830+
CHudTexture* tex = textureList[index];
831+
AddSearchableHudIconToList(*tex);
832+
}
833+
}
834+
#endif
835+
814836
// check to see if we have sprites for this res; if not, step down
815837
LoadHudTextures( textureList, "scripts/hud_textures", NULL );
816838
LoadHudTextures( textureList, "scripts/mod_textures", NULL );

src/game/client/hud.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ class CHud
144144
CHudTexture *AddUnsearchableHudIconToList( CHudTexture& texture );
145145
CHudTexture *AddSearchableHudIconToList( CHudTexture& texture );
146146

147+
#ifdef BDSBASE
148+
void RefreshHudTextures(const char* customKillIconFile = "\0");
149+
#else
147150
void RefreshHudTextures();
151+
#endif
148152

149153
// User messages
150154
void MsgFunc_ResetHUD(bf_read &msg);

src/game/server/pointhurt.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ BEGIN_DATADESC( CPointHurt )
2222
DEFINE_KEYFIELD( m_flDelay, FIELD_FLOAT, "DamageDelay" ),
2323
DEFINE_KEYFIELD( m_bitsDamageType, FIELD_INTEGER, "DamageType" ),
2424
DEFINE_KEYFIELD( m_strTarget, FIELD_STRING, "DamageTarget" ),
25+
#ifdef BDSBASE
26+
#ifdef TF_DLL
27+
DEFINE_KEYFIELD(m_szKillIcon, FIELD_STRING, "KillIcon"),
28+
#endif // TF_DLL
29+
#endif
2530

2631
// Function Pointers
2732
DEFINE_FUNCTION( HurtThink ),

src/game/server/pointhurt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ class CPointHurt : public CPointEntity
2727
float m_flDelay;
2828
string_t m_strTarget;
2929
EHANDLE m_pActivator;
30+
31+
#ifdef BDSBASE
32+
#ifdef TF_DLL
33+
string_t m_szKillIcon;
34+
#endif // TF_DLL
35+
#endif
3036
};

src/game/server/tf/func_croc.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ LINK_ENTITY_TO_CLASS( func_croc, CFuncCroc );
1818

1919
BEGIN_DATADESC( CFuncCroc )
2020
DEFINE_KEYFIELD( m_iszModel, FIELD_STRING, "croc_model" ),
21+
#ifdef BDSBASE
22+
DEFINE_KEYFIELD(m_iszKillIcon, FIELD_STRING, "killicon"),
23+
#endif
2124
// Outputs
2225
DEFINE_OUTPUT( m_OnEat, "OnEat" ),
2326
DEFINE_OUTPUT( m_OnEatRed, "OnEatRed" ),
@@ -103,6 +106,9 @@ void CEntityCroc::Think( void )
103106
CFuncCroc::CFuncCroc()
104107
{
105108
m_iszModel = NULL_STRING;
109+
#ifdef BDSBASE
110+
m_iszKillIcon = NULL_STRING;
111+
#endif
106112
}
107113

108114
//-----------------------------------------------------------------------------
@@ -208,4 +214,16 @@ const char *CFuncCroc::GetCrocModel( void )
208214
}
209215

210216
return CROC_MODEL;
211-
}
217+
}
218+
219+
#ifdef BDSBASE
220+
//-----------------------------------------------------------------------------
221+
// Purpose:
222+
//-----------------------------------------------------------------------------
223+
const char* CFuncCroc::GetKillIcon(void)
224+
{
225+
if (m_iszKillIcon != NULL_STRING)
226+
return (STRING(m_iszKillIcon));
227+
return "crocodile";
228+
}
229+
#endif

src/game/server/tf/func_croc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,18 @@ class CFuncCroc : public CBaseTrigger
5050

5151
const char *GetCrocModel( void );
5252

53+
#ifdef BDSBASE
54+
const char* GetKillIcon(void);
55+
#endif
56+
5357
private:
5458

5559
string_t m_iszModel;
5660

61+
#ifdef BDSBASE
62+
string_t m_iszKillIcon;
63+
#endif
64+
5765
COutputEvent m_OnEat;
5866
COutputEvent m_OnEatRed;
5967
COutputEvent m_OnEatBlue;

src/game/server/triggers.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ BEGIN_DATADESC( CTriggerHurt )
666666
DEFINE_KEYFIELD( m_bitsDamageInflict, FIELD_INTEGER, "damagetype" ),
667667
DEFINE_KEYFIELD( m_damageModel, FIELD_INTEGER, "damagemodel" ),
668668
DEFINE_KEYFIELD( m_bNoDmgForce, FIELD_BOOLEAN, "nodmgforce" ),
669+
#ifdef BDSBASE
670+
#ifdef TF_DLL
671+
DEFINE_KEYFIELD(m_szKillIcon, FIELD_STRING, "killicon"),
672+
#endif // TF_DLL
673+
#endif
669674

670675
DEFINE_FIELD( m_flLastDmgTime, FIELD_TIME ),
671676
DEFINE_FIELD( m_flDmgResetTime, FIELD_TIME ),

src/game/server/triggers.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ class CTriggerHurt : public CTriggerHurtShim, public ITriggerHurtAutoList
211211
int m_damageModel;
212212
bool m_bNoDmgForce; // Should damage from this trigger impart force on what it's hurting
213213

214+
#ifdef BDSBASE
215+
#ifdef TF_DLL
216+
string_t m_szKillIcon;
217+
#endif // TF_DLL
218+
#endif
219+
214220
enum
215221
{
216222
DAMAGEMODEL_NORMAL = 0,

src/game/shared/teamplayroundbased_gamerules.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ BEGIN_NETWORK_TABLE_NOBASE( CTeamplayRoundBasedRules, DT_TeamplayRoundBasedRules
103103
RecvPropBool( RECVINFO( m_bCheatsEnabledDuringLevel ) ),
104104
RecvPropTime( RECVINFO( m_flCountdownTime ) ),
105105
RecvPropTime( RECVINFO( m_flStateTransitionTime ) ),
106+
#ifdef BDSBASE
107+
RecvPropString(RECVINFO(m_pszCustomKillIconsFile)),
108+
#endif
106109
#else
107110
SendPropInt( SENDINFO( m_iRoundState ), 5 ),
108111
SendPropBool( SENDINFO( m_bInWaitingForPlayers ) ),
@@ -123,6 +126,9 @@ BEGIN_NETWORK_TABLE_NOBASE( CTeamplayRoundBasedRules, DT_TeamplayRoundBasedRules
123126
SendPropBool( SENDINFO( m_bCheatsEnabledDuringLevel ) ),
124127
SendPropTime( SENDINFO( m_flCountdownTime ) ),
125128
SendPropTime( SENDINFO( m_flStateTransitionTime ) ),
129+
#ifdef BDSBASE
130+
SendPropString(SENDINFO(m_pszCustomKillIconsFile)),
131+
#endif
126132
#endif
127133
END_NETWORK_TABLE()
128134

@@ -173,6 +179,9 @@ END_SEND_TABLE()
173179
BEGIN_DATADESC( CTeamplayRoundBasedRulesProxy )
174180
// Inputs.
175181
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetStalemateOnTimelimit", InputSetStalemateOnTimelimit ),
182+
#ifdef BDSBASE
183+
DEFINE_INPUTFUNC(FIELD_STRING, "SetCustomKillIconsFile", InputSetCustomKillIconsFile),
184+
#endif
176185
END_DATADESC()
177186

178187
//-----------------------------------------------------------------------------
@@ -182,6 +191,16 @@ void CTeamplayRoundBasedRulesProxy::InputSetStalemateOnTimelimit( inputdata_t &i
182191
{
183192
TeamplayRoundBasedRules()->SetStalemateOnTimelimit( inputdata.value.Bool() );
184193
}
194+
195+
#ifdef BDSBASE
196+
//-----------------------------------------------------------------------------
197+
// Purpose:
198+
//-----------------------------------------------------------------------------
199+
void CTeamplayRoundBasedRulesProxy::InputSetCustomKillIconsFile(inputdata_t& inputdata)
200+
{
201+
TeamplayRoundBasedRules()->SetCustomKillIconsFile(inputdata.value.String());
202+
}
203+
#endif
185204
#endif
186205

187206
#ifdef GAME_DLL
@@ -528,6 +547,10 @@ CTeamplayRoundBasedRules::CTeamplayRoundBasedRules( void )
528547

529548
m_hWaitingForPlayersTimer = NULL;
530549
m_bStopWatchShouldBeTimedWin = false;
550+
#else // GAME_DLL
551+
#ifdef BDSBASE
552+
V_strncpy(m_pszOldCustomKillIconsFile, "", MAX_PATH);
553+
#endif
531554
#endif
532555
}
533556

@@ -580,6 +603,13 @@ void CTeamplayRoundBasedRules::AddTeamRespawnWaveTime( int iTeam, float flValue
580603

581604
m_TeamRespawnWaveTimes.Set( iTeam, flNewValue );
582605
}
606+
607+
#ifdef BDSBASE
608+
void CTeamplayRoundBasedRules::SetCustomKillIconsFile(const char* pszCustomKillIconsFile)
609+
{
610+
V_StripExtension(pszCustomKillIconsFile, m_pszCustomKillIconsFile.GetForModify(), MAX_PATH);
611+
}
612+
#endif
583613
#endif
584614

585615
//-----------------------------------------------------------------------------
@@ -3790,6 +3820,14 @@ void CTeamplayRoundBasedRules::OnDataChanged( DataUpdateType_t updateType )
37903820
{
37913821
HandleOvertimeBegin();
37923822
}
3823+
3824+
#ifdef BDSBASE
3825+
if (!FStrEq(m_pszOldCustomKillIconsFile, m_pszCustomKillIconsFile))
3826+
{
3827+
V_strncpy(m_pszOldCustomKillIconsFile, m_pszCustomKillIconsFile, MAX_PATH);
3828+
gHUD.RefreshHudTextures(GetCustomKillIconsFile());
3829+
}
3830+
#endif
37933831
}
37943832
#endif // CLIENT_DLL
37953833

src/game/shared/teamplayroundbased_gamerules.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ class CTeamplayRoundBasedRulesProxy : public CGameRulesProxy
143143
#ifdef GAME_DLL
144144
DECLARE_DATADESC();
145145
void InputSetStalemateOnTimelimit( inputdata_t &inputdata );
146+
#ifdef BDSBASE
147+
void InputSetCustomKillIconsFile(inputdata_t& inputdata);
148+
#endif
146149
#endif
147150

148151
//----------------------------------------------------------------------------------
@@ -373,6 +376,10 @@ class CTeamplayRoundBasedRules : public CTeamplayRules, public CGameEventListene
373376

374377
void SetStalemateOnTimelimit( bool bStalemate ) { m_bAllowStalemateAtTimelimit = bStalemate; }
375378

379+
#ifdef BDSBASE
380+
void SetCustomKillIconsFile(const char* pszCustomKillIconsFile);
381+
#endif
382+
376383
bool IsGameUnderTimeLimit( void );
377384

378385
void HandleTimeLimitChange( void );
@@ -569,6 +576,9 @@ class CTeamplayRoundBasedRules : public CTeamplayRules, public CGameEventListene
569576
bool m_bOldInWaitingForPlayers;
570577
bool m_bOldInOvertime;
571578
bool m_bOldInSetup;
579+
#ifdef BDSBASE
580+
char m_pszOldCustomKillIconsFile[MAX_PATH];
581+
#endif
572582
#endif // CLIENT_DLL
573583

574584
public:
@@ -577,6 +587,9 @@ class CTeamplayRoundBasedRules : public CTeamplayRules, public CGameEventListene
577587
virtual bool HaveCheatsBeenEnabledDuringLevel( void ) { return m_bCheatsEnabledDuringLevel; }
578588

579589
float GetPreroundCountdownTime( void ){ return m_flCountdownTime; }
590+
#ifdef BDSBASE
591+
const char* GetCustomKillIconsFile() { return m_pszCustomKillIconsFile.Get(); }
592+
#endif
580593

581594
protected:
582595
CNetworkVar( gamerules_roundstate_t, m_iRoundState );
@@ -600,6 +613,9 @@ class CTeamplayRoundBasedRules : public CTeamplayRules, public CGameEventListene
600613
CNetworkVar( int, m_nRoundsPlayed );
601614
CNetworkVar( float, m_flCountdownTime );
602615
CNetworkVar( float, m_flStateTransitionTime ); // Timer for round states
616+
#ifdef BDSBASE
617+
CNetworkString(m_pszCustomKillIconsFile, MAX_PATH);
618+
#endif
603619
public:
604620
CNetworkArray( float, m_TeamRespawnWaveTimes, MAX_TEAMS_ARRAY_SAFE ); // Time between each team's respawn wave
605621

0 commit comments

Comments
 (0)