summaryrefslogtreecommitdiff
path: root/game/client/dod/dod_hud_playerstatus_weapon.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/dod/dod_hud_playerstatus_weapon.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/dod/dod_hud_playerstatus_weapon.cpp')
-rw-r--r--game/client/dod/dod_hud_playerstatus_weapon.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/game/client/dod/dod_hud_playerstatus_weapon.cpp b/game/client/dod/dod_hud_playerstatus_weapon.cpp
new file mode 100644
index 0000000..1301e35
--- /dev/null
+++ b/game/client/dod/dod_hud_playerstatus_weapon.cpp
@@ -0,0 +1,62 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#include "cbase.h"
+#include <KeyValues.h>
+#include <vgui/IScheme.h>
+#include <vgui/ISurface.h>
+#include <vgui/ISystem.h>
+#include <vgui_controls/AnimationController.h>
+#include <vgui_controls/EditablePanel.h>
+#include <vgui_controls/ImagePanel.h>
+
+#include "c_dod_team.h"
+#include "c_dod_playerresource.h"
+#include "c_dod_player.h"
+
+#include "weapon_dodbase.h"
+
+#include "dod_hud_playerstatus_weapon.h"
+
+float GetScale( int nIconWidth, int nIconHeight, int nWidth, int nHeight );
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CDoDHudCurrentWeapon::Paint()
+{
+ C_DODPlayer *pPlayer = C_DODPlayer::GetLocalDODPlayer();
+ if ( pPlayer )
+ {
+ C_WeaponDODBase *pWeapon = pPlayer->GetActiveDODWeapon();
+
+ if ( pWeapon )
+ {
+ const CHudTexture *pWpnSprite = pWeapon->GetSpriteActive();
+
+ if ( pWpnSprite )
+ {
+ int x, y, w, h;
+ GetBounds( x, y, w, h );
+
+ int spriteWidth = pWpnSprite->Width(), spriteHeight = pWpnSprite->Height();
+ float scale = GetScale( spriteWidth, spriteHeight, w, h );
+
+ spriteWidth *= scale;
+ spriteHeight *= scale;
+
+ int xpos = ( w / 2.0f ) - ( spriteWidth / 2.0f );
+ int ypos = ( h / 2.0f ) - ( spriteHeight / 2.0f );
+
+ pWpnSprite->DrawSelf( xpos, ypos, spriteWidth, spriteHeight, Color( 255, 255, 255, 255 ) );
+ }
+ }
+ }
+}
+
+
+
+