Skip to content

Commit

Permalink
Merge pull request #137 from BSVino/disable-overflow-drop-by-default
Browse files Browse the repository at this point in the history
Disable the overflow weapon drop mechanism by default
  • Loading branch information
BSVino authored Dec 24, 2019
2 parents e48a0ef + 36ffba8 commit 070f8c1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 34 deletions.
2 changes: 1 addition & 1 deletion mp/src/game/client/hud_hintdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void CHudHintDisplay::ApplySchemeSettings( vgui::IScheme *pScheme )
BaseClass::ApplySchemeSettings( pScheme );

SetFgColor( GetSchemeColor("HintMessageFg", pScheme) );
m_hFont = pScheme->GetFont( "HudHintText", true );
m_hFont = pScheme->GetFont( "HudHintTextLarge", true );
m_pLabel->SetBgColor( GetSchemeColor("HintMessageBg", pScheme) );
m_pLabel->SetPaintBackgroundType( 2 );
m_pLabel->SetSize( 0, GetTall() ); // Start tiny, it'll grow.
Expand Down
22 changes: 0 additions & 22 deletions mp/src/game/client/sdk/hud/da_instructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,6 @@ void __MsgFunc_LessonLearned( bf_read &msg )
}

DECLARE_HUDELEMENT( CHudLessonPanel );
DECLARE_HUD_MESSAGE( CHudLessonPanel, HintText );

CHudLessonPanel::CHudLessonPanel( const char *pElementName ) : BaseClass(NULL, "HudLessonPanel"), CHudElement( pElementName )
{
Expand All @@ -895,11 +894,7 @@ CHudLessonPanel::CHudLessonPanel( const char *pElementName ) : BaseClass(NULL, "

void CHudLessonPanel::Init()
{
HOOK_HUD_MESSAGE( CHudLessonPanel, HintText );
HOOK_MESSAGE( LessonLearned );

// listen for client side events
ListenForGameEvent( "player_hintmessage" );
}

inline std::string replace(std::string s, const std::string& f, const std::string& r)
Expand Down Expand Up @@ -1063,23 +1058,6 @@ void CHudLessonPanel::OnThink()
}
}

void CHudLessonPanel::MsgFunc_HintText( bf_read &msg )
{
// Read the string(s)
char szString[255];
msg.ReadString( szString, sizeof(szString) );

char *tmpStr = hudtextmessage->LookupString( szString, NULL );
LocalizeAndDisplay( tmpStr, szString );
}

void CHudLessonPanel::FireGameEvent( IGameEvent * event)
{
const char *hintmessage = event->GetString( "hintmessage" );
char *tmpStr = hudtextmessage->LookupString( hintmessage, NULL );
LocalizeAndDisplay( tmpStr, hintmessage );
}

//-----------------------------------------------------------------------------
// Purpose: Localize, display, and animate the hud element
//-----------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions mp/src/game/client/sdk/hud/da_instructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ class CHudLessonPanel : public vgui::Panel, public CHudElement

void Init();
void Reset();
void MsgFunc_HintText( bf_read &msg );
void FireGameEvent( IGameEvent * event);

bool SetHintText( wchar_t *text );
void LocalizeAndDisplay( const char *pszHudTxtMsg, const char *szRawString );
Expand Down
19 changes: 12 additions & 7 deletions mp/src/game/client/sdk/hud/sdk_hud_notices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,18 @@ void CHudNotices::ShowTopNotice()

pszObjectiveGoal = g_pVGuiLocalize->Find(VarArgs("#DA_MiniObjective_%s", NoticeToString(m_eTopNotice)));

if (m_eTopNotice == NOTICE_BOUNTY_ON_PLAYER || m_eTopNotice == NOTICE_BOUNTY_PROTECT_PLAYER || m_eTopNotice == NOTICE_BOUNTY_COLLECTED ||
m_eTopNotice == NOTICE_PLAYER_HAS_BRIEFCASE || m_eTopNotice == NOTICE_PLAYER_CAPTURED_BRIEFCASE ||
m_eTopNotice == NOTICE_RATRACE_PLAYER_LEAD || m_eTopNotice == NOTICE_RATRACE_OVER ||
m_eTopNotice == NOTICE_RATRACE_PLAYER_POINT_2)
{
g_pVGuiLocalize->ConstructString( sNoticeString, sizeof(sNoticeString), pszObjectiveGoal, 1, m_wszPlayerSubject );
pszObjectiveGoal = sNoticeString;
switch (m_eTopNotice) {
case NOTICE_BOUNTY_ON_PLAYER:
case NOTICE_BOUNTY_PROTECT_PLAYER:
case NOTICE_BOUNTY_COLLECTED:
case NOTICE_PLAYER_HAS_BRIEFCASE:
case NOTICE_PLAYER_CAPTURED_BRIEFCASE:
case NOTICE_RATRACE_PLAYER_LEAD:
case NOTICE_RATRACE_OVER:
case NOTICE_RATRACE_PLAYER_POINT_2:
g_pVGuiLocalize->ConstructString(sNoticeString, sizeof(sNoticeString), pszObjectiveGoal, 1, m_wszPlayerSubject);
pszObjectiveGoal = sNoticeString;
break;
}

if (!pszObjectiveGoal)
Expand Down
9 changes: 7 additions & 2 deletions mp/src/game/shared/sdk/weapon_sdkbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "ammodef.h"
#include "weapon_akimbobase.h"
#include "datacache/imdlcache.h"
#include "hintmessage.h"

#include "sdk_fx_shared.h"
#include "sdk_gamerules.h"
Expand Down Expand Up @@ -1559,6 +1560,8 @@ void CWeaponSDKBase::ItemPostFrame( void )
}
}

ConVar da_drop_overflow_on_pickup("da_drop_overflow_on_pickup", "0", FCVAR_ARCHIVE | FCVAR_USERINFO | FCVAR_CLIENTDLL, "Enable to drop weapons in order to make room for what you pick up.");

extern bool UTIL_ItemCanBeTouchedByPlayer( CBaseEntity *pItem, CBasePlayer *pPlayer );

void CWeaponSDKBase::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
Expand All @@ -1582,11 +1585,13 @@ void CWeaponSDKBase::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP

int iWeight = GetWeight();

if (iWeight + pPlayer->FindCurrentWeaponsWeight() > MAX_LOADOUT_WEIGHT)
if (da_drop_overflow_on_pickup.GetBool() && iWeight + pPlayer->FindCurrentWeaponsWeight() > MAX_LOADOUT_WEIGHT)
pPlayer->DropWeaponsToPickUp(this);

if (iWeight + pPlayer->FindCurrentWeaponsWeight() > MAX_LOADOUT_WEIGHT)
if (iWeight + pPlayer->FindCurrentWeaponsWeight() > MAX_LOADOUT_WEIGHT) {
CHintMessage("Inventory full\nPress [%drop%] to drop weapon", NULL, 6.0f).Send(pPlayer);
return;
}

// ----------------------------------------
// If I already have it just take the ammo
Expand Down

0 comments on commit 070f8c1

Please sign in to comment.