mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-03-12 05:22:55 +00:00
Use MAX_WEAPONS constant instead of magic numbers (#294)
This commit is contained in:
parent
5d64c9ceb4
commit
8d91e9b4c0
@ -222,7 +222,7 @@ void DLLEXPORT HUD_TxferPredictionData( struct entity_state_s *ps, const struct
|
|||||||
VectorCopy( ppcd->vuser3, pcd->vuser3 );
|
VectorCopy( ppcd->vuser3, pcd->vuser3 );
|
||||||
VectorCopy( ppcd->vuser4, pcd->vuser4 );
|
VectorCopy( ppcd->vuser4, pcd->vuser4 );
|
||||||
|
|
||||||
memcpy( wd, pwd, 32 * sizeof(weapon_data_t) );
|
memcpy( wd, pwd, MAX_WEAPONS * sizeof(weapon_data_t) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,7 +36,7 @@ extern globalvars_t *gpGlobals;
|
|||||||
extern int g_iUser1;
|
extern int g_iUser1;
|
||||||
|
|
||||||
// Pool of client side entities/entvars_t
|
// Pool of client side entities/entvars_t
|
||||||
static entvars_t ev[32];
|
static entvars_t ev[MAX_WEAPONS];
|
||||||
static int num_ents = 0;
|
static int num_ents = 0;
|
||||||
|
|
||||||
// The entity we'll use to represent the local client
|
// The entity we'll use to represent the local client
|
||||||
@ -45,7 +45,7 @@ static CBasePlayer player;
|
|||||||
// Local version of game .dll global variables ( time, etc. )
|
// Local version of game .dll global variables ( time, etc. )
|
||||||
static globalvars_t Globals;
|
static globalvars_t Globals;
|
||||||
|
|
||||||
static CBasePlayerWeapon *g_pWpns[32];
|
static CBasePlayerWeapon *g_pWpns[MAX_WEAPONS];
|
||||||
|
|
||||||
float g_flApplyVel = 0.0;
|
float g_flApplyVel = 0.0;
|
||||||
int g_irunninggausspred = 0;
|
int g_irunninggausspred = 0;
|
||||||
@ -752,7 +752,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||||||
if( !pWeapon )
|
if( !pWeapon )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( i = 0; i < 32; i++ )
|
for( i = 0; i < MAX_WEAPONS; i++ )
|
||||||
{
|
{
|
||||||
pCurrent = g_pWpns[i];
|
pCurrent = g_pWpns[i];
|
||||||
if( !pCurrent )
|
if( !pCurrent )
|
||||||
@ -921,7 +921,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||||||
HUD_SendWeaponAnim( to->client.weaponanim, body, 1 );
|
HUD_SendWeaponAnim( to->client.weaponanim, body, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < 32; i++ )
|
for( i = 0; i < MAX_WEAPONS; i++ )
|
||||||
{
|
{
|
||||||
pCurrent = g_pWpns[i];
|
pCurrent = g_pWpns[i];
|
||||||
|
|
||||||
|
@ -1627,6 +1627,7 @@ void RegisterEncoders( void )
|
|||||||
|
|
||||||
int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
|
int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
|
||||||
{
|
{
|
||||||
|
memset( info, 0, MAX_WEAPONS * sizeof(weapon_data_t) );
|
||||||
#if CLIENT_WEAPONS
|
#if CLIENT_WEAPONS
|
||||||
int i;
|
int i;
|
||||||
weapon_data_t *item;
|
weapon_data_t *item;
|
||||||
@ -1634,8 +1635,6 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
|
|||||||
CBasePlayer *pl = (CBasePlayer *)CBasePlayer::Instance( pev );
|
CBasePlayer *pl = (CBasePlayer *)CBasePlayer::Instance( pev );
|
||||||
CBasePlayerWeapon *gun;
|
CBasePlayerWeapon *gun;
|
||||||
|
|
||||||
memset( info, 0, 32 * sizeof(weapon_data_t) );
|
|
||||||
|
|
||||||
if( !pl )
|
if( !pl )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -1656,7 +1655,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
|
|||||||
// Get The ID.
|
// Get The ID.
|
||||||
gun->GetItemInfo( &II );
|
gun->GetItemInfo( &II );
|
||||||
|
|
||||||
if( II.iId >= 0 && II.iId < 32 )
|
if( II.iId >= 0 && II.iId < MAX_WEAPONS )
|
||||||
{
|
{
|
||||||
item = &info[II.iId];
|
item = &info[II.iId];
|
||||||
|
|
||||||
@ -1682,8 +1681,6 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
memset( info, 0, 32 * sizeof(weapon_data_t) );
|
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -83,8 +83,6 @@ public:
|
|||||||
|
|
||||||
#define WEAPON_SUIT 31 // ?????
|
#define WEAPON_SUIT 31 // ?????
|
||||||
|
|
||||||
#define MAX_WEAPONS 32
|
|
||||||
|
|
||||||
#define MAX_NORMAL_BATTERY 100
|
#define MAX_NORMAL_BATTERY 100
|
||||||
|
|
||||||
// weapon weight factors (for auto-switching) (-1 = noswitch)
|
// weapon weight factors (for auto-switching) (-1 = noswitch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user