From 488509e1d17bea1c353721608786eea504c3288d Mon Sep 17 00:00:00 2001 From: a1batross Date: Sat, 30 Jan 2016 22:24:46 +0600 Subject: [PATCH] Fix build & Fix #69 --- cl_dll/cs_wpn/cs_baseentity.cpp | 1 + cl_dll/cs_wpn/cs_weapons.cpp | 14 +++++++++++--- cl_dll/hud/ammo.cpp | 16 +++++++++------- common/port.h | 1 + dlls/extdll.h | 3 --- dlls/stdafx.h | 3 ++- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/cl_dll/cs_wpn/cs_baseentity.cpp b/cl_dll/cs_wpn/cs_baseentity.cpp index 15af234..c0521a5 100644 --- a/cl_dll/cs_wpn/cs_baseentity.cpp +++ b/cl_dll/cs_wpn/cs_baseentity.cpp @@ -21,6 +21,7 @@ This file contains "stubs" of class member implementations so that we can predic add in the functionality you need. ========================== */ +#include "port.h" #include "extdll.h" #include "util.h" #include "cbase.h" diff --git a/cl_dll/cs_wpn/cs_weapons.cpp b/cl_dll/cs_wpn/cs_weapons.cpp index 8c54129..0e3bdf9 100644 --- a/cl_dll/cs_wpn/cs_weapons.cpp +++ b/cl_dll/cs_wpn/cs_weapons.cpp @@ -1394,6 +1394,14 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm case WEAPON_P90: pWeapon = &g_P90; break; + + case WEAPON_NONE: + break; + + case WEAPON_GLOCK: + default: + gEngfuncs.Con_Printf("VALVEWHY: Unknown Weapon %i is active.\n", from->client.m_iId ); + break; } // Store pointer to our destination entity_state_t so we can get our origin, etc. from it @@ -1451,8 +1459,8 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm player.m_rgAmmo[ pCurrent->m_iSecondaryAmmoType ] = (int)from->client.vuser4[ 2 ]; } - if( g_pWpns[ from->client.m_iId - 1 ] ) - g_iWeaponFlags = g_pWpns[ from->client.m_iId - 1 ]->m_iWeaponState; + if( g_pWpns[ from->client.m_iId ] ) + g_iWeaponFlags = g_pWpns[ from->client.m_iId ]->m_iWeaponState; // For random weapon events, use this seed to seed random # generator player.random_seed = random_seed; @@ -1723,7 +1731,7 @@ void _DLLEXPORT HUD_PostRunCmd( local_state_t *from, local_state_t *to, struct u #endif { to->client.fov = g_lastFOV; - g_iWeaponFlags = from->weapondata[ from->client.m_iId - 1].m_iWeaponState; + g_iWeaponFlags = from->weapondata[ from->client.m_iId ].m_iWeaponState; g_iPlayerFlags = from->client.flags; g_iFreezeTimeOver = !(from->client.iuser3 & PLAYER_FREEZE_TIME_OVER); g_bInBombZone = (from->client.iuser3 & PLAYER_IN_BOMB_ZONE) != 0; diff --git a/cl_dll/hud/ammo.cpp b/cl_dll/hud/ammo.cpp index dbc3b94..f0f63b6 100644 --- a/cl_dll/hud/ammo.cpp +++ b/cl_dll/hud/ammo.cpp @@ -588,9 +588,9 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf ) if (gEngfuncs.IsSpectateOnly()) return 1; - if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) + if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) ) { - static wrect_t nullrc; + static wrect_t nullrc = {0, 0, 0, 0}; gpActiveSel = NULL; SetCrosshair( 0, nullrc, 0, 0, 0 ); } @@ -730,7 +730,6 @@ int CHudAmmo::MsgFunc_Crosshair(const char *pszName, int iSize, void *pbuf) int CHudAmmo::MsgFunc_Brass( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); - int MessageID = READ_BYTE(); Vector start, velocity; @@ -1086,13 +1085,15 @@ int CHudAmmo::Draw(float flTime) if (!m_pWeapon) return 0; + if( gHUD.m_iFOV > 40 ) + DrawCrosshair(flTime, m_pWeapon->iId); // draw a dynamic crosshair + WEAPON *pw = m_pWeapon; // shorthand // SPR_Draw Ammo if ((pw->iAmmoType < 0) && (pw->iAmmo2Type < 0)) return 0; - int iFlags = DHN_DRAWZERO; // draw 0 values AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left; @@ -1176,9 +1177,6 @@ int CHudAmmo::Draw(float flTime) } } - if( gHUD.m_iFOV > 40 ) - DrawCrosshair(flTime, m_pWeapon->iId); // draw a dynamic crosshair - return 1; } @@ -1231,6 +1229,10 @@ void CHudAmmo::DrawCrosshair( float flTime, int weaponid ) int iLength; float flCrosshairDistance; + + if ( g_iWeaponFlags & WPNSTATE_SHIELD_DRAWN ) + return; + if ( weaponid > 30 ) { iDistance = 4; diff --git a/common/port.h b/common/port.h index 51fd9b1..6976e94 100644 --- a/common/port.h +++ b/common/port.h @@ -13,6 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#pragma once #ifndef PORT_H #define PORT_H diff --git a/dlls/extdll.h b/dlls/extdll.h index 6e40b11..0c765c4 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -42,9 +42,6 @@ #define NOIME #include "windows.h" #else // _WIN32 -#define FALSE 0 -#define TRUE (!FALSE) -typedef uint32 ULONG; typedef unsigned char BYTE; typedef int BOOL; #define MAX_PATH PATH_MAX diff --git a/dlls/stdafx.h b/dlls/stdafx.h index 669678f..2d9f254 100644 --- a/dlls/stdafx.h +++ b/dlls/stdafx.h @@ -1,7 +1,8 @@ #ifndef stdafx_h__ #define stdafx_h__ +#include "port.h" #include "extdll.h" #include "util.h" -#endif // stdafx_h__ \ No newline at end of file +#endif // stdafx_h__