mirror of https://github.com/FWGS/hlsdk-xash3d
commit
92aa5456cf
|
@ -305,6 +305,9 @@ void CHudAmmo::Reset( void )
|
|||
gHR.Reset();
|
||||
|
||||
//VidInit();
|
||||
wrect_t nullrc = {0,};
|
||||
SetCrosshair( 0, nullrc, 0, 0, 0 ); // reset crosshair
|
||||
m_pWeapon = NULL; // reset last weapon
|
||||
}
|
||||
|
||||
int CHudAmmo::VidInit( void )
|
||||
|
@ -536,13 +539,13 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
if( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
|
||||
{
|
||||
static wrect_t nullrc;
|
||||
wrect_t nullrc = {0,};
|
||||
gpActiveSel = NULL;
|
||||
SetCrosshair( 0, nullrc, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_pWeapon )
|
||||
if( m_pWeapon )
|
||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
||||
}
|
||||
|
||||
|
@ -556,7 +559,7 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
//
|
||||
int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
static wrect_t nullrc;
|
||||
wrect_t nullrc = {0,};
|
||||
int fOnTarget = FALSE;
|
||||
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
@ -574,6 +577,8 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
if( iId < 1 )
|
||||
{
|
||||
SetCrosshair( 0, nullrc, 0, 0, 0 );
|
||||
// Clear out the weapon so we don't keep drawing the last active weapon's ammo. - Solokiller
|
||||
m_pWeapon = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -604,22 +609,24 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
m_pWeapon = pWeapon;
|
||||
|
||||
if( gHUD.m_iFOV >= 90 )
|
||||
if( !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
|
||||
{
|
||||
// normal crosshairs
|
||||
if( fOnTarget && m_pWeapon->hAutoaim )
|
||||
SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 );
|
||||
if( gHUD.m_iFOV >= 90 )
|
||||
{
|
||||
// normal crosshairs
|
||||
if( fOnTarget && m_pWeapon->hAutoaim )
|
||||
SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 );
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
||||
}
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// zoomed crosshairs
|
||||
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
|
||||
SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 );
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 );
|
||||
|
||||
{
|
||||
// zoomed crosshairs
|
||||
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
|
||||
SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 );
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 );
|
||||
}
|
||||
}
|
||||
|
||||
m_fFade = 200.0f; //!!!
|
||||
|
@ -877,11 +884,11 @@ int CHudAmmo::Draw( float flTime )
|
|||
x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth;
|
||||
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b );
|
||||
|
||||
wrect_t rc;
|
||||
/*wrect_t rc;
|
||||
rc.top = 0;
|
||||
rc.left = 0;
|
||||
rc.right = AmmoWidth;
|
||||
rc.bottom = 100;
|
||||
rc.bottom = 100;*/
|
||||
|
||||
int iBarWidth = AmmoWidth / 10;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "netadr.h"
|
||||
#include "parsemsg.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -32,10 +33,21 @@ extern "C"
|
|||
cl_enginefunc_t gEngfuncs;
|
||||
CHud gHUD;
|
||||
mobile_engfuncs_t *gMobileEngfuncs = NULL;
|
||||
|
||||
extern "C" int g_bhopcap;
|
||||
void InitInput( void );
|
||||
void EV_HookEvents( void );
|
||||
void IN_Commands( void );
|
||||
|
||||
int __MsgFunc_Bhopcap( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
g_bhopcap = READ_BYTE();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================
|
||||
Initialize
|
||||
|
@ -76,18 +88,18 @@ int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs )
|
|||
switch( hullnumber )
|
||||
{
|
||||
case 0: // Normal player
|
||||
mins = Vector( -16, -16, -36 );
|
||||
maxs = Vector( 16, 16, 36 );
|
||||
Vector( -16, -16, -36 ).CopyToArray(mins);
|
||||
Vector( 16, 16, 36 ).CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
case 1: // Crouched player
|
||||
mins = Vector( -16, -16, -18 );
|
||||
maxs = Vector( 16, 16, 18 );
|
||||
Vector( -16, -16, -18 ).CopyToArray(mins);
|
||||
Vector( 16, 16, 18 ).CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
case 2: // Point based hull
|
||||
mins = Vector( 0, 0, 0 );
|
||||
maxs = Vector( 0, 0, 0 );
|
||||
Vector( 0, 0, 0 ).CopyToArray(mins);
|
||||
Vector( 0, 0, 0 ).CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -196,6 +208,8 @@ void DLLEXPORT HUD_Init( void )
|
|||
{
|
||||
InitInput();
|
||||
gHUD.Init();
|
||||
|
||||
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -94,8 +94,12 @@ inline void DrawSetTextColor( float r, float g, float b )
|
|||
inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); }
|
||||
inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); }
|
||||
|
||||
inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); }
|
||||
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
||||
inline client_textmessage_t *TextMessageGet( const char *pName )
|
||||
{
|
||||
return gEngfuncs.pfnTextMessageGet( pName );
|
||||
}
|
||||
|
||||
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
||||
{
|
||||
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
|
||||
}
|
||||
|
@ -115,7 +119,7 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
|||
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
|
||||
}
|
||||
|
||||
int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b );
|
||||
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b );
|
||||
|
||||
inline int ConsoleStringLen( const char *string )
|
||||
{
|
||||
|
@ -140,7 +144,7 @@ inline void CenterPrint( const char *string )
|
|||
#define GetPlayerInfo ( *gEngfuncs.pfnGetPlayerInfo )
|
||||
|
||||
// sound functions
|
||||
inline void PlaySound( char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }
|
||||
inline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }
|
||||
inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); }
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
|
|
@ -41,12 +41,12 @@ COM_Log
|
|||
Log debug messages to file ( appends )
|
||||
====================
|
||||
*/
|
||||
void COM_Log( char *pszFile, char *fmt, ... )
|
||||
void COM_Log( const char *pszFile, const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
FILE *fp;
|
||||
char *pfilename;
|
||||
const char *pfilename;
|
||||
|
||||
if( !pszFile )
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ HUD_PlaySound
|
|||
Play a sound, if we are seeing this command for the first time
|
||||
=====================
|
||||
*/
|
||||
void HUD_PlaySound( char *sound, float volume )
|
||||
void HUD_PlaySound( const char *sound, float volume )
|
||||
{
|
||||
if( !g_runfuncs || !g_finalstate )
|
||||
return;
|
||||
|
@ -268,12 +268,12 @@ stub functions for such things as precaching. So we don't have to modify weapon
|
|||
is compiled into both game and client .dlls.
|
||||
======================
|
||||
*/
|
||||
int stub_PrecacheModel( char* s )
|
||||
int stub_PrecacheModel( const char* s )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stub_PrecacheSound( char* s )
|
||||
int stub_PrecacheSound( const char* s )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ extern "C"
|
|||
void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );
|
||||
}
|
||||
|
||||
void COM_Log( char *pszFile, char *fmt, ... );
|
||||
void COM_Log( const char *pszFile, const char *fmt, ... );
|
||||
int CL_IsDead( void );
|
||||
|
||||
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
|
||||
|
@ -28,11 +28,11 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
|
|||
|
||||
int HUD_GetWeaponAnim( void );
|
||||
void HUD_SendWeaponAnim( int iAnim, int body, int force );
|
||||
void HUD_PlaySound( char *sound, float volume );
|
||||
void HUD_PlaySound( const char *sound, float volume );
|
||||
void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||
void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
|
||||
int stub_PrecacheModel( char* s );
|
||||
int stub_PrecacheSound( char* s );
|
||||
int stub_PrecacheModel( const char* s );
|
||||
int stub_PrecacheSound( const char* s );
|
||||
unsigned short stub_PrecacheEvent( int type, const char *s );
|
||||
const char *stub_NameForFunction( void *function );
|
||||
void stub_SetModel( struct edict_s *e, const char *m );
|
||||
|
|
|
@ -187,7 +187,8 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
||||
|
||||
// Get the Killer's name
|
||||
char *killer_name = g_PlayerInfoList[killer].name;
|
||||
const char *killer_name = "";
|
||||
killer_name = g_PlayerInfoList[killer].name;
|
||||
if( !killer_name )
|
||||
{
|
||||
killer_name = "";
|
||||
|
@ -201,11 +202,11 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
}
|
||||
|
||||
// Get the Victim's name
|
||||
char *victim_name = NULL;
|
||||
const char *victim_name = "";
|
||||
// If victim is -1, the killer killed a specific, non-player object (like a sentrygun)
|
||||
if ( ( (char)victim ) != -1 )
|
||||
if( ( (char)victim ) != -1 )
|
||||
victim_name = g_PlayerInfoList[victim].name;
|
||||
if ( !victim_name )
|
||||
if( !victim_name )
|
||||
{
|
||||
victim_name = "";
|
||||
rgDeathNoticeList[i].szVictim[0] = 0;
|
||||
|
@ -218,7 +219,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
}
|
||||
|
||||
// Is it a non-player object kill?
|
||||
if ( ( (char)victim ) == -1 )
|
||||
if( ( (char)victim ) == -1 )
|
||||
{
|
||||
rgDeathNoticeList[i].iNonPlayerKill = TRUE;
|
||||
|
||||
|
@ -227,10 +228,10 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( killer == victim || killer == 0 )
|
||||
if( killer == victim || killer == 0 )
|
||||
rgDeathNoticeList[i].iSuicide = TRUE;
|
||||
|
||||
if ( !strcmp( killedwith, "d_teammate" ) )
|
||||
if( !strcmp( killedwith, "d_teammate" ) )
|
||||
rgDeathNoticeList[i].iTeamKill = TRUE;
|
||||
}
|
||||
|
||||
|
@ -285,7 +286,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
// replace the code names with the 'real' names
|
||||
if( !strcmp( killedwith + 2, "egon" ) )
|
||||
strcpy( killedwith, "d_gluon gun" );
|
||||
if ( !strcmp( killedwith + 2, "gauss" ) )
|
||||
if( !strcmp( killedwith + 2, "gauss" ) )
|
||||
strcpy( killedwith, "d_tau cannon" );
|
||||
|
||||
ConsolePrint( killedwith + 2 ); // skip over the "d_" part
|
||||
|
|
|
@ -585,10 +585,10 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
static int gTempEntFrame = 0;
|
||||
int i;
|
||||
TEMPENTITY *pTemp, *pnext, *pprev;
|
||||
float freq, gravity, gravitySlow, life, fastFreq;
|
||||
float /*freq,*/ gravity, gravitySlow, life, fastFreq;
|
||||
|
||||
// Nothing to simulate
|
||||
if ( !*ppTempEntActive )
|
||||
if( !*ppTempEntActive )
|
||||
return;
|
||||
|
||||
// in order to have tents collide with players, we have to run the player prediction code so
|
||||
|
@ -601,7 +601,7 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
gEngfuncs.pEventAPI->EV_PushPMStates();
|
||||
|
||||
// Now add in all of the players.
|
||||
gEngfuncs.pEventAPI->EV_SetSolidPlayers( -1 );
|
||||
gEngfuncs.pEventAPI->EV_SetSolidPlayers( -1 );
|
||||
|
||||
// !!!BUGBUG -- This needs to be time based
|
||||
gTempEntFrame = ( gTempEntFrame + 1 ) & 31;
|
||||
|
@ -623,7 +623,7 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
}
|
||||
|
||||
pprev = NULL;
|
||||
freq = client_time * 0.01;
|
||||
//freq = client_time * 0.01;
|
||||
fastFreq = client_time * 5.5;
|
||||
gravity = -frametime * cl_gravity;
|
||||
gravitySlow = gravity * 0.5;
|
||||
|
@ -709,12 +709,12 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
}
|
||||
else if( pTemp->flags & FTENT_SPIRAL )
|
||||
{
|
||||
float s, c;
|
||||
/*float s, c;
|
||||
s = sin( pTemp->entity.baseline.origin[2] + fastFreq );
|
||||
c = cos( pTemp->entity.baseline.origin[2] + fastFreq );
|
||||
c = cos( pTemp->entity.baseline.origin[2] + fastFreq );*/
|
||||
|
||||
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (int)(size_t)pTemp );
|
||||
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (int)(size_t)pTemp );
|
||||
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (size_t)pTemp );
|
||||
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (size_t)pTemp );
|
||||
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
extern engine_studio_api_t IEngineStudio;
|
||||
|
||||
static int tracerCount[32];
|
||||
static int g_tracerCount[32];
|
||||
|
||||
extern "C" char PM_FindTextureType( char *name );
|
||||
|
||||
|
@ -94,7 +94,7 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
|
|||
char chTextureType = CHAR_TEX_CONCRETE;
|
||||
float fvol;
|
||||
float fvolbar;
|
||||
char *rgsz[4];
|
||||
const char *rgsz[4];
|
||||
int cnt;
|
||||
float fattn = ATTN_NORM;
|
||||
int entity;
|
||||
|
@ -521,16 +521,17 @@ void EV_FireGlock2( event_args_t *args )
|
|||
VectorCopy( args->origin, origin );
|
||||
VectorCopy( args->angles, angles );
|
||||
VectorCopy( args->velocity, velocity );
|
||||
int empty = args->bparam1;
|
||||
|
||||
AngleVectors( angles, forward, right, up );
|
||||
|
||||
shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/shell.mdl");// brass shell
|
||||
shell = gEngfuncs.pEventAPI->EV_FindModelIndex( "models/shell.mdl" );// brass shell
|
||||
|
||||
if( EV_IsLocal( idx ) )
|
||||
{
|
||||
// Add muzzle flash to current weapon model
|
||||
EV_MuzzleFlash();
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( GLOCK_SHOOT, 2 );
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 );
|
||||
|
||||
V_PunchAxis( 0, -2.0 );
|
||||
}
|
||||
|
@ -545,7 +546,7 @@ void EV_FireGlock2( event_args_t *args )
|
|||
|
||||
VectorCopy( forward, vecAiming );
|
||||
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
}
|
||||
//======================
|
||||
// GLOCK END
|
||||
|
@ -568,7 +569,7 @@ void EV_FireShotGunDouble( event_args_t *args )
|
|||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t vecSpread;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -601,11 +602,11 @@ void EV_FireShotGunDouble( event_args_t *args )
|
|||
|
||||
if( gEngfuncs.GetMaxClients() > 1 )
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 8, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.17365, 0.04362 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 8, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.17365, 0.04362 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 12, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 12, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,7 +623,7 @@ void EV_FireShotGunSingle( event_args_t *args )
|
|||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t vecSpread;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -653,11 +654,11 @@ void EV_FireShotGunSingle( event_args_t *args )
|
|||
|
||||
if( gEngfuncs.GetMaxClients() > 1 )
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 4, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.08716, 0.04362 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 4, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.04362 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
}
|
||||
}
|
||||
//======================
|
||||
|
@ -679,7 +680,7 @@ void EV_FireMP5( event_args_t *args )
|
|||
int shell;
|
||||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -718,11 +719,11 @@ void EV_FireMP5( event_args_t *args )
|
|||
|
||||
if( gEngfuncs.GetMaxClients() > 1 )
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -769,7 +770,7 @@ void EV_FirePython( event_args_t *args )
|
|||
|
||||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -860,16 +861,16 @@ void EV_FireGauss( event_args_t *args )
|
|||
vec3_t angles;
|
||||
vec3_t velocity;
|
||||
float flDamage = args->fparam1;
|
||||
int primaryfire = args->bparam1;
|
||||
//int primaryfire = args->bparam1;
|
||||
|
||||
int m_fPrimaryFire = args->bparam1;
|
||||
int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
|
||||
//int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
|
||||
vec3_t vecSrc;
|
||||
vec3_t vecDest;
|
||||
edict_t *pentIgnore;
|
||||
//edict_t *pentIgnore;
|
||||
pmtrace_t tr, beam_tr;
|
||||
float flMaxFrac = 1.0;
|
||||
int nTotal = 0;
|
||||
//int nTotal = 0;
|
||||
int fHasPunched = 0;
|
||||
int fFirstBeam = 1;
|
||||
int nMaxHits = 10;
|
||||
|
@ -980,7 +981,7 @@ void EV_FireGauss( event_args_t *args )
|
|||
{
|
||||
float n;
|
||||
|
||||
pentIgnore = NULL;
|
||||
//pentIgnore = NULL;
|
||||
|
||||
n = -DotProduct( tr.plane.normal, forward );
|
||||
|
||||
|
@ -1137,7 +1138,13 @@ enum crowbar_e
|
|||
CROWBAR_ATTACK2MISS,
|
||||
CROWBAR_ATTACK2HIT,
|
||||
CROWBAR_ATTACK3MISS,
|
||||
#ifndef CROWBAR_IDLE_ANIM
|
||||
CROWBAR_ATTACK3HIT
|
||||
#else
|
||||
CROWBAR_ATTACK3HIT,
|
||||
CROWBAR_IDLE2,
|
||||
CROWBAR_IDLE3
|
||||
#endif
|
||||
};
|
||||
|
||||
int g_iSwing;
|
||||
|
@ -1159,8 +1166,6 @@ void EV_Crowbar( event_args_t *args )
|
|||
|
||||
if( EV_IsLocal( idx ) )
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 );
|
||||
|
||||
switch( (g_iSwing++) % 3 )
|
||||
{
|
||||
case 0:
|
||||
|
@ -1412,12 +1417,12 @@ BEAM *pBeam2;
|
|||
|
||||
void EV_EgonFire( event_args_t *args )
|
||||
{
|
||||
int idx, iFireState, iFireMode;
|
||||
int idx, /*iFireState,*/ iFireMode;
|
||||
vec3_t origin;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
iFireState = args->iparam1;
|
||||
//iFireState = args->iparam1;
|
||||
iFireMode = args->iparam2;
|
||||
int iStartup = args->bparam1;
|
||||
|
||||
|
@ -1430,6 +1435,12 @@ void EV_EgonFire( event_args_t *args )
|
|||
}
|
||||
else
|
||||
{
|
||||
// If there is any sound playing already, kill it. - Solokiller
|
||||
// This is necessary because multiple sounds can play on the same channel at the same time.
|
||||
// In some cases, more than 1 run sound plays when the egon stops firing, in which case only the earliest entry in the list is stopped.
|
||||
// This ensures no more than 1 of those is ever active at the same time.
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, EGON_SOUND_RUN );
|
||||
|
||||
if( iFireMode == FIRE_WIDE )
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.98, ATTN_NORM, 0, 125 );
|
||||
else
|
||||
|
@ -1438,7 +1449,7 @@ void EV_EgonFire( event_args_t *args )
|
|||
|
||||
//Only play the weapon anims if I shot it.
|
||||
if( EV_IsLocal( idx ) )
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation ( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 );
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 );
|
||||
|
||||
if( iStartup == 1 && EV_IsLocal( idx ) && !pBeam && !pBeam2 && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
|
||||
{
|
||||
|
@ -1539,13 +1550,13 @@ enum hgun_e
|
|||
|
||||
void EV_HornetGunFire( event_args_t *args )
|
||||
{
|
||||
int idx, iFireMode;
|
||||
int idx; //, iFireMode;
|
||||
vec3_t origin, angles, vecSrc, forward, right, up;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
VectorCopy( args->angles, angles );
|
||||
iFireMode = args->iparam1;
|
||||
//iFireMode = args->iparam1;
|
||||
|
||||
//Only play the weapon anims if I shot it.
|
||||
if( EV_IsLocal( idx ) )
|
||||
|
@ -1554,7 +1565,7 @@ void EV_HornetGunFire( event_args_t *args )
|
|||
gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 );
|
||||
}
|
||||
|
||||
switch( gEngfuncs.pfnRandomLong( 0 , 2 ) )
|
||||
switch( gEngfuncs.pfnRandomLong( 0, 2 ) )
|
||||
{
|
||||
case 0:
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 );
|
||||
|
@ -1690,7 +1701,7 @@ void EV_TrainPitchAdjust( event_args_t *args )
|
|||
int pitch;
|
||||
int stop;
|
||||
|
||||
char sz[256];
|
||||
const char *pszSound;
|
||||
|
||||
idx = args->entindex;
|
||||
|
||||
|
@ -1706,36 +1717,35 @@ void EV_TrainPitchAdjust( event_args_t *args )
|
|||
switch( noise )
|
||||
{
|
||||
case 1:
|
||||
strcpy( sz, "plats/ttrain1.wav" );
|
||||
pszSound = "plats/ttrain1.wav";
|
||||
break;
|
||||
case 2:
|
||||
strcpy( sz, "plats/ttrain2.wav" );
|
||||
pszSound = "plats/ttrain2.wav";
|
||||
break;
|
||||
case 3:
|
||||
strcpy( sz, "plats/ttrain3.wav" );
|
||||
pszSound = "plats/ttrain3.wav";
|
||||
break;
|
||||
case 4:
|
||||
strcpy( sz, "plats/ttrain4.wav");
|
||||
pszSound = "plats/ttrain4.wav";
|
||||
break;
|
||||
case 5:
|
||||
strcpy( sz, "plats/ttrain6.wav");
|
||||
pszSound = "plats/ttrain6.wav";
|
||||
break;
|
||||
case 6:
|
||||
strcpy( sz, "plats/ttrain7.wav");
|
||||
pszSound = "plats/ttrain7.wav";
|
||||
break;
|
||||
default:
|
||||
// no sound
|
||||
strcpy( sz, "" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( stop )
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, sz );
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, pszSound );
|
||||
}
|
||||
else
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, sz, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, pszSound, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ void CHudFlashlight::Reset( void )
|
|||
{
|
||||
m_fFade = 0;
|
||||
m_fOn = 0;
|
||||
m_iBat = 100;
|
||||
m_flBat = 1.0;
|
||||
}
|
||||
|
||||
int CHudFlashlight::VidInit( void )
|
||||
|
|
|
@ -65,7 +65,7 @@ int CHudGeiger::Draw( float flTime )
|
|||
{
|
||||
int pct;
|
||||
float flvol = 0.0f;
|
||||
int rg[3];
|
||||
//int rg[3];
|
||||
int i;
|
||||
|
||||
if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 )
|
||||
|
@ -79,61 +79,61 @@ int CHudGeiger::Draw( float flTime )
|
|||
{
|
||||
pct = 2;
|
||||
flvol = 0.4; //Con_Printf( "range > 600\n" );
|
||||
rg[0] = 1;
|
||||
rg[1] = 1;
|
||||
//rg[0] = 1;
|
||||
//rg[1] = 1;
|
||||
i = 2;
|
||||
}
|
||||
else if( m_iGeigerRange > 500 )
|
||||
{
|
||||
pct = 4;
|
||||
flvol = 0.5; //Con_Printf( "range > 500\n" );
|
||||
rg[0] = 1;
|
||||
rg[1] = 2;
|
||||
//rg[0] = 1;
|
||||
//rg[1] = 2;
|
||||
i = 2;
|
||||
}
|
||||
else if( m_iGeigerRange > 400 )
|
||||
{
|
||||
pct = 8;
|
||||
flvol = 0.6; //Con_Printf( "range > 400\n" );
|
||||
rg[0] = 1;
|
||||
rg[1] = 2;
|
||||
rg[2] = 3;
|
||||
//rg[0] = 1;
|
||||
//rg[1] = 2;
|
||||
//rg[2] = 3;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 300 )
|
||||
{
|
||||
pct = 8;
|
||||
flvol = 0.7; //Con_Printf( "range > 300\n" );
|
||||
rg[0] = 2;
|
||||
rg[1] = 3;
|
||||
rg[2] = 4;
|
||||
//rg[0] = 2;
|
||||
//rg[1] = 3;
|
||||
//rg[2] = 4;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 200 )
|
||||
{
|
||||
pct = 28;
|
||||
flvol = 0.78; //Con_Printf( "range > 200\n" );
|
||||
rg[0] = 2;
|
||||
rg[1] = 3;
|
||||
rg[2] = 4;
|
||||
//rg[0] = 2;
|
||||
//rg[1] = 3;
|
||||
//rg[2] = 4;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 150 )
|
||||
{
|
||||
pct = 40;
|
||||
flvol = 0.80; //Con_Printf( "range > 150\n" );
|
||||
rg[0] = 3;
|
||||
rg[1] = 4;
|
||||
rg[2] = 5;
|
||||
//rg[0] = 3;
|
||||
//rg[1] = 4;
|
||||
//rg[2] = 5;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 100 )
|
||||
{
|
||||
pct = 60;
|
||||
flvol = 0.85; //Con_Printf( "range > 100\n" );
|
||||
rg[0] = 3;
|
||||
rg[1] = 4;
|
||||
rg[2] = 5;
|
||||
//rg[0] = 3;
|
||||
//rg[1] = 4;
|
||||
//rg[2] = 5;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 75 )
|
||||
|
@ -141,29 +141,29 @@ int CHudGeiger::Draw( float flTime )
|
|||
pct = 80;
|
||||
flvol = 0.9; //Con_Printf( "range > 75\n" );
|
||||
//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;
|
||||
rg[0] = 4;
|
||||
rg[1] = 5;
|
||||
rg[2] = 6;
|
||||
//rg[0] = 4;
|
||||
//rg[1] = 5;
|
||||
//rg[2] = 6;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 50 )
|
||||
{
|
||||
pct = 90;
|
||||
flvol = 0.95; //Con_Printf( "range > 50\n" );
|
||||
rg[0] = 5;
|
||||
rg[1] = 6;
|
||||
//rg[0] = 5;
|
||||
//rg[1] = 6;
|
||||
i = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pct = 95;
|
||||
flvol = 1.0; //Con_Printf( "range < 50\n" );
|
||||
rg[0] = 5;
|
||||
rg[1] = 6;
|
||||
//rg[0] = 5;
|
||||
//rg[1] = 6;
|
||||
i = 2;
|
||||
}
|
||||
|
||||
flvol = ( flvol * ( (rand() & 127) ) / 255) + 0.25; // UTIL_RandomFloat(0.25, 0.5);
|
||||
flvol = ( flvol * ( ( rand() & 127 ) ) / 255 ) + 0.25; // UTIL_RandomFloat( 0.25, 0.5 );
|
||||
|
||||
if( ( rand() & 127 ) < pct || ( rand() & 127 ) < pct )
|
||||
{
|
||||
|
|
|
@ -54,7 +54,8 @@ int CBaseEntity::IsDormant( void ) { return 0; }
|
|||
BOOL CBaseEntity::IsInWorld( void ) { return TRUE; }
|
||||
int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; }
|
||||
int CBaseEntity::DamageDecal( int bitsDamageType ) { return -1; }
|
||||
CBaseEntity *CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
|
||||
CBaseEntity *CBaseEntity::Create( const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
|
||||
void CBaseEntity::UpdateOnRemove( void ) { }
|
||||
void CBaseEntity::SUB_Remove( void ) { }
|
||||
|
||||
// CBaseDelay Stubs
|
||||
|
@ -146,7 +147,7 @@ int CBaseMonster::CheckEnemy( CBaseEntity *pEnemy ) { return 0; }
|
|||
void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { }
|
||||
BOOL CBaseMonster::PopEnemy() { return FALSE; }
|
||||
void CBaseMonster::SetActivity( Activity NewActivity ) { }
|
||||
void CBaseMonster::SetSequenceByName( char *szSequence ) { }
|
||||
void CBaseMonster::SetSequenceByName( const char *szSequence ) { }
|
||||
int CBaseMonster::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; }
|
||||
float CBaseMonster::OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; }
|
||||
void CBaseMonster::AdvanceRoute( float distance ) { }
|
||||
|
@ -214,7 +215,7 @@ void CBaseMonster::MonsterInitDead( void ) { }
|
|||
BOOL CBaseMonster::BBoxFlat( void ) { return TRUE; }
|
||||
BOOL CBaseMonster::GetEnemy( void ) { return FALSE; }
|
||||
void CBaseMonster::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
|
||||
CBaseEntity* CBaseMonster::DropItem( char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; }
|
||||
CBaseEntity* CBaseMonster::DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; }
|
||||
BOOL CBaseMonster::ShouldFadeOnDeath( void ) { return FALSE; }
|
||||
void CBaseMonster::RadiusDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
|
||||
void CBaseMonster::RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
|
||||
|
@ -258,8 +259,8 @@ void CBasePlayer::PreThink(void) { }
|
|||
void CBasePlayer::CheckTimeBasedDamage() { }
|
||||
void CBasePlayer::UpdateGeigerCounter( void ) { }
|
||||
void CBasePlayer::CheckSuitUpdate() { }
|
||||
void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) { }
|
||||
void CBasePlayer::UpdatePlayerSound ( void ) { }
|
||||
void CBasePlayer::SetSuitUpdate( const char *name, int fgroup, int iNoRepeatTime ) { }
|
||||
void CBasePlayer::UpdatePlayerSound( void ) { }
|
||||
void CBasePlayer::PostThink() { }
|
||||
void CBasePlayer::Precache( void ) { }
|
||||
int CBasePlayer::Save( CSave &save ) { return 0; }
|
||||
|
@ -276,7 +277,7 @@ void CBasePlayer::ForceClientDllUpdate( void ) { }
|
|||
void CBasePlayer::ImpulseCommands() { }
|
||||
void CBasePlayer::CheatImpulseCommands( int iImpulse ) { }
|
||||
int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHoster ) { return FALSE; }
|
||||
void CBasePlayer::ItemPreFrame() { }
|
||||
void CBasePlayer::ItemPostFrame() { }
|
||||
int CBasePlayer::AmmoInventory( int iAmmoIndex ) { return -1; }
|
||||
|
@ -298,7 +299,7 @@ BOOL CBasePlayer::HasPlayerItem( CBasePlayerItem *pCheckItem ) { return FALSE; }
|
|||
BOOL CBasePlayer::SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; }
|
||||
Vector CBasePlayer::GetGunPosition( void ) { return g_vecZero; }
|
||||
const char *CBasePlayer::TeamID( void ) { return ""; }
|
||||
int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax ) { return 0; }
|
||||
int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax ) { return 0; }
|
||||
void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) { }
|
||||
void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { }
|
||||
|
||||
|
@ -314,6 +315,7 @@ int CBasePlayerItem::Restore( class CRestore & ) { return 1; }
|
|||
int CBasePlayerItem::Save( class CSave & ) { return 1; }
|
||||
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
|
||||
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
|
||||
float CBasePlayerWeapon::GetNextAttackDelay( float flTime ) { return flTime; }
|
||||
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
|
||||
void CBasePlayerItem::FallInit( void ) { }
|
||||
void CBasePlayerItem::FallThink( void ) { }
|
||||
|
|
|
@ -75,7 +75,7 @@ AlertMessage
|
|||
Print debug messages to console
|
||||
======================
|
||||
*/
|
||||
void AlertMessage( ALERT_TYPE atype, char *szFmt, ... )
|
||||
void AlertMessage( ALERT_TYPE atype, const char *szFmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -96,7 +96,7 @@ bool bIsMultiplayer( void )
|
|||
}
|
||||
|
||||
//Just loads a v_ model.
|
||||
void LoadVModel( char *szViewModel, CBasePlayer *m_pPlayer )
|
||||
void LoadVModel( const char *szViewModel, CBasePlayer *m_pPlayer )
|
||||
{
|
||||
gEngfuncs.CL_LoadModel( szViewModel, &m_pPlayer->pev->viewmodel );
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
|
|||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
return FALSE;
|
||||
|
||||
int j = min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
|
||||
int j = Q_min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
|
||||
|
||||
if( j == 0 )
|
||||
return FALSE;
|
||||
|
@ -208,7 +208,7 @@ CBasePlayerWeapon::DefaultDeploy
|
|||
|
||||
=====================
|
||||
*/
|
||||
BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal, int body )
|
||||
BOOL CBasePlayerWeapon::DefaultDeploy( const char *szViewModel, const char *szWeaponModel, int iAnim, const char *szAnimExt, int skiplocal, int body )
|
||||
{
|
||||
if( !CanDeploy() )
|
||||
return FALSE;
|
||||
|
@ -288,7 +288,7 @@ Only produces random numbers to match the server ones.
|
|||
*/
|
||||
Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand )
|
||||
{
|
||||
float x = 0, y = 0, z;
|
||||
float x = 0.0f, y = 0.0f, z;
|
||||
|
||||
for( ULONG iShot = 1; iShot <= cShots; iShot++ )
|
||||
{
|
||||
|
@ -560,27 +560,6 @@ void UTIL_ParticleLine( CBasePlayer *player, float *start, float *end, float lif
|
|||
gEngfuncs.pEfxAPI->R_ParticleLine( start, end, r, g, b, life );
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CBasePlayerWeapon::PrintState
|
||||
|
||||
For debugging, print out state variables to log file
|
||||
=====================
|
||||
*/
|
||||
void CBasePlayerWeapon::PrintState( void )
|
||||
{
|
||||
COM_Log( "c:\\hl.log", "%.4f ", gpGlobals->time );
|
||||
COM_Log( "c:\\hl.log", "%.4f ", m_pPlayer->m_flNextAttack );
|
||||
COM_Log( "c:\\hl.log", "%.4f ", m_flNextPrimaryAttack );
|
||||
COM_Log( "c:\\hl.log", "%.4f ", m_flTimeWeaponIdle - gpGlobals->time );
|
||||
COM_Log( "c:\\hl.log", "%i ", m_iClip );
|
||||
}
|
||||
|
||||
int RandomLong( int a, int b )
|
||||
{
|
||||
return gEngfuncs.pfnRandomLong( a, b );
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
HUD_InitClientWeapons
|
||||
|
|
|
@ -35,6 +35,7 @@ extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz,
|
|||
|
||||
extern cvar_t *sensitivity;
|
||||
cvar_t *cl_lw = NULL;
|
||||
cvar_t *cl_viewbob = NULL;
|
||||
|
||||
void ShutdownInput( void );
|
||||
|
||||
|
@ -194,6 +195,7 @@ void CHud::Init( void )
|
|||
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
||||
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
||||
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
||||
cl_viewbob = CVAR_CREATE( "cl_viewbob", "0", FCVAR_ARCHIVE );
|
||||
|
||||
m_pSpriteList = NULL;
|
||||
|
||||
|
|
12
cl_dll/hud.h
12
cl_dll/hud.h
|
@ -480,7 +480,7 @@ public:
|
|||
int Init( void );
|
||||
static char *LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size );
|
||||
static char *BufferedLocaliseTextString( const char *msg );
|
||||
char *LookupString( const char *msg_name, int *msg_dest = NULL );
|
||||
const char *LookupString( const char *msg_name, int *msg_dest = NULL );
|
||||
int MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf );
|
||||
};
|
||||
|
||||
|
@ -541,8 +541,8 @@ public:
|
|||
|
||||
//had to make these public so CHud could access them (to enable concussion icon)
|
||||
//could use a friend declaration instead...
|
||||
void EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );
|
||||
void DisableIcon( char *pszIconName );
|
||||
void EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );
|
||||
void DisableIcon( const char *pszIconName );
|
||||
|
||||
private:
|
||||
typedef struct
|
||||
|
@ -588,11 +588,11 @@ public:
|
|||
|
||||
int m_iFontHeight;
|
||||
int DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b );
|
||||
int DrawHudString( int x, int y, int iMaxX, char *szString, int r, int g, int b );
|
||||
int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b );
|
||||
int DrawHudString( int x, int y, int iMaxX, const char *szString, int r, int g, int b );
|
||||
int DrawHudStringReverse( int xpos, int ypos, int iMinX, const char *szString, int r, int g, int b );
|
||||
int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b );
|
||||
int GetNumWidth( int iNumber, int iFlags );
|
||||
int DrawHudStringLen( char *szIt );
|
||||
int DrawHudStringLen( const char *szIt );
|
||||
void DrawDarkRectangle( int x, int y, int wide, int tall );
|
||||
|
||||
private:
|
||||
|
|
|
@ -93,6 +93,13 @@ int CHud::Redraw( float flTime, int intermission )
|
|||
if( m_flTimeDelta < 0 )
|
||||
m_flTimeDelta = 0;
|
||||
|
||||
if( !m_iIntermission && intermission )
|
||||
{
|
||||
// Take a screenshot if the client's got the cvar set
|
||||
if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
|
||||
m_flShotTime = flTime + 1.0; // Take a screenshot in a second
|
||||
}
|
||||
|
||||
if( m_flShotTime && m_flShotTime < flTime )
|
||||
{
|
||||
gEngfuncs.pfnClientCmd( "snapshot\n" );
|
||||
|
@ -192,7 +199,7 @@ const unsigned char colors[8][3] =
|
|||
{240, 180, 24}
|
||||
};
|
||||
|
||||
int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
|
||||
int CHud::DrawHudString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b )
|
||||
{
|
||||
if( hud_textmode->value == 2 )
|
||||
{
|
||||
|
@ -226,9 +233,7 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g
|
|||
return xpos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
|
||||
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b )
|
||||
{
|
||||
// xash3d: reset unicode state
|
||||
gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 );
|
||||
|
@ -255,7 +260,7 @@ int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int
|
|||
return xpos;
|
||||
}
|
||||
|
||||
int CHud::DrawHudStringLen( char *szIt )
|
||||
int CHud::DrawHudStringLen( const char *szIt )
|
||||
{
|
||||
int l = 0;
|
||||
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||
|
@ -273,10 +278,10 @@ int CHud::DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r
|
|||
}
|
||||
|
||||
// draws a string from right to left (right-aligned)
|
||||
int CHud::DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b )
|
||||
int CHud::DrawHudStringReverse( int xpos, int ypos, int iMinX, const char *szString, int r, int g, int b )
|
||||
{
|
||||
// find the end of the string
|
||||
for( char *szIt = szString; *szIt != 0; szIt++ )
|
||||
for( const char *szIt = szString; *szIt != 0; szIt++ )
|
||||
xpos -= gHUD.m_scrinfo.charWidths[(unsigned char)*szIt];
|
||||
if( xpos < iMinX )
|
||||
xpos = iMinX;
|
||||
|
|
|
@ -175,13 +175,13 @@ void UTIL_StringToVector( float * pVector, const char *pString )
|
|||
}
|
||||
}
|
||||
|
||||
int UTIL_FindEntityInMap( char * name, float * origin, float * angle )
|
||||
int UTIL_FindEntityInMap( const char *name, float *origin, float *angle )
|
||||
{
|
||||
int n, found = 0;
|
||||
char keyname[256];
|
||||
char token[2048];
|
||||
|
||||
cl_entity_t * pEnt = gEngfuncs.GetEntityByIndex( 0 ); // get world model
|
||||
cl_entity_t *pEnt = gEngfuncs.GetEntityByIndex( 0 ); // get world model
|
||||
|
||||
if( !pEnt )
|
||||
return 0;
|
||||
|
@ -189,7 +189,7 @@ int UTIL_FindEntityInMap( char * name, float * origin, float * angle )
|
|||
if( !pEnt->model )
|
||||
return 0;
|
||||
|
||||
char * data = pEnt->model->entities;
|
||||
char *data = pEnt->model->entities;
|
||||
|
||||
while( data )
|
||||
{
|
||||
|
@ -1374,12 +1374,12 @@ void CHudSpectator::DeathMessage( int victim )
|
|||
AddOverviewEntityToList(m_hsprPlayerDead, pl, gEngfuncs.GetClientTime() + 2.0f );
|
||||
}
|
||||
|
||||
bool CHudSpectator::AddOverviewEntityToList(HSPRITE sprite, cl_entity_t *ent, double killTime)
|
||||
bool CHudSpectator::AddOverviewEntityToList( HSPRITE sprite, cl_entity_t *ent, double killTime )
|
||||
{
|
||||
for( int i = 0; i < MAX_OVERVIEW_ENTITIES; i++ )
|
||||
{
|
||||
// find empty entity slot
|
||||
if( m_OverviewEntities[i].entity == NULL)
|
||||
if( m_OverviewEntities[i].entity == NULL )
|
||||
{
|
||||
m_OverviewEntities[i].entity = ent;
|
||||
m_OverviewEntities[i].hSprite = sprite;
|
||||
|
|
|
@ -64,11 +64,11 @@ public:
|
|||
void CheckOverviewEntities();
|
||||
void DrawOverview();
|
||||
void DrawOverviewEntities();
|
||||
void GetMapPosition( float * returnvec );
|
||||
void GetMapPosition( float *returnvec );
|
||||
void DrawOverviewLayer();
|
||||
void LoadMapSprites();
|
||||
bool ParseOverviewFile();
|
||||
bool IsActivePlayer( cl_entity_t * ent );
|
||||
bool IsActivePlayer( cl_entity_t *ent );
|
||||
void SetModes( int iMainMode, int iInsetMode );
|
||||
void HandleButtonsDown( int ButtonPressed );
|
||||
void HandleButtonsUp( int ButtonPressed );
|
||||
|
|
|
@ -83,7 +83,7 @@ int CHudMenu::Draw( float flTime )
|
|||
int nlc = 0;
|
||||
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
|
||||
{
|
||||
if ( g_szMenuString[i] == '\n' )
|
||||
if( g_szMenuString[i] == '\n' )
|
||||
nlc++;
|
||||
}
|
||||
|
||||
|
@ -153,19 +153,21 @@ int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
|
|||
else
|
||||
{
|
||||
// append to the current menu string
|
||||
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen( g_szPrelocalisedMenuString ) );
|
||||
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen( g_szPrelocalisedMenuString ) - 1 );
|
||||
}
|
||||
g_szPrelocalisedMenuString[MAX_MENU_STRING - 1] = 0; // ensure null termination (strncat/strncpy does not)
|
||||
|
||||
if( !NeedMore )
|
||||
{
|
||||
// we have the whole string, so we can localise it now
|
||||
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) );
|
||||
strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );
|
||||
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
|
||||
|
||||
// Swap in characters
|
||||
if( KB_ConvertString( g_szMenuString, &temp ) )
|
||||
{
|
||||
strcpy( g_szMenuString, temp );
|
||||
strncpy( g_szMenuString, temp, MAX_MENU_STRING );
|
||||
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
|
||||
free( temp );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ DECLARE_MESSAGE( m_Message, GameTitle )
|
|||
|
||||
// 1 Global client_textmessage_t for custom messages that aren't in the titles.txt
|
||||
client_textmessage_t g_pCustomMessage;
|
||||
char *g_pCustomName = "Custom";
|
||||
const char *g_pCustomName = "Custom";
|
||||
char g_pCustomText[1024];
|
||||
|
||||
int CHudMessage::Init( void )
|
||||
|
@ -260,7 +260,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
|
|||
width = 0;
|
||||
}
|
||||
else
|
||||
width += gHUD.m_scrinfo.charWidths[*pText];
|
||||
width += gHUD.m_scrinfo.charWidths[(unsigned char)*pText];
|
||||
pText++;
|
||||
length++;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ int CHudMessage::Draw( float fTime )
|
|||
{
|
||||
int i, drawn;
|
||||
client_textmessage_t *pMessage;
|
||||
float endTime = 0;
|
||||
float endTime = 0.0f;
|
||||
|
||||
drawn = 0;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
cvar_t *cl_scoreboard_bg;
|
||||
cvar_t *cl_showpacketloss;
|
||||
hud_player_info_t g_PlayerInfoList[MAX_PLAYERS + 1]; // player info from the engine
|
||||
extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS + 1]; // additional player info sent directly to the client dll
|
||||
|
@ -59,6 +60,7 @@ int CHudScoreboard::Init( void )
|
|||
|
||||
InitHUDData();
|
||||
|
||||
cl_scoreboard_bg = CVAR_CREATE( "cl_scoreboard_bg", "1", FCVAR_ARCHIVE );
|
||||
cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE );
|
||||
|
||||
return 1;
|
||||
|
@ -90,7 +92,7 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
|
|||
|
||||
// X positions
|
||||
// relative to the side of the scoreboard
|
||||
#define NAME_RANGE_MIN 20
|
||||
#define NAME_RANGE_MIN -100
|
||||
#define NAME_RANGE_MAX 145
|
||||
#define KILLS_RANGE_MIN 130
|
||||
#define KILLS_RANGE_MAX 170
|
||||
|
@ -143,8 +145,9 @@ int CHudScoreboard::Draw( float fTime )
|
|||
int xpos = NAME_RANGE_MIN + xpos_rel;
|
||||
|
||||
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX;
|
||||
FAR_RIGHT += 5;
|
||||
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
|
||||
FAR_RIGHT += 125;
|
||||
if( cl_scoreboard_bg && cl_scoreboard_bg->value )
|
||||
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
|
||||
if( !gHUD.m_Teamplay )
|
||||
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
|
||||
else
|
||||
|
@ -337,7 +340,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
|||
}
|
||||
|
||||
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX;
|
||||
FAR_RIGHT += 5;
|
||||
FAR_RIGHT += 125;
|
||||
|
||||
// draw the players, in order, and restricted to team if set
|
||||
while( 1 )
|
||||
|
|
|
@ -104,7 +104,7 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p
|
|||
}
|
||||
|
||||
// add the icon to the icon list, and set it's drawing color
|
||||
void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )
|
||||
void CHudStatusIcons::EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -149,7 +149,7 @@ void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned
|
|||
}
|
||||
}
|
||||
|
||||
void CHudStatusIcons::DisableIcon( char *pszIconName )
|
||||
void CHudStatusIcons::DisableIcon( const char *pszIconName )
|
||||
{
|
||||
// find the sprite is in the current list
|
||||
for( int i = 0; i < MAX_ICONSPRITES; i++ )
|
||||
|
|
|
@ -45,14 +45,15 @@ int CHudTextMessage::Init( void )
|
|||
char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size )
|
||||
{
|
||||
char *dst = dst_buffer;
|
||||
for( char *src = (char*)msg; *src != 0 && buffer_size > 0; buffer_size-- )
|
||||
for( char *src = (char*)msg; *src != 0 && ( buffer_size - 1 ) > 0; buffer_size-- )
|
||||
{
|
||||
if( *src == '#' )
|
||||
{
|
||||
// cut msg name out of string
|
||||
static char word_buf[255];
|
||||
char *wdst = word_buf, *word_start = src;
|
||||
for( ++src; ( *src >= 'A' && *src <= 'z' ) || ( *src >= '0' && *src <= '9' ); wdst++, src++ )
|
||||
int wordbuf_size = (int)sizeof(word_buf);
|
||||
for( ++src; ( ( *src >= 'A' && *src <= 'z' ) || ( *src >= '0' && *src <= '9' ) ) && ( wordbuf_size - 1 ) > 0; wdst++, src++, wordbuf_size-- )
|
||||
{
|
||||
*wdst = *src;
|
||||
}
|
||||
|
@ -69,21 +70,20 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in
|
|||
}
|
||||
|
||||
// copy string into message over the msg name
|
||||
for( char *wsrc = (char*)clmsg->pMessage; *wsrc != 0; wsrc++, dst++ )
|
||||
for( char *wsrc = (char*)clmsg->pMessage; *wsrc != 0 && ( buffer_size - 1 ) > 0; wsrc++, dst++, buffer_size-- )
|
||||
{
|
||||
*dst = *wsrc;
|
||||
}
|
||||
*dst = 0;
|
||||
buffer_size++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst = *src;
|
||||
dst++, src++;
|
||||
*dst = 0;
|
||||
}
|
||||
}
|
||||
|
||||
dst_buffer[buffer_size - 1] = 0; // ensure null termination
|
||||
*dst = 0; // ensure null termination
|
||||
return dst_buffer;
|
||||
}
|
||||
|
||||
|
@ -91,12 +91,12 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in
|
|||
char *CHudTextMessage::BufferedLocaliseTextString( const char *msg )
|
||||
{
|
||||
static char dst_buffer[1024];
|
||||
LocaliseTextString( msg, dst_buffer, 1024 );
|
||||
LocaliseTextString( msg, dst_buffer, sizeof(dst_buffer) );
|
||||
return dst_buffer;
|
||||
}
|
||||
|
||||
// Simplified version of LocaliseTextString; assumes string is only one word
|
||||
char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
||||
const char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
||||
{
|
||||
if( !msg )
|
||||
return "";
|
||||
|
@ -108,7 +108,7 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
|||
client_textmessage_t *clmsg = TextMessageGet( msg + 1 );
|
||||
|
||||
if( !clmsg || !(clmsg->pMessage) )
|
||||
return (char*)msg; // lookup failed, so return the original string
|
||||
return msg; // lookup failed, so return the original string
|
||||
|
||||
if( msg_dest )
|
||||
{
|
||||
|
@ -118,12 +118,12 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
|||
*msg_dest = -clmsg->effect;
|
||||
}
|
||||
|
||||
return (char*)clmsg->pMessage;
|
||||
return clmsg->pMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
// nothing special about this message, so just return the same string
|
||||
return (char*)msg;
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,42 +162,39 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
|
|||
|
||||
int msg_dest = READ_BYTE();
|
||||
|
||||
static char szBuf[6][128];
|
||||
char *msg_text = LookupString( READ_STRING(), &msg_dest );
|
||||
msg_text = strcpy( szBuf[0], msg_text );
|
||||
#define MSG_BUF_SIZE 128
|
||||
char szBuf[6][MSG_BUF_SIZE];
|
||||
|
||||
strncpy( szBuf[0], LookupString( READ_STRING(), &msg_dest ), MSG_BUF_SIZE - 1 );
|
||||
szBuf[0][MSG_BUF_SIZE - 1] = '\0';
|
||||
|
||||
for( int i = 1; i <= 4; i++ )
|
||||
{
|
||||
// keep reading strings and using C format strings for subsituting the strings into the localised text string
|
||||
strncpy( szBuf[i], LookupString( READ_STRING() ), MSG_BUF_SIZE - 1 );
|
||||
szBuf[i][MSG_BUF_SIZE - 1] = '\0';
|
||||
StripEndNewlineFromString( szBuf[i] ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
|
||||
}
|
||||
|
||||
// keep reading strings and using C format strings for subsituting the strings into the localised text string
|
||||
char *sstr1 = LookupString( READ_STRING() );
|
||||
sstr1 = strcpy( szBuf[1], sstr1 );
|
||||
StripEndNewlineFromString( sstr1 ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
|
||||
char *sstr2 = LookupString( READ_STRING() );
|
||||
sstr2 = strcpy( szBuf[2], sstr2 );
|
||||
StripEndNewlineFromString( sstr2 );
|
||||
char *sstr3 = LookupString( READ_STRING() );
|
||||
sstr3 = strcpy( szBuf[3], sstr3 );
|
||||
StripEndNewlineFromString( sstr3 );
|
||||
char *sstr4 = LookupString( READ_STRING() );
|
||||
sstr4 = strcpy( szBuf[4], sstr4 );
|
||||
StripEndNewlineFromString( sstr4 );
|
||||
char *psz = szBuf[5];
|
||||
|
||||
switch( msg_dest )
|
||||
{
|
||||
case HUD_PRINTCENTER:
|
||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
CenterPrint( ConvertCRtoNL( psz ) );
|
||||
break;
|
||||
case HUD_PRINTNOTIFY:
|
||||
psz[0] = 1; // mark this message to go into the notify buffer
|
||||
sprintf( psz + 1, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
ConsolePrint( ConvertCRtoNL( psz ) );
|
||||
break;
|
||||
case HUD_PRINTTALK:
|
||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
|
||||
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
|
||||
break;
|
||||
case HUD_PRINTCONSOLE:
|
||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
ConsolePrint( ConvertCRtoNL( psz ) );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ extern cvar_t *cl_forwardspeed;
|
|||
extern cvar_t *chase_active;
|
||||
extern cvar_t *scr_ofsx, *scr_ofsy, *scr_ofsz;
|
||||
extern cvar_t *cl_vsmoothing;
|
||||
extern cvar_t *cl_viewbob;
|
||||
extern Vector dead_viewangles;
|
||||
|
||||
#define CAM_MODE_RELAX 1
|
||||
|
@ -90,7 +91,7 @@ float v_cameraFocusAngle = 35.0f;
|
|||
int v_cameraMode = CAM_MODE_FOCUS;
|
||||
qboolean v_resetCamera = 1;
|
||||
|
||||
vec3_t ev_punchangle;
|
||||
vec3_t g_ev_punchangle;
|
||||
|
||||
cvar_t *scr_ofsx;
|
||||
cvar_t *scr_ofsy;
|
||||
|
@ -351,11 +352,11 @@ V_CalcIntermissionRefdef
|
|||
*/
|
||||
void V_CalcIntermissionRefdef( struct ref_params_s *pparams )
|
||||
{
|
||||
cl_entity_t *ent, *view;
|
||||
cl_entity_t /**ent,*/ *view;
|
||||
float old;
|
||||
|
||||
// ent is the player model ( visible when out of body )
|
||||
ent = gEngfuncs.GetLocalPlayer();
|
||||
//ent = gEngfuncs.GetLocalPlayer();
|
||||
|
||||
// view is the weapon model (only visible from inside body )
|
||||
view = gEngfuncs.GetViewModel();
|
||||
|
@ -527,7 +528,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
V_AddIdle( pparams );
|
||||
|
||||
// offsets
|
||||
if ( pparams->health <= 0 )
|
||||
if( pparams->health <= 0 )
|
||||
{
|
||||
VectorCopy( dead_viewangles, angles );
|
||||
}
|
||||
|
@ -598,6 +599,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
view->angles[ROLL] -= bob * 1;
|
||||
view->angles[PITCH] -= bob * 0.3;
|
||||
|
||||
if( cl_viewbob && cl_viewbob->value )
|
||||
VectorCopy( view->angles, view->curstate.angles );
|
||||
|
||||
// pushing the view origin down off of the same X/Z plane as the ent's origin will give the
|
||||
// gun a very nice 'shifting' effect when the player looks up/down. If there is a problem
|
||||
// with view model distortion, this may be a cause. (SJB).
|
||||
|
@ -626,9 +630,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
VectorAdd( pparams->viewangles, pparams->punchangle, pparams->viewangles );
|
||||
|
||||
// Include client side punch, too
|
||||
VectorAdd( pparams->viewangles, (float *)&ev_punchangle, pparams->viewangles );
|
||||
VectorAdd( pparams->viewangles, (float *)&g_ev_punchangle, pparams->viewangles );
|
||||
|
||||
V_DropPunchAngle( pparams->frametime, (float *)&ev_punchangle );
|
||||
V_DropPunchAngle( pparams->frametime, (float *)&g_ev_punchangle );
|
||||
|
||||
// smooth out stair step ups
|
||||
#if 1
|
||||
|
@ -1307,7 +1311,7 @@ void V_GetMapChasePosition( int target, float *cl_angles, float *origin, float *
|
|||
|
||||
int V_FindViewModelByWeaponModel( int weaponindex )
|
||||
{
|
||||
static char *modelmap[][2] =
|
||||
static const char *modelmap[][2] =
|
||||
{
|
||||
{ "models/p_crossbow.mdl", "models/v_crossbow.mdl" },
|
||||
{ "models/p_crowbar.mdl", "models/v_crowbar.mdl" },
|
||||
|
@ -1327,7 +1331,7 @@ int V_FindViewModelByWeaponModel( int weaponindex )
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
struct model_s * weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
||||
struct model_s *weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
||||
|
||||
if( weaponModel )
|
||||
{
|
||||
|
@ -1575,7 +1579,7 @@ Client side punch effect
|
|||
*/
|
||||
void V_PunchAxis( int axis, float punch )
|
||||
{
|
||||
ev_punchangle[axis] = punch;
|
||||
g_ev_punchangle[axis] = punch;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -110,7 +110,9 @@
|
|||
#define EF_NOINTERP 32 // don't interpolate the next frame
|
||||
#define EF_LIGHT 64 // rocket flare glow sprite
|
||||
#define EF_NODRAW 128 // don't draw entity
|
||||
|
||||
#define EF_NIGHTVISION 256 // player nightvision
|
||||
#define EF_SNIPERLASER 512 // sniper laser effect
|
||||
#define EF_FIBERCAMERA 1024 // fiber camera
|
||||
|
||||
|
||||
#define EF_NOREFLECT (1<<24) // Entity won't reflecting in mirrors
|
||||
|
@ -531,6 +533,7 @@
|
|||
#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
|
||||
#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque
|
||||
#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube.
|
||||
#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive
|
||||
|
||||
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
|
||||
// byte (entity index of player)
|
||||
|
@ -621,8 +624,9 @@
|
|||
#define CHAN_BODY 4
|
||||
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
|
||||
#define CHAN_STATIC 6 // allocate channel from the static area
|
||||
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
|
||||
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
|
||||
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
|
||||
#define CHAN_BOT 501 // channel used for bot chatter.
|
||||
|
||||
// attenuation values
|
||||
#define ATTN_NONE 0
|
||||
|
@ -724,7 +728,8 @@ enum
|
|||
kRenderFxDeadPlayer, // kRenderAmt is the player index
|
||||
kRenderFxExplode, // Scale up really big!
|
||||
kRenderFxGlowShell, // Glowing Shell
|
||||
kRenderFxClampMinScale // Keep this sprite from getting very small (SPRITES only!)
|
||||
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
||||
kRenderFxLightMultiplier //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
|
||||
};
|
||||
|
||||
typedef unsigned int func_t;
|
||||
|
|
|
@ -24,14 +24,15 @@
|
|||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
||||
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
||||
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
||||
#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar
|
||||
|
||||
typedef struct cvar_s
|
||||
{
|
||||
char *name;
|
||||
char *string;
|
||||
const char *name;
|
||||
const char *string;
|
||||
int flags;
|
||||
float value;
|
||||
struct cvar_s *next;
|
||||
} cvar_t;
|
||||
|
||||
#endif//CVARDEF_H
|
||||
#endif//CVARDEF_H
|
||||
|
|
|
@ -18,7 +18,12 @@
|
|||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec2_t[2];
|
||||
|
||||
#ifndef DID_VEC3_T_DEFINE
|
||||
#define DID_VEC3_T_DEFINE
|
||||
typedef vec_t vec3_t[3];
|
||||
#endif
|
||||
|
||||
typedef vec_t vec4_t[4]; // x,y,z,w
|
||||
|
||||
#ifndef M_PI
|
||||
|
|
|
@ -16,7 +16,7 @@ endif
|
|||
LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \
|
||||
-fno-exceptions -DNO_VOICEGAMEMGR -w
|
||||
|
||||
LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -frtti
|
||||
LOCAL_CPPFLAGS := $(LOCAL_CFLAGS)
|
||||
|
||||
LOCAL_C_INCLUDES := $(SDL_PATH)/include \
|
||||
$(LOCAL_PATH)/. \
|
||||
|
@ -90,6 +90,7 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
|
|||
multiplay_gamerules.cpp \
|
||||
nihilanth.cpp \
|
||||
nodes.cpp \
|
||||
observer.cpp \
|
||||
osprey.cpp \
|
||||
pathcorner.cpp \
|
||||
plane.cpp \
|
||||
|
|
|
@ -92,6 +92,7 @@ set (SVDLL_SOURCES
|
|||
multiplay_gamerules.cpp
|
||||
nihilanth.cpp
|
||||
nodes.cpp
|
||||
observer.cpp
|
||||
osprey.cpp
|
||||
pathcorner.cpp
|
||||
plane.cpp
|
||||
|
|
|
@ -129,6 +129,7 @@ OBJ = \
|
|||
$(DLL_OBJDIR)/multiplay_gamerules.o \
|
||||
$(DLL_OBJDIR)/nihilanth.o \
|
||||
$(DLL_OBJDIR)/nodes.o \
|
||||
$(DLL_OBJDIR)/observer.cpp \^M
|
||||
$(DLL_OBJDIR)/osprey.o \
|
||||
$(DLL_OBJDIR)/pathcorner.o \
|
||||
$(DLL_OBJDIR)/plane.o \
|
||||
|
|
|
@ -99,7 +99,7 @@ typedef enum {
|
|||
typedef struct
|
||||
{
|
||||
int type;
|
||||
char *name;
|
||||
const char *name;
|
||||
} activity_map_t;
|
||||
|
||||
extern activity_map_t activity_map[];
|
||||
|
|
|
@ -93,5 +93,5 @@ _A( ACT_FLINCH_LEFTARM ),
|
|||
_A( ACT_FLINCH_RIGHTARM ),
|
||||
_A( ACT_FLINCH_LEFTLEG ),
|
||||
_A( ACT_FLINCH_RIGHTLEG ),
|
||||
0, NULL
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
|
|
@ -567,7 +567,6 @@ void CFlockingFlyer::FlockLeaderThink( void )
|
|||
TraceResult tr;
|
||||
Vector vecDist;// used for general measurements
|
||||
Vector vecDir;// used for general measurements
|
||||
int cProcessed = 0;// keep track of how many other boids we've processed
|
||||
float flLeftSide;
|
||||
float flRightSide;
|
||||
|
||||
|
@ -840,11 +839,11 @@ void CFlockingFlyer::SquadRemove( CFlockingFlyer *pRemove )
|
|||
{
|
||||
CFlockingFlyer *pLeader = m_pSquadNext;
|
||||
|
||||
// copy the enemy LKP to the new leader
|
||||
pLeader->m_vecEnemyLKP = m_vecEnemyLKP;
|
||||
|
||||
if( pLeader )
|
||||
{
|
||||
// copy the enemy LKP to the new leader
|
||||
pLeader->m_vecEnemyLKP = m_vecEnemyLKP;
|
||||
|
||||
CFlockingFlyer *pList = pLeader;
|
||||
|
||||
while( pList )
|
||||
|
|
|
@ -608,30 +608,30 @@ void CAGrunt::Spawn()
|
|||
//=========================================================
|
||||
void CAGrunt::Precache()
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
PRECACHE_MODEL( "models/agrunt.mdl" );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
|
||||
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
|
||||
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pIdleSounds[i] );
|
||||
PRECACHE_SOUND( pIdleSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pDieSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pDieSounds[i] );
|
||||
PRECACHE_SOUND( pDieSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pPainSounds[i] );
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackSounds[i] );
|
||||
PRECACHE_SOUND( pAttackSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAlertSounds[i] );
|
||||
PRECACHE_SOUND( pAlertSounds[i] );
|
||||
|
||||
PRECACHE_SOUND( "hassault/hw_shoot1.wav" );
|
||||
|
||||
|
@ -909,7 +909,7 @@ BOOL CAGrunt::FCanCheckAttacks( void )
|
|||
//=========================================================
|
||||
BOOL CAGrunt::CheckMeleeAttack1( float flDot, float flDist )
|
||||
{
|
||||
if( HasConditions( bits_COND_SEE_ENEMY ) && flDist <= AGRUNT_MELEE_DIST && flDot >= 0.6 && m_hEnemy != NULL )
|
||||
if( HasConditions( bits_COND_SEE_ENEMY ) && flDist <= AGRUNT_MELEE_DIST && flDot >= 0.6 && m_hEnemy != 0 )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1160,7 +1160,7 @@ Schedule_t *CAGrunt::GetScheduleOfType( int Type )
|
|||
case SCHED_FAIL:
|
||||
// no fail schedule specified, so pick a good generic one.
|
||||
{
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
// I have an enemy
|
||||
// !!!LATER - what if this enemy is really far away and i'm chasing him?
|
||||
|
|
|
@ -208,7 +208,7 @@ void SequencePrecache( void *pmodel, const char *pSequenceName )
|
|||
ALERT( at_error, "Bad sound event %d in sequence %s :: %s (sound is \"%s\")\n", pevent[i].event, pstudiohdr->name, pSequenceName, pevent[i].options );
|
||||
}
|
||||
|
||||
PRECACHE_SOUND( (char *)( gpGlobals->pStringBase + ALLOC_STRING( pevent[i].options ) ) );
|
||||
PRECACHE_SOUND( gpGlobals->pStringBase + ALLOC_STRING( pevent[i].options ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -268,8 +268,6 @@ int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEve
|
|||
if( !pstudiohdr || pev->sequence >= pstudiohdr->numseq || !pMonsterEvent )
|
||||
return 0;
|
||||
|
||||
int events = 0;
|
||||
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
mstudioevent_t *pevent;
|
||||
|
||||
|
@ -351,7 +349,7 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
|
|||
}
|
||||
}
|
||||
|
||||
int setting = 255 * ( flValue - pbonecontroller->start ) / ( pbonecontroller->end - pbonecontroller->start );
|
||||
int setting = (int)( 255 * ( flValue - pbonecontroller->start ) / ( pbonecontroller->end - pbonecontroller->start ) );
|
||||
|
||||
if( setting < 0 )
|
||||
setting = 0;
|
||||
|
@ -393,7 +391,7 @@ float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
|
|||
}
|
||||
}
|
||||
|
||||
int setting = 255 * ( flValue - pseqdesc->blendstart[iBlender] ) / ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] );
|
||||
int setting = (int)( 255 * ( flValue - pseqdesc->blendstart[iBlender] ) / ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] ) );
|
||||
|
||||
if( setting < 0 )
|
||||
setting = 0;
|
||||
|
|
|
@ -458,7 +458,7 @@ void CApache::HuntThink( void )
|
|||
if( m_flGoalSpeed < 800 )
|
||||
m_flGoalSpeed += 5;
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
// ALERT( at_console, "%s\n", STRING( m_hEnemy->pev->classname ) );
|
||||
if( FVisible( m_hEnemy ) )
|
||||
|
@ -552,7 +552,7 @@ void CApache::HuntThink( void )
|
|||
{
|
||||
if( m_flLastSeen + 60 > gpGlobals->time )
|
||||
{
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
// make sure it's a good shot
|
||||
if( DotProduct( m_vecTarget, vecEst ) > .965 )
|
||||
|
@ -732,7 +732,6 @@ void CApache::Flight( void )
|
|||
void CApache::FireRocket( void )
|
||||
{
|
||||
static float side = 1.0;
|
||||
static int count;
|
||||
|
||||
if( m_iRockets <= 0 )
|
||||
return;
|
||||
|
@ -805,13 +804,13 @@ BOOL CApache::FireGun()
|
|||
angles.x = angles.x + 360;
|
||||
|
||||
if( angles.x > m_angGun.x )
|
||||
m_angGun.x = min( angles.x, m_angGun.x + 12 );
|
||||
m_angGun.x = Q_min( angles.x, m_angGun.x + 12 );
|
||||
if( angles.x < m_angGun.x )
|
||||
m_angGun.x = max( angles.x, m_angGun.x - 12 );
|
||||
m_angGun.x = Q_max( angles.x, m_angGun.x - 12 );
|
||||
if( angles.y > m_angGun.y )
|
||||
m_angGun.y = min( angles.y, m_angGun.y + 12 );
|
||||
m_angGun.y = Q_min( angles.y, m_angGun.y + 12 );
|
||||
if( angles.y < m_angGun.y )
|
||||
m_angGun.y = max( angles.y, m_angGun.y - 12 );
|
||||
m_angGun.y = Q_max( angles.y, m_angGun.y - 12 );
|
||||
|
||||
m_angGun.y = SetBoneController( 0, m_angGun.y );
|
||||
m_angGun.x = SetBoneController( 1, m_angGun.x );
|
||||
|
|
|
@ -170,7 +170,7 @@ void CBarnacle::BarnacleThink( void )
|
|||
#endif
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
// barnacle has prey.
|
||||
if( !m_hEnemy->IsAlive() )
|
||||
|
@ -183,7 +183,7 @@ void CBarnacle::BarnacleThink( void )
|
|||
|
||||
if( m_fLiftingPrey )
|
||||
{
|
||||
if( m_hEnemy != NULL && m_hEnemy->pev->deadflag != DEAD_NO )
|
||||
if( m_hEnemy != 0 && m_hEnemy->pev->deadflag != DEAD_NO )
|
||||
{
|
||||
// crap, someone killed the prey on the way up.
|
||||
m_hEnemy = NULL;
|
||||
|
@ -352,7 +352,7 @@ void CBarnacle::Killed( entvars_t *pevAttacker, int iGib )
|
|||
pev->solid = SOLID_NOT;
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
pVictim = m_hEnemy->MyMonsterPointer();
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ void CBarney::RunTask( Task_t *pTask )
|
|||
switch( pTask->iTask )
|
||||
{
|
||||
case TASK_RANGE_ATTACK1:
|
||||
if( m_hEnemy != NULL && ( m_hEnemy->IsPlayer() ) )
|
||||
if( m_hEnemy != 0 && ( m_hEnemy->IsPlayer() ) )
|
||||
{
|
||||
pev->framerate = 1.5;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ int CBarney::Classify( void )
|
|||
//=========================================================
|
||||
void CBarney::AlertSound( void )
|
||||
{
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
if( FOkToSpeak() )
|
||||
{
|
||||
|
@ -504,7 +504,7 @@ int CBarney::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
|
|||
|
||||
// This is a heurstic to determine if the player intended to harm me
|
||||
// If I have an enemy, we can't establish intent (may just be crossfire)
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
// If the player was facing directly at me, or I'm already suspicious, get mad
|
||||
if( ( m_afMemory & bits_MEMORY_SUSPICIOUS ) || IsFacing( pevAttacker, pev->origin ) )
|
||||
|
@ -616,7 +616,7 @@ void CBarney::Killed( entvars_t *pevAttacker, int iGib )
|
|||
|
||||
GetAttachment( 0, vecGunPos, vecGunAngles );
|
||||
|
||||
CBaseEntity *pGun = DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles );
|
||||
DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles );
|
||||
}
|
||||
|
||||
SetUse( NULL );
|
||||
|
@ -633,7 +633,7 @@ Schedule_t *CBarney::GetScheduleOfType( int Type )
|
|||
switch( Type )
|
||||
{
|
||||
case SCHED_ARM_WEAPON:
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
// face enemy, then draw.
|
||||
return slBarneyEnemyDraw;
|
||||
|
@ -721,7 +721,7 @@ Schedule_t *CBarney::GetSchedule( void )
|
|||
return GetScheduleOfType( SCHED_SMALL_FLINCH );
|
||||
}
|
||||
|
||||
if( m_hEnemy == NULL && IsFollowing() )
|
||||
if( m_hEnemy == 0 && IsFollowing() )
|
||||
{
|
||||
if( !m_hTargetEnt->IsAlive() )
|
||||
{
|
||||
|
@ -783,10 +783,10 @@ public:
|
|||
void KeyValue( KeyValueData *pkvd );
|
||||
|
||||
int m_iPose;// which sequence to display -- temporary, don't need to save
|
||||
static char *m_szPoses[3];
|
||||
static const char *m_szPoses[3];
|
||||
};
|
||||
|
||||
char *CDeadBarney::m_szPoses[] = { "lying_on_back", "lying_on_side", "lying_on_stomach" };
|
||||
const char *CDeadBarney::m_szPoses[] = { "lying_on_back", "lying_on_side", "lying_on_stomach" };
|
||||
|
||||
void CDeadBarney::KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
|
|
|
@ -195,7 +195,7 @@ public:
|
|||
Task_t *GetTask( void );
|
||||
virtual MONSTERSTATE GetIdealState( void );
|
||||
virtual void SetActivity( Activity NewActivity );
|
||||
void SetSequenceByName( char *szSequence );
|
||||
void SetSequenceByName( const char *szSequence );
|
||||
void SetState( MONSTERSTATE State );
|
||||
virtual void ReportAIState( void );
|
||||
|
||||
|
@ -327,6 +327,6 @@ public:
|
|||
BOOL ExitScriptedSequence();
|
||||
BOOL CineCleanup();
|
||||
|
||||
CBaseEntity* DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item.
|
||||
CBaseEntity* DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item.
|
||||
};
|
||||
#endif // BASEMONSTER_H
|
||||
|
|
|
@ -411,7 +411,7 @@ void CBigMomma::SetYawSpeed( void )
|
|||
{
|
||||
int ys;
|
||||
|
||||
switch ( m_Activity )
|
||||
switch( m_Activity )
|
||||
{
|
||||
case ACT_IDLE:
|
||||
ys = 100;
|
||||
|
@ -677,7 +677,7 @@ void CBigMomma::Precache()
|
|||
|
||||
void CBigMomma::Activate( void )
|
||||
{
|
||||
if( m_hTargetEnt == NULL )
|
||||
if( m_hTargetEnt == 0 )
|
||||
Remember( bits_MEMORY_ADVANCE_NODE ); // Start 'er up
|
||||
}
|
||||
|
||||
|
@ -985,7 +985,7 @@ void CBigMomma::RunTask( Task_t *pTask )
|
|||
{
|
||||
float distance;
|
||||
|
||||
if( m_hTargetEnt == NULL )
|
||||
if( m_hTargetEnt == 0 )
|
||||
TaskFail();
|
||||
else
|
||||
{
|
||||
|
@ -1002,7 +1002,7 @@ void CBigMomma::RunTask( Task_t *pTask )
|
|||
}
|
||||
break;
|
||||
case TASK_WAIT_NODE:
|
||||
if( m_hTargetEnt != NULL && ( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT ) )
|
||||
if( m_hTargetEnt != 0 && ( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT ) )
|
||||
return;
|
||||
|
||||
if( gpGlobals->time > m_flWaitFinished )
|
||||
|
@ -1056,7 +1056,6 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
|
|||
float time = speed / flGravity;
|
||||
vecGrenadeVel = vecSpot2 - vecSpot1;
|
||||
vecGrenadeVel.z = 0;
|
||||
float distance = vecGrenadeVel.Length();
|
||||
|
||||
// Travel half the distance to the target in that time (apex is at the midpoint)
|
||||
vecGrenadeVel = vecGrenadeVel * ( 0.5 / time );
|
||||
|
|
|
@ -210,7 +210,7 @@ void CFuncIllusionary::KeyValue( KeyValueData *pkvd )
|
|||
{
|
||||
if( FStrEq( pkvd->szKeyName, "skin" ) )//skin is used for content type
|
||||
{
|
||||
pev->skin = atof( pkvd->szValue );
|
||||
pev->skin = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -402,7 +402,7 @@ void CFuncRotating::Spawn()
|
|||
}
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
SET_MODEL( ENT(pev), STRING(pev->model) );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
|
||||
SetUse( &CFuncRotating::RotatingUse );
|
||||
// did level designer forget to assign speed?
|
||||
|
@ -430,15 +430,13 @@ void CFuncRotating::Spawn()
|
|||
|
||||
void CFuncRotating::Precache( void )
|
||||
{
|
||||
char* szSoundFile = (char*)STRING( pev->message );
|
||||
const char* szSoundFile = STRING( pev->message );
|
||||
BOOL NullSound = FALSE;
|
||||
|
||||
// set up fan sounds
|
||||
if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 )
|
||||
{
|
||||
// if a path is set for a wave, use it
|
||||
PRECACHE_SOUND( szSoundFile );
|
||||
|
||||
pev->noiseRunning = ALLOC_STRING( szSoundFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -446,42 +444,32 @@ void CFuncRotating::Precache( void )
|
|||
switch( m_sounds )
|
||||
{
|
||||
case 1:
|
||||
PRECACHE_SOUND( "fans/fan1.wav" );
|
||||
pev->noiseRunning = ALLOC_STRING( "fans/fan1.wav" );
|
||||
szSoundFile = "fans/fan1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "fans/fan2.wav" );
|
||||
pev->noiseRunning = ALLOC_STRING( "fans/fan2.wav" );
|
||||
szSoundFile = "fans/fan2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "fans/fan3.wav" );
|
||||
pev->noiseRunning = ALLOC_STRING( "fans/fan3.wav" );
|
||||
szSoundFile = "fans/fan3.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "fans/fan4.wav" );
|
||||
pev->noiseRunning = ALLOC_STRING( "fans/fan4.wav" );
|
||||
szSoundFile = "fans/fan4.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "fans/fan5.wav" );
|
||||
pev->noiseRunning = ALLOC_STRING( "fans/fan5.wav" );
|
||||
szSoundFile = "fans/fan5.wav";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 )
|
||||
{
|
||||
PRECACHE_SOUND( szSoundFile );
|
||||
|
||||
pev->noiseRunning = ALLOC_STRING( szSoundFile );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
pev->noiseRunning = ALLOC_STRING( "common/null.wav" );
|
||||
break;
|
||||
}
|
||||
szSoundFile = "common/null.wav";
|
||||
NullSound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !NullSound )
|
||||
PRECACHE_SOUND( szSoundFile );
|
||||
pev->noiseRunning = MAKE_STRING( szSoundFile );
|
||||
|
||||
if( pev->avelocity != g_vecZero )
|
||||
{
|
||||
// if fan was spinning, and we went through transition or save/restore,
|
||||
|
@ -550,7 +538,7 @@ void CFuncRotating::RampPitchVol( int fUp )
|
|||
pitch = PITCH_NORM - 1;
|
||||
|
||||
// change the fan's vol and pitch
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning ),
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noiseRunning ),
|
||||
fvol, m_flAttenuation, SND_CHANGE_PITCH | SND_CHANGE_VOL, pitch );
|
||||
}
|
||||
|
||||
|
@ -572,7 +560,7 @@ void CFuncRotating::SpinUp( void )
|
|||
fabs( vecAVel.z ) >= fabs( pev->movedir.z * pev->speed ) )
|
||||
{
|
||||
pev->avelocity = pev->movedir * pev->speed;// set speed in case we overshot
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning ),
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noiseRunning ),
|
||||
m_flVolume, m_flAttenuation, SND_CHANGE_PITCH | SND_CHANGE_VOL, FANPITCHMAX );
|
||||
|
||||
SetThink( &CFuncRotating::Rotate );
|
||||
|
@ -613,8 +601,8 @@ void CFuncRotating::SpinDown( void )
|
|||
pev->avelocity = g_vecZero;// set speed in case we overshot
|
||||
|
||||
// stop sound, we're done
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning /* Stop */ ),
|
||||
0, 0, SND_STOP, m_pitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noiseRunning /* Stop */ ),
|
||||
0, 0, SND_STOP, (int)m_pitch );
|
||||
|
||||
SetThink( &CFuncRotating::Rotate );
|
||||
Rotate();
|
||||
|
@ -642,7 +630,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
|||
if( pev->avelocity != g_vecZero )
|
||||
{
|
||||
SetThink( &CFuncRotating::SpinDown );
|
||||
//EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, (char *)STRING( pev->noiseStop ),
|
||||
//EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, STRING( pev->noiseStop ),
|
||||
// m_flVolume, m_flAttenuation, 0, m_pitch );
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1;
|
||||
|
@ -650,7 +638,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
|||
else// fan is not moving, so start it
|
||||
{
|
||||
SetThink( &CFuncRotating::SpinUp );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning ),
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noiseRunning ),
|
||||
0.01, m_flAttenuation, 0, FANPITCHMIN );
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1;
|
||||
|
@ -663,7 +651,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
|||
// play stopping sound here
|
||||
SetThink( &CFuncRotating::SpinDown );
|
||||
|
||||
// EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, (char *)STRING( pev->noiseStop ),
|
||||
// EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, STRING( pev->noiseStop ),
|
||||
// m_flVolume, m_flAttenuation, 0, m_pitch );
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1;
|
||||
|
@ -671,7 +659,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
|||
}
|
||||
else
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning ),
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noiseRunning ),
|
||||
m_flVolume, m_flAttenuation, 0, FANPITCHMAX );
|
||||
pev->avelocity = pev->movedir * pev->speed;
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ int CBullsquid::IgnoreConditions( void )
|
|||
iIgnore = bits_COND_SMELL | bits_COND_SMELL_FOOD;
|
||||
}
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
if( FClassnameIs( m_hEnemy->pev, "monster_headcrab" ) )
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ int CBullsquid::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
|
|||
|
||||
// if the squid is running, has an enemy, was hurt by the enemy, hasn't been hurt in the last 3 seconds, and isn't too close to the enemy,
|
||||
// it will swerve. (whew).
|
||||
if( m_hEnemy != NULL && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3 )
|
||||
if( m_hEnemy != 0 && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3 )
|
||||
{
|
||||
flDist = ( pev->origin - m_hEnemy->pev->origin ).Length2D();
|
||||
|
||||
|
@ -324,7 +324,7 @@ BOOL CBullsquid::CheckRangeAttack1( float flDot, float flDist )
|
|||
|
||||
if( flDist > 64 && flDist <= 784 && flDot >= 0.5 && gpGlobals->time >= m_flNextSpitTime )
|
||||
{
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
if( fabs( pev->origin.z - m_hEnemy->pev->origin.z ) > 256 )
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ BOOL CBullsquid::CheckMeleeAttack2( float flDot, float flDist )
|
|||
//=========================================================
|
||||
BOOL CBullsquid::FValidateHintType( short sHint )
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
static short sSquidHints[] =
|
||||
{
|
||||
|
@ -784,7 +784,7 @@ void CBullsquid::RunAI( void )
|
|||
pev->skin = 1;
|
||||
}
|
||||
|
||||
if( m_hEnemy != NULL && m_Activity == ACT_RUN )
|
||||
if( m_hEnemy != 0 && m_Activity == ACT_RUN )
|
||||
{
|
||||
// chasing enemy. Sprint for last bit
|
||||
if( ( pev->origin - m_hEnemy->pev->origin).Length2D() < SQUID_SPRINT_DIST )
|
||||
|
@ -1247,7 +1247,7 @@ MONSTERSTATE CBullsquid::GetIdealState( void )
|
|||
COMBAT goes to ALERT upon death of enemy
|
||||
*/
|
||||
{
|
||||
if( m_hEnemy != NULL && ( iConditions & bits_COND_LIGHT_DAMAGE || iConditions & bits_COND_HEAVY_DAMAGE ) && FClassnameIs( m_hEnemy->pev, "monster_headcrab" ) )
|
||||
if( m_hEnemy != 0 && ( iConditions & bits_COND_LIGHT_DAMAGE || iConditions & bits_COND_HEAVY_DAMAGE ) && FClassnameIs( m_hEnemy->pev, "monster_headcrab" ) )
|
||||
{
|
||||
// if the squid has a headcrab enemy and something hurts it, it's going to forget about the crab for a while.
|
||||
m_hEnemy = NULL;
|
||||
|
|
|
@ -275,7 +275,7 @@ IMPLEMENT_SAVERESTORE( CBaseButton, CBaseToggle )
|
|||
|
||||
void CBaseButton::Precache( void )
|
||||
{
|
||||
char *pszSound;
|
||||
const char *pszSound;
|
||||
|
||||
if( FBitSet( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )// this button should spark in OFF state
|
||||
{
|
||||
|
@ -292,14 +292,14 @@ void CBaseButton::Precache( void )
|
|||
{
|
||||
pszSound = ButtonSound( (int)m_bLockedSound );
|
||||
PRECACHE_SOUND( pszSound );
|
||||
m_ls.sLockedSound = ALLOC_STRING( pszSound );
|
||||
m_ls.sLockedSound = MAKE_STRING( pszSound );
|
||||
}
|
||||
|
||||
if( m_bUnlockedSound )
|
||||
{
|
||||
pszSound = ButtonSound( (int)m_bUnlockedSound );
|
||||
PRECACHE_SOUND( pszSound );
|
||||
m_ls.sUnlockedSound = ALLOC_STRING( pszSound );
|
||||
m_ls.sUnlockedSound = MAKE_STRING( pszSound );
|
||||
}
|
||||
|
||||
// get sentence group names, for doors which are directly 'touched' to open
|
||||
|
@ -343,25 +343,25 @@ void CBaseButton::Precache( void )
|
|||
m_ls.sUnlockedSentence = MAKE_STRING( "EA" );
|
||||
break;
|
||||
case 2: // security door
|
||||
m_ls.sUnlockedSentence = MAKE_STRING("ED");
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ED" );
|
||||
break;
|
||||
case 3: // blast door
|
||||
m_ls.sUnlockedSentence = MAKE_STRING("EF");
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "EF" );
|
||||
break;
|
||||
case 4: // fire door
|
||||
m_ls.sUnlockedSentence = MAKE_STRING("EFIRE");
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "EFIRE" );
|
||||
break;
|
||||
case 5: // chemical door
|
||||
m_ls.sUnlockedSentence = MAKE_STRING("ECHEM");
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ECHEM" );
|
||||
break;
|
||||
case 6: // radiation door
|
||||
m_ls.sUnlockedSentence = MAKE_STRING("ERAD");
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ERAD" );
|
||||
break;
|
||||
case 7: // gen containment
|
||||
m_ls.sUnlockedSentence = MAKE_STRING("ECON");
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ECON" );
|
||||
break;
|
||||
case 8: // maintenance door
|
||||
m_ls.sUnlockedSentence = MAKE_STRING("EH");
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "EH" );
|
||||
break;
|
||||
default:
|
||||
m_ls.sUnlockedSentence = 0;
|
||||
|
@ -381,22 +381,22 @@ void CBaseButton::KeyValue( KeyValueData *pkvd )
|
|||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "locked_sound" ) )
|
||||
{
|
||||
m_bLockedSound = atof( pkvd->szValue );
|
||||
m_bLockedSound = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) )
|
||||
{
|
||||
m_bLockedSentence = atof( pkvd->szValue );
|
||||
m_bLockedSentence = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) )
|
||||
{
|
||||
m_bUnlockedSound = atof( pkvd->szValue );
|
||||
m_bUnlockedSound = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) )
|
||||
{
|
||||
m_bUnlockedSentence = atof( pkvd->szValue );
|
||||
m_bUnlockedSentence = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "sounds" ) )
|
||||
|
@ -421,12 +421,12 @@ int CBaseButton::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
|
|||
SetTouch( NULL );
|
||||
|
||||
m_hActivator = CBaseEntity::Instance( pevAttacker );
|
||||
if( m_hActivator == NULL )
|
||||
if( m_hActivator == 0 )
|
||||
return 0;
|
||||
|
||||
if( code == BUTTON_RETURN )
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noise ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
|
||||
|
||||
// Toggle buttons fire when they get back to their "home" position
|
||||
if( !( pev->spawnflags & SF_BUTTON_TOGGLE ) )
|
||||
|
@ -461,7 +461,7 @@ LINK_ENTITY_TO_CLASS( func_button, CBaseButton )
|
|||
|
||||
void CBaseButton::Spawn()
|
||||
{
|
||||
char *pszSound;
|
||||
const char *pszSound;
|
||||
|
||||
//----------------------------------------------------
|
||||
//determine sounds for buttons
|
||||
|
@ -469,7 +469,7 @@ void CBaseButton::Spawn()
|
|||
//----------------------------------------------------
|
||||
pszSound = ButtonSound( m_sounds );
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noise = ALLOC_STRING( pszSound );
|
||||
pev->noise = MAKE_STRING( pszSound );
|
||||
|
||||
Precache();
|
||||
|
||||
|
@ -525,9 +525,9 @@ void CBaseButton::Spawn()
|
|||
// Button sound table.
|
||||
// Also used by CBaseDoor to get 'touched' door lock/unlock sounds
|
||||
|
||||
char *ButtonSound( int sound )
|
||||
const char *ButtonSound( int sound )
|
||||
{
|
||||
char *pszSound;
|
||||
const char *pszSound;
|
||||
|
||||
switch( sound )
|
||||
{
|
||||
|
@ -657,7 +657,7 @@ void CBaseButton::ButtonUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
|
|||
{
|
||||
if( !m_fStayPushed && FBitSet( pev->spawnflags, SF_BUTTON_TOGGLE ) )
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noise ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
|
||||
|
||||
//SUB_UseTargets( m_eoActivator );
|
||||
ButtonReturn();
|
||||
|
@ -716,7 +716,7 @@ void CBaseButton::ButtonTouch( CBaseEntity *pOther )
|
|||
|
||||
if( code == BUTTON_RETURN )
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noise ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
|
||||
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
|
||||
ButtonReturn();
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ void CBaseButton::ButtonTouch( CBaseEntity *pOther )
|
|||
//
|
||||
void CBaseButton::ButtonActivate()
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noise ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
|
||||
|
||||
if( !UTIL_IsMasterTriggered( m_sMaster, m_hActivator ) )
|
||||
{
|
||||
|
@ -815,7 +815,7 @@ void CBaseButton::ButtonBackHome( void )
|
|||
|
||||
if( FBitSet( pev->spawnflags, SF_BUTTON_TOGGLE ) )
|
||||
{
|
||||
//EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noise ), 1, ATTN_NORM );
|
||||
//EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
|
||||
|
||||
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
|
||||
}
|
||||
|
@ -869,14 +869,14 @@ LINK_ENTITY_TO_CLASS( func_rot_button, CRotButton )
|
|||
|
||||
void CRotButton::Spawn( void )
|
||||
{
|
||||
char *pszSound;
|
||||
const char *pszSound;
|
||||
//----------------------------------------------------
|
||||
//determine sounds for buttons
|
||||
//a sound of 0 should not make a sound
|
||||
//----------------------------------------------------
|
||||
pszSound = ButtonSound( m_sounds );
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noise = ALLOC_STRING( pszSound );
|
||||
pev->noise = MAKE_STRING( pszSound );
|
||||
|
||||
// set the axis of rotation
|
||||
CBaseToggle::AxisDir( pev );
|
||||
|
@ -1010,9 +1010,9 @@ void CMomentaryRotButton::Spawn( void )
|
|||
UTIL_SetOrigin( pev, pev->origin );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
|
||||
char *pszSound = ButtonSound( m_sounds );
|
||||
const char *pszSound = ButtonSound( m_sounds );
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noise = ALLOC_STRING( pszSound );
|
||||
pev->noise = MAKE_STRING( pszSound );
|
||||
m_lastUsed = 0;
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ void CMomentaryRotButton::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CMomentaryRotButton::PlaySound( void )
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noise ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
|
||||
}
|
||||
|
||||
// BUGBUG: This design causes a latentcy. When the button is retriggered, the first impulse
|
||||
|
@ -1045,7 +1045,11 @@ void CMomentaryRotButton::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, US
|
|||
pev->ideal_yaw = CBaseToggle::AxisDelta( pev->spawnflags, pev->angles, m_start ) / m_flMoveDistance;
|
||||
|
||||
UpdateAllButtons( pev->ideal_yaw, 1 );
|
||||
UpdateTarget( pev->ideal_yaw );
|
||||
|
||||
// Calculate destination angle and use it to predict value, this prevents sending target in wrong direction on retriggering
|
||||
Vector dest = pev->angles + pev->avelocity * ( pev->nextthink - pev->ltime );
|
||||
float value1 = CBaseToggle::AxisDelta( pev->spawnflags, dest, m_start ) / m_flMoveDistance;
|
||||
UpdateTarget( value1 );
|
||||
}
|
||||
|
||||
void CMomentaryRotButton::UpdateAllButtons( float value, int start )
|
||||
|
|
|
@ -26,7 +26,7 @@ void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd );
|
|||
|
||||
extern "C" void PM_Move ( struct playermove_s *ppmove, int server );
|
||||
extern "C" void PM_Init ( struct playermove_s *ppmove );
|
||||
extern "C" char PM_FindTextureType( char *name );
|
||||
extern "C" char PM_FindTextureType( const char *name );
|
||||
|
||||
extern Vector VecBModelOrigin( entvars_t* pevBModel );
|
||||
extern DLL_GLOBAL Vector g_vecAttackDir;
|
||||
|
@ -441,9 +441,16 @@ edict_t *EHANDLE::Get( void )
|
|||
|
||||
edict_t *EHANDLE::Set( edict_t *pent )
|
||||
{
|
||||
m_pent = pent;
|
||||
if( pent )
|
||||
m_serialnumber = m_pent->serialnumber;
|
||||
if( pent )
|
||||
{
|
||||
m_pent = pent;
|
||||
m_serialnumber = m_pent->serialnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pent = NULL;
|
||||
m_serialnumber = 0;
|
||||
}
|
||||
return pent;
|
||||
}
|
||||
|
||||
|
@ -511,7 +518,7 @@ int CBaseEntity::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
|
|||
// (that is, no actual entity projectile was involved in the attack so use the shooter's origin).
|
||||
if( pevAttacker == pevInflictor )
|
||||
{
|
||||
vecTemp = pevInflictor->origin - VecBModelOrigin( pev );
|
||||
vecTemp = pevAttacker->origin - VecBModelOrigin( pev );
|
||||
}
|
||||
else
|
||||
// an actual missile was involved.
|
||||
|
@ -598,7 +605,7 @@ int CBaseEntity::Restore( CRestore &restore )
|
|||
mins = pev->mins; // Set model is about to destroy these
|
||||
maxs = pev->maxs;
|
||||
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
UTIL_SetSize( pev, mins, maxs ); // Reset them
|
||||
}
|
||||
|
@ -739,7 +746,7 @@ int CBaseEntity::DamageDecal( int bitsDamageType )
|
|||
|
||||
// NOTE: szName must be a pointer to constant memory, e.g. "monster_class" because the entity
|
||||
// will keep a pointer to it after this call.
|
||||
CBaseEntity *CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner )
|
||||
CBaseEntity *CBaseEntity::Create( const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner )
|
||||
{
|
||||
edict_t *pent;
|
||||
CBaseEntity *pEntity;
|
||||
|
|
16
dlls/cbase.h
16
dlls/cbase.h
|
@ -12,6 +12,8 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#ifndef CBASE_H
|
||||
#define CBASE_H
|
||||
/*
|
||||
|
||||
Class Hierachy
|
||||
|
@ -177,7 +179,7 @@ public:
|
|||
virtual void AddPointsToTeam( int score, BOOL bAllowNegativeScore ) {}
|
||||
virtual BOOL AddPlayerItem( CBasePlayerItem *pItem ) { return 0; }
|
||||
virtual BOOL RemovePlayerItem( CBasePlayerItem *pItem ) { return 0; }
|
||||
virtual int GiveAmmo( int iAmount, char *szName, int iMax ) { return -1; };
|
||||
virtual int GiveAmmo( int iAmount, const char *szName, int iMax ) { return -1; };
|
||||
virtual float GetDelay( void ) { return 0; }
|
||||
virtual int IsMoving( void ) { return pev->velocity != g_vecZero; }
|
||||
virtual void OverrideReset( void ) {}
|
||||
|
@ -229,7 +231,7 @@ public:
|
|||
};
|
||||
#endif
|
||||
|
||||
void UpdateOnRemove( void );
|
||||
virtual void UpdateOnRemove( void );
|
||||
|
||||
// common member functions
|
||||
void EXPORT SUB_Remove( void );
|
||||
|
@ -280,8 +282,8 @@ public:
|
|||
#ifdef _DEBUG
|
||||
void FunctionCheck( void *pFunction, char *name )
|
||||
{
|
||||
if( pFunction && !NAME_FOR_FUNCTION( (unsigned long)( pFunction ) ) )
|
||||
ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING( pev->classname ), name, (unsigned long)pFunction );
|
||||
if( pFunction && !NAME_FOR_FUNCTION( (size_t)( pFunction ) ) )
|
||||
ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING( pev->classname ), name, (size_t)pFunction );
|
||||
}
|
||||
|
||||
BASEPTR ThinkSet( BASEPTR func, char *name )
|
||||
|
@ -314,7 +316,7 @@ public:
|
|||
// used by monsters that are created by the MonsterMaker
|
||||
virtual void UpdateOwner( void ) { return; };
|
||||
|
||||
static CBaseEntity *Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL );
|
||||
static CBaseEntity *Create( const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL );
|
||||
|
||||
virtual BOOL FBecomeProne( void ) {return FALSE;};
|
||||
edict_t *edict() { return ENT( pev ); };
|
||||
|
@ -655,8 +657,7 @@ class CSound;
|
|||
|
||||
#include "basemonster.h"
|
||||
|
||||
|
||||
char *ButtonSound( int sound ); // get string of button sound number
|
||||
const char *ButtonSound( int sound ); // get string of button sound number
|
||||
|
||||
//
|
||||
// Generic Button
|
||||
|
@ -781,3 +782,4 @@ public:
|
|||
void Precache( void );
|
||||
void KeyValue( KeyValueData *pkvd );
|
||||
};
|
||||
#endif
|
||||
|
|
328
dlls/client.cpp
328
dlls/client.cpp
|
@ -38,6 +38,7 @@
|
|||
#include "weaponinfo.h"
|
||||
#include "usercmd.h"
|
||||
#include "netadr.h"
|
||||
#include "pm_shared.h"
|
||||
|
||||
extern DLL_GLOBAL ULONG g_ulModelIndexPlayer;
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
|
@ -47,9 +48,15 @@ extern DLL_GLOBAL ULONG g_ulFrameCount;
|
|||
extern void CopyToBodyQue( entvars_t* pev );
|
||||
extern int giPrecacheGrunt;
|
||||
extern int gmsgSayText;
|
||||
extern int gmsgBhopcap;
|
||||
|
||||
extern cvar_t allow_spectators;
|
||||
|
||||
extern int g_teamplay;
|
||||
|
||||
extern cvar_t bhopcap;
|
||||
extern "C" int g_bhopcap;
|
||||
|
||||
void LinkUserMessages( void );
|
||||
|
||||
/*
|
||||
|
@ -107,19 +114,18 @@ void ClientDisconnect( edict_t *pEntity )
|
|||
WRITE_STRING( text );
|
||||
MESSAGE_END();
|
||||
|
||||
CSound *pSound;
|
||||
pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( pEntity ) );
|
||||
CSound *pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( pEntity ) );
|
||||
|
||||
// since this client isn't around to think anymore, reset their sound.
|
||||
if( pSound )
|
||||
{
|
||||
// since this client isn't around to think anymore, reset their sound.
|
||||
if( pSound )
|
||||
{
|
||||
pSound->Reset();
|
||||
}
|
||||
pSound->Reset();
|
||||
}
|
||||
|
||||
// since the edict doesn't get deleted, fix it so it doesn't interfere.
|
||||
pEntity->v.takedamage = DAMAGE_NO;// don't attract autoaim
|
||||
pEntity->v.solid = SOLID_NOT;// nonsolid
|
||||
pEntity->v.effects = 0;// clear any effects
|
||||
UTIL_SetOrigin( &pEntity->v, pEntity->v.origin );
|
||||
|
||||
g_pGameRules->ClientDisconnected( pEntity );
|
||||
|
@ -204,6 +210,97 @@ void ClientPutInServer( edict_t *pEntity )
|
|||
#include "voice_gamemgr.h"
|
||||
extern CVoiceGameMgr g_VoiceGameMgr;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: determine if a uchar32 represents a valid Unicode code point
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Q_IsValidUChar32( unsigned int uVal )
|
||||
{
|
||||
// Values > 0x10FFFF are explicitly invalid; ditto for UTF-16 surrogate halves,
|
||||
// values ending in FFFE or FFFF, or values in the 0x00FDD0-0x00FDEF reserved range
|
||||
return ( ( uVal - 0x0u ) < 0x110000u ) && ( (uVal - 0x00D800u) > 0x7FFu ) && ( (uVal & 0xFFFFu) < 0xFFFEu ) && ( ( uVal - 0x00FDD0u ) > 0x1Fu );
|
||||
}
|
||||
|
||||
// Decode one character from a UTF-8 encoded string. Treats 6-byte CESU-8 sequences
|
||||
// as a single character, as if they were a correctly-encoded 4-byte UTF-8 sequence.
|
||||
int Q_UTF8ToUChar32( const char *pUTF8_, unsigned int &uValueOut, bool &bErrorOut )
|
||||
{
|
||||
const unsigned char *pUTF8 = (const unsigned char*)pUTF8_;
|
||||
|
||||
int nBytes = 1;
|
||||
unsigned int uValue = pUTF8[0];
|
||||
unsigned int uMinValue = 0;
|
||||
|
||||
// 0....... single byte
|
||||
if( uValue < 0x80 )
|
||||
goto decodeFinishedNoCheck;
|
||||
|
||||
// Expecting at least a two-byte sequence with 0xC0 <= first <= 0xF7 (110...... and 11110...)
|
||||
if( ( uValue - 0xC0u ) > 0x37u || ( pUTF8[1] & 0xC0 ) != 0x80 )
|
||||
goto decodeError;
|
||||
|
||||
uValue = ( uValue << 6 ) - ( 0xC0 << 6 ) + pUTF8[1] - 0x80;
|
||||
nBytes = 2;
|
||||
uMinValue = 0x80;
|
||||
|
||||
// 110..... two-byte lead byte
|
||||
if( !( uValue & ( 0x20 << 6 ) ) )
|
||||
goto decodeFinished;
|
||||
|
||||
// Expecting at least a three-byte sequence
|
||||
if( ( pUTF8[2] & 0xC0 ) != 0x80 )
|
||||
goto decodeError;
|
||||
|
||||
uValue = ( uValue << 6 ) - ( 0x20 << 12 ) + pUTF8[2] - 0x80;
|
||||
nBytes = 3;
|
||||
uMinValue = 0x800;
|
||||
|
||||
// 1110.... three-byte lead byte
|
||||
decodeFinished:
|
||||
if( uValue >= uMinValue && Q_IsValidUChar32( uValue ) )
|
||||
{
|
||||
decodeFinishedNoCheck:
|
||||
uValueOut = uValue;
|
||||
bErrorOut = false;
|
||||
return nBytes;
|
||||
}
|
||||
decodeError:
|
||||
uValueOut = '?';
|
||||
bErrorOut = true;
|
||||
return nBytes;
|
||||
|
||||
decodeFinishedMaybeCESU8:
|
||||
// Do we have a full UTF-16 surrogate pair that's been UTF-8 encoded afterwards?
|
||||
// That is, do we have 0xD800-0xDBFF followed by 0xDC00-0xDFFF? If so, decode it all.
|
||||
if( ( uValue - 0xD800u ) < 0x400u && pUTF8[3] == 0xED && (unsigned char)( pUTF8[4] - 0xB0 ) < 0x10 && ( pUTF8[5] & 0xC0 ) == 0x80 )
|
||||
{
|
||||
uValue = 0x10000 + ( ( uValue - 0xD800u ) << 10 ) + ( (unsigned char)( pUTF8[4] - 0xB0 ) << 6 ) + pUTF8[5] - 0x80;
|
||||
nBytes = 6;
|
||||
uMinValue = 0x10000;
|
||||
}
|
||||
goto decodeFinished;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns true if UTF-8 string contains invalid sequences.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Q_UnicodeValidate( const char *pUTF8 )
|
||||
{
|
||||
bool bError = false;
|
||||
while( *pUTF8 )
|
||||
{
|
||||
unsigned int uVal;
|
||||
// Our UTF-8 decoder silently fixes up 6-byte CESU-8 (improperly re-encoded UTF-16) sequences.
|
||||
// However, these are technically not valid UTF-8. So if we eat 6 bytes at once, it's an error.
|
||||
int nCharSize = Q_UTF8ToUChar32( pUTF8, uVal, bError );
|
||||
if( bError || nCharSize == 6 )
|
||||
return false;
|
||||
pUTF8 += nCharSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//// HOST_SAY
|
||||
// String comes in as
|
||||
// say blah blah blah
|
||||
|
@ -259,26 +356,19 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
|||
}
|
||||
|
||||
// remove quotes if present
|
||||
if( *p == '"' )
|
||||
if( p && *p == '"' )
|
||||
{
|
||||
p++;
|
||||
p[strlen( p ) - 1] = 0;
|
||||
}
|
||||
|
||||
// make sure the text has content
|
||||
for( pc = p; pc != NULL && *pc != 0; pc++ )
|
||||
{
|
||||
if( !isspace( *pc ) )
|
||||
{
|
||||
pc = NULL; // we've found an alphanumeric character, so text is valid
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( pc != NULL )
|
||||
if( !p || !p[0] || !Q_UnicodeValidate ( p ) )
|
||||
return; // no character found, so say nothing
|
||||
|
||||
// turn on color set 2 (color on, no sound)
|
||||
if( teamonly )
|
||||
if( player->IsObserver() && ( teamonly ) )
|
||||
sprintf( text, "%c(SPEC) %s: ", 2, STRING( pEntity->v.netname ) );
|
||||
else if( teamonly )
|
||||
sprintf( text, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) );
|
||||
else
|
||||
sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) );
|
||||
|
@ -313,9 +403,14 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
|||
if( g_VoiceGameMgr.PlayerHasBlockedPlayer( client, player ) )
|
||||
continue;
|
||||
#endif
|
||||
if( teamonly && g_pGameRules->PlayerRelationship( client, CBaseEntity::Instance( pEntity ) ) != GR_TEAMMATE )
|
||||
if( !player->IsObserver() && teamonly && g_pGameRules->PlayerRelationship( client, CBaseEntity::Instance( pEntity ) ) != GR_TEAMMATE )
|
||||
continue;
|
||||
|
||||
// Spectators can only talk to other specs
|
||||
if( player->IsObserver() && teamonly )
|
||||
if ( !client->IsObserver() )
|
||||
continue;
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, client->pev );
|
||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||
WRITE_STRING( text );
|
||||
|
@ -331,7 +426,7 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
|||
// echo to server console
|
||||
g_engfuncs.pfnServerPrint( text );
|
||||
|
||||
char *temp;
|
||||
const char *temp;
|
||||
if( teamonly )
|
||||
temp = "say_team";
|
||||
else
|
||||
|
@ -459,17 +554,55 @@ void ClientCommand( edict_t *pEntity )
|
|||
{
|
||||
GetClassPtr( (CBasePlayer *)pev )->SelectLastItem();
|
||||
}
|
||||
else if( FStrEq( pcmd, "spectate" ) && ( pev->flags & FL_PROXY ) ) // added for proxy support
|
||||
else if( FStrEq( pcmd, "spectate" ) ) // clients wants to become a spectator
|
||||
{
|
||||
CBasePlayer * pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
if( !pPlayer->IsObserver() )
|
||||
{
|
||||
// always allow proxies to become a spectator
|
||||
if( ( pev->flags & FL_PROXY ) || allow_spectators.value )
|
||||
{
|
||||
edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer );
|
||||
pPlayer->StartObserver( pev->origin, VARS( pentSpawnSpot )->angles );
|
||||
|
||||
edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer );
|
||||
pPlayer->StartObserver( pev->origin, VARS( pentSpawnSpot )->angles );
|
||||
// notify other clients of player switching to spectator mode
|
||||
UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs( "%s switched to spectator mode\n",
|
||||
( pev->netname && ( STRING( pev->netname ) )[0] != 0 ) ? STRING( pev->netname ) : "unconnected" ) );
|
||||
}
|
||||
else
|
||||
ClientPrint( pev, HUD_PRINTCONSOLE, "Spectator mode is disabled.\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->StopObserver();
|
||||
|
||||
// notify other clients of player left spectators
|
||||
UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs( "%s has left spectator mode\n",
|
||||
( pev->netname && ( STRING( pev->netname ) )[0] != 0 ) ? STRING( pev->netname ) : "unconnected" ) );
|
||||
}
|
||||
}
|
||||
/*else if( g_pGameRules->ClientCommand( GetClassPtr( (CBasePlayer *)pev ), pcmd ) )
|
||||
else if( FStrEq( pcmd, "specmode" ) ) // new spectator mode
|
||||
{
|
||||
CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
|
||||
if( pPlayer->IsObserver() )
|
||||
pPlayer->Observer_SetMode( atoi( CMD_ARGV( 1 ) ) );
|
||||
}
|
||||
else if( FStrEq( pcmd, "closemenus" ) )
|
||||
{
|
||||
// just ignore it
|
||||
}
|
||||
else if( FStrEq( pcmd, "follownext" ) ) // follow next player
|
||||
{
|
||||
CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
|
||||
if( pPlayer->IsObserver() )
|
||||
pPlayer->Observer_FindNextPlayer( atoi( CMD_ARGV( 1 ) ) ? true : false );
|
||||
}
|
||||
else if( g_pGameRules->ClientCommand( GetClassPtr( (CBasePlayer *)pev ), pcmd ) )
|
||||
{
|
||||
// MenuSelect returns true only if the command is properly handled, so don't print a warning
|
||||
}*/
|
||||
}
|
||||
else if( FStrEq( pcmd, "VModEnable" ) )
|
||||
{
|
||||
// clear 'Unknown command: VModEnable' in singleplayer
|
||||
|
@ -506,7 +639,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
|||
return;
|
||||
|
||||
// msg everyone if someone changes their name, and it isn't the first time (changing no name to current name)
|
||||
if( pEntity->v.netname && STRING( pEntity->v.netname )[0] != 0 && !FStrEq( STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) ) )
|
||||
if( pEntity->v.netname && ( STRING( pEntity->v.netname ) )[0] != 0 && !FStrEq( STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) ) )
|
||||
{
|
||||
char sName[256];
|
||||
char *pName = g_engfuncs.pfnInfoKeyValue( infobuffer, "name" );
|
||||
|
@ -524,12 +657,15 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
|||
// Set the name
|
||||
g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), infobuffer, "name", sName );
|
||||
|
||||
char text[256];
|
||||
snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||
WRITE_STRING( text );
|
||||
MESSAGE_END();
|
||||
if( gpGlobals->maxClients > 1 )
|
||||
{
|
||||
char text[256];
|
||||
snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||
WRITE_STRING( text );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
// team match?
|
||||
if( g_teamplay )
|
||||
|
@ -621,7 +757,6 @@ void PlayerPreThink( edict_t *pEntity )
|
|||
{
|
||||
//ALERT( at_console, "PreThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime );
|
||||
|
||||
entvars_t *pev = &pEntity->v;
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
||||
|
||||
if( pPlayer )
|
||||
|
@ -639,7 +774,6 @@ void PlayerPostThink( edict_t *pEntity )
|
|||
{
|
||||
//ALERT( at_console, "PostThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime );
|
||||
|
||||
entvars_t *pev = &pEntity->v;
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
||||
|
||||
if( pPlayer )
|
||||
|
@ -674,8 +808,16 @@ void StartFrame( void )
|
|||
|
||||
gpGlobals->teamplay = teamplay.value;
|
||||
g_ulFrameCount++;
|
||||
}
|
||||
|
||||
int oldBhopcap = g_bhopcap;
|
||||
g_bhopcap = ( g_pGameRules->IsMultiplayer() && bhopcap.value != 0.0f ) ? 1 : 0;
|
||||
if( g_bhopcap != oldBhopcap )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgBhopcap, NULL );
|
||||
WRITE_BYTE( g_bhopcap );
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
|
||||
void ClientPrecache( void )
|
||||
{
|
||||
|
@ -827,7 +969,6 @@ animation right now.
|
|||
*/
|
||||
void PlayerCustomization( edict_t *pEntity, customization_t *pCust )
|
||||
{
|
||||
entvars_t *pev = &pEntity->v;
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
||||
|
||||
if( !pPlayer )
|
||||
|
@ -867,7 +1008,6 @@ A spectator has joined the game
|
|||
*/
|
||||
void SpectatorConnect( edict_t *pEntity )
|
||||
{
|
||||
entvars_t *pev = &pEntity->v;
|
||||
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
||||
|
||||
if( pPlayer )
|
||||
|
@ -883,7 +1023,6 @@ A spectator has left the game
|
|||
*/
|
||||
void SpectatorDisconnect( edict_t *pEntity )
|
||||
{
|
||||
entvars_t *pev = &pEntity->v;
|
||||
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
||||
|
||||
if( pPlayer )
|
||||
|
@ -899,7 +1038,6 @@ A spectator has sent a usercmd
|
|||
*/
|
||||
void SpectatorThink( edict_t *pEntity )
|
||||
{
|
||||
entvars_t *pev = &pEntity->v;
|
||||
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
||||
|
||||
if( pPlayer )
|
||||
|
@ -983,7 +1121,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
|
|||
int i;
|
||||
|
||||
// don't send if flagged for NODRAW and it's not the host getting the message
|
||||
if( ( ent->v.effects == EF_NODRAW ) && ( ent != host ) )
|
||||
if( ( ent->v.effects & EF_NODRAW ) && ( ent != host ) )
|
||||
return 0;
|
||||
|
||||
// Ignore ents without valid / visible models
|
||||
|
@ -1112,11 +1250,11 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
|
|||
}
|
||||
|
||||
state->rendermode = ent->v.rendermode;
|
||||
state->renderamt = ent->v.renderamt;
|
||||
state->renderamt = (int)ent->v.renderamt;
|
||||
state->renderfx = ent->v.renderfx;
|
||||
state->rendercolor.r = ent->v.rendercolor.x;
|
||||
state->rendercolor.g = ent->v.rendercolor.y;
|
||||
state->rendercolor.b = ent->v.rendercolor.z;
|
||||
state->rendercolor.r = (byte)ent->v.rendercolor.x;
|
||||
state->rendercolor.g = (byte)ent->v.rendercolor.y;
|
||||
state->rendercolor.b = (byte)ent->v.rendercolor.z;
|
||||
|
||||
state->aiment = 0;
|
||||
if( ent->v.aiment )
|
||||
|
@ -1163,7 +1301,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
|
|||
//state->team = ent->v.team;
|
||||
|
||||
state->usehull = ( ent->v.flags & FL_DUCKING ) ? 1 : 0;
|
||||
state->health = ent->v.health;
|
||||
state->health = (int)ent->v.health;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -1518,12 +1656,12 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
|
|||
item->m_iId = II.iId;
|
||||
item->m_iClip = gun->m_iClip;
|
||||
|
||||
item->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle, -0.001 );
|
||||
item->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack, -0.001 );
|
||||
item->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack, -0.001 );
|
||||
item->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle, -0.001 );
|
||||
item->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack, -0.001 );
|
||||
item->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack, -0.001 );
|
||||
item->m_fInReload = gun->m_fInReload;
|
||||
item->m_fInSpecialReload = gun->m_fInSpecialReload;
|
||||
item->fuser1 = max( gun->pev->fuser1, -0.001 );
|
||||
item->fuser1 = Q_max( gun->pev->fuser1, -0.001 );
|
||||
item->fuser2 = gun->m_flStartThrow;
|
||||
item->fuser3 = gun->m_flReleaseThrow;
|
||||
item->iuser1 = gun->m_chargeReady;
|
||||
|
@ -1553,41 +1691,67 @@ engine sets cd to 0 before calling.
|
|||
*/
|
||||
void UpdateClientData( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd )
|
||||
{
|
||||
cd->flags = ent->v.flags;
|
||||
cd->health = ent->v.health;
|
||||
if( !ent || !ent->pvPrivateData )
|
||||
return;
|
||||
entvars_t *pev = (entvars_t *)&ent->v;
|
||||
CBasePlayer *pl = (CBasePlayer *)( CBasePlayer::Instance( pev ) );
|
||||
entvars_t *pevOrg = NULL;
|
||||
|
||||
cd->viewmodel = MODEL_INDEX( STRING( ent->v.viewmodel ) );
|
||||
// if user is spectating different player in First person, override some vars
|
||||
if( pl && pl->pev->iuser1 == OBS_IN_EYE )
|
||||
{
|
||||
if( pl->m_hObserverTarget )
|
||||
{
|
||||
pevOrg = pev;
|
||||
pev = pl->m_hObserverTarget->pev;
|
||||
pl = (CBasePlayer *)(CBasePlayer::Instance( pev ) );
|
||||
}
|
||||
}
|
||||
|
||||
cd->waterlevel = ent->v.waterlevel;
|
||||
cd->watertype = ent->v.watertype;
|
||||
cd->weapons = ent->v.weapons;
|
||||
cd->flags = pev->flags;
|
||||
cd->health = pev->health;
|
||||
|
||||
cd->viewmodel = MODEL_INDEX( STRING( pev->viewmodel ) );
|
||||
|
||||
cd->waterlevel = pev->waterlevel;
|
||||
cd->watertype = pev->watertype;
|
||||
cd->weapons = pev->weapons;
|
||||
|
||||
// Vectors
|
||||
cd->origin = ent->v.origin;
|
||||
cd->velocity = ent->v.velocity;
|
||||
cd->view_ofs = ent->v.view_ofs;
|
||||
cd->punchangle = ent->v.punchangle;
|
||||
cd->origin = pev->origin;
|
||||
cd->velocity = pev->velocity;
|
||||
cd->view_ofs = pev->view_ofs;
|
||||
cd->punchangle = pev->punchangle;
|
||||
|
||||
cd->bInDuck = ent->v.bInDuck;
|
||||
cd->flTimeStepSound = ent->v.flTimeStepSound;
|
||||
cd->flDuckTime = ent->v.flDuckTime;
|
||||
cd->flSwimTime = ent->v.flSwimTime;
|
||||
cd->waterjumptime = ent->v.teleport_time;
|
||||
cd->bInDuck = pev->bInDuck;
|
||||
cd->flTimeStepSound = pev->flTimeStepSound;
|
||||
cd->flDuckTime = pev->flDuckTime;
|
||||
cd->flSwimTime = pev->flSwimTime;
|
||||
cd->waterjumptime = pev->teleport_time;
|
||||
|
||||
strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) );
|
||||
|
||||
cd->maxspeed = ent->v.maxspeed;
|
||||
cd->fov = ent->v.fov;
|
||||
cd->weaponanim = ent->v.weaponanim;
|
||||
cd->maxspeed = pev->maxspeed;
|
||||
cd->fov = pev->fov;
|
||||
cd->weaponanim = pev->weaponanim;
|
||||
|
||||
cd->pushmsec = ent->v.pushmsec;
|
||||
cd->pushmsec = pev->pushmsec;
|
||||
|
||||
// Spectator mode
|
||||
if( pevOrg != NULL )
|
||||
{
|
||||
// don't use spec vars from chased player
|
||||
cd->iuser1 = pevOrg->iuser1;
|
||||
cd->iuser2 = pevOrg->iuser2;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->iuser1 = pev->iuser1;
|
||||
cd->iuser2 = pev->iuser2;
|
||||
}
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
if( sendweapons )
|
||||
{
|
||||
entvars_t *pev = (entvars_t *)&ent->v;
|
||||
CBasePlayer *pl = (CBasePlayer *)CBasePlayer::Instance( pev );
|
||||
|
||||
if( pl )
|
||||
{
|
||||
cd->m_flNextAttack = pl->m_flNextAttack;
|
||||
|
@ -1685,7 +1849,7 @@ ConnectionlessPacket
|
|||
int ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
|
||||
{
|
||||
// Parse stuff from args
|
||||
int max_buffer_size = *response_buffer_size;
|
||||
//int max_buffer_size = *response_buffer_size;
|
||||
|
||||
// Zero it out since we aren't going to respond.
|
||||
// If we wanted to response, we'd write data into response_buffer
|
||||
|
@ -1710,18 +1874,18 @@ int GetHullBounds( int hullnumber, float *mins, float *maxs )
|
|||
switch( hullnumber )
|
||||
{
|
||||
case 0: // Normal player
|
||||
mins = VEC_HULL_MIN;
|
||||
maxs = VEC_HULL_MAX;
|
||||
VEC_HULL_MIN.CopyToArray(mins);
|
||||
VEC_HULL_MAX.CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
case 1: // Crouched player
|
||||
mins = VEC_DUCK_HULL_MIN;
|
||||
maxs = VEC_DUCK_HULL_MAX;
|
||||
VEC_DUCK_HULL_MIN.CopyToArray(mins);
|
||||
VEC_DUCK_HULL_MAX.CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
case 2: // Point based hull
|
||||
mins = Vector( 0, 0, 0 );
|
||||
maxs = Vector( 0, 0, 0 );
|
||||
Vector( 0, 0, 0 ).CopyToArray(mins);
|
||||
Vector( 0, 0, 0 ).CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -1739,10 +1903,10 @@ to be created during play ( e.g., grenades, ammo packs, projectiles, corpses, et
|
|||
*/
|
||||
void CreateInstancedBaselines( void )
|
||||
{
|
||||
int iret = 0;
|
||||
/*int iret = 0;
|
||||
entity_state_t state;
|
||||
|
||||
memset( &state, 0, sizeof(state) );
|
||||
memset( &state, 0, sizeof(state) );*/
|
||||
|
||||
// Create any additional baselines here for things like grendates, etc.
|
||||
// iret = ENGINE_INSTANCE_BASELINE( pc->pev->classname, &state );
|
||||
|
|
|
@ -460,11 +460,11 @@ Activity CBaseMonster::GetSmallFlinchActivity( void )
|
|||
{
|
||||
Activity flinchActivity;
|
||||
BOOL fTriedDirection;
|
||||
float flDot;
|
||||
//float flDot;
|
||||
|
||||
fTriedDirection = FALSE;
|
||||
UTIL_MakeVectors( pev->angles );
|
||||
flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 );
|
||||
//flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 );
|
||||
|
||||
switch( m_LastHitGroup )
|
||||
{
|
||||
|
@ -576,8 +576,8 @@ Killed
|
|||
*/
|
||||
void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
|
||||
{
|
||||
unsigned int cCount = 0;
|
||||
BOOL fDone = FALSE;
|
||||
//unsigned int cCount = 0;
|
||||
//BOOL fDone = FALSE;
|
||||
|
||||
if( HasMemory( bits_MEMORY_KILLED ) )
|
||||
{
|
||||
|
@ -727,7 +727,7 @@ void CGib::BounceGibTouch( CBaseEntity *pOther )
|
|||
float volume;
|
||||
float zvel = fabs( pev->velocity.z );
|
||||
|
||||
volume = 0.8 * min( 1.0, ( (float)zvel ) / 450.0 );
|
||||
volume = 0.8 * Q_min( 1.0, ( (float)zvel ) / 450.0 );
|
||||
|
||||
CBreakable::MaterialSoundRandom( edict(), (Materials)m_material, volume );
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ int CBaseMonster::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, f
|
|||
// enemy's last known position is somewhere down the vector that the attack came from.
|
||||
if( pevInflictor )
|
||||
{
|
||||
if( m_hEnemy == NULL || pevInflictor == m_hEnemy->pev || !HasConditions( bits_COND_SEE_ENEMY ) )
|
||||
if( m_hEnemy == 0 || pevInflictor == m_hEnemy->pev || !HasConditions( bits_COND_SEE_ENEMY ) )
|
||||
{
|
||||
m_vecEnemyLKP = pevInflictor->origin;
|
||||
}
|
||||
|
@ -1463,7 +1463,7 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
|
|||
}
|
||||
}
|
||||
// make bullet trails
|
||||
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, ( flDistance * tr.flFraction ) / 64.0 );
|
||||
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0 ) );
|
||||
}
|
||||
ApplyMultiDamage( pev, pevAttacker );
|
||||
}
|
||||
|
@ -1483,7 +1483,8 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
|
|||
TraceResult tr;
|
||||
Vector vecRight = gpGlobals->v_right;
|
||||
Vector vecUp = gpGlobals->v_up;
|
||||
float x, y, z;
|
||||
float x = 0.0f, y = 0.0f;
|
||||
float z;
|
||||
|
||||
if( pevAttacker == NULL )
|
||||
pevAttacker = pev; // the default attacker is ourselves
|
||||
|
@ -1497,7 +1498,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
|
|||
// get circular gaussian spread
|
||||
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 );
|
||||
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 );
|
||||
z = x * x + y * y;
|
||||
//z = x * x + y * y;
|
||||
|
||||
Vector vecDir = vecDirShooting +
|
||||
x * vecSpread.x * vecRight +
|
||||
|
@ -1548,7 +1549,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
|
|||
}
|
||||
}
|
||||
// make bullet trails
|
||||
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, ( flDistance * tr.flFraction ) / 64.0 );
|
||||
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0 ) );
|
||||
}
|
||||
ApplyMultiDamage( pev, pevAttacker );
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void UpdateOnRemove();
|
||||
void SetYawSpeed( void );
|
||||
int Classify( void );
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
|
@ -384,6 +385,23 @@ void CController::Precache()
|
|||
UTIL_PrecacheOther( "controller_head_ball" );
|
||||
}
|
||||
|
||||
void CController::UpdateOnRemove()
|
||||
{
|
||||
CBaseEntity::UpdateOnRemove();
|
||||
|
||||
if( m_pBall[0] )
|
||||
{
|
||||
UTIL_Remove( m_pBall[0] );
|
||||
m_pBall[0] = 0;
|
||||
}
|
||||
|
||||
if( m_pBall[1] )
|
||||
{
|
||||
UTIL_Remove( m_pBall[1] );
|
||||
m_pBall[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// AI Schedules Specific to this monster
|
||||
//=========================================================
|
||||
|
@ -614,7 +632,7 @@ void CController::RunTask( Task_t *pTask )
|
|||
Vector vecSrc = vecHand + pev->velocity * ( m_flShootTime - gpGlobals->time );
|
||||
Vector vecDir;
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
if( HasConditions( bits_COND_SEE_ENEMY ) )
|
||||
{
|
||||
|
@ -707,7 +725,7 @@ Schedule_t *CController::GetSchedule( void )
|
|||
{
|
||||
case MONSTERSTATE_COMBAT:
|
||||
{
|
||||
Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 );
|
||||
// Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 );
|
||||
|
||||
// dead enemy
|
||||
if( HasConditions( bits_COND_LIGHT_DAMAGE ) )
|
||||
|
@ -1095,7 +1113,6 @@ class CControllerHeadBall : public CBaseMonster
|
|||
void EXPORT BounceTouch( CBaseEntity *pOther );
|
||||
void MovetoTarget( Vector vecTarget );
|
||||
void Crawl( void );
|
||||
int m_iTrail;
|
||||
int m_flNextAttack;
|
||||
Vector m_vecIdeal;
|
||||
EHANDLE m_hOwner;
|
||||
|
@ -1160,7 +1177,7 @@ void CControllerHeadBall::HuntThink( void )
|
|||
MESSAGE_END();
|
||||
|
||||
// check world boundaries
|
||||
if( gpGlobals->time - pev->dmgtime > 5 || pev->renderamt < 64 || m_hEnemy == NULL || m_hOwner == NULL || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
|
||||
if( gpGlobals->time - pev->dmgtime > 5 || pev->renderamt < 64 || m_hEnemy == 0 || m_hOwner == 0 || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
UTIL_Remove( this );
|
||||
|
@ -1340,7 +1357,7 @@ void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
|
|||
|
||||
entvars_t *pevOwner;
|
||||
|
||||
if( m_hOwner != NULL )
|
||||
if( m_hOwner != 0 )
|
||||
{
|
||||
pevOwner = m_hOwner->pev;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ void CCrossbow::PrimaryAttack( void )
|
|||
// this function only gets called in multiplayer
|
||||
void CCrossbow::FireSniperBolt()
|
||||
{
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
|
||||
|
||||
if( m_iClip == 0 )
|
||||
{
|
||||
|
@ -425,10 +425,11 @@ void CCrossbow::FireBolt()
|
|||
UTIL_MakeVectors( anglesAim );
|
||||
|
||||
anglesAim.x = -anglesAim.x;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
CCrossbowBolt *pBolt = CCrossbowBolt::BoltCreate();
|
||||
pBolt->pev->origin = vecSrc;
|
||||
pBolt->pev->angles = anglesAim;
|
||||
|
@ -451,7 +452,7 @@ void CCrossbow::FireBolt()
|
|||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
|
@ -480,7 +481,7 @@ void CCrossbow::SecondaryAttack()
|
|||
|
||||
void CCrossbow::Reload( void )
|
||||
{
|
||||
if( m_pPlayer->ammo_bolts <= 0 )
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == CROSSBOW_MAX_CLIP )
|
||||
return;
|
||||
|
||||
if( m_pPlayer->pev->fov != 0 )
|
||||
|
@ -488,7 +489,7 @@ void CCrossbow::Reload( void )
|
|||
SecondaryAttack();
|
||||
}
|
||||
|
||||
if( DefaultReload( 5, CROSSBOW_RELOAD, 4.5 ) )
|
||||
if( DefaultReload( CROSSBOW_MAX_CLIP, CROSSBOW_RELOAD, 4.5 ) )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/xbow_reload1.wav", RANDOM_FLOAT( 0.95, 1.0 ), ATTN_NORM, 0, 93 + RANDOM_LONG( 0, 0xF ) );
|
||||
}
|
||||
|
|
117
dlls/crowbar.cpp
117
dlls/crowbar.cpp
|
@ -27,7 +27,7 @@
|
|||
|
||||
LINK_ENTITY_TO_CLASS( weapon_crowbar, CCrowbar )
|
||||
|
||||
enum gauss_e
|
||||
enum crowbar_e
|
||||
{
|
||||
CROWBAR_IDLE = 0,
|
||||
CROWBAR_DRAW,
|
||||
|
@ -37,11 +37,16 @@ enum gauss_e
|
|||
CROWBAR_ATTACK2MISS,
|
||||
CROWBAR_ATTACK2HIT,
|
||||
CROWBAR_ATTACK3MISS,
|
||||
#ifndef CROWBAR_IDLE_ANIM
|
||||
CROWBAR_ATTACK3HIT
|
||||
#else
|
||||
CROWBAR_ATTACK3HIT,
|
||||
CROWBAR_IDLE2,
|
||||
CROWBAR_IDLE3
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
void CCrowbar::Spawn( )
|
||||
void CCrowbar::Spawn()
|
||||
{
|
||||
Precache();
|
||||
m_iId = WEAPON_CROWBAR;
|
||||
|
@ -81,6 +86,18 @@ int CCrowbar::GetItemInfo( ItemInfo *p )
|
|||
return 1;
|
||||
}
|
||||
|
||||
int CCrowbar::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CCrowbar::Deploy()
|
||||
{
|
||||
return DefaultDeploy( "models/v_crowbar.mdl", "models/p_crowbar.mdl", CROWBAR_DRAW, "crowbar" );
|
||||
|
@ -140,8 +157,10 @@ void CCrowbar::PrimaryAttack()
|
|||
{
|
||||
if( !Swing( 1 ) )
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
SetThink( &CCrowbar::SwingAgain );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,17 +201,22 @@ int CCrowbar::Swing( int fFirst )
|
|||
}
|
||||
}
|
||||
#endif
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
|
||||
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
|
||||
0.0, 0, 0.0 );
|
||||
if( fFirst )
|
||||
{
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
|
||||
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
|
||||
0, 0, 0 );
|
||||
}
|
||||
|
||||
if( tr.flFraction >= 1.0 )
|
||||
{
|
||||
if( fFirst )
|
||||
{
|
||||
// miss
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
#ifdef CROWBAR_IDLE_ANIM
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
#endif
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
}
|
||||
|
@ -220,26 +244,32 @@ int CCrowbar::Swing( int fFirst )
|
|||
fDidHit = TRUE;
|
||||
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
|
||||
|
||||
ClearMultiDamage();
|
||||
|
||||
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// first swing does full damage
|
||||
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
else
|
||||
{
|
||||
// subsequent swings do half
|
||||
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
||||
|
||||
// play thwack, smack, or dong sound
|
||||
float flVol = 1.0;
|
||||
int fHitWorld = TRUE;
|
||||
float flVol = 1.0;
|
||||
int fHitWorld = TRUE;
|
||||
|
||||
if( pEntity )
|
||||
{
|
||||
ClearMultiDamage();
|
||||
// If building with the clientside weapon prediction system,
|
||||
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
|
||||
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
|
||||
#ifdef CLIENT_WEAPONS
|
||||
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
#else
|
||||
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
#endif
|
||||
{
|
||||
// first swing does full damage
|
||||
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
else
|
||||
{
|
||||
// subsequent swings do half
|
||||
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
||||
|
||||
if( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
||||
{
|
||||
// play thwack or smack sound
|
||||
|
@ -295,12 +325,45 @@ int CCrowbar::Swing( int fFirst )
|
|||
m_trHit = tr;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME;
|
||||
#endif
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
|
||||
m_pPlayer->m_iWeaponVolume = (int)( flVol * CROWBAR_WALLHIT_VOLUME );
|
||||
|
||||
SetThink( &CCrowbar::Smack );
|
||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
|
||||
#endif
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 );
|
||||
}
|
||||
#ifdef CROWBAR_IDLE_ANIM
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
#endif
|
||||
return fDidHit;
|
||||
}
|
||||
|
||||
#ifdef CROWBAR_IDLE_ANIM
|
||||
void CCrowbar::WeaponIdle( void )
|
||||
{
|
||||
if( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
|
||||
{
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
|
||||
if( flRand > 0.9 )
|
||||
{
|
||||
iAnim = CROWBAR_IDLE2;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( flRand > 0.5 )
|
||||
{
|
||||
iAnim = CROWBAR_IDLE;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0 / 30.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = CROWBAR_IDLE3;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
|
||||
}
|
||||
}
|
||||
SendWeaponAnim( iAnim );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -66,7 +66,7 @@ enum decal_e
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
int index;
|
||||
} DLL_DECALLIST;
|
||||
|
||||
|
|
265
dlls/doors.cpp
265
dlls/doors.cpp
|
@ -22,6 +22,8 @@
|
|||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "doors.h"
|
||||
#include "game.h"
|
||||
#include "weapons.h"
|
||||
|
||||
extern void SetMovedir( entvars_t *ev );
|
||||
|
||||
|
@ -125,7 +127,7 @@ void PlayLockSounds( entvars_t *pev, locksound_t *pls, int flocked, int fbutton
|
|||
if( fplaysound )
|
||||
{
|
||||
// play 'door locked' sound
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, (char*)STRING( pls->sLockedSound ), fvol, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, STRING( pls->sLockedSound ), fvol, ATTN_NORM );
|
||||
pls->flwaitSound = gpGlobals->time + flsoundwait;
|
||||
}
|
||||
|
||||
|
@ -162,7 +164,7 @@ void PlayLockSounds( entvars_t *pev, locksound_t *pls, int flocked, int fbutton
|
|||
// play 'door unlocked' sound if set
|
||||
if( fplaysound )
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, (char*)STRING( pls->sUnlockedSound ), fvol, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, STRING( pls->sUnlockedSound ), fvol, ATTN_NORM );
|
||||
pls->flwaitSound = gpGlobals->time + flsoundwait;
|
||||
}
|
||||
|
||||
|
@ -189,42 +191,42 @@ void CBaseDoor::KeyValue( KeyValueData *pkvd )
|
|||
{
|
||||
if( FStrEq( pkvd->szKeyName, "skin" ) )//skin is used for content type
|
||||
{
|
||||
pev->skin = atof( pkvd->szValue );
|
||||
pev->skin = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
||||
{
|
||||
m_bMoveSnd = atof( pkvd->szValue );
|
||||
m_bMoveSnd = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
||||
{
|
||||
m_bStopSnd = atof( pkvd->szValue );
|
||||
m_bStopSnd = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "healthvalue" ) )
|
||||
{
|
||||
m_bHealthValue = atof( pkvd->szValue );
|
||||
m_bHealthValue = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "locked_sound" ) )
|
||||
{
|
||||
m_bLockedSound = atof( pkvd->szValue );
|
||||
m_bLockedSound = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) )
|
||||
{
|
||||
m_bLockedSentence = atof( pkvd->szValue );
|
||||
m_bLockedSentence = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) )
|
||||
{
|
||||
m_bUnlockedSound = atof( pkvd->szValue );
|
||||
m_bUnlockedSound = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) )
|
||||
{
|
||||
m_bUnlockedSentence = atof( pkvd->szValue );
|
||||
m_bUnlockedSentence = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "WaveHeight" ) )
|
||||
|
@ -328,115 +330,105 @@ void CBaseDoor::SetToggleState( int state )
|
|||
|
||||
void CBaseDoor::Precache( void )
|
||||
{
|
||||
char *pszSound;
|
||||
const char *pszSound;
|
||||
BOOL NullSound = FALSE;
|
||||
|
||||
// set the door's "in-motion" sound
|
||||
switch( m_bMoveSnd )
|
||||
{
|
||||
case 0:
|
||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
||||
break;
|
||||
case 1:
|
||||
PRECACHE_SOUND( "doors/doormove1.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove1.wav" );
|
||||
pszSound = "doors/doormove1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "doors/doormove2.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove2.wav" );
|
||||
pszSound = "doors/doormove2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "doors/doormove3.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove3.wav" );
|
||||
pszSound = "doors/doormove3.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "doors/doormove4.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove4.wav" );
|
||||
pszSound = "doors/doormove4.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "doors/doormove5.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove5.wav" );
|
||||
pszSound = "doors/doormove5.wav";
|
||||
break;
|
||||
case 6:
|
||||
PRECACHE_SOUND( "doors/doormove6.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove6.wav" );
|
||||
pszSound = "doors/doormove6.wav";
|
||||
break;
|
||||
case 7:
|
||||
PRECACHE_SOUND( "doors/doormove7.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove7.wav" );
|
||||
pszSound = "doors/doormove7.wav";
|
||||
break;
|
||||
case 8:
|
||||
PRECACHE_SOUND( "doors/doormove8.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove8.wav" );
|
||||
pszSound = "doors/doormove8.wav";
|
||||
break;
|
||||
case 9:
|
||||
PRECACHE_SOUND( "doors/doormove9.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove9.wav" );
|
||||
pszSound = "doors/doormove9.wav";
|
||||
break;
|
||||
case 10:
|
||||
PRECACHE_SOUND( "doors/doormove10.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove10.wav" );
|
||||
pszSound = "doors/doormove10.wav";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
||||
pszSound = "common/null.wav";
|
||||
NullSound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !NullSound )
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noiseMoving = MAKE_STRING( pszSound );
|
||||
NullSound = FALSE;
|
||||
|
||||
// set the door's 'reached destination' stop sound
|
||||
switch( m_bStopSnd )
|
||||
{
|
||||
case 0:
|
||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
||||
break;
|
||||
case 1:
|
||||
PRECACHE_SOUND( "doors/doorstop1.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop1.wav" );
|
||||
pszSound = "doors/doorstop1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "doors/doorstop2.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop2.wav" );
|
||||
pszSound = "doors/doorstop2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "doors/doorstop3.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop3.wav" );
|
||||
pszSound = "doors/doorstop3.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "doors/doorstop4.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop4.wav" );
|
||||
pszSound = "doors/doorstop4.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "doors/doorstop5.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop5.wav" );
|
||||
pszSound = "doors/doorstop5.wav";
|
||||
break;
|
||||
case 6:
|
||||
PRECACHE_SOUND( "doors/doorstop6.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop6.wav");
|
||||
pszSound = "doors/doorstop6.wav";
|
||||
break;
|
||||
case 7:
|
||||
PRECACHE_SOUND( "doors/doorstop7.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop7.wav" );
|
||||
pszSound = "doors/doorstop7.wav";
|
||||
break;
|
||||
case 8:
|
||||
PRECACHE_SOUND( "doors/doorstop8.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop8.wav" );
|
||||
pszSound = "doors/doorstop8.wav";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
||||
pszSound = "common/null.wav";
|
||||
NullSound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !NullSound )
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noiseArrived = MAKE_STRING( pszSound );
|
||||
|
||||
// get door button sounds, for doors which are directly 'touched' to open
|
||||
if( m_bLockedSound )
|
||||
{
|
||||
pszSound = ButtonSound( (int)m_bLockedSound );
|
||||
PRECACHE_SOUND( pszSound );
|
||||
m_ls.sLockedSound = ALLOC_STRING( pszSound );
|
||||
m_ls.sLockedSound = MAKE_STRING( pszSound );
|
||||
}
|
||||
|
||||
if( m_bUnlockedSound )
|
||||
{
|
||||
pszSound = ButtonSound( (int)m_bUnlockedSound );
|
||||
PRECACHE_SOUND( pszSound );
|
||||
m_ls.sUnlockedSound = ALLOC_STRING( pszSound );
|
||||
m_ls.sUnlockedSound = MAKE_STRING( pszSound );
|
||||
}
|
||||
|
||||
// get sentence group names, for doors which are directly 'touched' to open
|
||||
|
@ -444,39 +436,39 @@ void CBaseDoor::Precache( void )
|
|||
{
|
||||
case 1:
|
||||
// access denied
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NA" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NA" );
|
||||
break;
|
||||
case 2:
|
||||
// security lockout
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "ND" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "ND" );
|
||||
break;
|
||||
case 3:
|
||||
// blast door
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NF" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NF" );
|
||||
break;
|
||||
case 4:
|
||||
// fire door
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NFIRE" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NFIRE" );
|
||||
break;
|
||||
case 5:
|
||||
// chemical door
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NCHEM" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NCHEM" );
|
||||
break;
|
||||
case 6:
|
||||
// radiation door
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NRAD" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NRAD" );
|
||||
break;
|
||||
case 7:
|
||||
// gen containment
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NCON" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NCON" );
|
||||
break;
|
||||
case 8:
|
||||
// maintenance door
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NH" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NH" );
|
||||
break;
|
||||
case 9:
|
||||
// broken door
|
||||
m_ls.sLockedSentence = ALLOC_STRING( "NG" );
|
||||
m_ls.sLockedSentence = MAKE_STRING( "NG" );
|
||||
break;
|
||||
default:
|
||||
m_ls.sLockedSentence = 0;
|
||||
|
@ -487,35 +479,35 @@ void CBaseDoor::Precache( void )
|
|||
{
|
||||
case 1:
|
||||
// access granted
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EA" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "EA" );
|
||||
break;
|
||||
case 2:
|
||||
// security door
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ED" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ED" );
|
||||
break;
|
||||
case 3:
|
||||
// blast door
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EF" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "EF" );
|
||||
break;
|
||||
case 4:
|
||||
// fire door
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EFIRE" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "EFIRE" );
|
||||
break;
|
||||
case 5:
|
||||
// chemical door
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ECHEM" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ECHEM" );
|
||||
break;
|
||||
case 6:
|
||||
// radiation door
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ERAD" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ERAD" );
|
||||
break;
|
||||
case 7:
|
||||
// gen containment
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ECON" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "ECON" );
|
||||
break;
|
||||
case 8:
|
||||
// maintenance door
|
||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EH" );
|
||||
m_ls.sUnlockedSentence = MAKE_STRING( "EH" );
|
||||
break;
|
||||
default:
|
||||
m_ls.sUnlockedSentence = 0;
|
||||
|
@ -581,7 +573,7 @@ int CBaseDoor::DoorActivate()
|
|||
else
|
||||
{
|
||||
// door should open
|
||||
if( m_hActivator != NULL && m_hActivator->IsPlayer() )
|
||||
if( m_hActivator != 0 && m_hActivator->IsPlayer() )
|
||||
{
|
||||
// give health if player opened the door (medikit)
|
||||
//VARS( m_eoActivator )->health += m_bHealthValue;
|
||||
|
@ -614,7 +606,7 @@ void CBaseDoor::DoorGoUp( void )
|
|||
// filter them out and leave a client stuck with looping door sounds!
|
||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||
if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ), 1, ATTN_NORM );
|
||||
|
||||
m_toggle_state = TS_GOING_UP;
|
||||
|
||||
|
@ -623,7 +615,7 @@ void CBaseDoor::DoorGoUp( void )
|
|||
{
|
||||
float sign = 1.0;
|
||||
|
||||
if( m_hActivator != NULL )
|
||||
if( m_hActivator != 0 )
|
||||
{
|
||||
pevActivator = m_hActivator->pev;
|
||||
|
||||
|
@ -654,8 +646,8 @@ void CBaseDoor::DoorHitTop( void )
|
|||
{
|
||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||
{
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||
}
|
||||
|
||||
ASSERT( m_toggle_state == TS_GOING_UP );
|
||||
|
@ -694,7 +686,7 @@ void CBaseDoor::DoorGoDown( void )
|
|||
{
|
||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||
if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ), 1, ATTN_NORM );
|
||||
#ifdef DOOR_ASSERT
|
||||
ASSERT( m_toggle_state == TS_AT_TOP );
|
||||
#endif // DOOR_ASSERT
|
||||
|
@ -714,8 +706,8 @@ void CBaseDoor::DoorHitBottom( void )
|
|||
{
|
||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||
{
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||
}
|
||||
|
||||
ASSERT( m_toggle_state == TS_GOING_DOWN );
|
||||
|
@ -746,10 +738,22 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
|
|||
if( pev->dmg )
|
||||
pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );
|
||||
|
||||
if( satchelfix.value )
|
||||
{
|
||||
// Detonate satchels
|
||||
if( !strcmp( "monster_satchel", STRING( pOther->pev->classname ) ) )
|
||||
( (CSatchel*)pOther )->Use( this, this, USE_ON, 0 );
|
||||
}
|
||||
|
||||
// if a door has a negative wait, it would never come back if blocked,
|
||||
// so let it just squash the object to death real fast
|
||||
if( m_flWait >= 0 )
|
||||
{
|
||||
// BMod Start - Door sound fix.
|
||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||
// BMod End
|
||||
|
||||
if( m_toggle_state == TS_GOING_DOWN )
|
||||
{
|
||||
DoorGoUp();
|
||||
|
@ -763,7 +767,7 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
|
|||
// Block all door pieces with the same targetname here.
|
||||
if( !FStringNull( pev->targetname ) )
|
||||
{
|
||||
for(;;)
|
||||
for( ; ; )
|
||||
{
|
||||
pentTarget = FIND_ENTITY_BY_TARGETNAME( pentTarget, STRING( pev->targetname ) );
|
||||
|
||||
|
@ -795,7 +799,7 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
|
|||
}
|
||||
}
|
||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||
|
||||
if( pDoor->m_toggle_state == TS_GOING_DOWN )
|
||||
pDoor->DoorGoUp();
|
||||
|
@ -975,94 +979,88 @@ void CMomentaryDoor::Spawn( void )
|
|||
|
||||
Precache();
|
||||
}
|
||||
|
||||
|
||||
void CMomentaryDoor::Precache( void )
|
||||
{
|
||||
const char *pszSound;
|
||||
BOOL NullSound = FALSE;
|
||||
|
||||
// set the door's "in-motion" sound
|
||||
switch( m_bMoveSnd )
|
||||
{
|
||||
case 0:
|
||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
||||
break;
|
||||
case 1:
|
||||
PRECACHE_SOUND( "doors/doormove1.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove1.wav" );
|
||||
pszSound = "doors/doormove1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "doors/doormove2.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove2.wav" );
|
||||
pszSound = "doors/doormove2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "doors/doormove3.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove3.wav" );
|
||||
pszSound = "doors/doormove3.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "doors/doormove4.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove4.wav" );
|
||||
pszSound = "doors/doormove4.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "doors/doormove5.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove5.wav" );
|
||||
pszSound = "doors/doormove5.wav";
|
||||
break;
|
||||
case 6:
|
||||
PRECACHE_SOUND( "doors/doormove6.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove6.wav" );
|
||||
pszSound = "doors/doormove6.wav";
|
||||
break;
|
||||
case 7:
|
||||
PRECACHE_SOUND( "doors/doormove7.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove7.wav" );
|
||||
pszSound = "doors/doormove7.wav";
|
||||
break;
|
||||
case 8:
|
||||
PRECACHE_SOUND( "doors/doormove8.wav" );
|
||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove8.wav" );
|
||||
pszSound = "doors/doormove8.wav";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
||||
pszSound = "common/null.wav";
|
||||
NullSound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !NullSound )
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noiseMoving = MAKE_STRING( pszSound );
|
||||
NullSound = FALSE;
|
||||
|
||||
// set the door's 'reached destination' stop sound
|
||||
switch( m_bStopSnd )
|
||||
{
|
||||
case 0:
|
||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
||||
break;
|
||||
case 1:
|
||||
PRECACHE_SOUND( "doors/doorstop1.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop1.wav" );
|
||||
pszSound = "doors/doorstop1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "doors/doorstop2.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop2.wav" );
|
||||
pszSound = "doors/doorstop2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "doors/doorstop3.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING("doors/doorstop3.wav");
|
||||
pszSound = "doors/doorstop3.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "doors/doorstop4.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop4.wav" );
|
||||
pszSound = "doors/doorstop4.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "doors/doorstop5.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop5.wav" );
|
||||
pszSound = "doors/doorstop5.wav";
|
||||
break;
|
||||
case 6:
|
||||
PRECACHE_SOUND( "doors/doorstop6.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop6.wav" );
|
||||
pszSound = "doors/doorstop6.wav";
|
||||
break;
|
||||
case 7:
|
||||
PRECACHE_SOUND( "doors/doorstop7.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop7.wav" );
|
||||
pszSound = "doors/doorstop7.wav";
|
||||
break;
|
||||
case 8:
|
||||
PRECACHE_SOUND( "doors/doorstop8.wav" );
|
||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop8.wav" );
|
||||
pszSound = "doors/doorstop8.wav";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
||||
pszSound = "common/null.wav";
|
||||
NullSound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !NullSound )
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noiseArrived = MAKE_STRING( pszSound );
|
||||
}
|
||||
|
||||
void CMomentaryDoor::KeyValue( KeyValueData *pkvd )
|
||||
|
@ -1070,7 +1068,7 @@ void CMomentaryDoor::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
||||
{
|
||||
m_bMoveSnd = atof( pkvd->szValue );
|
||||
m_bMoveSnd = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
||||
|
@ -1100,23 +1098,26 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
|
|||
Vector move = m_vecPosition1 + ( value * ( m_vecPosition2 - m_vecPosition1 ) );
|
||||
|
||||
Vector delta = move - pev->origin;
|
||||
float speed = delta.Length() * 10;
|
||||
//float speed = delta.Length() * 10;
|
||||
float speed = delta.Length() / 0.1; // move there in 0.1 sec
|
||||
|
||||
if( speed != 0 )
|
||||
{
|
||||
// This entity only thinks when it moves, so if it's thinking, it's in the process of moving
|
||||
// play the sound when it starts moving
|
||||
// play the sound when it starts moving(not yet thinking)
|
||||
if( pev->nextthink < pev->ltime || pev->nextthink == 0 )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ), 1, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ), 1, ATTN_NORM );
|
||||
// If we already moving to designated point, return
|
||||
else if( move == m_vecFinalDest )
|
||||
return;
|
||||
|
||||
LinearMove( move, speed );
|
||||
SetMoveDone( &CMomentaryDoor::MomentaryMoveDone );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CMomentaryDoor::MomentaryMoveDone( void )
|
||||
{
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ void CBubbling::Spawn( void )
|
|||
pev->solid = SOLID_NOT; // Remove model & collisions
|
||||
pev->renderamt = 0; // The engine won't draw this model if this is set to 0 and blending is on
|
||||
pev->rendermode = kRenderTransTexture;
|
||||
int speed = pev->speed > 0 ? pev->speed : -pev->speed;
|
||||
int speed = fabs( pev->speed );
|
||||
|
||||
// HACKHACK!!! - Speed in rendercolor
|
||||
pev->rendercolor.x = speed >> 8;
|
||||
|
@ -229,7 +229,7 @@ void CBeam::BeamInit( const char *pSpriteName, int width )
|
|||
SetFrame( 0 );
|
||||
SetScrollRate( 0 );
|
||||
pev->model = MAKE_STRING( pSpriteName );
|
||||
SetTexture( PRECACHE_MODEL( (char *)pSpriteName ) );
|
||||
SetTexture( PRECACHE_MODEL( pSpriteName ) );
|
||||
SetWidth( width );
|
||||
pev->skin = 0;
|
||||
pev->sequence = 0;
|
||||
|
@ -280,12 +280,12 @@ void CBeam::RelinkBeam( void )
|
|||
{
|
||||
const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
|
||||
|
||||
pev->mins.x = min( startPos.x, endPos.x );
|
||||
pev->mins.y = min( startPos.y, endPos.y );
|
||||
pev->mins.z = min( startPos.z, endPos.z );
|
||||
pev->maxs.x = max( startPos.x, endPos.x );
|
||||
pev->maxs.y = max( startPos.y, endPos.y );
|
||||
pev->maxs.z = max( startPos.z, endPos.z );
|
||||
pev->mins.x = Q_min( startPos.x, endPos.x );
|
||||
pev->mins.y = Q_min( startPos.y, endPos.y );
|
||||
pev->mins.z = Q_min( startPos.z, endPos.z );
|
||||
pev->maxs.x = Q_max( startPos.x, endPos.x );
|
||||
pev->maxs.y = Q_max( startPos.y, endPos.y );
|
||||
pev->maxs.z = Q_max( startPos.z, endPos.z );
|
||||
pev->mins = pev->mins - pev->origin;
|
||||
pev->maxs = pev->maxs - pev->origin;
|
||||
|
||||
|
@ -486,7 +486,7 @@ void CLightning::Spawn( void )
|
|||
|
||||
void CLightning::Precache( void )
|
||||
{
|
||||
m_spriteTexture = PRECACHE_MODEL( (char *)STRING( m_iszSpriteName ) );
|
||||
m_spriteTexture = PRECACHE_MODEL( STRING( m_iszSpriteName ) );
|
||||
CBeam::Precache();
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ void CLightning::StrikeThink( void )
|
|||
WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b
|
||||
WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b
|
||||
WRITE_BYTE( (int)pev->rendercolor.z ); // r, g, b
|
||||
WRITE_BYTE( pev->renderamt ); // brightness
|
||||
WRITE_BYTE( (int)pev->renderamt ); // brightness
|
||||
WRITE_BYTE( m_speed ); // speed
|
||||
MESSAGE_END();
|
||||
DoSparks( pStart->pev->origin, pEnd->pev->origin );
|
||||
|
@ -763,7 +763,7 @@ void CLightning::Zap( const Vector &vecSrc, const Vector &vecDest )
|
|||
WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b
|
||||
WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b
|
||||
WRITE_BYTE( (int)pev->rendercolor.z ); // r, g, b
|
||||
WRITE_BYTE( pev->renderamt ); // brightness
|
||||
WRITE_BYTE( (int)pev->renderamt ); // brightness
|
||||
WRITE_BYTE( m_speed ); // speed
|
||||
MESSAGE_END();
|
||||
#else
|
||||
|
@ -944,7 +944,7 @@ void CLaser::Spawn( void )
|
|||
m_pSprite = NULL;
|
||||
|
||||
if( m_pSprite )
|
||||
m_pSprite->SetTransparency( kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx );
|
||||
m_pSprite->SetTransparency( kRenderGlow, (int)pev->rendercolor.x, (int)pev->rendercolor.y, (int)pev->rendercolor.z, (int)pev->renderamt, (int)pev->renderfx );
|
||||
|
||||
if( pev->targetname && !( pev->spawnflags & SF_BEAM_STARTON ) )
|
||||
TurnOff();
|
||||
|
@ -954,9 +954,9 @@ void CLaser::Spawn( void )
|
|||
|
||||
void CLaser::Precache( void )
|
||||
{
|
||||
pev->modelindex = PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
pev->modelindex = PRECACHE_MODEL( STRING( pev->model ) );
|
||||
if( m_iszSpriteName )
|
||||
PRECACHE_MODEL( (char *)STRING( m_iszSpriteName ) );
|
||||
PRECACHE_MODEL( STRING( m_iszSpriteName ) );
|
||||
}
|
||||
|
||||
void CLaser::KeyValue( KeyValueData *pkvd )
|
||||
|
@ -1100,7 +1100,7 @@ void CGlow::Spawn( void )
|
|||
pev->effects = 0;
|
||||
pev->frame = 0;
|
||||
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
|
||||
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
|
||||
|
@ -1160,7 +1160,7 @@ void CSprite::Spawn( void )
|
|||
|
||||
void CSprite::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
|
||||
// Reset attachment after save/restore
|
||||
if( pev->aiment )
|
||||
|
@ -1515,7 +1515,7 @@ void CEnvShooter::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CEnvShooter::Precache( void )
|
||||
{
|
||||
m_iGibModelIndex = PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
m_iGibModelIndex = PRECACHE_MODEL( STRING( pev->model ) );
|
||||
CBreakable::MaterialSoundPrecache( (Materials)m_iGibMaterial );
|
||||
}
|
||||
|
||||
|
@ -1619,7 +1619,7 @@ void CTestEffect::TestThink( void )
|
|||
for( i = 0; i < m_iBeam; i++ )
|
||||
{
|
||||
t = ( gpGlobals->time - m_flBeamTime[i] ) / ( 3 + m_flStartTime - m_flBeamTime[i] );
|
||||
m_pBeam[i]->SetBrightness( 255 * t );
|
||||
m_pBeam[i]->SetBrightness( (int)( 255 * t ) );
|
||||
// m_pBeam[i]->SetScrollRate( 20 * t );
|
||||
}
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
@ -1749,9 +1749,9 @@ Vector CBlood::BloodPosition( CBaseEntity *pActivator )
|
|||
void CBlood::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if( pev->spawnflags & SF_BLOOD_STREAM )
|
||||
UTIL_BloodStream( BloodPosition( pActivator ), Direction(), ( Color() == BLOOD_COLOR_RED ) ? 70 : Color(), BloodAmount() );
|
||||
UTIL_BloodStream( BloodPosition( pActivator ), Direction(), ( Color() == BLOOD_COLOR_RED ) ? 70 : Color(), (int)BloodAmount() );
|
||||
else
|
||||
UTIL_BloodDrips( BloodPosition( pActivator ), Direction(), Color(), BloodAmount() );
|
||||
UTIL_BloodDrips( BloodPosition( pActivator ), Direction(), Color(), (int)BloodAmount() );
|
||||
|
||||
if( pev->spawnflags & SF_BLOOD_DECAL )
|
||||
{
|
||||
|
@ -1947,12 +1947,12 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
|
|||
{
|
||||
if( pActivator->IsNetClient() )
|
||||
{
|
||||
UTIL_ScreenFade( pActivator, pev->rendercolor, Duration(), HoldTime(), pev->renderamt, fadeFlags );
|
||||
UTIL_ScreenFade( pActivator, pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), pev->renderamt, fadeFlags );
|
||||
UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags );
|
||||
}
|
||||
SUB_UseTargets( this, USE_TOGGLE, 0 );
|
||||
}
|
||||
|
@ -2005,7 +2005,7 @@ void CMessage::Spawn( void )
|
|||
void CMessage::Precache( void )
|
||||
{
|
||||
if( pev->noise )
|
||||
PRECACHE_SOUND( (char *)STRING( pev->noise ) );
|
||||
PRECACHE_SOUND( STRING( pev->noise ) );
|
||||
}
|
||||
|
||||
void CMessage::KeyValue( KeyValueData *pkvd )
|
||||
|
@ -2040,16 +2040,15 @@ void CMessage::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useT
|
|||
if( pActivator && pActivator->IsPlayer() )
|
||||
pPlayer = pActivator;
|
||||
else
|
||||
{
|
||||
pPlayer = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );
|
||||
}
|
||||
|
||||
if( pPlayer )
|
||||
UTIL_ShowMessage( STRING( pev->message ), pPlayer );
|
||||
}
|
||||
|
||||
if( pev->noise )
|
||||
{
|
||||
EMIT_SOUND( edict(), CHAN_BODY, STRING( pev->noise ), pev->scale, pev->speed );
|
||||
}
|
||||
|
||||
if( pev->spawnflags & SF_MESSAGE_ONCE )
|
||||
UTIL_Remove( this );
|
||||
|
||||
|
@ -2071,7 +2070,7 @@ public:
|
|||
|
||||
void CEnvFunnel::Precache( void )
|
||||
{
|
||||
m_iSprite = PRECACHE_MODEL ( "sprites/flare6.spr" );
|
||||
m_iSprite = PRECACHE_MODEL( "sprites/flare6.spr" );
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS( env_funnel, CEnvFunnel )
|
||||
|
|
|
@ -238,7 +238,7 @@ public:
|
|||
|
||||
inline int GetWidth( void )
|
||||
{
|
||||
return pev->scale;
|
||||
return (int)pev->scale;
|
||||
}
|
||||
|
||||
inline int GetNoise( void )
|
||||
|
@ -255,17 +255,17 @@ public:
|
|||
|
||||
inline int GetBrightness( void )
|
||||
{
|
||||
return pev->renderamt;
|
||||
return (int)pev->renderamt;
|
||||
}
|
||||
|
||||
inline int GetFrame( void )
|
||||
{
|
||||
return pev->frame;
|
||||
return (int)pev->frame;
|
||||
}
|
||||
|
||||
inline int GetScrollRate( void )
|
||||
{
|
||||
return pev->animtime;
|
||||
return (int)pev->animtime;
|
||||
}
|
||||
|
||||
// Call after you change start/end positions
|
||||
|
|
|
@ -143,7 +143,7 @@ float CEgon::GetDischargeInterval( void )
|
|||
|
||||
BOOL CEgon::HasAmmo( void )
|
||||
{
|
||||
if( m_pPlayer->ammo_uranium <= 0 )
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
@ -270,7 +270,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
|||
}
|
||||
}
|
||||
#endif
|
||||
float timedist;
|
||||
float timedist = 0.0f;
|
||||
|
||||
switch( m_fireMode )
|
||||
{
|
||||
|
@ -380,13 +380,13 @@ void CEgon::UpdateEffect( const Vector &startPoint, const Vector &endPoint, floa
|
|||
}
|
||||
|
||||
m_pBeam->SetStartPos( endPoint );
|
||||
m_pBeam->SetBrightness( 255 - ( timeBlend * 180 ) );
|
||||
m_pBeam->SetWidth( 40 - ( timeBlend * 20 ) );
|
||||
m_pBeam->SetBrightness( (int)( 255 - ( timeBlend * 180 )) );
|
||||
m_pBeam->SetWidth( (int)( 40 - ( timeBlend * 20 ) ) );
|
||||
|
||||
if( m_fireMode == FIRE_WIDE )
|
||||
m_pBeam->SetColor( 30 + ( 25 * timeBlend ), 30 + ( 30 * timeBlend ), 64 + 80 * fabs( sin( gpGlobals->time * 10 ) ) );
|
||||
m_pBeam->SetColor( (int)( 30 + ( 25 * timeBlend ) ), (int)( 30 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time * 10 ) ) ) );
|
||||
else
|
||||
m_pBeam->SetColor( 60 + ( 25 * timeBlend ), 120 + ( 30 * timeBlend ), 64 + 80 * fabs( sin( gpGlobals->time *10 ) ) );
|
||||
m_pBeam->SetColor( (int)( 60 + ( 25 * timeBlend ) ), (int)( 120 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time *10 ) ) ) );
|
||||
|
||||
UTIL_SetOrigin( m_pSprite->pev, endPoint );
|
||||
m_pSprite->pev->frame += 8 * gpGlobals->frametime;
|
||||
|
|
|
@ -14,10 +14,14 @@
|
|||
****/
|
||||
#ifndef ENGINECALLBACK_H
|
||||
#define ENGINECALLBACK_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "event_flags.h"
|
||||
|
||||
// Fix warning in MSVC8
|
||||
#undef SERVER_EXECUTE
|
||||
|
||||
// Must be provided by user of this code
|
||||
extern enginefuncs_t g_engfuncs;
|
||||
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
#endif
|
||||
|
||||
// Silence certain warnings
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4244) // int or float down-conversion
|
||||
#pragma warning(disable : 4305) // int or float data truncation
|
||||
#pragma warning(disable : 4201) // nameless struct/union
|
||||
#pragma warning(disable : 4514) // unreferenced inline function removed
|
||||
#pragma warning(disable : 4100) // unreferenced formal parameter
|
||||
#endif
|
||||
|
||||
// Prevent tons of unused windows definitions
|
||||
#ifdef _WIN32
|
||||
|
@ -42,9 +44,13 @@
|
|||
#include "windows.h"
|
||||
#undef HSPRITE
|
||||
#else // _WIN32
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
typedef unsigned long ULONG;
|
||||
#endif
|
||||
typedef unsigned int ULONG;
|
||||
typedef unsigned char BYTE;
|
||||
typedef int BOOL;
|
||||
#define MAX_PATH PATH_MAX
|
||||
|
@ -82,11 +88,11 @@ typedef float vec_t; // needed before including progdefs.h
|
|||
|
||||
// Shared header between the client DLL and the game DLLs
|
||||
#include "cdll_dll.h"
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef Q_min
|
||||
#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef Q_max
|
||||
#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#endif //EXTDLL_H
|
||||
|
|
|
@ -104,7 +104,7 @@ void CBreakable::KeyValue( KeyValueData* pkvd )
|
|||
else if( FStrEq( pkvd->szKeyName, "spawnobject" ) )
|
||||
{
|
||||
int object = atoi( pkvd->szValue );
|
||||
if( object > 0 && object < ARRAYSIZE( pSpawnObjects ) )
|
||||
if( object > 0 && object < (int)ARRAYSIZE( pSpawnObjects ) )
|
||||
m_iszSpawnObject = MAKE_STRING( pSpawnObjects[object] );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ void CBreakable::MaterialSoundPrecache( Materials precacheMaterial )
|
|||
|
||||
for( i = 0; i < soundCount; i++ )
|
||||
{
|
||||
PRECACHE_SOUND( (char *)pSoundList[i] );
|
||||
PRECACHE_SOUND( pSoundList[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -340,11 +340,11 @@ void CBreakable::Precache( void )
|
|||
if( m_iszGibModel )
|
||||
pGibName = STRING( m_iszGibModel );
|
||||
|
||||
m_idShard = PRECACHE_MODEL( (char *)pGibName );
|
||||
m_idShard = PRECACHE_MODEL( pGibName );
|
||||
|
||||
// Precache the spawn item's data
|
||||
if( m_iszSpawnObject )
|
||||
UTIL_PrecacheOther( (char *)STRING( m_iszSpawnObject ) );
|
||||
UTIL_PrecacheOther( STRING( m_iszSpawnObject ) );
|
||||
}
|
||||
|
||||
// play shard sound when func_breakable takes damage.
|
||||
|
@ -353,7 +353,7 @@ void CBreakable::DamageSound( void )
|
|||
{
|
||||
int pitch;
|
||||
float fvol;
|
||||
char *rgpsz[6];
|
||||
const char *rgpsz[6];
|
||||
int i = 0;
|
||||
int material = m_Material;
|
||||
|
||||
|
@ -574,7 +574,6 @@ void CBreakable::Die( void )
|
|||
{
|
||||
Vector vecSpot;// shard origin
|
||||
Vector vecVelocity;// shard velocity
|
||||
CBaseEntity *pEntity = NULL;
|
||||
char cFlag = 0;
|
||||
int pitch;
|
||||
float fvol;
|
||||
|
@ -747,7 +746,7 @@ void CBreakable::Die( void )
|
|||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
pev->nextthink = pev->ltime + 0.1;
|
||||
if( m_iszSpawnObject )
|
||||
CBaseEntity::Create( (char *)STRING( m_iszSpawnObject ), VecBModelOrigin( pev ), pev->angles, edict() );
|
||||
CBaseEntity::Create( STRING( m_iszSpawnObject ), VecBModelOrigin( pev ), pev->angles, edict() );
|
||||
|
||||
if( Explodable() )
|
||||
{
|
||||
|
@ -794,7 +793,7 @@ public:
|
|||
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
static char *m_soundNames[3];
|
||||
static const char *m_soundNames[3];
|
||||
int m_lastSound; // no need to save/restore, just keeps the same sound from playing twice in a row
|
||||
float m_maxSpeed;
|
||||
float m_soundTime;
|
||||
|
@ -810,7 +809,7 @@ IMPLEMENT_SAVERESTORE( CPushable, CBreakable )
|
|||
|
||||
LINK_ENTITY_TO_CLASS( func_pushable, CPushable )
|
||||
|
||||
char *CPushable::m_soundNames[3] =
|
||||
const char *CPushable::m_soundNames[3] =
|
||||
{
|
||||
"debris/pushbox1.wav",
|
||||
"debris/pushbox2.wav",
|
||||
|
@ -839,7 +838,7 @@ void CPushable::Spawn( void )
|
|||
UTIL_SetOrigin( pev, pev->origin );
|
||||
|
||||
// Multiply by area of the box's cross-section (assume 1000 units^3 standard volume)
|
||||
pev->skin = ( pev->skin * ( pev->maxs.x - pev->mins.x ) * ( pev->maxs.y - pev->mins.y ) ) * 0.0005;
|
||||
pev->skin = (int)( ( pev->skin * ( pev->maxs.x - pev->mins.x ) * ( pev->maxs.y - pev->mins.y ) ) * 0.0005 );
|
||||
m_soundTime = 0;
|
||||
}
|
||||
|
||||
|
@ -882,7 +881,7 @@ void CPushable::KeyValue( KeyValueData *pkvd )
|
|||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "buoyancy" ) )
|
||||
{
|
||||
pev->skin = atof( pkvd->szValue );
|
||||
pev->skin = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
BOOL StartControl( CBasePlayer* pController );
|
||||
void StopControl( void );
|
||||
void ControllerPostFrame( void );
|
||||
virtual void StopFire( void ){}
|
||||
|
||||
protected:
|
||||
CBasePlayer* m_pController;
|
||||
|
@ -190,7 +191,7 @@ void CFuncTank::Spawn( void )
|
|||
|
||||
if( m_fireRate <= 0 )
|
||||
m_fireRate = 1;
|
||||
if( m_spread > MAX_FIRING_SPREADS )
|
||||
if( m_spread > (int)MAX_FIRING_SPREADS )
|
||||
m_spread = 0;
|
||||
|
||||
pev->oldorigin = pev->origin;
|
||||
|
@ -199,13 +200,13 @@ void CFuncTank::Spawn( void )
|
|||
void CFuncTank::Precache( void )
|
||||
{
|
||||
if( m_iszSpriteSmoke )
|
||||
PRECACHE_MODEL( (char *)STRING( m_iszSpriteSmoke ) );
|
||||
PRECACHE_MODEL( STRING( m_iszSpriteSmoke ) );
|
||||
|
||||
if( m_iszSpriteFlash )
|
||||
PRECACHE_MODEL( (char *)STRING( m_iszSpriteFlash ) );
|
||||
PRECACHE_MODEL( STRING( m_iszSpriteFlash ) );
|
||||
|
||||
if( pev->noise )
|
||||
PRECACHE_SOUND( (char *)STRING( pev->noise ) );
|
||||
PRECACHE_SOUND( STRING( pev->noise ) );
|
||||
}
|
||||
|
||||
void CFuncTank::KeyValue( KeyValueData *pkvd )
|
||||
|
@ -328,7 +329,7 @@ BOOL CFuncTank::OnControls( entvars_t *pevTest )
|
|||
if( !( pev->spawnflags & SF_TANK_CANCONTROL ) )
|
||||
return FALSE;
|
||||
|
||||
Vector offset = pevTest->origin - pev->origin;
|
||||
//Vector offset = pevTest->origin - pev->origin;
|
||||
|
||||
if( ( m_vecControllerUsePos - pevTest->origin ).Length() < 30 )
|
||||
return TRUE;
|
||||
|
@ -351,6 +352,7 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController )
|
|||
ALERT( at_console, "using TANK!\n");
|
||||
|
||||
m_pController = pController;
|
||||
m_pController->m_pTank = this;
|
||||
if( m_pController->m_pActiveItem )
|
||||
{
|
||||
m_pController->m_pActiveItem->Holster();
|
||||
|
@ -368,6 +370,8 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController )
|
|||
|
||||
void CFuncTank::StopControl()
|
||||
{
|
||||
StopFire();
|
||||
|
||||
// TODO: bring back the controllers current weapon
|
||||
if( !m_pController )
|
||||
return;
|
||||
|
@ -380,6 +384,8 @@ void CFuncTank::StopControl()
|
|||
m_pController->m_iHideHUD &= ~HIDEHUD_WEAPONS;
|
||||
|
||||
pev->nextthink = 0;
|
||||
|
||||
m_pController->m_pTank = NULL;
|
||||
m_pController = NULL;
|
||||
|
||||
if( IsActive() )
|
||||
|
@ -426,7 +432,6 @@ void CFuncTank::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
|
|||
}
|
||||
else if( !m_pController && useType != USE_OFF )
|
||||
{
|
||||
( (CBasePlayer*)pActivator )->m_pTank = this;
|
||||
StartControl( (CBasePlayer*)pActivator );
|
||||
}
|
||||
else
|
||||
|
@ -476,9 +481,9 @@ void CFuncTank::TrackTarget( void )
|
|||
{
|
||||
TraceResult tr;
|
||||
edict_t *pPlayer = FIND_CLIENT_IN_PVS( edict() );
|
||||
BOOL updateTime = FALSE, lineOfSight;
|
||||
BOOL updateTime = FALSE;
|
||||
Vector angles, direction, targetPosition, barrelEnd;
|
||||
edict_t *pTarget;
|
||||
edict_t *pTarget = NULL;
|
||||
|
||||
// Get a position to aim for
|
||||
if( m_pController )
|
||||
|
@ -515,12 +520,8 @@ void CFuncTank::TrackTarget( void )
|
|||
|
||||
UTIL_TraceLine( barrelEnd, targetPosition, dont_ignore_monsters, edict(), &tr );
|
||||
|
||||
lineOfSight = FALSE;
|
||||
// No line of sight, don't track
|
||||
if( tr.flFraction == 1.0 || tr.pHit == pTarget )
|
||||
{
|
||||
lineOfSight = TRUE;
|
||||
|
||||
CBaseEntity *pInstance = CBaseEntity::Instance(pTarget);
|
||||
if( InRange( range ) && pInstance && pInstance->IsAlive() )
|
||||
{
|
||||
|
@ -644,7 +645,7 @@ void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t
|
|||
{
|
||||
CSprite *pSprite = CSprite::SpriteCreate( STRING( m_iszSpriteSmoke ), barrelEnd, TRUE );
|
||||
pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0, 20.0 ) );
|
||||
pSprite->SetTransparency( kRenderTransAlpha, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, 255, kRenderFxNone );
|
||||
pSprite->SetTransparency( kRenderTransAlpha, (int)pev->rendercolor.x, (int)pev->rendercolor.y, (int)pev->rendercolor.z, 255, kRenderFxNone );
|
||||
pSprite->pev->velocity.z = RANDOM_FLOAT( 40, 80 );
|
||||
pSprite->SetScale( m_spriteScale );
|
||||
}
|
||||
|
@ -687,13 +688,13 @@ void CFuncTank::StartRotSound( void )
|
|||
if( !pev->noise || ( pev->spawnflags & SF_TANK_SOUNDON ) )
|
||||
return;
|
||||
pev->spawnflags |= SF_TANK_SOUNDON;
|
||||
EMIT_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noise ), 0.85, ATTN_NORM );
|
||||
EMIT_SOUND( edict(), CHAN_STATIC, STRING( pev->noise ), 0.85, ATTN_NORM );
|
||||
}
|
||||
|
||||
void CFuncTank::StopRotSound( void )
|
||||
{
|
||||
if( pev->spawnflags & SF_TANK_SOUNDON )
|
||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noise ) );
|
||||
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noise ) );
|
||||
pev->spawnflags &= ~SF_TANK_SOUNDON;
|
||||
}
|
||||
|
||||
|
@ -714,7 +715,7 @@ void CFuncTankGun::Fire( const Vector &barrelEnd, const Vector &forward, entvars
|
|||
// FireBullets needs gpGlobals->v_up, etc.
|
||||
UTIL_MakeAimVectors( pev->angles );
|
||||
|
||||
int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate;
|
||||
int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate );
|
||||
if( bulletCount > 0 )
|
||||
{
|
||||
for( i = 0; i < bulletCount; i++ )
|
||||
|
@ -754,6 +755,7 @@ public:
|
|||
virtual int Save( CSave &save );
|
||||
virtual int Restore( CRestore &restore );
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
virtual void StopFire( void );
|
||||
|
||||
private:
|
||||
CLaser *m_pLaser;
|
||||
|
@ -835,7 +837,7 @@ void CFuncTankLaser::Fire( const Vector &barrelEnd, const Vector &forward, entva
|
|||
// TankTrace needs gpGlobals->v_up, etc.
|
||||
UTIL_MakeAimVectors( pev->angles );
|
||||
|
||||
int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate;
|
||||
int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate );
|
||||
if( bulletCount )
|
||||
{
|
||||
for( i = 0; i < bulletCount; i++ )
|
||||
|
@ -858,6 +860,12 @@ void CFuncTankLaser::Fire( const Vector &barrelEnd, const Vector &forward, entva
|
|||
}
|
||||
}
|
||||
|
||||
void CFuncTankLaser::StopFire( void )
|
||||
{
|
||||
if( m_pLaser )
|
||||
m_pLaser->TurnOff();
|
||||
}
|
||||
|
||||
class CFuncTankRocket : public CFuncTank
|
||||
{
|
||||
public:
|
||||
|
@ -879,12 +887,12 @@ void CFuncTankRocket::Fire( const Vector &barrelEnd, const Vector &forward, entv
|
|||
|
||||
if( m_fireLast != 0 )
|
||||
{
|
||||
int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate;
|
||||
int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate );
|
||||
if( bulletCount > 0 )
|
||||
{
|
||||
for( i = 0; i < bulletCount; i++ )
|
||||
{
|
||||
CBaseEntity *pRocket = CBaseEntity::Create( "rpg_rocket", barrelEnd, pev->angles, edict() );
|
||||
CBaseEntity::Create( "rpg_rocket", barrelEnd, pev->angles, edict() );
|
||||
}
|
||||
CFuncTank::Fire( barrelEnd, forward, pev );
|
||||
}
|
||||
|
@ -917,7 +925,7 @@ void CFuncTankMortar::Fire( const Vector &barrelEnd, const Vector &forward, entv
|
|||
{
|
||||
if( m_fireLast != 0 )
|
||||
{
|
||||
int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate;
|
||||
int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate );
|
||||
// Only create 1 explosion
|
||||
if( bulletCount > 0 )
|
||||
{
|
||||
|
|
|
@ -25,11 +25,13 @@ cvar_t timeleft = { "mp_timeleft","0" , FCVAR_SERVER | FCVAR_UNLOGGED }; // "
|
|||
|
||||
// multiplayer server rules
|
||||
cvar_t teamplay = { "mp_teamplay","0", FCVAR_SERVER };
|
||||
cvar_t fraglimit = {"mp_fraglimit","0", FCVAR_SERVER };
|
||||
cvar_t fraglimit = { "mp_fraglimit","0", FCVAR_SERVER };
|
||||
cvar_t timelimit = { "mp_timelimit","0", FCVAR_SERVER };
|
||||
cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER };
|
||||
cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
|
||||
cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
|
||||
cvar_t selfgauss = { "mp_selfgauss", "1", FCVAR_SERVER };
|
||||
cvar_t satchelfix = { "mp_satchelfix", "0", FCVAR_SERVER };
|
||||
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
|
||||
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
|
||||
cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER };
|
||||
|
@ -38,6 +40,9 @@ cvar_t teamlist = { "mp_teamlist","hgrunt;scientist", FCVAR_SERVER };
|
|||
cvar_t teamoverride = { "mp_teamoverride","1" };
|
||||
cvar_t defaultteam = { "mp_defaultteam","0" };
|
||||
cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER };
|
||||
cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER };
|
||||
|
||||
cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators
|
||||
|
||||
cvar_t mp_chattime = { "mp_chattime","10", FCVAR_SERVER };
|
||||
|
||||
|
@ -452,6 +457,7 @@ void GameDLLInit( void )
|
|||
g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );
|
||||
|
||||
CVAR_REGISTER( &displaysoundlist );
|
||||
CVAR_REGISTER( &allow_spectators );
|
||||
|
||||
CVAR_REGISTER( &teamplay );
|
||||
CVAR_REGISTER( &fraglimit );
|
||||
|
@ -463,6 +469,8 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &friendlyfire );
|
||||
CVAR_REGISTER( &falldamage );
|
||||
CVAR_REGISTER( &weaponstay );
|
||||
CVAR_REGISTER( &selfgauss );
|
||||
CVAR_REGISTER( &satchelfix );
|
||||
CVAR_REGISTER( &forcerespawn );
|
||||
CVAR_REGISTER( &flashlight );
|
||||
CVAR_REGISTER( &aimcrosshair );
|
||||
|
@ -471,6 +479,7 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &teamoverride );
|
||||
CVAR_REGISTER( &defaultteam );
|
||||
CVAR_REGISTER( &allowmonsters );
|
||||
CVAR_REGISTER( &bhopcap );
|
||||
|
||||
CVAR_REGISTER( &mp_chattime );
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ extern cvar_t timelimit;
|
|||
extern cvar_t friendlyfire;
|
||||
extern cvar_t falldamage;
|
||||
extern cvar_t weaponstay;
|
||||
extern cvar_t selfgauss;
|
||||
extern cvar_t satchelfix;
|
||||
extern cvar_t forcerespawn;
|
||||
extern cvar_t flashlight;
|
||||
extern cvar_t aimcrosshair;
|
||||
|
|
|
@ -200,6 +200,7 @@ class CGargantua : public CBaseMonster
|
|||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void UpdateOnRemove();
|
||||
void SetYawSpeed( void );
|
||||
int Classify( void );
|
||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
|
||||
|
@ -538,7 +539,6 @@ void CGargantua::FlameControls( float angleX, float angleY )
|
|||
void CGargantua::FlameUpdate( void )
|
||||
{
|
||||
int i;
|
||||
static float offset[2] = { 60, -60 };
|
||||
TraceResult trace;
|
||||
Vector vecStart, angleGun;
|
||||
BOOL streaks = FALSE;
|
||||
|
@ -759,7 +759,7 @@ void CGargantua::Spawn()
|
|||
//=========================================================
|
||||
void CGargantua::Precache()
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
PRECACHE_MODEL( "models/garg.mdl" );
|
||||
PRECACHE_MODEL( GARG_EYE_SPRITE_NAME );
|
||||
|
@ -770,39 +770,52 @@ void CGargantua::Precache()
|
|||
PRECACHE_SOUND( GARG_STOMP_BUZZ_SOUND );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
|
||||
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pBeamAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pBeamAttackSounds[i] );
|
||||
PRECACHE_SOUND( pBeamAttackSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
|
||||
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pRicSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pRicSounds[i] );
|
||||
PRECACHE_SOUND( pRicSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pFootSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pFootSounds[i] );
|
||||
PRECACHE_SOUND( pFootSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pIdleSounds[i] );
|
||||
PRECACHE_SOUND( pIdleSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAlertSounds[i]);
|
||||
PRECACHE_SOUND( pAlertSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pPainSounds[i] );
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackSounds[i] );
|
||||
PRECACHE_SOUND( pAttackSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pStompSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pStompSounds[i] );
|
||||
PRECACHE_SOUND( pStompSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pBreatheSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pBreatheSounds[i] );
|
||||
PRECACHE_SOUND( pBreatheSounds[i] );
|
||||
}
|
||||
|
||||
void CGargantua::UpdateOnRemove()
|
||||
{
|
||||
CBaseEntity::UpdateOnRemove();
|
||||
|
||||
if( m_pEyeGlow )
|
||||
{
|
||||
UTIL_Remove( m_pEyeGlow );
|
||||
m_pEyeGlow = 0;
|
||||
}
|
||||
|
||||
FlameDestroy();
|
||||
}
|
||||
|
||||
void CGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
|
||||
{
|
||||
ALERT( at_aiconsole, "CGargantua::TraceAttack\n" );
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "soundent.h"
|
||||
#include "shake.h"
|
||||
#include "gamerules.h"
|
||||
#include "game.h"
|
||||
|
||||
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
|
||||
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
|
||||
|
@ -123,6 +124,12 @@ int CGauss::GetItemInfo( ItemInfo *p )
|
|||
return 1;
|
||||
}
|
||||
|
||||
BOOL CGauss::IsUseable()
|
||||
{
|
||||
// Currently charging, allow the player to fire it first. - Solokiller
|
||||
return CBasePlayerWeapon::IsUseable() || m_fInAttack != 0;
|
||||
}
|
||||
|
||||
BOOL CGauss::Deploy()
|
||||
{
|
||||
m_pPlayer->m_flPlayAftershock = 0.0;
|
||||
|
@ -145,7 +152,7 @@ void CGauss::PrimaryAttack()
|
|||
if( m_pPlayer->pev->waterlevel == 3 )
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15;
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.15 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -183,7 +190,7 @@ void CGauss::SecondaryAttack()
|
|||
PlayEmptySound();
|
||||
}
|
||||
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -224,6 +231,22 @@ void CGauss::SecondaryAttack()
|
|||
}
|
||||
else
|
||||
{
|
||||
// Moved to before the ammo burn.
|
||||
// Because we drained 1 when m_InAttack == 0, then 1 again now before checking if we're out of ammo,
|
||||
// this resuled in the player having -1 ammo, which in turn caused CanDeploy to think it could be deployed.
|
||||
// This will need to be fixed further down the line by preventing negative ammo unless explicitly required (infinite ammo?),
|
||||
// But this check will prevent the problem for now. - Solokiller
|
||||
// TODO: investigate further.
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
{
|
||||
// out of ammo! force the gun to fire
|
||||
StartFire();
|
||||
m_fInAttack = 0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// during the charging process, eat one bit of ammo every once in a while
|
||||
if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000 )
|
||||
{
|
||||
|
@ -243,23 +266,13 @@ void CGauss::SecondaryAttack()
|
|||
}
|
||||
}
|
||||
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
{
|
||||
// out of ammo! force the gun to fire
|
||||
StartFire();
|
||||
m_fInAttack = 0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge )
|
||||
{
|
||||
// don't eat any more ammo after gun is fully charged.
|
||||
m_pPlayer->m_flNextAmmoBurn = 1000;
|
||||
}
|
||||
|
||||
int pitch = ( gpGlobals->time - m_pPlayer->m_flStartCharge ) * ( 150 / GetFullChargeTime() ) + 100;
|
||||
int pitch = (int)( ( gpGlobals->time - m_pPlayer->m_flStartCharge ) * ( 150 / GetFullChargeTime() ) + 100 );
|
||||
if( pitch > 250 )
|
||||
pitch = 250;
|
||||
|
||||
|
@ -359,11 +372,11 @@ void CGauss::StartFire( void )
|
|||
void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
||||
{
|
||||
m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
|
||||
|
||||
TraceResult tr, beam_tr;
|
||||
#ifndef CLIENT_DLL
|
||||
Vector vecSrc = vecOrigSrc;
|
||||
Vector vecDest = vecSrc + vecDir * 8192;
|
||||
edict_t *pentIgnore;
|
||||
TraceResult tr, beam_tr;
|
||||
float flMaxFrac = 1.0;
|
||||
int nTotal = 0;
|
||||
int fHasPunched = 0;
|
||||
|
@ -371,8 +384,7 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
int nMaxHits = 10;
|
||||
|
||||
pentIgnore = ENT( m_pPlayer->pev );
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
#else
|
||||
if( m_fPrimaryFire == false )
|
||||
g_irunninggausspred = true;
|
||||
#endif
|
||||
|
@ -501,6 +513,10 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
|
||||
vecSrc = beam_tr.vecEndPos + vecDir;
|
||||
}
|
||||
else if( !selfgauss.value )
|
||||
{
|
||||
flDamage = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -559,6 +575,10 @@ void CGauss::WeaponIdle( void )
|
|||
StartFire();
|
||||
m_fInAttack = 0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
|
||||
|
||||
// Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -88,7 +88,7 @@ void CGenericMonster::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
//=========================================================
|
||||
int CGenericMonster::ISoundMask( void )
|
||||
{
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -131,7 +131,7 @@ void CGenericMonster::Spawn()
|
|||
//=========================================================
|
||||
void CGenericMonster::Precache()
|
||||
{
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
|
|
@ -49,7 +49,7 @@ void CGrenade::Explode( Vector vecSrc, Vector vecAim )
|
|||
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution.
|
||||
void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
|
||||
{
|
||||
float flRndSound;// sound randomizer
|
||||
// float flRndSound;// sound randomizer
|
||||
|
||||
pev->model = iStringNull;//invisible
|
||||
pev->solid = SOLID_NOT;// intangible
|
||||
|
@ -102,7 +102,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
|
|||
UTIL_DecalTrace( pTrace, DECAL_SCORCH2 );
|
||||
}
|
||||
|
||||
flRndSound = RANDOM_FLOAT( 0, 1 );
|
||||
//flRndSound = RANDOM_FLOAT( 0, 1 );
|
||||
|
||||
switch( RANDOM_LONG( 0, 2 ) )
|
||||
{
|
||||
|
@ -144,8 +144,8 @@ void CGrenade::Smoke( void )
|
|||
WRITE_COORD( pev->origin.y );
|
||||
WRITE_COORD( pev->origin.z );
|
||||
WRITE_SHORT( g_sModelIndexSmoke );
|
||||
WRITE_BYTE( ( pev->dmg - 50 ) * 0.80 ); // scale * 10
|
||||
WRITE_BYTE( 12 ); // framerate
|
||||
WRITE_BYTE( (int)( ( pev->dmg - 50 ) * 0.80 ) ); // scale * 10
|
||||
WRITE_BYTE( 12 ); // framerate
|
||||
MESSAGE_END();
|
||||
}
|
||||
UTIL_Remove( this );
|
||||
|
@ -165,7 +165,7 @@ void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
|
|||
|
||||
void CGrenade::PreDetonate( void )
|
||||
{
|
||||
CSoundEnt::InsertSound ( bits_SOUND_DANGER, pev->origin, 400, 0.3 );
|
||||
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, 400, 0.3 );
|
||||
|
||||
SetThink( &CGrenade::Detonate );
|
||||
pev->nextthink = gpGlobals->time + 1;
|
||||
|
@ -207,7 +207,7 @@ void CGrenade::DangerSoundThink( void )
|
|||
return;
|
||||
}
|
||||
|
||||
CSoundEnt::InsertSound ( bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5, pev->velocity.Length(), 0.2 );
|
||||
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5, (int)pev->velocity.Length(), 0.2 );
|
||||
pev->nextthink = gpGlobals->time + 0.2;
|
||||
|
||||
if( pev->waterlevel != 0 )
|
||||
|
@ -253,7 +253,7 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
|
|||
// go ahead and emit the danger sound.
|
||||
|
||||
// register a radius louder than the explosion, so we make sure everyone gets out of the way
|
||||
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, pev->dmg / 0.4, 0.3 );
|
||||
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, (int)( pev->dmg / 0.4 ), 0.3 );
|
||||
m_fRegisteredSound = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,18 @@ int CGlock::GetItemInfo( ItemInfo *p )
|
|||
return 1;
|
||||
}
|
||||
|
||||
int CGlock::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CGlock::Deploy()
|
||||
{
|
||||
// pev->body = 1;
|
||||
|
@ -109,7 +121,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
|
|||
if( m_fFireOnEmpty )
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.2 );
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -158,7 +170,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
|
|||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 );
|
||||
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime;
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay( flCycleTime );
|
||||
|
||||
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
// HEV suit - indicate out of ammo condition
|
||||
|
@ -169,15 +181,15 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
|
|||
|
||||
void CGlock::Reload( void )
|
||||
{
|
||||
if( m_pPlayer->ammo_9mm <= 0 )
|
||||
return;
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == GLOCK_MAX_CLIP )
|
||||
return;
|
||||
|
||||
int iResult;
|
||||
|
||||
if( m_iClip == 0 )
|
||||
iResult = DefaultReload( 17, GLOCK_RELOAD, 1.5 );
|
||||
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5 );
|
||||
else
|
||||
iResult = DefaultReload( 17, GLOCK_RELOAD_NOT_EMPTY, 1.5 );
|
||||
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5 );
|
||||
|
||||
if( iResult )
|
||||
{
|
||||
|
|
|
@ -109,7 +109,7 @@ void CGMan::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
//=========================================================
|
||||
int CGMan::ISoundMask( void )
|
||||
{
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -149,7 +149,7 @@ void CGMan::StartTask( Task_t *pTask )
|
|||
switch( pTask->iTask )
|
||||
{
|
||||
case TASK_WAIT:
|
||||
if( m_hPlayer == NULL )
|
||||
if( m_hPlayer == 0 )
|
||||
{
|
||||
m_hPlayer = UTIL_FindEntityByClassname( NULL, "player" );
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ void CGMan::RunTask( Task_t *pTask )
|
|||
{
|
||||
case TASK_WAIT:
|
||||
// look at who I'm talking to
|
||||
if( m_flTalkTime > gpGlobals->time && m_hTalkTarget != NULL )
|
||||
if( m_flTalkTime > gpGlobals->time && m_hTalkTarget != 0 )
|
||||
{
|
||||
float yaw = VecToYaw( m_hTalkTarget->pev->origin - pev->origin ) - pev->angles.y;
|
||||
|
||||
|
@ -177,7 +177,7 @@ void CGMan::RunTask( Task_t *pTask )
|
|||
SetBoneController( 0, yaw );
|
||||
}
|
||||
// look at player, but only if playing a "safe" idle animation
|
||||
else if( m_hPlayer != NULL && pev->sequence == 0 )
|
||||
else if( m_hPlayer != 0 && pev->sequence == 0 )
|
||||
{
|
||||
float yaw = VecToYaw( m_hPlayer->pev->origin - pev->origin ) - pev->angles.y;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ void CRecharge::Spawn()
|
|||
UTIL_SetOrigin( pev, pev->origin ); // set size and link into world
|
||||
UTIL_SetSize( pev, pev->mins, pev->maxs );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
m_iJuice = gSkillData.suitchargerCapacity;
|
||||
m_iJuice = (int)gSkillData.suitchargerCapacity;
|
||||
pev->frame = 0;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
|
|||
|
||||
void CRecharge::Recharge( void )
|
||||
{
|
||||
m_iJuice = gSkillData.suitchargerCapacity;
|
||||
m_iJuice = (int)gSkillData.suitchargerCapacity;
|
||||
pev->frame = 0;
|
||||
SetThink( &CBaseEntity::SUB_DoNothing );
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void CRecharge::Off( void )
|
|||
|
||||
m_iOn = 0;
|
||||
|
||||
if( ( !m_iJuice ) && ( ( m_iReactivate = g_pGameRules->FlHEVChargerRechargeTime() ) > 0 ) )
|
||||
if( ( !m_iJuice ) && ( ( m_iReactivate = (int)g_pGameRules->FlHEVChargerRechargeTime() ) > 0 ) )
|
||||
{
|
||||
pev->nextthink = pev->ltime + m_iReactivate;
|
||||
SetThink( &CRecharge::Recharge );
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
class CLegacyCineMonster : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void CineSpawn( char *szModel );
|
||||
void CineSpawn( const char *szModel );
|
||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||
void EXPORT CineThink( void );
|
||||
void Pain( void );
|
||||
|
@ -103,7 +103,7 @@ LINK_ENTITY_TO_CLASS( monster_cine3_barney, CCine3Barney )
|
|||
// ********** Scientist SPAWN **********
|
||||
//
|
||||
|
||||
void CLegacyCineMonster :: CineSpawn( char *szModel )
|
||||
void CLegacyCineMonster :: CineSpawn( const char *szModel )
|
||||
{
|
||||
PRECACHE_MODEL(szModel);
|
||||
SET_MODEL(ENT(pev), szModel);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
class CCycler : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax);
|
||||
void GenericCyclerSpawn( const char *szModel, Vector vecMin, Vector vecMax );
|
||||
virtual int ObjectCaps( void ) { return ( CBaseEntity::ObjectCaps() | FCAP_IMPULSE_USE ); }
|
||||
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
|
||||
void Spawn( void );
|
||||
|
@ -67,7 +67,7 @@ class CGenericCycler : public CCycler
|
|||
public:
|
||||
void Spawn( void )
|
||||
{
|
||||
GenericCyclerSpawn( (char *)STRING( pev->model ), Vector( -16, -16, 0 ), Vector( 16, 16, 72 ) );
|
||||
GenericCyclerSpawn( STRING( pev->model ), Vector( -16, -16, 0 ), Vector( 16, 16, 72 ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,7 @@ void CCyclerProbe::Spawn( void )
|
|||
}
|
||||
|
||||
// Cycler member functions
|
||||
void CCycler::GenericCyclerSpawn( char *szModel, Vector vecMin, Vector vecMax )
|
||||
void CCycler::GenericCyclerSpawn( const char *szModel, Vector vecMin, Vector vecMax )
|
||||
{
|
||||
if( !szModel || !*szModel )
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ void CCyclerSprite::Spawn( void )
|
|||
m_animate = 1;
|
||||
m_lastTime = gpGlobals->time;
|
||||
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
|
||||
m_maxFrame = (float)MODEL_FRAMES( pev->modelindex ) - 1;
|
||||
|
@ -314,7 +314,7 @@ void CWeaponCycler::Spawn()
|
|||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
m_iszModel = pev->model;
|
||||
m_iModel = pev->modelindex;
|
||||
|
@ -401,18 +401,18 @@ void CWreckage::Spawn( void )
|
|||
|
||||
if( pev->model )
|
||||
{
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
}
|
||||
// pev->scale = 5.0;
|
||||
|
||||
m_flStartTime = gpGlobals->time;
|
||||
m_flStartTime = (int)gpGlobals->time;
|
||||
}
|
||||
|
||||
void CWreckage::Precache()
|
||||
{
|
||||
if( pev->model )
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
}
|
||||
|
||||
void CWreckage::Think( void )
|
||||
|
|
|
@ -99,8 +99,13 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ )
|
|||
{
|
||||
// no more grenades!
|
||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_HANDGRENADE );
|
||||
SetThink( &CBasePlayerItem::DestroyItem );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
DestroyItem();
|
||||
}
|
||||
|
||||
if( m_flStartThrow )
|
||||
{
|
||||
m_flStartThrow = 0;
|
||||
m_flReleaseThrow = 0;
|
||||
}
|
||||
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
|
||||
|
@ -170,7 +175,7 @@ void CHandGrenade::WeaponIdle( void )
|
|||
|
||||
m_flReleaseThrow = 0;
|
||||
m_flStartThrow = 0;
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
|
@ -180,7 +185,7 @@ void CHandGrenade::WeaponIdle( void )
|
|||
// just threw last grenade
|
||||
// set attack times in the future, and weapon idle in the future so we can see the whole throw
|
||||
// animation, weapon idle will automatically retire the weapon for us.
|
||||
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;// ensure that the animation can finish playing
|
||||
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );// ensure that the animation can finish playing
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ void CHAssassin::SetYawSpeed( void )
|
|||
//=========================================================
|
||||
void CHAssassin::Shoot( void )
|
||||
{
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ IMPLEMENT_CUSTOM_SCHEDULES( CHAssassin, CBaseMonster )
|
|||
//=========================================================
|
||||
BOOL CHAssassin::CheckMeleeAttack1( float flDot, float flDist )
|
||||
{
|
||||
if( m_flNextJump < gpGlobals->time && ( flDist <= 128 || HasMemory( bits_MEMORY_BADJUMP ) ) && m_hEnemy != NULL )
|
||||
if( m_flNextJump < gpGlobals->time && ( flDist <= 128 || HasMemory( bits_MEMORY_BADJUMP ) ) && m_hEnemy != 0 )
|
||||
{
|
||||
TraceResult tr;
|
||||
|
||||
|
@ -687,7 +687,7 @@ void CHAssassin::RunAI( void )
|
|||
|
||||
// always visible if moving
|
||||
// always visible is not on hard
|
||||
if( g_iSkillLevel != SKILL_HARD || m_hEnemy == NULL || pev->deadflag != DEAD_NO || m_Activity == ACT_RUN || m_Activity == ACT_WALK || !( pev->flags & FL_ONGROUND ) )
|
||||
if( g_iSkillLevel != SKILL_HARD || m_hEnemy == 0 || pev->deadflag != DEAD_NO || m_Activity == ACT_RUN || m_Activity == ACT_WALK || !( pev->flags & FL_ONGROUND ) )
|
||||
m_iTargetRanderamt = 255;
|
||||
else
|
||||
m_iTargetRanderamt = 20;
|
||||
|
@ -699,12 +699,12 @@ void CHAssassin::RunAI( void )
|
|||
EMIT_SOUND( ENT( pev ), CHAN_BODY, "debris/beamstart1.wav", 0.2, ATTN_NORM );
|
||||
}
|
||||
|
||||
pev->renderamt = max( pev->renderamt - 50, m_iTargetRanderamt );
|
||||
pev->renderamt = Q_max( pev->renderamt - 50, m_iTargetRanderamt );
|
||||
pev->rendermode = kRenderTransTexture;
|
||||
}
|
||||
else if( pev->renderamt < m_iTargetRanderamt )
|
||||
{
|
||||
pev->renderamt = min( pev->renderamt + 50, m_iTargetRanderamt );
|
||||
pev->renderamt = Q_min( pev->renderamt + 50, m_iTargetRanderamt );
|
||||
if( pev->renderamt == 255 )
|
||||
pev->rendermode = kRenderNormal;
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ void CHeadCrab::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
UTIL_MakeVectors( pev->angles );
|
||||
|
||||
Vector vecJumpDir;
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
float gravity = g_psv_gravity->value;
|
||||
if( gravity <= 1 )
|
||||
|
@ -538,7 +538,7 @@ Schedule_t *CBabyCrab::GetScheduleOfType( int Type )
|
|||
switch( Type )
|
||||
{
|
||||
case SCHED_FAIL: // If you fail, try to jump!
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
return slHCRangeAttack1Fast;
|
||||
break;
|
||||
case SCHED_RANGE_ATTACK1:
|
||||
|
|
|
@ -159,7 +159,7 @@ void CWallHealth::Spawn()
|
|||
UTIL_SetOrigin( pev, pev->origin ); // set size and link into world
|
||||
UTIL_SetSize( pev, pev->mins, pev->maxs );
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
m_iJuice = gSkillData.healthchargerCapacity;
|
||||
m_iJuice = (int)gSkillData.healthchargerCapacity;
|
||||
pev->frame = 0;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
|
|||
void CWallHealth::Recharge( void )
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM );
|
||||
m_iJuice = gSkillData.healthchargerCapacity;
|
||||
m_iJuice = (int)gSkillData.healthchargerCapacity;
|
||||
pev->frame = 0;
|
||||
SetThink( &CBaseEntity::SUB_DoNothing );
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ void CWallHealth::Off( void )
|
|||
|
||||
m_iOn = 0;
|
||||
|
||||
if( ( !m_iJuice ) && ( ( m_iReactivate = g_pGameRules->FlHealthChargerRechargeTime() ) > 0 ) )
|
||||
if( ( !m_iJuice ) && ( ( m_iReactivate = (int)g_pGameRules->FlHealthChargerRechargeTime() ) > 0 ) )
|
||||
{
|
||||
pev->nextthink = pev->ltime + m_iReactivate;
|
||||
SetThink( &CWallHealth::Recharge );
|
||||
|
|
|
@ -217,7 +217,7 @@ const char *CHGrunt::pGruntSentences[] =
|
|||
"HG_TAUNT", // say rude things
|
||||
};
|
||||
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
HGRUNT_SENT_NONE = -1,
|
||||
HGRUNT_SENT_GREN = 0,
|
||||
|
@ -366,7 +366,7 @@ void CHGrunt::JustSpoke( void )
|
|||
//=========================================================
|
||||
void CHGrunt::PrescheduleThink( void )
|
||||
{
|
||||
if( InSquad() && m_hEnemy != NULL )
|
||||
if( InSquad() && m_hEnemy != 0 )
|
||||
{
|
||||
if( HasConditions( bits_COND_SEE_ENEMY ) )
|
||||
{
|
||||
|
@ -413,9 +413,9 @@ BOOL CHGrunt::FCanCheckAttacks( void )
|
|||
//=========================================================
|
||||
BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist )
|
||||
{
|
||||
CBaseMonster *pEnemy;
|
||||
CBaseMonster *pEnemy = 0;
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
pEnemy = m_hEnemy->MyMonsterPointer();
|
||||
|
||||
|
@ -787,7 +787,7 @@ Vector CHGrunt::GetGunPosition()
|
|||
//=========================================================
|
||||
void CHGrunt::Shoot( void )
|
||||
{
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ void CHGrunt::Shoot( void )
|
|||
//=========================================================
|
||||
void CHGrunt::Shotgun( void )
|
||||
{
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1834,7 +1834,7 @@ IMPLEMENT_CUSTOM_SCHEDULES( CHGrunt, CSquadMonster )
|
|||
void CHGrunt::SetActivity( Activity NewActivity )
|
||||
{
|
||||
int iSequence = ACTIVITY_NOT_AVAILABLE;
|
||||
void *pmodel = GET_MODEL_PTR( ENT( pev ) );
|
||||
//void *pmodel = GET_MODEL_PTR( ENT( pev ) );
|
||||
|
||||
switch( NewActivity )
|
||||
{
|
||||
|
@ -2032,10 +2032,10 @@ Schedule_t *CHGrunt::GetSchedule( void )
|
|||
// before he starts pluggin away.
|
||||
if( FOkToSpeak() )// && RANDOM_LONG( 0, 1 ) )
|
||||
{
|
||||
if( ( m_hEnemy != NULL ) && m_hEnemy->IsPlayer() )
|
||||
if( ( m_hEnemy != 0 ) && m_hEnemy->IsPlayer() )
|
||||
// player
|
||||
SENTENCEG_PlayRndSz( ENT( pev ), "HG_ALERT", HGRUNT_SENTENCE_VOLUME, GRUNT_ATTN, 0, m_voicePitch );
|
||||
else if( ( m_hEnemy != NULL ) &&
|
||||
else if( ( m_hEnemy != 0 ) &&
|
||||
( m_hEnemy->Classify() != CLASS_PLAYER_ALLY ) &&
|
||||
( m_hEnemy->Classify() != CLASS_HUMAN_PASSIVE ) &&
|
||||
( m_hEnemy->Classify() != CLASS_MACHINE ) )
|
||||
|
@ -2072,7 +2072,7 @@ Schedule_t *CHGrunt::GetSchedule( void )
|
|||
// 10% chance of flinch.
|
||||
int iPercent = RANDOM_LONG( 0, 99 );
|
||||
|
||||
if( iPercent <= 90 && m_hEnemy != NULL )
|
||||
if( iPercent <= 90 && m_hEnemy != 0 )
|
||||
{
|
||||
// only try to take cover if we actually have an enemy!
|
||||
|
||||
|
@ -2308,7 +2308,7 @@ Schedule_t *CHGrunt::GetScheduleOfType( int Type )
|
|||
}
|
||||
case SCHED_FAIL:
|
||||
{
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
// grunt has an enemy, so pick a different default fail schedule most likely to help recover.
|
||||
return &slGruntCombatFail[0];
|
||||
|
@ -2408,10 +2408,10 @@ public:
|
|||
void KeyValue( KeyValueData *pkvd );
|
||||
|
||||
int m_iPose;// which sequence to display -- temporary, don't need to save
|
||||
static char *m_szPoses[3];
|
||||
static const char *m_szPoses[3];
|
||||
};
|
||||
|
||||
char *CDeadHGrunt::m_szPoses[] = { "deadstomach", "deadside", "deadsitting" };
|
||||
const char *CDeadHGrunt::m_szPoses[] = { "deadstomach", "deadside", "deadsitting" };
|
||||
|
||||
void CDeadHGrunt::KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
|
|
|
@ -258,14 +258,14 @@ void CHornet::TrackTarget( void )
|
|||
}
|
||||
|
||||
// UNDONE: The player pointer should come back after returning from another level
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
// enemy is dead.
|
||||
Look( 512 );
|
||||
m_hEnemy = BestVisibleEnemy();
|
||||
}
|
||||
|
||||
if( m_hEnemy != NULL && FVisible( m_hEnemy ) )
|
||||
if( m_hEnemy != 0 && FVisible( m_hEnemy ) )
|
||||
{
|
||||
m_vecEnemyLKP = m_hEnemy->BodyTarget( pev->origin );
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void CHornet::TrackTarget( void )
|
|||
|
||||
// if hornet is close to the enemy, jet in a straight line for a half second.
|
||||
// (only in the single player game)
|
||||
if( m_hEnemy != NULL && !g_pGameRules->IsMultiplayer() )
|
||||
if( m_hEnemy != 0 && !g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
if( flDelta >= 0.4 && ( pev->origin - m_vecEnemyLKP ).Length() <= 300 )
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ void CHornet::DartTouch( CBaseEntity *pOther )
|
|||
|
||||
void CHornet::DieTouch( CBaseEntity *pOther )
|
||||
{
|
||||
if( pOther && pOther->pev->takedamage )
|
||||
if( pOther && pOther->pev->takedamage && pev->owner )
|
||||
{
|
||||
// do the damage
|
||||
switch( RANDOM_LONG( 0, 2 ) )
|
||||
|
|
|
@ -137,7 +137,7 @@ int CHoundeye::Classify( void )
|
|||
//=========================================================
|
||||
BOOL CHoundeye::FValidateHintType( short sHint )
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
static short sHoundHints[] =
|
||||
{
|
||||
|
|
|
@ -416,7 +416,7 @@ void CIchthyosaur::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
case ICHTHYOSAUR_AE_SHAKE_RIGHT:
|
||||
case ICHTHYOSAUR_AE_SHAKE_LEFT:
|
||||
{
|
||||
if( m_hEnemy != NULL && FVisible( m_hEnemy ) )
|
||||
if( m_hEnemy != 0 && FVisible( m_hEnemy ) )
|
||||
{
|
||||
CBaseEntity *pHurt = m_hEnemy;
|
||||
|
||||
|
@ -622,7 +622,7 @@ void CIchthyosaur::RunTask( Task_t *pTask )
|
|||
switch( pTask->iTask )
|
||||
{
|
||||
case TASK_ICHTHYOSAUR_CIRCLE_ENEMY:
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
TaskComplete();
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ void CIchthyosaur::Stop( void )
|
|||
|
||||
void CIchthyosaur::Swim()
|
||||
{
|
||||
int retValue = 0;
|
||||
//int retValue = 0;
|
||||
|
||||
Vector start = pev->origin;
|
||||
|
||||
|
@ -1072,7 +1072,7 @@ Vector CIchthyosaur::DoProbe( const Vector &Probe )
|
|||
}
|
||||
}
|
||||
|
||||
if( bBumpedSomething && ( m_hEnemy == NULL || tr.pHit != m_hEnemy->edict() ) )
|
||||
if( bBumpedSomething && ( m_hEnemy == 0 || tr.pHit != m_hEnemy->edict() ) )
|
||||
{
|
||||
Vector ProbeDir = Probe - pev->origin;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class CISlave : public CSquadMonster
|
|||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void UpdateOnRemove();
|
||||
void SetYawSpeed( void );
|
||||
int ISoundMask( void );
|
||||
int Classify( void );
|
||||
|
@ -51,7 +52,7 @@ public:
|
|||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
BOOL CheckRangeAttack1( float flDot, float flDist );
|
||||
BOOL CheckRangeAttack2( float flDot, float flDist );
|
||||
void CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation );
|
||||
void CallForHelp( const char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation );
|
||||
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType );
|
||||
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
|
||||
|
||||
|
@ -155,7 +156,7 @@ int CISlave::IRelationship( CBaseEntity *pTarget )
|
|||
return CBaseMonster::IRelationship( pTarget );
|
||||
}
|
||||
|
||||
void CISlave::CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation )
|
||||
void CISlave::CallForHelp( const char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation )
|
||||
{
|
||||
// ALERT( at_aiconsole, "help " );
|
||||
|
||||
|
@ -185,7 +186,7 @@ void CISlave::CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vect
|
|||
//=========================================================
|
||||
void CISlave::AlertSound( void )
|
||||
{
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
SENTENCEG_PlayRndSz( ENT( pev ), "SLV_ALERT", 0.85, ATTN_NORM, 0, m_voicePitch );
|
||||
|
||||
|
@ -365,7 +366,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
WRITE_BYTE( 0 ); // decay * 0.1
|
||||
MESSAGE_END();
|
||||
}
|
||||
if( m_hDead != NULL )
|
||||
if( m_hDead != 0 )
|
||||
{
|
||||
WackBeam( -1, m_hDead );
|
||||
WackBeam( 1, m_hDead );
|
||||
|
@ -385,7 +386,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
{
|
||||
ClearBeams();
|
||||
|
||||
if( m_hDead != NULL )
|
||||
if( m_hDead != 0 )
|
||||
{
|
||||
Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 );
|
||||
TraceResult trace;
|
||||
|
@ -394,7 +395,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
if( !trace.fStartSolid )
|
||||
{
|
||||
CBaseEntity *pNew = Create( "monster_alien_slave", m_hDead->pev->origin, m_hDead->pev->angles );
|
||||
CBaseMonster *pNewMonster = pNew->MyMonsterPointer( );
|
||||
//CBaseMonster *pNewMonster = pNew->MyMonsterPointer();
|
||||
pNew->pev->spawnflags |= 1;
|
||||
WackBeam( -1, pNew );
|
||||
WackBeam( 1, pNew );
|
||||
|
@ -484,7 +485,7 @@ BOOL CISlave::CheckRangeAttack2( float flDot, float flDist )
|
|||
}
|
||||
}
|
||||
}
|
||||
if( m_hDead != NULL )
|
||||
if( m_hDead != 0 )
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -530,7 +531,7 @@ void CISlave::Spawn()
|
|||
//=========================================================
|
||||
void CISlave::Precache()
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
PRECACHE_MODEL( "models/islave.mdl" );
|
||||
PRECACHE_MODEL( "sprites/lgtning.spr" );
|
||||
|
@ -543,20 +544,27 @@ void CISlave::Precache()
|
|||
PRECACHE_SOUND( "weapons/cbar_miss1.wav" );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
|
||||
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
|
||||
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pPainSounds[i] );
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pDeathSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pDeathSounds[i] );
|
||||
PRECACHE_SOUND( pDeathSounds[i] );
|
||||
|
||||
UTIL_PrecacheOther( "test_effect" );
|
||||
}
|
||||
|
||||
void CISlave::UpdateOnRemove()
|
||||
{
|
||||
CBaseEntity::UpdateOnRemove();
|
||||
|
||||
ClearBeams();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// TakeDamage - get provoked when injured
|
||||
//=========================================================
|
||||
|
@ -756,8 +764,8 @@ void CISlave::BeamGlow()
|
|||
//=========================================================
|
||||
void CISlave::WackBeam( int side, CBaseEntity *pEntity )
|
||||
{
|
||||
Vector vecDest;
|
||||
float flDist = 1.0;
|
||||
//Vector vecDest;
|
||||
//float flDist = 1.0;
|
||||
|
||||
if( m_iBeams >= ISLAVE_MAX_BEAMS )
|
||||
return;
|
||||
|
|
|
@ -166,6 +166,7 @@ void CItem::Materialize( void )
|
|||
}
|
||||
|
||||
SetTouch( &CItem::ItemTouch );
|
||||
SetThink( NULL );
|
||||
}
|
||||
|
||||
#define SF_SUIT_SHORTLOGON 0x0001
|
||||
|
@ -226,7 +227,7 @@ class CItemBattery : public CItem
|
|||
char szcharge[64];
|
||||
|
||||
pPlayer->pev->armorvalue += gSkillData.batteryCapacity;
|
||||
pPlayer->pev->armorvalue = min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY );
|
||||
pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY );
|
||||
|
||||
EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM );
|
||||
|
||||
|
|
|
@ -271,15 +271,15 @@ void CLeech::AlertSound( void )
|
|||
|
||||
void CLeech::Precache( void )
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
//PRECACHE_MODEL( "models/icky.mdl" );
|
||||
PRECACHE_MODEL( "models/leech.mdl" );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackSounds[i] );
|
||||
PRECACHE_SOUND( pAttackSounds[i] );
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAlertSounds[i] );
|
||||
PRECACHE_SOUND( pAlertSounds[i] );
|
||||
}
|
||||
|
||||
int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
||||
|
|
|
@ -99,7 +99,7 @@ void CLight::Spawn( void )
|
|||
if( FBitSet( pev->spawnflags, SF_LIGHT_START_OFF ) )
|
||||
LIGHT_STYLE( m_iStyle, "a" );
|
||||
else if( m_iszPattern )
|
||||
LIGHT_STYLE( m_iStyle, (char *)STRING( m_iszPattern ) );
|
||||
LIGHT_STYLE( m_iStyle, STRING( m_iszPattern ) );
|
||||
else
|
||||
LIGHT_STYLE( m_iStyle, "m" );
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void CLight::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp
|
|||
if( FBitSet( pev->spawnflags, SF_LIGHT_START_OFF ) )
|
||||
{
|
||||
if( m_iszPattern )
|
||||
LIGHT_STYLE( m_iStyle, (char *)STRING( m_iszPattern ) );
|
||||
LIGHT_STYLE( m_iStyle, STRING( m_iszPattern ) );
|
||||
else
|
||||
LIGHT_STYLE( m_iStyle, "m" );
|
||||
ClearBits( pev->spawnflags, SF_LIGHT_START_OFF );
|
||||
|
@ -155,15 +155,16 @@ void CEnvLight::KeyValue( KeyValueData* pkvd )
|
|||
}
|
||||
else if( j == 4 )
|
||||
{
|
||||
r = r * ( v / 255.0 );
|
||||
g = g * ( v / 255.0 );
|
||||
b = b * ( v / 255.0 );
|
||||
v /= 255;
|
||||
r *= v;
|
||||
g *= v;
|
||||
b *= v;
|
||||
}
|
||||
|
||||
// simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling
|
||||
r = pow( r / 114.0, 0.6 ) * 264;
|
||||
g = pow( g / 114.0, 0.6 ) * 264;
|
||||
b = pow( b / 114.0, 0.6 ) * 264;
|
||||
r = (int)( pow( r / 114.0, 0.6 ) * 264.0 );
|
||||
g = (int)( pow( g / 114.0, 0.6 ) * 264.0 );
|
||||
b = (int)( pow( b / 114.0, 0.6 ) * 264.0 );
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
sprintf( szColor, "%d", r );
|
||||
|
|
|
@ -64,9 +64,9 @@ void CRuleEntity::Spawn( void )
|
|||
|
||||
void CRuleEntity::KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "master"))
|
||||
if( FStrEq(pkvd->szKeyName, "master" ) )
|
||||
{
|
||||
SetMaster( ALLOC_STRING(pkvd->szValue) );
|
||||
SetMaster( ALLOC_STRING( pkvd->szValue ) );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -75,9 +75,9 @@ void CRuleEntity::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
BOOL CRuleEntity::CanFireForActivator( CBaseEntity *pActivator )
|
||||
{
|
||||
if ( m_iszMaster )
|
||||
if( m_iszMaster )
|
||||
{
|
||||
if ( UTIL_IsMasterTriggered( m_iszMaster, pActivator ) )
|
||||
if( UTIL_IsMasterTriggered( m_iszMaster, pActivator ) )
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -135,7 +135,7 @@ public:
|
|||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||
void KeyValue( KeyValueData *pkvd );
|
||||
|
||||
inline int Points( void ) { return pev->frags; }
|
||||
inline int Points( void ) { return (int)pev->frags; }
|
||||
inline BOOL AllowNegativeScore( void ) { return pev->spawnflags & SF_SCORE_NEGATIVE; }
|
||||
inline BOOL AwardToTeam( void ) { return pev->spawnflags & SF_SCORE_TEAM; }
|
||||
|
||||
|
@ -153,9 +153,9 @@ void CGameScore::Spawn( void )
|
|||
|
||||
void CGameScore::KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "points"))
|
||||
if( FStrEq( pkvd->szKeyName, "points" ) )
|
||||
{
|
||||
SetPoints( atoi(pkvd->szValue) );
|
||||
SetPoints( atoi( pkvd->szValue ) );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -164,13 +164,13 @@ void CGameScore::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CGameScore::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
// Only players can use this
|
||||
if ( pActivator->IsPlayer() )
|
||||
if( pActivator->IsPlayer() )
|
||||
{
|
||||
if ( AwardToTeam() )
|
||||
if( AwardToTeam() )
|
||||
{
|
||||
pActivator->AddPointsToTeam( Points(), AllowNegativeScore() );
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ LINK_ENTITY_TO_CLASS( game_end, CGameEnd )
|
|||
|
||||
void CGameEnd::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
g_pGameRules->EndMultiplayerGame();
|
||||
|
@ -239,27 +239,27 @@ IMPLEMENT_SAVERESTORE( CGameText, CRulePointEntity )
|
|||
|
||||
void CGameText::KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "channel"))
|
||||
if( FStrEq( pkvd->szKeyName, "channel" ) )
|
||||
{
|
||||
m_textParms.channel = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "x"))
|
||||
else if( FStrEq( pkvd->szKeyName, "x" ) )
|
||||
{
|
||||
m_textParms.x = atof( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "y"))
|
||||
else if( FStrEq(pkvd->szKeyName, "y" ) )
|
||||
{
|
||||
m_textParms.y = atof( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "effect"))
|
||||
else if( FStrEq( pkvd->szKeyName, "effect" ) )
|
||||
{
|
||||
m_textParms.effect = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "color"))
|
||||
else if( FStrEq( pkvd->szKeyName, "color" ) )
|
||||
{
|
||||
int color[4];
|
||||
UTIL_StringToIntArray( color, 4, pkvd->szValue );
|
||||
|
@ -269,7 +269,7 @@ void CGameText::KeyValue( KeyValueData *pkvd )
|
|||
m_textParms.a1 = color[3];
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "color2"))
|
||||
else if( FStrEq( pkvd->szKeyName, "color2" ) )
|
||||
{
|
||||
int color[4];
|
||||
UTIL_StringToIntArray( color, 4, pkvd->szValue );
|
||||
|
@ -279,22 +279,22 @@ void CGameText::KeyValue( KeyValueData *pkvd )
|
|||
m_textParms.a2 = color[3];
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "fadein"))
|
||||
else if( FStrEq( pkvd->szKeyName, "fadein" ) )
|
||||
{
|
||||
m_textParms.fadeinTime = atof( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "fadeout"))
|
||||
else if( FStrEq( pkvd->szKeyName, "fadeout" ) )
|
||||
{
|
||||
m_textParms.fadeoutTime = atof( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "holdtime"))
|
||||
else if( FStrEq( pkvd->szKeyName, "holdtime" ) )
|
||||
{
|
||||
m_textParms.holdTime = atof( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "fxtime"))
|
||||
else if( FStrEq(pkvd->szKeyName, "fxtime" ) )
|
||||
{
|
||||
m_textParms.fxTime = atof( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
|
@ -305,16 +305,16 @@ void CGameText::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CGameText::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
if ( MessageToAll() )
|
||||
if( MessageToAll() )
|
||||
{
|
||||
UTIL_HudMessageAll( m_textParms, MessageGet() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( pActivator->IsNetClient() )
|
||||
if( pActivator->IsNetClient() )
|
||||
{
|
||||
UTIL_HudMessage( pActivator, m_textParms, MessageGet() );
|
||||
}
|
||||
|
@ -356,12 +356,12 @@ LINK_ENTITY_TO_CLASS( game_team_master, CGameTeamMaster )
|
|||
|
||||
void CGameTeamMaster::KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "teamindex"))
|
||||
if( FStrEq( pkvd->szKeyName, "teamindex" ) )
|
||||
{
|
||||
m_teamIndex = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "triggerstate"))
|
||||
else if( FStrEq( pkvd->szKeyName, "triggerstate" ) )
|
||||
{
|
||||
int type = atoi( pkvd->szValue );
|
||||
switch( type )
|
||||
|
@ -384,12 +384,12 @@ void CGameTeamMaster::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
if ( useType == USE_SET )
|
||||
if( useType == USE_SET )
|
||||
{
|
||||
if ( value < 0 )
|
||||
if( value < 0 )
|
||||
{
|
||||
m_teamIndex = -1;
|
||||
}
|
||||
|
@ -400,10 +400,10 @@ void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
|||
return;
|
||||
}
|
||||
|
||||
if ( TeamMatch( pActivator ) )
|
||||
if( TeamMatch( pActivator ) )
|
||||
{
|
||||
SUB_UseTargets( pActivator, triggerType, value );
|
||||
if ( RemoveOnFire() )
|
||||
if( RemoveOnFire() )
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ BOOL CGameTeamMaster::IsTriggered( CBaseEntity *pActivator )
|
|||
|
||||
const char *CGameTeamMaster::TeamID( void )
|
||||
{
|
||||
if ( m_teamIndex < 0 ) // Currently set to "no team"
|
||||
if( m_teamIndex < 0 ) // Currently set to "no team"
|
||||
return "";
|
||||
|
||||
return g_pGameRules->GetIndexedTeamName( m_teamIndex ); // UNDONE: Fill this in with the team from the "teamlist"
|
||||
|
@ -423,10 +423,10 @@ const char *CGameTeamMaster::TeamID( void )
|
|||
|
||||
BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator )
|
||||
{
|
||||
if ( m_teamIndex < 0 && AnyTeam() )
|
||||
if( m_teamIndex < 0 && AnyTeam() )
|
||||
return TRUE;
|
||||
|
||||
if ( !pActivator )
|
||||
if( !pActivator )
|
||||
return FALSE;
|
||||
|
||||
return UTIL_TeamsMatch( pActivator->TeamID(), TeamID() );
|
||||
|
@ -443,7 +443,7 @@ BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator )
|
|||
class CGameTeamSet : public CRulePointEntity
|
||||
{
|
||||
public:
|
||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||
inline BOOL RemoveOnFire( void ) { return (pev->spawnflags & SF_TEAMSET_FIREONCE) ? TRUE : FALSE; }
|
||||
inline BOOL ShouldClearTeam( void ) { return (pev->spawnflags & SF_TEAMSET_CLEARTEAM) ? TRUE : FALSE; }
|
||||
|
||||
|
@ -454,10 +454,10 @@ LINK_ENTITY_TO_CLASS( game_team_set, CGameTeamSet )
|
|||
|
||||
void CGameTeamSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
if ( ShouldClearTeam() )
|
||||
if( ShouldClearTeam() )
|
||||
{
|
||||
SUB_UseTargets( pActivator, USE_SET, -1 );
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ void CGameTeamSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
|||
SUB_UseTargets( pActivator, USE_SET, 0 );
|
||||
}
|
||||
|
||||
if ( RemoveOnFire() )
|
||||
if( RemoveOnFire() )
|
||||
{
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
@ -506,22 +506,22 @@ IMPLEMENT_SAVERESTORE( CGamePlayerZone, CRuleBrushEntity )
|
|||
|
||||
void CGamePlayerZone::KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
if (FStrEq(pkvd->szKeyName, "intarget"))
|
||||
if( FStrEq(pkvd->szKeyName, "intarget" ) )
|
||||
{
|
||||
m_iszInTarget = ALLOC_STRING( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "outtarget"))
|
||||
else if( FStrEq( pkvd->szKeyName, "outtarget" ) )
|
||||
{
|
||||
m_iszOutTarget = ALLOC_STRING( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "incount"))
|
||||
else if( FStrEq( pkvd->szKeyName, "incount" ) )
|
||||
{
|
||||
m_iszInCount = ALLOC_STRING( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "outcount"))
|
||||
else if( FStrEq( pkvd->szKeyName, "outcount" ) )
|
||||
{
|
||||
m_iszOutCount = ALLOC_STRING( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
|
@ -535,12 +535,12 @@ void CGamePlayerZone::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
|||
int playersInCount = 0;
|
||||
int playersOutCount = 0;
|
||||
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
CBaseEntity *pPlayer = NULL;
|
||||
|
||||
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
for( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
pPlayer = UTIL_PlayerByIndex( i );
|
||||
if ( pPlayer )
|
||||
|
@ -549,40 +549,40 @@ void CGamePlayerZone::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
|||
int hullNumber;
|
||||
|
||||
hullNumber = human_hull;
|
||||
if ( pPlayer->pev->flags & FL_DUCKING )
|
||||
if( pPlayer->pev->flags & FL_DUCKING )
|
||||
{
|
||||
hullNumber = head_hull;
|
||||
}
|
||||
|
||||
UTIL_TraceModel( pPlayer->pev->origin, pPlayer->pev->origin, hullNumber, edict(), &trace );
|
||||
|
||||
if ( trace.fStartSolid )
|
||||
if( trace.fStartSolid )
|
||||
{
|
||||
playersInCount++;
|
||||
if ( m_iszInTarget )
|
||||
if( m_iszInTarget )
|
||||
{
|
||||
FireTargets( STRING(m_iszInTarget), pPlayer, pActivator, useType, value );
|
||||
FireTargets( STRING( m_iszInTarget ), pPlayer, pActivator, useType, value );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
playersOutCount++;
|
||||
if ( m_iszOutTarget )
|
||||
if( m_iszOutTarget )
|
||||
{
|
||||
FireTargets( STRING(m_iszOutTarget), pPlayer, pActivator, useType, value );
|
||||
FireTargets( STRING( m_iszOutTarget ), pPlayer, pActivator, useType, value );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_iszInCount )
|
||||
if( m_iszInCount )
|
||||
{
|
||||
FireTargets( STRING(m_iszInCount), pActivator, this, USE_SET, playersInCount );
|
||||
FireTargets( STRING( m_iszInCount ), pActivator, this, USE_SET, playersInCount );
|
||||
}
|
||||
|
||||
if ( m_iszOutCount )
|
||||
if( m_iszOutCount )
|
||||
{
|
||||
FireTargets( STRING(m_iszOutCount), pActivator, this, USE_SET, playersOutCount );
|
||||
FireTargets( STRING( m_iszOutCount ), pActivator, this, USE_SET, playersOutCount );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -605,12 +605,12 @@ LINK_ENTITY_TO_CLASS( game_player_hurt, CGamePlayerHurt )
|
|||
|
||||
void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
if ( pActivator->IsPlayer() )
|
||||
if( pActivator->IsPlayer() )
|
||||
{
|
||||
if ( pev->dmg < 0 )
|
||||
if( pev->dmg < 0 )
|
||||
pActivator->TakeHealth( -pev->dmg, DMG_GENERIC );
|
||||
else
|
||||
pActivator->TakeDamage( pev, pev, pev->dmg, DMG_GENERIC );
|
||||
|
@ -618,7 +618,7 @@ void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
|||
|
||||
SUB_UseTargets( pActivator, useType, value );
|
||||
|
||||
if ( RemoveOnFire() )
|
||||
if( RemoveOnFire() )
|
||||
{
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
@ -643,8 +643,8 @@ public:
|
|||
inline void CountUp( void ) { pev->frags++; }
|
||||
inline void CountDown( void ) { pev->frags--; }
|
||||
inline void ResetCount( void ) { pev->frags = pev->dmg; }
|
||||
inline int CountValue( void ) { return pev->frags; }
|
||||
inline int LimitValue( void ) { return pev->health; }
|
||||
inline int CountValue( void ) { return (int)pev->frags; }
|
||||
inline int LimitValue( void ) { return (int)pev->health; }
|
||||
|
||||
inline BOOL HitLimit( void ) { return CountValue() == LimitValue(); }
|
||||
|
||||
|
@ -665,7 +665,7 @@ void CGameCounter::Spawn( void )
|
|||
|
||||
void CGameCounter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
switch( useType )
|
||||
|
@ -681,16 +681,16 @@ void CGameCounter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
|||
SetCountValue( (int)value );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( HitLimit() )
|
||||
|
||||
if( HitLimit() )
|
||||
{
|
||||
SUB_UseTargets( pActivator, USE_TOGGLE, 0 );
|
||||
if ( RemoveOnFire() )
|
||||
if( RemoveOnFire() )
|
||||
{
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
||||
if ( ResetOnFire() )
|
||||
|
||||
if( ResetOnFire() )
|
||||
{
|
||||
ResetCount();
|
||||
}
|
||||
|
@ -716,12 +716,12 @@ LINK_ENTITY_TO_CLASS( game_counter_set, CGameCounterSet )
|
|||
|
||||
void CGameCounterSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
SUB_UseTargets( pActivator, USE_SET, pev->frags );
|
||||
|
||||
if ( RemoveOnFire() )
|
||||
if( RemoveOnFire() )
|
||||
{
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
@ -756,19 +756,19 @@ void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
|
|||
{
|
||||
CRulePointEntity::KeyValue( pkvd );
|
||||
|
||||
if ( !pkvd->fHandled )
|
||||
if( !pkvd->fHandled )
|
||||
{
|
||||
for ( int i = 0; i < MAX_EQUIP; i++ )
|
||||
for( int i = 0; i < MAX_EQUIP; i++ )
|
||||
{
|
||||
if ( !m_weaponNames[i] )
|
||||
if( !m_weaponNames[i] )
|
||||
{
|
||||
char tmp[128];
|
||||
|
||||
UTIL_StripToken( pkvd->szKeyName, tmp );
|
||||
|
||||
m_weaponNames[i] = ALLOC_STRING(tmp);
|
||||
m_weaponCount[i] = atoi(pkvd->szValue);
|
||||
m_weaponCount[i] = max(1,m_weaponCount[i]);
|
||||
m_weaponNames[i] = ALLOC_STRING( tmp );
|
||||
m_weaponCount[i] = atoi( pkvd->szValue );
|
||||
m_weaponCount[i] = Q_max( 1, m_weaponCount[i] );
|
||||
pkvd->fHandled = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -778,10 +778,10 @@ void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CGamePlayerEquip::Touch( CBaseEntity *pOther )
|
||||
{
|
||||
if ( !CanFireForActivator( pOther ) )
|
||||
if( !CanFireForActivator( pOther ) )
|
||||
return;
|
||||
|
||||
if ( UseOnly() )
|
||||
if( UseOnly() )
|
||||
return;
|
||||
|
||||
EquipPlayer( pOther );
|
||||
|
@ -791,21 +791,21 @@ void CGamePlayerEquip::EquipPlayer( CBaseEntity *pEntity )
|
|||
{
|
||||
CBasePlayer *pPlayer = NULL;
|
||||
|
||||
if ( pEntity->IsPlayer() )
|
||||
if( pEntity->IsPlayer() )
|
||||
{
|
||||
pPlayer = (CBasePlayer *)pEntity;
|
||||
}
|
||||
|
||||
if ( !pPlayer )
|
||||
if( !pPlayer )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < MAX_EQUIP; i++ )
|
||||
for( int i = 0; i < MAX_EQUIP; i++ )
|
||||
{
|
||||
if ( !m_weaponNames[i] )
|
||||
if( !m_weaponNames[i] )
|
||||
break;
|
||||
for ( int j = 0; j < m_weaponCount[i]; j++ )
|
||||
for( int j = 0; j < m_weaponCount[i]; j++ )
|
||||
{
|
||||
pPlayer->GiveNamedItem( STRING(m_weaponNames[i]) );
|
||||
pPlayer->GiveNamedItem( STRING( m_weaponNames[i] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -844,9 +844,9 @@ const char *CGamePlayerTeam::TargetTeamName( const char *pszTargetName )
|
|||
{
|
||||
CBaseEntity *pTeamEntity = NULL;
|
||||
|
||||
while ((pTeamEntity = UTIL_FindEntityByTargetname( pTeamEntity, pszTargetName )) != NULL)
|
||||
while( ( pTeamEntity = UTIL_FindEntityByTargetname( pTeamEntity, pszTargetName ) ) != NULL )
|
||||
{
|
||||
if ( FClassnameIs( pTeamEntity->pev, "game_team_master" ) )
|
||||
if( FClassnameIs( pTeamEntity->pev, "game_team_master" ) )
|
||||
return pTeamEntity->TeamID();
|
||||
}
|
||||
|
||||
|
@ -855,10 +855,10 @@ const char *CGamePlayerTeam::TargetTeamName( const char *pszTargetName )
|
|||
|
||||
void CGamePlayerTeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if ( !CanFireForActivator( pActivator ) )
|
||||
if( !CanFireForActivator( pActivator ) )
|
||||
return;
|
||||
|
||||
if ( pActivator->IsPlayer() )
|
||||
if( pActivator->IsPlayer() )
|
||||
{
|
||||
const char *pszTargetTeam = TargetTeamName( STRING(pev->target) );
|
||||
if ( pszTargetTeam )
|
||||
|
@ -868,7 +868,7 @@ void CGamePlayerTeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
|||
}
|
||||
}
|
||||
|
||||
if ( RemoveOnFire() )
|
||||
if( RemoveOnFire() )
|
||||
{
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ int CBaseMonster::Restore( CRestore &restore )
|
|||
m_Activity = ACT_RESET;
|
||||
|
||||
// If we don't have an enemy, clear conditions like see enemy, etc.
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
m_afConditions = 0;
|
||||
|
||||
return status;
|
||||
|
@ -334,12 +334,10 @@ void CBaseMonster::Look( int iDistance )
|
|||
{
|
||||
if( pev->spawnflags & SF_MONSTER_WAIT_TILL_SEEN )
|
||||
{
|
||||
CBaseMonster *pClient;
|
||||
|
||||
pClient = pSightEnt->MyMonsterPointer();
|
||||
CBaseMonster *pClient = pSightEnt->MyMonsterPointer();
|
||||
|
||||
// don't link this client in the list if the monster is wait till seen and the player isn't facing the monster
|
||||
if( pSightEnt && !pClient->FInViewCone( this ) )
|
||||
if( pClient && !pClient->FInViewCone( this ) )
|
||||
{
|
||||
// we're not in the player's view cone.
|
||||
continue;
|
||||
|
@ -672,7 +670,7 @@ BOOL CBaseMonster::FRefreshRoute( void )
|
|||
returnCode = BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, NULL );
|
||||
break;
|
||||
case MOVEGOAL_TARGETENT:
|
||||
if( m_hTargetEnt != NULL )
|
||||
if( m_hTargetEnt != 0 )
|
||||
{
|
||||
returnCode = BuildRoute( m_hTargetEnt->pev->origin, bits_MF_TO_TARGETENT, m_hTargetEnt );
|
||||
}
|
||||
|
@ -954,7 +952,7 @@ BOOL CBaseMonster::CheckRangeAttack2( float flDot, float flDist )
|
|||
BOOL CBaseMonster::CheckMeleeAttack1( float flDot, float flDist )
|
||||
{
|
||||
// Decent fix to keep folks from kicking/punching hornets and snarks is to check the onground flag(sjb)
|
||||
if( flDist <= 64 && flDot >= 0.7 && m_hEnemy != NULL && FBitSet( m_hEnemy->pev->flags, FL_ONGROUND ) )
|
||||
if( flDist <= 64 && flDot >= 0.7 && m_hEnemy != 0 && FBitSet( m_hEnemy->pev->flags, FL_ONGROUND ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1165,7 +1163,7 @@ void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos )
|
|||
{
|
||||
if( m_hOldEnemy[i] == pEnemy )
|
||||
return;
|
||||
if( m_hOldEnemy[i] == NULL ) // someone died, reuse their slot
|
||||
if( m_hOldEnemy[i] == 0 ) // someone died, reuse their slot
|
||||
break;
|
||||
}
|
||||
if( i >= MAX_OLD_ENEMIES )
|
||||
|
@ -1183,7 +1181,7 @@ BOOL CBaseMonster::PopEnemy()
|
|||
// UNDONE: blah, this is bad, we should use a stack but I'm too lazy to code one.
|
||||
for( int i = MAX_OLD_ENEMIES - 1; i >= 0; i-- )
|
||||
{
|
||||
if( m_hOldEnemy[i] != NULL )
|
||||
if( m_hOldEnemy[i] != 0 )
|
||||
{
|
||||
if( m_hOldEnemy[i]->IsAlive()) // cheat and know when they die
|
||||
{
|
||||
|
@ -1240,7 +1238,7 @@ void CBaseMonster::SetActivity( Activity NewActivity )
|
|||
//=========================================================
|
||||
// SetSequenceByName
|
||||
//=========================================================
|
||||
void CBaseMonster::SetSequenceByName( char *szSequence )
|
||||
void CBaseMonster::SetSequenceByName( const char *szSequence )
|
||||
{
|
||||
int iSequence;
|
||||
|
||||
|
@ -1961,7 +1959,7 @@ void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, f
|
|||
while( flTotal > 0.001 )
|
||||
{
|
||||
// don't walk more than 16 units or stairs stop working
|
||||
flStep = min( 16.0, flTotal );
|
||||
flStep = Q_min( 16.0, flTotal );
|
||||
UTIL_MoveToOrigin( ENT( pev ), m_Route[m_iRouteIndex].vecLocation, flStep, MOVE_NORMAL );
|
||||
flTotal -= flStep;
|
||||
}
|
||||
|
@ -2863,7 +2861,7 @@ void CBaseMonster::ReportAIState( void )
|
|||
else
|
||||
ALERT( level, "No Schedule, " );
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
ALERT( level, "\nEnemy is %s", STRING( m_hEnemy->pev->classname ) );
|
||||
else
|
||||
ALERT( level, "No enemy" );
|
||||
|
@ -2950,7 +2948,7 @@ BOOL CBaseMonster::FCheckAITrigger( void )
|
|||
switch( m_iTriggerCondition )
|
||||
{
|
||||
case AITRIGGER_SEEPLAYER_ANGRY_AT_PLAYER:
|
||||
if( m_hEnemy != NULL && m_hEnemy->IsPlayer() && HasConditions( bits_COND_SEE_ENEMY ) )
|
||||
if( m_hEnemy != 0 && m_hEnemy->IsPlayer() && HasConditions( bits_COND_SEE_ENEMY ) )
|
||||
{
|
||||
fFireTarget = TRUE;
|
||||
}
|
||||
|
@ -3321,7 +3319,7 @@ BOOL CBaseMonster::GetEnemy( void )
|
|||
}
|
||||
|
||||
// remember old enemies
|
||||
if( m_hEnemy == NULL && PopEnemy() )
|
||||
if( m_hEnemy == 0 && PopEnemy() )
|
||||
{
|
||||
if( m_pSchedule )
|
||||
{
|
||||
|
@ -3332,7 +3330,7 @@ BOOL CBaseMonster::GetEnemy( void )
|
|||
}
|
||||
}
|
||||
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
// monster has an enemy.
|
||||
return TRUE;
|
||||
|
@ -3344,7 +3342,7 @@ BOOL CBaseMonster::GetEnemy( void )
|
|||
//=========================================================
|
||||
// DropItem - dead monster drops named item
|
||||
//=========================================================
|
||||
CBaseEntity *CBaseMonster::DropItem( char *pszItemName, const Vector &vecPos, const Vector &vecAng )
|
||||
CBaseEntity *CBaseMonster::DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng )
|
||||
{
|
||||
if( !pszItemName )
|
||||
{
|
||||
|
@ -3359,6 +3357,9 @@ CBaseEntity *CBaseMonster::DropItem( char *pszItemName, const Vector &vecPos, co
|
|||
// do we want this behavior to be default?! (sjb)
|
||||
pItem->pev->velocity = pev->velocity;
|
||||
pItem->pev->avelocity = Vector( 0, RANDOM_FLOAT( 0, 100 ), 0 );
|
||||
|
||||
// Dropped items should never respawn (unless this rule changes in the future). - Solokiller
|
||||
pItem->pev->spawnflags |= SF_NORESPAWN;
|
||||
return pItem;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -42,7 +42,7 @@ void CBaseMonster::SetState( MONSTERSTATE State )
|
|||
|
||||
// Drop enemy pointers when going to idle
|
||||
case MONSTERSTATE_IDLE:
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
m_hEnemy = NULL;// not allowed to have an enemy anymore.
|
||||
ALERT( at_aiconsole, "Stripped\n" );
|
||||
|
@ -92,7 +92,7 @@ void CBaseMonster::RunAI( void )
|
|||
}
|
||||
|
||||
// do these calculations if monster has an enemy.
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
CheckEnemy( m_hEnemy );
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ MONSTERSTATE CBaseMonster::GetIdealState( void )
|
|||
COMBAT goes to ALERT upon death of enemy
|
||||
*/
|
||||
{
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
m_IdealMonsterState = MONSTERSTATE_ALERT;
|
||||
// pev->effects = EF_BRIGHTFIELD;
|
||||
|
|
12
dlls/mp5.cpp
12
dlls/mp5.cpp
|
@ -177,7 +177,7 @@ void CMP5::PrimaryAttack()
|
|||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.1 );
|
||||
|
||||
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
|
@ -227,7 +227,7 @@ void CMP5::SecondaryAttack( void )
|
|||
#endif
|
||||
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 );
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 1 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting.
|
||||
|
||||
|
@ -238,7 +238,7 @@ void CMP5::SecondaryAttack( void )
|
|||
|
||||
void CMP5::Reload( void )
|
||||
{
|
||||
if( m_pPlayer->ammo_9mm <= 0 )
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == MP5_MAX_CLIP )
|
||||
return;
|
||||
|
||||
DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5 );
|
||||
|
@ -270,6 +270,12 @@ void CMP5::WeaponIdle( void )
|
|||
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
|
||||
}
|
||||
|
||||
BOOL CMP5::IsUseable()
|
||||
{
|
||||
//Can be used if the player has AR grenades. - Solokiller
|
||||
return CBasePlayerWeapon::IsUseable() || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] > 0;
|
||||
}
|
||||
|
||||
class CMP5AmmoClip : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
|
|
|
@ -230,7 +230,7 @@ CBaseEntity *CBaseMonster::BestVisibleEnemy( void )
|
|||
// currently think is the best visible enemy. No need to do
|
||||
// a distance check, just get mad at this one for now.
|
||||
iBestRelationship = IRelationship( pNextEnt );
|
||||
iNearest = ( pNextEnt->pev->origin - pev->origin ).Length();
|
||||
(int)iNearest = ( pNextEnt->pev->origin - pev->origin ).Length();
|
||||
pReturn = pNextEnt;
|
||||
}
|
||||
else if( IRelationship( pNextEnt ) == iBestRelationship )
|
||||
|
@ -238,7 +238,7 @@ CBaseEntity *CBaseMonster::BestVisibleEnemy( void )
|
|||
// this entity is disliked just as much as the entity that
|
||||
// we currently think is the best visible enemy, so we only
|
||||
// get mad at it if it is closer.
|
||||
iDist = ( pNextEnt->pev->origin - pev->origin ).Length();
|
||||
(int)iDist = ( pNextEnt->pev->origin - pev->origin ).Length();
|
||||
|
||||
if( iDist <= iNearest )
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
|
|||
if( IS_DEDICATED_SERVER() )
|
||||
{
|
||||
// dedicated server
|
||||
char *servercfgfile = (char *)CVAR_GET_STRING( "servercfgfile" );
|
||||
/*const char *servercfgfile = CVAR_GET_STRING( "servercfgfile" );
|
||||
|
||||
if( servercfgfile && servercfgfile[0] )
|
||||
{
|
||||
|
@ -102,11 +102,13 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
|
|||
sprintf( szCommand, "exec %s\n", servercfgfile );
|
||||
SERVER_COMMAND( szCommand );
|
||||
}
|
||||
*/
|
||||
// this code has been moved into engine, to only run server.cfg once
|
||||
}
|
||||
else
|
||||
{
|
||||
// listen server
|
||||
char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" );
|
||||
const char *lservercfgfile = CVAR_GET_STRING( "lservercfgfile" );
|
||||
|
||||
if( lservercfgfile && lservercfgfile[0] )
|
||||
{
|
||||
|
@ -254,7 +256,7 @@ void CHalfLifeMultiplay::Think( void )
|
|||
|
||||
if( pPlayer )
|
||||
{
|
||||
remain = flFragLimit - pPlayer->pev->frags;
|
||||
remain = (int)( flFragLimit - pPlayer->pev->frags );
|
||||
if( remain < bestfrags )
|
||||
{
|
||||
bestfrags = remain;
|
||||
|
@ -298,7 +300,7 @@ BOOL CHalfLifeMultiplay::IsDeathmatch( void )
|
|||
//=========================================================
|
||||
BOOL CHalfLifeMultiplay::IsCoOp( void )
|
||||
{
|
||||
return gpGlobals->coop;
|
||||
return gpGlobals->coop ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -421,7 +423,7 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
|
|||
{
|
||||
// notify other clients of player joining the game
|
||||
UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs( "%s has joined the game\n",
|
||||
( pl->pev->netname && STRING( pl->pev->netname )[0] != 0 ) ? STRING( pl->pev->netname ) : "unconnected" ) );
|
||||
( pl->pev->netname && ( STRING( pl->pev->netname ) )[0] != 0 ) ? STRING( pl->pev->netname ) : "unconnected" ) );
|
||||
|
||||
// team match?
|
||||
if( g_teamplay )
|
||||
|
@ -465,7 +467,7 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
|
|||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgScoreInfo, NULL, pl->edict() );
|
||||
WRITE_BYTE( i ); // client number
|
||||
WRITE_SHORT( plr->pev->frags );
|
||||
WRITE_SHORT( (int)plr->pev->frags );
|
||||
WRITE_SHORT( plr->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( plr->m_szTeamName ) + 1 );
|
||||
|
@ -650,7 +652,7 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
|||
// killed scores
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
||||
WRITE_SHORT( pVictim->pev->frags );
|
||||
WRITE_SHORT( (int)pVictim->pev->frags );
|
||||
WRITE_SHORT( pVictim->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
||||
|
@ -664,7 +666,7 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
|||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX( PK->edict() ) );
|
||||
WRITE_SHORT( PK->pev->frags );
|
||||
WRITE_SHORT( (int)PK->pev->frags );
|
||||
WRITE_SHORT( PK->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( PK->m_szTeamName ) + 1 );
|
||||
|
@ -673,12 +675,6 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
|||
// let the killer paint another decal as soon as he'd like.
|
||||
PK->m_flNextDecalTime = gpGlobals->time;
|
||||
}
|
||||
#ifndef HLDEMO_BUILD
|
||||
if( pVictim->HasNamedPlayerItem( "weapon_satchel" ) )
|
||||
{
|
||||
DeactivateSatchels( pVictim );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -687,14 +683,14 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
|||
void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor )
|
||||
{
|
||||
// Work out what killed the player, and send a message to all clients about it
|
||||
CBaseEntity *Killer = CBaseEntity::Instance( pKiller );
|
||||
CBaseEntity::Instance( pKiller );
|
||||
|
||||
const char *killer_weapon_name = "world"; // by default, the player is killed by the world
|
||||
int killer_index = 0;
|
||||
|
||||
// Hack to fix name change
|
||||
char *tau = "tau_cannon";
|
||||
char *gluon = "gluon gun";
|
||||
const char *tau = "tau_cannon";
|
||||
const char *gluon = "gluon gun";
|
||||
|
||||
if( pKiller->flags & FL_CLIENT )
|
||||
{
|
||||
|
@ -1218,7 +1214,7 @@ COM_Parse
|
|||
Parse a token out of a string
|
||||
==============
|
||||
*/
|
||||
char *COM_Parse( char *data )
|
||||
const char *COM_Parse( const char *data )
|
||||
{
|
||||
int c;
|
||||
int len;
|
||||
|
@ -1294,9 +1290,9 @@ COM_TokenWaiting
|
|||
Returns 1 if additional data is waiting to be processed on this line
|
||||
==============
|
||||
*/
|
||||
int COM_TokenWaiting( char *buffer )
|
||||
int COM_TokenWaiting( const char *buffer )
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
p = buffer;
|
||||
while( *p && *p!='\n')
|
||||
|
@ -1317,12 +1313,12 @@ ReloadMapCycleFile
|
|||
Parses mapcycle.txt file into mapcycle_t structure
|
||||
==============
|
||||
*/
|
||||
int ReloadMapCycleFile( char *filename, mapcycle_t *cycle )
|
||||
int ReloadMapCycleFile( const char *filename, mapcycle_t *cycle )
|
||||
{
|
||||
char szMap[32];
|
||||
int length;
|
||||
char *pFileList;
|
||||
char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( filename, &length );
|
||||
const char *pFileList;
|
||||
const char *aFileList = pFileList = (const char *)LOAD_FILE_FOR_ME( filename, &length );
|
||||
int hasbuffer;
|
||||
mapcycle_item_s *item, *newlist = NULL, *next;
|
||||
|
||||
|
@ -1372,15 +1368,15 @@ int ReloadMapCycleFile( char *filename, mapcycle_t *cycle )
|
|||
if( s && s[0] )
|
||||
{
|
||||
item->minplayers = atoi( s );
|
||||
item->minplayers = max( item->minplayers, 0 );
|
||||
item->minplayers = min( item->minplayers, gpGlobals->maxClients );
|
||||
item->minplayers = Q_max( item->minplayers, 0 );
|
||||
item->minplayers = Q_min( item->minplayers, gpGlobals->maxClients );
|
||||
}
|
||||
s = g_engfuncs.pfnInfoKeyValue( szBuffer, "maxplayers" );
|
||||
if( s && s[0] )
|
||||
{
|
||||
item->maxplayers = atoi( s );
|
||||
item->maxplayers = max( item->maxplayers, 0 );
|
||||
item->maxplayers = min( item->maxplayers, gpGlobals->maxClients );
|
||||
item->maxplayers = Q_max( item->maxplayers, 0 );
|
||||
item->maxplayers = Q_min( item->maxplayers, gpGlobals->maxClients );
|
||||
}
|
||||
|
||||
// Remove keys
|
||||
|
@ -1400,7 +1396,7 @@ int ReloadMapCycleFile( char *filename, mapcycle_t *cycle )
|
|||
}
|
||||
}
|
||||
|
||||
FREE_FILE( aFileList );
|
||||
FREE_FILE( (void*)aFileList );
|
||||
}
|
||||
|
||||
// Fixup circular list pointer
|
||||
|
@ -1536,7 +1532,7 @@ void CHalfLifeMultiplay::ChangeLevel( void )
|
|||
BOOL do_cycle = TRUE;
|
||||
|
||||
// find the map to change to
|
||||
char *mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" );
|
||||
const char *mapcfile = CVAR_GET_STRING( "mapcyclefile" );
|
||||
ASSERT( mapcfile != NULL );
|
||||
|
||||
szCommands[0] = '\0';
|
||||
|
@ -1654,8 +1650,8 @@ void CHalfLifeMultiplay::SendMOTDToClient( edict_t *client )
|
|||
{
|
||||
// read from the MOTD.txt file
|
||||
int length, char_count = 0;
|
||||
char *pFileList;
|
||||
char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( (char *)CVAR_GET_STRING( "motdfile" ), &length );
|
||||
const char *pFileList;
|
||||
const char *aFileList = pFileList = (const char*)LOAD_FILE_FOR_ME( CVAR_GET_STRING( "motdfile" ), &length );
|
||||
|
||||
// send the server name
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgServerName, NULL, client );
|
||||
|
@ -1683,13 +1679,13 @@ void CHalfLifeMultiplay::SendMOTDToClient( edict_t *client )
|
|||
if( char_count < MAX_MOTD_LENGTH )
|
||||
pFileList = aFileList + char_count;
|
||||
else
|
||||
*pFileList = 0;
|
||||
pFileList = 0;
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgMOTD, NULL, client );
|
||||
WRITE_BYTE( *pFileList ? FALSE : TRUE ); // FALSE means there is still more message to come
|
||||
WRITE_BYTE( pFileList ? FALSE : TRUE ); // FALSE means there is still more message to come
|
||||
WRITE_STRING( chunk );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
FREE_FILE( aFileList );
|
||||
FREE_FILE( (void*)aFileList );
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void UpdateOnRemove();
|
||||
int Classify( void ) { return CLASS_ALIEN_MILITARY; };
|
||||
int BloodColor( void ) { return BLOOD_COLOR_YELLOW; }
|
||||
void Killed( entvars_t *pevAttacker, int iGib );
|
||||
|
@ -345,6 +346,26 @@ void CNihilanth::Precache( void )
|
|||
PRECACHE_SOUND( "debris/beamstart7.wav" );
|
||||
}
|
||||
|
||||
void CNihilanth::UpdateOnRemove()
|
||||
{
|
||||
CBaseEntity::UpdateOnRemove();
|
||||
|
||||
if( m_pBall )
|
||||
{
|
||||
UTIL_Remove( m_pBall );
|
||||
m_pBall = 0;
|
||||
}
|
||||
|
||||
for( int i = 0; i < N_SPHERES; i++ )
|
||||
{
|
||||
if( CBaseEntity* pSphere = (CBaseEntity *)m_hSphere[i] )
|
||||
{
|
||||
UTIL_Remove( pSphere );
|
||||
m_hSphere[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CNihilanth::PainSound( void )
|
||||
{
|
||||
if( m_flNextPainSound > gpGlobals->time )
|
||||
|
@ -457,7 +478,7 @@ void CNihilanth::DyingThink( void )
|
|||
{
|
||||
if( m_pBall->pev->renderamt > 0 )
|
||||
{
|
||||
m_pBall->pev->renderamt = max( 0, m_pBall->pev->renderamt - 2 );
|
||||
m_pBall->pev->renderamt = Q_max( 0, m_pBall->pev->renderamt - 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -587,7 +608,7 @@ void CNihilanth::ShootBalls( void )
|
|||
|
||||
while( m_flShootTime < m_flShootEnd && m_flShootTime < gpGlobals->time )
|
||||
{
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
Vector vecSrc, vecDir;
|
||||
CNihilanthHVR *pEntity;
|
||||
|
@ -621,14 +642,14 @@ void CNihilanth::MakeFriend( Vector vecStart )
|
|||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
if( m_hFriend[i] != NULL && !m_hFriend[i]->IsAlive() )
|
||||
if( m_hFriend[i] != 0 && !m_hFriend[i]->IsAlive() )
|
||||
{
|
||||
if( pev->rendermode == kRenderNormal ) // don't do it if they are already fading
|
||||
m_hFriend[i]->MyMonsterPointer()->FadeMonster();
|
||||
m_hFriend[i] = NULL;
|
||||
}
|
||||
|
||||
if( m_hFriend[i] == NULL )
|
||||
if( m_hFriend[i] == 0 )
|
||||
{
|
||||
if( RANDOM_LONG( 0, 1 ) == 0 )
|
||||
{
|
||||
|
@ -654,7 +675,7 @@ void CNihilanth::MakeFriend( Vector vecStart )
|
|||
m_hFriend[i] = Create( "monster_alien_slave", node.m_vecOrigin, pev->angles );
|
||||
}
|
||||
}
|
||||
if( m_hFriend[i] != NULL )
|
||||
if( m_hFriend[i] != 0 )
|
||||
{
|
||||
EMIT_SOUND( m_hFriend[i]->edict(), CHAN_WEAPON, "debris/beamstart7.wav", 1.0, ATTN_NORM );
|
||||
}
|
||||
|
@ -701,7 +722,7 @@ void CNihilanth::NextActivity()
|
|||
}
|
||||
}
|
||||
|
||||
if( ( pev->health < gSkillData.nihilanthHealth / 2 || m_iActiveSpheres < N_SPHERES / 2 ) && m_hRecharger == NULL && m_iLevel <= 9 )
|
||||
if( ( pev->health < gSkillData.nihilanthHealth / 2 || m_iActiveSpheres < N_SPHERES / 2 ) && m_hRecharger == 0 && m_iLevel <= 9 )
|
||||
{
|
||||
char szName[64];
|
||||
|
||||
|
@ -742,7 +763,7 @@ void CNihilanth::NextActivity()
|
|||
float flDist = ( m_posDesired - pev->origin ).Length();
|
||||
float flDot = DotProduct( m_vecDesired, gpGlobals->v_forward );
|
||||
|
||||
if( m_hRecharger != NULL )
|
||||
if( m_hRecharger != 0 )
|
||||
{
|
||||
// at we at power up yet?
|
||||
if( flDist < 128.0 )
|
||||
|
@ -767,23 +788,23 @@ void CNihilanth::NextActivity()
|
|||
return;
|
||||
}
|
||||
|
||||
if( m_hEnemy != NULL && !m_hEnemy->IsAlive() )
|
||||
if( m_hEnemy != 0 && !m_hEnemy->IsAlive() )
|
||||
{
|
||||
m_hEnemy = NULL;
|
||||
m_hEnemy = 0;
|
||||
}
|
||||
|
||||
if( m_flLastSeen + 15 < gpGlobals->time )
|
||||
{
|
||||
m_hEnemy = NULL;
|
||||
m_hEnemy = 0;
|
||||
}
|
||||
|
||||
if( m_hEnemy == NULL )
|
||||
if( m_hEnemy == 0 )
|
||||
{
|
||||
Look( 4096 );
|
||||
m_hEnemy = BestVisibleEnemy();
|
||||
}
|
||||
|
||||
if( m_hEnemy != NULL && m_irritation != 0 )
|
||||
if( m_hEnemy != 0 && m_irritation != 0 )
|
||||
{
|
||||
if( m_flLastSeen + 5 > gpGlobals->time && flDist < 256 && flDot > 0 )
|
||||
{
|
||||
|
@ -860,7 +881,7 @@ void CNihilanth::HuntThink( void )
|
|||
}
|
||||
|
||||
// look for current enemy
|
||||
if( m_hEnemy != NULL && m_hRecharger == NULL )
|
||||
if( m_hEnemy != 0 && m_hRecharger == 0 )
|
||||
{
|
||||
if( FVisible( m_hEnemy ) )
|
||||
{
|
||||
|
@ -874,7 +895,7 @@ void CNihilanth::HuntThink( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_flAdj = min( m_flAdj + 10, 1000 );
|
||||
m_flAdj = Q_min( m_flAdj + 10, 1000 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -928,7 +949,7 @@ void CNihilanth::Flight( void )
|
|||
if( flDir < 0 )
|
||||
flSpeed = -flSpeed;
|
||||
|
||||
float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward );
|
||||
//float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward );
|
||||
|
||||
// sideways drag
|
||||
m_velocity.x = m_velocity.x * ( 1.0 - fabs( gpGlobals->v_right.x ) * 0.05 );
|
||||
|
@ -959,7 +980,7 @@ BOOL CNihilanth::AbsorbSphere( void )
|
|||
{
|
||||
for( int i = 0; i < N_SPHERES; i++ )
|
||||
{
|
||||
if( m_hSphere[i] != NULL )
|
||||
if( m_hSphere[i] != 0 )
|
||||
{
|
||||
CNihilanthHVR *pSphere = (CNihilanthHVR *)( (CBaseEntity *)m_hSphere[i] );
|
||||
pSphere->AbsorbInit();
|
||||
|
@ -978,7 +999,7 @@ BOOL CNihilanth::EmitSphere( void )
|
|||
|
||||
for( int i = 0; i < N_SPHERES; i++ )
|
||||
{
|
||||
if( m_hSphere[i] != NULL )
|
||||
if( m_hSphere[i] != 0 )
|
||||
{
|
||||
m_iActiveSpheres++;
|
||||
}
|
||||
|
@ -1007,10 +1028,10 @@ void CNihilanth::TargetSphere( USE_TYPE useType, float value )
|
|||
|
||||
for( i = 0; i < N_SPHERES; i++ )
|
||||
{
|
||||
if( m_hSphere[i] != NULL )
|
||||
if( m_hSphere[i] != 0 )
|
||||
{
|
||||
pSphere = m_hSphere[i]->MyMonsterPointer();
|
||||
if( pSphere->m_hEnemy == NULL )
|
||||
if( pSphere->m_hEnemy == 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1036,7 +1057,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
break;
|
||||
case 2:
|
||||
// zen
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
if( RANDOM_LONG( 0, 4 ) == 0 )
|
||||
EMIT_SOUND( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, 0.2 );
|
||||
|
@ -1077,7 +1098,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
break;
|
||||
case 3:
|
||||
// prayer
|
||||
if (m_hEnemy != NULL)
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
char szText[32];
|
||||
|
||||
|
@ -1141,7 +1162,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
case 4:
|
||||
// get a sphere
|
||||
{
|
||||
if( m_hRecharger != NULL )
|
||||
if( m_hRecharger != 0 )
|
||||
{
|
||||
if( !EmitSphere() )
|
||||
{
|
||||
|
@ -1157,7 +1178,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
}
|
||||
break;
|
||||
case 6:
|
||||
if( m_hEnemy != NULL )
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
Vector vecSrc, vecAngles;
|
||||
GetAttachment( 2, vecSrc, vecAngles );
|
||||
|
@ -1185,8 +1206,22 @@ void CNihilanth::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
|
|||
case USE_OFF:
|
||||
{
|
||||
CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, m_szDeadTouch );
|
||||
if( pTouch && m_hEnemy != NULL )
|
||||
pTouch->Touch( m_hEnemy );
|
||||
if( pTouch )
|
||||
{
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
pTouch->Touch( m_hEnemy );
|
||||
}
|
||||
// if the player is using "notarget", the ending sequence won't fire unless we catch it here
|
||||
else
|
||||
{
|
||||
CBaseEntity *pEntity = UTIL_FindEntityByClassname( NULL, "player" );
|
||||
if( pEntity != NULL && pEntity->IsAlive() )
|
||||
{
|
||||
pTouch->Touch( pEntity );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case USE_ON:
|
||||
|
@ -1326,7 +1361,7 @@ void CNihilanthHVR::HoverThink( void )
|
|||
{
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if( m_hTargetEnt != NULL )
|
||||
if( m_hTargetEnt != 0 )
|
||||
{
|
||||
CircleTarget( m_hTargetEnt->pev->origin + Vector( 0, 0, 16 * N_SCALE ) );
|
||||
}
|
||||
|
@ -1410,7 +1445,7 @@ void CNihilanthHVR::ZapThink( void )
|
|||
pev->nextthink = gpGlobals->time + 0.05;
|
||||
|
||||
// check world boundaries
|
||||
if( m_hEnemy == NULL || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
|
||||
if( m_hEnemy == 0 || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
UTIL_Remove( this );
|
||||
|
@ -1547,7 +1582,7 @@ void CNihilanthHVR::TeleportThink( void )
|
|||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
// check world boundaries
|
||||
if( m_hEnemy == NULL || !m_hEnemy->IsAlive() || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
|
||||
if( m_hEnemy == 0 || !m_hEnemy->IsAlive() || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
|
||||
{
|
||||
STOP_SOUND( edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
|
||||
UTIL_Remove( this );
|
||||
|
@ -1559,10 +1594,10 @@ void CNihilanthHVR::TeleportThink( void )
|
|||
STOP_SOUND( edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
|
||||
UTIL_Remove( this );
|
||||
|
||||
if( m_hTargetEnt != NULL )
|
||||
if( m_hTargetEnt != 0 )
|
||||
m_hTargetEnt->Use( m_hEnemy, m_hEnemy, USE_ON, 1.0 );
|
||||
|
||||
if( m_hTouch != NULL && m_hEnemy != NULL )
|
||||
if( m_hTouch != 0 && m_hEnemy != 0 )
|
||||
m_hTouch->Touch( m_hEnemy );
|
||||
}
|
||||
else
|
||||
|
@ -1616,10 +1651,10 @@ void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther )
|
|||
|
||||
if( pOther == pEnemy )
|
||||
{
|
||||
if( m_hTargetEnt != NULL )
|
||||
if( m_hTargetEnt != 0 )
|
||||
m_hTargetEnt->Use( pEnemy, pEnemy, USE_ON, 1.0 );
|
||||
|
||||
if( m_hTouch != NULL && pEnemy != NULL )
|
||||
if( m_hTouch != 0 && pEnemy != NULL )
|
||||
m_hTouch->Touch( pEnemy );
|
||||
}
|
||||
else
|
||||
|
@ -1642,7 +1677,7 @@ void CNihilanthHVR::DissipateThink( void )
|
|||
pev->renderamt -= 2;
|
||||
pev->scale += 0.1;
|
||||
|
||||
if( m_hTargetEnt != NULL )
|
||||
if( m_hTargetEnt != 0 )
|
||||
{
|
||||
CircleTarget( m_hTargetEnt->pev->origin + Vector( 0, 0, 4096 ) );
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ entvars_t *CGraph::LinkEntForLink( CLink *pLink, CNode *pNode )
|
|||
//=========================================================
|
||||
int CGraph::HandleLinkEnt( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODEQUERY queryType )
|
||||
{
|
||||
edict_t *pentWorld;
|
||||
//edict_t *pentWorld;
|
||||
CBaseEntity *pDoor;
|
||||
TraceResult tr;
|
||||
|
||||
|
@ -230,7 +230,7 @@ int CGraph::HandleLinkEnt( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODE
|
|||
ALERT( at_aiconsole, "dead path ent!\n" );
|
||||
return TRUE;
|
||||
}
|
||||
pentWorld = NULL;
|
||||
//pentWorld = NULL;
|
||||
|
||||
// func_door
|
||||
if( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) )
|
||||
|
@ -586,7 +586,7 @@ int CGraph::FindShortestPath( int *piPath, int iStart, int iDest, int iHull, int
|
|||
int iVisitNode;
|
||||
int iCurrentNode;
|
||||
int iNumPathNodes;
|
||||
int iHullMask;
|
||||
int iHullMask = 0;
|
||||
|
||||
if( !m_fGraphPresent || !m_fGraphPointersSet )
|
||||
{
|
||||
|
@ -793,12 +793,12 @@ void inline CalcBounds( int &Lower, int &Upper, int Goal, int Best )
|
|||
int Temp = 2 * Goal - Best;
|
||||
if( Best > Goal )
|
||||
{
|
||||
Lower = max( 0, Temp );
|
||||
Lower = Q_max( 0, Temp );
|
||||
Upper = Best;
|
||||
}
|
||||
else
|
||||
{
|
||||
Upper = min( 255, Temp );
|
||||
Upper = Q_min( 255, Temp );
|
||||
Lower = Best;
|
||||
}
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
|
|||
}
|
||||
}
|
||||
|
||||
for( i = max( m_minY, halfY + 1 ); i <= m_maxY; i++ )
|
||||
for( i = Q_max( m_minY, halfY + 1 ); i <= m_maxY; i++ )
|
||||
{
|
||||
for( j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++ )
|
||||
{
|
||||
|
@ -987,7 +987,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
|
|||
}
|
||||
}
|
||||
|
||||
for( i = min( m_maxZ, halfZ ); i >= m_minZ; i-- )
|
||||
for( i = Q_min( m_maxZ, halfZ ); i >= m_minZ; i-- )
|
||||
{
|
||||
for( j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++ )
|
||||
{
|
||||
|
@ -1012,7 +1012,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
|
|||
}
|
||||
}
|
||||
|
||||
for( i = max( m_minX, halfX + 1 ); i <= m_maxX; i++ )
|
||||
for( i = Q_max( m_minX, halfX + 1 ); i <= m_maxX; i++ )
|
||||
{
|
||||
for( j = m_RangeStart[0][i]; j <= m_RangeEnd[0][i]; j++ )
|
||||
{
|
||||
|
@ -1034,7 +1034,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
|
|||
}
|
||||
}
|
||||
|
||||
for( i = min( m_maxY, halfY ); i >= m_minY; i-- )
|
||||
for( i = Q_min( m_maxY, halfY ); i >= m_minY; i-- )
|
||||
{
|
||||
for( j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++ )
|
||||
{
|
||||
|
@ -1055,7 +1055,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
|
|||
}
|
||||
}
|
||||
|
||||
for( i = max( m_minZ, halfZ + 1 ); i <= m_maxZ; i++ )
|
||||
for( i = Q_max( m_minZ, halfZ + 1 ); i <= m_maxZ; i++ )
|
||||
{
|
||||
for( j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++ )
|
||||
{
|
||||
|
@ -1665,10 +1665,10 @@ void CTestHull::BuildNodeGraph( void )
|
|||
|
||||
int iBadNode;// this is the node that caused graph generation to fail
|
||||
|
||||
int cMaxInitialLinks = 0;
|
||||
int cMaxValidLinks = 0;
|
||||
//int cMaxInitialLinks = 0;
|
||||
//int cMaxValidLinks = 0;
|
||||
|
||||
int iPoolIndex = 0;
|
||||
//int iPoolIndex = 0;
|
||||
int cPoolLinks;// number of links in the pool.
|
||||
|
||||
Vector vecDirToCheckNode;
|
||||
|
@ -2058,11 +2058,16 @@ void CTestHull::BuildNodeGraph( void )
|
|||
fprintf( file, "\nAll Connections are Paired!\n" );
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define SIZET_FMT "%Iu"
|
||||
#else
|
||||
#define SIZET_FMT "%zu"
|
||||
#endif
|
||||
fprintf( file, "-------------------------------------------------------------------------------\n" );
|
||||
fprintf( file, "\n\n-------------------------------------------------------------------------------\n" );
|
||||
fprintf( file, "Total Number of Connections in Pool: %d\n", cPoolLinks );
|
||||
fprintf( file, "-------------------------------------------------------------------------------\n" );
|
||||
fprintf( file, "Connection Pool: %d bytes\n", sizeof(CLink) * cPoolLinks );
|
||||
fprintf( file, "Connection Pool: " SIZET_FMT " bytes\n", sizeof(CLink) * cPoolLinks );
|
||||
fprintf( file, "-------------------------------------------------------------------------------\n" );
|
||||
|
||||
ALERT( at_aiconsole, "%d Nodes, %d Connections\n", WorldGraph.m_cNodes, cPoolLinks );
|
||||
|
@ -2103,7 +2108,7 @@ void CTestHull::BuildNodeGraph( void )
|
|||
WorldGraph.ComputeStaticRoutingTables();
|
||||
|
||||
// save the node graph for this level
|
||||
WorldGraph.FSaveGraph( (char *)STRING( gpGlobals->mapname ) );
|
||||
WorldGraph.FSaveGraph( STRING( gpGlobals->mapname ) );
|
||||
ALERT( at_console, "Done.\n" );
|
||||
}
|
||||
|
||||
|
@ -2358,7 +2363,7 @@ void CQueuePriority::Heap_SiftUp( void )
|
|||
// will be loaded. If file cannot be loaded, the node tree
|
||||
// will be created and saved to disk.
|
||||
//=========================================================
|
||||
int CGraph::FLoadGraph( char *szMapName )
|
||||
int CGraph::FLoadGraph( const char *szMapName )
|
||||
{
|
||||
char szFilename[MAX_PATH];
|
||||
int iVersion;
|
||||
|
@ -2537,7 +2542,7 @@ NoMemory:
|
|||
// CGraph - FSaveGraph - It's not rocket science.
|
||||
// this WILL overwrite existing files.
|
||||
//=========================================================
|
||||
int CGraph::FSaveGraph( char *szMapName )
|
||||
int CGraph::FSaveGraph( const char *szMapName )
|
||||
{
|
||||
int iVersion = GRAPH_VERSION;
|
||||
char szFilename[MAX_PATH];
|
||||
|
@ -2669,7 +2674,7 @@ int CGraph::FSetGraphPointers( void )
|
|||
// though. ( I now suspect that we are getting GMT back from
|
||||
// these functions and must compensate for local time ) (sjb)
|
||||
//=========================================================
|
||||
int CGraph::CheckNODFile( char *szMapName )
|
||||
int CGraph::CheckNODFile( const char *szMapName )
|
||||
{
|
||||
int retValue;
|
||||
|
||||
|
|
10
dlls/nodes.h
10
dlls/nodes.h
|
@ -15,7 +15,8 @@
|
|||
//=========================================================
|
||||
// nodes.h
|
||||
//=========================================================
|
||||
|
||||
#ifndef NODES_H
|
||||
#define NODES_H
|
||||
//=========================================================
|
||||
// DEFINE
|
||||
//=========================================================
|
||||
|
@ -181,9 +182,9 @@ public:
|
|||
void InitGraph( void );
|
||||
int AllocNodes ( void );
|
||||
|
||||
int CheckNODFile(char *szMapName);
|
||||
int FLoadGraph(char *szMapName);
|
||||
int FSaveGraph(char *szMapName);
|
||||
int CheckNODFile(const char *szMapName);
|
||||
int FLoadGraph(const char *szMapName);
|
||||
int FSaveGraph(const char *szMapName);
|
||||
int FSetGraphPointers(void);
|
||||
void CheckNode(Vector vecOrigin, int iNode);
|
||||
|
||||
|
@ -374,3 +375,4 @@ enum
|
|||
};
|
||||
|
||||
extern CGraph WorldGraph;
|
||||
#endif // NODES_H
|
||||
|
|
|
@ -0,0 +1,291 @@
|
|||
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
|
||||
//
|
||||
// The copyright to the contents herein is the property of Valve, L.L.C.
|
||||
// The contents may be used and/or copied only with the written permission of
|
||||
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
|
||||
// the agreement/contract under which the contents have been supplied.
|
||||
//
|
||||
// Purpose: Functionality for the observer chase camera
|
||||
//
|
||||
// $Workfile: $
|
||||
// $Date: $
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// $Log: $
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
#include "pm_shared.h"
|
||||
|
||||
extern int gmsgCurWeapon;
|
||||
extern int gmsgSetFOV;
|
||||
extern int gmsgTeamInfo;
|
||||
|
||||
extern int g_teamplay;
|
||||
|
||||
// Find the next client in the game for this player to spectate
|
||||
void CBasePlayer::Observer_FindNextPlayer( bool bReverse )
|
||||
{
|
||||
// MOD AUTHORS: Modify the logic of this function if you want to restrict the observer to watching
|
||||
// only a subset of the players. e.g. Make it check the target's team.
|
||||
int iStart;
|
||||
if( m_hObserverTarget )
|
||||
iStart = ENTINDEX( m_hObserverTarget->edict() );
|
||||
else
|
||||
iStart = ENTINDEX( edict() );
|
||||
int iCurrent = iStart;
|
||||
m_hObserverTarget = 0;
|
||||
int iDir = bReverse ? -1 : 1;
|
||||
|
||||
do
|
||||
{
|
||||
iCurrent += iDir;
|
||||
|
||||
// Loop through the clients
|
||||
if( iCurrent > gpGlobals->maxClients )
|
||||
iCurrent = 1;
|
||||
if( iCurrent < 1 )
|
||||
iCurrent = gpGlobals->maxClients;
|
||||
|
||||
CBaseEntity *pEnt = UTIL_PlayerByIndex( iCurrent );
|
||||
if( !pEnt )
|
||||
continue;
|
||||
if( pEnt == this )
|
||||
continue;
|
||||
// Don't spec observers or players who haven't picked a class yet
|
||||
if( ( (CBasePlayer*)pEnt )->IsObserver() || ( pEnt->pev->effects & EF_NODRAW ) )
|
||||
continue;
|
||||
|
||||
// MOD AUTHORS: Add checks on target here.
|
||||
m_hObserverTarget = pEnt;
|
||||
break;
|
||||
}while( iCurrent != iStart );
|
||||
|
||||
// Did we find a target?
|
||||
if( m_hObserverTarget )
|
||||
{
|
||||
// Move to the target
|
||||
UTIL_SetOrigin( pev, m_hObserverTarget->pev->origin );
|
||||
|
||||
// ALERT( at_console, "Now Tracking %s\n", STRING( m_hObserverTarget->pev->netname ) );
|
||||
|
||||
// Store the target in pev so the physics DLL can get to it
|
||||
if( pev->iuser1 != OBS_ROAMING )
|
||||
pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() );
|
||||
}
|
||||
}
|
||||
|
||||
// Handle buttons in observer mode
|
||||
void CBasePlayer::Observer_HandleButtons()
|
||||
{
|
||||
// Slow down mouse clicks
|
||||
if( m_flNextObserverInput > gpGlobals->time )
|
||||
return;
|
||||
|
||||
// Jump changes from modes: Chase to Roaming
|
||||
if( m_afButtonPressed & IN_JUMP )
|
||||
{
|
||||
if( pev->iuser1 == OBS_CHASE_LOCKED )
|
||||
Observer_SetMode( OBS_CHASE_FREE );
|
||||
else if( pev->iuser1 == OBS_CHASE_FREE )
|
||||
Observer_SetMode( OBS_IN_EYE );
|
||||
else if( pev->iuser1 == OBS_IN_EYE )
|
||||
Observer_SetMode( OBS_ROAMING );
|
||||
else if( pev->iuser1 == OBS_ROAMING )
|
||||
Observer_SetMode( OBS_MAP_FREE );
|
||||
else if( pev->iuser1 == OBS_MAP_FREE )
|
||||
Observer_SetMode( OBS_MAP_CHASE );
|
||||
else
|
||||
Observer_SetMode( OBS_CHASE_FREE ); // don't use OBS_CHASE_LOCKED anymore
|
||||
|
||||
m_flNextObserverInput = gpGlobals->time + 0.2;
|
||||
}
|
||||
|
||||
// Attack moves to the next player
|
||||
if ( m_afButtonPressed & IN_ATTACK )//&& pev->iuser1 != OBS_ROAMING )
|
||||
{
|
||||
Observer_FindNextPlayer( false );
|
||||
|
||||
m_flNextObserverInput = gpGlobals->time + 0.2;
|
||||
}
|
||||
|
||||
// Attack2 moves to the prev player
|
||||
if ( m_afButtonPressed & IN_ATTACK2)// && pev->iuser1 != OBS_ROAMING )
|
||||
{
|
||||
Observer_FindNextPlayer( true );
|
||||
|
||||
m_flNextObserverInput = gpGlobals->time + 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
void CBasePlayer::Observer_CheckTarget()
|
||||
{
|
||||
if( pev->iuser1 == OBS_ROAMING )
|
||||
return;
|
||||
|
||||
// try to find a traget if we have no current one
|
||||
if( m_hObserverTarget == 0 )
|
||||
{
|
||||
Observer_FindNextPlayer( false );
|
||||
|
||||
if( m_hObserverTarget == 0 )
|
||||
{
|
||||
// no target found at all
|
||||
|
||||
int lastMode = pev->iuser1;
|
||||
|
||||
Observer_SetMode( OBS_ROAMING );
|
||||
|
||||
m_iObserverLastMode = lastMode; // don't overwrite users lastmode
|
||||
|
||||
return; // we still have np target return
|
||||
}
|
||||
}
|
||||
|
||||
CBasePlayer* target = (CBasePlayer*)( UTIL_PlayerByIndex( ENTINDEX( m_hObserverTarget->edict() ) ) );
|
||||
|
||||
if( !target )
|
||||
{
|
||||
Observer_FindNextPlayer( false );
|
||||
return;
|
||||
}
|
||||
|
||||
// check taget
|
||||
if( target->pev->deadflag == DEAD_DEAD )
|
||||
{
|
||||
if( ( target->m_fDeadTime + 2.0f ) < gpGlobals->time )
|
||||
{
|
||||
// 3 secs after death change target
|
||||
Observer_FindNextPlayer( false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CBasePlayer::Observer_CheckProperties()
|
||||
{
|
||||
// try to find a traget if we have no current one
|
||||
if( pev->iuser1 == OBS_IN_EYE && m_hObserverTarget != 0 )
|
||||
{
|
||||
CBasePlayer* target = (CBasePlayer*)( UTIL_PlayerByIndex( ENTINDEX( m_hObserverTarget->edict() ) ) );
|
||||
|
||||
if( !target )
|
||||
return;
|
||||
|
||||
int weapon = ( target->m_pActiveItem != NULL ) ? target->m_pActiveItem->m_iId : 0;
|
||||
// use fov of tracked client
|
||||
if( m_iFOV != target->m_iFOV || m_iObserverWeapon != weapon )
|
||||
{
|
||||
m_iFOV = target->m_iFOV;
|
||||
m_iClientFOV = m_iFOV;
|
||||
// write fov before wepon data, so zoomed crosshair is set correctly
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, pev );
|
||||
WRITE_BYTE( m_iFOV );
|
||||
MESSAGE_END();
|
||||
|
||||
m_iObserverWeapon = weapon;
|
||||
//send weapon update
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
|
||||
WRITE_BYTE( 1 ); // 1 = current weapon, not on target
|
||||
WRITE_BYTE( m_iObserverWeapon );
|
||||
WRITE_BYTE( 0 ); // clip
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iFOV = 90;
|
||||
|
||||
if( m_iObserverWeapon != 0 )
|
||||
{
|
||||
m_iObserverWeapon = 0;
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
|
||||
WRITE_BYTE( 1 ); // 1 = current weapon
|
||||
WRITE_BYTE( m_iObserverWeapon );
|
||||
WRITE_BYTE( 0 ); // clip
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to change the observer mode
|
||||
void CBasePlayer::Observer_SetMode( int iMode )
|
||||
{
|
||||
|
||||
// Just abort if we're changing to the mode we're already in
|
||||
if( iMode == pev->iuser1 )
|
||||
return;
|
||||
|
||||
// is valid mode ?
|
||||
if( iMode < OBS_CHASE_LOCKED || iMode > OBS_MAP_CHASE )
|
||||
iMode = OBS_IN_EYE; // now it is
|
||||
// verify observer target again
|
||||
if( m_hObserverTarget != 0 )
|
||||
{
|
||||
CBaseEntity *pEnt = m_hObserverTarget;
|
||||
|
||||
if( ( pEnt == this ) || ( pEnt == NULL ) )
|
||||
m_hObserverTarget = 0;
|
||||
else if( ( (CBasePlayer*)pEnt )->IsObserver() || ( pEnt->pev->effects & EF_NODRAW ) )
|
||||
m_hObserverTarget = 0;
|
||||
}
|
||||
|
||||
// set spectator mode
|
||||
pev->iuser1 = iMode;
|
||||
|
||||
// if we are not roaming, we need a valid target to track
|
||||
if( ( iMode != OBS_ROAMING ) && ( m_hObserverTarget == 0 ) )
|
||||
{
|
||||
Observer_FindNextPlayer( false );
|
||||
|
||||
// if we didn't find a valid target switch to roaming
|
||||
if( m_hObserverTarget == 0 )
|
||||
{
|
||||
ClientPrint( pev, HUD_PRINTCENTER, "#Spec_NoTarget" );
|
||||
pev->iuser1 = OBS_ROAMING;
|
||||
}
|
||||
}
|
||||
|
||||
// set target if not roaming
|
||||
if( pev->iuser1 == OBS_ROAMING )
|
||||
{
|
||||
pev->iuser2 = 0;
|
||||
}
|
||||
else
|
||||
pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() );
|
||||
|
||||
pev->iuser3 = 0; // clear second target from death cam
|
||||
|
||||
// print spepctaor mode on client screen
|
||||
|
||||
char modemsg[16];
|
||||
sprintf( modemsg,"#Spec_Mode%i", pev->iuser1 );
|
||||
ClientPrint( pev, HUD_PRINTCENTER, modemsg );
|
||||
|
||||
m_iObserverLastMode = iMode;
|
||||
}
|
||||
|
||||
void CBasePlayer::StopObserver()
|
||||
{
|
||||
// Turn off spectator
|
||||
pev->iuser1 = pev->iuser2 = 0;
|
||||
m_iHideHUD = 0;
|
||||
|
||||
GetClassPtr( (CBasePlayer *)pev )->Spawn();
|
||||
pev->nextthink = -1;
|
||||
|
||||
// Update Team Status
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo );
|
||||
WRITE_BYTE( ENTINDEX( edict() ) ); // index number of primary entity
|
||||
if( g_teamplay )
|
||||
WRITE_STRING( TeamID() );
|
||||
else
|
||||
WRITE_STRING( "Players" );
|
||||
MESSAGE_END();
|
||||
}
|
|
@ -261,7 +261,7 @@ BOOL COsprey::HasDead()
|
|||
{
|
||||
for( int i = 0; i < m_iUnits; i++ )
|
||||
{
|
||||
if( m_hGrunt[i] == NULL || !m_hGrunt[i]->IsAlive() )
|
||||
if( m_hGrunt[i] == 0 || !m_hGrunt[i]->IsAlive() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -285,9 +285,9 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc )
|
|||
|
||||
for( int i = 0; i < m_iUnits; i++ )
|
||||
{
|
||||
if( m_hGrunt[i] == NULL || !m_hGrunt[i]->IsAlive() )
|
||||
if( m_hGrunt[i] == 0 || !m_hGrunt[i]->IsAlive() )
|
||||
{
|
||||
if( m_hGrunt[i] != NULL && m_hGrunt[i]->pev->rendermode == kRenderNormal )
|
||||
if( m_hGrunt[i] != 0 && m_hGrunt[i]->pev->rendermode == kRenderNormal )
|
||||
{
|
||||
m_hGrunt[i]->SUB_StartFadeOut();
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ void COsprey::HoverThink( void )
|
|||
int i;
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
if( m_hRepel[i] != NULL && m_hRepel[i]->pev->health > 0 && !( m_hRepel[i]->pev->flags & FL_ONGROUND ) )
|
||||
if( m_hRepel[i] != 0 && m_hRepel[i]->pev->health > 0 && !( m_hRepel[i]->pev->flags & FL_ONGROUND ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
234
dlls/plats.cpp
234
dlls/plats.cpp
|
@ -82,12 +82,12 @@ void CBasePlatTrain::KeyValue( KeyValueData *pkvd )
|
|||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
||||
{
|
||||
m_bMoveSnd = atof( pkvd->szValue );
|
||||
m_bMoveSnd = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
||||
{
|
||||
m_bStopSnd = atof( pkvd->szValue );
|
||||
m_bStopSnd = atoi( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if( FStrEq( pkvd->szKeyName, "volume" ) )
|
||||
|
@ -104,111 +104,100 @@ void CBasePlatTrain::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CBasePlatTrain::Precache( void )
|
||||
{
|
||||
const char *pszSound;
|
||||
BOOL NullSound = FALSE;
|
||||
|
||||
// set the plat's "in-motion" sound
|
||||
switch( m_bMoveSnd )
|
||||
{
|
||||
case 0:
|
||||
pev->noiseMoving = MAKE_STRING( "common/null.wav" );
|
||||
break;
|
||||
case 1:
|
||||
PRECACHE_SOUND( "plats/bigmove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/bigmove1.wav" );
|
||||
pszSound = "plats/bigmove1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "plats/bigmove2.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/bigmove2.wav" );
|
||||
pszSound = "plats/bigmove2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "plats/elevmove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/elevmove1.wav" );
|
||||
pszSound = "plats/elevmove1.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "plats/elevmove2.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/elevmove2.wav" );
|
||||
pszSound = "plats/elevmove2.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "plats/elevmove3.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/elevmove3.wav" );
|
||||
pszSound = "plats/elevmove3.wav";
|
||||
break;
|
||||
case 6:
|
||||
PRECACHE_SOUND( "plats/freightmove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/freightmove1.wav" );
|
||||
pszSound = "plats/freightmove1.wav";
|
||||
break;
|
||||
case 7:
|
||||
PRECACHE_SOUND( "plats/freightmove2.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/freightmove2.wav" );
|
||||
pszSound = "plats/freightmove2.wav";
|
||||
break;
|
||||
case 8:
|
||||
PRECACHE_SOUND( "plats/heavymove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/heavymove1.wav" );
|
||||
pszSound = "plats/heavymove1.wav";
|
||||
break;
|
||||
case 9:
|
||||
PRECACHE_SOUND( "plats/rackmove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/rackmove1.wav" );
|
||||
pszSound = "plats/rackmove1.wav";
|
||||
break;
|
||||
case 10:
|
||||
PRECACHE_SOUND( "plats/railmove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/railmove1.wav" );
|
||||
pszSound = "plats/railmove1.wav";
|
||||
break;
|
||||
case 11:
|
||||
PRECACHE_SOUND( "plats/squeekmove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/squeekmove1.wav" );
|
||||
pszSound = "plats/squeekmove1.wav";
|
||||
break;
|
||||
case 12:
|
||||
PRECACHE_SOUND( "plats/talkmove1.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/talkmove1.wav" );
|
||||
pszSound = "plats/talkmove1.wav";
|
||||
break;
|
||||
case 13:
|
||||
PRECACHE_SOUND( "plats/talkmove2.wav" );
|
||||
pev->noiseMoving = MAKE_STRING( "plats/talkmove2.wav" );
|
||||
pszSound = "plats/talkmove2.wav";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pev->noiseMoving = MAKE_STRING( "common/null.wav" );
|
||||
pszSound = "common/null.wav";
|
||||
NullSound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !NullSound )
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noiseMoving = MAKE_STRING( pszSound );
|
||||
NullSound = FALSE;
|
||||
|
||||
// set the plat's 'reached destination' stop sound
|
||||
switch( m_bStopSnd )
|
||||
{
|
||||
case 0:
|
||||
pev->noiseArrived = MAKE_STRING( "common/null.wav" );
|
||||
break;
|
||||
case 1:
|
||||
PRECACHE_SOUND( "plats/bigstop1.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/bigstop1.wav" );
|
||||
pszSound = "plats/bigstop1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "plats/bigstop2.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/bigstop2.wav" );
|
||||
pszSound = "plats/bigstop2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "plats/freightstop1.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/freightstop1.wav" );
|
||||
pszSound = "plats/freightstop1.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "plats/heavystop2.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/heavystop2.wav" );
|
||||
pszSound = "plats/heavystop2.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "plats/rackstop1.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/rackstop1.wav" );
|
||||
pszSound = "plats/rackstop1.wav";
|
||||
break;
|
||||
case 6:
|
||||
PRECACHE_SOUND( "plats/railstop1.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/railstop1.wav" );
|
||||
pszSound = "plats/railstop1.wav";
|
||||
break;
|
||||
case 7:
|
||||
PRECACHE_SOUND( "plats/squeekstop1.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/squeekstop1.wav" );
|
||||
pszSound = "plats/squeekstop1.wav";
|
||||
break;
|
||||
case 8:
|
||||
PRECACHE_SOUND( "plats/talkstop1.wav" );
|
||||
pev->noiseArrived = MAKE_STRING( "plats/talkstop1.wav" );
|
||||
pszSound = "plats/talkstop1.wav";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
pev->noiseArrived = MAKE_STRING( "common/null.wav" );
|
||||
pszSound = "common/null.wav";
|
||||
NullSound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !NullSound )
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noiseArrived = MAKE_STRING( pszSound );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -248,7 +237,7 @@ public:
|
|||
virtual int ObjectCaps( void ) { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE; }
|
||||
void SpawnInsideTrigger( CFuncPlat *pPlatform );
|
||||
void Touch( CBaseEntity *pOther );
|
||||
CFuncPlat *m_pPlatform;
|
||||
EHANDLE m_hPlatform;
|
||||
};
|
||||
|
||||
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
|
||||
|
@ -340,24 +329,24 @@ static void PlatSpawnInsideTrigger( entvars_t *pevPlatform )
|
|||
//
|
||||
void CPlatTrigger::SpawnInsideTrigger( CFuncPlat *pPlatform )
|
||||
{
|
||||
m_pPlatform = pPlatform;
|
||||
m_hPlatform = pPlatform;
|
||||
// Create trigger entity, "point" it at the owning platform, give it a touch method
|
||||
pev->solid = SOLID_TRIGGER;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
pev->origin = pPlatform->pev->origin;
|
||||
|
||||
// Establish the trigger field's size
|
||||
Vector vecTMin = m_pPlatform->pev->mins + Vector( 25, 25, 0 );
|
||||
Vector vecTMax = m_pPlatform->pev->maxs + Vector( 25, 25, 8 );
|
||||
vecTMin.z = vecTMax.z - ( m_pPlatform->m_vecPosition1.z - m_pPlatform->m_vecPosition2.z + 8 );
|
||||
if( m_pPlatform->pev->size.x <= 50 )
|
||||
Vector vecTMin = pPlatform->pev->mins + Vector( 25, 25, 0 );
|
||||
Vector vecTMax = pPlatform->pev->maxs + Vector( 25, 25, 8 );
|
||||
vecTMin.z = vecTMax.z - ( pPlatform->m_vecPosition1.z - pPlatform->m_vecPosition2.z + 8 );
|
||||
if( pPlatform->pev->size.x <= 50 )
|
||||
{
|
||||
vecTMin.x = ( m_pPlatform->pev->mins.x + m_pPlatform->pev->maxs.x ) / 2;
|
||||
vecTMin.x = ( pPlatform->pev->mins.x + pPlatform->pev->maxs.x ) / 2;
|
||||
vecTMax.x = vecTMin.x + 1;
|
||||
}
|
||||
if( m_pPlatform->pev->size.y <= 50 )
|
||||
if( pPlatform->pev->size.y <= 50 )
|
||||
{
|
||||
vecTMin.y = ( m_pPlatform->pev->mins.y + m_pPlatform->pev->maxs.y ) / 2;
|
||||
vecTMin.y = ( pPlatform->pev->mins.y + pPlatform->pev->maxs.y ) / 2;
|
||||
vecTMax.y = vecTMin.y + 1;
|
||||
}
|
||||
UTIL_SetSize( pev, vecTMin, vecTMax );
|
||||
|
@ -373,15 +362,24 @@ void CPlatTrigger::Touch( CBaseEntity *pOther )
|
|||
if( !FClassnameIs( pevToucher, "player" ) )
|
||||
return;
|
||||
|
||||
CFuncPlat *pPlatform = (CFuncPlat*)(CBaseEntity*)m_hPlatform;
|
||||
|
||||
if( !pPlatform )
|
||||
{
|
||||
// The target platform has been removed, remove myself as well. - Solokiller
|
||||
UTIL_Remove( this );
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore touches by corpses
|
||||
if( !pOther->IsAlive() )
|
||||
return;
|
||||
|
||||
// Make linked platform go up/down.
|
||||
if( m_pPlatform->m_toggle_state == TS_AT_BOTTOM )
|
||||
m_pPlatform->GoUp();
|
||||
else if( m_pPlatform->m_toggle_state == TS_AT_TOP )
|
||||
m_pPlatform->pev->nextthink = m_pPlatform->pev->ltime + 1;// delay going down
|
||||
if( pPlatform->m_toggle_state == TS_AT_BOTTOM )
|
||||
pPlatform->GoUp();
|
||||
else if( pPlatform->m_toggle_state == TS_AT_TOP )
|
||||
pPlatform->pev->nextthink = pPlatform->pev->ltime + 1;// delay going down
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -418,7 +416,7 @@ void CFuncPlat::PlatUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
|||
void CFuncPlat::GoDown( void )
|
||||
{
|
||||
if( pev->noiseMovement )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMovement ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMovement ), m_volume, ATTN_NORM );
|
||||
|
||||
ASSERT( m_toggle_state == TS_AT_TOP || m_toggle_state == TS_GOING_UP );
|
||||
m_toggle_state = TS_GOING_DOWN;
|
||||
|
@ -427,15 +425,15 @@ void CFuncPlat::GoDown( void )
|
|||
}
|
||||
|
||||
//
|
||||
// Platform has hit bottom. Stops and waits forever.
|
||||
// Platform has hit bottom. Stops and waits forever.
|
||||
//
|
||||
void CFuncPlat::HitBottom( void )
|
||||
{
|
||||
if( pev->noiseMovement )
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||
|
||||
if( pev->noiseStopMoving )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, (char*)STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
|
||||
ASSERT( m_toggle_state == TS_GOING_DOWN );
|
||||
m_toggle_state = TS_AT_BOTTOM;
|
||||
|
@ -447,7 +445,7 @@ void CFuncPlat::HitBottom( void )
|
|||
void CFuncPlat::GoUp( void )
|
||||
{
|
||||
if( pev->noiseMovement )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMovement ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMovement ), m_volume, ATTN_NORM );
|
||||
|
||||
ASSERT( m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN );
|
||||
m_toggle_state = TS_GOING_UP;
|
||||
|
@ -456,15 +454,15 @@ void CFuncPlat::GoUp( void )
|
|||
}
|
||||
|
||||
//
|
||||
// Platform has hit top. Pauses, then starts back down again.
|
||||
// Platform has hit top. Pauses, then starts back down again.
|
||||
//
|
||||
void CFuncPlat::HitTop( void )
|
||||
{
|
||||
if( pev->noiseMovement )
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||
|
||||
if( pev->noiseStopMoving )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, (char*)STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
|
||||
ASSERT( m_toggle_state == TS_GOING_UP );
|
||||
m_toggle_state = TS_AT_TOP;
|
||||
|
@ -484,7 +482,7 @@ void CFuncPlat::Blocked( CBaseEntity *pOther )
|
|||
pOther->TakeDamage( pev, pev, 1, DMG_CRUSH );
|
||||
|
||||
if( pev->noiseMovement )
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||
|
||||
// Send the platform back where it came from
|
||||
ASSERT( m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN );
|
||||
|
@ -554,7 +552,7 @@ void CFuncPlatRot::GoDown( void )
|
|||
}
|
||||
|
||||
//
|
||||
// Platform has hit bottom. Stops and waits forever.
|
||||
// Platform has hit bottom. Stops and waits forever.
|
||||
//
|
||||
void CFuncPlatRot::HitBottom( void )
|
||||
{
|
||||
|
@ -573,7 +571,7 @@ void CFuncPlatRot::GoUp( void )
|
|||
}
|
||||
|
||||
//
|
||||
// Platform has hit top. Pauses, then starts back down again.
|
||||
// Platform has hit top. Pauses, then starts back down again.
|
||||
//
|
||||
void CFuncPlatRot::HitTop( void )
|
||||
{
|
||||
|
@ -672,7 +670,7 @@ void CFuncTrain::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
|
|||
pev->nextthink = 0;
|
||||
pev->velocity = g_vecZero;
|
||||
if( pev->noiseStopMoving )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -693,9 +691,9 @@ void CFuncTrain::Wait( void )
|
|||
|
||||
// clear the sound channel.
|
||||
if( pev->noiseMovement )
|
||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
||||
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||
if( pev->noiseStopMoving )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
pev->nextthink = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -706,9 +704,9 @@ void CFuncTrain::Wait( void )
|
|||
// -1 wait will wait forever!
|
||||
pev->nextthink = pev->ltime + m_flWait;
|
||||
if( pev->noiseMovement )
|
||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
||||
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||
if( pev->noiseStopMoving )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
SetThink( &CFuncTrain::Next );
|
||||
}
|
||||
else
|
||||
|
@ -730,10 +728,10 @@ void CFuncTrain::Next( void )
|
|||
if( !pTarg )
|
||||
{
|
||||
if( pev->noiseMovement )
|
||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
||||
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||
// Play stop sound
|
||||
if( pev->noiseStopMoving )
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, (char*)STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -743,21 +741,21 @@ void CFuncTrain::Next( void )
|
|||
pev->target = pTarg->pev->target;
|
||||
m_flWait = pTarg->GetDelay();
|
||||
|
||||
if ( m_pevCurrentTarget && m_pevCurrentTarget->speed != 0 )
|
||||
if( m_pevCurrentTarget && m_pevCurrentTarget->speed != 0 )
|
||||
{
|
||||
// don't copy speed from target if it is 0 (uninitialized)
|
||||
pev->speed = m_pevCurrentTarget->speed;
|
||||
ALERT( at_aiconsole, "Train %s speed to %4.2f\n", STRING(pev->targetname), pev->speed );
|
||||
ALERT( at_aiconsole, "Train %s speed to %4.2f\n", STRING( pev->targetname ), pev->speed );
|
||||
}
|
||||
m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us.
|
||||
|
||||
pev->enemy = pTarg->edict();//hack
|
||||
|
||||
if(FBitSet(m_pevCurrentTarget->spawnflags, SF_CORNER_TELEPORT))
|
||||
if( FBitSet( m_pevCurrentTarget->spawnflags, SF_CORNER_TELEPORT ) )
|
||||
{
|
||||
// Path corner has indicated a teleport to the next corner.
|
||||
SetBits(pev->effects, EF_NOINTERP);
|
||||
UTIL_SetOrigin(pev, pTarg->pev->origin - (pev->mins + pev->maxs)* 0.5);
|
||||
SetBits( pev->effects, EF_NOINTERP );
|
||||
UTIL_SetOrigin( pev, pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5 );
|
||||
Wait(); // Get on with doing the next path corner.
|
||||
}
|
||||
else
|
||||
|
@ -767,13 +765,15 @@ void CFuncTrain::Next( void )
|
|||
// CHANGED this from CHAN_VOICE to CHAN_STATIC around OEM beta time because trains should
|
||||
// use CHAN_STATIC for their movement sounds to prevent sound field problems.
|
||||
// this is not a hack or temporary fix, this is how things should be. (sjb).
|
||||
if ( pev->noiseMovement )
|
||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING(pev->noiseMovement) );
|
||||
if ( pev->noiseMovement )
|
||||
EMIT_SOUND (ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMovement), m_volume, ATTN_NORM);
|
||||
ClearBits(pev->effects, EF_NOINTERP);
|
||||
if( pev->noiseMovement )
|
||||
{
|
||||
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMovement ), m_volume, ATTN_NORM );
|
||||
}
|
||||
|
||||
ClearBits( pev->effects, EF_NOINTERP );
|
||||
SetMoveDone( &CFuncTrain::Wait );
|
||||
LinearMove (pTarg->pev->origin - (pev->mins + pev->maxs)* 0.5, pev->speed);
|
||||
LinearMove( pTarg->pev->origin - ( pev->mins + pev->maxs )* 0.5, pev->speed );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -853,8 +853,8 @@ void CFuncTrain::Precache( void )
|
|||
case 1:
|
||||
PRECACHE_SOUND( "plats/train2.wav" );
|
||||
PRECACHE_SOUND( "plats/train1.wav" );
|
||||
pev->noise = MAKE_STRING("plats/train2.wav" );
|
||||
pev->noise1 = MAKE_STRING("plats/train1.wav" );
|
||||
pev->noise = MAKE_STRING( "plats/train2.wav" );
|
||||
pev->noise1 = MAKE_STRING( "plats/train1.wav" );
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "plats/platmove1.wav" );
|
||||
|
@ -1061,7 +1061,7 @@ void CFuncTrackTrain::StopSound( void )
|
|||
PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_UPDATE, edict(), m_usAdjustPitch, 0.0,
|
||||
(float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, us_encode, 0, 1, 0 );
|
||||
/*
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noise ) );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noise ) );
|
||||
*/
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_ITEM, "plats/ttrain_brake1.wav", m_flVolume, ATTN_NORM, 0, 100 );
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ void CFuncTrackTrain::UpdateSound( void )
|
|||
{
|
||||
// play startup sound for train
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_ITEM, "plats/ttrain_start1.wav", m_flVolume, ATTN_NORM, 0, 100 );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noise ), m_flVolume, ATTN_NORM, 0, (int)flpitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noise ), m_flVolume, ATTN_NORM, 0, (int)flpitch );
|
||||
m_soundPlaying = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
// update pitch
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noise ), m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, (int)flpitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noise ), m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, (int)flpitch );
|
||||
*/
|
||||
// volume 0.0 - 1.0 - 6 bits
|
||||
// m_sounds 3 bits
|
||||
|
@ -1322,7 +1322,7 @@ BOOL CFuncTrackTrain::OnControls( entvars_t *pevTest )
|
|||
|
||||
void CFuncTrackTrain::Find( void )
|
||||
{
|
||||
m_ppath = CPathTrack::Instance(FIND_ENTITY_BY_TARGETNAME( NULL, STRING( pev->target ) ) );
|
||||
m_ppath = CPathTrack::Instance( FIND_ENTITY_BY_TARGETNAME( NULL, STRING( pev->target ) ) );
|
||||
if( !m_ppath )
|
||||
return;
|
||||
|
||||
|
@ -1437,7 +1437,7 @@ void CFuncTrackTrain::Spawn( void )
|
|||
pev->speed = 0;
|
||||
pev->velocity = g_vecZero;
|
||||
pev->avelocity = g_vecZero;
|
||||
pev->impulse = m_speed;
|
||||
pev->impulse = (int)m_speed;
|
||||
|
||||
m_dir = 1;
|
||||
|
||||
|
@ -1471,6 +1471,8 @@ void CFuncTrackTrain::Spawn( void )
|
|||
|
||||
void CFuncTrackTrain::Precache( void )
|
||||
{
|
||||
const char *pszSound;
|
||||
|
||||
if( m_flVolume == 0.0 )
|
||||
m_flVolume = 1.0;
|
||||
|
||||
|
@ -1478,34 +1480,36 @@ void CFuncTrackTrain::Precache( void )
|
|||
{
|
||||
default:
|
||||
// no sound
|
||||
pev->noise = 0;
|
||||
pszSound = NULL;
|
||||
break;
|
||||
case 1:
|
||||
PRECACHE_SOUND( "plats/ttrain1.wav" );
|
||||
pev->noise = MAKE_STRING("plats/ttrain1.wav" );
|
||||
pszSound = "plats/ttrain1.wav";
|
||||
break;
|
||||
case 2:
|
||||
PRECACHE_SOUND( "plats/ttrain2.wav" );
|
||||
pev->noise = MAKE_STRING( "plats/ttrain2.wav" );
|
||||
pszSound = "plats/ttrain2.wav";
|
||||
break;
|
||||
case 3:
|
||||
PRECACHE_SOUND( "plats/ttrain3.wav" );
|
||||
pev->noise = MAKE_STRING( "plats/ttrain3.wav" );
|
||||
pszSound = "plats/ttrain3.wav";
|
||||
break;
|
||||
case 4:
|
||||
PRECACHE_SOUND( "plats/ttrain4.wav" );
|
||||
pev->noise = MAKE_STRING( "plats/ttrain4.wav" );
|
||||
pszSound = "plats/ttrain4.wav";
|
||||
break;
|
||||
case 5:
|
||||
PRECACHE_SOUND( "plats/ttrain6.wav" );
|
||||
pev->noise = MAKE_STRING( "plats/ttrain6.wav" );
|
||||
pszSound = "plats/ttrain6.wav";
|
||||
break;
|
||||
case 6:
|
||||
PRECACHE_SOUND( "plats/ttrain7.wav" );
|
||||
pev->noise = MAKE_STRING( "plats/ttrain7.wav" );
|
||||
pszSound = "plats/ttrain7.wav";
|
||||
break;
|
||||
}
|
||||
|
||||
if( pszSound )
|
||||
{
|
||||
PRECACHE_SOUND( pszSound );
|
||||
pev->noise = MAKE_STRING( pszSound );
|
||||
}
|
||||
else
|
||||
pev->noise = 0;
|
||||
|
||||
PRECACHE_SOUND( "plats/ttrain_brake1.wav" );
|
||||
PRECACHE_SOUND( "plats/ttrain_start1.wav" );
|
||||
|
||||
|
@ -2212,7 +2216,7 @@ void CGunTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
|
|||
{
|
||||
pev->takedamage = DAMAGE_AIM;
|
||||
m_hTargetEnt = GetNextTarget();
|
||||
if( m_hTargetEnt == NULL )
|
||||
if( m_hTargetEnt == 0 )
|
||||
return;
|
||||
pev->health = pev->max_health;
|
||||
Next();
|
||||
|
|
251
dlls/player.cpp
251
dlls/player.cpp
|
@ -34,6 +34,7 @@
|
|||
#include "decals.h"
|
||||
#include "gamerules.h"
|
||||
#include "game.h"
|
||||
#include "pm_shared.h"
|
||||
#include "hltv.h"
|
||||
|
||||
// #define DUCKFIX
|
||||
|
@ -44,6 +45,8 @@ extern DLL_GLOBAL BOOL g_fDrawLines;
|
|||
int gEvilImpulse101;
|
||||
extern DLL_GLOBAL int g_iSkillLevel, gDisplayTitle;
|
||||
|
||||
extern "C" int g_bhopcap;
|
||||
|
||||
BOOL gInitHUD = TRUE;
|
||||
|
||||
extern void CopyToBodyQue( entvars_t *pev);
|
||||
|
@ -180,6 +183,7 @@ int gmsgSetFOV = 0;
|
|||
int gmsgShowMenu = 0;
|
||||
int gmsgGeigerRange = 0;
|
||||
int gmsgTeamNames = 0;
|
||||
int gmsgBhopcap = 0;
|
||||
|
||||
int gmsgStatusText = 0;
|
||||
int gmsgStatusValue = 0;
|
||||
|
@ -201,7 +205,8 @@ void LinkUserMessages( void )
|
|||
gmsgDamage = REG_USER_MSG( "Damage", 12 );
|
||||
gmsgBattery = REG_USER_MSG( "Battery", 2);
|
||||
gmsgTrain = REG_USER_MSG( "Train", 1 );
|
||||
gmsgHudText = REG_USER_MSG( "HudText", -1 );
|
||||
//gmsgHudText = REG_USER_MSG( "HudTextPro", -1 );
|
||||
gmsgHudText = REG_USER_MSG( "HudText", -1 ); // we don't use the message but 3rd party addons may!
|
||||
gmsgSayText = REG_USER_MSG( "SayText", -1 );
|
||||
gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
|
||||
gmsgWeaponList = REG_USER_MSG( "WeaponList", -1 );
|
||||
|
@ -225,6 +230,7 @@ void LinkUserMessages( void )
|
|||
gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) );
|
||||
gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 );
|
||||
gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 );
|
||||
gmsgBhopcap = REG_USER_MSG( "Bhopcap", 1 );
|
||||
|
||||
gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
|
||||
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
|
||||
|
@ -457,10 +463,10 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
|
|||
}
|
||||
|
||||
// keep track of amount of damage last sustained
|
||||
m_lastDamageAmount = flDamage;
|
||||
m_lastDamageAmount = (int)flDamage;
|
||||
|
||||
// Armor.
|
||||
if( pev->armorvalue && !( bitsDamageType & ( DMG_FALL | DMG_DROWN ) ) )// armor doesn't protect against fall or drown damage!
|
||||
if( !( pev->flags & FL_GODMODE ) && pev->armorvalue && !( bitsDamageType & ( DMG_FALL | DMG_DROWN ) ) )// armor doesn't protect against fall or drown damage!
|
||||
{
|
||||
float flNew = flDamage * flRatio;
|
||||
|
||||
|
@ -660,8 +666,8 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
|||
int iWeaponRules;
|
||||
int iAmmoRules;
|
||||
int i;
|
||||
CBasePlayerWeapon *rgpPackWeapons[20] = {0};// 20 hardcoded for now. How to determine exactly how many weapons we have?
|
||||
int iPackAmmo[MAX_AMMO_SLOTS + 1];
|
||||
CBasePlayerWeapon *rgpPackWeapons[MAX_WEAPONS] = {0,};
|
||||
int iPackAmmo[MAX_AMMO_SLOTS];
|
||||
int iPW = 0;// index into packweapons array
|
||||
int iPA = 0;// index into packammo array
|
||||
|
||||
|
@ -669,7 +675,7 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
|||
|
||||
// get the game rules
|
||||
iWeaponRules = g_pGameRules->DeadPlayerWeapons( this );
|
||||
iAmmoRules = g_pGameRules->DeadPlayerAmmo( this );
|
||||
iAmmoRules = g_pGameRules->DeadPlayerAmmo( this );
|
||||
|
||||
if( iWeaponRules == GR_PLR_DROP_GUN_NO && iAmmoRules == GR_PLR_DROP_AMMO_NO )
|
||||
{
|
||||
|
@ -679,14 +685,14 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
|||
}
|
||||
|
||||
// go through all of the weapons and make a list of the ones to pack
|
||||
for( i = 0; i < MAX_ITEM_TYPES; i++ )
|
||||
for( i = 0; i < MAX_ITEM_TYPES && iPW < MAX_WEAPONS; i++ )
|
||||
{
|
||||
if( m_rgpPlayerItems[i] )
|
||||
{
|
||||
// there's a weapon here. Should I pack it?
|
||||
CBasePlayerItem *pPlayerItem = m_rgpPlayerItems[i];
|
||||
|
||||
while( pPlayerItem )
|
||||
while( pPlayerItem && iPW < MAX_WEAPONS )
|
||||
{
|
||||
switch( iWeaponRules )
|
||||
{
|
||||
|
@ -785,18 +791,21 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit )
|
|||
|
||||
m_pLastItem = NULL;
|
||||
|
||||
if( m_pTank != 0 )
|
||||
m_pTank->Use( this, this, USE_OFF, 0 );
|
||||
|
||||
int i;
|
||||
CBasePlayerItem *pPendingItem;
|
||||
for( i = 0; i < MAX_ITEM_TYPES; i++ )
|
||||
{
|
||||
m_pActiveItem = m_rgpPlayerItems[i];
|
||||
m_rgpPlayerItems[i] = NULL;
|
||||
while( m_pActiveItem )
|
||||
{
|
||||
pPendingItem = m_pActiveItem->m_pNext;
|
||||
m_pActiveItem->Drop();
|
||||
m_pActiveItem = pPendingItem;
|
||||
}
|
||||
m_rgpPlayerItems[i] = NULL;
|
||||
}
|
||||
m_pActiveItem = NULL;
|
||||
|
||||
|
@ -808,9 +817,15 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit )
|
|||
else
|
||||
pev->weapons &= ~WEAPON_ALLWEAPONS;
|
||||
|
||||
// Turn off flashlight
|
||||
ClearBits( pev->effects, EF_DIMLIGHT );
|
||||
|
||||
for( i = 0; i < MAX_AMMO_SLOTS; i++ )
|
||||
m_rgAmmo[i] = 0;
|
||||
|
||||
if( satchelfix.value )
|
||||
DeactivateSatchels( this );
|
||||
|
||||
UpdateClientData();
|
||||
|
||||
// send Selected Weapon Message to our client
|
||||
|
@ -839,11 +854,8 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
|
|||
|
||||
g_pGameRules->PlayerKilled( this, pevAttacker, g_pevLastInflictor );
|
||||
|
||||
if( m_pTank != NULL )
|
||||
{
|
||||
if( m_pTank != 0 )
|
||||
m_pTank->Use( this, this, USE_OFF, 0 );
|
||||
m_pTank = NULL;
|
||||
}
|
||||
|
||||
// this client isn't going to be thinking for a while, so reset the sound until they respawn
|
||||
pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( edict() ) );
|
||||
|
@ -1164,7 +1176,7 @@ void CBasePlayer::WaterMove()
|
|||
// track drowning damage, give it back when
|
||||
// player finally takes a breath
|
||||
|
||||
m_idrowndmg += pev->dmg;
|
||||
m_idrowndmg += (int)pev->dmg;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1297,6 +1309,9 @@ void CBasePlayer::PlayerDeathThink( void )
|
|||
StartDeathCam();
|
||||
}
|
||||
|
||||
if( pev->iuser1 ) // player is in spectator mode
|
||||
return;
|
||||
|
||||
// wait for any button down, or mp_forcerespawn is set and the respawn time is up
|
||||
if( !fAnyButtonDown && !( g_pGameRules->IsMultiplayer() && forcerespawn.value > 0 && ( gpGlobals->time > ( m_fDeadTime + 5 ) ) ) )
|
||||
return;
|
||||
|
@ -1345,7 +1360,9 @@ void CBasePlayer::StartDeathCam( void )
|
|||
}
|
||||
|
||||
CopyToBodyQue( pev );
|
||||
StartObserver( pSpot->v.origin, pSpot->v.v_angle );
|
||||
|
||||
UTIL_SetOrigin( pev, pSpot->v.origin );
|
||||
pev->angles = pev->v_angle = pSpot->v.v_angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1353,23 +1370,86 @@ void CBasePlayer::StartDeathCam( void )
|
|||
TraceResult tr;
|
||||
CopyToBodyQue( pev );
|
||||
UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, 128 ), ignore_monsters, edict(), &tr );
|
||||
StartObserver( tr.vecEndPos, UTIL_VecToAngles( tr.vecEndPos - pev->origin ) );
|
||||
return;
|
||||
|
||||
UTIL_SetOrigin( pev, tr.vecEndPos );
|
||||
pev->angles = pev->v_angle = UTIL_VecToAngles( tr.vecEndPos - pev->origin );
|
||||
}
|
||||
|
||||
// start death cam
|
||||
m_afPhysicsFlags |= PFLAG_OBSERVER;
|
||||
pev->view_ofs = g_vecZero;
|
||||
pev->fixangle = TRUE;
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
pev->modelindex = 0;
|
||||
}
|
||||
|
||||
void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle )
|
||||
{
|
||||
m_afPhysicsFlags |= PFLAG_OBSERVER;
|
||||
// clear any clientside entities attached to this player
|
||||
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin );
|
||||
WRITE_BYTE( TE_KILLPLAYERATTACHMENTS );
|
||||
WRITE_BYTE( (BYTE)entindex() );
|
||||
MESSAGE_END();
|
||||
|
||||
// Holster weapon immediately, to allow it to cleanup
|
||||
if( m_pActiveItem )
|
||||
m_pActiveItem->Holster();
|
||||
|
||||
if( m_pTank != 0 )
|
||||
m_pTank->Use( this, this, USE_OFF, 0 );
|
||||
|
||||
// clear out the suit message cache so we don't keep chattering
|
||||
SetSuitUpdate( NULL, FALSE, 0 );
|
||||
|
||||
// Tell Ammo Hud that the player is dead
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
|
||||
WRITE_BYTE( 0 );
|
||||
WRITE_BYTE( 0XFF );
|
||||
WRITE_BYTE( 0xFF );
|
||||
MESSAGE_END();
|
||||
|
||||
// reset FOV
|
||||
m_iFOV = m_iClientFOV = 0;
|
||||
pev->fov = m_iFOV;
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, pev );
|
||||
WRITE_BYTE( 0 );
|
||||
MESSAGE_END();
|
||||
|
||||
// Setup flags
|
||||
m_iHideHUD = ( HIDEHUD_HEALTH | HIDEHUD_WEAPONS );
|
||||
m_afPhysicsFlags |= PFLAG_OBSERVER;
|
||||
pev->effects = EF_NODRAW;
|
||||
pev->view_ofs = g_vecZero;
|
||||
pev->angles = pev->v_angle = vecViewAngle;
|
||||
pev->fixangle = TRUE;
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
pev->modelindex = 0;
|
||||
ClearBits( m_afPhysicsFlags, PFLAG_DUCKING );
|
||||
ClearBits( pev->flags, FL_DUCKING );
|
||||
pev->deadflag = DEAD_RESPAWNABLE;
|
||||
pev->health = 1;
|
||||
|
||||
// Clear out the status bar
|
||||
m_fInitHUD = TRUE;
|
||||
|
||||
pev->team = 0;
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo );
|
||||
WRITE_BYTE( ENTINDEX(edict()) );
|
||||
WRITE_STRING( "" );
|
||||
MESSAGE_END();
|
||||
|
||||
// Remove all the player's stuff
|
||||
RemoveAllItems( FALSE );
|
||||
|
||||
// Move them to the new position
|
||||
UTIL_SetOrigin( pev, vecPosition );
|
||||
|
||||
// Find a player to watch
|
||||
m_flNextObserverInput = 0;
|
||||
Observer_SetMode( m_iObserverLastMode );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1379,6 +1459,9 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle )
|
|||
|
||||
void CBasePlayer::PlayerUse( void )
|
||||
{
|
||||
if( IsObserver() )
|
||||
return;
|
||||
|
||||
// Was use pressed or released?
|
||||
if( !( ( pev->button | m_afButtonPressed | m_afButtonReleased) & IN_USE ) )
|
||||
return;
|
||||
|
@ -1386,12 +1469,11 @@ void CBasePlayer::PlayerUse( void )
|
|||
// Hit Use on a train?
|
||||
if( m_afButtonPressed & IN_USE )
|
||||
{
|
||||
if( m_pTank != NULL )
|
||||
if( m_pTank != 0 )
|
||||
{
|
||||
// Stop controlling the tank
|
||||
// TODO: Send HUD Update
|
||||
m_pTank->Use( this, this, USE_OFF, 0 );
|
||||
m_pTank = NULL;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -1409,7 +1491,7 @@ void CBasePlayer::PlayerUse( void )
|
|||
if( pTrain && !( pev->button & IN_JUMP ) && FBitSet( pev->flags, FL_ONGROUND ) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE ) && pTrain->OnControls( pev ) )
|
||||
{
|
||||
m_afPhysicsFlags |= PFLAG_ONTRAIN;
|
||||
m_iTrain = TrainSpeed( pTrain->pev->speed, pTrain->pev->impulse );
|
||||
m_iTrain = TrainSpeed( (int)pTrain->pev->speed, pTrain->pev->impulse );
|
||||
m_iTrain |= TRAIN_NEW;
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "plats/train_use1.wav", 0.8, ATTN_NORM );
|
||||
return;
|
||||
|
@ -1580,7 +1662,7 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
|
|||
|
||||
if( -score > pev->frags ) // Will this go negative?
|
||||
{
|
||||
score = -pev->frags; // Sum will be 0
|
||||
score = (int)( -pev->frags ); // Sum will be 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1589,7 +1671,7 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
|
|||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX( edict() ) );
|
||||
WRITE_SHORT( pev->frags );
|
||||
WRITE_SHORT( (int)pev->frags );
|
||||
WRITE_SHORT( m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( g_pGameRules->GetTeamIndex( m_szTeamName ) + 1 );
|
||||
|
@ -1651,8 +1733,8 @@ void CBasePlayer::UpdateStatusBar()
|
|||
// allies and medics get to see the targets health
|
||||
if( g_pGameRules->PlayerRelationship( this, pEntity ) == GR_TEAMMATE )
|
||||
{
|
||||
newSBarState[SBAR_ID_TARGETHEALTH] = 100 * ( pEntity->pev->health / pEntity->pev->max_health );
|
||||
newSBarState[SBAR_ID_TARGETARMOR] = pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max.
|
||||
newSBarState[SBAR_ID_TARGETHEALTH] = (int)( 100 * ( pEntity->pev->health / pEntity->pev->max_health ) );
|
||||
newSBarState[SBAR_ID_TARGETARMOR] = (int)pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max.
|
||||
}
|
||||
|
||||
m_flStatusBarDisappearDelay = gpGlobals->time + 1.0;
|
||||
|
@ -1747,6 +1829,16 @@ void CBasePlayer::PreThink( void )
|
|||
|
||||
CheckSuitUpdate();
|
||||
|
||||
// Observer Button Handling
|
||||
if( IsObserver() )
|
||||
{
|
||||
Observer_HandleButtons();
|
||||
Observer_CheckTarget();
|
||||
Observer_CheckProperties();
|
||||
pev->impulse = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if( pev->deadflag >= DEAD_DYING )
|
||||
{
|
||||
PlayerDeathThink();
|
||||
|
@ -1807,7 +1899,7 @@ void CBasePlayer::PreThink( void )
|
|||
|
||||
if( vel )
|
||||
{
|
||||
m_iTrain = TrainSpeed( pTrain->pev->speed, pTrain->pev->impulse );
|
||||
m_iTrain = TrainSpeed( (int)pTrain->pev->speed, pTrain->pev->impulse );
|
||||
m_iTrain |= TRAIN_ACTIVE|TRAIN_NEW;
|
||||
}
|
||||
}
|
||||
|
@ -1918,7 +2010,7 @@ void CBasePlayer::CheckTimeBasedDamage()
|
|||
int i;
|
||||
BYTE bDuration = 0;
|
||||
|
||||
static float gtbdPrev = 0.0;
|
||||
//static float gtbdPrev = 0.0;
|
||||
|
||||
if( !( m_bitsDamageType & DMG_TIMEBASED ) )
|
||||
return;
|
||||
|
@ -1957,7 +2049,7 @@ void CBasePlayer::CheckTimeBasedDamage()
|
|||
// after the player has been drowning and finally takes a breath
|
||||
if( m_idrowndmg > m_idrownrestored )
|
||||
{
|
||||
int idif = min( m_idrowndmg - m_idrownrestored, 10 );
|
||||
int idif = Q_min( m_idrowndmg - m_idrownrestored, 10 );
|
||||
|
||||
TakeHealth( idif, DMG_GENERIC );
|
||||
m_idrownrestored += idif;
|
||||
|
@ -2179,7 +2271,7 @@ void CBasePlayer::CheckSuitUpdate()
|
|||
// seconds, then we won't repeat playback of this word or sentence
|
||||
// for at least that number of seconds.
|
||||
|
||||
void CBasePlayer::SetSuitUpdate( char *name, int fgroup, int iNoRepeatTime )
|
||||
void CBasePlayer::SetSuitUpdate( const char *name, int fgroup, int iNoRepeatTime )
|
||||
{
|
||||
int i;
|
||||
int isentence;
|
||||
|
@ -2307,7 +2399,7 @@ void CBasePlayer::UpdatePlayerSound( void )
|
|||
// is louder than his body/movement, use the weapon volume, else, use the body volume.
|
||||
if( FBitSet( pev->flags, FL_ONGROUND ) )
|
||||
{
|
||||
iBodyVolume = pev->velocity.Length();
|
||||
iBodyVolume = (int)pev->velocity.Length();
|
||||
|
||||
// clamp the noise that can be made by the body, in case a push trigger,
|
||||
// weapon recoil, or anything shoves the player abnormally fast.
|
||||
|
@ -2340,7 +2432,7 @@ void CBasePlayer::UpdatePlayerSound( void )
|
|||
}
|
||||
|
||||
// decay weapon volume over time so bits_SOUND_COMBAT stays set for a while
|
||||
m_iWeaponVolume -= 250 * gpGlobals->frametime;
|
||||
m_iWeaponVolume -= (int)( 250 * gpGlobals->frametime );
|
||||
if( m_iWeaponVolume < 0 )
|
||||
{
|
||||
iVolume = 0;
|
||||
|
@ -2358,7 +2450,7 @@ void CBasePlayer::UpdatePlayerSound( void )
|
|||
}
|
||||
else if( iVolume > m_iTargetVolume )
|
||||
{
|
||||
iVolume -= 250 * gpGlobals->frametime;
|
||||
iVolume -= (int)( 250 * gpGlobals->frametime );
|
||||
|
||||
if( iVolume < m_iTargetVolume )
|
||||
{
|
||||
|
@ -2387,7 +2479,7 @@ void CBasePlayer::UpdatePlayerSound( void )
|
|||
}
|
||||
|
||||
// keep track of virtual muzzle flash
|
||||
m_iWeaponFlash -= 256 * gpGlobals->frametime;
|
||||
m_iWeaponFlash -= (int)( 256 * gpGlobals->frametime );
|
||||
if( m_iWeaponFlash < 0 )
|
||||
m_iWeaponFlash = 0;
|
||||
|
||||
|
@ -2409,7 +2501,7 @@ void CBasePlayer::PostThink()
|
|||
goto pt_end;
|
||||
|
||||
// Handle Tank controlling
|
||||
if( m_pTank != NULL )
|
||||
if( m_pTank != 0 )
|
||||
{
|
||||
// if they've moved too far from the gun, or selected a weapon, unuse the gun
|
||||
if( m_pTank->OnControls( pev ) && !pev->weaponmodel )
|
||||
|
@ -2420,7 +2512,6 @@ void CBasePlayer::PostThink()
|
|||
{
|
||||
// they've moved off the platform
|
||||
m_pTank->Use( this, this, USE_OFF, 0 );
|
||||
m_pTank = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2473,7 +2564,7 @@ void CBasePlayer::PostThink()
|
|||
{
|
||||
if( m_flFallVelocity > 64 && !g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
CSoundEnt::InsertSound( bits_SOUND_PLAYER, pev->origin, m_flFallVelocity, 0.2 );
|
||||
CSoundEnt::InsertSound( bits_SOUND_PLAYER, pev->origin, (int)m_flFallVelocity, 0.2 );
|
||||
// ALERT( at_console, "fall %f\n", m_flFallVelocity );
|
||||
}
|
||||
m_flFallVelocity = 0;
|
||||
|
@ -2494,11 +2585,15 @@ void CBasePlayer::PostThink()
|
|||
CheckPowerups( pev );
|
||||
|
||||
UpdatePlayerSound();
|
||||
pt_end:
|
||||
if( pev->deadflag == DEAD_NO )
|
||||
m_vecLastViewAngles = pev->angles;
|
||||
else
|
||||
pev->angles = m_vecLastViewAngles;
|
||||
|
||||
// Track button info so we can detect 'pressed' and 'released' buttons next frame
|
||||
m_afButtonLast = pev->button;
|
||||
|
||||
pt_end:
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
// Decay timers on weapons
|
||||
// go through all of the weapons and make a list of the ones to pack
|
||||
|
@ -2516,23 +2611,23 @@ pt_end:
|
|||
|
||||
if( gun && gun->UseDecrement() )
|
||||
{
|
||||
gun->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
|
||||
gun->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
|
||||
gun->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
|
||||
gun->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
|
||||
|
||||
if( gun->m_flTimeWeaponIdle != 1000 )
|
||||
{
|
||||
gun->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 );
|
||||
gun->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 );
|
||||
}
|
||||
|
||||
if( gun->pev->fuser1 != 1000 )
|
||||
{
|
||||
gun->pev->fuser1 = max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 );
|
||||
gun->pev->fuser1 = Q_max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 );
|
||||
}
|
||||
|
||||
// Only decrement if not flagged as NO_DECREMENT
|
||||
/*if( gun->m_flPumpTime != 1000 )
|
||||
{
|
||||
gun->m_flPumpTime = max( gun->m_flPumpTime - gpGlobals->frametime, -0.001 );
|
||||
gun->m_flPumpTime = Q_max( gun->m_flPumpTime - gpGlobals->frametime, -0.001 );
|
||||
}*/
|
||||
}
|
||||
|
||||
|
@ -3103,7 +3198,7 @@ void CSprayCan::Think( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
UTIL_PlayerDecalTrace( &tr, playernum, pev->frame, TRUE );
|
||||
UTIL_PlayerDecalTrace( &tr, playernum, (int)pev->frame, TRUE );
|
||||
// Just painted last custom frame.
|
||||
if( pev->frame++ >= ( nFrames - 1 ) )
|
||||
UTIL_Remove( this );
|
||||
|
@ -3550,19 +3645,23 @@ int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem )
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHolster )
|
||||
{
|
||||
pItem->pev->nextthink = 0;// crowbar may be trying to swing again, etc.
|
||||
pItem->SetThink( NULL );
|
||||
|
||||
if( m_pActiveItem == pItem )
|
||||
{
|
||||
ResetAutoaim();
|
||||
pItem->Holster();
|
||||
pItem->pev->nextthink = 0;// crowbar may be trying to swing again, etc.
|
||||
pItem->SetThink( NULL );
|
||||
if( bCallHolster )
|
||||
pItem->Holster();
|
||||
m_pActiveItem = NULL;
|
||||
pev->viewmodel = 0;
|
||||
pev->weaponmodel = 0;
|
||||
}
|
||||
else if( m_pLastItem == pItem )
|
||||
|
||||
// In some cases an item can be both the active and last item, like for instance dropping all weapons and only having an exhaustible weapon left. - Solokiller
|
||||
if( m_pLastItem == pItem )
|
||||
m_pLastItem = NULL;
|
||||
|
||||
CBasePlayerItem *pPrev = m_rgpPlayerItems[pItem->iItemSlot()];
|
||||
|
@ -3590,7 +3689,7 @@ int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem )
|
|||
//
|
||||
// Returns the unique ID for the ammo, or -1 if error
|
||||
//
|
||||
int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax )
|
||||
int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax )
|
||||
{
|
||||
if( !szName )
|
||||
{
|
||||
|
@ -3611,7 +3710,7 @@ int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax )
|
|||
if( i < 0 || i >= MAX_AMMO_SLOTS )
|
||||
return -1;
|
||||
|
||||
int iAdd = min( iCount, iMax - m_rgAmmo[i] );
|
||||
int iAdd = Q_min( iCount, iMax - m_rgAmmo[i] );
|
||||
if( iAdd < 1 )
|
||||
return i;
|
||||
|
||||
|
@ -3664,10 +3763,10 @@ Called every frame by the player PostThink
|
|||
*/
|
||||
void CBasePlayer::ItemPostFrame()
|
||||
{
|
||||
static int fInSelect = FALSE;
|
||||
//static int fInSelect = FALSE;
|
||||
|
||||
// check if the player is using a tank
|
||||
if( m_pTank != NULL )
|
||||
if( m_pTank != 0 )
|
||||
return;
|
||||
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
|
@ -3732,7 +3831,7 @@ void CBasePlayer::SendAmmoUpdate( void )
|
|||
// send "Ammo" update message
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev );
|
||||
WRITE_BYTE( i );
|
||||
WRITE_BYTE( max( min( m_rgAmmo[i], 254 ), 0 ) ); // clamp the value to one byte
|
||||
WRITE_BYTE( Q_max( Q_min( m_rgAmmo[i], 254 ), 0 ) ); // clamp the value to one byte
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
|
@ -3767,6 +3866,9 @@ void CBasePlayer::UpdateClientData( void )
|
|||
|
||||
g_pGameRules->InitHUD( this );
|
||||
m_fGameHUDInitialized = TRUE;
|
||||
|
||||
m_iObserverLastMode = OBS_ROAMING;
|
||||
|
||||
if( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
FireTargets( "game_playerjoin", this, this, USE_TOGGLE, 0 );
|
||||
|
@ -3775,6 +3877,12 @@ void CBasePlayer::UpdateClientData( void )
|
|||
|
||||
FireTargets( "game_playerspawn", this, this, USE_TOGGLE, 0 );
|
||||
|
||||
// Send flashlight status
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgFlashlight, NULL, pev );
|
||||
WRITE_BYTE( FlashlightIsOn() ? 1 : 0 );
|
||||
WRITE_BYTE( m_iFlashBattery );
|
||||
MESSAGE_END();
|
||||
|
||||
InitStatusBar();
|
||||
}
|
||||
|
||||
|
@ -3807,19 +3915,22 @@ void CBasePlayer::UpdateClientData( void )
|
|||
|
||||
if( pev->health != m_iClientHealth )
|
||||
{
|
||||
int iHealth = max( pev->health, 0 ); // make sure that no negative health values are sent
|
||||
#define clamp( val, min, max ) ( ((val) > (max)) ? (max) : ( ((val) < (min)) ? (min) : (val) ) )
|
||||
int iHealth = clamp( pev->health, 0, 255 ); // make sure that no negative health values are sent
|
||||
if( pev->health > 0.0f && pev->health <= 1.0f )
|
||||
iHealth = 1;
|
||||
|
||||
// send "health" update message
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, pev );
|
||||
WRITE_BYTE( iHealth );
|
||||
MESSAGE_END();
|
||||
|
||||
m_iClientHealth = pev->health;
|
||||
m_iClientHealth = (int)pev->health;
|
||||
}
|
||||
|
||||
if( pev->armorvalue != m_iClientBattery )
|
||||
{
|
||||
m_iClientBattery = pev->armorvalue;
|
||||
m_iClientBattery = (int)pev->armorvalue;
|
||||
|
||||
ASSERT( gmsgBattery > 0 );
|
||||
|
||||
|
@ -3847,8 +3958,8 @@ void CBasePlayer::UpdateClientData( void )
|
|||
int visibleDamageBits = m_bitsDamageType & DMG_SHOWNHUD;
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgDamage, NULL, pev );
|
||||
WRITE_BYTE( pev->dmg_save );
|
||||
WRITE_BYTE( pev->dmg_take );
|
||||
WRITE_BYTE( (int)pev->dmg_save );
|
||||
WRITE_BYTE( (int)pev->dmg_take );
|
||||
WRITE_LONG( visibleDamageBits );
|
||||
WRITE_COORD( damageOrigin.x );
|
||||
WRITE_COORD( damageOrigin.y );
|
||||
|
@ -3974,6 +4085,15 @@ void CBasePlayer::UpdateClientData( void )
|
|||
UpdateStatusBar();
|
||||
m_flNextSBarUpdateTime = gpGlobals->time + 0.2;
|
||||
}
|
||||
|
||||
// Send the current bhopcap state.
|
||||
if( !m_bSentBhopcap )
|
||||
{
|
||||
m_bSentBhopcap = true;
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgBhopcap, NULL, pev );
|
||||
WRITE_BYTE( g_bhopcap );
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -4113,8 +4233,8 @@ Vector CBasePlayer::GetAutoaimVector( float flDelta )
|
|||
{
|
||||
SET_CROSSHAIRANGLE( edict(), -m_vecAutoAim.x, m_vecAutoAim.y );
|
||||
|
||||
m_lastx = m_vecAutoAim.x;
|
||||
m_lasty = m_vecAutoAim.y;
|
||||
m_lastx = (int)m_vecAutoAim.x;
|
||||
m_lasty = (int)m_vecAutoAim.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4336,7 +4456,8 @@ void CBasePlayer::DropPlayerItem( char *pszItemName )
|
|||
// item we want to drop and hit a BREAK; pWeapon is the item.
|
||||
if( pWeapon )
|
||||
{
|
||||
g_pGameRules->GetNextBestWeapon( this, pWeapon );
|
||||
if( !g_pGameRules->GetNextBestWeapon( this, pWeapon ) )
|
||||
return; // can't drop the item they asked for, may be our last item or something we can't holster
|
||||
|
||||
UTIL_MakeVectors( pev->angles );
|
||||
|
||||
|
@ -4457,10 +4578,10 @@ public:
|
|||
void KeyValue( KeyValueData *pkvd );
|
||||
|
||||
int m_iPose;// which sequence to display -- temporary, don't need to save
|
||||
static char *m_szPoses[4];
|
||||
static const char *m_szPoses[4];
|
||||
};
|
||||
|
||||
char *CDeadHEV::m_szPoses[] =
|
||||
const char *CDeadHEV::m_szPoses[] =
|
||||
{
|
||||
"deadback",
|
||||
"deadsitting",
|
||||
|
@ -4602,7 +4723,7 @@ void CRevertSaved::KeyValue( KeyValueData *pkvd )
|
|||
|
||||
void CRevertSaved::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), pev->renderamt, FFADE_OUT );
|
||||
UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, FFADE_OUT );
|
||||
pev->nextthink = gpGlobals->time + MessageTime();
|
||||
SetThink( &CRevertSaved::MessageThink );
|
||||
}
|
||||
|
|
|
@ -86,6 +86,18 @@ enum sbar_data
|
|||
class CBasePlayer : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
// Spectator camera
|
||||
void Observer_FindNextPlayer( bool bReverse );
|
||||
void Observer_HandleButtons();
|
||||
void Observer_SetMode( int iMode );
|
||||
void Observer_CheckTarget();
|
||||
void Observer_CheckProperties();
|
||||
EHANDLE m_hObserverTarget;
|
||||
float m_flNextObserverInput;
|
||||
int m_iObserverWeapon; // weapon of current tracked target
|
||||
int m_iObserverLastMode;// last used observer mode
|
||||
int IsObserver() { return pev->iuser1; };
|
||||
|
||||
int random_seed; // See that is shared between client & server for shared weapons code
|
||||
|
||||
int m_iPlayerSound;// the index of the sound list slot reserved for this player
|
||||
|
@ -243,11 +255,12 @@ public:
|
|||
|
||||
void StartDeathCam( void );
|
||||
void StartObserver( Vector vecPosition, Vector vecViewAngle );
|
||||
void StopObserver();
|
||||
|
||||
void AddPoints( int score, BOOL bAllowNegativeScore );
|
||||
void AddPointsToTeam( int score, BOOL bAllowNegativeScore );
|
||||
BOOL AddPlayerItem( CBasePlayerItem *pItem );
|
||||
BOOL RemovePlayerItem( CBasePlayerItem *pItem );
|
||||
BOOL RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHoster );
|
||||
void DropPlayerItem ( char *pszItemName );
|
||||
BOOL HasPlayerItem( CBasePlayerItem *pCheckItem );
|
||||
BOOL HasNamedPlayerItem( const char *pszItemName );
|
||||
|
@ -261,7 +274,7 @@ public:
|
|||
void GiveNamedItem( const char *szName );
|
||||
void EnableControl(BOOL fControl);
|
||||
|
||||
int GiveAmmo( int iAmount, char *szName, int iMax );
|
||||
int GiveAmmo( int iAmount, const char *szName, int iMax );
|
||||
void SendAmmoUpdate(void);
|
||||
|
||||
void WaterMove( void );
|
||||
|
@ -269,7 +282,7 @@ public:
|
|||
void PlayerUse( void );
|
||||
|
||||
void CheckSuitUpdate();
|
||||
void SetSuitUpdate(char *name, int fgroup, int iNoRepeat);
|
||||
void SetSuitUpdate( const char *name, int fgroup, int iNoRepeat );
|
||||
void UpdateGeigerCounter( void );
|
||||
void CheckTimeBasedDamage( void );
|
||||
|
||||
|
@ -293,6 +306,8 @@ public:
|
|||
|
||||
void TabulateAmmo( void );
|
||||
|
||||
Vector m_vecLastViewAngles;
|
||||
|
||||
float m_flStartCharge;
|
||||
float m_flAmmoStartCharge;
|
||||
float m_flPlayAftershock;
|
||||
|
@ -301,13 +316,15 @@ public:
|
|||
//Player ID
|
||||
void InitStatusBar( void );
|
||||
void UpdateStatusBar( void );
|
||||
int m_izSBarState[ SBAR_END ];
|
||||
int m_izSBarState[SBAR_END];
|
||||
float m_flNextSBarUpdateTime;
|
||||
float m_flStatusBarDisappearDelay;
|
||||
char m_SbarString0[ SBAR_STRING_SIZE ];
|
||||
char m_SbarString1[ SBAR_STRING_SIZE ];
|
||||
char m_SbarString0[SBAR_STRING_SIZE];
|
||||
char m_SbarString1[SBAR_STRING_SIZE];
|
||||
|
||||
float m_flNextChatTime;
|
||||
|
||||
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
|
||||
};
|
||||
|
||||
#define AUTOAIM_2DEGREES 0.0348994967025
|
||||
|
@ -315,7 +332,7 @@ public:
|
|||
#define AUTOAIM_8DEGREES 0.1391731009601
|
||||
#define AUTOAIM_10DEGREES 0.1736481776669
|
||||
|
||||
extern int gmsgHudText;
|
||||
extern int gmsgHudText;
|
||||
extern BOOL gInitHUD;
|
||||
|
||||
#endif // PLAYER_H
|
||||
|
|
|
@ -248,7 +248,7 @@ void CProp::MaterialSoundPrecache( Materials precacheMaterial )
|
|||
|
||||
for( i = 0; i < soundCount; i++ )
|
||||
{
|
||||
PRECACHE_SOUND( (char *)pSoundList[i] );
|
||||
PRECACHE_SOUND( pSoundList[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,8 +327,8 @@ void CProp::Precache( void )
|
|||
if( m_iszGibModel )
|
||||
pGibName = STRING( m_iszGibModel );
|
||||
|
||||
m_idShard = PRECACHE_MODEL( (char *)pGibName );
|
||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
||||
m_idShard = PRECACHE_MODEL( pGibName );
|
||||
PRECACHE_MODEL( STRING( pev->model ) );
|
||||
}
|
||||
|
||||
void CProp::DamageSound( void )
|
||||
|
|
|
@ -169,7 +169,7 @@ void CPython::PrimaryAttack()
|
|||
Reload();
|
||||
else
|
||||
{
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/357_cock1.wav", 0.8, ATTN_NORM );
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ void CPython::PrimaryAttack()
|
|||
|
||||
void CPython::Reload( void )
|
||||
{
|
||||
if( m_pPlayer->ammo_357 <= 0 )
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == PYTHON_MAX_CLIP )
|
||||
return;
|
||||
|
||||
if( m_pPlayer->pev->fov != 0 )
|
||||
|
@ -227,7 +227,7 @@ void CPython::Reload( void )
|
|||
#else
|
||||
bUseScope = g_pGameRules->IsMultiplayer();
|
||||
#endif
|
||||
if( DefaultReload( 6, PYTHON_RELOAD, 2.0, bUseScope ) )
|
||||
if( DefaultReload( PYTHON_MAX_CLIP, PYTHON_RELOAD, 2.0, bUseScope ) )
|
||||
{
|
||||
m_flSoundDelay = 1.5;
|
||||
}
|
||||
|
|
32
dlls/rpg.cpp
32
dlls/rpg.cpp
|
@ -109,8 +109,8 @@ CRpgRocket *CRpgRocket::CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBa
|
|||
pRocket->pev->angles = vecAngles;
|
||||
pRocket->Spawn();
|
||||
pRocket->SetTouch( &CRpgRocket::RocketTouch );
|
||||
pRocket->m_pLauncher = pLauncher;// remember what RPG fired me.
|
||||
pRocket->m_pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
|
||||
pRocket->m_hLauncher = pLauncher;// remember what RPG fired me.
|
||||
pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
|
||||
pRocket->pev->owner = pOwner->edict();
|
||||
|
||||
return pRocket;
|
||||
|
@ -150,10 +150,10 @@ void CRpgRocket::Spawn( void )
|
|||
//=========================================================
|
||||
void CRpgRocket::RocketTouch( CBaseEntity *pOther )
|
||||
{
|
||||
if( m_pLauncher )
|
||||
if( CRpg* pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) )
|
||||
{
|
||||
// my launcher is still around, tell it I'm dead.
|
||||
m_pLauncher->m_cActiveRockets--;
|
||||
pLauncher->m_cActiveRockets--;
|
||||
}
|
||||
|
||||
STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );
|
||||
|
@ -265,6 +265,11 @@ void CRpgRocket::FollowThink( void )
|
|||
pev->velocity = pev->velocity * 0.2 + vecTarget * flSpeed * 0.798;
|
||||
if( pev->waterlevel == 0 && pev->velocity.Length() < 1500 )
|
||||
{
|
||||
if( CRpg *pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) )
|
||||
{
|
||||
// my launcher is still around, tell it I'm dead.
|
||||
pLauncher->m_cActiveRockets--;
|
||||
}
|
||||
Detonate();
|
||||
}
|
||||
}
|
||||
|
@ -278,13 +283,8 @@ void CRpg::Reload( void )
|
|||
{
|
||||
int iResult = 0;
|
||||
|
||||
if( m_iClip == 1 )
|
||||
{
|
||||
// don't bother with any of this if don't need to reload.
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_pPlayer->ammo_rockets <= 0 )
|
||||
// don't bother with any of this if don't need to reload.
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == RPG_MAX_CLIP )
|
||||
return;
|
||||
|
||||
// because the RPG waits to autoreload when no missiles are active while the LTD is on, the
|
||||
|
@ -297,7 +297,7 @@ void CRpg::Reload( void )
|
|||
// Set the next attack time into the future so that WeaponIdle will get called more often
|
||||
// than reload, allowing the RPG LTD to be updated
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
|
||||
if( m_cActiveRockets && m_fSpotActive )
|
||||
{
|
||||
|
@ -463,8 +463,10 @@ void CRpg::PrimaryAttack()
|
|||
|
||||
m_iClip--;
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.5;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 1.5 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
|
||||
|
||||
ResetEmptySound();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -492,13 +494,13 @@ void CRpg::WeaponIdle( void )
|
|||
{
|
||||
UpdateSpot();
|
||||
|
||||
ResetEmptySound();
|
||||
|
||||
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
|
||||
{
|
||||
ResetEmptySound();
|
||||
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
|
||||
if( flRand <= 0.75 || m_fSpotActive )
|
||||
|
|
103
dlls/satchel.cpp
103
dlls/satchel.cpp
|
@ -23,6 +23,13 @@
|
|||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
enum satchel_state
|
||||
{
|
||||
SATCHEL_IDLE = 0,
|
||||
SATCHEL_READY,
|
||||
SATCHEL_RELOAD
|
||||
};
|
||||
|
||||
enum satchel_e
|
||||
{
|
||||
SATCHEL_IDLE1 = 0,
|
||||
|
@ -42,6 +49,7 @@ enum satchel_radio_e
|
|||
|
||||
class CSatchelCharge : public CGrenade
|
||||
{
|
||||
Vector m_lastBounceOrigin; // Used to fix a bug in engine: when object isn't moving, but its speed isn't 0 and on ground isn't set
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void BounceSound( void );
|
||||
|
@ -92,7 +100,7 @@ void CSatchelCharge::Spawn( void )
|
|||
|
||||
void CSatchelCharge::SatchelSlide( CBaseEntity *pOther )
|
||||
{
|
||||
entvars_t *pevOther = pOther->pev;
|
||||
//entvars_t *pevOther = pOther->pev;
|
||||
|
||||
// don't hit the guy that launched this grenade
|
||||
if( pOther->edict() == pev->owner )
|
||||
|
@ -114,14 +122,19 @@ void CSatchelCharge::SatchelSlide( CBaseEntity *pOther )
|
|||
}
|
||||
if( !( pev->flags & FL_ONGROUND ) && pev->velocity.Length2D() > 10 )
|
||||
{
|
||||
// Fix for a bug in engine: when object isn't moving, but its speed isn't 0 and on ground isn't set
|
||||
if( pev->origin != m_lastBounceOrigin )
|
||||
BounceSound();
|
||||
}
|
||||
StudioFrameAdvance();
|
||||
m_lastBounceOrigin = pev->origin;
|
||||
// There is no model animation so commented this out to prevent net traffic
|
||||
// StudioFrameAdvance();
|
||||
}
|
||||
|
||||
void CSatchelCharge::SatchelThink( void )
|
||||
{
|
||||
StudioFrameAdvance();
|
||||
// There is no model animation so commented this out to prevent net traffic
|
||||
// StudioFrameAdvance();
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if( !IsInWorld() )
|
||||
|
@ -149,7 +162,7 @@ void CSatchelCharge::SatchelThink( void )
|
|||
|
||||
void CSatchelCharge::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL( "models/grenade.mdl" );
|
||||
PRECACHE_MODEL( "models/w_satchel.mdl" );
|
||||
PRECACHE_SOUND( "weapons/g_bounce1.wav" );
|
||||
PRECACHE_SOUND( "weapons/g_bounce2.wav" );
|
||||
PRECACHE_SOUND( "weapons/g_bounce3.wav" );
|
||||
|
@ -188,7 +201,7 @@ int CSatchel::AddDuplicate( CBasePlayerItem *pOriginal )
|
|||
{
|
||||
pSatchel = (CSatchel *)pOriginal;
|
||||
|
||||
if( pSatchel->m_chargeReady != 0 )
|
||||
if( pSatchel->m_chargeReady != SATCHEL_IDLE )
|
||||
{
|
||||
// player has some satchels deployed. Refuse to add more.
|
||||
return FALSE;
|
||||
|
@ -205,7 +218,7 @@ int CSatchel::AddToPlayer( CBasePlayer *pPlayer )
|
|||
int bResult = CBasePlayerItem::AddToPlayer( pPlayer );
|
||||
|
||||
pPlayer->pev->weapons |= ( 1 << m_iId );
|
||||
m_chargeReady = 0;// this satchel charge weapon now forgets that any satchels are deployed by it.
|
||||
m_chargeReady = SATCHEL_IDLE;// this satchel charge weapon now forgets that any satchels are deployed by it.
|
||||
|
||||
if( bResult )
|
||||
{
|
||||
|
@ -257,19 +270,7 @@ int CSatchel::GetItemInfo( ItemInfo *p )
|
|||
//=========================================================
|
||||
BOOL CSatchel::IsUseable( void )
|
||||
{
|
||||
if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] > 0 )
|
||||
{
|
||||
// player is carrying some satchels
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if( m_chargeReady != 0 )
|
||||
{
|
||||
// player isn't carrying any satchels, but has some out
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return CanDeploy();
|
||||
}
|
||||
|
||||
BOOL CSatchel::CanDeploy( void )
|
||||
|
@ -280,7 +281,7 @@ BOOL CSatchel::CanDeploy( void )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if( m_chargeReady != 0 )
|
||||
if( m_chargeReady )
|
||||
{
|
||||
// player isn't carrying any satchels, but has some out
|
||||
return TRUE;
|
||||
|
@ -316,11 +317,10 @@ void CSatchel::Holster( int skiplocal /* = 0 */ )
|
|||
}
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
|
||||
|
||||
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && !m_chargeReady )
|
||||
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && m_chargeReady != SATCHEL_READY )
|
||||
{
|
||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_SATCHEL );
|
||||
SetThink( &CBasePlayerItem::DestroyItem );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
DestroyItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,38 +328,37 @@ void CSatchel::PrimaryAttack()
|
|||
{
|
||||
switch( m_chargeReady )
|
||||
{
|
||||
case 0:
|
||||
case SATCHEL_IDLE:
|
||||
{
|
||||
Throw();
|
||||
Throw();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case SATCHEL_READY:
|
||||
{
|
||||
SendWeaponAnim( SATCHEL_RADIO_FIRE );
|
||||
SendWeaponAnim( SATCHEL_RADIO_FIRE );
|
||||
|
||||
edict_t *pPlayer = m_pPlayer->edict();
|
||||
edict_t *pPlayer = m_pPlayer->edict();
|
||||
|
||||
CBaseEntity *pSatchel = NULL;
|
||||
CBaseEntity *pSatchel = NULL;
|
||||
|
||||
while( ( pSatchel = UTIL_FindEntityInSphere( pSatchel, m_pPlayer->pev->origin, 4096 ) ) != NULL )
|
||||
{
|
||||
if( FClassnameIs( pSatchel->pev, "monster_satchel" ) )
|
||||
while( ( pSatchel = UTIL_FindEntityInSphere( pSatchel, m_pPlayer->pev->origin, 4096 ) ) != NULL )
|
||||
{
|
||||
if( pSatchel->pev->owner == pPlayer )
|
||||
if( FClassnameIs( pSatchel->pev, "monster_satchel" ) )
|
||||
{
|
||||
pSatchel->Use( m_pPlayer, m_pPlayer, USE_ON, 0 );
|
||||
m_chargeReady = 2;
|
||||
if( pSatchel->pev->owner == pPlayer )
|
||||
{
|
||||
pSatchel->Use( m_pPlayer, m_pPlayer, USE_ON, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_chargeReady = 2;
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
break;
|
||||
m_chargeReady = SATCHEL_RELOAD;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case SATCHEL_RELOAD:
|
||||
// we're reloading, don't allow fire
|
||||
break;
|
||||
}
|
||||
|
@ -367,7 +366,7 @@ void CSatchel::PrimaryAttack()
|
|||
|
||||
void CSatchel::SecondaryAttack( void )
|
||||
{
|
||||
if( m_chargeReady != 2 )
|
||||
if( m_chargeReady != SATCHEL_RELOAD )
|
||||
{
|
||||
Throw();
|
||||
}
|
||||
|
@ -377,11 +376,11 @@ void CSatchel::Throw( void )
|
|||
{
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
Vector vecSrc = m_pPlayer->pev->origin;
|
||||
|
||||
Vector vecThrow = gpGlobals->v_forward * 274 + m_pPlayer->pev->velocity;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
CBaseEntity *pSatchel = Create( "monster_satchel", vecSrc, Vector( 0, 0, 0 ), m_pPlayer->edict() );
|
||||
pSatchel->pev->velocity = vecThrow;
|
||||
pSatchel->pev->avelocity.y = 400;
|
||||
|
@ -397,11 +396,11 @@ void CSatchel::Throw( void )
|
|||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
m_chargeReady = 1;
|
||||
|
||||
m_chargeReady = SATCHEL_READY;
|
||||
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 1.0 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
}
|
||||
}
|
||||
|
@ -413,17 +412,17 @@ void CSatchel::WeaponIdle( void )
|
|||
|
||||
switch( m_chargeReady )
|
||||
{
|
||||
case 0:
|
||||
case SATCHEL_IDLE:
|
||||
SendWeaponAnim( SATCHEL_FIDGET1 );
|
||||
// use tripmine animations
|
||||
strcpy( m_pPlayer->m_szAnimExtention, "trip" );
|
||||
break;
|
||||
case 1:
|
||||
case SATCHEL_READY:
|
||||
SendWeaponAnim( SATCHEL_RADIO_FIDGET1 );
|
||||
// use hivehand animations
|
||||
strcpy( m_pPlayer->m_szAnimExtention, "hive" );
|
||||
break;
|
||||
case 2:
|
||||
case SATCHEL_RELOAD:
|
||||
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
|
||||
{
|
||||
m_chargeReady = 0;
|
||||
|
@ -442,9 +441,9 @@ void CSatchel::WeaponIdle( void )
|
|||
// use tripmine animations
|
||||
strcpy( m_pPlayer->m_szAnimExtention, "trip" );
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_chargeReady = 0;
|
||||
m_chargeReady = SATCHEL_IDLE;
|
||||
break;
|
||||
}
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
|
||||
|
|
|
@ -23,7 +23,7 @@ class CSaveRestoreBuffer
|
|||
public:
|
||||
CSaveRestoreBuffer( void );
|
||||
CSaveRestoreBuffer( SAVERESTOREDATA *pdata );
|
||||
~CSaveRestoreBuffer( void );
|
||||
virtual ~CSaveRestoreBuffer( void );
|
||||
|
||||
int EntityIndex( entvars_t *pevLookup );
|
||||
int EntityIndex( edict_t *pentLookup );
|
||||
|
@ -41,6 +41,10 @@ protected:
|
|||
SAVERESTOREDATA *m_pdata;
|
||||
void BufferRewind( int size );
|
||||
unsigned int HashString( const char *pszToken );
|
||||
private:
|
||||
// effc++ rule 11
|
||||
void operator = ( CSaveRestoreBuffer& );
|
||||
CSaveRestoreBuffer( const CSaveRestoreBuffer& );
|
||||
};
|
||||
|
||||
class CSave : public CSaveRestoreBuffer
|
||||
|
@ -81,7 +85,7 @@ typedef struct
|
|||
class CRestore : public CSaveRestoreBuffer
|
||||
{
|
||||
public:
|
||||
CRestore( SAVERESTOREDATA *pdata ) : CSaveRestoreBuffer( pdata ) { m_global = 0; m_precache = TRUE; }
|
||||
CRestore( SAVERESTOREDATA *pdata ) : CSaveRestoreBuffer( pdata ), m_global(0), m_precache( TRUE ) { }
|
||||
int ReadEntVars( const char *pname, entvars_t *pev ); // entvars_t
|
||||
int ReadFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );
|
||||
int ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount, int startField, int size, char *pName, void *pData );
|
||||
|
@ -160,6 +164,9 @@ private:
|
|||
globalentity_t *Find( string_t globalname );
|
||||
globalentity_t *m_pList;
|
||||
int m_listCount;
|
||||
// effc++ rule 11
|
||||
void operator = ( CGlobalState& );
|
||||
CGlobalState( const CGlobalState& );
|
||||
};
|
||||
|
||||
extern CGlobalState gGlobalState;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue