mirror of https://github.com/FWGS/hlsdk-xash3d
Merge remote-tracking branch 'origin/monster_player' into decay-pc
This commit is contained in:
commit
bdf3bc310a
|
@ -13,7 +13,6 @@ LOCAL_MODULE := client
|
||||||
#else
|
#else
|
||||||
APP_PLATFORM := android-8
|
APP_PLATFORM := android-8
|
||||||
#endif
|
#endif
|
||||||
LOCAL_CONLYFLAGS += -std=c99
|
|
||||||
|
|
||||||
include $(XASH3D_CONFIG)
|
include $(XASH3D_CONFIG)
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ SRCS+=./input_xash3d.cpp
|
||||||
SRCS+=./scoreboard.cpp
|
SRCS+=./scoreboard.cpp
|
||||||
SRCS+=./MOTD.cpp
|
SRCS+=./MOTD.cpp
|
||||||
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
|
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
|
||||||
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w
|
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
|
||||||
$(LOCAL_PATH)/../common \
|
$(LOCAL_PATH)/../common \
|
||||||
|
|
|
@ -103,7 +103,7 @@ int CHudMOTD::Draw( float fTime )
|
||||||
|
|
||||||
// find where to start drawing the line
|
// find where to start drawing the line
|
||||||
if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) )
|
if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) )
|
||||||
gHUD.DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 );
|
DrawUtfString( xpos, ypos, xmax, ch, 255, 180, 0 );
|
||||||
|
|
||||||
ypos += LINE_HEIGHT;
|
ypos += LINE_HEIGHT;
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
|
||||||
BEGIN_READ( pbuf, iSize );
|
BEGIN_READ( pbuf, iSize );
|
||||||
|
|
||||||
int is_finished = READ_BYTE();
|
int is_finished = READ_BYTE();
|
||||||
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) );
|
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - 1 );
|
||||||
|
|
||||||
if( is_finished )
|
if( is_finished )
|
||||||
{
|
{
|
||||||
|
|
|
@ -305,6 +305,9 @@ void CHudAmmo::Reset( void )
|
||||||
gHR.Reset();
|
gHR.Reset();
|
||||||
|
|
||||||
//VidInit();
|
//VidInit();
|
||||||
|
wrect_t nullrc = {0,};
|
||||||
|
SetCrosshair( 0, nullrc, 0, 0, 0 ); // reset crosshair
|
||||||
|
m_pWeapon = NULL; // reset last weapon
|
||||||
}
|
}
|
||||||
|
|
||||||
int CHudAmmo::VidInit( void )
|
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 ) )
|
if( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
|
||||||
{
|
{
|
||||||
static wrect_t nullrc;
|
wrect_t nullrc = {0,};
|
||||||
gpActiveSel = NULL;
|
gpActiveSel = NULL;
|
||||||
SetCrosshair( 0, nullrc, 0, 0, 0 );
|
SetCrosshair( 0, nullrc, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_pWeapon )
|
if( m_pWeapon )
|
||||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
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 )
|
int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
||||||
{
|
{
|
||||||
static wrect_t nullrc;
|
wrect_t nullrc = {0,};
|
||||||
int fOnTarget = FALSE;
|
int fOnTarget = FALSE;
|
||||||
|
|
||||||
BEGIN_READ( pbuf, iSize );
|
BEGIN_READ( pbuf, iSize );
|
||||||
|
@ -574,6 +577,8 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
||||||
if( iId < 1 )
|
if( iId < 1 )
|
||||||
{
|
{
|
||||||
SetCrosshair( 0, nullrc, 0, 0, 0 );
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,22 +609,24 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
||||||
|
|
||||||
m_pWeapon = pWeapon;
|
m_pWeapon = pWeapon;
|
||||||
|
|
||||||
if( gHUD.m_iFOV >= 90 )
|
if( !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
|
||||||
{
|
{
|
||||||
// normal crosshairs
|
if( gHUD.m_iFOV >= 90 )
|
||||||
if( fOnTarget && m_pWeapon->hAutoaim )
|
{
|
||||||
SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 );
|
// 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
|
else
|
||||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
{
|
||||||
}
|
// zoomed crosshairs
|
||||||
else
|
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
|
||||||
{
|
SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 );
|
||||||
// zoomed crosshairs
|
else
|
||||||
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
|
SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 );
|
||||||
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; //!!!
|
m_fFade = 200.0f; //!!!
|
||||||
|
@ -877,11 +884,11 @@ int CHudAmmo::Draw( float flTime )
|
||||||
x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth;
|
x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth;
|
||||||
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b );
|
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b );
|
||||||
|
|
||||||
wrect_t rc;
|
/*wrect_t rc;
|
||||||
rc.top = 0;
|
rc.top = 0;
|
||||||
rc.left = 0;
|
rc.left = 0;
|
||||||
rc.right = AmmoWidth;
|
rc.right = AmmoWidth;
|
||||||
rc.bottom = 100;
|
rc.bottom = 100;*/
|
||||||
|
|
||||||
int iBarWidth = AmmoWidth / 10;
|
int iBarWidth = AmmoWidth / 10;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "hud.h"
|
#include "hud.h"
|
||||||
#include "cl_util.h"
|
#include "cl_util.h"
|
||||||
#include "netadr.h"
|
#include "netadr.h"
|
||||||
|
#include "parsemsg.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -32,10 +33,21 @@ extern "C"
|
||||||
cl_enginefunc_t gEngfuncs;
|
cl_enginefunc_t gEngfuncs;
|
||||||
CHud gHUD;
|
CHud gHUD;
|
||||||
mobile_engfuncs_t *gMobileEngfuncs = NULL;
|
mobile_engfuncs_t *gMobileEngfuncs = NULL;
|
||||||
|
|
||||||
|
extern "C" int g_bhopcap;
|
||||||
void InitInput( void );
|
void InitInput( void );
|
||||||
void EV_HookEvents( void );
|
void EV_HookEvents( void );
|
||||||
void IN_Commands( 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
|
Initialize
|
||||||
|
@ -76,18 +88,18 @@ int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs )
|
||||||
switch( hullnumber )
|
switch( hullnumber )
|
||||||
{
|
{
|
||||||
case 0: // Normal player
|
case 0: // Normal player
|
||||||
mins = Vector( -16, -16, -36 );
|
Vector( -16, -16, -36 ).CopyToArray(mins);
|
||||||
maxs = Vector( 16, 16, 36 );
|
Vector( 16, 16, 36 ).CopyToArray(maxs);
|
||||||
iret = 1;
|
iret = 1;
|
||||||
break;
|
break;
|
||||||
case 1: // Crouched player
|
case 1: // Crouched player
|
||||||
mins = Vector( -16, -16, -18 );
|
Vector( -16, -16, -18 ).CopyToArray(mins);
|
||||||
maxs = Vector( 16, 16, 18 );
|
Vector( 16, 16, 18 ).CopyToArray(maxs);
|
||||||
iret = 1;
|
iret = 1;
|
||||||
break;
|
break;
|
||||||
case 2: // Point based hull
|
case 2: // Point based hull
|
||||||
mins = Vector( 0, 0, 0 );
|
Vector( 0, 0, 0 ).CopyToArray(mins);
|
||||||
maxs = Vector( 0, 0, 0 );
|
Vector( 0, 0, 0 ).CopyToArray(maxs);
|
||||||
iret = 1;
|
iret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -196,6 +208,8 @@ void DLLEXPORT HUD_Init( void )
|
||||||
{
|
{
|
||||||
InitInput();
|
InitInput();
|
||||||
gHUD.Init();
|
gHUD.Init();
|
||||||
|
|
||||||
|
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -41,6 +41,10 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
||||||
#include "exportdef.h"
|
#include "exportdef.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||||
|
#define XASH_64BIT
|
||||||
|
#endif
|
||||||
|
|
||||||
extern cl_enginefunc_t gEngfuncs;
|
extern cl_enginefunc_t gEngfuncs;
|
||||||
#include "../engine/mobility_int.h"
|
#include "../engine/mobility_int.h"
|
||||||
extern mobile_engfuncs_t *gMobileEngfuncs;
|
extern mobile_engfuncs_t *gMobileEngfuncs;
|
||||||
|
|
|
@ -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_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 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 client_textmessage_t *TextMessageGet( const char *pName )
|
||||||
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
{
|
||||||
|
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 );
|
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
|
||||||
}
|
}
|
||||||
|
@ -115,6 +119,8 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
||||||
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
|
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b );
|
||||||
|
|
||||||
inline int ConsoleStringLen( const char *string )
|
inline int ConsoleStringLen( const char *string )
|
||||||
{
|
{
|
||||||
int _width = 0, _height = 0;
|
int _width = 0, _height = 0;
|
||||||
|
@ -138,7 +144,7 @@ inline void CenterPrint( const char *string )
|
||||||
#define GetPlayerInfo ( *gEngfuncs.pfnGetPlayerInfo )
|
#define GetPlayerInfo ( *gEngfuncs.pfnGetPlayerInfo )
|
||||||
|
|
||||||
// sound functions
|
// 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 ); }
|
inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); }
|
||||||
|
|
||||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
|
@ -41,12 +41,12 @@ COM_Log
|
||||||
Log debug messages to file ( appends )
|
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;
|
va_list argptr;
|
||||||
char string[1024];
|
char string[1024];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *pfilename;
|
const char *pfilename;
|
||||||
|
|
||||||
if( !pszFile )
|
if( !pszFile )
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ HUD_PlaySound
|
||||||
Play a sound, if we are seeing this command for the first time
|
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 )
|
if( !g_runfuncs || !g_finalstate )
|
||||||
return;
|
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.
|
is compiled into both game and client .dlls.
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
int stub_PrecacheModel( char* s )
|
int stub_PrecacheModel( const char* s )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stub_PrecacheSound( char* s )
|
int stub_PrecacheSound( const char* s )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *stub_NameForFunction( unsigned long function )
|
const char *stub_NameForFunction( void *function )
|
||||||
{
|
{
|
||||||
return "func";
|
return "func";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -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 _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 );
|
int CL_IsDead( void );
|
||||||
|
|
||||||
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
|
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
|
||||||
|
@ -28,13 +28,13 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
|
||||||
|
|
||||||
int HUD_GetWeaponAnim( void );
|
int HUD_GetWeaponAnim( void );
|
||||||
void HUD_SendWeaponAnim( int iAnim, int body, int force );
|
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_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 );
|
void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
|
||||||
int stub_PrecacheModel( char* s );
|
int stub_PrecacheModel( const char* s );
|
||||||
int stub_PrecacheSound( char* s );
|
int stub_PrecacheSound( const char* s );
|
||||||
unsigned short stub_PrecacheEvent( int type, const char *s );
|
unsigned short stub_PrecacheEvent( int type, const char *s );
|
||||||
const char *stub_NameForFunction( unsigned long function );
|
const char *stub_NameForFunction( void *function );
|
||||||
void stub_SetModel( struct edict_s *e, const char *m );
|
void stub_SetModel( struct edict_s *e, const char *m );
|
||||||
|
|
||||||
extern cvar_t *cl_lw;
|
extern cvar_t *cl_lw;
|
||||||
|
|
|
@ -187,7 +187,8 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
||||||
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
||||||
|
|
||||||
// Get the Killer's name
|
// 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 )
|
if( !killer_name )
|
||||||
{
|
{
|
||||||
killer_name = "";
|
killer_name = "";
|
||||||
|
@ -201,11 +202,11 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Victim's name
|
// 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 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;
|
victim_name = g_PlayerInfoList[victim].name;
|
||||||
if ( !victim_name )
|
if( !victim_name )
|
||||||
{
|
{
|
||||||
victim_name = "";
|
victim_name = "";
|
||||||
rgDeathNoticeList[i].szVictim[0] = 0;
|
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?
|
// Is it a non-player object kill?
|
||||||
if ( ( (char)victim ) == -1 )
|
if( ( (char)victim ) == -1 )
|
||||||
{
|
{
|
||||||
rgDeathNoticeList[i].iNonPlayerKill = TRUE;
|
rgDeathNoticeList[i].iNonPlayerKill = TRUE;
|
||||||
|
|
||||||
|
@ -227,10 +228,10 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( killer == victim || killer == 0 )
|
if( killer == victim || killer == 0 )
|
||||||
rgDeathNoticeList[i].iSuicide = TRUE;
|
rgDeathNoticeList[i].iSuicide = TRUE;
|
||||||
|
|
||||||
if ( !strcmp( killedwith, "d_teammate" ) )
|
if( !strcmp( killedwith, "d_teammate" ) )
|
||||||
rgDeathNoticeList[i].iTeamKill = TRUE;
|
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
|
// replace the code names with the 'real' names
|
||||||
if( !strcmp( killedwith + 2, "egon" ) )
|
if( !strcmp( killedwith + 2, "egon" ) )
|
||||||
strcpy( killedwith, "d_gluon gun" );
|
strcpy( killedwith, "d_gluon gun" );
|
||||||
if ( !strcmp( killedwith + 2, "gauss" ) )
|
if( !strcmp( killedwith + 2, "gauss" ) )
|
||||||
strcpy( killedwith, "d_tau cannon" );
|
strcpy( killedwith, "d_tau cannon" );
|
||||||
|
|
||||||
ConsolePrint( killedwith + 2 ); // skip over the "d_" part
|
ConsolePrint( killedwith + 2 ); // skip over the "d_" part
|
||||||
|
|
|
@ -585,10 +585,10 @@ void DLLEXPORT HUD_TempEntUpdate (
|
||||||
static int gTempEntFrame = 0;
|
static int gTempEntFrame = 0;
|
||||||
int i;
|
int i;
|
||||||
TEMPENTITY *pTemp, *pnext, *pprev;
|
TEMPENTITY *pTemp, *pnext, *pprev;
|
||||||
float freq, gravity, gravitySlow, life, fastFreq;
|
float /*freq,*/ gravity, gravitySlow, life, fastFreq;
|
||||||
|
|
||||||
// Nothing to simulate
|
// Nothing to simulate
|
||||||
if ( !*ppTempEntActive )
|
if( !*ppTempEntActive )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// in order to have tents collide with players, we have to run the player prediction code so
|
// in order to have tents collide with players, we have to run the player prediction code so
|
||||||
|
@ -623,7 +623,7 @@ void DLLEXPORT HUD_TempEntUpdate (
|
||||||
}
|
}
|
||||||
|
|
||||||
pprev = NULL;
|
pprev = NULL;
|
||||||
freq = client_time * 0.01;
|
//freq = client_time * 0.01;
|
||||||
fastFreq = client_time * 5.5;
|
fastFreq = client_time * 5.5;
|
||||||
gravity = -frametime * cl_gravity;
|
gravity = -frametime * cl_gravity;
|
||||||
gravitySlow = gravity * 0.5;
|
gravitySlow = gravity * 0.5;
|
||||||
|
@ -709,12 +709,12 @@ void DLLEXPORT HUD_TempEntUpdate (
|
||||||
}
|
}
|
||||||
else if( pTemp->flags & FTENT_SPIRAL )
|
else if( pTemp->flags & FTENT_SPIRAL )
|
||||||
{
|
{
|
||||||
float s, c;
|
/*float s, c;
|
||||||
s = sin( pTemp->entity.baseline.origin[2] + fastFreq );
|
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[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 + (int)(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;
|
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
extern engine_studio_api_t IEngineStudio;
|
extern engine_studio_api_t IEngineStudio;
|
||||||
|
|
||||||
static int tracerCount[32];
|
static int g_tracerCount[32];
|
||||||
|
|
||||||
extern "C" char PM_FindTextureType( char *name );
|
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;
|
char chTextureType = CHAR_TEX_CONCRETE;
|
||||||
float fvol;
|
float fvol;
|
||||||
float fvolbar;
|
float fvolbar;
|
||||||
char *rgsz[4];
|
const char *rgsz[4];
|
||||||
int cnt;
|
int cnt;
|
||||||
float fattn = ATTN_NORM;
|
float fattn = ATTN_NORM;
|
||||||
int entity;
|
int entity;
|
||||||
|
@ -521,16 +521,17 @@ void EV_FireGlock2( event_args_t *args )
|
||||||
VectorCopy( args->origin, origin );
|
VectorCopy( args->origin, origin );
|
||||||
VectorCopy( args->angles, angles );
|
VectorCopy( args->angles, angles );
|
||||||
VectorCopy( args->velocity, velocity );
|
VectorCopy( args->velocity, velocity );
|
||||||
|
int empty = args->bparam1;
|
||||||
|
|
||||||
AngleVectors( angles, forward, right, up );
|
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 ) )
|
if( EV_IsLocal( idx ) )
|
||||||
{
|
{
|
||||||
// Add muzzle flash to current weapon model
|
// Add muzzle flash to current weapon model
|
||||||
EV_MuzzleFlash();
|
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 );
|
V_PunchAxis( 0, -2.0 );
|
||||||
}
|
}
|
||||||
|
@ -545,7 +546,7 @@ void EV_FireGlock2( event_args_t *args )
|
||||||
|
|
||||||
VectorCopy( forward, vecAiming );
|
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
|
// GLOCK END
|
||||||
|
@ -568,7 +569,7 @@ void EV_FireShotGunDouble( event_args_t *args )
|
||||||
vec3_t vecSrc, vecAiming;
|
vec3_t vecSrc, vecAiming;
|
||||||
vec3_t vecSpread;
|
vec3_t vecSpread;
|
||||||
vec3_t up, right, forward;
|
vec3_t up, right, forward;
|
||||||
float flSpread = 0.01;
|
//float flSpread = 0.01;
|
||||||
|
|
||||||
idx = args->entindex;
|
idx = args->entindex;
|
||||||
VectorCopy( args->origin, origin );
|
VectorCopy( args->origin, origin );
|
||||||
|
@ -601,11 +602,11 @@ void EV_FireShotGunDouble( event_args_t *args )
|
||||||
|
|
||||||
if( gEngfuncs.GetMaxClients() > 1 )
|
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
|
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 vecSrc, vecAiming;
|
||||||
vec3_t vecSpread;
|
vec3_t vecSpread;
|
||||||
vec3_t up, right, forward;
|
vec3_t up, right, forward;
|
||||||
float flSpread = 0.01;
|
//float flSpread = 0.01;
|
||||||
|
|
||||||
idx = args->entindex;
|
idx = args->entindex;
|
||||||
VectorCopy( args->origin, origin );
|
VectorCopy( args->origin, origin );
|
||||||
|
@ -653,11 +654,11 @@ void EV_FireShotGunSingle( event_args_t *args )
|
||||||
|
|
||||||
if( gEngfuncs.GetMaxClients() > 1 )
|
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
|
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;
|
int shell;
|
||||||
vec3_t vecSrc, vecAiming;
|
vec3_t vecSrc, vecAiming;
|
||||||
vec3_t up, right, forward;
|
vec3_t up, right, forward;
|
||||||
float flSpread = 0.01;
|
//float flSpread = 0.01;
|
||||||
|
|
||||||
idx = args->entindex;
|
idx = args->entindex;
|
||||||
VectorCopy( args->origin, origin );
|
VectorCopy( args->origin, origin );
|
||||||
|
@ -718,11 +719,11 @@ void EV_FireMP5( event_args_t *args )
|
||||||
|
|
||||||
if( gEngfuncs.GetMaxClients() > 1 )
|
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
|
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 vecSrc, vecAiming;
|
||||||
vec3_t up, right, forward;
|
vec3_t up, right, forward;
|
||||||
float flSpread = 0.01;
|
//float flSpread = 0.01;
|
||||||
|
|
||||||
idx = args->entindex;
|
idx = args->entindex;
|
||||||
VectorCopy( args->origin, origin );
|
VectorCopy( args->origin, origin );
|
||||||
|
@ -860,16 +861,16 @@ void EV_FireGauss( event_args_t *args )
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
vec3_t velocity;
|
vec3_t velocity;
|
||||||
float flDamage = args->fparam1;
|
float flDamage = args->fparam1;
|
||||||
int primaryfire = args->bparam1;
|
//int primaryfire = args->bparam1;
|
||||||
|
|
||||||
int m_fPrimaryFire = 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 vecSrc;
|
||||||
vec3_t vecDest;
|
vec3_t vecDest;
|
||||||
edict_t *pentIgnore;
|
//edict_t *pentIgnore;
|
||||||
pmtrace_t tr, beam_tr;
|
pmtrace_t tr, beam_tr;
|
||||||
float flMaxFrac = 1.0;
|
float flMaxFrac = 1.0;
|
||||||
int nTotal = 0;
|
//int nTotal = 0;
|
||||||
int fHasPunched = 0;
|
int fHasPunched = 0;
|
||||||
int fFirstBeam = 1;
|
int fFirstBeam = 1;
|
||||||
int nMaxHits = 10;
|
int nMaxHits = 10;
|
||||||
|
@ -980,7 +981,7 @@ void EV_FireGauss( event_args_t *args )
|
||||||
{
|
{
|
||||||
float n;
|
float n;
|
||||||
|
|
||||||
pentIgnore = NULL;
|
//pentIgnore = NULL;
|
||||||
|
|
||||||
n = -DotProduct( tr.plane.normal, forward );
|
n = -DotProduct( tr.plane.normal, forward );
|
||||||
|
|
||||||
|
@ -1137,7 +1138,13 @@ enum crowbar_e
|
||||||
CROWBAR_ATTACK2MISS,
|
CROWBAR_ATTACK2MISS,
|
||||||
CROWBAR_ATTACK2HIT,
|
CROWBAR_ATTACK2HIT,
|
||||||
CROWBAR_ATTACK3MISS,
|
CROWBAR_ATTACK3MISS,
|
||||||
|
#ifndef CROWBAR_IDLE_ANIM
|
||||||
CROWBAR_ATTACK3HIT
|
CROWBAR_ATTACK3HIT
|
||||||
|
#else
|
||||||
|
CROWBAR_ATTACK3HIT,
|
||||||
|
CROWBAR_IDLE2,
|
||||||
|
CROWBAR_IDLE3
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
int g_iSwing;
|
int g_iSwing;
|
||||||
|
@ -1159,8 +1166,6 @@ void EV_Crowbar( event_args_t *args )
|
||||||
|
|
||||||
if( EV_IsLocal( idx ) )
|
if( EV_IsLocal( idx ) )
|
||||||
{
|
{
|
||||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 );
|
|
||||||
|
|
||||||
switch( (g_iSwing++) % 3 )
|
switch( (g_iSwing++) % 3 )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -1412,12 +1417,12 @@ BEAM *pBeam2;
|
||||||
|
|
||||||
void EV_EgonFire( event_args_t *args )
|
void EV_EgonFire( event_args_t *args )
|
||||||
{
|
{
|
||||||
int idx, iFireState, iFireMode;
|
int idx, /*iFireState,*/ iFireMode;
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
|
|
||||||
idx = args->entindex;
|
idx = args->entindex;
|
||||||
VectorCopy( args->origin, origin );
|
VectorCopy( args->origin, origin );
|
||||||
iFireState = args->iparam1;
|
//iFireState = args->iparam1;
|
||||||
iFireMode = args->iparam2;
|
iFireMode = args->iparam2;
|
||||||
int iStartup = args->bparam1;
|
int iStartup = args->bparam1;
|
||||||
|
|
||||||
|
@ -1430,6 +1435,12 @@ void EV_EgonFire( event_args_t *args )
|
||||||
}
|
}
|
||||||
else
|
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 )
|
if( iFireMode == FIRE_WIDE )
|
||||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.98, ATTN_NORM, 0, 125 );
|
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.98, ATTN_NORM, 0, 125 );
|
||||||
else
|
else
|
||||||
|
@ -1438,7 +1449,7 @@ void EV_EgonFire( event_args_t *args )
|
||||||
|
|
||||||
//Only play the weapon anims if I shot it.
|
//Only play the weapon anims if I shot it.
|
||||||
if( EV_IsLocal( idx ) )
|
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.
|
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 )
|
void EV_HornetGunFire( event_args_t *args )
|
||||||
{
|
{
|
||||||
int idx, iFireMode;
|
int idx; //, iFireMode;
|
||||||
vec3_t origin, angles, vecSrc, forward, right, up;
|
vec3_t origin, angles, vecSrc, forward, right, up;
|
||||||
|
|
||||||
idx = args->entindex;
|
idx = args->entindex;
|
||||||
VectorCopy( args->origin, origin );
|
VectorCopy( args->origin, origin );
|
||||||
VectorCopy( args->angles, angles );
|
VectorCopy( args->angles, angles );
|
||||||
iFireMode = args->iparam1;
|
//iFireMode = args->iparam1;
|
||||||
|
|
||||||
//Only play the weapon anims if I shot it.
|
//Only play the weapon anims if I shot it.
|
||||||
if( EV_IsLocal( idx ) )
|
if( EV_IsLocal( idx ) )
|
||||||
|
@ -1554,7 +1565,7 @@ void EV_HornetGunFire( event_args_t *args )
|
||||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 );
|
gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( gEngfuncs.pfnRandomLong( 0 , 2 ) )
|
switch( gEngfuncs.pfnRandomLong( 0, 2 ) )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 );
|
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 pitch;
|
||||||
int stop;
|
int stop;
|
||||||
|
|
||||||
char sz[256];
|
const char *pszSound;
|
||||||
|
|
||||||
idx = args->entindex;
|
idx = args->entindex;
|
||||||
|
|
||||||
|
@ -1706,36 +1717,35 @@ void EV_TrainPitchAdjust( event_args_t *args )
|
||||||
switch( noise )
|
switch( noise )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
strcpy( sz, "plats/ttrain1.wav" );
|
pszSound = "plats/ttrain1.wav";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
strcpy( sz, "plats/ttrain2.wav" );
|
pszSound = "plats/ttrain2.wav";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
strcpy( sz, "plats/ttrain3.wav" );
|
pszSound = "plats/ttrain3.wav";
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
strcpy( sz, "plats/ttrain4.wav");
|
pszSound = "plats/ttrain4.wav";
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
strcpy( sz, "plats/ttrain6.wav");
|
pszSound = "plats/ttrain6.wav";
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
strcpy( sz, "plats/ttrain7.wav");
|
pszSound = "plats/ttrain7.wav";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// no sound
|
// no sound
|
||||||
strcpy( sz, "" );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( stop )
|
if( stop )
|
||||||
{
|
{
|
||||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, sz );
|
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, pszSound );
|
||||||
}
|
}
|
||||||
else
|
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_fFade = 0;
|
||||||
m_fOn = 0;
|
m_fOn = 0;
|
||||||
|
m_iBat = 100;
|
||||||
|
m_flBat = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CHudFlashlight::VidInit( void )
|
int CHudFlashlight::VidInit( void )
|
||||||
|
|
|
@ -65,7 +65,7 @@ int CHudGeiger::Draw( float flTime )
|
||||||
{
|
{
|
||||||
int pct;
|
int pct;
|
||||||
float flvol = 0.0f;
|
float flvol = 0.0f;
|
||||||
int rg[3];
|
//int rg[3];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 )
|
if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 )
|
||||||
|
@ -79,61 +79,61 @@ int CHudGeiger::Draw( float flTime )
|
||||||
{
|
{
|
||||||
pct = 2;
|
pct = 2;
|
||||||
flvol = 0.4; //Con_Printf( "range > 600\n" );
|
flvol = 0.4; //Con_Printf( "range > 600\n" );
|
||||||
rg[0] = 1;
|
//rg[0] = 1;
|
||||||
rg[1] = 1;
|
//rg[1] = 1;
|
||||||
i = 2;
|
i = 2;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 500 )
|
else if( m_iGeigerRange > 500 )
|
||||||
{
|
{
|
||||||
pct = 4;
|
pct = 4;
|
||||||
flvol = 0.5; //Con_Printf( "range > 500\n" );
|
flvol = 0.5; //Con_Printf( "range > 500\n" );
|
||||||
rg[0] = 1;
|
//rg[0] = 1;
|
||||||
rg[1] = 2;
|
//rg[1] = 2;
|
||||||
i = 2;
|
i = 2;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 400 )
|
else if( m_iGeigerRange > 400 )
|
||||||
{
|
{
|
||||||
pct = 8;
|
pct = 8;
|
||||||
flvol = 0.6; //Con_Printf( "range > 400\n" );
|
flvol = 0.6; //Con_Printf( "range > 400\n" );
|
||||||
rg[0] = 1;
|
//rg[0] = 1;
|
||||||
rg[1] = 2;
|
//rg[1] = 2;
|
||||||
rg[2] = 3;
|
//rg[2] = 3;
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 300 )
|
else if( m_iGeigerRange > 300 )
|
||||||
{
|
{
|
||||||
pct = 8;
|
pct = 8;
|
||||||
flvol = 0.7; //Con_Printf( "range > 300\n" );
|
flvol = 0.7; //Con_Printf( "range > 300\n" );
|
||||||
rg[0] = 2;
|
//rg[0] = 2;
|
||||||
rg[1] = 3;
|
//rg[1] = 3;
|
||||||
rg[2] = 4;
|
//rg[2] = 4;
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 200 )
|
else if( m_iGeigerRange > 200 )
|
||||||
{
|
{
|
||||||
pct = 28;
|
pct = 28;
|
||||||
flvol = 0.78; //Con_Printf( "range > 200\n" );
|
flvol = 0.78; //Con_Printf( "range > 200\n" );
|
||||||
rg[0] = 2;
|
//rg[0] = 2;
|
||||||
rg[1] = 3;
|
//rg[1] = 3;
|
||||||
rg[2] = 4;
|
//rg[2] = 4;
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 150 )
|
else if( m_iGeigerRange > 150 )
|
||||||
{
|
{
|
||||||
pct = 40;
|
pct = 40;
|
||||||
flvol = 0.80; //Con_Printf( "range > 150\n" );
|
flvol = 0.80; //Con_Printf( "range > 150\n" );
|
||||||
rg[0] = 3;
|
//rg[0] = 3;
|
||||||
rg[1] = 4;
|
//rg[1] = 4;
|
||||||
rg[2] = 5;
|
//rg[2] = 5;
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 100 )
|
else if( m_iGeigerRange > 100 )
|
||||||
{
|
{
|
||||||
pct = 60;
|
pct = 60;
|
||||||
flvol = 0.85; //Con_Printf( "range > 100\n" );
|
flvol = 0.85; //Con_Printf( "range > 100\n" );
|
||||||
rg[0] = 3;
|
//rg[0] = 3;
|
||||||
rg[1] = 4;
|
//rg[1] = 4;
|
||||||
rg[2] = 5;
|
//rg[2] = 5;
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 75 )
|
else if( m_iGeigerRange > 75 )
|
||||||
|
@ -141,29 +141,29 @@ int CHudGeiger::Draw( float flTime )
|
||||||
pct = 80;
|
pct = 80;
|
||||||
flvol = 0.9; //Con_Printf( "range > 75\n" );
|
flvol = 0.9; //Con_Printf( "range > 75\n" );
|
||||||
//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;
|
//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;
|
||||||
rg[0] = 4;
|
//rg[0] = 4;
|
||||||
rg[1] = 5;
|
//rg[1] = 5;
|
||||||
rg[2] = 6;
|
//rg[2] = 6;
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
else if( m_iGeigerRange > 50 )
|
else if( m_iGeigerRange > 50 )
|
||||||
{
|
{
|
||||||
pct = 90;
|
pct = 90;
|
||||||
flvol = 0.95; //Con_Printf( "range > 50\n" );
|
flvol = 0.95; //Con_Printf( "range > 50\n" );
|
||||||
rg[0] = 5;
|
//rg[0] = 5;
|
||||||
rg[1] = 6;
|
//rg[1] = 6;
|
||||||
i = 2;
|
i = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pct = 95;
|
pct = 95;
|
||||||
flvol = 1.0; //Con_Printf( "range < 50\n" );
|
flvol = 1.0; //Con_Printf( "range < 50\n" );
|
||||||
rg[0] = 5;
|
//rg[0] = 5;
|
||||||
rg[1] = 6;
|
//rg[1] = 6;
|
||||||
i = 2;
|
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 )
|
if( ( rand() & 127 ) < pct || ( rand() & 127 ) < pct )
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,8 @@ int CBaseEntity::IsDormant( void ) { return 0; }
|
||||||
BOOL CBaseEntity::IsInWorld( void ) { return TRUE; }
|
BOOL CBaseEntity::IsInWorld( void ) { return TRUE; }
|
||||||
int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; }
|
int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; }
|
||||||
int CBaseEntity::DamageDecal( int bitsDamageType ) { return -1; }
|
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 ) { }
|
void CBaseEntity::SUB_Remove( void ) { }
|
||||||
|
|
||||||
// CBaseDelay Stubs
|
// CBaseDelay Stubs
|
||||||
|
@ -146,7 +147,7 @@ int CBaseMonster::CheckEnemy( CBaseEntity *pEnemy ) { return 0; }
|
||||||
void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { }
|
void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { }
|
||||||
BOOL CBaseMonster::PopEnemy() { return FALSE; }
|
BOOL CBaseMonster::PopEnemy() { return FALSE; }
|
||||||
void CBaseMonster::SetActivity( Activity NewActivity ) { }
|
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; }
|
int CBaseMonster::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; }
|
||||||
float CBaseMonster::OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; }
|
float CBaseMonster::OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; }
|
||||||
void CBaseMonster::AdvanceRoute( float distance ) { }
|
void CBaseMonster::AdvanceRoute( float distance ) { }
|
||||||
|
@ -214,7 +215,7 @@ void CBaseMonster::MonsterInitDead( void ) { }
|
||||||
BOOL CBaseMonster::BBoxFlat( void ) { return TRUE; }
|
BOOL CBaseMonster::BBoxFlat( void ) { return TRUE; }
|
||||||
BOOL CBaseMonster::GetEnemy( void ) { return FALSE; }
|
BOOL CBaseMonster::GetEnemy( void ) { return FALSE; }
|
||||||
void CBaseMonster::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
|
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; }
|
BOOL CBaseMonster::ShouldFadeOnDeath( void ) { return FALSE; }
|
||||||
void CBaseMonster::RadiusDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
|
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 ) { }
|
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::CheckTimeBasedDamage() { }
|
||||||
void CBasePlayer::UpdateGeigerCounter( void ) { }
|
void CBasePlayer::UpdateGeigerCounter( void ) { }
|
||||||
void CBasePlayer::CheckSuitUpdate() { }
|
void CBasePlayer::CheckSuitUpdate() { }
|
||||||
void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) { }
|
void CBasePlayer::SetSuitUpdate( const char *name, int fgroup, int iNoRepeatTime ) { }
|
||||||
void CBasePlayer::UpdatePlayerSound ( void ) { }
|
void CBasePlayer::UpdatePlayerSound( void ) { }
|
||||||
void CBasePlayer::PostThink() { }
|
void CBasePlayer::PostThink() { }
|
||||||
void CBasePlayer::Precache( void ) { }
|
void CBasePlayer::Precache( void ) { }
|
||||||
int CBasePlayer::Save( CSave &save ) { return 0; }
|
int CBasePlayer::Save( CSave &save ) { return 0; }
|
||||||
|
@ -276,7 +277,7 @@ void CBasePlayer::ForceClientDllUpdate( void ) { }
|
||||||
void CBasePlayer::ImpulseCommands() { }
|
void CBasePlayer::ImpulseCommands() { }
|
||||||
void CBasePlayer::CheatImpulseCommands( int iImpulse ) { }
|
void CBasePlayer::CheatImpulseCommands( int iImpulse ) { }
|
||||||
int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
|
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::ItemPreFrame() { }
|
||||||
void CBasePlayer::ItemPostFrame() { }
|
void CBasePlayer::ItemPostFrame() { }
|
||||||
int CBasePlayer::AmmoInventory( int iAmmoIndex ) { return -1; }
|
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; }
|
BOOL CBasePlayer::SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; }
|
||||||
Vector CBasePlayer::GetGunPosition( void ) { return g_vecZero; }
|
Vector CBasePlayer::GetGunPosition( void ) { return g_vecZero; }
|
||||||
const char *CBasePlayer::TeamID( void ) { return ""; }
|
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::AddPoints( int score, BOOL bAllowNegativeScore ) { }
|
||||||
void CBasePlayer::AddPointsToTeam( 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 CBasePlayerItem::Save( class CSave & ) { return 1; }
|
||||||
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
|
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
|
||||||
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
|
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
|
||||||
|
float CBasePlayerWeapon::GetNextAttackDelay( float flTime ) { return flTime; }
|
||||||
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
|
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
|
||||||
void CBasePlayerItem::FallInit( void ) { }
|
void CBasePlayerItem::FallInit( void ) { }
|
||||||
void CBasePlayerItem::FallThink( void ) { }
|
void CBasePlayerItem::FallThink( void ) { }
|
||||||
|
|
|
@ -75,7 +75,7 @@ AlertMessage
|
||||||
Print debug messages to console
|
Print debug messages to console
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void AlertMessage( ALERT_TYPE atype, char *szFmt, ... )
|
void AlertMessage( ALERT_TYPE atype, const char *szFmt, ... )
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
static char string[1024];
|
static char string[1024];
|
||||||
|
@ -96,7 +96,7 @@ bool bIsMultiplayer( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
//Just loads a v_ model.
|
//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 );
|
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 )
|
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||||
return FALSE;
|
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 )
|
if( j == 0 )
|
||||||
return FALSE;
|
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() )
|
if( !CanDeploy() )
|
||||||
return FALSE;
|
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 )
|
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, y, z;
|
float x = 0.0f, y = 0.0f, z;
|
||||||
|
|
||||||
for( ULONG iShot = 1; iShot <= cShots; iShot++ )
|
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 );
|
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
|
HUD_InitClientWeapons
|
||||||
|
|
|
@ -35,6 +35,7 @@ extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz,
|
||||||
|
|
||||||
extern cvar_t *sensitivity;
|
extern cvar_t *sensitivity;
|
||||||
cvar_t *cl_lw = NULL;
|
cvar_t *cl_lw = NULL;
|
||||||
|
cvar_t *cl_viewbob = NULL;
|
||||||
|
|
||||||
void ShutdownInput( void );
|
void ShutdownInput( void );
|
||||||
|
|
||||||
|
@ -194,6 +195,7 @@ void CHud::Init( void )
|
||||||
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
||||||
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
||||||
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
||||||
|
cl_viewbob = CVAR_CREATE( "cl_viewbob", "0", FCVAR_ARCHIVE );
|
||||||
|
|
||||||
m_pSpriteList = NULL;
|
m_pSpriteList = NULL;
|
||||||
|
|
||||||
|
|
12
cl_dll/hud.h
12
cl_dll/hud.h
|
@ -480,7 +480,7 @@ public:
|
||||||
int Init( void );
|
int Init( void );
|
||||||
static char *LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size );
|
static char *LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size );
|
||||||
static char *BufferedLocaliseTextString( const char *msg );
|
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 );
|
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)
|
//had to make these public so CHud could access them (to enable concussion icon)
|
||||||
//could use a friend declaration instead...
|
//could use a friend declaration instead...
|
||||||
void EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );
|
void EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );
|
||||||
void DisableIcon( char *pszIconName );
|
void DisableIcon( const char *pszIconName );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -588,11 +588,11 @@ public:
|
||||||
|
|
||||||
int m_iFontHeight;
|
int m_iFontHeight;
|
||||||
int DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b );
|
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 DrawHudString( int x, int y, int iMaxX, const 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 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 DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b );
|
||||||
int GetNumWidth( int iNumber, int iFlags );
|
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 );
|
void DrawDarkRectangle( int x, int y, int wide, int tall );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -93,6 +93,13 @@ int CHud::Redraw( float flTime, int intermission )
|
||||||
if( m_flTimeDelta < 0 )
|
if( m_flTimeDelta < 0 )
|
||||||
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 )
|
if( m_flShotTime && m_flShotTime < flTime )
|
||||||
{
|
{
|
||||||
gEngfuncs.pfnClientCmd( "snapshot\n" );
|
gEngfuncs.pfnClientCmd( "snapshot\n" );
|
||||||
|
@ -192,7 +199,7 @@ const unsigned char colors[8][3] =
|
||||||
{240, 180, 24}
|
{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 )
|
if( hud_textmode->value == 2 )
|
||||||
{
|
{
|
||||||
|
@ -226,7 +233,34 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g
|
||||||
return xpos;
|
return xpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CHud::DrawHudStringLen( char *szIt )
|
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 );
|
||||||
|
|
||||||
|
// draw the string until we hit the null character or a newline character
|
||||||
|
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||||
|
{
|
||||||
|
int w = gHUD.m_scrinfo.charWidths['M'];
|
||||||
|
if( xpos + w > iMaxX )
|
||||||
|
return xpos;
|
||||||
|
if( ( *szIt == '^' ) && ( *( szIt + 1 ) >= '0') && ( *( szIt + 1 ) <= '7') )
|
||||||
|
{
|
||||||
|
szIt++;
|
||||||
|
r = colors[*szIt - '0'][0];
|
||||||
|
g = colors[*szIt - '0'][1];
|
||||||
|
b = colors[*szIt - '0'][2];
|
||||||
|
if( !*(++szIt) )
|
||||||
|
return xpos;
|
||||||
|
}
|
||||||
|
int c = (unsigned int)(unsigned char)*szIt;
|
||||||
|
xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return xpos;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHud::DrawHudStringLen( const char *szIt )
|
||||||
{
|
{
|
||||||
int l = 0;
|
int l = 0;
|
||||||
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||||
|
@ -244,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)
|
// 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
|
// 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];
|
xpos -= gHUD.m_scrinfo.charWidths[(unsigned char)*szIt];
|
||||||
if( xpos < iMinX )
|
if( xpos < iMinX )
|
||||||
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;
|
int n, found = 0;
|
||||||
char keyname[256];
|
char keyname[256];
|
||||||
char token[2048];
|
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 )
|
if( !pEnt )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -189,7 +189,7 @@ int UTIL_FindEntityInMap( char * name, float * origin, float * angle )
|
||||||
if( !pEnt->model )
|
if( !pEnt->model )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char * data = pEnt->model->entities;
|
char *data = pEnt->model->entities;
|
||||||
|
|
||||||
while( data )
|
while( data )
|
||||||
{
|
{
|
||||||
|
@ -993,7 +993,7 @@ void CHudSpectator::DrawOverviewLayer()
|
||||||
if ( hasMapImage)
|
if ( hasMapImage)
|
||||||
{
|
{
|
||||||
i = m_MapSprite->numframes / (4*3);
|
i = m_MapSprite->numframes / (4*3);
|
||||||
i = sqrt(i);
|
i = sqrt(float(i));
|
||||||
xTiles = i*4;
|
xTiles = i*4;
|
||||||
yTiles = i*3;
|
yTiles = i*3;
|
||||||
}
|
}
|
||||||
|
@ -1374,12 +1374,12 @@ void CHudSpectator::DeathMessage( int victim )
|
||||||
AddOverviewEntityToList(m_hsprPlayerDead, pl, gEngfuncs.GetClientTime() + 2.0f );
|
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++ )
|
for( int i = 0; i < MAX_OVERVIEW_ENTITIES; i++ )
|
||||||
{
|
{
|
||||||
// find empty entity slot
|
// find empty entity slot
|
||||||
if( m_OverviewEntities[i].entity == NULL)
|
if( m_OverviewEntities[i].entity == NULL )
|
||||||
{
|
{
|
||||||
m_OverviewEntities[i].entity = ent;
|
m_OverviewEntities[i].entity = ent;
|
||||||
m_OverviewEntities[i].hSprite = sprite;
|
m_OverviewEntities[i].hSprite = sprite;
|
||||||
|
|
|
@ -64,11 +64,11 @@ public:
|
||||||
void CheckOverviewEntities();
|
void CheckOverviewEntities();
|
||||||
void DrawOverview();
|
void DrawOverview();
|
||||||
void DrawOverviewEntities();
|
void DrawOverviewEntities();
|
||||||
void GetMapPosition( float * returnvec );
|
void GetMapPosition( float *returnvec );
|
||||||
void DrawOverviewLayer();
|
void DrawOverviewLayer();
|
||||||
void LoadMapSprites();
|
void LoadMapSprites();
|
||||||
bool ParseOverviewFile();
|
bool ParseOverviewFile();
|
||||||
bool IsActivePlayer( cl_entity_t * ent );
|
bool IsActivePlayer( cl_entity_t *ent );
|
||||||
void SetModes( int iMainMode, int iInsetMode );
|
void SetModes( int iMainMode, int iInsetMode );
|
||||||
void HandleButtonsDown( int ButtonPressed );
|
void HandleButtonsDown( int ButtonPressed );
|
||||||
void HandleButtonsUp( int ButtonPressed );
|
void HandleButtonsUp( int ButtonPressed );
|
||||||
|
|
|
@ -54,7 +54,7 @@ float rel_pitch;
|
||||||
#define IMPULSE_DOWN 2
|
#define IMPULSE_DOWN 2
|
||||||
#define IMPULSE_UP 4
|
#define IMPULSE_UP 4
|
||||||
|
|
||||||
bool CL_IsDead();
|
int CL_IsDead( void );
|
||||||
Vector dead_viewangles(0, 0, 0);
|
Vector dead_viewangles(0, 0, 0);
|
||||||
|
|
||||||
void IN_ToggleButtons( float forwardmove, float sidemove )
|
void IN_ToggleButtons( float forwardmove, float sidemove )
|
||||||
|
|
|
@ -83,7 +83,7 @@ int CHudMenu::Draw( float flTime )
|
||||||
int nlc = 0;
|
int nlc = 0;
|
||||||
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
|
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
|
||||||
{
|
{
|
||||||
if ( g_szMenuString[i] == '\n' )
|
if( g_szMenuString[i] == '\n' )
|
||||||
nlc++;
|
nlc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,19 +153,21 @@ int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// append to the current menu string
|
// 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)
|
g_szPrelocalisedMenuString[MAX_MENU_STRING - 1] = 0; // ensure null termination (strncat/strncpy does not)
|
||||||
|
|
||||||
if( !NeedMore )
|
if( !NeedMore )
|
||||||
{
|
{
|
||||||
// we have the whole string, so we can localise it now
|
// 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
|
// Swap in characters
|
||||||
if( KB_ConvertString( g_szMenuString, &temp ) )
|
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 );
|
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
|
// 1 Global client_textmessage_t for custom messages that aren't in the titles.txt
|
||||||
client_textmessage_t g_pCustomMessage;
|
client_textmessage_t g_pCustomMessage;
|
||||||
char *g_pCustomName = "Custom";
|
const char *g_pCustomName = "Custom";
|
||||||
char g_pCustomText[1024];
|
char g_pCustomText[1024];
|
||||||
|
|
||||||
int CHudMessage::Init( void )
|
int CHudMessage::Init( void )
|
||||||
|
@ -260,7 +260,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
|
||||||
width = 0;
|
width = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
width += gHUD.m_scrinfo.charWidths[*pText];
|
width += gHUD.m_scrinfo.charWidths[(unsigned char)*pText];
|
||||||
pText++;
|
pText++;
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ int CHudMessage::Draw( float fTime )
|
||||||
{
|
{
|
||||||
int i, drawn;
|
int i, drawn;
|
||||||
client_textmessage_t *pMessage;
|
client_textmessage_t *pMessage;
|
||||||
float endTime;
|
float endTime = 0.0f;
|
||||||
|
|
||||||
drawn = 0;
|
drawn = 0;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
cvar_t *cl_scoreboard_bg;
|
||||||
cvar_t *cl_showpacketloss;
|
cvar_t *cl_showpacketloss;
|
||||||
hud_player_info_t g_PlayerInfoList[MAX_PLAYERS + 1]; // player info from the engine
|
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
|
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();
|
InitHUDData();
|
||||||
|
|
||||||
|
cl_scoreboard_bg = CVAR_CREATE( "cl_scoreboard_bg", "1", FCVAR_ARCHIVE );
|
||||||
cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE );
|
cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE );
|
||||||
|
|
||||||
return 1;
|
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
|
// X positions
|
||||||
// relative to the side of the scoreboard
|
// relative to the side of the scoreboard
|
||||||
#define NAME_RANGE_MIN 20
|
#define NAME_RANGE_MIN -100
|
||||||
#define NAME_RANGE_MAX 145
|
#define NAME_RANGE_MAX 145
|
||||||
#define KILLS_RANGE_MIN 130
|
#define KILLS_RANGE_MIN 130
|
||||||
#define KILLS_RANGE_MAX 170
|
#define KILLS_RANGE_MAX 170
|
||||||
|
@ -143,21 +145,22 @@ int CHudScoreboard::Draw( float fTime )
|
||||||
int xpos = NAME_RANGE_MIN + xpos_rel;
|
int xpos = NAME_RANGE_MIN + xpos_rel;
|
||||||
|
|
||||||
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX;
|
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX;
|
||||||
FAR_RIGHT += 5;
|
FAR_RIGHT += 125;
|
||||||
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
|
if( cl_scoreboard_bg && cl_scoreboard_bg->value )
|
||||||
|
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
|
||||||
if( !gHUD.m_Teamplay )
|
if( !gHUD.m_Teamplay )
|
||||||
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
|
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
|
||||||
else
|
else
|
||||||
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
|
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
|
||||||
|
|
||||||
gHUD.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 );
|
gHUD.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 );
|
||||||
gHUD.DrawHudString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
|
DrawUtfString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
|
||||||
gHUD.DrawHudString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
|
DrawUtfString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
|
||||||
gHUD.DrawHudString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
|
DrawUtfString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
|
||||||
|
|
||||||
if( can_show_packetloss )
|
if( can_show_packetloss )
|
||||||
{
|
{
|
||||||
gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
|
DrawUtfString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
list_slot += 1.2;
|
list_slot += 1.2;
|
||||||
|
@ -272,7 +275,7 @@ int CHudScoreboard::Draw( float fTime )
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw their name (left to right)
|
// draw their name (left to right)
|
||||||
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
|
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
|
||||||
|
|
||||||
// draw kills (right to left)
|
// draw kills (right to left)
|
||||||
xpos = KILLS_RANGE_MAX + xpos_rel;
|
xpos = KILLS_RANGE_MAX + xpos_rel;
|
||||||
|
@ -280,7 +283,7 @@ int CHudScoreboard::Draw( float fTime )
|
||||||
|
|
||||||
// draw divider
|
// draw divider
|
||||||
xpos = DIVIDER_POS + xpos_rel;
|
xpos = DIVIDER_POS + xpos_rel;
|
||||||
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
|
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
|
||||||
|
|
||||||
// draw deaths
|
// draw deaths
|
||||||
xpos = DEATHS_RANGE_MAX + xpos_rel;
|
xpos = DEATHS_RANGE_MAX + xpos_rel;
|
||||||
|
@ -300,7 +303,7 @@ int CHudScoreboard::Draw( float fTime )
|
||||||
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25;
|
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25;
|
||||||
|
|
||||||
sprintf( buf, " %d", team_info->packetloss );
|
sprintf( buf, " %d", team_info->packetloss );
|
||||||
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
|
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again
|
team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again
|
||||||
|
@ -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 = 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
|
// draw the players, in order, and restricted to team if set
|
||||||
while( 1 )
|
while( 1 )
|
||||||
|
@ -400,7 +403,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw their name (left to right)
|
// draw their name (left to right)
|
||||||
gHUD.DrawHudString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );
|
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );
|
||||||
|
|
||||||
// draw kills (right to left)
|
// draw kills (right to left)
|
||||||
xpos = KILLS_RANGE_MAX + xpos_rel;
|
xpos = KILLS_RANGE_MAX + xpos_rel;
|
||||||
|
@ -408,7 +411,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
||||||
|
|
||||||
// draw divider
|
// draw divider
|
||||||
xpos = DIVIDER_POS + xpos_rel;
|
xpos = DIVIDER_POS + xpos_rel;
|
||||||
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
|
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
|
||||||
|
|
||||||
// draw deaths
|
// draw deaths
|
||||||
xpos = DEATHS_RANGE_MAX + xpos_rel;
|
xpos = DEATHS_RANGE_MAX + xpos_rel;
|
||||||
|
@ -435,7 +438,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
||||||
|
|
||||||
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2 ) + PL_RANGE_MIN + xpos_rel + 25;
|
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2 ) + PL_RANGE_MIN + xpos_rel + 25;
|
||||||
|
|
||||||
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
|
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again
|
pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again
|
||||||
|
|
|
@ -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
|
// 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;
|
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
|
// find the sprite is in the current list
|
||||||
for( int i = 0; i < MAX_ICONSPRITES; i++ )
|
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 *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size )
|
||||||
{
|
{
|
||||||
char *dst = dst_buffer;
|
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 == '#' )
|
if( *src == '#' )
|
||||||
{
|
{
|
||||||
// cut msg name out of string
|
// cut msg name out of string
|
||||||
static char word_buf[255];
|
static char word_buf[255];
|
||||||
char *wdst = word_buf, *word_start = src;
|
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;
|
*wdst = *src;
|
||||||
}
|
}
|
||||||
|
@ -69,21 +70,20 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy string into message over the msg name
|
// 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 = *wsrc;
|
||||||
}
|
}
|
||||||
*dst = 0;
|
buffer_size++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
dst++, src++;
|
dst++, src++;
|
||||||
*dst = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dst_buffer[buffer_size - 1] = 0; // ensure null termination
|
*dst = 0; // ensure null termination
|
||||||
return dst_buffer;
|
return dst_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,12 +91,12 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in
|
||||||
char *CHudTextMessage::BufferedLocaliseTextString( const char *msg )
|
char *CHudTextMessage::BufferedLocaliseTextString( const char *msg )
|
||||||
{
|
{
|
||||||
static char dst_buffer[1024];
|
static char dst_buffer[1024];
|
||||||
LocaliseTextString( msg, dst_buffer, 1024 );
|
LocaliseTextString( msg, dst_buffer, sizeof(dst_buffer) );
|
||||||
return dst_buffer;
|
return dst_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simplified version of LocaliseTextString; assumes string is only one word
|
// 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 )
|
if( !msg )
|
||||||
return "";
|
return "";
|
||||||
|
@ -108,7 +108,7 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
||||||
client_textmessage_t *clmsg = TextMessageGet( msg + 1 );
|
client_textmessage_t *clmsg = TextMessageGet( msg + 1 );
|
||||||
|
|
||||||
if( !clmsg || !(clmsg->pMessage) )
|
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 )
|
if( msg_dest )
|
||||||
{
|
{
|
||||||
|
@ -118,12 +118,12 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
||||||
*msg_dest = -clmsg->effect;
|
*msg_dest = -clmsg->effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char*)clmsg->pMessage;
|
return clmsg->pMessage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nothing special about this message, so just return the same string
|
// 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();
|
int msg_dest = READ_BYTE();
|
||||||
|
|
||||||
static char szBuf[6][128];
|
#define MSG_BUF_SIZE 128
|
||||||
char *msg_text = LookupString( READ_STRING(), &msg_dest );
|
char szBuf[6][MSG_BUF_SIZE];
|
||||||
msg_text = strcpy( szBuf[0], msg_text );
|
|
||||||
|
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];
|
char *psz = szBuf[5];
|
||||||
|
|
||||||
switch( msg_dest )
|
switch( msg_dest )
|
||||||
{
|
{
|
||||||
case HUD_PRINTCENTER:
|
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 ) );
|
CenterPrint( ConvertCRtoNL( psz ) );
|
||||||
break;
|
break;
|
||||||
case HUD_PRINTNOTIFY:
|
case HUD_PRINTNOTIFY:
|
||||||
psz[0] = 1; // mark this message to go into the notify buffer
|
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 ) );
|
ConsolePrint( ConvertCRtoNL( psz ) );
|
||||||
break;
|
break;
|
||||||
case HUD_PRINTTALK:
|
case HUD_PRINTTALK:
|
||||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||||
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
|
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
|
||||||
break;
|
break;
|
||||||
case HUD_PRINTCONSOLE:
|
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 ) );
|
ConsolePrint( ConvertCRtoNL( psz ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
|
|
||||||
extern vec3_t vec3_origin;
|
extern vec3_t vec3_origin;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
vec3_t vec3_origin;
|
||||||
|
#endif
|
||||||
|
|
||||||
double sqrt( double x );
|
double sqrt( double x );
|
||||||
|
|
||||||
float Length( const float *v )
|
float Length( const float *v )
|
||||||
|
|
|
@ -78,6 +78,7 @@ extern cvar_t *cl_forwardspeed;
|
||||||
extern cvar_t *chase_active;
|
extern cvar_t *chase_active;
|
||||||
extern cvar_t *scr_ofsx, *scr_ofsy, *scr_ofsz;
|
extern cvar_t *scr_ofsx, *scr_ofsy, *scr_ofsz;
|
||||||
extern cvar_t *cl_vsmoothing;
|
extern cvar_t *cl_vsmoothing;
|
||||||
|
extern cvar_t *cl_viewbob;
|
||||||
extern Vector dead_viewangles;
|
extern Vector dead_viewangles;
|
||||||
|
|
||||||
#define CAM_MODE_RELAX 1
|
#define CAM_MODE_RELAX 1
|
||||||
|
@ -90,7 +91,7 @@ float v_cameraFocusAngle = 35.0f;
|
||||||
int v_cameraMode = CAM_MODE_FOCUS;
|
int v_cameraMode = CAM_MODE_FOCUS;
|
||||||
qboolean v_resetCamera = 1;
|
qboolean v_resetCamera = 1;
|
||||||
|
|
||||||
vec3_t ev_punchangle;
|
vec3_t g_ev_punchangle;
|
||||||
|
|
||||||
cvar_t *scr_ofsx;
|
cvar_t *scr_ofsx;
|
||||||
cvar_t *scr_ofsy;
|
cvar_t *scr_ofsy;
|
||||||
|
@ -351,11 +352,11 @@ V_CalcIntermissionRefdef
|
||||||
*/
|
*/
|
||||||
void V_CalcIntermissionRefdef( struct ref_params_s *pparams )
|
void V_CalcIntermissionRefdef( struct ref_params_s *pparams )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent, *view;
|
cl_entity_t /**ent,*/ *view;
|
||||||
float old;
|
float old;
|
||||||
|
|
||||||
// ent is the player model ( visible when out of body )
|
// 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 is the weapon model (only visible from inside body )
|
||||||
view = gEngfuncs.GetViewModel();
|
view = gEngfuncs.GetViewModel();
|
||||||
|
@ -527,7 +528,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
||||||
V_AddIdle( pparams );
|
V_AddIdle( pparams );
|
||||||
|
|
||||||
// offsets
|
// offsets
|
||||||
if ( pparams->health <= 0 )
|
if( pparams->health <= 0 )
|
||||||
{
|
{
|
||||||
VectorCopy( dead_viewangles, angles );
|
VectorCopy( dead_viewangles, angles );
|
||||||
}
|
}
|
||||||
|
@ -598,6 +599,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
||||||
view->angles[ROLL] -= bob * 1;
|
view->angles[ROLL] -= bob * 1;
|
||||||
view->angles[PITCH] -= bob * 0.3;
|
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
|
// 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
|
// 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).
|
// 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 );
|
VectorAdd( pparams->viewangles, pparams->punchangle, pparams->viewangles );
|
||||||
|
|
||||||
// Include client side punch, too
|
// 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
|
// smooth out stair step ups
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -1307,7 +1311,7 @@ void V_GetMapChasePosition( int target, float *cl_angles, float *origin, float *
|
||||||
|
|
||||||
int V_FindViewModelByWeaponModel( int weaponindex )
|
int V_FindViewModelByWeaponModel( int weaponindex )
|
||||||
{
|
{
|
||||||
static char *modelmap[][2] =
|
static const char *modelmap[][2] =
|
||||||
{
|
{
|
||||||
{ "models/p_crossbow.mdl", "models/v_crossbow.mdl" },
|
{ "models/p_crossbow.mdl", "models/v_crossbow.mdl" },
|
||||||
{ "models/p_crowbar.mdl", "models/v_crowbar.mdl" },
|
{ "models/p_crowbar.mdl", "models/v_crowbar.mdl" },
|
||||||
|
@ -1327,7 +1331,7 @@ int V_FindViewModelByWeaponModel( int weaponindex )
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct model_s * weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
struct model_s *weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
||||||
|
|
||||||
if( weaponModel )
|
if( weaponModel )
|
||||||
{
|
{
|
||||||
|
@ -1575,7 +1579,7 @@ Client side punch effect
|
||||||
*/
|
*/
|
||||||
void V_PunchAxis( int axis, float punch )
|
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_NOINTERP 32 // don't interpolate the next frame
|
||||||
#define EF_LIGHT 64 // rocket flare glow sprite
|
#define EF_LIGHT 64 // rocket flare glow sprite
|
||||||
#define EF_NODRAW 128 // don't draw entity
|
#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
|
#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_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_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_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)
|
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
|
||||||
// byte (entity index of player)
|
// byte (entity index of player)
|
||||||
|
@ -621,8 +624,9 @@
|
||||||
#define CHAN_BODY 4
|
#define CHAN_BODY 4
|
||||||
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
|
#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_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_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
|
// attenuation values
|
||||||
#define ATTN_NONE 0
|
#define ATTN_NONE 0
|
||||||
|
@ -724,7 +728,8 @@ enum
|
||||||
kRenderFxDeadPlayer, // kRenderAmt is the player index
|
kRenderFxDeadPlayer, // kRenderAmt is the player index
|
||||||
kRenderFxExplode, // Scale up really big!
|
kRenderFxExplode, // Scale up really big!
|
||||||
kRenderFxGlowShell, // Glowing Shell
|
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;
|
typedef unsigned int func_t;
|
||||||
|
|
|
@ -24,11 +24,12 @@
|
||||||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
#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_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_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
|
typedef struct cvar_s
|
||||||
{
|
{
|
||||||
char *name;
|
const char *name;
|
||||||
char *string;
|
const char *string;
|
||||||
int flags;
|
int flags;
|
||||||
float value;
|
float value;
|
||||||
struct cvar_s *next;
|
struct cvar_s *next;
|
||||||
|
|
|
@ -18,7 +18,12 @@
|
||||||
|
|
||||||
typedef float vec_t;
|
typedef float vec_t;
|
||||||
typedef vec_t vec2_t[2];
|
typedef vec_t vec2_t[2];
|
||||||
|
|
||||||
|
#ifndef DID_VEC3_T_DEFINE
|
||||||
|
#define DID_VEC3_T_DEFINE
|
||||||
typedef vec_t vec3_t[3];
|
typedef vec_t vec3_t[3];
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef vec_t vec4_t[4]; // x,y,z,w
|
typedef vec_t vec4_t[4]; // x,y,z,w
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
|
|
|
@ -16,7 +16,7 @@ endif
|
||||||
LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \
|
LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \
|
||||||
-fno-exceptions -DNO_VOICEGAMEMGR -w
|
-fno-exceptions -DNO_VOICEGAMEMGR -w
|
||||||
|
|
||||||
LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -frtti
|
LOCAL_CPPFLAGS := $(LOCAL_CFLAGS)
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(SDL_PATH)/include \
|
LOCAL_C_INCLUDES := $(SDL_PATH)/include \
|
||||||
$(LOCAL_PATH)/. \
|
$(LOCAL_PATH)/. \
|
||||||
|
@ -90,11 +90,13 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
|
||||||
multiplay_gamerules.cpp \
|
multiplay_gamerules.cpp \
|
||||||
nihilanth.cpp \
|
nihilanth.cpp \
|
||||||
nodes.cpp \
|
nodes.cpp \
|
||||||
|
observer.cpp \
|
||||||
osprey.cpp \
|
osprey.cpp \
|
||||||
pathcorner.cpp \
|
pathcorner.cpp \
|
||||||
plane.cpp \
|
plane.cpp \
|
||||||
plats.cpp \
|
plats.cpp \
|
||||||
player.cpp \
|
player.cpp \
|
||||||
|
playermonster.cpp \
|
||||||
python.cpp \
|
python.cpp \
|
||||||
rat.cpp \
|
rat.cpp \
|
||||||
roach.cpp \
|
roach.cpp \
|
||||||
|
|
|
@ -92,11 +92,13 @@ set (SVDLL_SOURCES
|
||||||
multiplay_gamerules.cpp
|
multiplay_gamerules.cpp
|
||||||
nihilanth.cpp
|
nihilanth.cpp
|
||||||
nodes.cpp
|
nodes.cpp
|
||||||
|
observer.cpp
|
||||||
osprey.cpp
|
osprey.cpp
|
||||||
pathcorner.cpp
|
pathcorner.cpp
|
||||||
plane.cpp
|
plane.cpp
|
||||||
plats.cpp
|
plats.cpp
|
||||||
player.cpp
|
player.cpp
|
||||||
|
playermonster.cpp
|
||||||
python.cpp
|
python.cpp
|
||||||
rat.cpp
|
rat.cpp
|
||||||
roach.cpp
|
roach.cpp
|
||||||
|
|
|
@ -129,11 +129,13 @@ OBJ = \
|
||||||
$(DLL_OBJDIR)/multiplay_gamerules.o \
|
$(DLL_OBJDIR)/multiplay_gamerules.o \
|
||||||
$(DLL_OBJDIR)/nihilanth.o \
|
$(DLL_OBJDIR)/nihilanth.o \
|
||||||
$(DLL_OBJDIR)/nodes.o \
|
$(DLL_OBJDIR)/nodes.o \
|
||||||
|
$(DLL_OBJDIR)/observer.cpp \^M
|
||||||
$(DLL_OBJDIR)/osprey.o \
|
$(DLL_OBJDIR)/osprey.o \
|
||||||
$(DLL_OBJDIR)/pathcorner.o \
|
$(DLL_OBJDIR)/pathcorner.o \
|
||||||
$(DLL_OBJDIR)/plane.o \
|
$(DLL_OBJDIR)/plane.o \
|
||||||
$(DLL_OBJDIR)/plats.o \
|
$(DLL_OBJDIR)/plats.o \
|
||||||
$(DLL_OBJDIR)/player.o \
|
$(DLL_OBJDIR)/player.o \
|
||||||
|
$(DLL_OBJDIR)/playermonster.o \^M
|
||||||
$(DLL_OBJDIR)/python.o \
|
$(DLL_OBJDIR)/python.o \
|
||||||
$(DLL_OBJDIR)/rat.o \
|
$(DLL_OBJDIR)/rat.o \
|
||||||
$(DLL_OBJDIR)/roach.o \
|
$(DLL_OBJDIR)/roach.o \
|
||||||
|
|
|
@ -99,7 +99,7 @@ typedef enum {
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
char *name;
|
const char *name;
|
||||||
} activity_map_t;
|
} activity_map_t;
|
||||||
|
|
||||||
extern activity_map_t activity_map[];
|
extern activity_map_t activity_map[];
|
||||||
|
|
|
@ -93,5 +93,5 @@ _A( ACT_FLINCH_LEFTARM ),
|
||||||
_A( ACT_FLINCH_RIGHTARM ),
|
_A( ACT_FLINCH_RIGHTARM ),
|
||||||
_A( ACT_FLINCH_LEFTLEG ),
|
_A( ACT_FLINCH_LEFTLEG ),
|
||||||
_A( ACT_FLINCH_RIGHTLEG ),
|
_A( ACT_FLINCH_RIGHTLEG ),
|
||||||
0, NULL
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
|
@ -567,7 +567,6 @@ void CFlockingFlyer::FlockLeaderThink( void )
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
Vector vecDist;// used for general measurements
|
Vector vecDist;// used for general measurements
|
||||||
Vector vecDir;// 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 flLeftSide;
|
||||||
float flRightSide;
|
float flRightSide;
|
||||||
|
|
||||||
|
@ -840,11 +839,11 @@ void CFlockingFlyer::SquadRemove( CFlockingFlyer *pRemove )
|
||||||
{
|
{
|
||||||
CFlockingFlyer *pLeader = m_pSquadNext;
|
CFlockingFlyer *pLeader = m_pSquadNext;
|
||||||
|
|
||||||
// copy the enemy LKP to the new leader
|
|
||||||
pLeader->m_vecEnemyLKP = m_vecEnemyLKP;
|
|
||||||
|
|
||||||
if( pLeader )
|
if( pLeader )
|
||||||
{
|
{
|
||||||
|
// copy the enemy LKP to the new leader
|
||||||
|
pLeader->m_vecEnemyLKP = m_vecEnemyLKP;
|
||||||
|
|
||||||
CFlockingFlyer *pList = pLeader;
|
CFlockingFlyer *pList = pLeader;
|
||||||
|
|
||||||
while( pList )
|
while( pList )
|
||||||
|
|
|
@ -608,30 +608,30 @@ void CAGrunt::Spawn()
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CAGrunt::Precache()
|
void CAGrunt::Precache()
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
PRECACHE_MODEL( "models/agrunt.mdl" );
|
PRECACHE_MODEL( "models/agrunt.mdl" );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
|
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
|
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pIdleSounds[i] );
|
PRECACHE_SOUND( pIdleSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pDieSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pDieSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pDieSounds[i] );
|
PRECACHE_SOUND( pDieSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pPainSounds[i] );
|
PRECACHE_SOUND( pPainSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackSounds[i] );
|
PRECACHE_SOUND( pAttackSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAlertSounds[i] );
|
PRECACHE_SOUND( pAlertSounds[i] );
|
||||||
|
|
||||||
PRECACHE_SOUND( "hassault/hw_shoot1.wav" );
|
PRECACHE_SOUND( "hassault/hw_shoot1.wav" );
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ BOOL CAGrunt::FCanCheckAttacks( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
BOOL CAGrunt::CheckMeleeAttack1( float flDot, float flDist )
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1160,7 +1160,7 @@ Schedule_t *CAGrunt::GetScheduleOfType( int Type )
|
||||||
case SCHED_FAIL:
|
case SCHED_FAIL:
|
||||||
// no fail schedule specified, so pick a good generic one.
|
// no fail schedule specified, so pick a good generic one.
|
||||||
{
|
{
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
// I have an enemy
|
// I have an enemy
|
||||||
// !!!LATER - what if this enemy is really far away and i'm chasing him?
|
// !!!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 );
|
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 )
|
if( !pstudiohdr || pev->sequence >= pstudiohdr->numseq || !pMonsterEvent )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int events = 0;
|
|
||||||
|
|
||||||
mstudioseqdesc_t *pseqdesc;
|
mstudioseqdesc_t *pseqdesc;
|
||||||
mstudioevent_t *pevent;
|
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 )
|
if( setting < 0 )
|
||||||
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 )
|
if( setting < 0 )
|
||||||
setting = 0;
|
setting = 0;
|
||||||
|
|
|
@ -458,7 +458,7 @@ void CApache::HuntThink( void )
|
||||||
if( m_flGoalSpeed < 800 )
|
if( m_flGoalSpeed < 800 )
|
||||||
m_flGoalSpeed += 5;
|
m_flGoalSpeed += 5;
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
// ALERT( at_console, "%s\n", STRING( m_hEnemy->pev->classname ) );
|
// ALERT( at_console, "%s\n", STRING( m_hEnemy->pev->classname ) );
|
||||||
if( FVisible( m_hEnemy ) )
|
if( FVisible( m_hEnemy ) )
|
||||||
|
@ -552,7 +552,7 @@ void CApache::HuntThink( void )
|
||||||
{
|
{
|
||||||
if( m_flLastSeen + 60 > gpGlobals->time )
|
if( m_flLastSeen + 60 > gpGlobals->time )
|
||||||
{
|
{
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
// make sure it's a good shot
|
// make sure it's a good shot
|
||||||
if( DotProduct( m_vecTarget, vecEst ) > .965 )
|
if( DotProduct( m_vecTarget, vecEst ) > .965 )
|
||||||
|
@ -732,7 +732,6 @@ void CApache::Flight( void )
|
||||||
void CApache::FireRocket( void )
|
void CApache::FireRocket( void )
|
||||||
{
|
{
|
||||||
static float side = 1.0;
|
static float side = 1.0;
|
||||||
static int count;
|
|
||||||
|
|
||||||
if( m_iRockets <= 0 )
|
if( m_iRockets <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -805,13 +804,13 @@ BOOL CApache::FireGun()
|
||||||
angles.x = angles.x + 360;
|
angles.x = angles.x + 360;
|
||||||
|
|
||||||
if( angles.x > m_angGun.x )
|
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 )
|
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 )
|
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 )
|
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.y = SetBoneController( 0, m_angGun.y );
|
||||||
m_angGun.x = SetBoneController( 1, m_angGun.x );
|
m_angGun.x = SetBoneController( 1, m_angGun.x );
|
||||||
|
|
|
@ -170,7 +170,7 @@ void CBarnacle::BarnacleThink( void )
|
||||||
#endif
|
#endif
|
||||||
pev->nextthink = gpGlobals->time + 0.1;
|
pev->nextthink = gpGlobals->time + 0.1;
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
// barnacle has prey.
|
// barnacle has prey.
|
||||||
if( !m_hEnemy->IsAlive() )
|
if( !m_hEnemy->IsAlive() )
|
||||||
|
@ -183,7 +183,7 @@ void CBarnacle::BarnacleThink( void )
|
||||||
|
|
||||||
if( m_fLiftingPrey )
|
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.
|
// crap, someone killed the prey on the way up.
|
||||||
m_hEnemy = NULL;
|
m_hEnemy = NULL;
|
||||||
|
@ -352,7 +352,7 @@ void CBarnacle::Killed( entvars_t *pevAttacker, int iGib )
|
||||||
pev->solid = SOLID_NOT;
|
pev->solid = SOLID_NOT;
|
||||||
pev->takedamage = DAMAGE_NO;
|
pev->takedamage = DAMAGE_NO;
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
pVictim = m_hEnemy->MyMonsterPointer();
|
pVictim = m_hEnemy->MyMonsterPointer();
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ void CBarney::RunTask( Task_t *pTask )
|
||||||
switch( pTask->iTask )
|
switch( pTask->iTask )
|
||||||
{
|
{
|
||||||
case TASK_RANGE_ATTACK1:
|
case TASK_RANGE_ATTACK1:
|
||||||
if( m_hEnemy != NULL && ( m_hEnemy->IsPlayer() ) )
|
if( m_hEnemy != 0 && ( m_hEnemy->IsPlayer() ) )
|
||||||
{
|
{
|
||||||
pev->framerate = 1.5;
|
pev->framerate = 1.5;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ int CBarney::Classify( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CBarney::AlertSound( void )
|
void CBarney::AlertSound( void )
|
||||||
{
|
{
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
if( FOkToSpeak() )
|
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
|
// 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 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 the player was facing directly at me, or I'm already suspicious, get mad
|
||||||
if( ( m_afMemory & bits_MEMORY_SUSPICIOUS ) || IsFacing( pevAttacker, pev->origin ) )
|
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 );
|
GetAttachment( 0, vecGunPos, vecGunAngles );
|
||||||
|
|
||||||
CBaseEntity *pGun = DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles );
|
DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetUse( NULL );
|
SetUse( NULL );
|
||||||
|
@ -633,7 +633,7 @@ Schedule_t *CBarney::GetScheduleOfType( int Type )
|
||||||
switch( Type )
|
switch( Type )
|
||||||
{
|
{
|
||||||
case SCHED_ARM_WEAPON:
|
case SCHED_ARM_WEAPON:
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
// face enemy, then draw.
|
// face enemy, then draw.
|
||||||
return slBarneyEnemyDraw;
|
return slBarneyEnemyDraw;
|
||||||
|
@ -721,7 +721,7 @@ Schedule_t *CBarney::GetSchedule( void )
|
||||||
return GetScheduleOfType( SCHED_SMALL_FLINCH );
|
return GetScheduleOfType( SCHED_SMALL_FLINCH );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hEnemy == NULL && IsFollowing() )
|
if( m_hEnemy == 0 && IsFollowing() )
|
||||||
{
|
{
|
||||||
if( !m_hTargetEnt->IsAlive() )
|
if( !m_hTargetEnt->IsAlive() )
|
||||||
{
|
{
|
||||||
|
@ -783,10 +783,10 @@ public:
|
||||||
void KeyValue( KeyValueData *pkvd );
|
void KeyValue( KeyValueData *pkvd );
|
||||||
|
|
||||||
int m_iPose;// which sequence to display -- temporary, don't need to save
|
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 )
|
void CDeadBarney::KeyValue( KeyValueData *pkvd )
|
||||||
{
|
{
|
||||||
|
|
|
@ -195,7 +195,7 @@ public:
|
||||||
Task_t *GetTask( void );
|
Task_t *GetTask( void );
|
||||||
virtual MONSTERSTATE GetIdealState( void );
|
virtual MONSTERSTATE GetIdealState( void );
|
||||||
virtual void SetActivity( Activity NewActivity );
|
virtual void SetActivity( Activity NewActivity );
|
||||||
void SetSequenceByName( char *szSequence );
|
void SetSequenceByName( const char *szSequence );
|
||||||
void SetState( MONSTERSTATE State );
|
void SetState( MONSTERSTATE State );
|
||||||
virtual void ReportAIState( void );
|
virtual void ReportAIState( void );
|
||||||
|
|
||||||
|
@ -327,6 +327,6 @@ public:
|
||||||
BOOL ExitScriptedSequence();
|
BOOL ExitScriptedSequence();
|
||||||
BOOL CineCleanup();
|
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
|
#endif // BASEMONSTER_H
|
||||||
|
|
|
@ -411,7 +411,7 @@ void CBigMomma::SetYawSpeed( void )
|
||||||
{
|
{
|
||||||
int ys;
|
int ys;
|
||||||
|
|
||||||
switch ( m_Activity )
|
switch( m_Activity )
|
||||||
{
|
{
|
||||||
case ACT_IDLE:
|
case ACT_IDLE:
|
||||||
ys = 100;
|
ys = 100;
|
||||||
|
@ -677,7 +677,7 @@ void CBigMomma::Precache()
|
||||||
|
|
||||||
void CBigMomma::Activate( void )
|
void CBigMomma::Activate( void )
|
||||||
{
|
{
|
||||||
if( m_hTargetEnt == NULL )
|
if( m_hTargetEnt == 0 )
|
||||||
Remember( bits_MEMORY_ADVANCE_NODE ); // Start 'er up
|
Remember( bits_MEMORY_ADVANCE_NODE ); // Start 'er up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,7 +985,7 @@ void CBigMomma::RunTask( Task_t *pTask )
|
||||||
{
|
{
|
||||||
float distance;
|
float distance;
|
||||||
|
|
||||||
if( m_hTargetEnt == NULL )
|
if( m_hTargetEnt == 0 )
|
||||||
TaskFail();
|
TaskFail();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1002,7 +1002,7 @@ void CBigMomma::RunTask( Task_t *pTask )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TASK_WAIT_NODE:
|
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;
|
return;
|
||||||
|
|
||||||
if( gpGlobals->time > m_flWaitFinished )
|
if( gpGlobals->time > m_flWaitFinished )
|
||||||
|
@ -1056,7 +1056,6 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
|
||||||
float time = speed / flGravity;
|
float time = speed / flGravity;
|
||||||
vecGrenadeVel = vecSpot2 - vecSpot1;
|
vecGrenadeVel = vecSpot2 - vecSpot1;
|
||||||
vecGrenadeVel.z = 0;
|
vecGrenadeVel.z = 0;
|
||||||
float distance = vecGrenadeVel.Length();
|
|
||||||
|
|
||||||
// Travel half the distance to the target in that time (apex is at the midpoint)
|
// Travel half the distance to the target in that time (apex is at the midpoint)
|
||||||
vecGrenadeVel = vecGrenadeVel * ( 0.5 / time );
|
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
|
if( FStrEq( pkvd->szKeyName, "skin" ) )//skin is used for content type
|
||||||
{
|
{
|
||||||
pev->skin = atof( pkvd->szValue );
|
pev->skin = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -402,7 +402,7 @@ void CFuncRotating::Spawn()
|
||||||
}
|
}
|
||||||
|
|
||||||
UTIL_SetOrigin( pev, pev->origin );
|
UTIL_SetOrigin( pev, pev->origin );
|
||||||
SET_MODEL( ENT(pev), STRING(pev->model) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
|
|
||||||
SetUse( &CFuncRotating::RotatingUse );
|
SetUse( &CFuncRotating::RotatingUse );
|
||||||
// did level designer forget to assign speed?
|
// did level designer forget to assign speed?
|
||||||
|
@ -430,15 +430,13 @@ void CFuncRotating::Spawn()
|
||||||
|
|
||||||
void CFuncRotating::Precache( void )
|
void CFuncRotating::Precache( void )
|
||||||
{
|
{
|
||||||
char* szSoundFile = (char*)STRING( pev->message );
|
const char* szSoundFile = STRING( pev->message );
|
||||||
|
BOOL NullSound = FALSE;
|
||||||
|
|
||||||
// set up fan sounds
|
// set up fan sounds
|
||||||
if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 )
|
if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 )
|
||||||
{
|
{
|
||||||
// if a path is set for a wave, use it
|
// if a path is set for a wave, use it
|
||||||
PRECACHE_SOUND( szSoundFile );
|
|
||||||
|
|
||||||
pev->noiseRunning = ALLOC_STRING( szSoundFile );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -446,42 +444,32 @@ void CFuncRotating::Precache( void )
|
||||||
switch( m_sounds )
|
switch( m_sounds )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "fans/fan1.wav" );
|
szSoundFile = "fans/fan1.wav";
|
||||||
pev->noiseRunning = ALLOC_STRING( "fans/fan1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "fans/fan2.wav" );
|
szSoundFile = "fans/fan2.wav";
|
||||||
pev->noiseRunning = ALLOC_STRING( "fans/fan2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "fans/fan3.wav" );
|
szSoundFile = "fans/fan3.wav";
|
||||||
pev->noiseRunning = ALLOC_STRING( "fans/fan3.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "fans/fan4.wav" );
|
szSoundFile = "fans/fan4.wav";
|
||||||
pev->noiseRunning = ALLOC_STRING( "fans/fan4.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "fans/fan5.wav" );
|
szSoundFile = "fans/fan5.wav";
|
||||||
pev->noiseRunning = ALLOC_STRING( "fans/fan5.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 )
|
szSoundFile = "common/null.wav";
|
||||||
{
|
NullSound = TRUE;
|
||||||
PRECACHE_SOUND( szSoundFile );
|
break;
|
||||||
|
|
||||||
pev->noiseRunning = ALLOC_STRING( szSoundFile );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pev->noiseRunning = ALLOC_STRING( "common/null.wav" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !NullSound )
|
||||||
|
PRECACHE_SOUND( szSoundFile );
|
||||||
|
pev->noiseRunning = MAKE_STRING( szSoundFile );
|
||||||
|
|
||||||
if( pev->avelocity != g_vecZero )
|
if( pev->avelocity != g_vecZero )
|
||||||
{
|
{
|
||||||
// if fan was spinning, and we went through transition or save/restore,
|
// 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;
|
pitch = PITCH_NORM - 1;
|
||||||
|
|
||||||
// change the fan's vol and pitch
|
// 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 );
|
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 ) )
|
fabs( vecAVel.z ) >= fabs( pev->movedir.z * pev->speed ) )
|
||||||
{
|
{
|
||||||
pev->avelocity = pev->movedir * pev->speed;// set speed in case we overshot
|
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 );
|
m_flVolume, m_flAttenuation, SND_CHANGE_PITCH | SND_CHANGE_VOL, FANPITCHMAX );
|
||||||
|
|
||||||
SetThink( &CFuncRotating::Rotate );
|
SetThink( &CFuncRotating::Rotate );
|
||||||
|
@ -613,8 +601,8 @@ void CFuncRotating::SpinDown( void )
|
||||||
pev->avelocity = g_vecZero;// set speed in case we overshot
|
pev->avelocity = g_vecZero;// set speed in case we overshot
|
||||||
|
|
||||||
// stop sound, we're done
|
// stop sound, we're done
|
||||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning /* Stop */ ),
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noiseRunning /* Stop */ ),
|
||||||
0, 0, SND_STOP, m_pitch );
|
0, 0, SND_STOP, (int)m_pitch );
|
||||||
|
|
||||||
SetThink( &CFuncRotating::Rotate );
|
SetThink( &CFuncRotating::Rotate );
|
||||||
Rotate();
|
Rotate();
|
||||||
|
@ -642,7 +630,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
||||||
if( pev->avelocity != g_vecZero )
|
if( pev->avelocity != g_vecZero )
|
||||||
{
|
{
|
||||||
SetThink( &CFuncRotating::SpinDown );
|
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 );
|
// m_flVolume, m_flAttenuation, 0, m_pitch );
|
||||||
|
|
||||||
pev->nextthink = pev->ltime + 0.1;
|
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
|
else// fan is not moving, so start it
|
||||||
{
|
{
|
||||||
SetThink( &CFuncRotating::SpinUp );
|
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 );
|
0.01, m_flAttenuation, 0, FANPITCHMIN );
|
||||||
|
|
||||||
pev->nextthink = pev->ltime + 0.1;
|
pev->nextthink = pev->ltime + 0.1;
|
||||||
|
@ -663,7 +651,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
||||||
// play stopping sound here
|
// play stopping sound here
|
||||||
SetThink( &CFuncRotating::SpinDown );
|
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 );
|
// m_flVolume, m_flAttenuation, 0, m_pitch );
|
||||||
|
|
||||||
pev->nextthink = pev->ltime + 0.1;
|
pev->nextthink = pev->ltime + 0.1;
|
||||||
|
@ -671,7 +659,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
||||||
}
|
}
|
||||||
else
|
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 );
|
m_flVolume, m_flAttenuation, 0, FANPITCHMAX );
|
||||||
pev->avelocity = pev->movedir * pev->speed;
|
pev->avelocity = pev->movedir * pev->speed;
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ int CBullsquid::IgnoreConditions( void )
|
||||||
iIgnore = bits_COND_SMELL | bits_COND_SMELL_FOOD;
|
iIgnore = bits_COND_SMELL | bits_COND_SMELL_FOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
if( FClassnameIs( m_hEnemy->pev, "monster_headcrab" ) )
|
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,
|
// 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).
|
// 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();
|
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( 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 )
|
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 )
|
BOOL CBullsquid::FValidateHintType( short sHint )
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
static short sSquidHints[] =
|
static short sSquidHints[] =
|
||||||
{
|
{
|
||||||
|
@ -784,7 +784,7 @@ void CBullsquid::RunAI( void )
|
||||||
pev->skin = 1;
|
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
|
// chasing enemy. Sprint for last bit
|
||||||
if( ( pev->origin - m_hEnemy->pev->origin).Length2D() < SQUID_SPRINT_DIST )
|
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
|
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.
|
// 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;
|
m_hEnemy = NULL;
|
||||||
|
|
|
@ -275,7 +275,7 @@ IMPLEMENT_SAVERESTORE( CBaseButton, CBaseToggle )
|
||||||
|
|
||||||
void CBaseButton::Precache( void )
|
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
|
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 );
|
pszSound = ButtonSound( (int)m_bLockedSound );
|
||||||
PRECACHE_SOUND( pszSound );
|
PRECACHE_SOUND( pszSound );
|
||||||
m_ls.sLockedSound = ALLOC_STRING( pszSound );
|
m_ls.sLockedSound = MAKE_STRING( pszSound );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_bUnlockedSound )
|
if( m_bUnlockedSound )
|
||||||
{
|
{
|
||||||
pszSound = ButtonSound( (int)m_bUnlockedSound );
|
pszSound = ButtonSound( (int)m_bUnlockedSound );
|
||||||
PRECACHE_SOUND( pszSound );
|
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
|
// 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" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "EA" );
|
||||||
break;
|
break;
|
||||||
case 2: // security door
|
case 2: // security door
|
||||||
m_ls.sUnlockedSentence = MAKE_STRING("ED");
|
m_ls.sUnlockedSentence = MAKE_STRING( "ED" );
|
||||||
break;
|
break;
|
||||||
case 3: // blast door
|
case 3: // blast door
|
||||||
m_ls.sUnlockedSentence = MAKE_STRING("EF");
|
m_ls.sUnlockedSentence = MAKE_STRING( "EF" );
|
||||||
break;
|
break;
|
||||||
case 4: // fire door
|
case 4: // fire door
|
||||||
m_ls.sUnlockedSentence = MAKE_STRING("EFIRE");
|
m_ls.sUnlockedSentence = MAKE_STRING( "EFIRE" );
|
||||||
break;
|
break;
|
||||||
case 5: // chemical door
|
case 5: // chemical door
|
||||||
m_ls.sUnlockedSentence = MAKE_STRING("ECHEM");
|
m_ls.sUnlockedSentence = MAKE_STRING( "ECHEM" );
|
||||||
break;
|
break;
|
||||||
case 6: // radiation door
|
case 6: // radiation door
|
||||||
m_ls.sUnlockedSentence = MAKE_STRING("ERAD");
|
m_ls.sUnlockedSentence = MAKE_STRING( "ERAD" );
|
||||||
break;
|
break;
|
||||||
case 7: // gen containment
|
case 7: // gen containment
|
||||||
m_ls.sUnlockedSentence = MAKE_STRING("ECON");
|
m_ls.sUnlockedSentence = MAKE_STRING( "ECON" );
|
||||||
break;
|
break;
|
||||||
case 8: // maintenance door
|
case 8: // maintenance door
|
||||||
m_ls.sUnlockedSentence = MAKE_STRING("EH");
|
m_ls.sUnlockedSentence = MAKE_STRING( "EH" );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_ls.sUnlockedSentence = 0;
|
m_ls.sUnlockedSentence = 0;
|
||||||
|
@ -381,22 +381,22 @@ void CBaseButton::KeyValue( KeyValueData *pkvd )
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "locked_sound" ) )
|
else if( FStrEq( pkvd->szKeyName, "locked_sound" ) )
|
||||||
{
|
{
|
||||||
m_bLockedSound = atof( pkvd->szValue );
|
m_bLockedSound = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) )
|
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) )
|
||||||
{
|
{
|
||||||
m_bLockedSentence = atof( pkvd->szValue );
|
m_bLockedSentence = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) )
|
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) )
|
||||||
{
|
{
|
||||||
m_bUnlockedSound = atof( pkvd->szValue );
|
m_bUnlockedSound = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) )
|
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) )
|
||||||
{
|
{
|
||||||
m_bUnlockedSentence = atof( pkvd->szValue );
|
m_bUnlockedSentence = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "sounds" ) )
|
else if( FStrEq( pkvd->szKeyName, "sounds" ) )
|
||||||
|
@ -421,12 +421,12 @@ int CBaseButton::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
|
||||||
SetTouch( NULL );
|
SetTouch( NULL );
|
||||||
|
|
||||||
m_hActivator = CBaseEntity::Instance( pevAttacker );
|
m_hActivator = CBaseEntity::Instance( pevAttacker );
|
||||||
if( m_hActivator == NULL )
|
if( m_hActivator == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( code == BUTTON_RETURN )
|
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
|
// Toggle buttons fire when they get back to their "home" position
|
||||||
if( !( pev->spawnflags & SF_BUTTON_TOGGLE ) )
|
if( !( pev->spawnflags & SF_BUTTON_TOGGLE ) )
|
||||||
|
@ -461,7 +461,7 @@ LINK_ENTITY_TO_CLASS( func_button, CBaseButton )
|
||||||
|
|
||||||
void CBaseButton::Spawn()
|
void CBaseButton::Spawn()
|
||||||
{
|
{
|
||||||
char *pszSound;
|
const char *pszSound;
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
//determine sounds for buttons
|
//determine sounds for buttons
|
||||||
|
@ -469,7 +469,7 @@ void CBaseButton::Spawn()
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
pszSound = ButtonSound( m_sounds );
|
pszSound = ButtonSound( m_sounds );
|
||||||
PRECACHE_SOUND( pszSound );
|
PRECACHE_SOUND( pszSound );
|
||||||
pev->noise = ALLOC_STRING( pszSound );
|
pev->noise = MAKE_STRING( pszSound );
|
||||||
|
|
||||||
Precache();
|
Precache();
|
||||||
|
|
||||||
|
@ -525,9 +525,9 @@ void CBaseButton::Spawn()
|
||||||
// Button sound table.
|
// Button sound table.
|
||||||
// Also used by CBaseDoor to get 'touched' door lock/unlock sounds
|
// 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 )
|
switch( sound )
|
||||||
{
|
{
|
||||||
|
@ -657,7 +657,7 @@ void CBaseButton::ButtonUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
|
||||||
{
|
{
|
||||||
if( !m_fStayPushed && FBitSet( pev->spawnflags, SF_BUTTON_TOGGLE ) )
|
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 );
|
//SUB_UseTargets( m_eoActivator );
|
||||||
ButtonReturn();
|
ButtonReturn();
|
||||||
|
@ -716,7 +716,7 @@ void CBaseButton::ButtonTouch( CBaseEntity *pOther )
|
||||||
|
|
||||||
if( code == BUTTON_RETURN )
|
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 );
|
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
|
||||||
ButtonReturn();
|
ButtonReturn();
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ void CBaseButton::ButtonTouch( CBaseEntity *pOther )
|
||||||
//
|
//
|
||||||
void CBaseButton::ButtonActivate()
|
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 ) )
|
if( !UTIL_IsMasterTriggered( m_sMaster, m_hActivator ) )
|
||||||
{
|
{
|
||||||
|
@ -815,7 +815,7 @@ void CBaseButton::ButtonBackHome( void )
|
||||||
|
|
||||||
if( FBitSet( pev->spawnflags, SF_BUTTON_TOGGLE ) )
|
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 );
|
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
|
||||||
}
|
}
|
||||||
|
@ -869,14 +869,14 @@ LINK_ENTITY_TO_CLASS( func_rot_button, CRotButton )
|
||||||
|
|
||||||
void CRotButton::Spawn( void )
|
void CRotButton::Spawn( void )
|
||||||
{
|
{
|
||||||
char *pszSound;
|
const char *pszSound;
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
//determine sounds for buttons
|
//determine sounds for buttons
|
||||||
//a sound of 0 should not make a sound
|
//a sound of 0 should not make a sound
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
pszSound = ButtonSound( m_sounds );
|
pszSound = ButtonSound( m_sounds );
|
||||||
PRECACHE_SOUND( pszSound );
|
PRECACHE_SOUND( pszSound );
|
||||||
pev->noise = ALLOC_STRING( pszSound );
|
pev->noise = MAKE_STRING( pszSound );
|
||||||
|
|
||||||
// set the axis of rotation
|
// set the axis of rotation
|
||||||
CBaseToggle::AxisDir( pev );
|
CBaseToggle::AxisDir( pev );
|
||||||
|
@ -1010,9 +1010,9 @@ void CMomentaryRotButton::Spawn( void )
|
||||||
UTIL_SetOrigin( pev, pev->origin );
|
UTIL_SetOrigin( pev, pev->origin );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
|
|
||||||
char *pszSound = ButtonSound( m_sounds );
|
const char *pszSound = ButtonSound( m_sounds );
|
||||||
PRECACHE_SOUND( pszSound );
|
PRECACHE_SOUND( pszSound );
|
||||||
pev->noise = ALLOC_STRING( pszSound );
|
pev->noise = MAKE_STRING( pszSound );
|
||||||
m_lastUsed = 0;
|
m_lastUsed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,7 +1034,7 @@ void CMomentaryRotButton::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CMomentaryRotButton::PlaySound( void )
|
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
|
// 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;
|
pev->ideal_yaw = CBaseToggle::AxisDelta( pev->spawnflags, pev->angles, m_start ) / m_flMoveDistance;
|
||||||
|
|
||||||
UpdateAllButtons( pev->ideal_yaw, 1 );
|
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 )
|
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_Move ( struct playermove_s *ppmove, int server );
|
||||||
extern "C" void PM_Init ( struct playermove_s *ppmove );
|
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 Vector VecBModelOrigin( entvars_t* pevBModel );
|
||||||
extern DLL_GLOBAL Vector g_vecAttackDir;
|
extern DLL_GLOBAL Vector g_vecAttackDir;
|
||||||
|
@ -441,9 +441,16 @@ edict_t *EHANDLE::Get( void )
|
||||||
|
|
||||||
edict_t *EHANDLE::Set( edict_t *pent )
|
edict_t *EHANDLE::Set( edict_t *pent )
|
||||||
{
|
{
|
||||||
m_pent = pent;
|
|
||||||
if( pent )
|
if( pent )
|
||||||
|
{
|
||||||
|
m_pent = pent;
|
||||||
m_serialnumber = m_pent->serialnumber;
|
m_serialnumber = m_pent->serialnumber;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pent = NULL;
|
||||||
|
m_serialnumber = 0;
|
||||||
|
}
|
||||||
return pent;
|
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).
|
// (that is, no actual entity projectile was involved in the attack so use the shooter's origin).
|
||||||
if( pevAttacker == pevInflictor )
|
if( pevAttacker == pevInflictor )
|
||||||
{
|
{
|
||||||
vecTemp = pevInflictor->origin - VecBModelOrigin( pev );
|
vecTemp = pevAttacker->origin - VecBModelOrigin( pev );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// an actual missile was involved.
|
// an actual missile was involved.
|
||||||
|
@ -598,7 +605,7 @@ int CBaseEntity::Restore( CRestore &restore )
|
||||||
mins = pev->mins; // Set model is about to destroy these
|
mins = pev->mins; // Set model is about to destroy these
|
||||||
maxs = pev->maxs;
|
maxs = pev->maxs;
|
||||||
|
|
||||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
UTIL_SetSize( pev, mins, maxs ); // Reset them
|
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
|
// 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.
|
// 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;
|
edict_t *pent;
|
||||||
CBaseEntity *pEntity;
|
CBaseEntity *pEntity;
|
||||||
|
|
16
dlls/cbase.h
16
dlls/cbase.h
|
@ -12,6 +12,8 @@
|
||||||
* without written permission from Valve LLC.
|
* without written permission from Valve LLC.
|
||||||
*
|
*
|
||||||
****/
|
****/
|
||||||
|
#ifndef CBASE_H
|
||||||
|
#define CBASE_H
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Class Hierachy
|
Class Hierachy
|
||||||
|
@ -177,7 +179,7 @@ public:
|
||||||
virtual void AddPointsToTeam( int score, BOOL bAllowNegativeScore ) {}
|
virtual void AddPointsToTeam( int score, BOOL bAllowNegativeScore ) {}
|
||||||
virtual BOOL AddPlayerItem( CBasePlayerItem *pItem ) { return 0; }
|
virtual BOOL AddPlayerItem( CBasePlayerItem *pItem ) { return 0; }
|
||||||
virtual BOOL RemovePlayerItem( 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 float GetDelay( void ) { return 0; }
|
||||||
virtual int IsMoving( void ) { return pev->velocity != g_vecZero; }
|
virtual int IsMoving( void ) { return pev->velocity != g_vecZero; }
|
||||||
virtual void OverrideReset( void ) {}
|
virtual void OverrideReset( void ) {}
|
||||||
|
@ -229,7 +231,7 @@ public:
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UpdateOnRemove( void );
|
virtual void UpdateOnRemove( void );
|
||||||
|
|
||||||
// common member functions
|
// common member functions
|
||||||
void EXPORT SUB_Remove( void );
|
void EXPORT SUB_Remove( void );
|
||||||
|
@ -280,8 +282,8 @@ public:
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void FunctionCheck( void *pFunction, char *name )
|
void FunctionCheck( void *pFunction, char *name )
|
||||||
{
|
{
|
||||||
if( pFunction && !NAME_FOR_FUNCTION( (unsigned long)( pFunction ) ) )
|
if( pFunction && !NAME_FOR_FUNCTION( (size_t)( pFunction ) ) )
|
||||||
ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING( pev->classname ), name, (unsigned long)pFunction );
|
ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING( pev->classname ), name, (size_t)pFunction );
|
||||||
}
|
}
|
||||||
|
|
||||||
BASEPTR ThinkSet( BASEPTR func, char *name )
|
BASEPTR ThinkSet( BASEPTR func, char *name )
|
||||||
|
@ -314,7 +316,7 @@ public:
|
||||||
// used by monsters that are created by the MonsterMaker
|
// used by monsters that are created by the MonsterMaker
|
||||||
virtual void UpdateOwner( void ) { return; };
|
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;};
|
virtual BOOL FBecomeProne( void ) {return FALSE;};
|
||||||
edict_t *edict() { return ENT( pev ); };
|
edict_t *edict() { return ENT( pev ); };
|
||||||
|
@ -655,8 +657,7 @@ class CSound;
|
||||||
|
|
||||||
#include "basemonster.h"
|
#include "basemonster.h"
|
||||||
|
|
||||||
|
const char *ButtonSound( int sound ); // get string of button sound number
|
||||||
char *ButtonSound( int sound ); // get string of button sound number
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generic Button
|
// Generic Button
|
||||||
|
@ -781,3 +782,4 @@ public:
|
||||||
void Precache( void );
|
void Precache( void );
|
||||||
void KeyValue( KeyValueData *pkvd );
|
void KeyValue( KeyValueData *pkvd );
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
328
dlls/client.cpp
328
dlls/client.cpp
|
@ -38,6 +38,7 @@
|
||||||
#include "weaponinfo.h"
|
#include "weaponinfo.h"
|
||||||
#include "usercmd.h"
|
#include "usercmd.h"
|
||||||
#include "netadr.h"
|
#include "netadr.h"
|
||||||
|
#include "pm_shared.h"
|
||||||
|
|
||||||
extern DLL_GLOBAL ULONG g_ulModelIndexPlayer;
|
extern DLL_GLOBAL ULONG g_ulModelIndexPlayer;
|
||||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||||
|
@ -47,9 +48,15 @@ extern DLL_GLOBAL ULONG g_ulFrameCount;
|
||||||
extern void CopyToBodyQue( entvars_t* pev );
|
extern void CopyToBodyQue( entvars_t* pev );
|
||||||
extern int giPrecacheGrunt;
|
extern int giPrecacheGrunt;
|
||||||
extern int gmsgSayText;
|
extern int gmsgSayText;
|
||||||
|
extern int gmsgBhopcap;
|
||||||
|
|
||||||
|
extern cvar_t allow_spectators;
|
||||||
|
|
||||||
extern int g_teamplay;
|
extern int g_teamplay;
|
||||||
|
|
||||||
|
extern cvar_t bhopcap;
|
||||||
|
extern "C" int g_bhopcap;
|
||||||
|
|
||||||
void LinkUserMessages( void );
|
void LinkUserMessages( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -107,19 +114,18 @@ void ClientDisconnect( edict_t *pEntity )
|
||||||
WRITE_STRING( text );
|
WRITE_STRING( text );
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
|
||||||
CSound *pSound;
|
CSound *pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( pEntity ) );
|
||||||
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.
|
pSound->Reset();
|
||||||
if( pSound )
|
|
||||||
{
|
|
||||||
pSound->Reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// since the edict doesn't get deleted, fix it so it doesn't interfere.
|
// 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.takedamage = DAMAGE_NO;// don't attract autoaim
|
||||||
pEntity->v.solid = SOLID_NOT;// nonsolid
|
pEntity->v.solid = SOLID_NOT;// nonsolid
|
||||||
|
pEntity->v.effects = 0;// clear any effects
|
||||||
UTIL_SetOrigin( &pEntity->v, pEntity->v.origin );
|
UTIL_SetOrigin( &pEntity->v, pEntity->v.origin );
|
||||||
|
|
||||||
g_pGameRules->ClientDisconnected( pEntity );
|
g_pGameRules->ClientDisconnected( pEntity );
|
||||||
|
@ -204,6 +210,97 @@ void ClientPutInServer( edict_t *pEntity )
|
||||||
#include "voice_gamemgr.h"
|
#include "voice_gamemgr.h"
|
||||||
extern CVoiceGameMgr g_VoiceGameMgr;
|
extern CVoiceGameMgr g_VoiceGameMgr;
|
||||||
#endif
|
#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
|
//// HOST_SAY
|
||||||
// String comes in as
|
// String comes in as
|
||||||
// say blah blah blah
|
// say blah blah blah
|
||||||
|
@ -259,26 +356,19 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove quotes if present
|
// remove quotes if present
|
||||||
if( *p == '"' )
|
if( p && *p == '"' )
|
||||||
{
|
{
|
||||||
p++;
|
p++;
|
||||||
p[strlen( p ) - 1] = 0;
|
p[strlen( p ) - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the text has content
|
if( !p || !p[0] || !Q_UnicodeValidate ( p ) )
|
||||||
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 )
|
|
||||||
return; // no character found, so say nothing
|
return; // no character found, so say nothing
|
||||||
|
|
||||||
// turn on color set 2 (color on, no sound)
|
// 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 ) );
|
sprintf( text, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) );
|
||||||
else
|
else
|
||||||
sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) );
|
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 ) )
|
if( g_VoiceGameMgr.PlayerHasBlockedPlayer( client, player ) )
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#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;
|
continue;
|
||||||
|
|
||||||
|
// Spectators can only talk to other specs
|
||||||
|
if( player->IsObserver() && teamonly )
|
||||||
|
if ( !client->IsObserver() )
|
||||||
|
continue;
|
||||||
|
|
||||||
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, client->pev );
|
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, client->pev );
|
||||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||||
WRITE_STRING( text );
|
WRITE_STRING( text );
|
||||||
|
@ -331,7 +426,7 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
||||||
// echo to server console
|
// echo to server console
|
||||||
g_engfuncs.pfnServerPrint( text );
|
g_engfuncs.pfnServerPrint( text );
|
||||||
|
|
||||||
char *temp;
|
const char *temp;
|
||||||
if( teamonly )
|
if( teamonly )
|
||||||
temp = "say_team";
|
temp = "say_team";
|
||||||
else
|
else
|
||||||
|
@ -459,17 +554,55 @@ void ClientCommand( edict_t *pEntity )
|
||||||
{
|
{
|
||||||
GetClassPtr( (CBasePlayer *)pev )->SelectLastItem();
|
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 );
|
// notify other clients of player switching to spectator mode
|
||||||
pPlayer->StartObserver( pev->origin, VARS( pentSpawnSpot )->angles );
|
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
|
// MenuSelect returns true only if the command is properly handled, so don't print a warning
|
||||||
}*/
|
}
|
||||||
else if( FStrEq( pcmd, "VModEnable" ) )
|
else if( FStrEq( pcmd, "VModEnable" ) )
|
||||||
{
|
{
|
||||||
// clear 'Unknown command: VModEnable' in singleplayer
|
// clear 'Unknown command: VModEnable' in singleplayer
|
||||||
|
@ -506,7 +639,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// msg everyone if someone changes their name, and it isn't the first time (changing no name to current name)
|
// 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 sName[256];
|
||||||
char *pName = g_engfuncs.pfnInfoKeyValue( infobuffer, "name" );
|
char *pName = g_engfuncs.pfnInfoKeyValue( infobuffer, "name" );
|
||||||
|
@ -524,12 +657,15 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
||||||
// Set the name
|
// Set the name
|
||||||
g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), infobuffer, "name", sName );
|
g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), infobuffer, "name", sName );
|
||||||
|
|
||||||
char text[256];
|
if( gpGlobals->maxClients > 1 )
|
||||||
snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
{
|
||||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
char text[256];
|
||||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
||||||
WRITE_STRING( text );
|
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||||
MESSAGE_END();
|
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||||
|
WRITE_STRING( text );
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
|
||||||
// team match?
|
// team match?
|
||||||
if( g_teamplay )
|
if( g_teamplay )
|
||||||
|
@ -621,7 +757,6 @@ void PlayerPreThink( edict_t *pEntity )
|
||||||
{
|
{
|
||||||
//ALERT( at_console, "PreThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime );
|
//ALERT( at_console, "PreThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime );
|
||||||
|
|
||||||
entvars_t *pev = &pEntity->v;
|
|
||||||
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
||||||
|
|
||||||
if( pPlayer )
|
if( pPlayer )
|
||||||
|
@ -639,7 +774,6 @@ void PlayerPostThink( edict_t *pEntity )
|
||||||
{
|
{
|
||||||
//ALERT( at_console, "PostThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime );
|
//ALERT( at_console, "PostThink( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime );
|
||||||
|
|
||||||
entvars_t *pev = &pEntity->v;
|
|
||||||
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
||||||
|
|
||||||
if( pPlayer )
|
if( pPlayer )
|
||||||
|
@ -674,8 +808,16 @@ void StartFrame( void )
|
||||||
|
|
||||||
gpGlobals->teamplay = teamplay.value;
|
gpGlobals->teamplay = teamplay.value;
|
||||||
g_ulFrameCount++;
|
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 )
|
void ClientPrecache( void )
|
||||||
{
|
{
|
||||||
|
@ -827,7 +969,6 @@ animation right now.
|
||||||
*/
|
*/
|
||||||
void PlayerCustomization( edict_t *pEntity, customization_t *pCust )
|
void PlayerCustomization( edict_t *pEntity, customization_t *pCust )
|
||||||
{
|
{
|
||||||
entvars_t *pev = &pEntity->v;
|
|
||||||
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE( pEntity );
|
||||||
|
|
||||||
if( !pPlayer )
|
if( !pPlayer )
|
||||||
|
@ -867,7 +1008,6 @@ A spectator has joined the game
|
||||||
*/
|
*/
|
||||||
void SpectatorConnect( edict_t *pEntity )
|
void SpectatorConnect( edict_t *pEntity )
|
||||||
{
|
{
|
||||||
entvars_t *pev = &pEntity->v;
|
|
||||||
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
||||||
|
|
||||||
if( pPlayer )
|
if( pPlayer )
|
||||||
|
@ -883,7 +1023,6 @@ A spectator has left the game
|
||||||
*/
|
*/
|
||||||
void SpectatorDisconnect( edict_t *pEntity )
|
void SpectatorDisconnect( edict_t *pEntity )
|
||||||
{
|
{
|
||||||
entvars_t *pev = &pEntity->v;
|
|
||||||
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
||||||
|
|
||||||
if( pPlayer )
|
if( pPlayer )
|
||||||
|
@ -899,7 +1038,6 @@ A spectator has sent a usercmd
|
||||||
*/
|
*/
|
||||||
void SpectatorThink( edict_t *pEntity )
|
void SpectatorThink( edict_t *pEntity )
|
||||||
{
|
{
|
||||||
entvars_t *pev = &pEntity->v;
|
|
||||||
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE( pEntity );
|
||||||
|
|
||||||
if( pPlayer )
|
if( pPlayer )
|
||||||
|
@ -983,7 +1121,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// don't send if flagged for NODRAW and it's not the host getting the message
|
// 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;
|
return 0;
|
||||||
|
|
||||||
// Ignore ents without valid / visible models
|
// 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->rendermode = ent->v.rendermode;
|
||||||
state->renderamt = ent->v.renderamt;
|
state->renderamt = (int)ent->v.renderamt;
|
||||||
state->renderfx = ent->v.renderfx;
|
state->renderfx = ent->v.renderfx;
|
||||||
state->rendercolor.r = ent->v.rendercolor.x;
|
state->rendercolor.r = (byte)ent->v.rendercolor.x;
|
||||||
state->rendercolor.g = ent->v.rendercolor.y;
|
state->rendercolor.g = (byte)ent->v.rendercolor.y;
|
||||||
state->rendercolor.b = ent->v.rendercolor.z;
|
state->rendercolor.b = (byte)ent->v.rendercolor.z;
|
||||||
|
|
||||||
state->aiment = 0;
|
state->aiment = 0;
|
||||||
if( ent->v.aiment )
|
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->team = ent->v.team;
|
||||||
|
|
||||||
state->usehull = ( ent->v.flags & FL_DUCKING ) ? 1 : 0;
|
state->usehull = ( ent->v.flags & FL_DUCKING ) ? 1 : 0;
|
||||||
state->health = ent->v.health;
|
state->health = (int)ent->v.health;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1518,12 +1656,12 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
|
||||||
item->m_iId = II.iId;
|
item->m_iId = II.iId;
|
||||||
item->m_iClip = gun->m_iClip;
|
item->m_iClip = gun->m_iClip;
|
||||||
|
|
||||||
item->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle, -0.001 );
|
item->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle, -0.001 );
|
||||||
item->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack, -0.001 );
|
item->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack, -0.001 );
|
||||||
item->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack, -0.001 );
|
item->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack, -0.001 );
|
||||||
item->m_fInReload = gun->m_fInReload;
|
item->m_fInReload = gun->m_fInReload;
|
||||||
item->m_fInSpecialReload = gun->m_fInSpecialReload;
|
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->fuser2 = gun->m_flStartThrow;
|
||||||
item->fuser3 = gun->m_flReleaseThrow;
|
item->fuser3 = gun->m_flReleaseThrow;
|
||||||
item->iuser1 = gun->m_chargeReady;
|
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 )
|
void UpdateClientData( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd )
|
||||||
{
|
{
|
||||||
cd->flags = ent->v.flags;
|
if( !ent || !ent->pvPrivateData )
|
||||||
cd->health = ent->v.health;
|
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->flags = pev->flags;
|
||||||
cd->watertype = ent->v.watertype;
|
cd->health = pev->health;
|
||||||
cd->weapons = ent->v.weapons;
|
|
||||||
|
cd->viewmodel = MODEL_INDEX( STRING( pev->viewmodel ) );
|
||||||
|
|
||||||
|
cd->waterlevel = pev->waterlevel;
|
||||||
|
cd->watertype = pev->watertype;
|
||||||
|
cd->weapons = pev->weapons;
|
||||||
|
|
||||||
// Vectors
|
// Vectors
|
||||||
cd->origin = ent->v.origin;
|
cd->origin = pev->origin;
|
||||||
cd->velocity = ent->v.velocity;
|
cd->velocity = pev->velocity;
|
||||||
cd->view_ofs = ent->v.view_ofs;
|
cd->view_ofs = pev->view_ofs;
|
||||||
cd->punchangle = ent->v.punchangle;
|
cd->punchangle = pev->punchangle;
|
||||||
|
|
||||||
cd->bInDuck = ent->v.bInDuck;
|
cd->bInDuck = pev->bInDuck;
|
||||||
cd->flTimeStepSound = ent->v.flTimeStepSound;
|
cd->flTimeStepSound = pev->flTimeStepSound;
|
||||||
cd->flDuckTime = ent->v.flDuckTime;
|
cd->flDuckTime = pev->flDuckTime;
|
||||||
cd->flSwimTime = ent->v.flSwimTime;
|
cd->flSwimTime = pev->flSwimTime;
|
||||||
cd->waterjumptime = ent->v.teleport_time;
|
cd->waterjumptime = pev->teleport_time;
|
||||||
|
|
||||||
strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) );
|
strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) );
|
||||||
|
|
||||||
cd->maxspeed = ent->v.maxspeed;
|
cd->maxspeed = pev->maxspeed;
|
||||||
cd->fov = ent->v.fov;
|
cd->fov = pev->fov;
|
||||||
cd->weaponanim = ent->v.weaponanim;
|
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 defined( CLIENT_WEAPONS )
|
||||||
if( sendweapons )
|
if( sendweapons )
|
||||||
{
|
{
|
||||||
entvars_t *pev = (entvars_t *)&ent->v;
|
|
||||||
CBasePlayer *pl = (CBasePlayer *)CBasePlayer::Instance( pev );
|
|
||||||
|
|
||||||
if( pl )
|
if( pl )
|
||||||
{
|
{
|
||||||
cd->m_flNextAttack = pl->m_flNextAttack;
|
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 )
|
int ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
|
||||||
{
|
{
|
||||||
// Parse stuff from args
|
// 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.
|
// Zero it out since we aren't going to respond.
|
||||||
// If we wanted to response, we'd write data into response_buffer
|
// 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 )
|
switch( hullnumber )
|
||||||
{
|
{
|
||||||
case 0: // Normal player
|
case 0: // Normal player
|
||||||
mins = VEC_HULL_MIN;
|
VEC_HULL_MIN.CopyToArray(mins);
|
||||||
maxs = VEC_HULL_MAX;
|
VEC_HULL_MAX.CopyToArray(maxs);
|
||||||
iret = 1;
|
iret = 1;
|
||||||
break;
|
break;
|
||||||
case 1: // Crouched player
|
case 1: // Crouched player
|
||||||
mins = VEC_DUCK_HULL_MIN;
|
VEC_DUCK_HULL_MIN.CopyToArray(mins);
|
||||||
maxs = VEC_DUCK_HULL_MAX;
|
VEC_DUCK_HULL_MAX.CopyToArray(maxs);
|
||||||
iret = 1;
|
iret = 1;
|
||||||
break;
|
break;
|
||||||
case 2: // Point based hull
|
case 2: // Point based hull
|
||||||
mins = Vector( 0, 0, 0 );
|
Vector( 0, 0, 0 ).CopyToArray(mins);
|
||||||
maxs = Vector( 0, 0, 0 );
|
Vector( 0, 0, 0 ).CopyToArray(maxs);
|
||||||
iret = 1;
|
iret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1739,10 +1903,10 @@ to be created during play ( e.g., grenades, ammo packs, projectiles, corpses, et
|
||||||
*/
|
*/
|
||||||
void CreateInstancedBaselines( void )
|
void CreateInstancedBaselines( void )
|
||||||
{
|
{
|
||||||
int iret = 0;
|
/*int iret = 0;
|
||||||
entity_state_t state;
|
entity_state_t state;
|
||||||
|
|
||||||
memset( &state, 0, sizeof(state) );
|
memset( &state, 0, sizeof(state) );*/
|
||||||
|
|
||||||
// Create any additional baselines here for things like grendates, etc.
|
// Create any additional baselines here for things like grendates, etc.
|
||||||
// iret = ENGINE_INSTANCE_BASELINE( pc->pev->classname, &state );
|
// iret = ENGINE_INSTANCE_BASELINE( pc->pev->classname, &state );
|
||||||
|
|
|
@ -460,11 +460,11 @@ Activity CBaseMonster::GetSmallFlinchActivity( void )
|
||||||
{
|
{
|
||||||
Activity flinchActivity;
|
Activity flinchActivity;
|
||||||
BOOL fTriedDirection;
|
BOOL fTriedDirection;
|
||||||
float flDot;
|
//float flDot;
|
||||||
|
|
||||||
fTriedDirection = FALSE;
|
fTriedDirection = FALSE;
|
||||||
UTIL_MakeVectors( pev->angles );
|
UTIL_MakeVectors( pev->angles );
|
||||||
flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 );
|
//flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 );
|
||||||
|
|
||||||
switch( m_LastHitGroup )
|
switch( m_LastHitGroup )
|
||||||
{
|
{
|
||||||
|
@ -576,8 +576,8 @@ Killed
|
||||||
*/
|
*/
|
||||||
void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
|
void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
|
||||||
{
|
{
|
||||||
unsigned int cCount = 0;
|
//unsigned int cCount = 0;
|
||||||
BOOL fDone = FALSE;
|
//BOOL fDone = FALSE;
|
||||||
|
|
||||||
if( HasMemory( bits_MEMORY_KILLED ) )
|
if( HasMemory( bits_MEMORY_KILLED ) )
|
||||||
{
|
{
|
||||||
|
@ -727,7 +727,7 @@ void CGib::BounceGibTouch( CBaseEntity *pOther )
|
||||||
float volume;
|
float volume;
|
||||||
float zvel = fabs( pev->velocity.z );
|
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 );
|
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.
|
// enemy's last known position is somewhere down the vector that the attack came from.
|
||||||
if( pevInflictor )
|
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;
|
m_vecEnemyLKP = pevInflictor->origin;
|
||||||
}
|
}
|
||||||
|
@ -1463,7 +1463,7 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// make bullet trails
|
// 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 );
|
ApplyMultiDamage( pev, pevAttacker );
|
||||||
}
|
}
|
||||||
|
@ -1483,7 +1483,8 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
Vector vecRight = gpGlobals->v_right;
|
Vector vecRight = gpGlobals->v_right;
|
||||||
Vector vecUp = gpGlobals->v_up;
|
Vector vecUp = gpGlobals->v_up;
|
||||||
float x, y, z;
|
float x = 0.0f, y = 0.0f;
|
||||||
|
float z;
|
||||||
|
|
||||||
if( pevAttacker == NULL )
|
if( pevAttacker == NULL )
|
||||||
pevAttacker = pev; // the default attacker is ourselves
|
pevAttacker = pev; // the default attacker is ourselves
|
||||||
|
@ -1497,7 +1498,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
|
||||||
// get circular gaussian spread
|
// get circular gaussian spread
|
||||||
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 );
|
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 );
|
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 +
|
Vector vecDir = vecDirShooting +
|
||||||
x * vecSpread.x * vecRight +
|
x * vecSpread.x * vecRight +
|
||||||
|
@ -1548,7 +1549,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// make bullet trails
|
// 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 );
|
ApplyMultiDamage( pev, pevAttacker );
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
void Spawn( void );
|
void Spawn( void );
|
||||||
void Precache( void );
|
void Precache( void );
|
||||||
|
void UpdateOnRemove();
|
||||||
void SetYawSpeed( void );
|
void SetYawSpeed( void );
|
||||||
int Classify( void );
|
int Classify( void );
|
||||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||||
|
@ -384,6 +385,23 @@ void CController::Precache()
|
||||||
UTIL_PrecacheOther( "controller_head_ball" );
|
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
|
// 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 vecSrc = vecHand + pev->velocity * ( m_flShootTime - gpGlobals->time );
|
||||||
Vector vecDir;
|
Vector vecDir;
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
if( HasConditions( bits_COND_SEE_ENEMY ) )
|
if( HasConditions( bits_COND_SEE_ENEMY ) )
|
||||||
{
|
{
|
||||||
|
@ -707,7 +725,7 @@ Schedule_t *CController::GetSchedule( void )
|
||||||
{
|
{
|
||||||
case MONSTERSTATE_COMBAT:
|
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
|
// dead enemy
|
||||||
if( HasConditions( bits_COND_LIGHT_DAMAGE ) )
|
if( HasConditions( bits_COND_LIGHT_DAMAGE ) )
|
||||||
|
@ -1095,7 +1113,6 @@ class CControllerHeadBall : public CBaseMonster
|
||||||
void EXPORT BounceTouch( CBaseEntity *pOther );
|
void EXPORT BounceTouch( CBaseEntity *pOther );
|
||||||
void MovetoTarget( Vector vecTarget );
|
void MovetoTarget( Vector vecTarget );
|
||||||
void Crawl( void );
|
void Crawl( void );
|
||||||
int m_iTrail;
|
|
||||||
int m_flNextAttack;
|
int m_flNextAttack;
|
||||||
Vector m_vecIdeal;
|
Vector m_vecIdeal;
|
||||||
EHANDLE m_hOwner;
|
EHANDLE m_hOwner;
|
||||||
|
@ -1160,7 +1177,7 @@ void CControllerHeadBall::HuntThink( void )
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
|
||||||
// check world boundaries
|
// 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 );
|
SetTouch( NULL );
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
|
@ -1340,7 +1357,7 @@ void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
|
||||||
|
|
||||||
entvars_t *pevOwner;
|
entvars_t *pevOwner;
|
||||||
|
|
||||||
if( m_hOwner != NULL )
|
if( m_hOwner != 0 )
|
||||||
{
|
{
|
||||||
pevOwner = m_hOwner->pev;
|
pevOwner = m_hOwner->pev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#define BOLT_AIR_VELOCITY 2000
|
#define BOLT_AIR_VELOCITY 2000
|
||||||
#define BOLT_WATER_VELOCITY 1000
|
#define BOLT_WATER_VELOCITY 1000
|
||||||
|
|
||||||
|
extern BOOL gPhysicsInterfaceInitialized;
|
||||||
|
|
||||||
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
|
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
|
||||||
//
|
//
|
||||||
// OVERLOADS SOME ENTVARS:
|
// OVERLOADS SOME ENTVARS:
|
||||||
|
@ -167,9 +169,11 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
|
||||||
pev->angles.z = RANDOM_LONG( 0, 360 );
|
pev->angles.z = RANDOM_LONG( 0, 360 );
|
||||||
pev->nextthink = gpGlobals->time + 10.0;
|
pev->nextthink = gpGlobals->time + 10.0;
|
||||||
|
|
||||||
// g-cont. Setup movewith feature
|
if (gPhysicsInterfaceInitialized) {
|
||||||
pev->movetype = MOVETYPE_COMPOUND; // set movewith type
|
// g-cont. Setup movewith feature
|
||||||
pev->aiment = ENT( pOther->pev ); // set parent
|
pev->movetype = MOVETYPE_COMPOUND; // set movewith type
|
||||||
|
pev->aiment = ENT( pOther->pev ); // set parent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( UTIL_PointContents( pev->origin ) != CONTENTS_WATER )
|
if( UTIL_PointContents( pev->origin ) != CONTENTS_WATER )
|
||||||
|
@ -349,7 +353,7 @@ void CCrossbow::PrimaryAttack( void )
|
||||||
// this function only gets called in multiplayer
|
// this function only gets called in multiplayer
|
||||||
void CCrossbow::FireSniperBolt()
|
void CCrossbow::FireSniperBolt()
|
||||||
{
|
{
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
|
||||||
|
|
||||||
if( m_iClip == 0 )
|
if( m_iClip == 0 )
|
||||||
{
|
{
|
||||||
|
@ -421,10 +425,11 @@ void CCrossbow::FireBolt()
|
||||||
UTIL_MakeVectors( anglesAim );
|
UTIL_MakeVectors( anglesAim );
|
||||||
|
|
||||||
anglesAim.x = -anglesAim.x;
|
anglesAim.x = -anglesAim.x;
|
||||||
|
|
||||||
|
#ifndef CLIENT_DLL
|
||||||
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2;
|
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2;
|
||||||
Vector vecDir = gpGlobals->v_forward;
|
Vector vecDir = gpGlobals->v_forward;
|
||||||
|
|
||||||
#ifndef CLIENT_DLL
|
|
||||||
CCrossbowBolt *pBolt = CCrossbowBolt::BoltCreate();
|
CCrossbowBolt *pBolt = CCrossbowBolt::BoltCreate();
|
||||||
pBolt->pev->origin = vecSrc;
|
pBolt->pev->origin = vecSrc;
|
||||||
pBolt->pev->angles = anglesAim;
|
pBolt->pev->angles = anglesAim;
|
||||||
|
@ -447,7 +452,7 @@ void CCrossbow::FireBolt()
|
||||||
// HEV suit - indicate out of ammo condition
|
// HEV suit - indicate out of ammo condition
|
||||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||||
|
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
|
||||||
|
|
||||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||||
|
|
||||||
|
@ -476,7 +481,7 @@ void CCrossbow::SecondaryAttack()
|
||||||
|
|
||||||
void CCrossbow::Reload( void )
|
void CCrossbow::Reload( void )
|
||||||
{
|
{
|
||||||
if( m_pPlayer->ammo_bolts <= 0 )
|
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == CROSSBOW_MAX_CLIP )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( m_pPlayer->pev->fov != 0 )
|
if( m_pPlayer->pev->fov != 0 )
|
||||||
|
@ -484,7 +489,7 @@ void CCrossbow::Reload( void )
|
||||||
SecondaryAttack();
|
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 ) );
|
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 )
|
LINK_ENTITY_TO_CLASS( weapon_crowbar, CCrowbar )
|
||||||
|
|
||||||
enum gauss_e
|
enum crowbar_e
|
||||||
{
|
{
|
||||||
CROWBAR_IDLE = 0,
|
CROWBAR_IDLE = 0,
|
||||||
CROWBAR_DRAW,
|
CROWBAR_DRAW,
|
||||||
|
@ -37,11 +37,16 @@ enum gauss_e
|
||||||
CROWBAR_ATTACK2MISS,
|
CROWBAR_ATTACK2MISS,
|
||||||
CROWBAR_ATTACK2HIT,
|
CROWBAR_ATTACK2HIT,
|
||||||
CROWBAR_ATTACK3MISS,
|
CROWBAR_ATTACK3MISS,
|
||||||
|
#ifndef CROWBAR_IDLE_ANIM
|
||||||
CROWBAR_ATTACK3HIT
|
CROWBAR_ATTACK3HIT
|
||||||
|
#else
|
||||||
|
CROWBAR_ATTACK3HIT,
|
||||||
|
CROWBAR_IDLE2,
|
||||||
|
CROWBAR_IDLE3
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void CCrowbar::Spawn()
|
||||||
void CCrowbar::Spawn( )
|
|
||||||
{
|
{
|
||||||
Precache();
|
Precache();
|
||||||
m_iId = WEAPON_CROWBAR;
|
m_iId = WEAPON_CROWBAR;
|
||||||
|
@ -81,6 +86,18 @@ int CCrowbar::GetItemInfo( ItemInfo *p )
|
||||||
return 1;
|
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()
|
BOOL CCrowbar::Deploy()
|
||||||
{
|
{
|
||||||
return DefaultDeploy( "models/v_crowbar.mdl", "models/p_crowbar.mdl", CROWBAR_DRAW, "crowbar" );
|
return DefaultDeploy( "models/v_crowbar.mdl", "models/p_crowbar.mdl", CROWBAR_DRAW, "crowbar" );
|
||||||
|
@ -140,8 +157,10 @@ void CCrowbar::PrimaryAttack()
|
||||||
{
|
{
|
||||||
if( !Swing( 1 ) )
|
if( !Swing( 1 ) )
|
||||||
{
|
{
|
||||||
|
#ifndef CLIENT_DLL
|
||||||
SetThink( &CCrowbar::SwingAgain );
|
SetThink( &CCrowbar::SwingAgain );
|
||||||
pev->nextthink = gpGlobals->time + 0.1;
|
pev->nextthink = gpGlobals->time + 0.1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,17 +201,22 @@ int CCrowbar::Swing( int fFirst )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
|
if( fFirst )
|
||||||
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
|
{
|
||||||
0.0, 0, 0.0 );
|
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( tr.flFraction >= 1.0 )
|
||||||
{
|
{
|
||||||
if( fFirst )
|
if( fFirst )
|
||||||
{
|
{
|
||||||
// miss
|
// 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
|
// player "shoot" animation
|
||||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||||
}
|
}
|
||||||
|
@ -220,26 +244,32 @@ int CCrowbar::Swing( int fFirst )
|
||||||
fDidHit = TRUE;
|
fDidHit = TRUE;
|
||||||
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
|
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
|
// play thwack, smack, or dong sound
|
||||||
float flVol = 1.0;
|
float flVol = 1.0;
|
||||||
int fHitWorld = TRUE;
|
int fHitWorld = TRUE;
|
||||||
|
|
||||||
if( pEntity )
|
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 )
|
if( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
||||||
{
|
{
|
||||||
// play thwack or smack sound
|
// play thwack or smack sound
|
||||||
|
@ -295,12 +325,45 @@ int CCrowbar::Swing( int fFirst )
|
||||||
m_trHit = tr;
|
m_trHit = tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME;
|
m_pPlayer->m_iWeaponVolume = (int)( flVol * CROWBAR_WALLHIT_VOLUME );
|
||||||
#endif
|
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
|
|
||||||
|
|
||||||
SetThink( &CCrowbar::Smack );
|
SetThink( &CCrowbar::Smack );
|
||||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
|
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;
|
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
|
typedef struct
|
||||||
{
|
{
|
||||||
char *name;
|
const char *name;
|
||||||
int index;
|
int index;
|
||||||
} DLL_DECALLIST;
|
} DLL_DECALLIST;
|
||||||
|
|
||||||
|
|
263
dlls/doors.cpp
263
dlls/doors.cpp
|
@ -22,6 +22,8 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
#include "doors.h"
|
#include "doors.h"
|
||||||
|
#include "game.h"
|
||||||
|
#include "weapons.h"
|
||||||
|
|
||||||
extern void SetMovedir( entvars_t *ev );
|
extern void SetMovedir( entvars_t *ev );
|
||||||
|
|
||||||
|
@ -125,7 +127,7 @@ void PlayLockSounds( entvars_t *pev, locksound_t *pls, int flocked, int fbutton
|
||||||
if( fplaysound )
|
if( fplaysound )
|
||||||
{
|
{
|
||||||
// play 'door locked' sound
|
// 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;
|
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
|
// play 'door unlocked' sound if set
|
||||||
if( fplaysound )
|
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;
|
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
|
if( FStrEq( pkvd->szKeyName, "skin" ) )//skin is used for content type
|
||||||
{
|
{
|
||||||
pev->skin = atof( pkvd->szValue );
|
pev->skin = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
else if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
||||||
{
|
{
|
||||||
m_bMoveSnd = atof( pkvd->szValue );
|
m_bMoveSnd = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
||||||
{
|
{
|
||||||
m_bStopSnd = atof( pkvd->szValue );
|
m_bStopSnd = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "healthvalue" ) )
|
else if( FStrEq( pkvd->szKeyName, "healthvalue" ) )
|
||||||
{
|
{
|
||||||
m_bHealthValue = atof( pkvd->szValue );
|
m_bHealthValue = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "locked_sound" ) )
|
else if( FStrEq( pkvd->szKeyName, "locked_sound" ) )
|
||||||
{
|
{
|
||||||
m_bLockedSound = atof( pkvd->szValue );
|
m_bLockedSound = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) )
|
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ) )
|
||||||
{
|
{
|
||||||
m_bLockedSentence = atof( pkvd->szValue );
|
m_bLockedSentence = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) )
|
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ) )
|
||||||
{
|
{
|
||||||
m_bUnlockedSound = atof( pkvd->szValue );
|
m_bUnlockedSound = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) )
|
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ) )
|
||||||
{
|
{
|
||||||
m_bUnlockedSentence = atof( pkvd->szValue );
|
m_bUnlockedSentence = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "WaveHeight" ) )
|
else if( FStrEq( pkvd->szKeyName, "WaveHeight" ) )
|
||||||
|
@ -328,115 +330,105 @@ void CBaseDoor::SetToggleState( int state )
|
||||||
|
|
||||||
void CBaseDoor::Precache( void )
|
void CBaseDoor::Precache( void )
|
||||||
{
|
{
|
||||||
char *pszSound;
|
const char *pszSound;
|
||||||
|
BOOL NullSound = FALSE;
|
||||||
|
|
||||||
// set the door's "in-motion" sound
|
// set the door's "in-motion" sound
|
||||||
switch( m_bMoveSnd )
|
switch( m_bMoveSnd )
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "doors/doormove1.wav" );
|
pszSound = "doors/doormove1.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "doors/doormove2.wav" );
|
pszSound = "doors/doormove2.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "doors/doormove3.wav" );
|
pszSound = "doors/doormove3.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove3.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "doors/doormove4.wav" );
|
pszSound = "doors/doormove4.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove4.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "doors/doormove5.wav" );
|
pszSound = "doors/doormove5.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove5.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
PRECACHE_SOUND( "doors/doormove6.wav" );
|
pszSound = "doors/doormove6.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove6.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
PRECACHE_SOUND( "doors/doormove7.wav" );
|
pszSound = "doors/doormove7.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove7.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
PRECACHE_SOUND( "doors/doormove8.wav" );
|
pszSound = "doors/doormove8.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove8.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
PRECACHE_SOUND( "doors/doormove9.wav" );
|
pszSound = "doors/doormove9.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove9.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
PRECACHE_SOUND( "doors/doormove10.wav" );
|
pszSound = "doors/doormove10.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove10.wav" );
|
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
default:
|
default:
|
||||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
pszSound = "common/null.wav";
|
||||||
|
NullSound = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !NullSound )
|
||||||
|
PRECACHE_SOUND( pszSound );
|
||||||
|
pev->noiseMoving = MAKE_STRING( pszSound );
|
||||||
|
NullSound = FALSE;
|
||||||
|
|
||||||
// set the door's 'reached destination' stop sound
|
// set the door's 'reached destination' stop sound
|
||||||
switch( m_bStopSnd )
|
switch( m_bStopSnd )
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "doors/doorstop1.wav" );
|
pszSound = "doors/doorstop1.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "doors/doorstop2.wav" );
|
pszSound = "doors/doorstop2.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "doors/doorstop3.wav" );
|
pszSound = "doors/doorstop3.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop3.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "doors/doorstop4.wav" );
|
pszSound = "doors/doorstop4.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop4.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "doors/doorstop5.wav" );
|
pszSound = "doors/doorstop5.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop5.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
PRECACHE_SOUND( "doors/doorstop6.wav" );
|
pszSound = "doors/doorstop6.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop6.wav");
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
PRECACHE_SOUND( "doors/doorstop7.wav" );
|
pszSound = "doors/doorstop7.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop7.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
PRECACHE_SOUND( "doors/doorstop8.wav" );
|
pszSound = "doors/doorstop8.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop8.wav" );
|
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
default:
|
default:
|
||||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
pszSound = "common/null.wav";
|
||||||
|
NullSound = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !NullSound )
|
||||||
|
PRECACHE_SOUND( pszSound );
|
||||||
|
pev->noiseArrived = MAKE_STRING( pszSound );
|
||||||
|
|
||||||
// get door button sounds, for doors which are directly 'touched' to open
|
// get door button sounds, for doors which are directly 'touched' to open
|
||||||
if( m_bLockedSound )
|
if( m_bLockedSound )
|
||||||
{
|
{
|
||||||
pszSound = ButtonSound( (int)m_bLockedSound );
|
pszSound = ButtonSound( (int)m_bLockedSound );
|
||||||
PRECACHE_SOUND( pszSound );
|
PRECACHE_SOUND( pszSound );
|
||||||
m_ls.sLockedSound = ALLOC_STRING( pszSound );
|
m_ls.sLockedSound = MAKE_STRING( pszSound );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_bUnlockedSound )
|
if( m_bUnlockedSound )
|
||||||
{
|
{
|
||||||
pszSound = ButtonSound( (int)m_bUnlockedSound );
|
pszSound = ButtonSound( (int)m_bUnlockedSound );
|
||||||
PRECACHE_SOUND( pszSound );
|
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
|
// get sentence group names, for doors which are directly 'touched' to open
|
||||||
|
@ -444,39 +436,39 @@ void CBaseDoor::Precache( void )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
// access denied
|
// access denied
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NA" );
|
m_ls.sLockedSentence = MAKE_STRING( "NA" );
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// security lockout
|
// security lockout
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "ND" );
|
m_ls.sLockedSentence = MAKE_STRING( "ND" );
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// blast door
|
// blast door
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NF" );
|
m_ls.sLockedSentence = MAKE_STRING( "NF" );
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// fire door
|
// fire door
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NFIRE" );
|
m_ls.sLockedSentence = MAKE_STRING( "NFIRE" );
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
// chemical door
|
// chemical door
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NCHEM" );
|
m_ls.sLockedSentence = MAKE_STRING( "NCHEM" );
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// radiation door
|
// radiation door
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NRAD" );
|
m_ls.sLockedSentence = MAKE_STRING( "NRAD" );
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
// gen containment
|
// gen containment
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NCON" );
|
m_ls.sLockedSentence = MAKE_STRING( "NCON" );
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
// maintenance door
|
// maintenance door
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NH" );
|
m_ls.sLockedSentence = MAKE_STRING( "NH" );
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
// broken door
|
// broken door
|
||||||
m_ls.sLockedSentence = ALLOC_STRING( "NG" );
|
m_ls.sLockedSentence = MAKE_STRING( "NG" );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_ls.sLockedSentence = 0;
|
m_ls.sLockedSentence = 0;
|
||||||
|
@ -487,35 +479,35 @@ void CBaseDoor::Precache( void )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
// access granted
|
// access granted
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EA" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "EA" );
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// security door
|
// security door
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ED" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "ED" );
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// blast door
|
// blast door
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EF" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "EF" );
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// fire door
|
// fire door
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EFIRE" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "EFIRE" );
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
// chemical door
|
// chemical door
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ECHEM" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "ECHEM" );
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// radiation door
|
// radiation door
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ERAD" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "ERAD" );
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
// gen containment
|
// gen containment
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "ECON" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "ECON" );
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
// maintenance door
|
// maintenance door
|
||||||
m_ls.sUnlockedSentence = ALLOC_STRING( "EH" );
|
m_ls.sUnlockedSentence = MAKE_STRING( "EH" );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_ls.sUnlockedSentence = 0;
|
m_ls.sUnlockedSentence = 0;
|
||||||
|
@ -581,7 +573,7 @@ int CBaseDoor::DoorActivate()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// door should open
|
// 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)
|
// give health if player opened the door (medikit)
|
||||||
//VARS( m_eoActivator )->health += m_bHealthValue;
|
//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!
|
// filter them out and leave a client stuck with looping door sounds!
|
||||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||||
if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
|
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;
|
m_toggle_state = TS_GOING_UP;
|
||||||
|
|
||||||
|
@ -623,7 +615,7 @@ void CBaseDoor::DoorGoUp( void )
|
||||||
{
|
{
|
||||||
float sign = 1.0;
|
float sign = 1.0;
|
||||||
|
|
||||||
if( m_hActivator != NULL )
|
if( m_hActivator != 0 )
|
||||||
{
|
{
|
||||||
pevActivator = m_hActivator->pev;
|
pevActivator = m_hActivator->pev;
|
||||||
|
|
||||||
|
@ -654,8 +646,8 @@ void CBaseDoor::DoorHitTop( void )
|
||||||
{
|
{
|
||||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
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 ) );
|
||||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT( m_toggle_state == TS_GOING_UP );
|
ASSERT( m_toggle_state == TS_GOING_UP );
|
||||||
|
@ -694,7 +686,7 @@ void CBaseDoor::DoorGoDown( void )
|
||||||
{
|
{
|
||||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||||
if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
|
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
|
#ifdef DOOR_ASSERT
|
||||||
ASSERT( m_toggle_state == TS_AT_TOP );
|
ASSERT( m_toggle_state == TS_AT_TOP );
|
||||||
#endif // DOOR_ASSERT
|
#endif // DOOR_ASSERT
|
||||||
|
@ -714,8 +706,8 @@ void CBaseDoor::DoorHitBottom( void )
|
||||||
{
|
{
|
||||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
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 ) );
|
||||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT( m_toggle_state == TS_GOING_DOWN );
|
ASSERT( m_toggle_state == TS_GOING_DOWN );
|
||||||
|
@ -746,10 +738,22 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
|
||||||
if( pev->dmg )
|
if( pev->dmg )
|
||||||
pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );
|
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,
|
// 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
|
// so let it just squash the object to death real fast
|
||||||
if( m_flWait >= 0 )
|
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 )
|
if( m_toggle_state == TS_GOING_DOWN )
|
||||||
{
|
{
|
||||||
DoorGoUp();
|
DoorGoUp();
|
||||||
|
@ -763,7 +767,7 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
|
||||||
// Block all door pieces with the same targetname here.
|
// Block all door pieces with the same targetname here.
|
||||||
if( !FStringNull( pev->targetname ) )
|
if( !FStringNull( pev->targetname ) )
|
||||||
{
|
{
|
||||||
for(;;)
|
for( ; ; )
|
||||||
{
|
{
|
||||||
pentTarget = FIND_ENTITY_BY_TARGETNAME( pentTarget, STRING( pev->targetname ) );
|
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 ) )
|
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 )
|
if( pDoor->m_toggle_state == TS_GOING_DOWN )
|
||||||
pDoor->DoorGoUp();
|
pDoor->DoorGoUp();
|
||||||
|
@ -978,91 +982,85 @@ void CMomentaryDoor::Spawn( void )
|
||||||
|
|
||||||
void CMomentaryDoor::Precache( void )
|
void CMomentaryDoor::Precache( void )
|
||||||
{
|
{
|
||||||
|
const char *pszSound;
|
||||||
|
BOOL NullSound = FALSE;
|
||||||
|
|
||||||
// set the door's "in-motion" sound
|
// set the door's "in-motion" sound
|
||||||
switch( m_bMoveSnd )
|
switch( m_bMoveSnd )
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "doors/doormove1.wav" );
|
pszSound = "doors/doormove1.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "doors/doormove2.wav" );
|
pszSound = "doors/doormove2.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "doors/doormove3.wav" );
|
pszSound = "doors/doormove3.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove3.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "doors/doormove4.wav" );
|
pszSound = "doors/doormove4.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove4.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "doors/doormove5.wav" );
|
pszSound = "doors/doormove5.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove5.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
PRECACHE_SOUND( "doors/doormove6.wav" );
|
pszSound = "doors/doormove6.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove6.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
PRECACHE_SOUND( "doors/doormove7.wav" );
|
pszSound = "doors/doormove7.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove7.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
PRECACHE_SOUND( "doors/doormove8.wav" );
|
pszSound = "doors/doormove8.wav";
|
||||||
pev->noiseMoving = ALLOC_STRING( "doors/doormove8.wav" );
|
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
default:
|
default:
|
||||||
pev->noiseMoving = ALLOC_STRING( "common/null.wav" );
|
pszSound = "common/null.wav";
|
||||||
|
NullSound = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !NullSound )
|
||||||
|
PRECACHE_SOUND( pszSound );
|
||||||
|
pev->noiseMoving = MAKE_STRING( pszSound );
|
||||||
|
NullSound = FALSE;
|
||||||
|
|
||||||
// set the door's 'reached destination' stop sound
|
// set the door's 'reached destination' stop sound
|
||||||
switch( m_bStopSnd )
|
switch( m_bStopSnd )
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "doors/doorstop1.wav" );
|
pszSound = "doors/doorstop1.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "doors/doorstop2.wav" );
|
pszSound = "doors/doorstop2.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "doors/doorstop3.wav" );
|
pszSound = "doors/doorstop3.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING("doors/doorstop3.wav");
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "doors/doorstop4.wav" );
|
pszSound = "doors/doorstop4.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop4.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "doors/doorstop5.wav" );
|
pszSound = "doors/doorstop5.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop5.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
PRECACHE_SOUND( "doors/doorstop6.wav" );
|
pszSound = "doors/doorstop6.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop6.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
PRECACHE_SOUND( "doors/doorstop7.wav" );
|
pszSound = "doors/doorstop7.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop7.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
PRECACHE_SOUND( "doors/doorstop8.wav" );
|
pszSound = "doors/doorstop8.wav";
|
||||||
pev->noiseArrived = ALLOC_STRING( "doors/doorstop8.wav" );
|
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
default:
|
default:
|
||||||
pev->noiseArrived = ALLOC_STRING( "common/null.wav" );
|
pszSound = "common/null.wav";
|
||||||
|
NullSound = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !NullSound )
|
||||||
|
PRECACHE_SOUND( pszSound );
|
||||||
|
pev->noiseArrived = MAKE_STRING( pszSound );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMomentaryDoor::KeyValue( KeyValueData *pkvd )
|
void CMomentaryDoor::KeyValue( KeyValueData *pkvd )
|
||||||
|
@ -1070,7 +1068,7 @@ void CMomentaryDoor::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
||||||
{
|
{
|
||||||
m_bMoveSnd = atof( pkvd->szValue );
|
m_bMoveSnd = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
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 move = m_vecPosition1 + ( value * ( m_vecPosition2 - m_vecPosition1 ) );
|
||||||
|
|
||||||
Vector delta = move - pev->origin;
|
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 )
|
if( speed != 0 )
|
||||||
{
|
{
|
||||||
// This entity only thinks when it moves, so if it's thinking, it's in the process of moving
|
// 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 )
|
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 );
|
LinearMove( move, speed );
|
||||||
SetMoveDone( &CMomentaryDoor::MomentaryMoveDone );
|
SetMoveDone( &CMomentaryDoor::MomentaryMoveDone );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMomentaryDoor::MomentaryMoveDone( void )
|
void CMomentaryDoor::MomentaryMoveDone( void )
|
||||||
{
|
{
|
||||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) );
|
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
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->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->renderamt = 0; // The engine won't draw this model if this is set to 0 and blending is on
|
||||||
pev->rendermode = kRenderTransTexture;
|
pev->rendermode = kRenderTransTexture;
|
||||||
int speed = pev->speed > 0 ? pev->speed : -pev->speed;
|
int speed = fabs( pev->speed );
|
||||||
|
|
||||||
// HACKHACK!!! - Speed in rendercolor
|
// HACKHACK!!! - Speed in rendercolor
|
||||||
pev->rendercolor.x = speed >> 8;
|
pev->rendercolor.x = speed >> 8;
|
||||||
|
@ -229,7 +229,7 @@ void CBeam::BeamInit( const char *pSpriteName, int width )
|
||||||
SetFrame( 0 );
|
SetFrame( 0 );
|
||||||
SetScrollRate( 0 );
|
SetScrollRate( 0 );
|
||||||
pev->model = MAKE_STRING( pSpriteName );
|
pev->model = MAKE_STRING( pSpriteName );
|
||||||
SetTexture( PRECACHE_MODEL( (char *)pSpriteName ) );
|
SetTexture( PRECACHE_MODEL( pSpriteName ) );
|
||||||
SetWidth( width );
|
SetWidth( width );
|
||||||
pev->skin = 0;
|
pev->skin = 0;
|
||||||
pev->sequence = 0;
|
pev->sequence = 0;
|
||||||
|
@ -280,12 +280,12 @@ void CBeam::RelinkBeam( void )
|
||||||
{
|
{
|
||||||
const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
|
const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
|
||||||
|
|
||||||
pev->mins.x = min( startPos.x, endPos.x );
|
pev->mins.x = Q_min( startPos.x, endPos.x );
|
||||||
pev->mins.y = min( startPos.y, endPos.y );
|
pev->mins.y = Q_min( startPos.y, endPos.y );
|
||||||
pev->mins.z = min( startPos.z, endPos.z );
|
pev->mins.z = Q_min( startPos.z, endPos.z );
|
||||||
pev->maxs.x = max( startPos.x, endPos.x );
|
pev->maxs.x = Q_max( startPos.x, endPos.x );
|
||||||
pev->maxs.y = max( startPos.y, endPos.y );
|
pev->maxs.y = Q_max( startPos.y, endPos.y );
|
||||||
pev->maxs.z = max( startPos.z, endPos.z );
|
pev->maxs.z = Q_max( startPos.z, endPos.z );
|
||||||
pev->mins = pev->mins - pev->origin;
|
pev->mins = pev->mins - pev->origin;
|
||||||
pev->maxs = pev->maxs - pev->origin;
|
pev->maxs = pev->maxs - pev->origin;
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ LINK_ENTITY_TO_CLASS( trip_beam, CTripBeam )
|
||||||
void CTripBeam::Spawn( void )
|
void CTripBeam::Spawn( void )
|
||||||
{
|
{
|
||||||
CLightning::Spawn();
|
CLightning::Spawn();
|
||||||
SetTouch( &TriggerTouch );
|
SetTouch( &CLightning::TriggerTouch );
|
||||||
pev->solid = SOLID_TRIGGER;
|
pev->solid = SOLID_TRIGGER;
|
||||||
RelinkBeam();
|
RelinkBeam();
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ void CLightning::Spawn( void )
|
||||||
|
|
||||||
void CLightning::Precache( void )
|
void CLightning::Precache( void )
|
||||||
{
|
{
|
||||||
m_spriteTexture = PRECACHE_MODEL( (char *)STRING( m_iszSpriteName ) );
|
m_spriteTexture = PRECACHE_MODEL( STRING( m_iszSpriteName ) );
|
||||||
CBeam::Precache();
|
CBeam::Precache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ void CLightning::StrikeThink( void )
|
||||||
WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b
|
WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b
|
||||||
WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b
|
WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b
|
||||||
WRITE_BYTE( (int)pev->rendercolor.z ); // 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
|
WRITE_BYTE( m_speed ); // speed
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
DoSparks( pStart->pev->origin, pEnd->pev->origin );
|
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.x ); // r, g, b
|
||||||
WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b
|
WRITE_BYTE( (int)pev->rendercolor.y ); // r, g, b
|
||||||
WRITE_BYTE( (int)pev->rendercolor.z ); // 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
|
WRITE_BYTE( m_speed ); // speed
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
#else
|
#else
|
||||||
|
@ -944,7 +944,7 @@ void CLaser::Spawn( void )
|
||||||
m_pSprite = NULL;
|
m_pSprite = NULL;
|
||||||
|
|
||||||
if( m_pSprite )
|
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 ) )
|
if( pev->targetname && !( pev->spawnflags & SF_BEAM_STARTON ) )
|
||||||
TurnOff();
|
TurnOff();
|
||||||
|
@ -954,9 +954,9 @@ void CLaser::Spawn( void )
|
||||||
|
|
||||||
void CLaser::Precache( void )
|
void CLaser::Precache( void )
|
||||||
{
|
{
|
||||||
pev->modelindex = PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
pev->modelindex = PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
if( m_iszSpriteName )
|
if( m_iszSpriteName )
|
||||||
PRECACHE_MODEL( (char *)STRING( m_iszSpriteName ) );
|
PRECACHE_MODEL( STRING( m_iszSpriteName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLaser::KeyValue( KeyValueData *pkvd )
|
void CLaser::KeyValue( KeyValueData *pkvd )
|
||||||
|
@ -1100,7 +1100,7 @@ void CGlow::Spawn( void )
|
||||||
pev->effects = 0;
|
pev->effects = 0;
|
||||||
pev->frame = 0;
|
pev->frame = 0;
|
||||||
|
|
||||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
|
|
||||||
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
|
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
|
||||||
|
@ -1160,7 +1160,7 @@ void CSprite::Spawn( void )
|
||||||
|
|
||||||
void CSprite::Precache( void )
|
void CSprite::Precache( void )
|
||||||
{
|
{
|
||||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
|
|
||||||
// Reset attachment after save/restore
|
// Reset attachment after save/restore
|
||||||
if( pev->aiment )
|
if( pev->aiment )
|
||||||
|
@ -1267,7 +1267,7 @@ void CSprite::TurnOn( void )
|
||||||
pev->effects = 0;
|
pev->effects = 0;
|
||||||
if( ( pev->framerate && m_maxFrame > 1.0 ) || ( pev->spawnflags & SF_SPRITE_ONCE ) )
|
if( ( pev->framerate && m_maxFrame > 1.0 ) || ( pev->spawnflags & SF_SPRITE_ONCE ) )
|
||||||
{
|
{
|
||||||
SetThink( &CSprite::CSprite::AnimateThink );
|
SetThink( &CSprite::AnimateThink );
|
||||||
pev->nextthink = gpGlobals->time;
|
pev->nextthink = gpGlobals->time;
|
||||||
m_lastTime = gpGlobals->time;
|
m_lastTime = gpGlobals->time;
|
||||||
}
|
}
|
||||||
|
@ -1515,7 +1515,7 @@ void CEnvShooter::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CEnvShooter::Precache( void )
|
void CEnvShooter::Precache( void )
|
||||||
{
|
{
|
||||||
m_iGibModelIndex = PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
m_iGibModelIndex = PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
CBreakable::MaterialSoundPrecache( (Materials)m_iGibMaterial );
|
CBreakable::MaterialSoundPrecache( (Materials)m_iGibMaterial );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1619,7 +1619,7 @@ void CTestEffect::TestThink( void )
|
||||||
for( i = 0; i < m_iBeam; i++ )
|
for( i = 0; i < m_iBeam; i++ )
|
||||||
{
|
{
|
||||||
t = ( gpGlobals->time - m_flBeamTime[i] ) / ( 3 + m_flStartTime - m_flBeamTime[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 );
|
// m_pBeam[i]->SetScrollRate( 20 * t );
|
||||||
}
|
}
|
||||||
pev->nextthink = gpGlobals->time + 0.1;
|
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 )
|
void CBlood::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if( pev->spawnflags & SF_BLOOD_STREAM )
|
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
|
else
|
||||||
UTIL_BloodDrips( BloodPosition( pActivator ), Direction(), Color(), BloodAmount() );
|
UTIL_BloodDrips( BloodPosition( pActivator ), Direction(), Color(), (int)BloodAmount() );
|
||||||
|
|
||||||
if( pev->spawnflags & SF_BLOOD_DECAL )
|
if( pev->spawnflags & SF_BLOOD_DECAL )
|
||||||
{
|
{
|
||||||
|
@ -1947,12 +1947,12 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
|
||||||
{
|
{
|
||||||
if( pActivator->IsNetClient() )
|
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
|
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 );
|
SUB_UseTargets( this, USE_TOGGLE, 0 );
|
||||||
}
|
}
|
||||||
|
@ -2005,7 +2005,7 @@ void CMessage::Spawn( void )
|
||||||
void CMessage::Precache( void )
|
void CMessage::Precache( void )
|
||||||
{
|
{
|
||||||
if( pev->noise )
|
if( pev->noise )
|
||||||
PRECACHE_SOUND( (char *)STRING( pev->noise ) );
|
PRECACHE_SOUND( STRING( pev->noise ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMessage::KeyValue( KeyValueData *pkvd )
|
void CMessage::KeyValue( KeyValueData *pkvd )
|
||||||
|
@ -2040,16 +2040,15 @@ void CMessage::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useT
|
||||||
if( pActivator && pActivator->IsPlayer() )
|
if( pActivator && pActivator->IsPlayer() )
|
||||||
pPlayer = pActivator;
|
pPlayer = pActivator;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
pPlayer = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );
|
pPlayer = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );
|
||||||
}
|
|
||||||
if( pPlayer )
|
if( pPlayer )
|
||||||
UTIL_ShowMessage( STRING( pev->message ), pPlayer );
|
UTIL_ShowMessage( STRING( pev->message ), pPlayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pev->noise )
|
if( pev->noise )
|
||||||
{
|
|
||||||
EMIT_SOUND( edict(), CHAN_BODY, STRING( pev->noise ), pev->scale, pev->speed );
|
EMIT_SOUND( edict(), CHAN_BODY, STRING( pev->noise ), pev->scale, pev->speed );
|
||||||
}
|
|
||||||
if( pev->spawnflags & SF_MESSAGE_ONCE )
|
if( pev->spawnflags & SF_MESSAGE_ONCE )
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
|
|
||||||
|
@ -2071,7 +2070,7 @@ public:
|
||||||
|
|
||||||
void CEnvFunnel::Precache( void )
|
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 )
|
LINK_ENTITY_TO_CLASS( env_funnel, CEnvFunnel )
|
||||||
|
|
|
@ -238,7 +238,7 @@ public:
|
||||||
|
|
||||||
inline int GetWidth( void )
|
inline int GetWidth( void )
|
||||||
{
|
{
|
||||||
return pev->scale;
|
return (int)pev->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int GetNoise( void )
|
inline int GetNoise( void )
|
||||||
|
@ -255,17 +255,17 @@ public:
|
||||||
|
|
||||||
inline int GetBrightness( void )
|
inline int GetBrightness( void )
|
||||||
{
|
{
|
||||||
return pev->renderamt;
|
return (int)pev->renderamt;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int GetFrame( void )
|
inline int GetFrame( void )
|
||||||
{
|
{
|
||||||
return pev->frame;
|
return (int)pev->frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int GetScrollRate( void )
|
inline int GetScrollRate( void )
|
||||||
{
|
{
|
||||||
return pev->animtime;
|
return (int)pev->animtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call after you change start/end positions
|
// Call after you change start/end positions
|
||||||
|
|
|
@ -143,7 +143,7 @@ float CEgon::GetDischargeInterval( void )
|
||||||
|
|
||||||
BOOL CEgon::HasAmmo( void )
|
BOOL CEgon::HasAmmo( void )
|
||||||
{
|
{
|
||||||
if( m_pPlayer->ammo_uranium <= 0 )
|
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -270,7 +270,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
float timedist;
|
float timedist = 0.0f;
|
||||||
|
|
||||||
switch( m_fireMode )
|
switch( m_fireMode )
|
||||||
{
|
{
|
||||||
|
@ -380,13 +380,13 @@ void CEgon::UpdateEffect( const Vector &startPoint, const Vector &endPoint, floa
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pBeam->SetStartPos( endPoint );
|
m_pBeam->SetStartPos( endPoint );
|
||||||
m_pBeam->SetBrightness( 255 - ( timeBlend * 180 ) );
|
m_pBeam->SetBrightness( (int)( 255 - ( timeBlend * 180 )) );
|
||||||
m_pBeam->SetWidth( 40 - ( timeBlend * 20 ) );
|
m_pBeam->SetWidth( (int)( 40 - ( timeBlend * 20 ) ) );
|
||||||
|
|
||||||
if( m_fireMode == FIRE_WIDE )
|
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
|
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 );
|
UTIL_SetOrigin( m_pSprite->pev, endPoint );
|
||||||
m_pSprite->pev->frame += 8 * gpGlobals->frametime;
|
m_pSprite->pev->frame += 8 * gpGlobals->frametime;
|
||||||
|
|
|
@ -14,10 +14,14 @@
|
||||||
****/
|
****/
|
||||||
#ifndef ENGINECALLBACK_H
|
#ifndef ENGINECALLBACK_H
|
||||||
#define ENGINECALLBACK_H
|
#define ENGINECALLBACK_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "event_flags.h"
|
#include "event_flags.h"
|
||||||
|
|
||||||
|
// Fix warning in MSVC8
|
||||||
|
#undef SERVER_EXECUTE
|
||||||
|
|
||||||
// Must be provided by user of this code
|
// Must be provided by user of this code
|
||||||
extern enginefuncs_t g_engfuncs;
|
extern enginefuncs_t g_engfuncs;
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Silence certain warnings
|
// Silence certain warnings
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable : 4244) // int or float down-conversion
|
#pragma warning(disable : 4244) // int or float down-conversion
|
||||||
#pragma warning(disable : 4305) // int or float data truncation
|
#pragma warning(disable : 4305) // int or float data truncation
|
||||||
#pragma warning(disable : 4201) // nameless struct/union
|
#pragma warning(disable : 4201) // nameless struct/union
|
||||||
#pragma warning(disable : 4514) // unreferenced inline function removed
|
#pragma warning(disable : 4514) // unreferenced inline function removed
|
||||||
#pragma warning(disable : 4100) // unreferenced formal parameter
|
#pragma warning(disable : 4100) // unreferenced formal parameter
|
||||||
|
#endif
|
||||||
|
|
||||||
// Prevent tons of unused windows definitions
|
// Prevent tons of unused windows definitions
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -42,9 +44,13 @@
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#undef HSPRITE
|
#undef HSPRITE
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
|
#ifndef FALSE
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
#ifndef TRUE
|
||||||
#define TRUE (!FALSE)
|
#define TRUE (!FALSE)
|
||||||
typedef unsigned long ULONG;
|
#endif
|
||||||
|
typedef unsigned int ULONG;
|
||||||
typedef unsigned char BYTE;
|
typedef unsigned char BYTE;
|
||||||
typedef int BOOL;
|
typedef int BOOL;
|
||||||
#define MAX_PATH PATH_MAX
|
#define MAX_PATH PATH_MAX
|
||||||
|
@ -57,6 +63,10 @@ typedef int BOOL;
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
|
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||||
|
#define XASH_64BIT
|
||||||
|
#endif
|
||||||
|
|
||||||
// Header file containing definition of globalvars_t and entvars_t
|
// Header file containing definition of globalvars_t and entvars_t
|
||||||
typedef unsigned int func_t;
|
typedef unsigned int func_t;
|
||||||
typedef unsigned int string_t; // from engine's pr_comp.h;
|
typedef unsigned int string_t; // from engine's pr_comp.h;
|
||||||
|
@ -78,11 +88,11 @@ typedef float vec_t; // needed before including progdefs.h
|
||||||
|
|
||||||
// Shared header between the client DLL and the game DLLs
|
// Shared header between the client DLL and the game DLLs
|
||||||
#include "cdll_dll.h"
|
#include "cdll_dll.h"
|
||||||
#ifndef min
|
#ifndef Q_min
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
#ifndef max
|
#ifndef Q_max
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //EXTDLL_H
|
#endif //EXTDLL_H
|
||||||
|
|
|
@ -104,7 +104,7 @@ void CBreakable::KeyValue( KeyValueData* pkvd )
|
||||||
else if( FStrEq( pkvd->szKeyName, "spawnobject" ) )
|
else if( FStrEq( pkvd->szKeyName, "spawnobject" ) )
|
||||||
{
|
{
|
||||||
int object = atoi( pkvd->szValue );
|
int object = atoi( pkvd->szValue );
|
||||||
if( object > 0 && object < ARRAYSIZE( pSpawnObjects ) )
|
if( object > 0 && object < (int)ARRAYSIZE( pSpawnObjects ) )
|
||||||
m_iszSpawnObject = MAKE_STRING( pSpawnObjects[object] );
|
m_iszSpawnObject = MAKE_STRING( pSpawnObjects[object] );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ void CBreakable::MaterialSoundPrecache( Materials precacheMaterial )
|
||||||
|
|
||||||
for( i = 0; i < soundCount; i++ )
|
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 )
|
if( m_iszGibModel )
|
||||||
pGibName = STRING( m_iszGibModel );
|
pGibName = STRING( m_iszGibModel );
|
||||||
|
|
||||||
m_idShard = PRECACHE_MODEL( (char *)pGibName );
|
m_idShard = PRECACHE_MODEL( pGibName );
|
||||||
|
|
||||||
// Precache the spawn item's data
|
// Precache the spawn item's data
|
||||||
if( m_iszSpawnObject )
|
if( m_iszSpawnObject )
|
||||||
UTIL_PrecacheOther( (char *)STRING( m_iszSpawnObject ) );
|
UTIL_PrecacheOther( STRING( m_iszSpawnObject ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// play shard sound when func_breakable takes damage.
|
// play shard sound when func_breakable takes damage.
|
||||||
|
@ -353,7 +353,7 @@ void CBreakable::DamageSound( void )
|
||||||
{
|
{
|
||||||
int pitch;
|
int pitch;
|
||||||
float fvol;
|
float fvol;
|
||||||
char *rgpsz[6];
|
const char *rgpsz[6];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int material = m_Material;
|
int material = m_Material;
|
||||||
|
|
||||||
|
@ -574,7 +574,6 @@ void CBreakable::Die( void )
|
||||||
{
|
{
|
||||||
Vector vecSpot;// shard origin
|
Vector vecSpot;// shard origin
|
||||||
Vector vecVelocity;// shard velocity
|
Vector vecVelocity;// shard velocity
|
||||||
CBaseEntity *pEntity = NULL;
|
|
||||||
char cFlag = 0;
|
char cFlag = 0;
|
||||||
int pitch;
|
int pitch;
|
||||||
float fvol;
|
float fvol;
|
||||||
|
@ -747,7 +746,7 @@ void CBreakable::Die( void )
|
||||||
SetThink( &CBaseEntity::SUB_Remove );
|
SetThink( &CBaseEntity::SUB_Remove );
|
||||||
pev->nextthink = pev->ltime + 0.1;
|
pev->nextthink = pev->ltime + 0.1;
|
||||||
if( m_iszSpawnObject )
|
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() )
|
if( Explodable() )
|
||||||
{
|
{
|
||||||
|
@ -794,7 +793,7 @@ public:
|
||||||
|
|
||||||
static TYPEDESCRIPTION m_SaveData[];
|
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
|
int m_lastSound; // no need to save/restore, just keeps the same sound from playing twice in a row
|
||||||
float m_maxSpeed;
|
float m_maxSpeed;
|
||||||
float m_soundTime;
|
float m_soundTime;
|
||||||
|
@ -810,7 +809,7 @@ IMPLEMENT_SAVERESTORE( CPushable, CBreakable )
|
||||||
|
|
||||||
LINK_ENTITY_TO_CLASS( func_pushable, CPushable )
|
LINK_ENTITY_TO_CLASS( func_pushable, CPushable )
|
||||||
|
|
||||||
char *CPushable::m_soundNames[3] =
|
const char *CPushable::m_soundNames[3] =
|
||||||
{
|
{
|
||||||
"debris/pushbox1.wav",
|
"debris/pushbox1.wav",
|
||||||
"debris/pushbox2.wav",
|
"debris/pushbox2.wav",
|
||||||
|
@ -839,7 +838,7 @@ void CPushable::Spawn( void )
|
||||||
UTIL_SetOrigin( pev, pev->origin );
|
UTIL_SetOrigin( pev, pev->origin );
|
||||||
|
|
||||||
// Multiply by area of the box's cross-section (assume 1000 units^3 standard volume)
|
// 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;
|
m_soundTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,7 +881,7 @@ void CPushable::KeyValue( KeyValueData *pkvd )
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "buoyancy" ) )
|
else if( FStrEq( pkvd->szKeyName, "buoyancy" ) )
|
||||||
{
|
{
|
||||||
pev->skin = atof( pkvd->szValue );
|
pev->skin = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
BOOL StartControl( CBasePlayer* pController );
|
BOOL StartControl( CBasePlayer* pController );
|
||||||
void StopControl( void );
|
void StopControl( void );
|
||||||
void ControllerPostFrame( void );
|
void ControllerPostFrame( void );
|
||||||
|
virtual void StopFire( void ){}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CBasePlayer* m_pController;
|
CBasePlayer* m_pController;
|
||||||
|
@ -190,7 +191,7 @@ void CFuncTank::Spawn( void )
|
||||||
|
|
||||||
if( m_fireRate <= 0 )
|
if( m_fireRate <= 0 )
|
||||||
m_fireRate = 1;
|
m_fireRate = 1;
|
||||||
if( m_spread > MAX_FIRING_SPREADS )
|
if( m_spread > (int)MAX_FIRING_SPREADS )
|
||||||
m_spread = 0;
|
m_spread = 0;
|
||||||
|
|
||||||
pev->oldorigin = pev->origin;
|
pev->oldorigin = pev->origin;
|
||||||
|
@ -199,13 +200,13 @@ void CFuncTank::Spawn( void )
|
||||||
void CFuncTank::Precache( void )
|
void CFuncTank::Precache( void )
|
||||||
{
|
{
|
||||||
if( m_iszSpriteSmoke )
|
if( m_iszSpriteSmoke )
|
||||||
PRECACHE_MODEL( (char *)STRING( m_iszSpriteSmoke ) );
|
PRECACHE_MODEL( STRING( m_iszSpriteSmoke ) );
|
||||||
|
|
||||||
if( m_iszSpriteFlash )
|
if( m_iszSpriteFlash )
|
||||||
PRECACHE_MODEL( (char *)STRING( m_iszSpriteFlash ) );
|
PRECACHE_MODEL( STRING( m_iszSpriteFlash ) );
|
||||||
|
|
||||||
if( pev->noise )
|
if( pev->noise )
|
||||||
PRECACHE_SOUND( (char *)STRING( pev->noise ) );
|
PRECACHE_SOUND( STRING( pev->noise ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFuncTank::KeyValue( KeyValueData *pkvd )
|
void CFuncTank::KeyValue( KeyValueData *pkvd )
|
||||||
|
@ -328,7 +329,7 @@ BOOL CFuncTank::OnControls( entvars_t *pevTest )
|
||||||
if( !( pev->spawnflags & SF_TANK_CANCONTROL ) )
|
if( !( pev->spawnflags & SF_TANK_CANCONTROL ) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Vector offset = pevTest->origin - pev->origin;
|
//Vector offset = pevTest->origin - pev->origin;
|
||||||
|
|
||||||
if( ( m_vecControllerUsePos - pevTest->origin ).Length() < 30 )
|
if( ( m_vecControllerUsePos - pevTest->origin ).Length() < 30 )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -351,6 +352,7 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController )
|
||||||
ALERT( at_console, "using TANK!\n");
|
ALERT( at_console, "using TANK!\n");
|
||||||
|
|
||||||
m_pController = pController;
|
m_pController = pController;
|
||||||
|
m_pController->m_pTank = this;
|
||||||
if( m_pController->m_pActiveItem )
|
if( m_pController->m_pActiveItem )
|
||||||
{
|
{
|
||||||
m_pController->m_pActiveItem->Holster();
|
m_pController->m_pActiveItem->Holster();
|
||||||
|
@ -368,6 +370,8 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController )
|
||||||
|
|
||||||
void CFuncTank::StopControl()
|
void CFuncTank::StopControl()
|
||||||
{
|
{
|
||||||
|
StopFire();
|
||||||
|
|
||||||
// TODO: bring back the controllers current weapon
|
// TODO: bring back the controllers current weapon
|
||||||
if( !m_pController )
|
if( !m_pController )
|
||||||
return;
|
return;
|
||||||
|
@ -380,6 +384,8 @@ void CFuncTank::StopControl()
|
||||||
m_pController->m_iHideHUD &= ~HIDEHUD_WEAPONS;
|
m_pController->m_iHideHUD &= ~HIDEHUD_WEAPONS;
|
||||||
|
|
||||||
pev->nextthink = 0;
|
pev->nextthink = 0;
|
||||||
|
|
||||||
|
m_pController->m_pTank = NULL;
|
||||||
m_pController = NULL;
|
m_pController = NULL;
|
||||||
|
|
||||||
if( IsActive() )
|
if( IsActive() )
|
||||||
|
@ -426,7 +432,6 @@ void CFuncTank::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
|
||||||
}
|
}
|
||||||
else if( !m_pController && useType != USE_OFF )
|
else if( !m_pController && useType != USE_OFF )
|
||||||
{
|
{
|
||||||
( (CBasePlayer*)pActivator )->m_pTank = this;
|
|
||||||
StartControl( (CBasePlayer*)pActivator );
|
StartControl( (CBasePlayer*)pActivator );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -476,9 +481,9 @@ void CFuncTank::TrackTarget( void )
|
||||||
{
|
{
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
edict_t *pPlayer = FIND_CLIENT_IN_PVS( edict() );
|
edict_t *pPlayer = FIND_CLIENT_IN_PVS( edict() );
|
||||||
BOOL updateTime = FALSE, lineOfSight;
|
BOOL updateTime = FALSE;
|
||||||
Vector angles, direction, targetPosition, barrelEnd;
|
Vector angles, direction, targetPosition, barrelEnd;
|
||||||
edict_t *pTarget;
|
edict_t *pTarget = NULL;
|
||||||
|
|
||||||
// Get a position to aim for
|
// Get a position to aim for
|
||||||
if( m_pController )
|
if( m_pController )
|
||||||
|
@ -515,12 +520,8 @@ void CFuncTank::TrackTarget( void )
|
||||||
|
|
||||||
UTIL_TraceLine( barrelEnd, targetPosition, dont_ignore_monsters, edict(), &tr );
|
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 )
|
if( tr.flFraction == 1.0 || tr.pHit == pTarget )
|
||||||
{
|
{
|
||||||
lineOfSight = TRUE;
|
|
||||||
|
|
||||||
CBaseEntity *pInstance = CBaseEntity::Instance(pTarget);
|
CBaseEntity *pInstance = CBaseEntity::Instance(pTarget);
|
||||||
if( InRange( range ) && pInstance && pInstance->IsAlive() )
|
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 );
|
CSprite *pSprite = CSprite::SpriteCreate( STRING( m_iszSpriteSmoke ), barrelEnd, TRUE );
|
||||||
pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0, 20.0 ) );
|
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->pev->velocity.z = RANDOM_FLOAT( 40, 80 );
|
||||||
pSprite->SetScale( m_spriteScale );
|
pSprite->SetScale( m_spriteScale );
|
||||||
}
|
}
|
||||||
|
@ -687,13 +688,13 @@ void CFuncTank::StartRotSound( void )
|
||||||
if( !pev->noise || ( pev->spawnflags & SF_TANK_SOUNDON ) )
|
if( !pev->noise || ( pev->spawnflags & SF_TANK_SOUNDON ) )
|
||||||
return;
|
return;
|
||||||
pev->spawnflags |= SF_TANK_SOUNDON;
|
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 )
|
void CFuncTank::StopRotSound( void )
|
||||||
{
|
{
|
||||||
if( pev->spawnflags & SF_TANK_SOUNDON )
|
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;
|
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.
|
// FireBullets needs gpGlobals->v_up, etc.
|
||||||
UTIL_MakeAimVectors( pev->angles );
|
UTIL_MakeAimVectors( pev->angles );
|
||||||
|
|
||||||
int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate;
|
int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate );
|
||||||
if( bulletCount > 0 )
|
if( bulletCount > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < bulletCount; i++ )
|
for( i = 0; i < bulletCount; i++ )
|
||||||
|
@ -754,6 +755,7 @@ public:
|
||||||
virtual int Save( CSave &save );
|
virtual int Save( CSave &save );
|
||||||
virtual int Restore( CRestore &restore );
|
virtual int Restore( CRestore &restore );
|
||||||
static TYPEDESCRIPTION m_SaveData[];
|
static TYPEDESCRIPTION m_SaveData[];
|
||||||
|
virtual void StopFire( void );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CLaser *m_pLaser;
|
CLaser *m_pLaser;
|
||||||
|
@ -835,7 +837,7 @@ void CFuncTankLaser::Fire( const Vector &barrelEnd, const Vector &forward, entva
|
||||||
// TankTrace needs gpGlobals->v_up, etc.
|
// TankTrace needs gpGlobals->v_up, etc.
|
||||||
UTIL_MakeAimVectors( pev->angles );
|
UTIL_MakeAimVectors( pev->angles );
|
||||||
|
|
||||||
int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate;
|
int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate );
|
||||||
if( bulletCount )
|
if( bulletCount )
|
||||||
{
|
{
|
||||||
for( i = 0; i < bulletCount; i++ )
|
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
|
class CFuncTankRocket : public CFuncTank
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -879,12 +887,12 @@ void CFuncTankRocket::Fire( const Vector &barrelEnd, const Vector &forward, entv
|
||||||
|
|
||||||
if( m_fireLast != 0 )
|
if( m_fireLast != 0 )
|
||||||
{
|
{
|
||||||
int bulletCount = ( gpGlobals->time - m_fireLast ) * m_fireRate;
|
int bulletCount = (int)( ( gpGlobals->time - m_fireLast ) * m_fireRate );
|
||||||
if( bulletCount > 0 )
|
if( bulletCount > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < bulletCount; i++ )
|
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 );
|
CFuncTank::Fire( barrelEnd, forward, pev );
|
||||||
}
|
}
|
||||||
|
@ -917,7 +925,7 @@ void CFuncTankMortar::Fire( const Vector &barrelEnd, const Vector &forward, entv
|
||||||
{
|
{
|
||||||
if( m_fireLast != 0 )
|
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
|
// Only create 1 explosion
|
||||||
if( bulletCount > 0 )
|
if( bulletCount > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,11 +25,13 @@ cvar_t timeleft = { "mp_timeleft","0" , FCVAR_SERVER | FCVAR_UNLOGGED }; // "
|
||||||
|
|
||||||
// multiplayer server rules
|
// multiplayer server rules
|
||||||
cvar_t teamplay = { "mp_teamplay","0", FCVAR_SERVER };
|
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 timelimit = { "mp_timelimit","0", FCVAR_SERVER };
|
||||||
cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER };
|
cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER };
|
||||||
cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
|
cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
|
||||||
cvar_t weaponstay = { "mp_weaponstay","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 forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
|
||||||
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
|
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
|
||||||
cvar_t aimcrosshair = { "mp_autocrosshair","1", 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 teamoverride = { "mp_teamoverride","1" };
|
||||||
cvar_t defaultteam = { "mp_defaultteam","0" };
|
cvar_t defaultteam = { "mp_defaultteam","0" };
|
||||||
cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER };
|
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 };
|
cvar_t mp_chattime = { "mp_chattime","10", FCVAR_SERVER };
|
||||||
|
|
||||||
|
@ -452,6 +457,7 @@ void GameDLLInit( void )
|
||||||
g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );
|
g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );
|
||||||
|
|
||||||
CVAR_REGISTER( &displaysoundlist );
|
CVAR_REGISTER( &displaysoundlist );
|
||||||
|
CVAR_REGISTER( &allow_spectators );
|
||||||
|
|
||||||
CVAR_REGISTER( &teamplay );
|
CVAR_REGISTER( &teamplay );
|
||||||
CVAR_REGISTER( &fraglimit );
|
CVAR_REGISTER( &fraglimit );
|
||||||
|
@ -463,6 +469,8 @@ void GameDLLInit( void )
|
||||||
CVAR_REGISTER( &friendlyfire );
|
CVAR_REGISTER( &friendlyfire );
|
||||||
CVAR_REGISTER( &falldamage );
|
CVAR_REGISTER( &falldamage );
|
||||||
CVAR_REGISTER( &weaponstay );
|
CVAR_REGISTER( &weaponstay );
|
||||||
|
CVAR_REGISTER( &selfgauss );
|
||||||
|
CVAR_REGISTER( &satchelfix );
|
||||||
CVAR_REGISTER( &forcerespawn );
|
CVAR_REGISTER( &forcerespawn );
|
||||||
CVAR_REGISTER( &flashlight );
|
CVAR_REGISTER( &flashlight );
|
||||||
CVAR_REGISTER( &aimcrosshair );
|
CVAR_REGISTER( &aimcrosshair );
|
||||||
|
@ -471,6 +479,7 @@ void GameDLLInit( void )
|
||||||
CVAR_REGISTER( &teamoverride );
|
CVAR_REGISTER( &teamoverride );
|
||||||
CVAR_REGISTER( &defaultteam );
|
CVAR_REGISTER( &defaultteam );
|
||||||
CVAR_REGISTER( &allowmonsters );
|
CVAR_REGISTER( &allowmonsters );
|
||||||
|
CVAR_REGISTER( &bhopcap );
|
||||||
|
|
||||||
CVAR_REGISTER( &mp_chattime );
|
CVAR_REGISTER( &mp_chattime );
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ extern cvar_t timelimit;
|
||||||
extern cvar_t friendlyfire;
|
extern cvar_t friendlyfire;
|
||||||
extern cvar_t falldamage;
|
extern cvar_t falldamage;
|
||||||
extern cvar_t weaponstay;
|
extern cvar_t weaponstay;
|
||||||
|
extern cvar_t selfgauss;
|
||||||
|
extern cvar_t satchelfix;
|
||||||
extern cvar_t forcerespawn;
|
extern cvar_t forcerespawn;
|
||||||
extern cvar_t flashlight;
|
extern cvar_t flashlight;
|
||||||
extern cvar_t aimcrosshair;
|
extern cvar_t aimcrosshair;
|
||||||
|
|
|
@ -200,6 +200,7 @@ class CGargantua : public CBaseMonster
|
||||||
public:
|
public:
|
||||||
void Spawn( void );
|
void Spawn( void );
|
||||||
void Precache( void );
|
void Precache( void );
|
||||||
|
void UpdateOnRemove();
|
||||||
void SetYawSpeed( void );
|
void SetYawSpeed( void );
|
||||||
int Classify( void );
|
int Classify( void );
|
||||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
|
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 )
|
void CGargantua::FlameUpdate( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static float offset[2] = { 60, -60 };
|
|
||||||
TraceResult trace;
|
TraceResult trace;
|
||||||
Vector vecStart, angleGun;
|
Vector vecStart, angleGun;
|
||||||
BOOL streaks = FALSE;
|
BOOL streaks = FALSE;
|
||||||
|
@ -759,7 +759,7 @@ void CGargantua::Spawn()
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CGargantua::Precache()
|
void CGargantua::Precache()
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
PRECACHE_MODEL( "models/garg.mdl" );
|
PRECACHE_MODEL( "models/garg.mdl" );
|
||||||
PRECACHE_MODEL( GARG_EYE_SPRITE_NAME );
|
PRECACHE_MODEL( GARG_EYE_SPRITE_NAME );
|
||||||
|
@ -770,37 +770,50 @@ void CGargantua::Precache()
|
||||||
PRECACHE_SOUND( GARG_STOMP_BUZZ_SOUND );
|
PRECACHE_SOUND( GARG_STOMP_BUZZ_SOUND );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
|
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pBeamAttackSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pBeamAttackSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pBeamAttackSounds[i] );
|
PRECACHE_SOUND( pBeamAttackSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
|
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pRicSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pRicSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pRicSounds[i] );
|
PRECACHE_SOUND( pRicSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pFootSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pFootSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pFootSounds[i] );
|
PRECACHE_SOUND( pFootSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pIdleSounds[i] );
|
PRECACHE_SOUND( pIdleSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||||
PRECACHE_SOUND((char *)pAlertSounds[i]);
|
PRECACHE_SOUND( pAlertSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pPainSounds[i] );
|
PRECACHE_SOUND( pPainSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackSounds[i] );
|
PRECACHE_SOUND( pAttackSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pStompSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pStompSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pStompSounds[i] );
|
PRECACHE_SOUND( pStompSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pBreatheSounds ); 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 )
|
void CGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "soundent.h"
|
#include "soundent.h"
|
||||||
#include "shake.h"
|
#include "shake.h"
|
||||||
#include "gamerules.h"
|
#include "gamerules.h"
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
|
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
|
||||||
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
|
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
|
||||||
|
@ -123,6 +124,12 @@ int CGauss::GetItemInfo( ItemInfo *p )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CGauss::IsUseable()
|
||||||
|
{
|
||||||
|
// Currently charging, allow the player to fire it first. - Solokiller
|
||||||
|
return CBasePlayerWeapon::IsUseable() || m_fInAttack != 0;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CGauss::Deploy()
|
BOOL CGauss::Deploy()
|
||||||
{
|
{
|
||||||
m_pPlayer->m_flPlayAftershock = 0.0;
|
m_pPlayer->m_flPlayAftershock = 0.0;
|
||||||
|
@ -145,7 +152,7 @@ void CGauss::PrimaryAttack()
|
||||||
if( m_pPlayer->pev->waterlevel == 3 )
|
if( m_pPlayer->pev->waterlevel == 3 )
|
||||||
{
|
{
|
||||||
PlayEmptySound();
|
PlayEmptySound();
|
||||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15;
|
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.15 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +190,7 @@ void CGauss::SecondaryAttack()
|
||||||
PlayEmptySound();
|
PlayEmptySound();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +231,22 @@ void CGauss::SecondaryAttack()
|
||||||
}
|
}
|
||||||
else
|
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
|
// 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 )
|
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 )
|
if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge )
|
||||||
{
|
{
|
||||||
// don't eat any more ammo after gun is fully charged.
|
// don't eat any more ammo after gun is fully charged.
|
||||||
m_pPlayer->m_flNextAmmoBurn = 1000;
|
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 )
|
if( pitch > 250 )
|
||||||
pitch = 250;
|
pitch = 250;
|
||||||
|
|
||||||
|
@ -359,11 +372,11 @@ void CGauss::StartFire( void )
|
||||||
void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
||||||
{
|
{
|
||||||
m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
|
m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
|
||||||
|
TraceResult tr, beam_tr;
|
||||||
|
#ifndef CLIENT_DLL
|
||||||
Vector vecSrc = vecOrigSrc;
|
Vector vecSrc = vecOrigSrc;
|
||||||
Vector vecDest = vecSrc + vecDir * 8192;
|
Vector vecDest = vecSrc + vecDir * 8192;
|
||||||
edict_t *pentIgnore;
|
edict_t *pentIgnore;
|
||||||
TraceResult tr, beam_tr;
|
|
||||||
float flMaxFrac = 1.0;
|
float flMaxFrac = 1.0;
|
||||||
int nTotal = 0;
|
int nTotal = 0;
|
||||||
int fHasPunched = 0;
|
int fHasPunched = 0;
|
||||||
|
@ -371,8 +384,7 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
||||||
int nMaxHits = 10;
|
int nMaxHits = 10;
|
||||||
|
|
||||||
pentIgnore = ENT( m_pPlayer->pev );
|
pentIgnore = ENT( m_pPlayer->pev );
|
||||||
|
#else
|
||||||
#ifdef CLIENT_DLL
|
|
||||||
if( m_fPrimaryFire == false )
|
if( m_fPrimaryFire == false )
|
||||||
g_irunninggausspred = true;
|
g_irunninggausspred = true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -501,6 +513,10 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
||||||
|
|
||||||
vecSrc = beam_tr.vecEndPos + vecDir;
|
vecSrc = beam_tr.vecEndPos + vecDir;
|
||||||
}
|
}
|
||||||
|
else if( !selfgauss.value )
|
||||||
|
{
|
||||||
|
flDamage = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -559,6 +575,10 @@ void CGauss::WeaponIdle( void )
|
||||||
StartFire();
|
StartFire();
|
||||||
m_fInAttack = 0;
|
m_fInAttack = 0;
|
||||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,7 +88,7 @@ void CGenericMonster::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
int CGenericMonster::ISoundMask( void )
|
int CGenericMonster::ISoundMask( void )
|
||||||
{
|
{
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -131,7 +131,7 @@ void CGenericMonster::Spawn()
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CGenericMonster::Precache()
|
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.
|
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution.
|
||||||
void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
|
void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
|
||||||
{
|
{
|
||||||
float flRndSound;// sound randomizer
|
// float flRndSound;// sound randomizer
|
||||||
|
|
||||||
pev->model = iStringNull;//invisible
|
pev->model = iStringNull;//invisible
|
||||||
pev->solid = SOLID_NOT;// intangible
|
pev->solid = SOLID_NOT;// intangible
|
||||||
|
@ -102,7 +102,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
|
||||||
UTIL_DecalTrace( pTrace, DECAL_SCORCH2 );
|
UTIL_DecalTrace( pTrace, DECAL_SCORCH2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
flRndSound = RANDOM_FLOAT( 0, 1 );
|
//flRndSound = RANDOM_FLOAT( 0, 1 );
|
||||||
|
|
||||||
switch( RANDOM_LONG( 0, 2 ) )
|
switch( RANDOM_LONG( 0, 2 ) )
|
||||||
{
|
{
|
||||||
|
@ -144,8 +144,8 @@ void CGrenade::Smoke( void )
|
||||||
WRITE_COORD( pev->origin.y );
|
WRITE_COORD( pev->origin.y );
|
||||||
WRITE_COORD( pev->origin.z );
|
WRITE_COORD( pev->origin.z );
|
||||||
WRITE_SHORT( g_sModelIndexSmoke );
|
WRITE_SHORT( g_sModelIndexSmoke );
|
||||||
WRITE_BYTE( ( pev->dmg - 50 ) * 0.80 ); // scale * 10
|
WRITE_BYTE( (int)( ( pev->dmg - 50 ) * 0.80 ) ); // scale * 10
|
||||||
WRITE_BYTE( 12 ); // framerate
|
WRITE_BYTE( 12 ); // framerate
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
}
|
}
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
|
@ -165,7 +165,7 @@ void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
|
||||||
|
|
||||||
void CGrenade::PreDetonate( void )
|
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 );
|
SetThink( &CGrenade::Detonate );
|
||||||
pev->nextthink = gpGlobals->time + 1;
|
pev->nextthink = gpGlobals->time + 1;
|
||||||
|
@ -207,7 +207,7 @@ void CGrenade::DangerSoundThink( void )
|
||||||
return;
|
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;
|
pev->nextthink = gpGlobals->time + 0.2;
|
||||||
|
|
||||||
if( pev->waterlevel != 0 )
|
if( pev->waterlevel != 0 )
|
||||||
|
@ -253,7 +253,7 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
|
||||||
// go ahead and emit the danger sound.
|
// go ahead and emit the danger sound.
|
||||||
|
|
||||||
// register a radius louder than the explosion, so we make sure everyone gets out of the way
|
// 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;
|
m_fRegisteredSound = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,18 @@ int CGlock::GetItemInfo( ItemInfo *p )
|
||||||
return 1;
|
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()
|
BOOL CGlock::Deploy()
|
||||||
{
|
{
|
||||||
// pev->body = 1;
|
// pev->body = 1;
|
||||||
|
@ -109,7 +121,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
|
||||||
if( m_fFireOnEmpty )
|
if( m_fFireOnEmpty )
|
||||||
{
|
{
|
||||||
PlayEmptySound();
|
PlayEmptySound();
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
|
m_flNextPrimaryAttack = GetNextAttackDelay( 0.2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
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 );
|
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 )
|
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||||
// HEV suit - indicate out of ammo condition
|
// HEV suit - indicate out of ammo condition
|
||||||
|
@ -169,15 +181,15 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
|
||||||
|
|
||||||
void CGlock::Reload( void )
|
void CGlock::Reload( void )
|
||||||
{
|
{
|
||||||
if( m_pPlayer->ammo_9mm <= 0 )
|
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == GLOCK_MAX_CLIP )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int iResult;
|
int iResult;
|
||||||
|
|
||||||
if( m_iClip == 0 )
|
if( m_iClip == 0 )
|
||||||
iResult = DefaultReload( 17, GLOCK_RELOAD, 1.5 );
|
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5 );
|
||||||
else
|
else
|
||||||
iResult = DefaultReload( 17, GLOCK_RELOAD_NOT_EMPTY, 1.5 );
|
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5 );
|
||||||
|
|
||||||
if( iResult )
|
if( iResult )
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,7 +109,7 @@ void CGMan::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
int CGMan::ISoundMask( void )
|
int CGMan::ISoundMask( void )
|
||||||
{
|
{
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -149,7 +149,7 @@ void CGMan::StartTask( Task_t *pTask )
|
||||||
switch( pTask->iTask )
|
switch( pTask->iTask )
|
||||||
{
|
{
|
||||||
case TASK_WAIT:
|
case TASK_WAIT:
|
||||||
if( m_hPlayer == NULL )
|
if( m_hPlayer == 0 )
|
||||||
{
|
{
|
||||||
m_hPlayer = UTIL_FindEntityByClassname( NULL, "player" );
|
m_hPlayer = UTIL_FindEntityByClassname( NULL, "player" );
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void CGMan::RunTask( Task_t *pTask )
|
||||||
{
|
{
|
||||||
case TASK_WAIT:
|
case TASK_WAIT:
|
||||||
// look at who I'm talking to
|
// 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;
|
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 );
|
SetBoneController( 0, yaw );
|
||||||
}
|
}
|
||||||
// look at player, but only if playing a "safe" idle animation
|
// 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;
|
float yaw = VecToYaw( m_hPlayer->pev->origin - pev->origin ) - pev->angles.y;
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ void CRecharge::Spawn()
|
||||||
UTIL_SetOrigin( pev, pev->origin ); // set size and link into world
|
UTIL_SetOrigin( pev, pev->origin ); // set size and link into world
|
||||||
UTIL_SetSize( pev, pev->mins, pev->maxs );
|
UTIL_SetSize( pev, pev->mins, pev->maxs );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
m_iJuice = gSkillData.suitchargerCapacity;
|
m_iJuice = (int)gSkillData.suitchargerCapacity;
|
||||||
pev->frame = 0;
|
pev->frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
|
||||||
|
|
||||||
void CRecharge::Recharge( void )
|
void CRecharge::Recharge( void )
|
||||||
{
|
{
|
||||||
m_iJuice = gSkillData.suitchargerCapacity;
|
m_iJuice = (int)gSkillData.suitchargerCapacity;
|
||||||
pev->frame = 0;
|
pev->frame = 0;
|
||||||
SetThink( &CBaseEntity::SUB_DoNothing );
|
SetThink( &CBaseEntity::SUB_DoNothing );
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void CRecharge::Off( void )
|
||||||
|
|
||||||
m_iOn = 0;
|
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;
|
pev->nextthink = pev->ltime + m_iReactivate;
|
||||||
SetThink( &CRecharge::Recharge );
|
SetThink( &CRecharge::Recharge );
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
class CLegacyCineMonster : public CBaseMonster
|
class CLegacyCineMonster : public CBaseMonster
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void CineSpawn( char *szModel );
|
void CineSpawn( const char *szModel );
|
||||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||||
void EXPORT CineThink( void );
|
void EXPORT CineThink( void );
|
||||||
void Pain( void );
|
void Pain( void );
|
||||||
|
@ -103,7 +103,7 @@ LINK_ENTITY_TO_CLASS( monster_cine3_barney, CCine3Barney )
|
||||||
// ********** Scientist SPAWN **********
|
// ********** Scientist SPAWN **********
|
||||||
//
|
//
|
||||||
|
|
||||||
void CLegacyCineMonster :: CineSpawn( char *szModel )
|
void CLegacyCineMonster :: CineSpawn( const char *szModel )
|
||||||
{
|
{
|
||||||
PRECACHE_MODEL(szModel);
|
PRECACHE_MODEL(szModel);
|
||||||
SET_MODEL(ENT(pev), szModel);
|
SET_MODEL(ENT(pev), szModel);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
class CCycler : public CBaseMonster
|
class CCycler : public CBaseMonster
|
||||||
{
|
{
|
||||||
public:
|
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 ); }
|
virtual int ObjectCaps( void ) { return ( CBaseEntity::ObjectCaps() | FCAP_IMPULSE_USE ); }
|
||||||
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
|
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
|
||||||
void Spawn( void );
|
void Spawn( void );
|
||||||
|
@ -67,7 +67,7 @@ class CGenericCycler : public CCycler
|
||||||
public:
|
public:
|
||||||
void Spawn( void )
|
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
|
// 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 )
|
if( !szModel || !*szModel )
|
||||||
{
|
{
|
||||||
|
@ -255,7 +255,7 @@ void CCyclerSprite::Spawn( void )
|
||||||
m_animate = 1;
|
m_animate = 1;
|
||||||
m_lastTime = gpGlobals->time;
|
m_lastTime = gpGlobals->time;
|
||||||
|
|
||||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
|
|
||||||
m_maxFrame = (float)MODEL_FRAMES( pev->modelindex ) - 1;
|
m_maxFrame = (float)MODEL_FRAMES( pev->modelindex ) - 1;
|
||||||
|
@ -314,7 +314,7 @@ void CWeaponCycler::Spawn()
|
||||||
pev->solid = SOLID_SLIDEBOX;
|
pev->solid = SOLID_SLIDEBOX;
|
||||||
pev->movetype = MOVETYPE_NONE;
|
pev->movetype = MOVETYPE_NONE;
|
||||||
|
|
||||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
m_iszModel = pev->model;
|
m_iszModel = pev->model;
|
||||||
m_iModel = pev->modelindex;
|
m_iModel = pev->modelindex;
|
||||||
|
@ -401,18 +401,18 @@ void CWreckage::Spawn( void )
|
||||||
|
|
||||||
if( pev->model )
|
if( pev->model )
|
||||||
{
|
{
|
||||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
}
|
}
|
||||||
// pev->scale = 5.0;
|
// pev->scale = 5.0;
|
||||||
|
|
||||||
m_flStartTime = gpGlobals->time;
|
m_flStartTime = (int)gpGlobals->time;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWreckage::Precache()
|
void CWreckage::Precache()
|
||||||
{
|
{
|
||||||
if( pev->model )
|
if( pev->model )
|
||||||
PRECACHE_MODEL( (char *)STRING( pev->model ) );
|
PRECACHE_MODEL( STRING( pev->model ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWreckage::Think( void )
|
void CWreckage::Think( void )
|
||||||
|
|
|
@ -99,8 +99,13 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ )
|
||||||
{
|
{
|
||||||
// no more grenades!
|
// no more grenades!
|
||||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_HANDGRENADE );
|
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_HANDGRENADE );
|
||||||
SetThink( &CBasePlayerItem::DestroyItem );
|
DestroyItem();
|
||||||
pev->nextthink = gpGlobals->time + 0.1;
|
}
|
||||||
|
|
||||||
|
if( m_flStartThrow )
|
||||||
|
{
|
||||||
|
m_flStartThrow = 0;
|
||||||
|
m_flReleaseThrow = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
|
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_flReleaseThrow = 0;
|
||||||
m_flStartThrow = 0;
|
m_flStartThrow = 0;
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||||
|
|
||||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||||
|
@ -180,7 +185,7 @@ void CHandGrenade::WeaponIdle( void )
|
||||||
// just threw last grenade
|
// just threw last grenade
|
||||||
// set attack times in the future, and weapon idle in the future so we can see the whole throw
|
// 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.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ void CHAssassin::SetYawSpeed( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CHAssassin::Shoot( void )
|
void CHAssassin::Shoot( void )
|
||||||
{
|
{
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ IMPLEMENT_CUSTOM_SCHEDULES( CHAssassin, CBaseMonster )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
BOOL CHAssassin::CheckMeleeAttack1( float flDot, float flDist )
|
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;
|
TraceResult tr;
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ void CHAssassin::RunAI( void )
|
||||||
|
|
||||||
// always visible if moving
|
// always visible if moving
|
||||||
// always visible is not on hard
|
// 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;
|
m_iTargetRanderamt = 255;
|
||||||
else
|
else
|
||||||
m_iTargetRanderamt = 20;
|
m_iTargetRanderamt = 20;
|
||||||
|
@ -699,12 +699,12 @@ void CHAssassin::RunAI( void )
|
||||||
EMIT_SOUND( ENT( pev ), CHAN_BODY, "debris/beamstart1.wav", 0.2, ATTN_NORM );
|
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;
|
pev->rendermode = kRenderTransTexture;
|
||||||
}
|
}
|
||||||
else if( pev->renderamt < m_iTargetRanderamt )
|
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 )
|
if( pev->renderamt == 255 )
|
||||||
pev->rendermode = kRenderNormal;
|
pev->rendermode = kRenderNormal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ void CHeadCrab::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
UTIL_MakeVectors( pev->angles );
|
UTIL_MakeVectors( pev->angles );
|
||||||
|
|
||||||
Vector vecJumpDir;
|
Vector vecJumpDir;
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
float gravity = g_psv_gravity->value;
|
float gravity = g_psv_gravity->value;
|
||||||
if( gravity <= 1 )
|
if( gravity <= 1 )
|
||||||
|
@ -538,7 +538,7 @@ Schedule_t *CBabyCrab::GetScheduleOfType( int Type )
|
||||||
switch( Type )
|
switch( Type )
|
||||||
{
|
{
|
||||||
case SCHED_FAIL: // If you fail, try to jump!
|
case SCHED_FAIL: // If you fail, try to jump!
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
return slHCRangeAttack1Fast;
|
return slHCRangeAttack1Fast;
|
||||||
break;
|
break;
|
||||||
case SCHED_RANGE_ATTACK1:
|
case SCHED_RANGE_ATTACK1:
|
||||||
|
|
|
@ -159,7 +159,7 @@ void CWallHealth::Spawn()
|
||||||
UTIL_SetOrigin( pev, pev->origin ); // set size and link into world
|
UTIL_SetOrigin( pev, pev->origin ); // set size and link into world
|
||||||
UTIL_SetSize( pev, pev->mins, pev->maxs );
|
UTIL_SetSize( pev, pev->mins, pev->maxs );
|
||||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||||
m_iJuice = gSkillData.healthchargerCapacity;
|
m_iJuice = (int)gSkillData.healthchargerCapacity;
|
||||||
pev->frame = 0;
|
pev->frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
|
||||||
void CWallHealth::Recharge( void )
|
void CWallHealth::Recharge( void )
|
||||||
{
|
{
|
||||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM );
|
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;
|
pev->frame = 0;
|
||||||
SetThink( &CBaseEntity::SUB_DoNothing );
|
SetThink( &CBaseEntity::SUB_DoNothing );
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ void CWallHealth::Off( void )
|
||||||
|
|
||||||
m_iOn = 0;
|
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;
|
pev->nextthink = pev->ltime + m_iReactivate;
|
||||||
SetThink( &CWallHealth::Recharge );
|
SetThink( &CWallHealth::Recharge );
|
||||||
|
|
|
@ -217,7 +217,7 @@ const char *CHGrunt::pGruntSentences[] =
|
||||||
"HG_TAUNT", // say rude things
|
"HG_TAUNT", // say rude things
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
typedef enum
|
||||||
{
|
{
|
||||||
HGRUNT_SENT_NONE = -1,
|
HGRUNT_SENT_NONE = -1,
|
||||||
HGRUNT_SENT_GREN = 0,
|
HGRUNT_SENT_GREN = 0,
|
||||||
|
@ -366,7 +366,7 @@ void CHGrunt::JustSpoke( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CHGrunt::PrescheduleThink( void )
|
void CHGrunt::PrescheduleThink( void )
|
||||||
{
|
{
|
||||||
if( InSquad() && m_hEnemy != NULL )
|
if( InSquad() && m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
if( HasConditions( bits_COND_SEE_ENEMY ) )
|
if( HasConditions( bits_COND_SEE_ENEMY ) )
|
||||||
{
|
{
|
||||||
|
@ -413,9 +413,9 @@ BOOL CHGrunt::FCanCheckAttacks( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist )
|
BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist )
|
||||||
{
|
{
|
||||||
CBaseMonster *pEnemy;
|
CBaseMonster *pEnemy = 0;
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
pEnemy = m_hEnemy->MyMonsterPointer();
|
pEnemy = m_hEnemy->MyMonsterPointer();
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ Vector CHGrunt::GetGunPosition()
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CHGrunt::Shoot( void )
|
void CHGrunt::Shoot( void )
|
||||||
{
|
{
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ void CHGrunt::Shoot( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CHGrunt::Shotgun( void )
|
void CHGrunt::Shotgun( void )
|
||||||
{
|
{
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1834,7 +1834,7 @@ IMPLEMENT_CUSTOM_SCHEDULES( CHGrunt, CSquadMonster )
|
||||||
void CHGrunt::SetActivity( Activity NewActivity )
|
void CHGrunt::SetActivity( Activity NewActivity )
|
||||||
{
|
{
|
||||||
int iSequence = ACTIVITY_NOT_AVAILABLE;
|
int iSequence = ACTIVITY_NOT_AVAILABLE;
|
||||||
void *pmodel = GET_MODEL_PTR( ENT( pev ) );
|
//void *pmodel = GET_MODEL_PTR( ENT( pev ) );
|
||||||
|
|
||||||
switch( NewActivity )
|
switch( NewActivity )
|
||||||
{
|
{
|
||||||
|
@ -2032,10 +2032,10 @@ Schedule_t *CHGrunt::GetSchedule( void )
|
||||||
// before he starts pluggin away.
|
// before he starts pluggin away.
|
||||||
if( FOkToSpeak() )// && RANDOM_LONG( 0, 1 ) )
|
if( FOkToSpeak() )// && RANDOM_LONG( 0, 1 ) )
|
||||||
{
|
{
|
||||||
if( ( m_hEnemy != NULL ) && m_hEnemy->IsPlayer() )
|
if( ( m_hEnemy != 0 ) && m_hEnemy->IsPlayer() )
|
||||||
// player
|
// player
|
||||||
SENTENCEG_PlayRndSz( ENT( pev ), "HG_ALERT", HGRUNT_SENTENCE_VOLUME, GRUNT_ATTN, 0, m_voicePitch );
|
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_PLAYER_ALLY ) &&
|
||||||
( m_hEnemy->Classify() != CLASS_HUMAN_PASSIVE ) &&
|
( m_hEnemy->Classify() != CLASS_HUMAN_PASSIVE ) &&
|
||||||
( m_hEnemy->Classify() != CLASS_MACHINE ) )
|
( m_hEnemy->Classify() != CLASS_MACHINE ) )
|
||||||
|
@ -2072,7 +2072,7 @@ Schedule_t *CHGrunt::GetSchedule( void )
|
||||||
// 10% chance of flinch.
|
// 10% chance of flinch.
|
||||||
int iPercent = RANDOM_LONG( 0, 99 );
|
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!
|
// only try to take cover if we actually have an enemy!
|
||||||
|
|
||||||
|
@ -2308,7 +2308,7 @@ Schedule_t *CHGrunt::GetScheduleOfType( int Type )
|
||||||
}
|
}
|
||||||
case SCHED_FAIL:
|
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.
|
// grunt has an enemy, so pick a different default fail schedule most likely to help recover.
|
||||||
return &slGruntCombatFail[0];
|
return &slGruntCombatFail[0];
|
||||||
|
@ -2408,10 +2408,10 @@ public:
|
||||||
void KeyValue( KeyValueData *pkvd );
|
void KeyValue( KeyValueData *pkvd );
|
||||||
|
|
||||||
int m_iPose;// which sequence to display -- temporary, don't need to save
|
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 )
|
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
|
// UNDONE: The player pointer should come back after returning from another level
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
{
|
{
|
||||||
// enemy is dead.
|
// enemy is dead.
|
||||||
Look( 512 );
|
Look( 512 );
|
||||||
m_hEnemy = BestVisibleEnemy();
|
m_hEnemy = BestVisibleEnemy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hEnemy != NULL && FVisible( m_hEnemy ) )
|
if( m_hEnemy != 0 && FVisible( m_hEnemy ) )
|
||||||
{
|
{
|
||||||
m_vecEnemyLKP = m_hEnemy->BodyTarget( pev->origin );
|
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.
|
// if hornet is close to the enemy, jet in a straight line for a half second.
|
||||||
// (only in the single player game)
|
// (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 )
|
if( flDelta >= 0.4 && ( pev->origin - m_vecEnemyLKP ).Length() <= 300 )
|
||||||
{
|
{
|
||||||
|
@ -407,7 +407,7 @@ void CHornet::DartTouch( CBaseEntity *pOther )
|
||||||
|
|
||||||
void CHornet::DieTouch( CBaseEntity *pOther )
|
void CHornet::DieTouch( CBaseEntity *pOther )
|
||||||
{
|
{
|
||||||
if( pOther && pOther->pev->takedamage )
|
if( pOther && pOther->pev->takedamage && pev->owner )
|
||||||
{
|
{
|
||||||
// do the damage
|
// do the damage
|
||||||
switch( RANDOM_LONG( 0, 2 ) )
|
switch( RANDOM_LONG( 0, 2 ) )
|
||||||
|
|
|
@ -137,7 +137,7 @@ int CHoundeye::Classify( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
BOOL CHoundeye::FValidateHintType( short sHint )
|
BOOL CHoundeye::FValidateHintType( short sHint )
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
static short sHoundHints[] =
|
static short sHoundHints[] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -416,7 +416,7 @@ void CIchthyosaur::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
case ICHTHYOSAUR_AE_SHAKE_RIGHT:
|
case ICHTHYOSAUR_AE_SHAKE_RIGHT:
|
||||||
case ICHTHYOSAUR_AE_SHAKE_LEFT:
|
case ICHTHYOSAUR_AE_SHAKE_LEFT:
|
||||||
{
|
{
|
||||||
if( m_hEnemy != NULL && FVisible( m_hEnemy ) )
|
if( m_hEnemy != 0 && FVisible( m_hEnemy ) )
|
||||||
{
|
{
|
||||||
CBaseEntity *pHurt = m_hEnemy;
|
CBaseEntity *pHurt = m_hEnemy;
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ void CIchthyosaur::RunTask( Task_t *pTask )
|
||||||
switch( pTask->iTask )
|
switch( pTask->iTask )
|
||||||
{
|
{
|
||||||
case TASK_ICHTHYOSAUR_CIRCLE_ENEMY:
|
case TASK_ICHTHYOSAUR_CIRCLE_ENEMY:
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
{
|
{
|
||||||
TaskComplete();
|
TaskComplete();
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ void CIchthyosaur::Stop( void )
|
||||||
|
|
||||||
void CIchthyosaur::Swim()
|
void CIchthyosaur::Swim()
|
||||||
{
|
{
|
||||||
int retValue = 0;
|
//int retValue = 0;
|
||||||
|
|
||||||
Vector start = pev->origin;
|
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;
|
Vector ProbeDir = Probe - pev->origin;
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ class CISlave : public CSquadMonster
|
||||||
public:
|
public:
|
||||||
void Spawn( void );
|
void Spawn( void );
|
||||||
void Precache( void );
|
void Precache( void );
|
||||||
|
void UpdateOnRemove();
|
||||||
void SetYawSpeed( void );
|
void SetYawSpeed( void );
|
||||||
int ISoundMask( void );
|
int ISoundMask( void );
|
||||||
int Classify( void );
|
int Classify( void );
|
||||||
|
@ -51,7 +52,7 @@ public:
|
||||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||||
BOOL CheckRangeAttack1( float flDot, float flDist );
|
BOOL CheckRangeAttack1( float flDot, float flDist );
|
||||||
BOOL CheckRangeAttack2( 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 );
|
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 );
|
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 );
|
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 " );
|
// ALERT( at_aiconsole, "help " );
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ void CISlave::CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vect
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CISlave::AlertSound( void )
|
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 );
|
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
|
WRITE_BYTE( 0 ); // decay * 0.1
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
}
|
}
|
||||||
if( m_hDead != NULL )
|
if( m_hDead != 0 )
|
||||||
{
|
{
|
||||||
WackBeam( -1, m_hDead );
|
WackBeam( -1, m_hDead );
|
||||||
WackBeam( 1, m_hDead );
|
WackBeam( 1, m_hDead );
|
||||||
|
@ -385,7 +386,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
{
|
{
|
||||||
ClearBeams();
|
ClearBeams();
|
||||||
|
|
||||||
if( m_hDead != NULL )
|
if( m_hDead != 0 )
|
||||||
{
|
{
|
||||||
Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 );
|
Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 );
|
||||||
TraceResult trace;
|
TraceResult trace;
|
||||||
|
@ -394,7 +395,7 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
if( !trace.fStartSolid )
|
if( !trace.fStartSolid )
|
||||||
{
|
{
|
||||||
CBaseEntity *pNew = Create( "monster_alien_slave", m_hDead->pev->origin, m_hDead->pev->angles );
|
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;
|
pNew->pev->spawnflags |= 1;
|
||||||
WackBeam( -1, pNew );
|
WackBeam( -1, pNew );
|
||||||
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;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -530,7 +531,7 @@ void CISlave::Spawn()
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CISlave::Precache()
|
void CISlave::Precache()
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
PRECACHE_MODEL( "models/islave.mdl" );
|
PRECACHE_MODEL( "models/islave.mdl" );
|
||||||
PRECACHE_MODEL( "sprites/lgtning.spr" );
|
PRECACHE_MODEL( "sprites/lgtning.spr" );
|
||||||
|
@ -543,20 +544,27 @@ void CISlave::Precache()
|
||||||
PRECACHE_SOUND( "weapons/cbar_miss1.wav" );
|
PRECACHE_SOUND( "weapons/cbar_miss1.wav" );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
|
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
|
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||||
PRECACHE_SOUND((char *)pPainSounds[i] );
|
PRECACHE_SOUND( pPainSounds[i] );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pDeathSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pDeathSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pDeathSounds[i] );
|
PRECACHE_SOUND( pDeathSounds[i] );
|
||||||
|
|
||||||
UTIL_PrecacheOther( "test_effect" );
|
UTIL_PrecacheOther( "test_effect" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CISlave::UpdateOnRemove()
|
||||||
|
{
|
||||||
|
CBaseEntity::UpdateOnRemove();
|
||||||
|
|
||||||
|
ClearBeams();
|
||||||
|
}
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
// TakeDamage - get provoked when injured
|
// TakeDamage - get provoked when injured
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -756,8 +764,8 @@ void CISlave::BeamGlow()
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CISlave::WackBeam( int side, CBaseEntity *pEntity )
|
void CISlave::WackBeam( int side, CBaseEntity *pEntity )
|
||||||
{
|
{
|
||||||
Vector vecDest;
|
//Vector vecDest;
|
||||||
float flDist = 1.0;
|
//float flDist = 1.0;
|
||||||
|
|
||||||
if( m_iBeams >= ISLAVE_MAX_BEAMS )
|
if( m_iBeams >= ISLAVE_MAX_BEAMS )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -166,6 +166,7 @@ void CItem::Materialize( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTouch( &CItem::ItemTouch );
|
SetTouch( &CItem::ItemTouch );
|
||||||
|
SetThink( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SF_SUIT_SHORTLOGON 0x0001
|
#define SF_SUIT_SHORTLOGON 0x0001
|
||||||
|
@ -226,7 +227,7 @@ class CItemBattery : public CItem
|
||||||
char szcharge[64];
|
char szcharge[64];
|
||||||
|
|
||||||
pPlayer->pev->armorvalue += gSkillData.batteryCapacity;
|
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 );
|
EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM );
|
||||||
|
|
||||||
|
|
|
@ -271,15 +271,15 @@ void CLeech::AlertSound( void )
|
||||||
|
|
||||||
void CLeech::Precache( void )
|
void CLeech::Precache( void )
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
//PRECACHE_MODEL( "models/icky.mdl" );
|
//PRECACHE_MODEL( "models/icky.mdl" );
|
||||||
PRECACHE_MODEL( "models/leech.mdl" );
|
PRECACHE_MODEL( "models/leech.mdl" );
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||||
PRECACHE_SOUND( (char *)pAttackSounds[i] );
|
PRECACHE_SOUND( pAttackSounds[i] );
|
||||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); 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 )
|
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 ) )
|
if( FBitSet( pev->spawnflags, SF_LIGHT_START_OFF ) )
|
||||||
LIGHT_STYLE( m_iStyle, "a" );
|
LIGHT_STYLE( m_iStyle, "a" );
|
||||||
else if( m_iszPattern )
|
else if( m_iszPattern )
|
||||||
LIGHT_STYLE( m_iStyle, (char *)STRING( m_iszPattern ) );
|
LIGHT_STYLE( m_iStyle, STRING( m_iszPattern ) );
|
||||||
else
|
else
|
||||||
LIGHT_STYLE( m_iStyle, "m" );
|
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( FBitSet( pev->spawnflags, SF_LIGHT_START_OFF ) )
|
||||||
{
|
{
|
||||||
if( m_iszPattern )
|
if( m_iszPattern )
|
||||||
LIGHT_STYLE( m_iStyle, (char *)STRING( m_iszPattern ) );
|
LIGHT_STYLE( m_iStyle, STRING( m_iszPattern ) );
|
||||||
else
|
else
|
||||||
LIGHT_STYLE( m_iStyle, "m" );
|
LIGHT_STYLE( m_iStyle, "m" );
|
||||||
ClearBits( pev->spawnflags, SF_LIGHT_START_OFF );
|
ClearBits( pev->spawnflags, SF_LIGHT_START_OFF );
|
||||||
|
@ -155,15 +155,16 @@ void CEnvLight::KeyValue( KeyValueData* pkvd )
|
||||||
}
|
}
|
||||||
else if( j == 4 )
|
else if( j == 4 )
|
||||||
{
|
{
|
||||||
r = r * ( v / 255.0 );
|
v /= 255;
|
||||||
g = g * ( v / 255.0 );
|
r *= v;
|
||||||
b = b * ( v / 255.0 );
|
g *= v;
|
||||||
|
b *= v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling
|
// simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling
|
||||||
r = pow( r / 114.0, 0.6 ) * 264;
|
r = (int)( pow( r / 114.0, 0.6 ) * 264.0 );
|
||||||
g = pow( g / 114.0, 0.6 ) * 264;
|
g = (int)( pow( g / 114.0, 0.6 ) * 264.0 );
|
||||||
b = pow( b / 114.0, 0.6 ) * 264;
|
b = (int)( pow( b / 114.0, 0.6 ) * 264.0 );
|
||||||
|
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
sprintf( szColor, "%d", r );
|
sprintf( szColor, "%d", r );
|
||||||
|
|
|
@ -64,9 +64,9 @@ void CRuleEntity::Spawn( void )
|
||||||
|
|
||||||
void CRuleEntity::KeyValue( KeyValueData *pkvd )
|
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;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -75,9 +75,9 @@ void CRuleEntity::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
BOOL CRuleEntity::CanFireForActivator( CBaseEntity *pActivator )
|
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;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -135,7 +135,7 @@ public:
|
||||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||||
void KeyValue( KeyValueData *pkvd );
|
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 AllowNegativeScore( void ) { return pev->spawnflags & SF_SCORE_NEGATIVE; }
|
||||||
inline BOOL AwardToTeam( void ) { return pev->spawnflags & SF_SCORE_TEAM; }
|
inline BOOL AwardToTeam( void ) { return pev->spawnflags & SF_SCORE_TEAM; }
|
||||||
|
|
||||||
|
@ -153,9 +153,9 @@ void CGameScore::Spawn( void )
|
||||||
|
|
||||||
void CGameScore::KeyValue( KeyValueData *pkvd )
|
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;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -164,13 +164,13 @@ void CGameScore::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CGameScore::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
void CGameScore::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Only players can use this
|
// Only players can use this
|
||||||
if ( pActivator->IsPlayer() )
|
if( pActivator->IsPlayer() )
|
||||||
{
|
{
|
||||||
if ( AwardToTeam() )
|
if( AwardToTeam() )
|
||||||
{
|
{
|
||||||
pActivator->AddPointsToTeam( Points(), AllowNegativeScore() );
|
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 )
|
void CGameEnd::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pGameRules->EndMultiplayerGame();
|
g_pGameRules->EndMultiplayerGame();
|
||||||
|
@ -239,27 +239,27 @@ IMPLEMENT_SAVERESTORE( CGameText, CRulePointEntity )
|
||||||
|
|
||||||
void CGameText::KeyValue( KeyValueData *pkvd )
|
void CGameText::KeyValue( KeyValueData *pkvd )
|
||||||
{
|
{
|
||||||
if (FStrEq(pkvd->szKeyName, "channel"))
|
if( FStrEq( pkvd->szKeyName, "channel" ) )
|
||||||
{
|
{
|
||||||
m_textParms.channel = atoi( pkvd->szValue );
|
m_textParms.channel = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "x"))
|
else if( FStrEq( pkvd->szKeyName, "x" ) )
|
||||||
{
|
{
|
||||||
m_textParms.x = atof( pkvd->szValue );
|
m_textParms.x = atof( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "y"))
|
else if( FStrEq(pkvd->szKeyName, "y" ) )
|
||||||
{
|
{
|
||||||
m_textParms.y = atof( pkvd->szValue );
|
m_textParms.y = atof( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "effect"))
|
else if( FStrEq( pkvd->szKeyName, "effect" ) )
|
||||||
{
|
{
|
||||||
m_textParms.effect = atoi( pkvd->szValue );
|
m_textParms.effect = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "color"))
|
else if( FStrEq( pkvd->szKeyName, "color" ) )
|
||||||
{
|
{
|
||||||
int color[4];
|
int color[4];
|
||||||
UTIL_StringToIntArray( color, 4, pkvd->szValue );
|
UTIL_StringToIntArray( color, 4, pkvd->szValue );
|
||||||
|
@ -269,7 +269,7 @@ void CGameText::KeyValue( KeyValueData *pkvd )
|
||||||
m_textParms.a1 = color[3];
|
m_textParms.a1 = color[3];
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "color2"))
|
else if( FStrEq( pkvd->szKeyName, "color2" ) )
|
||||||
{
|
{
|
||||||
int color[4];
|
int color[4];
|
||||||
UTIL_StringToIntArray( color, 4, pkvd->szValue );
|
UTIL_StringToIntArray( color, 4, pkvd->szValue );
|
||||||
|
@ -279,22 +279,22 @@ void CGameText::KeyValue( KeyValueData *pkvd )
|
||||||
m_textParms.a2 = color[3];
|
m_textParms.a2 = color[3];
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "fadein"))
|
else if( FStrEq( pkvd->szKeyName, "fadein" ) )
|
||||||
{
|
{
|
||||||
m_textParms.fadeinTime = atof( pkvd->szValue );
|
m_textParms.fadeinTime = atof( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "fadeout"))
|
else if( FStrEq( pkvd->szKeyName, "fadeout" ) )
|
||||||
{
|
{
|
||||||
m_textParms.fadeoutTime = atof( pkvd->szValue );
|
m_textParms.fadeoutTime = atof( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "holdtime"))
|
else if( FStrEq( pkvd->szKeyName, "holdtime" ) )
|
||||||
{
|
{
|
||||||
m_textParms.holdTime = atof( pkvd->szValue );
|
m_textParms.holdTime = atof( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "fxtime"))
|
else if( FStrEq(pkvd->szKeyName, "fxtime" ) )
|
||||||
{
|
{
|
||||||
m_textParms.fxTime = atof( pkvd->szValue );
|
m_textParms.fxTime = atof( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
|
@ -305,16 +305,16 @@ void CGameText::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CGameText::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
void CGameText::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( MessageToAll() )
|
if( MessageToAll() )
|
||||||
{
|
{
|
||||||
UTIL_HudMessageAll( m_textParms, MessageGet() );
|
UTIL_HudMessageAll( m_textParms, MessageGet() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( pActivator->IsNetClient() )
|
if( pActivator->IsNetClient() )
|
||||||
{
|
{
|
||||||
UTIL_HudMessage( pActivator, m_textParms, MessageGet() );
|
UTIL_HudMessage( pActivator, m_textParms, MessageGet() );
|
||||||
}
|
}
|
||||||
|
@ -356,12 +356,12 @@ LINK_ENTITY_TO_CLASS( game_team_master, CGameTeamMaster )
|
||||||
|
|
||||||
void CGameTeamMaster::KeyValue( KeyValueData *pkvd )
|
void CGameTeamMaster::KeyValue( KeyValueData *pkvd )
|
||||||
{
|
{
|
||||||
if (FStrEq(pkvd->szKeyName, "teamindex"))
|
if( FStrEq( pkvd->szKeyName, "teamindex" ) )
|
||||||
{
|
{
|
||||||
m_teamIndex = atoi( pkvd->szValue );
|
m_teamIndex = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "triggerstate"))
|
else if( FStrEq( pkvd->szKeyName, "triggerstate" ) )
|
||||||
{
|
{
|
||||||
int type = atoi( pkvd->szValue );
|
int type = atoi( pkvd->szValue );
|
||||||
switch( type )
|
switch( type )
|
||||||
|
@ -384,12 +384,12 @@ void CGameTeamMaster::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( useType == USE_SET )
|
if( useType == USE_SET )
|
||||||
{
|
{
|
||||||
if ( value < 0 )
|
if( value < 0 )
|
||||||
{
|
{
|
||||||
m_teamIndex = -1;
|
m_teamIndex = -1;
|
||||||
}
|
}
|
||||||
|
@ -400,10 +400,10 @@ void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( TeamMatch( pActivator ) )
|
if( TeamMatch( pActivator ) )
|
||||||
{
|
{
|
||||||
SUB_UseTargets( pActivator, triggerType, value );
|
SUB_UseTargets( pActivator, triggerType, value );
|
||||||
if ( RemoveOnFire() )
|
if( RemoveOnFire() )
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ BOOL CGameTeamMaster::IsTriggered( CBaseEntity *pActivator )
|
||||||
|
|
||||||
const char *CGameTeamMaster::TeamID( void )
|
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 "";
|
||||||
|
|
||||||
return g_pGameRules->GetIndexedTeamName( m_teamIndex ); // UNDONE: Fill this in with the team from the "teamlist"
|
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 )
|
BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator )
|
||||||
{
|
{
|
||||||
if ( m_teamIndex < 0 && AnyTeam() )
|
if( m_teamIndex < 0 && AnyTeam() )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if ( !pActivator )
|
if( !pActivator )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return UTIL_TeamsMatch( pActivator->TeamID(), TeamID() );
|
return UTIL_TeamsMatch( pActivator->TeamID(), TeamID() );
|
||||||
|
@ -443,7 +443,7 @@ BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator )
|
||||||
class CGameTeamSet : public CRulePointEntity
|
class CGameTeamSet : public CRulePointEntity
|
||||||
{
|
{
|
||||||
public:
|
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 RemoveOnFire( void ) { return (pev->spawnflags & SF_TEAMSET_FIREONCE) ? TRUE : FALSE; }
|
||||||
inline BOOL ShouldClearTeam( void ) { return (pev->spawnflags & SF_TEAMSET_CLEARTEAM) ? 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 )
|
void CGameTeamSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ShouldClearTeam() )
|
if( ShouldClearTeam() )
|
||||||
{
|
{
|
||||||
SUB_UseTargets( pActivator, USE_SET, -1 );
|
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 );
|
SUB_UseTargets( pActivator, USE_SET, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( RemoveOnFire() )
|
if( RemoveOnFire() )
|
||||||
{
|
{
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
}
|
}
|
||||||
|
@ -506,22 +506,22 @@ IMPLEMENT_SAVERESTORE( CGamePlayerZone, CRuleBrushEntity )
|
||||||
|
|
||||||
void CGamePlayerZone::KeyValue( KeyValueData *pkvd )
|
void CGamePlayerZone::KeyValue( KeyValueData *pkvd )
|
||||||
{
|
{
|
||||||
if (FStrEq(pkvd->szKeyName, "intarget"))
|
if( FStrEq(pkvd->szKeyName, "intarget" ) )
|
||||||
{
|
{
|
||||||
m_iszInTarget = ALLOC_STRING( pkvd->szValue );
|
m_iszInTarget = ALLOC_STRING( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "outtarget"))
|
else if( FStrEq( pkvd->szKeyName, "outtarget" ) )
|
||||||
{
|
{
|
||||||
m_iszOutTarget = ALLOC_STRING( pkvd->szValue );
|
m_iszOutTarget = ALLOC_STRING( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "incount"))
|
else if( FStrEq( pkvd->szKeyName, "incount" ) )
|
||||||
{
|
{
|
||||||
m_iszInCount = ALLOC_STRING( pkvd->szValue );
|
m_iszInCount = ALLOC_STRING( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if (FStrEq(pkvd->szKeyName, "outcount"))
|
else if( FStrEq( pkvd->szKeyName, "outcount" ) )
|
||||||
{
|
{
|
||||||
m_iszOutCount = ALLOC_STRING( pkvd->szValue );
|
m_iszOutCount = ALLOC_STRING( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
|
@ -535,12 +535,12 @@ void CGamePlayerZone::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
||||||
int playersInCount = 0;
|
int playersInCount = 0;
|
||||||
int playersOutCount = 0;
|
int playersOutCount = 0;
|
||||||
|
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CBaseEntity *pPlayer = NULL;
|
CBaseEntity *pPlayer = NULL;
|
||||||
|
|
||||||
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
|
for( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||||
{
|
{
|
||||||
pPlayer = UTIL_PlayerByIndex( i );
|
pPlayer = UTIL_PlayerByIndex( i );
|
||||||
if ( pPlayer )
|
if ( pPlayer )
|
||||||
|
@ -549,40 +549,40 @@ void CGamePlayerZone::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
||||||
int hullNumber;
|
int hullNumber;
|
||||||
|
|
||||||
hullNumber = human_hull;
|
hullNumber = human_hull;
|
||||||
if ( pPlayer->pev->flags & FL_DUCKING )
|
if( pPlayer->pev->flags & FL_DUCKING )
|
||||||
{
|
{
|
||||||
hullNumber = head_hull;
|
hullNumber = head_hull;
|
||||||
}
|
}
|
||||||
|
|
||||||
UTIL_TraceModel( pPlayer->pev->origin, pPlayer->pev->origin, hullNumber, edict(), &trace );
|
UTIL_TraceModel( pPlayer->pev->origin, pPlayer->pev->origin, hullNumber, edict(), &trace );
|
||||||
|
|
||||||
if ( trace.fStartSolid )
|
if( trace.fStartSolid )
|
||||||
{
|
{
|
||||||
playersInCount++;
|
playersInCount++;
|
||||||
if ( m_iszInTarget )
|
if( m_iszInTarget )
|
||||||
{
|
{
|
||||||
FireTargets( STRING(m_iszInTarget), pPlayer, pActivator, useType, value );
|
FireTargets( STRING( m_iszInTarget ), pPlayer, pActivator, useType, value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playersOutCount++;
|
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 )
|
void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( pActivator->IsPlayer() )
|
if( pActivator->IsPlayer() )
|
||||||
{
|
{
|
||||||
if ( pev->dmg < 0 )
|
if( pev->dmg < 0 )
|
||||||
pActivator->TakeHealth( -pev->dmg, DMG_GENERIC );
|
pActivator->TakeHealth( -pev->dmg, DMG_GENERIC );
|
||||||
else
|
else
|
||||||
pActivator->TakeDamage( pev, pev, pev->dmg, DMG_GENERIC );
|
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 );
|
SUB_UseTargets( pActivator, useType, value );
|
||||||
|
|
||||||
if ( RemoveOnFire() )
|
if( RemoveOnFire() )
|
||||||
{
|
{
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
}
|
}
|
||||||
|
@ -643,8 +643,8 @@ public:
|
||||||
inline void CountUp( void ) { pev->frags++; }
|
inline void CountUp( void ) { pev->frags++; }
|
||||||
inline void CountDown( void ) { pev->frags--; }
|
inline void CountDown( void ) { pev->frags--; }
|
||||||
inline void ResetCount( void ) { pev->frags = pev->dmg; }
|
inline void ResetCount( void ) { pev->frags = pev->dmg; }
|
||||||
inline int CountValue( void ) { return pev->frags; }
|
inline int CountValue( void ) { return (int)pev->frags; }
|
||||||
inline int LimitValue( void ) { return pev->health; }
|
inline int LimitValue( void ) { return (int)pev->health; }
|
||||||
|
|
||||||
inline BOOL HitLimit( void ) { return CountValue() == LimitValue(); }
|
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 )
|
void CGameCounter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( useType )
|
switch( useType )
|
||||||
|
@ -682,15 +682,15 @@ void CGameCounter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( HitLimit() )
|
if( HitLimit() )
|
||||||
{
|
{
|
||||||
SUB_UseTargets( pActivator, USE_TOGGLE, 0 );
|
SUB_UseTargets( pActivator, USE_TOGGLE, 0 );
|
||||||
if ( RemoveOnFire() )
|
if( RemoveOnFire() )
|
||||||
{
|
{
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ResetOnFire() )
|
if( ResetOnFire() )
|
||||||
{
|
{
|
||||||
ResetCount();
|
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 )
|
void CGameCounterSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SUB_UseTargets( pActivator, USE_SET, pev->frags );
|
SUB_UseTargets( pActivator, USE_SET, pev->frags );
|
||||||
|
|
||||||
if ( RemoveOnFire() )
|
if( RemoveOnFire() )
|
||||||
{
|
{
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
}
|
}
|
||||||
|
@ -756,19 +756,19 @@ void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
|
||||||
{
|
{
|
||||||
CRulePointEntity::KeyValue( 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];
|
char tmp[128];
|
||||||
|
|
||||||
UTIL_StripToken( pkvd->szKeyName, tmp );
|
UTIL_StripToken( pkvd->szKeyName, tmp );
|
||||||
|
|
||||||
m_weaponNames[i] = ALLOC_STRING(tmp);
|
m_weaponNames[i] = ALLOC_STRING( tmp );
|
||||||
m_weaponCount[i] = atoi(pkvd->szValue);
|
m_weaponCount[i] = atoi( pkvd->szValue );
|
||||||
m_weaponCount[i] = max(1,m_weaponCount[i]);
|
m_weaponCount[i] = Q_max( 1, m_weaponCount[i] );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -778,10 +778,10 @@ void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CGamePlayerEquip::Touch( CBaseEntity *pOther )
|
void CGamePlayerEquip::Touch( CBaseEntity *pOther )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pOther ) )
|
if( !CanFireForActivator( pOther ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( UseOnly() )
|
if( UseOnly() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EquipPlayer( pOther );
|
EquipPlayer( pOther );
|
||||||
|
@ -791,21 +791,21 @@ void CGamePlayerEquip::EquipPlayer( CBaseEntity *pEntity )
|
||||||
{
|
{
|
||||||
CBasePlayer *pPlayer = NULL;
|
CBasePlayer *pPlayer = NULL;
|
||||||
|
|
||||||
if ( pEntity->IsPlayer() )
|
if( pEntity->IsPlayer() )
|
||||||
{
|
{
|
||||||
pPlayer = (CBasePlayer *)pEntity;
|
pPlayer = (CBasePlayer *)pEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !pPlayer )
|
if( !pPlayer )
|
||||||
return;
|
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;
|
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;
|
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();
|
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 )
|
void CGamePlayerTeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
if ( !CanFireForActivator( pActivator ) )
|
if( !CanFireForActivator( pActivator ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( pActivator->IsPlayer() )
|
if( pActivator->IsPlayer() )
|
||||||
{
|
{
|
||||||
const char *pszTargetTeam = TargetTeamName( STRING(pev->target) );
|
const char *pszTargetTeam = TargetTeamName( STRING(pev->target) );
|
||||||
if ( pszTargetTeam )
|
if ( pszTargetTeam )
|
||||||
|
@ -868,7 +868,7 @@ void CGamePlayerTeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( RemoveOnFire() )
|
if( RemoveOnFire() )
|
||||||
{
|
{
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ int CBaseMonster::Restore( CRestore &restore )
|
||||||
m_Activity = ACT_RESET;
|
m_Activity = ACT_RESET;
|
||||||
|
|
||||||
// If we don't have an enemy, clear conditions like see enemy, etc.
|
// If we don't have an enemy, clear conditions like see enemy, etc.
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
m_afConditions = 0;
|
m_afConditions = 0;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -334,12 +334,10 @@ void CBaseMonster::Look( int iDistance )
|
||||||
{
|
{
|
||||||
if( pev->spawnflags & SF_MONSTER_WAIT_TILL_SEEN )
|
if( pev->spawnflags & SF_MONSTER_WAIT_TILL_SEEN )
|
||||||
{
|
{
|
||||||
CBaseMonster *pClient;
|
CBaseMonster *pClient = pSightEnt->MyMonsterPointer();
|
||||||
|
|
||||||
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
|
// 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.
|
// we're not in the player's view cone.
|
||||||
continue;
|
continue;
|
||||||
|
@ -672,7 +670,7 @@ BOOL CBaseMonster::FRefreshRoute( void )
|
||||||
returnCode = BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, NULL );
|
returnCode = BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, NULL );
|
||||||
break;
|
break;
|
||||||
case MOVEGOAL_TARGETENT:
|
case MOVEGOAL_TARGETENT:
|
||||||
if( m_hTargetEnt != NULL )
|
if( m_hTargetEnt != 0 )
|
||||||
{
|
{
|
||||||
returnCode = BuildRoute( m_hTargetEnt->pev->origin, bits_MF_TO_TARGETENT, m_hTargetEnt );
|
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 )
|
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)
|
// 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1165,7 +1163,7 @@ void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos )
|
||||||
{
|
{
|
||||||
if( m_hOldEnemy[i] == pEnemy )
|
if( m_hOldEnemy[i] == pEnemy )
|
||||||
return;
|
return;
|
||||||
if( m_hOldEnemy[i] == NULL ) // someone died, reuse their slot
|
if( m_hOldEnemy[i] == 0 ) // someone died, reuse their slot
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( i >= MAX_OLD_ENEMIES )
|
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.
|
// 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-- )
|
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
|
if( m_hOldEnemy[i]->IsAlive()) // cheat and know when they die
|
||||||
{
|
{
|
||||||
|
@ -1240,7 +1238,7 @@ void CBaseMonster::SetActivity( Activity NewActivity )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
// SetSequenceByName
|
// SetSequenceByName
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CBaseMonster::SetSequenceByName( char *szSequence )
|
void CBaseMonster::SetSequenceByName( const char *szSequence )
|
||||||
{
|
{
|
||||||
int iSequence;
|
int iSequence;
|
||||||
|
|
||||||
|
@ -1961,7 +1959,7 @@ void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, f
|
||||||
while( flTotal > 0.001 )
|
while( flTotal > 0.001 )
|
||||||
{
|
{
|
||||||
// don't walk more than 16 units or stairs stop working
|
// 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 );
|
UTIL_MoveToOrigin( ENT( pev ), m_Route[m_iRouteIndex].vecLocation, flStep, MOVE_NORMAL );
|
||||||
flTotal -= flStep;
|
flTotal -= flStep;
|
||||||
}
|
}
|
||||||
|
@ -2863,7 +2861,7 @@ void CBaseMonster::ReportAIState( void )
|
||||||
else
|
else
|
||||||
ALERT( level, "No Schedule, " );
|
ALERT( level, "No Schedule, " );
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
ALERT( level, "\nEnemy is %s", STRING( m_hEnemy->pev->classname ) );
|
ALERT( level, "\nEnemy is %s", STRING( m_hEnemy->pev->classname ) );
|
||||||
else
|
else
|
||||||
ALERT( level, "No enemy" );
|
ALERT( level, "No enemy" );
|
||||||
|
@ -2950,7 +2948,7 @@ BOOL CBaseMonster::FCheckAITrigger( void )
|
||||||
switch( m_iTriggerCondition )
|
switch( m_iTriggerCondition )
|
||||||
{
|
{
|
||||||
case AITRIGGER_SEEPLAYER_ANGRY_AT_PLAYER:
|
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;
|
fFireTarget = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3321,7 +3319,7 @@ BOOL CBaseMonster::GetEnemy( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember old enemies
|
// remember old enemies
|
||||||
if( m_hEnemy == NULL && PopEnemy() )
|
if( m_hEnemy == 0 && PopEnemy() )
|
||||||
{
|
{
|
||||||
if( m_pSchedule )
|
if( m_pSchedule )
|
||||||
{
|
{
|
||||||
|
@ -3332,7 +3330,7 @@ BOOL CBaseMonster::GetEnemy( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
// monster has an enemy.
|
// monster has an enemy.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -3344,7 +3342,7 @@ BOOL CBaseMonster::GetEnemy( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
// DropItem - dead monster drops named item
|
// 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 )
|
if( !pszItemName )
|
||||||
{
|
{
|
||||||
|
@ -3359,6 +3357,9 @@ CBaseEntity *CBaseMonster::DropItem( char *pszItemName, const Vector &vecPos, co
|
||||||
// do we want this behavior to be default?! (sjb)
|
// do we want this behavior to be default?! (sjb)
|
||||||
pItem->pev->velocity = pev->velocity;
|
pItem->pev->velocity = pev->velocity;
|
||||||
pItem->pev->avelocity = Vector( 0, RANDOM_FLOAT( 0, 100 ), 0 );
|
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;
|
return pItem;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,7 +42,7 @@ void CBaseMonster::SetState( MONSTERSTATE State )
|
||||||
|
|
||||||
// Drop enemy pointers when going to idle
|
// Drop enemy pointers when going to idle
|
||||||
case MONSTERSTATE_IDLE:
|
case MONSTERSTATE_IDLE:
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
m_hEnemy = NULL;// not allowed to have an enemy anymore.
|
m_hEnemy = NULL;// not allowed to have an enemy anymore.
|
||||||
ALERT( at_aiconsole, "Stripped\n" );
|
ALERT( at_aiconsole, "Stripped\n" );
|
||||||
|
@ -92,7 +92,7 @@ void CBaseMonster::RunAI( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// do these calculations if monster has an enemy.
|
// do these calculations if monster has an enemy.
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
CheckEnemy( m_hEnemy );
|
CheckEnemy( m_hEnemy );
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ MONSTERSTATE CBaseMonster::GetIdealState( void )
|
||||||
COMBAT goes to ALERT upon death of enemy
|
COMBAT goes to ALERT upon death of enemy
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
{
|
{
|
||||||
m_IdealMonsterState = MONSTERSTATE_ALERT;
|
m_IdealMonsterState = MONSTERSTATE_ALERT;
|
||||||
// pev->effects = EF_BRIGHTFIELD;
|
// 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
|
// HEV suit - indicate out of ammo condition
|
||||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||||
|
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
m_flNextPrimaryAttack = GetNextAttackDelay( 0.1 );
|
||||||
|
|
||||||
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||||
|
@ -227,7 +227,7 @@ void CMP5::SecondaryAttack( void )
|
||||||
#endif
|
#endif
|
||||||
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 );
|
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 );
|
||||||
|
|
||||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1;
|
m_flNextPrimaryAttack = GetNextAttackDelay( 1 );
|
||||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1;
|
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1;
|
||||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting.
|
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting.
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ void CMP5::SecondaryAttack( void )
|
||||||
|
|
||||||
void CMP5::Reload( 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;
|
return;
|
||||||
|
|
||||||
DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5 );
|
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.
|
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
|
class CMP5AmmoClip : public CBasePlayerAmmo
|
||||||
{
|
{
|
||||||
void Spawn( void )
|
void Spawn( void )
|
||||||
|
|
|
@ -74,7 +74,7 @@ void CBaseMonster::MonsterInitDead( void )
|
||||||
|
|
||||||
// Setup health counters, etc.
|
// Setup health counters, etc.
|
||||||
BecomeDead();
|
BecomeDead();
|
||||||
SetThink( &CorpseFallThink );
|
SetThink( &CBaseMonster::CorpseFallThink );
|
||||||
pev->nextthink = gpGlobals->time + 0.5;
|
pev->nextthink = gpGlobals->time + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ CBaseEntity *CBaseMonster::BestVisibleEnemy( void )
|
||||||
// currently think is the best visible enemy. No need to do
|
// currently think is the best visible enemy. No need to do
|
||||||
// a distance check, just get mad at this one for now.
|
// a distance check, just get mad at this one for now.
|
||||||
iBestRelationship = IRelationship( pNextEnt );
|
iBestRelationship = IRelationship( pNextEnt );
|
||||||
iNearest = ( pNextEnt->pev->origin - pev->origin ).Length();
|
(int)iNearest = ( pNextEnt->pev->origin - pev->origin ).Length();
|
||||||
pReturn = pNextEnt;
|
pReturn = pNextEnt;
|
||||||
}
|
}
|
||||||
else if( IRelationship( pNextEnt ) == iBestRelationship )
|
else if( IRelationship( pNextEnt ) == iBestRelationship )
|
||||||
|
@ -238,7 +238,7 @@ CBaseEntity *CBaseMonster::BestVisibleEnemy( void )
|
||||||
// this entity is disliked just as much as the entity that
|
// this entity is disliked just as much as the entity that
|
||||||
// we currently think is the best visible enemy, so we only
|
// we currently think is the best visible enemy, so we only
|
||||||
// get mad at it if it is closer.
|
// 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 )
|
if( iDist <= iNearest )
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
|
||||||
if( IS_DEDICATED_SERVER() )
|
if( IS_DEDICATED_SERVER() )
|
||||||
{
|
{
|
||||||
// dedicated server
|
// dedicated server
|
||||||
char *servercfgfile = (char *)CVAR_GET_STRING( "servercfgfile" );
|
/*const char *servercfgfile = CVAR_GET_STRING( "servercfgfile" );
|
||||||
|
|
||||||
if( servercfgfile && servercfgfile[0] )
|
if( servercfgfile && servercfgfile[0] )
|
||||||
{
|
{
|
||||||
|
@ -102,11 +102,13 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
|
||||||
sprintf( szCommand, "exec %s\n", servercfgfile );
|
sprintf( szCommand, "exec %s\n", servercfgfile );
|
||||||
SERVER_COMMAND( szCommand );
|
SERVER_COMMAND( szCommand );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
// this code has been moved into engine, to only run server.cfg once
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// listen server
|
// listen server
|
||||||
char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" );
|
const char *lservercfgfile = CVAR_GET_STRING( "lservercfgfile" );
|
||||||
|
|
||||||
if( lservercfgfile && lservercfgfile[0] )
|
if( lservercfgfile && lservercfgfile[0] )
|
||||||
{
|
{
|
||||||
|
@ -254,7 +256,7 @@ void CHalfLifeMultiplay::Think( void )
|
||||||
|
|
||||||
if( pPlayer )
|
if( pPlayer )
|
||||||
{
|
{
|
||||||
remain = flFragLimit - pPlayer->pev->frags;
|
remain = (int)( flFragLimit - pPlayer->pev->frags );
|
||||||
if( remain < bestfrags )
|
if( remain < bestfrags )
|
||||||
{
|
{
|
||||||
bestfrags = remain;
|
bestfrags = remain;
|
||||||
|
@ -298,7 +300,7 @@ BOOL CHalfLifeMultiplay::IsDeathmatch( void )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
BOOL CHalfLifeMultiplay::IsCoOp( 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
|
// notify other clients of player joining the game
|
||||||
UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs( "%s has joined the game\n",
|
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?
|
// team match?
|
||||||
if( g_teamplay )
|
if( g_teamplay )
|
||||||
|
@ -465,7 +467,7 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
|
||||||
{
|
{
|
||||||
MESSAGE_BEGIN( MSG_ONE, gmsgScoreInfo, NULL, pl->edict() );
|
MESSAGE_BEGIN( MSG_ONE, gmsgScoreInfo, NULL, pl->edict() );
|
||||||
WRITE_BYTE( i ); // client number
|
WRITE_BYTE( i ); // client number
|
||||||
WRITE_SHORT( plr->pev->frags );
|
WRITE_SHORT( (int)plr->pev->frags );
|
||||||
WRITE_SHORT( plr->m_iDeaths );
|
WRITE_SHORT( plr->m_iDeaths );
|
||||||
WRITE_SHORT( 0 );
|
WRITE_SHORT( 0 );
|
||||||
WRITE_SHORT( GetTeamIndex( plr->m_szTeamName ) + 1 );
|
WRITE_SHORT( GetTeamIndex( plr->m_szTeamName ) + 1 );
|
||||||
|
@ -650,7 +652,7 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
||||||
// killed scores
|
// killed scores
|
||||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||||
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
||||||
WRITE_SHORT( pVictim->pev->frags );
|
WRITE_SHORT( (int)pVictim->pev->frags );
|
||||||
WRITE_SHORT( pVictim->m_iDeaths );
|
WRITE_SHORT( pVictim->m_iDeaths );
|
||||||
WRITE_SHORT( 0 );
|
WRITE_SHORT( 0 );
|
||||||
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
||||||
|
@ -664,7 +666,7 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
||||||
|
|
||||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||||
WRITE_BYTE( ENTINDEX( PK->edict() ) );
|
WRITE_BYTE( ENTINDEX( PK->edict() ) );
|
||||||
WRITE_SHORT( PK->pev->frags );
|
WRITE_SHORT( (int)PK->pev->frags );
|
||||||
WRITE_SHORT( PK->m_iDeaths );
|
WRITE_SHORT( PK->m_iDeaths );
|
||||||
WRITE_SHORT( 0 );
|
WRITE_SHORT( 0 );
|
||||||
WRITE_SHORT( GetTeamIndex( PK->m_szTeamName ) + 1 );
|
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.
|
// let the killer paint another decal as soon as he'd like.
|
||||||
PK->m_flNextDecalTime = gpGlobals->time;
|
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 )
|
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
|
// 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
|
const char *killer_weapon_name = "world"; // by default, the player is killed by the world
|
||||||
int killer_index = 0;
|
int killer_index = 0;
|
||||||
|
|
||||||
// Hack to fix name change
|
// Hack to fix name change
|
||||||
char *tau = "tau_cannon";
|
const char *tau = "tau_cannon";
|
||||||
char *gluon = "gluon gun";
|
const char *gluon = "gluon gun";
|
||||||
|
|
||||||
if( pKiller->flags & FL_CLIENT )
|
if( pKiller->flags & FL_CLIENT )
|
||||||
{
|
{
|
||||||
|
@ -1218,7 +1214,7 @@ COM_Parse
|
||||||
Parse a token out of a string
|
Parse a token out of a string
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
char *COM_Parse( char *data )
|
const char *COM_Parse( const char *data )
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int len;
|
int len;
|
||||||
|
@ -1294,9 +1290,9 @@ COM_TokenWaiting
|
||||||
Returns 1 if additional data is waiting to be processed on this line
|
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;
|
p = buffer;
|
||||||
while( *p && *p!='\n')
|
while( *p && *p!='\n')
|
||||||
|
@ -1317,12 +1313,12 @@ ReloadMapCycleFile
|
||||||
Parses mapcycle.txt file into mapcycle_t structure
|
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];
|
char szMap[32];
|
||||||
int length;
|
int length;
|
||||||
char *pFileList;
|
const char *pFileList;
|
||||||
char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( filename, &length );
|
const char *aFileList = pFileList = (const char *)LOAD_FILE_FOR_ME( filename, &length );
|
||||||
int hasbuffer;
|
int hasbuffer;
|
||||||
mapcycle_item_s *item, *newlist = NULL, *next;
|
mapcycle_item_s *item, *newlist = NULL, *next;
|
||||||
|
|
||||||
|
@ -1372,15 +1368,15 @@ int ReloadMapCycleFile( char *filename, mapcycle_t *cycle )
|
||||||
if( s && s[0] )
|
if( s && s[0] )
|
||||||
{
|
{
|
||||||
item->minplayers = atoi( s );
|
item->minplayers = atoi( s );
|
||||||
item->minplayers = max( item->minplayers, 0 );
|
item->minplayers = Q_max( item->minplayers, 0 );
|
||||||
item->minplayers = min( item->minplayers, gpGlobals->maxClients );
|
item->minplayers = Q_min( item->minplayers, gpGlobals->maxClients );
|
||||||
}
|
}
|
||||||
s = g_engfuncs.pfnInfoKeyValue( szBuffer, "maxplayers" );
|
s = g_engfuncs.pfnInfoKeyValue( szBuffer, "maxplayers" );
|
||||||
if( s && s[0] )
|
if( s && s[0] )
|
||||||
{
|
{
|
||||||
item->maxplayers = atoi( s );
|
item->maxplayers = atoi( s );
|
||||||
item->maxplayers = max( item->maxplayers, 0 );
|
item->maxplayers = Q_max( item->maxplayers, 0 );
|
||||||
item->maxplayers = min( item->maxplayers, gpGlobals->maxClients );
|
item->maxplayers = Q_min( item->maxplayers, gpGlobals->maxClients );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove keys
|
// Remove keys
|
||||||
|
@ -1400,7 +1396,7 @@ int ReloadMapCycleFile( char *filename, mapcycle_t *cycle )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_FILE( aFileList );
|
FREE_FILE( (void*)aFileList );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fixup circular list pointer
|
// Fixup circular list pointer
|
||||||
|
@ -1536,7 +1532,7 @@ void CHalfLifeMultiplay::ChangeLevel( void )
|
||||||
BOOL do_cycle = TRUE;
|
BOOL do_cycle = TRUE;
|
||||||
|
|
||||||
// find the map to change to
|
// find the map to change to
|
||||||
char *mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" );
|
const char *mapcfile = CVAR_GET_STRING( "mapcyclefile" );
|
||||||
ASSERT( mapcfile != NULL );
|
ASSERT( mapcfile != NULL );
|
||||||
|
|
||||||
szCommands[0] = '\0';
|
szCommands[0] = '\0';
|
||||||
|
@ -1654,8 +1650,8 @@ void CHalfLifeMultiplay::SendMOTDToClient( edict_t *client )
|
||||||
{
|
{
|
||||||
// read from the MOTD.txt file
|
// read from the MOTD.txt file
|
||||||
int length, char_count = 0;
|
int length, char_count = 0;
|
||||||
char *pFileList;
|
const char *pFileList;
|
||||||
char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( (char *)CVAR_GET_STRING( "motdfile" ), &length );
|
const char *aFileList = pFileList = (const char*)LOAD_FILE_FOR_ME( CVAR_GET_STRING( "motdfile" ), &length );
|
||||||
|
|
||||||
// send the server name
|
// send the server name
|
||||||
MESSAGE_BEGIN( MSG_ONE, gmsgServerName, NULL, client );
|
MESSAGE_BEGIN( MSG_ONE, gmsgServerName, NULL, client );
|
||||||
|
@ -1683,13 +1679,13 @@ void CHalfLifeMultiplay::SendMOTDToClient( edict_t *client )
|
||||||
if( char_count < MAX_MOTD_LENGTH )
|
if( char_count < MAX_MOTD_LENGTH )
|
||||||
pFileList = aFileList + char_count;
|
pFileList = aFileList + char_count;
|
||||||
else
|
else
|
||||||
*pFileList = 0;
|
pFileList = 0;
|
||||||
|
|
||||||
MESSAGE_BEGIN( MSG_ONE, gmsgMOTD, NULL, client );
|
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 );
|
WRITE_STRING( chunk );
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_FILE( aFileList );
|
FREE_FILE( (void*)aFileList );
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
|
|
||||||
void Spawn( void );
|
void Spawn( void );
|
||||||
void Precache( void );
|
void Precache( void );
|
||||||
|
void UpdateOnRemove();
|
||||||
int Classify( void ) { return CLASS_ALIEN_MILITARY; };
|
int Classify( void ) { return CLASS_ALIEN_MILITARY; };
|
||||||
int BloodColor( void ) { return BLOOD_COLOR_YELLOW; }
|
int BloodColor( void ) { return BLOOD_COLOR_YELLOW; }
|
||||||
void Killed( entvars_t *pevAttacker, int iGib );
|
void Killed( entvars_t *pevAttacker, int iGib );
|
||||||
|
@ -345,6 +346,26 @@ void CNihilanth::Precache( void )
|
||||||
PRECACHE_SOUND( "debris/beamstart7.wav" );
|
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 )
|
void CNihilanth::PainSound( void )
|
||||||
{
|
{
|
||||||
if( m_flNextPainSound > gpGlobals->time )
|
if( m_flNextPainSound > gpGlobals->time )
|
||||||
|
@ -457,7 +478,7 @@ void CNihilanth::DyingThink( void )
|
||||||
{
|
{
|
||||||
if( m_pBall->pev->renderamt > 0 )
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -587,7 +608,7 @@ void CNihilanth::ShootBalls( void )
|
||||||
|
|
||||||
while( m_flShootTime < m_flShootEnd && m_flShootTime < gpGlobals->time )
|
while( m_flShootTime < m_flShootEnd && m_flShootTime < gpGlobals->time )
|
||||||
{
|
{
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
Vector vecSrc, vecDir;
|
Vector vecSrc, vecDir;
|
||||||
CNihilanthHVR *pEntity;
|
CNihilanthHVR *pEntity;
|
||||||
|
@ -621,14 +642,14 @@ void CNihilanth::MakeFriend( Vector vecStart )
|
||||||
|
|
||||||
for( i = 0; i < 3; i++ )
|
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
|
if( pev->rendermode == kRenderNormal ) // don't do it if they are already fading
|
||||||
m_hFriend[i]->MyMonsterPointer()->FadeMonster();
|
m_hFriend[i]->MyMonsterPointer()->FadeMonster();
|
||||||
m_hFriend[i] = NULL;
|
m_hFriend[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hFriend[i] == NULL )
|
if( m_hFriend[i] == 0 )
|
||||||
{
|
{
|
||||||
if( RANDOM_LONG( 0, 1 ) == 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 );
|
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 );
|
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];
|
char szName[64];
|
||||||
|
|
||||||
|
@ -742,7 +763,7 @@ void CNihilanth::NextActivity()
|
||||||
float flDist = ( m_posDesired - pev->origin ).Length();
|
float flDist = ( m_posDesired - pev->origin ).Length();
|
||||||
float flDot = DotProduct( m_vecDesired, gpGlobals->v_forward );
|
float flDot = DotProduct( m_vecDesired, gpGlobals->v_forward );
|
||||||
|
|
||||||
if( m_hRecharger != NULL )
|
if( m_hRecharger != 0 )
|
||||||
{
|
{
|
||||||
// at we at power up yet?
|
// at we at power up yet?
|
||||||
if( flDist < 128.0 )
|
if( flDist < 128.0 )
|
||||||
|
@ -767,23 +788,23 @@ void CNihilanth::NextActivity()
|
||||||
return;
|
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 )
|
if( m_flLastSeen + 15 < gpGlobals->time )
|
||||||
{
|
{
|
||||||
m_hEnemy = NULL;
|
m_hEnemy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_hEnemy == NULL )
|
if( m_hEnemy == 0 )
|
||||||
{
|
{
|
||||||
Look( 4096 );
|
Look( 4096 );
|
||||||
m_hEnemy = BestVisibleEnemy();
|
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 )
|
if( m_flLastSeen + 5 > gpGlobals->time && flDist < 256 && flDot > 0 )
|
||||||
{
|
{
|
||||||
|
@ -860,7 +881,7 @@ void CNihilanth::HuntThink( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for current enemy
|
// look for current enemy
|
||||||
if( m_hEnemy != NULL && m_hRecharger == NULL )
|
if( m_hEnemy != 0 && m_hRecharger == 0 )
|
||||||
{
|
{
|
||||||
if( FVisible( m_hEnemy ) )
|
if( FVisible( m_hEnemy ) )
|
||||||
{
|
{
|
||||||
|
@ -874,7 +895,7 @@ void CNihilanth::HuntThink( void )
|
||||||
}
|
}
|
||||||
else
|
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 )
|
if( flDir < 0 )
|
||||||
flSpeed = -flSpeed;
|
flSpeed = -flSpeed;
|
||||||
|
|
||||||
float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward );
|
//float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward );
|
||||||
|
|
||||||
// sideways drag
|
// sideways drag
|
||||||
m_velocity.x = m_velocity.x * ( 1.0 - fabs( gpGlobals->v_right.x ) * 0.05 );
|
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++ )
|
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] );
|
CNihilanthHVR *pSphere = (CNihilanthHVR *)( (CBaseEntity *)m_hSphere[i] );
|
||||||
pSphere->AbsorbInit();
|
pSphere->AbsorbInit();
|
||||||
|
@ -978,7 +999,7 @@ BOOL CNihilanth::EmitSphere( void )
|
||||||
|
|
||||||
for( int i = 0; i < N_SPHERES; i++ )
|
for( int i = 0; i < N_SPHERES; i++ )
|
||||||
{
|
{
|
||||||
if( m_hSphere[i] != NULL )
|
if( m_hSphere[i] != 0 )
|
||||||
{
|
{
|
||||||
m_iActiveSpheres++;
|
m_iActiveSpheres++;
|
||||||
}
|
}
|
||||||
|
@ -1007,10 +1028,10 @@ void CNihilanth::TargetSphere( USE_TYPE useType, float value )
|
||||||
|
|
||||||
for( i = 0; i < N_SPHERES; i++ )
|
for( i = 0; i < N_SPHERES; i++ )
|
||||||
{
|
{
|
||||||
if( m_hSphere[i] != NULL )
|
if( m_hSphere[i] != 0 )
|
||||||
{
|
{
|
||||||
pSphere = m_hSphere[i]->MyMonsterPointer();
|
pSphere = m_hSphere[i]->MyMonsterPointer();
|
||||||
if( pSphere->m_hEnemy == NULL )
|
if( pSphere->m_hEnemy == 0 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1036,7 +1057,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// zen
|
// zen
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
if( RANDOM_LONG( 0, 4 ) == 0 )
|
if( RANDOM_LONG( 0, 4 ) == 0 )
|
||||||
EMIT_SOUND( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, 0.2 );
|
EMIT_SOUND( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, 0.2 );
|
||||||
|
@ -1077,7 +1098,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// prayer
|
// prayer
|
||||||
if (m_hEnemy != NULL)
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
char szText[32];
|
char szText[32];
|
||||||
|
|
||||||
|
@ -1141,7 +1162,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
case 4:
|
case 4:
|
||||||
// get a sphere
|
// get a sphere
|
||||||
{
|
{
|
||||||
if( m_hRecharger != NULL )
|
if( m_hRecharger != 0 )
|
||||||
{
|
{
|
||||||
if( !EmitSphere() )
|
if( !EmitSphere() )
|
||||||
{
|
{
|
||||||
|
@ -1157,7 +1178,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if( m_hEnemy != NULL )
|
if( m_hEnemy != 0 )
|
||||||
{
|
{
|
||||||
Vector vecSrc, vecAngles;
|
Vector vecSrc, vecAngles;
|
||||||
GetAttachment( 2, vecSrc, vecAngles );
|
GetAttachment( 2, vecSrc, vecAngles );
|
||||||
|
@ -1185,8 +1206,22 @@ void CNihilanth::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
|
||||||
case USE_OFF:
|
case USE_OFF:
|
||||||
{
|
{
|
||||||
CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, m_szDeadTouch );
|
CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, m_szDeadTouch );
|
||||||
if( pTouch && m_hEnemy != NULL )
|
if( pTouch )
|
||||||
pTouch->Touch( m_hEnemy );
|
{
|
||||||
|
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;
|
break;
|
||||||
case USE_ON:
|
case USE_ON:
|
||||||
|
@ -1326,7 +1361,7 @@ void CNihilanthHVR::HoverThink( void )
|
||||||
{
|
{
|
||||||
pev->nextthink = gpGlobals->time + 0.1;
|
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 ) );
|
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;
|
pev->nextthink = gpGlobals->time + 0.05;
|
||||||
|
|
||||||
// check world boundaries
|
// 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 );
|
SetTouch( NULL );
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
|
@ -1547,7 +1582,7 @@ void CNihilanthHVR::TeleportThink( void )
|
||||||
pev->nextthink = gpGlobals->time + 0.1;
|
pev->nextthink = gpGlobals->time + 0.1;
|
||||||
|
|
||||||
// check world boundaries
|
// 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" );
|
STOP_SOUND( edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
|
@ -1559,10 +1594,10 @@ void CNihilanthHVR::TeleportThink( void )
|
||||||
STOP_SOUND( edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
|
STOP_SOUND( edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
|
|
||||||
if( m_hTargetEnt != NULL )
|
if( m_hTargetEnt != 0 )
|
||||||
m_hTargetEnt->Use( m_hEnemy, m_hEnemy, USE_ON, 1.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 );
|
m_hTouch->Touch( m_hEnemy );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1616,10 +1651,10 @@ void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther )
|
||||||
|
|
||||||
if( pOther == pEnemy )
|
if( pOther == pEnemy )
|
||||||
{
|
{
|
||||||
if( m_hTargetEnt != NULL )
|
if( m_hTargetEnt != 0 )
|
||||||
m_hTargetEnt->Use( pEnemy, pEnemy, USE_ON, 1.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 );
|
m_hTouch->Touch( pEnemy );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1642,7 +1677,7 @@ void CNihilanthHVR::DissipateThink( void )
|
||||||
pev->renderamt -= 2;
|
pev->renderamt -= 2;
|
||||||
pev->scale += 0.1;
|
pev->scale += 0.1;
|
||||||
|
|
||||||
if( m_hTargetEnt != NULL )
|
if( m_hTargetEnt != 0 )
|
||||||
{
|
{
|
||||||
CircleTarget( m_hTargetEnt->pev->origin + Vector( 0, 0, 4096 ) );
|
CircleTarget( m_hTargetEnt->pev->origin + Vector( 0, 0, 4096 ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt )
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#define CreateDirectory(p, n) mkdir(p, 0777)
|
#define CreateDirectory(p, n) mkdir(p, 0777)
|
||||||
|
#else
|
||||||
|
#define CreateDirectory(p, n) CreateDirectoryA(p, n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -212,7 +214,7 @@ entvars_t *CGraph::LinkEntForLink( CLink *pLink, CNode *pNode )
|
||||||
//=========================================================
|
//=========================================================
|
||||||
int CGraph::HandleLinkEnt( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODEQUERY queryType )
|
int CGraph::HandleLinkEnt( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODEQUERY queryType )
|
||||||
{
|
{
|
||||||
edict_t *pentWorld;
|
//edict_t *pentWorld;
|
||||||
CBaseEntity *pDoor;
|
CBaseEntity *pDoor;
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
|
|
||||||
|
@ -228,7 +230,7 @@ int CGraph::HandleLinkEnt( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODE
|
||||||
ALERT( at_aiconsole, "dead path ent!\n" );
|
ALERT( at_aiconsole, "dead path ent!\n" );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
pentWorld = NULL;
|
//pentWorld = NULL;
|
||||||
|
|
||||||
// func_door
|
// func_door
|
||||||
if( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) )
|
if( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) )
|
||||||
|
@ -584,7 +586,7 @@ int CGraph::FindShortestPath( int *piPath, int iStart, int iDest, int iHull, int
|
||||||
int iVisitNode;
|
int iVisitNode;
|
||||||
int iCurrentNode;
|
int iCurrentNode;
|
||||||
int iNumPathNodes;
|
int iNumPathNodes;
|
||||||
int iHullMask;
|
int iHullMask = 0;
|
||||||
|
|
||||||
if( !m_fGraphPresent || !m_fGraphPointersSet )
|
if( !m_fGraphPresent || !m_fGraphPointersSet )
|
||||||
{
|
{
|
||||||
|
@ -791,12 +793,12 @@ void inline CalcBounds( int &Lower, int &Upper, int Goal, int Best )
|
||||||
int Temp = 2 * Goal - Best;
|
int Temp = 2 * Goal - Best;
|
||||||
if( Best > Goal )
|
if( Best > Goal )
|
||||||
{
|
{
|
||||||
Lower = max( 0, Temp );
|
Lower = Q_max( 0, Temp );
|
||||||
Upper = Best;
|
Upper = Best;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Upper = min( 255, Temp );
|
Upper = Q_min( 255, Temp );
|
||||||
Lower = Best;
|
Lower = Best;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -960,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++ )
|
for( j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++ )
|
||||||
{
|
{
|
||||||
|
@ -985,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++ )
|
for( j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++ )
|
||||||
{
|
{
|
||||||
|
@ -1010,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++ )
|
for( j = m_RangeStart[0][i]; j <= m_RangeEnd[0][i]; j++ )
|
||||||
{
|
{
|
||||||
|
@ -1032,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++ )
|
for( j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++ )
|
||||||
{
|
{
|
||||||
|
@ -1053,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++ )
|
for( j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++ )
|
||||||
{
|
{
|
||||||
|
@ -1663,10 +1665,10 @@ void CTestHull::BuildNodeGraph( void )
|
||||||
|
|
||||||
int iBadNode;// this is the node that caused graph generation to fail
|
int iBadNode;// this is the node that caused graph generation to fail
|
||||||
|
|
||||||
int cMaxInitialLinks = 0;
|
//int cMaxInitialLinks = 0;
|
||||||
int cMaxValidLinks = 0;
|
//int cMaxValidLinks = 0;
|
||||||
|
|
||||||
int iPoolIndex = 0;
|
//int iPoolIndex = 0;
|
||||||
int cPoolLinks;// number of links in the pool.
|
int cPoolLinks;// number of links in the pool.
|
||||||
|
|
||||||
Vector vecDirToCheckNode;
|
Vector vecDirToCheckNode;
|
||||||
|
@ -2056,11 +2058,16 @@ void CTestHull::BuildNodeGraph( void )
|
||||||
fprintf( file, "\nAll Connections are Paired!\n" );
|
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" );
|
||||||
fprintf( file, "\n\n-------------------------------------------------------------------------------\n" );
|
fprintf( file, "\n\n-------------------------------------------------------------------------------\n" );
|
||||||
fprintf( file, "Total Number of Connections in Pool: %d\n", cPoolLinks );
|
fprintf( file, "Total Number of Connections in Pool: %d\n", cPoolLinks );
|
||||||
fprintf( file, "-------------------------------------------------------------------------------\n" );
|
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" );
|
fprintf( file, "-------------------------------------------------------------------------------\n" );
|
||||||
|
|
||||||
ALERT( at_aiconsole, "%d Nodes, %d Connections\n", WorldGraph.m_cNodes, cPoolLinks );
|
ALERT( at_aiconsole, "%d Nodes, %d Connections\n", WorldGraph.m_cNodes, cPoolLinks );
|
||||||
|
@ -2101,7 +2108,7 @@ void CTestHull::BuildNodeGraph( void )
|
||||||
WorldGraph.ComputeStaticRoutingTables();
|
WorldGraph.ComputeStaticRoutingTables();
|
||||||
|
|
||||||
// save the node graph for this level
|
// save the node graph for this level
|
||||||
WorldGraph.FSaveGraph( (char *)STRING( gpGlobals->mapname ) );
|
WorldGraph.FSaveGraph( STRING( gpGlobals->mapname ) );
|
||||||
ALERT( at_console, "Done.\n" );
|
ALERT( at_console, "Done.\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2356,7 +2363,7 @@ void CQueuePriority::Heap_SiftUp( void )
|
||||||
// will be loaded. If file cannot be loaded, the node tree
|
// will be loaded. If file cannot be loaded, the node tree
|
||||||
// will be created and saved to disk.
|
// will be created and saved to disk.
|
||||||
//=========================================================
|
//=========================================================
|
||||||
int CGraph::FLoadGraph( char *szMapName )
|
int CGraph::FLoadGraph( const char *szMapName )
|
||||||
{
|
{
|
||||||
char szFilename[MAX_PATH];
|
char szFilename[MAX_PATH];
|
||||||
int iVersion;
|
int iVersion;
|
||||||
|
@ -2535,7 +2542,7 @@ NoMemory:
|
||||||
// CGraph - FSaveGraph - It's not rocket science.
|
// CGraph - FSaveGraph - It's not rocket science.
|
||||||
// this WILL overwrite existing files.
|
// this WILL overwrite existing files.
|
||||||
//=========================================================
|
//=========================================================
|
||||||
int CGraph::FSaveGraph( char *szMapName )
|
int CGraph::FSaveGraph( const char *szMapName )
|
||||||
{
|
{
|
||||||
int iVersion = GRAPH_VERSION;
|
int iVersion = GRAPH_VERSION;
|
||||||
char szFilename[MAX_PATH];
|
char szFilename[MAX_PATH];
|
||||||
|
@ -2667,7 +2674,7 @@ int CGraph::FSetGraphPointers( void )
|
||||||
// though. ( I now suspect that we are getting GMT back from
|
// though. ( I now suspect that we are getting GMT back from
|
||||||
// these functions and must compensate for local time ) (sjb)
|
// these functions and must compensate for local time ) (sjb)
|
||||||
//=========================================================
|
//=========================================================
|
||||||
int CGraph::CheckNODFile( char *szMapName )
|
int CGraph::CheckNODFile( const char *szMapName )
|
||||||
{
|
{
|
||||||
int retValue;
|
int retValue;
|
||||||
|
|
||||||
|
|
14
dlls/nodes.h
14
dlls/nodes.h
|
@ -15,7 +15,8 @@
|
||||||
//=========================================================
|
//=========================================================
|
||||||
// nodes.h
|
// nodes.h
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
#ifndef NODES_H
|
||||||
|
#define NODES_H
|
||||||
//=========================================================
|
//=========================================================
|
||||||
// DEFINE
|
// DEFINE
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -103,7 +104,11 @@ typedef struct
|
||||||
//=========================================================
|
//=========================================================
|
||||||
// CGraph
|
// CGraph
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
#ifdef XASH_64BIT
|
||||||
|
#define GRAPH_VERSION (int)16 * 10
|
||||||
|
#else
|
||||||
#define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files.
|
#define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files.
|
||||||
|
#endif
|
||||||
|
|
||||||
class CGraph
|
class CGraph
|
||||||
{
|
{
|
||||||
|
@ -177,9 +182,9 @@ public:
|
||||||
void InitGraph( void );
|
void InitGraph( void );
|
||||||
int AllocNodes ( void );
|
int AllocNodes ( void );
|
||||||
|
|
||||||
int CheckNODFile(char *szMapName);
|
int CheckNODFile(const char *szMapName);
|
||||||
int FLoadGraph(char *szMapName);
|
int FLoadGraph(const char *szMapName);
|
||||||
int FSaveGraph(char *szMapName);
|
int FSaveGraph(const char *szMapName);
|
||||||
int FSetGraphPointers(void);
|
int FSetGraphPointers(void);
|
||||||
void CheckNode(Vector vecOrigin, int iNode);
|
void CheckNode(Vector vecOrigin, int iNode);
|
||||||
|
|
||||||
|
@ -370,3 +375,4 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CGraph WorldGraph;
|
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++ )
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -285,9 +285,9 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc )
|
||||||
|
|
||||||
for( int i = 0; i < m_iUnits; i++ )
|
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();
|
m_hGrunt[i]->SUB_StartFadeOut();
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ void COsprey::HoverThink( void )
|
||||||
int i;
|
int i;
|
||||||
for( i = 0; i < 4; 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
234
dlls/plats.cpp
234
dlls/plats.cpp
|
@ -82,12 +82,12 @@ void CBasePlatTrain::KeyValue( KeyValueData *pkvd )
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
else if( FStrEq( pkvd->szKeyName, "movesnd" ) )
|
||||||
{
|
{
|
||||||
m_bMoveSnd = atof( pkvd->szValue );
|
m_bMoveSnd = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
else if( FStrEq( pkvd->szKeyName, "stopsnd" ) )
|
||||||
{
|
{
|
||||||
m_bStopSnd = atof( pkvd->szValue );
|
m_bStopSnd = atoi( pkvd->szValue );
|
||||||
pkvd->fHandled = TRUE;
|
pkvd->fHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if( FStrEq( pkvd->szKeyName, "volume" ) )
|
else if( FStrEq( pkvd->szKeyName, "volume" ) )
|
||||||
|
@ -104,111 +104,100 @@ void CBasePlatTrain::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CBasePlatTrain::Precache( void )
|
void CBasePlatTrain::Precache( void )
|
||||||
{
|
{
|
||||||
|
const char *pszSound;
|
||||||
|
BOOL NullSound = FALSE;
|
||||||
|
|
||||||
// set the plat's "in-motion" sound
|
// set the plat's "in-motion" sound
|
||||||
switch( m_bMoveSnd )
|
switch( m_bMoveSnd )
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
pev->noiseMoving = MAKE_STRING( "common/null.wav" );
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "plats/bigmove1.wav" );
|
pszSound = "plats/bigmove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/bigmove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "plats/bigmove2.wav" );
|
pszSound = "plats/bigmove2.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/bigmove2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "plats/elevmove1.wav" );
|
pszSound = "plats/elevmove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/elevmove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "plats/elevmove2.wav" );
|
pszSound = "plats/elevmove2.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/elevmove2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "plats/elevmove3.wav" );
|
pszSound = "plats/elevmove3.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/elevmove3.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
PRECACHE_SOUND( "plats/freightmove1.wav" );
|
pszSound = "plats/freightmove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/freightmove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
PRECACHE_SOUND( "plats/freightmove2.wav" );
|
pszSound = "plats/freightmove2.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/freightmove2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
PRECACHE_SOUND( "plats/heavymove1.wav" );
|
pszSound = "plats/heavymove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/heavymove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
PRECACHE_SOUND( "plats/rackmove1.wav" );
|
pszSound = "plats/rackmove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/rackmove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
PRECACHE_SOUND( "plats/railmove1.wav" );
|
pszSound = "plats/railmove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/railmove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
PRECACHE_SOUND( "plats/squeekmove1.wav" );
|
pszSound = "plats/squeekmove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/squeekmove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
PRECACHE_SOUND( "plats/talkmove1.wav" );
|
pszSound = "plats/talkmove1.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/talkmove1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
PRECACHE_SOUND( "plats/talkmove2.wav" );
|
pszSound = "plats/talkmove2.wav";
|
||||||
pev->noiseMoving = MAKE_STRING( "plats/talkmove2.wav" );
|
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
default:
|
default:
|
||||||
pev->noiseMoving = MAKE_STRING( "common/null.wav" );
|
pszSound = "common/null.wav";
|
||||||
|
NullSound = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !NullSound )
|
||||||
|
PRECACHE_SOUND( pszSound );
|
||||||
|
pev->noiseMoving = MAKE_STRING( pszSound );
|
||||||
|
NullSound = FALSE;
|
||||||
|
|
||||||
// set the plat's 'reached destination' stop sound
|
// set the plat's 'reached destination' stop sound
|
||||||
switch( m_bStopSnd )
|
switch( m_bStopSnd )
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
pev->noiseArrived = MAKE_STRING( "common/null.wav" );
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "plats/bigstop1.wav" );
|
pszSound = "plats/bigstop1.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/bigstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "plats/bigstop2.wav" );
|
pszSound = "plats/bigstop2.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/bigstop2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "plats/freightstop1.wav" );
|
pszSound = "plats/freightstop1.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/freightstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "plats/heavystop2.wav" );
|
pszSound = "plats/heavystop2.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/heavystop2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "plats/rackstop1.wav" );
|
pszSound = "plats/rackstop1.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/rackstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
PRECACHE_SOUND( "plats/railstop1.wav" );
|
pszSound = "plats/railstop1.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/railstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
PRECACHE_SOUND( "plats/squeekstop1.wav" );
|
pszSound = "plats/squeekstop1.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/squeekstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
PRECACHE_SOUND( "plats/talkstop1.wav" );
|
pszSound = "plats/talkstop1.wav";
|
||||||
pev->noiseArrived = MAKE_STRING( "plats/talkstop1.wav" );
|
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
default:
|
default:
|
||||||
pev->noiseArrived = MAKE_STRING( "common/null.wav" );
|
pszSound = "common/null.wav";
|
||||||
|
NullSound = TRUE;
|
||||||
break;
|
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; }
|
virtual int ObjectCaps( void ) { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE; }
|
||||||
void SpawnInsideTrigger( CFuncPlat *pPlatform );
|
void SpawnInsideTrigger( CFuncPlat *pPlatform );
|
||||||
void Touch( CBaseEntity *pOther );
|
void Touch( CBaseEntity *pOther );
|
||||||
CFuncPlat *m_pPlatform;
|
EHANDLE m_hPlatform;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
|
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
|
||||||
|
@ -340,24 +329,24 @@ static void PlatSpawnInsideTrigger( entvars_t *pevPlatform )
|
||||||
//
|
//
|
||||||
void CPlatTrigger::SpawnInsideTrigger( CFuncPlat *pPlatform )
|
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
|
// Create trigger entity, "point" it at the owning platform, give it a touch method
|
||||||
pev->solid = SOLID_TRIGGER;
|
pev->solid = SOLID_TRIGGER;
|
||||||
pev->movetype = MOVETYPE_NONE;
|
pev->movetype = MOVETYPE_NONE;
|
||||||
pev->origin = pPlatform->pev->origin;
|
pev->origin = pPlatform->pev->origin;
|
||||||
|
|
||||||
// Establish the trigger field's size
|
// Establish the trigger field's size
|
||||||
Vector vecTMin = m_pPlatform->pev->mins + Vector( 25, 25, 0 );
|
Vector vecTMin = pPlatform->pev->mins + Vector( 25, 25, 0 );
|
||||||
Vector vecTMax = m_pPlatform->pev->maxs + Vector( 25, 25, 8 );
|
Vector vecTMax = pPlatform->pev->maxs + Vector( 25, 25, 8 );
|
||||||
vecTMin.z = vecTMax.z - ( m_pPlatform->m_vecPosition1.z - m_pPlatform->m_vecPosition2.z + 8 );
|
vecTMin.z = vecTMax.z - ( pPlatform->m_vecPosition1.z - pPlatform->m_vecPosition2.z + 8 );
|
||||||
if( m_pPlatform->pev->size.x <= 50 )
|
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;
|
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;
|
vecTMax.y = vecTMin.y + 1;
|
||||||
}
|
}
|
||||||
UTIL_SetSize( pev, vecTMin, vecTMax );
|
UTIL_SetSize( pev, vecTMin, vecTMax );
|
||||||
|
@ -373,15 +362,24 @@ void CPlatTrigger::Touch( CBaseEntity *pOther )
|
||||||
if( !FClassnameIs( pevToucher, "player" ) )
|
if( !FClassnameIs( pevToucher, "player" ) )
|
||||||
return;
|
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
|
// Ignore touches by corpses
|
||||||
if( !pOther->IsAlive() )
|
if( !pOther->IsAlive() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Make linked platform go up/down.
|
// Make linked platform go up/down.
|
||||||
if( m_pPlatform->m_toggle_state == TS_AT_BOTTOM )
|
if( pPlatform->m_toggle_state == TS_AT_BOTTOM )
|
||||||
m_pPlatform->GoUp();
|
pPlatform->GoUp();
|
||||||
else if( m_pPlatform->m_toggle_state == TS_AT_TOP )
|
else if( pPlatform->m_toggle_state == TS_AT_TOP )
|
||||||
m_pPlatform->pev->nextthink = m_pPlatform->pev->ltime + 1;// delay going down
|
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 )
|
void CFuncPlat::GoDown( void )
|
||||||
{
|
{
|
||||||
if( pev->noiseMovement )
|
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 );
|
ASSERT( m_toggle_state == TS_AT_TOP || m_toggle_state == TS_GOING_UP );
|
||||||
m_toggle_state = TS_GOING_DOWN;
|
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 )
|
void CFuncPlat::HitBottom( void )
|
||||||
{
|
{
|
||||||
if( pev->noiseMovement )
|
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 )
|
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 );
|
ASSERT( m_toggle_state == TS_GOING_DOWN );
|
||||||
m_toggle_state = TS_AT_BOTTOM;
|
m_toggle_state = TS_AT_BOTTOM;
|
||||||
|
@ -447,7 +445,7 @@ void CFuncPlat::HitBottom( void )
|
||||||
void CFuncPlat::GoUp( void )
|
void CFuncPlat::GoUp( void )
|
||||||
{
|
{
|
||||||
if( pev->noiseMovement )
|
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 );
|
ASSERT( m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN );
|
||||||
m_toggle_state = TS_GOING_UP;
|
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 )
|
void CFuncPlat::HitTop( void )
|
||||||
{
|
{
|
||||||
if( pev->noiseMovement )
|
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 )
|
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 );
|
ASSERT( m_toggle_state == TS_GOING_UP );
|
||||||
m_toggle_state = TS_AT_TOP;
|
m_toggle_state = TS_AT_TOP;
|
||||||
|
@ -484,7 +482,7 @@ void CFuncPlat::Blocked( CBaseEntity *pOther )
|
||||||
pOther->TakeDamage( pev, pev, 1, DMG_CRUSH );
|
pOther->TakeDamage( pev, pev, 1, DMG_CRUSH );
|
||||||
|
|
||||||
if( pev->noiseMovement )
|
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
|
// Send the platform back where it came from
|
||||||
ASSERT( m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN );
|
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 )
|
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 )
|
void CFuncPlatRot::HitTop( void )
|
||||||
{
|
{
|
||||||
|
@ -672,7 +670,7 @@ void CFuncTrain::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
|
||||||
pev->nextthink = 0;
|
pev->nextthink = 0;
|
||||||
pev->velocity = g_vecZero;
|
pev->velocity = g_vecZero;
|
||||||
if( pev->noiseStopMoving )
|
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.
|
// clear the sound channel.
|
||||||
if( pev->noiseMovement )
|
if( pev->noiseMovement )
|
||||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||||
if( pev->noiseStopMoving )
|
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;
|
pev->nextthink = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -706,9 +704,9 @@ void CFuncTrain::Wait( void )
|
||||||
// -1 wait will wait forever!
|
// -1 wait will wait forever!
|
||||||
pev->nextthink = pev->ltime + m_flWait;
|
pev->nextthink = pev->ltime + m_flWait;
|
||||||
if( pev->noiseMovement )
|
if( pev->noiseMovement )
|
||||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||||
if( pev->noiseStopMoving )
|
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 );
|
SetThink( &CFuncTrain::Next );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -730,10 +728,10 @@ void CFuncTrain::Next( void )
|
||||||
if( !pTarg )
|
if( !pTarg )
|
||||||
{
|
{
|
||||||
if( pev->noiseMovement )
|
if( pev->noiseMovement )
|
||||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING( pev->noiseMovement ) );
|
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) );
|
||||||
// Play stop sound
|
// Play stop sound
|
||||||
if( pev->noiseStopMoving )
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,21 +741,21 @@ void CFuncTrain::Next( void )
|
||||||
pev->target = pTarg->pev->target;
|
pev->target = pTarg->pev->target;
|
||||||
m_flWait = pTarg->GetDelay();
|
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)
|
// don't copy speed from target if it is 0 (uninitialized)
|
||||||
pev->speed = m_pevCurrentTarget->speed;
|
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.
|
m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us.
|
||||||
|
|
||||||
pev->enemy = pTarg->edict();//hack
|
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.
|
// Path corner has indicated a teleport to the next corner.
|
||||||
SetBits(pev->effects, EF_NOINTERP);
|
SetBits( pev->effects, EF_NOINTERP );
|
||||||
UTIL_SetOrigin(pev, pTarg->pev->origin - (pev->mins + pev->maxs)* 0.5);
|
UTIL_SetOrigin( pev, pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5 );
|
||||||
Wait(); // Get on with doing the next path corner.
|
Wait(); // Get on with doing the next path corner.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -767,13 +765,15 @@ void CFuncTrain::Next( void )
|
||||||
// CHANGED this from CHAN_VOICE to CHAN_STATIC around OEM beta time because trains should
|
// 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.
|
// 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).
|
// this is not a hack or temporary fix, this is how things should be. (sjb).
|
||||||
if ( pev->noiseMovement )
|
if( pev->noiseMovement )
|
||||||
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING(pev->noiseMovement) );
|
{
|
||||||
if ( pev->noiseMovement )
|
STOP_SOUND( edict(), CHAN_STATIC, STRING( 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 );
|
||||||
ClearBits(pev->effects, EF_NOINTERP);
|
}
|
||||||
|
|
||||||
|
ClearBits( pev->effects, EF_NOINTERP );
|
||||||
SetMoveDone( &CFuncTrain::Wait );
|
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:
|
case 1:
|
||||||
PRECACHE_SOUND( "plats/train2.wav" );
|
PRECACHE_SOUND( "plats/train2.wav" );
|
||||||
PRECACHE_SOUND( "plats/train1.wav" );
|
PRECACHE_SOUND( "plats/train1.wav" );
|
||||||
pev->noise = MAKE_STRING("plats/train2.wav" );
|
pev->noise = MAKE_STRING( "plats/train2.wav" );
|
||||||
pev->noise1 = MAKE_STRING("plats/train1.wav" );
|
pev->noise1 = MAKE_STRING( "plats/train1.wav" );
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "plats/platmove1.wav" );
|
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,
|
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 );
|
(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 );
|
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
|
// 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_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;
|
m_soundPlaying = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// update pitch
|
// 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
|
// volume 0.0 - 1.0 - 6 bits
|
||||||
// m_sounds 3 bits
|
// m_sounds 3 bits
|
||||||
|
@ -1322,7 +1322,7 @@ BOOL CFuncTrackTrain::OnControls( entvars_t *pevTest )
|
||||||
|
|
||||||
void CFuncTrackTrain::Find( void )
|
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 )
|
if( !m_ppath )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1437,7 +1437,7 @@ void CFuncTrackTrain::Spawn( void )
|
||||||
pev->speed = 0;
|
pev->speed = 0;
|
||||||
pev->velocity = g_vecZero;
|
pev->velocity = g_vecZero;
|
||||||
pev->avelocity = g_vecZero;
|
pev->avelocity = g_vecZero;
|
||||||
pev->impulse = m_speed;
|
pev->impulse = (int)m_speed;
|
||||||
|
|
||||||
m_dir = 1;
|
m_dir = 1;
|
||||||
|
|
||||||
|
@ -1471,6 +1471,8 @@ void CFuncTrackTrain::Spawn( void )
|
||||||
|
|
||||||
void CFuncTrackTrain::Precache( void )
|
void CFuncTrackTrain::Precache( void )
|
||||||
{
|
{
|
||||||
|
const char *pszSound;
|
||||||
|
|
||||||
if( m_flVolume == 0.0 )
|
if( m_flVolume == 0.0 )
|
||||||
m_flVolume = 1.0;
|
m_flVolume = 1.0;
|
||||||
|
|
||||||
|
@ -1478,34 +1480,36 @@ void CFuncTrackTrain::Precache( void )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
// no sound
|
// no sound
|
||||||
pev->noise = 0;
|
pszSound = NULL;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
PRECACHE_SOUND( "plats/ttrain1.wav" );
|
pszSound = "plats/ttrain1.wav";
|
||||||
pev->noise = MAKE_STRING("plats/ttrain1.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PRECACHE_SOUND( "plats/ttrain2.wav" );
|
pszSound = "plats/ttrain2.wav";
|
||||||
pev->noise = MAKE_STRING( "plats/ttrain2.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PRECACHE_SOUND( "plats/ttrain3.wav" );
|
pszSound = "plats/ttrain3.wav";
|
||||||
pev->noise = MAKE_STRING( "plats/ttrain3.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PRECACHE_SOUND( "plats/ttrain4.wav" );
|
pszSound = "plats/ttrain4.wav";
|
||||||
pev->noise = MAKE_STRING( "plats/ttrain4.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
PRECACHE_SOUND( "plats/ttrain6.wav" );
|
pszSound = "plats/ttrain6.wav";
|
||||||
pev->noise = MAKE_STRING( "plats/ttrain6.wav" );
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
PRECACHE_SOUND( "plats/ttrain7.wav" );
|
pszSound = "plats/ttrain7.wav";
|
||||||
pev->noise = MAKE_STRING( "plats/ttrain7.wav" );
|
|
||||||
break;
|
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_brake1.wav" );
|
||||||
PRECACHE_SOUND( "plats/ttrain_start1.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;
|
pev->takedamage = DAMAGE_AIM;
|
||||||
m_hTargetEnt = GetNextTarget();
|
m_hTargetEnt = GetNextTarget();
|
||||||
if( m_hTargetEnt == NULL )
|
if( m_hTargetEnt == 0 )
|
||||||
return;
|
return;
|
||||||
pev->health = pev->max_health;
|
pev->health = pev->max_health;
|
||||||
Next();
|
Next();
|
||||||
|
|
251
dlls/player.cpp
251
dlls/player.cpp
|
@ -34,6 +34,7 @@
|
||||||
#include "decals.h"
|
#include "decals.h"
|
||||||
#include "gamerules.h"
|
#include "gamerules.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "pm_shared.h"
|
||||||
#include "hltv.h"
|
#include "hltv.h"
|
||||||
|
|
||||||
// #define DUCKFIX
|
// #define DUCKFIX
|
||||||
|
@ -44,6 +45,8 @@ extern DLL_GLOBAL BOOL g_fDrawLines;
|
||||||
int gEvilImpulse101;
|
int gEvilImpulse101;
|
||||||
extern DLL_GLOBAL int g_iSkillLevel, gDisplayTitle;
|
extern DLL_GLOBAL int g_iSkillLevel, gDisplayTitle;
|
||||||
|
|
||||||
|
extern "C" int g_bhopcap;
|
||||||
|
|
||||||
BOOL gInitHUD = TRUE;
|
BOOL gInitHUD = TRUE;
|
||||||
|
|
||||||
extern void CopyToBodyQue( entvars_t *pev);
|
extern void CopyToBodyQue( entvars_t *pev);
|
||||||
|
@ -180,6 +183,7 @@ int gmsgSetFOV = 0;
|
||||||
int gmsgShowMenu = 0;
|
int gmsgShowMenu = 0;
|
||||||
int gmsgGeigerRange = 0;
|
int gmsgGeigerRange = 0;
|
||||||
int gmsgTeamNames = 0;
|
int gmsgTeamNames = 0;
|
||||||
|
int gmsgBhopcap = 0;
|
||||||
|
|
||||||
int gmsgStatusText = 0;
|
int gmsgStatusText = 0;
|
||||||
int gmsgStatusValue = 0;
|
int gmsgStatusValue = 0;
|
||||||
|
@ -201,7 +205,8 @@ void LinkUserMessages( void )
|
||||||
gmsgDamage = REG_USER_MSG( "Damage", 12 );
|
gmsgDamage = REG_USER_MSG( "Damage", 12 );
|
||||||
gmsgBattery = REG_USER_MSG( "Battery", 2);
|
gmsgBattery = REG_USER_MSG( "Battery", 2);
|
||||||
gmsgTrain = REG_USER_MSG( "Train", 1 );
|
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 );
|
gmsgSayText = REG_USER_MSG( "SayText", -1 );
|
||||||
gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
|
gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
|
||||||
gmsgWeaponList = REG_USER_MSG( "WeaponList", -1 );
|
gmsgWeaponList = REG_USER_MSG( "WeaponList", -1 );
|
||||||
|
@ -225,6 +230,7 @@ void LinkUserMessages( void )
|
||||||
gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) );
|
gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) );
|
||||||
gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 );
|
gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 );
|
||||||
gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 );
|
gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 );
|
||||||
|
gmsgBhopcap = REG_USER_MSG( "Bhopcap", 1 );
|
||||||
|
|
||||||
gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
|
gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
|
||||||
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
|
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
|
// keep track of amount of damage last sustained
|
||||||
m_lastDamageAmount = flDamage;
|
m_lastDamageAmount = (int)flDamage;
|
||||||
|
|
||||||
// Armor.
|
// 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;
|
float flNew = flDamage * flRatio;
|
||||||
|
|
||||||
|
@ -660,8 +666,8 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
||||||
int iWeaponRules;
|
int iWeaponRules;
|
||||||
int iAmmoRules;
|
int iAmmoRules;
|
||||||
int i;
|
int i;
|
||||||
CBasePlayerWeapon *rgpPackWeapons[20] = {0};// 20 hardcoded for now. How to determine exactly how many weapons we have?
|
CBasePlayerWeapon *rgpPackWeapons[MAX_WEAPONS] = {0,};
|
||||||
int iPackAmmo[MAX_AMMO_SLOTS + 1];
|
int iPackAmmo[MAX_AMMO_SLOTS];
|
||||||
int iPW = 0;// index into packweapons array
|
int iPW = 0;// index into packweapons array
|
||||||
int iPA = 0;// index into packammo array
|
int iPA = 0;// index into packammo array
|
||||||
|
|
||||||
|
@ -669,7 +675,7 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
||||||
|
|
||||||
// get the game rules
|
// get the game rules
|
||||||
iWeaponRules = g_pGameRules->DeadPlayerWeapons( this );
|
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 )
|
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
|
// 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] )
|
if( m_rgpPlayerItems[i] )
|
||||||
{
|
{
|
||||||
// there's a weapon here. Should I pack it?
|
// there's a weapon here. Should I pack it?
|
||||||
CBasePlayerItem *pPlayerItem = m_rgpPlayerItems[i];
|
CBasePlayerItem *pPlayerItem = m_rgpPlayerItems[i];
|
||||||
|
|
||||||
while( pPlayerItem )
|
while( pPlayerItem && iPW < MAX_WEAPONS )
|
||||||
{
|
{
|
||||||
switch( iWeaponRules )
|
switch( iWeaponRules )
|
||||||
{
|
{
|
||||||
|
@ -785,18 +791,21 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit )
|
||||||
|
|
||||||
m_pLastItem = NULL;
|
m_pLastItem = NULL;
|
||||||
|
|
||||||
|
if( m_pTank != 0 )
|
||||||
|
m_pTank->Use( this, this, USE_OFF, 0 );
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
CBasePlayerItem *pPendingItem;
|
CBasePlayerItem *pPendingItem;
|
||||||
for( i = 0; i < MAX_ITEM_TYPES; i++ )
|
for( i = 0; i < MAX_ITEM_TYPES; i++ )
|
||||||
{
|
{
|
||||||
m_pActiveItem = m_rgpPlayerItems[i];
|
m_pActiveItem = m_rgpPlayerItems[i];
|
||||||
|
m_rgpPlayerItems[i] = NULL;
|
||||||
while( m_pActiveItem )
|
while( m_pActiveItem )
|
||||||
{
|
{
|
||||||
pPendingItem = m_pActiveItem->m_pNext;
|
pPendingItem = m_pActiveItem->m_pNext;
|
||||||
m_pActiveItem->Drop();
|
m_pActiveItem->Drop();
|
||||||
m_pActiveItem = pPendingItem;
|
m_pActiveItem = pPendingItem;
|
||||||
}
|
}
|
||||||
m_rgpPlayerItems[i] = NULL;
|
|
||||||
}
|
}
|
||||||
m_pActiveItem = NULL;
|
m_pActiveItem = NULL;
|
||||||
|
|
||||||
|
@ -808,9 +817,15 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit )
|
||||||
else
|
else
|
||||||
pev->weapons &= ~WEAPON_ALLWEAPONS;
|
pev->weapons &= ~WEAPON_ALLWEAPONS;
|
||||||
|
|
||||||
|
// Turn off flashlight
|
||||||
|
ClearBits( pev->effects, EF_DIMLIGHT );
|
||||||
|
|
||||||
for( i = 0; i < MAX_AMMO_SLOTS; i++ )
|
for( i = 0; i < MAX_AMMO_SLOTS; i++ )
|
||||||
m_rgAmmo[i] = 0;
|
m_rgAmmo[i] = 0;
|
||||||
|
|
||||||
|
if( satchelfix.value )
|
||||||
|
DeactivateSatchels( this );
|
||||||
|
|
||||||
UpdateClientData();
|
UpdateClientData();
|
||||||
|
|
||||||
// send Selected Weapon Message to our client
|
// 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 );
|
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->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
|
// this client isn't going to be thinking for a while, so reset the sound until they respawn
|
||||||
pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( edict() ) );
|
pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( edict() ) );
|
||||||
|
@ -1164,7 +1176,7 @@ void CBasePlayer::WaterMove()
|
||||||
// track drowning damage, give it back when
|
// track drowning damage, give it back when
|
||||||
// player finally takes a breath
|
// player finally takes a breath
|
||||||
|
|
||||||
m_idrowndmg += pev->dmg;
|
m_idrowndmg += (int)pev->dmg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1297,6 +1309,9 @@ void CBasePlayer::PlayerDeathThink( void )
|
||||||
StartDeathCam();
|
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
|
// 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 ) ) ) )
|
if( !fAnyButtonDown && !( g_pGameRules->IsMultiplayer() && forcerespawn.value > 0 && ( gpGlobals->time > ( m_fDeadTime + 5 ) ) ) )
|
||||||
return;
|
return;
|
||||||
|
@ -1345,7 +1360,9 @@ void CBasePlayer::StartDeathCam( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyToBodyQue( pev );
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -1353,23 +1370,86 @@ void CBasePlayer::StartDeathCam( void )
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
CopyToBodyQue( pev );
|
CopyToBodyQue( pev );
|
||||||
UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, 128 ), ignore_monsters, edict(), &tr );
|
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 )
|
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->view_ofs = g_vecZero;
|
||||||
pev->angles = pev->v_angle = vecViewAngle;
|
pev->angles = pev->v_angle = vecViewAngle;
|
||||||
pev->fixangle = TRUE;
|
pev->fixangle = TRUE;
|
||||||
pev->solid = SOLID_NOT;
|
pev->solid = SOLID_NOT;
|
||||||
pev->takedamage = DAMAGE_NO;
|
pev->takedamage = DAMAGE_NO;
|
||||||
pev->movetype = MOVETYPE_NONE;
|
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 );
|
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 )
|
void CBasePlayer::PlayerUse( void )
|
||||||
{
|
{
|
||||||
|
if( IsObserver() )
|
||||||
|
return;
|
||||||
|
|
||||||
// Was use pressed or released?
|
// Was use pressed or released?
|
||||||
if( !( ( pev->button | m_afButtonPressed | m_afButtonReleased) & IN_USE ) )
|
if( !( ( pev->button | m_afButtonPressed | m_afButtonReleased) & IN_USE ) )
|
||||||
return;
|
return;
|
||||||
|
@ -1386,12 +1469,11 @@ void CBasePlayer::PlayerUse( void )
|
||||||
// Hit Use on a train?
|
// Hit Use on a train?
|
||||||
if( m_afButtonPressed & IN_USE )
|
if( m_afButtonPressed & IN_USE )
|
||||||
{
|
{
|
||||||
if( m_pTank != NULL )
|
if( m_pTank != 0 )
|
||||||
{
|
{
|
||||||
// Stop controlling the tank
|
// Stop controlling the tank
|
||||||
// TODO: Send HUD Update
|
// TODO: Send HUD Update
|
||||||
m_pTank->Use( this, this, USE_OFF, 0 );
|
m_pTank->Use( this, this, USE_OFF, 0 );
|
||||||
m_pTank = NULL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
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 ) )
|
if( pTrain && !( pev->button & IN_JUMP ) && FBitSet( pev->flags, FL_ONGROUND ) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE ) && pTrain->OnControls( pev ) )
|
||||||
{
|
{
|
||||||
m_afPhysicsFlags |= PFLAG_ONTRAIN;
|
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;
|
m_iTrain |= TRAIN_NEW;
|
||||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "plats/train_use1.wav", 0.8, ATTN_NORM );
|
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "plats/train_use1.wav", 0.8, ATTN_NORM );
|
||||||
return;
|
return;
|
||||||
|
@ -1580,7 +1662,7 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
|
||||||
|
|
||||||
if( -score > pev->frags ) // Will this go negative?
|
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 );
|
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||||
WRITE_BYTE( ENTINDEX( edict() ) );
|
WRITE_BYTE( ENTINDEX( edict() ) );
|
||||||
WRITE_SHORT( pev->frags );
|
WRITE_SHORT( (int)pev->frags );
|
||||||
WRITE_SHORT( m_iDeaths );
|
WRITE_SHORT( m_iDeaths );
|
||||||
WRITE_SHORT( 0 );
|
WRITE_SHORT( 0 );
|
||||||
WRITE_SHORT( g_pGameRules->GetTeamIndex( m_szTeamName ) + 1 );
|
WRITE_SHORT( g_pGameRules->GetTeamIndex( m_szTeamName ) + 1 );
|
||||||
|
@ -1651,8 +1733,8 @@ void CBasePlayer::UpdateStatusBar()
|
||||||
// allies and medics get to see the targets health
|
// allies and medics get to see the targets health
|
||||||
if( g_pGameRules->PlayerRelationship( this, pEntity ) == GR_TEAMMATE )
|
if( g_pGameRules->PlayerRelationship( this, pEntity ) == GR_TEAMMATE )
|
||||||
{
|
{
|
||||||
newSBarState[SBAR_ID_TARGETHEALTH] = 100 * ( pEntity->pev->health / pEntity->pev->max_health );
|
newSBarState[SBAR_ID_TARGETHEALTH] = (int)( 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_TARGETARMOR] = (int)pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max.
|
||||||
}
|
}
|
||||||
|
|
||||||
m_flStatusBarDisappearDelay = gpGlobals->time + 1.0;
|
m_flStatusBarDisappearDelay = gpGlobals->time + 1.0;
|
||||||
|
@ -1747,6 +1829,16 @@ void CBasePlayer::PreThink( void )
|
||||||
|
|
||||||
CheckSuitUpdate();
|
CheckSuitUpdate();
|
||||||
|
|
||||||
|
// Observer Button Handling
|
||||||
|
if( IsObserver() )
|
||||||
|
{
|
||||||
|
Observer_HandleButtons();
|
||||||
|
Observer_CheckTarget();
|
||||||
|
Observer_CheckProperties();
|
||||||
|
pev->impulse = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( pev->deadflag >= DEAD_DYING )
|
if( pev->deadflag >= DEAD_DYING )
|
||||||
{
|
{
|
||||||
PlayerDeathThink();
|
PlayerDeathThink();
|
||||||
|
@ -1807,7 +1899,7 @@ void CBasePlayer::PreThink( void )
|
||||||
|
|
||||||
if( vel )
|
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;
|
m_iTrain |= TRAIN_ACTIVE|TRAIN_NEW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1918,7 +2010,7 @@ void CBasePlayer::CheckTimeBasedDamage()
|
||||||
int i;
|
int i;
|
||||||
BYTE bDuration = 0;
|
BYTE bDuration = 0;
|
||||||
|
|
||||||
static float gtbdPrev = 0.0;
|
//static float gtbdPrev = 0.0;
|
||||||
|
|
||||||
if( !( m_bitsDamageType & DMG_TIMEBASED ) )
|
if( !( m_bitsDamageType & DMG_TIMEBASED ) )
|
||||||
return;
|
return;
|
||||||
|
@ -1957,7 +2049,7 @@ void CBasePlayer::CheckTimeBasedDamage()
|
||||||
// after the player has been drowning and finally takes a breath
|
// after the player has been drowning and finally takes a breath
|
||||||
if( m_idrowndmg > m_idrownrestored )
|
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 );
|
TakeHealth( idif, DMG_GENERIC );
|
||||||
m_idrownrestored += idif;
|
m_idrownrestored += idif;
|
||||||
|
@ -2179,7 +2271,7 @@ void CBasePlayer::CheckSuitUpdate()
|
||||||
// seconds, then we won't repeat playback of this word or sentence
|
// seconds, then we won't repeat playback of this word or sentence
|
||||||
// for at least that number of seconds.
|
// 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 i;
|
||||||
int isentence;
|
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.
|
// is louder than his body/movement, use the weapon volume, else, use the body volume.
|
||||||
if( FBitSet( pev->flags, FL_ONGROUND ) )
|
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,
|
// clamp the noise that can be made by the body, in case a push trigger,
|
||||||
// weapon recoil, or anything shoves the player abnormally fast.
|
// 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
|
// 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 )
|
if( m_iWeaponVolume < 0 )
|
||||||
{
|
{
|
||||||
iVolume = 0;
|
iVolume = 0;
|
||||||
|
@ -2358,7 +2450,7 @@ void CBasePlayer::UpdatePlayerSound( void )
|
||||||
}
|
}
|
||||||
else if( iVolume > m_iTargetVolume )
|
else if( iVolume > m_iTargetVolume )
|
||||||
{
|
{
|
||||||
iVolume -= 250 * gpGlobals->frametime;
|
iVolume -= (int)( 250 * gpGlobals->frametime );
|
||||||
|
|
||||||
if( iVolume < m_iTargetVolume )
|
if( iVolume < m_iTargetVolume )
|
||||||
{
|
{
|
||||||
|
@ -2387,7 +2479,7 @@ void CBasePlayer::UpdatePlayerSound( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep track of virtual muzzle flash
|
// keep track of virtual muzzle flash
|
||||||
m_iWeaponFlash -= 256 * gpGlobals->frametime;
|
m_iWeaponFlash -= (int)( 256 * gpGlobals->frametime );
|
||||||
if( m_iWeaponFlash < 0 )
|
if( m_iWeaponFlash < 0 )
|
||||||
m_iWeaponFlash = 0;
|
m_iWeaponFlash = 0;
|
||||||
|
|
||||||
|
@ -2409,7 +2501,7 @@ void CBasePlayer::PostThink()
|
||||||
goto pt_end;
|
goto pt_end;
|
||||||
|
|
||||||
// Handle Tank controlling
|
// 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 they've moved too far from the gun, or selected a weapon, unuse the gun
|
||||||
if( m_pTank->OnControls( pev ) && !pev->weaponmodel )
|
if( m_pTank->OnControls( pev ) && !pev->weaponmodel )
|
||||||
|
@ -2420,7 +2512,6 @@ void CBasePlayer::PostThink()
|
||||||
{
|
{
|
||||||
// they've moved off the platform
|
// they've moved off the platform
|
||||||
m_pTank->Use( this, this, USE_OFF, 0 );
|
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() )
|
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 );
|
// ALERT( at_console, "fall %f\n", m_flFallVelocity );
|
||||||
}
|
}
|
||||||
m_flFallVelocity = 0;
|
m_flFallVelocity = 0;
|
||||||
|
@ -2494,11 +2585,15 @@ void CBasePlayer::PostThink()
|
||||||
CheckPowerups( pev );
|
CheckPowerups( pev );
|
||||||
|
|
||||||
UpdatePlayerSound();
|
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
|
// Track button info so we can detect 'pressed' and 'released' buttons next frame
|
||||||
m_afButtonLast = pev->button;
|
m_afButtonLast = pev->button;
|
||||||
|
|
||||||
pt_end:
|
|
||||||
#if defined( CLIENT_WEAPONS )
|
#if defined( CLIENT_WEAPONS )
|
||||||
// Decay timers on weapons
|
// Decay timers on weapons
|
||||||
// go through all of the weapons and make a list of the ones to pack
|
// 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() )
|
if( gun && gun->UseDecrement() )
|
||||||
{
|
{
|
||||||
gun->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
|
gun->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
|
||||||
gun->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
|
gun->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
|
||||||
|
|
||||||
if( gun->m_flTimeWeaponIdle != 1000 )
|
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 )
|
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
|
// Only decrement if not flagged as NO_DECREMENT
|
||||||
/*if( gun->m_flPumpTime != 1000 )
|
/*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
|
else
|
||||||
{
|
{
|
||||||
UTIL_PlayerDecalTrace( &tr, playernum, pev->frame, TRUE );
|
UTIL_PlayerDecalTrace( &tr, playernum, (int)pev->frame, TRUE );
|
||||||
// Just painted last custom frame.
|
// Just painted last custom frame.
|
||||||
if( pev->frame++ >= ( nFrames - 1 ) )
|
if( pev->frame++ >= ( nFrames - 1 ) )
|
||||||
UTIL_Remove( this );
|
UTIL_Remove( this );
|
||||||
|
@ -3550,19 +3645,23 @@ int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem )
|
||||||
return FALSE;
|
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 )
|
if( m_pActiveItem == pItem )
|
||||||
{
|
{
|
||||||
ResetAutoaim();
|
ResetAutoaim();
|
||||||
pItem->Holster();
|
if( bCallHolster )
|
||||||
pItem->pev->nextthink = 0;// crowbar may be trying to swing again, etc.
|
pItem->Holster();
|
||||||
pItem->SetThink( NULL );
|
|
||||||
m_pActiveItem = NULL;
|
m_pActiveItem = NULL;
|
||||||
pev->viewmodel = 0;
|
pev->viewmodel = 0;
|
||||||
pev->weaponmodel = 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;
|
m_pLastItem = NULL;
|
||||||
|
|
||||||
CBasePlayerItem *pPrev = m_rgpPlayerItems[pItem->iItemSlot()];
|
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
|
// 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 )
|
if( !szName )
|
||||||
{
|
{
|
||||||
|
@ -3611,7 +3710,7 @@ int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax )
|
||||||
if( i < 0 || i >= MAX_AMMO_SLOTS )
|
if( i < 0 || i >= MAX_AMMO_SLOTS )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int iAdd = min( iCount, iMax - m_rgAmmo[i] );
|
int iAdd = Q_min( iCount, iMax - m_rgAmmo[i] );
|
||||||
if( iAdd < 1 )
|
if( iAdd < 1 )
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
@ -3664,10 +3763,10 @@ Called every frame by the player PostThink
|
||||||
*/
|
*/
|
||||||
void CBasePlayer::ItemPostFrame()
|
void CBasePlayer::ItemPostFrame()
|
||||||
{
|
{
|
||||||
static int fInSelect = FALSE;
|
//static int fInSelect = FALSE;
|
||||||
|
|
||||||
// check if the player is using a tank
|
// check if the player is using a tank
|
||||||
if( m_pTank != NULL )
|
if( m_pTank != 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined( CLIENT_WEAPONS )
|
#if defined( CLIENT_WEAPONS )
|
||||||
|
@ -3732,7 +3831,7 @@ void CBasePlayer::SendAmmoUpdate( void )
|
||||||
// send "Ammo" update message
|
// send "Ammo" update message
|
||||||
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev );
|
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev );
|
||||||
WRITE_BYTE( i );
|
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();
|
MESSAGE_END();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3767,6 +3866,9 @@ void CBasePlayer::UpdateClientData( void )
|
||||||
|
|
||||||
g_pGameRules->InitHUD( this );
|
g_pGameRules->InitHUD( this );
|
||||||
m_fGameHUDInitialized = TRUE;
|
m_fGameHUDInitialized = TRUE;
|
||||||
|
|
||||||
|
m_iObserverLastMode = OBS_ROAMING;
|
||||||
|
|
||||||
if( g_pGameRules->IsMultiplayer() )
|
if( g_pGameRules->IsMultiplayer() )
|
||||||
{
|
{
|
||||||
FireTargets( "game_playerjoin", this, this, USE_TOGGLE, 0 );
|
FireTargets( "game_playerjoin", this, this, USE_TOGGLE, 0 );
|
||||||
|
@ -3775,6 +3877,12 @@ void CBasePlayer::UpdateClientData( void )
|
||||||
|
|
||||||
FireTargets( "game_playerspawn", this, this, USE_TOGGLE, 0 );
|
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();
|
InitStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3807,19 +3915,22 @@ void CBasePlayer::UpdateClientData( void )
|
||||||
|
|
||||||
if( pev->health != m_iClientHealth )
|
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
|
// send "health" update message
|
||||||
MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, pev );
|
MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, pev );
|
||||||
WRITE_BYTE( iHealth );
|
WRITE_BYTE( iHealth );
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
|
||||||
m_iClientHealth = pev->health;
|
m_iClientHealth = (int)pev->health;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pev->armorvalue != m_iClientBattery )
|
if( pev->armorvalue != m_iClientBattery )
|
||||||
{
|
{
|
||||||
m_iClientBattery = pev->armorvalue;
|
m_iClientBattery = (int)pev->armorvalue;
|
||||||
|
|
||||||
ASSERT( gmsgBattery > 0 );
|
ASSERT( gmsgBattery > 0 );
|
||||||
|
|
||||||
|
@ -3847,8 +3958,8 @@ void CBasePlayer::UpdateClientData( void )
|
||||||
int visibleDamageBits = m_bitsDamageType & DMG_SHOWNHUD;
|
int visibleDamageBits = m_bitsDamageType & DMG_SHOWNHUD;
|
||||||
|
|
||||||
MESSAGE_BEGIN( MSG_ONE, gmsgDamage, NULL, pev );
|
MESSAGE_BEGIN( MSG_ONE, gmsgDamage, NULL, pev );
|
||||||
WRITE_BYTE( pev->dmg_save );
|
WRITE_BYTE( (int)pev->dmg_save );
|
||||||
WRITE_BYTE( pev->dmg_take );
|
WRITE_BYTE( (int)pev->dmg_take );
|
||||||
WRITE_LONG( visibleDamageBits );
|
WRITE_LONG( visibleDamageBits );
|
||||||
WRITE_COORD( damageOrigin.x );
|
WRITE_COORD( damageOrigin.x );
|
||||||
WRITE_COORD( damageOrigin.y );
|
WRITE_COORD( damageOrigin.y );
|
||||||
|
@ -3974,6 +4085,15 @@ void CBasePlayer::UpdateClientData( void )
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
m_flNextSBarUpdateTime = gpGlobals->time + 0.2;
|
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 );
|
SET_CROSSHAIRANGLE( edict(), -m_vecAutoAim.x, m_vecAutoAim.y );
|
||||||
|
|
||||||
m_lastx = m_vecAutoAim.x;
|
m_lastx = (int)m_vecAutoAim.x;
|
||||||
m_lasty = m_vecAutoAim.y;
|
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.
|
// item we want to drop and hit a BREAK; pWeapon is the item.
|
||||||
if( pWeapon )
|
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 );
|
UTIL_MakeVectors( pev->angles );
|
||||||
|
|
||||||
|
@ -4457,10 +4578,10 @@ public:
|
||||||
void KeyValue( KeyValueData *pkvd );
|
void KeyValue( KeyValueData *pkvd );
|
||||||
|
|
||||||
int m_iPose;// which sequence to display -- temporary, don't need to save
|
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",
|
"deadback",
|
||||||
"deadsitting",
|
"deadsitting",
|
||||||
|
@ -4602,7 +4723,7 @@ void CRevertSaved::KeyValue( KeyValueData *pkvd )
|
||||||
|
|
||||||
void CRevertSaved::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
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();
|
pev->nextthink = gpGlobals->time + MessageTime();
|
||||||
SetThink( &CRevertSaved::MessageThink );
|
SetThink( &CRevertSaved::MessageThink );
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,18 @@ enum sbar_data
|
||||||
class CBasePlayer : public CBaseMonster
|
class CBasePlayer : public CBaseMonster
|
||||||
{
|
{
|
||||||
public:
|
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 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
|
int m_iPlayerSound;// the index of the sound list slot reserved for this player
|
||||||
|
@ -243,11 +255,12 @@ public:
|
||||||
|
|
||||||
void StartDeathCam( void );
|
void StartDeathCam( void );
|
||||||
void StartObserver( Vector vecPosition, Vector vecViewAngle );
|
void StartObserver( Vector vecPosition, Vector vecViewAngle );
|
||||||
|
void StopObserver();
|
||||||
|
|
||||||
void AddPoints( int score, BOOL bAllowNegativeScore );
|
void AddPoints( int score, BOOL bAllowNegativeScore );
|
||||||
void AddPointsToTeam( int score, BOOL bAllowNegativeScore );
|
void AddPointsToTeam( int score, BOOL bAllowNegativeScore );
|
||||||
BOOL AddPlayerItem( CBasePlayerItem *pItem );
|
BOOL AddPlayerItem( CBasePlayerItem *pItem );
|
||||||
BOOL RemovePlayerItem( CBasePlayerItem *pItem );
|
BOOL RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHoster );
|
||||||
void DropPlayerItem ( char *pszItemName );
|
void DropPlayerItem ( char *pszItemName );
|
||||||
BOOL HasPlayerItem( CBasePlayerItem *pCheckItem );
|
BOOL HasPlayerItem( CBasePlayerItem *pCheckItem );
|
||||||
BOOL HasNamedPlayerItem( const char *pszItemName );
|
BOOL HasNamedPlayerItem( const char *pszItemName );
|
||||||
|
@ -261,7 +274,7 @@ public:
|
||||||
void GiveNamedItem( const char *szName );
|
void GiveNamedItem( const char *szName );
|
||||||
void EnableControl(BOOL fControl);
|
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 SendAmmoUpdate(void);
|
||||||
|
|
||||||
void WaterMove( void );
|
void WaterMove( void );
|
||||||
|
@ -269,7 +282,7 @@ public:
|
||||||
void PlayerUse( void );
|
void PlayerUse( void );
|
||||||
|
|
||||||
void CheckSuitUpdate();
|
void CheckSuitUpdate();
|
||||||
void SetSuitUpdate(char *name, int fgroup, int iNoRepeat);
|
void SetSuitUpdate( const char *name, int fgroup, int iNoRepeat );
|
||||||
void UpdateGeigerCounter( void );
|
void UpdateGeigerCounter( void );
|
||||||
void CheckTimeBasedDamage( void );
|
void CheckTimeBasedDamage( void );
|
||||||
|
|
||||||
|
@ -293,6 +306,8 @@ public:
|
||||||
|
|
||||||
void TabulateAmmo( void );
|
void TabulateAmmo( void );
|
||||||
|
|
||||||
|
Vector m_vecLastViewAngles;
|
||||||
|
|
||||||
float m_flStartCharge;
|
float m_flStartCharge;
|
||||||
float m_flAmmoStartCharge;
|
float m_flAmmoStartCharge;
|
||||||
float m_flPlayAftershock;
|
float m_flPlayAftershock;
|
||||||
|
@ -301,13 +316,15 @@ public:
|
||||||
//Player ID
|
//Player ID
|
||||||
void InitStatusBar( void );
|
void InitStatusBar( void );
|
||||||
void UpdateStatusBar( void );
|
void UpdateStatusBar( void );
|
||||||
int m_izSBarState[ SBAR_END ];
|
int m_izSBarState[SBAR_END];
|
||||||
float m_flNextSBarUpdateTime;
|
float m_flNextSBarUpdateTime;
|
||||||
float m_flStatusBarDisappearDelay;
|
float m_flStatusBarDisappearDelay;
|
||||||
char m_SbarString0[ SBAR_STRING_SIZE ];
|
char m_SbarString0[SBAR_STRING_SIZE];
|
||||||
char m_SbarString1[ SBAR_STRING_SIZE ];
|
char m_SbarString1[SBAR_STRING_SIZE];
|
||||||
|
|
||||||
float m_flNextChatTime;
|
float m_flNextChatTime;
|
||||||
|
|
||||||
|
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AUTOAIM_2DEGREES 0.0348994967025
|
#define AUTOAIM_2DEGREES 0.0348994967025
|
||||||
|
@ -315,7 +332,7 @@ public:
|
||||||
#define AUTOAIM_8DEGREES 0.1391731009601
|
#define AUTOAIM_8DEGREES 0.1391731009601
|
||||||
#define AUTOAIM_10DEGREES 0.1736481776669
|
#define AUTOAIM_10DEGREES 0.1736481776669
|
||||||
|
|
||||||
extern int gmsgHudText;
|
extern int gmsgHudText;
|
||||||
extern BOOL gInitHUD;
|
extern BOOL gInitHUD;
|
||||||
|
|
||||||
#endif // PLAYER_H
|
#endif // PLAYER_H
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue