Revert some changes from PR

This commit is contained in:
a1batross 2016-08-08 15:01:16 +06:00
commit 008234143e
229 changed files with 29635 additions and 31529 deletions

View File

@ -26,7 +26,7 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_MOTD, MOTD );
DECLARE_MESSAGE( m_MOTD, MOTD )
int CHudMOTD::Init( void )
{
@ -71,7 +71,8 @@ int CHudMOTD :: Draw( float fTime )
int ypos = ( ScreenHeight - LINE_HEIGHT * m_iLines ) / 2; // shift it up slightly
char *ch = m_szMOTD;
int xpos = ( ScreenWidth - gHUD.m_scrinfo.charWidths['M'] * m_iMaxLength ) / 2;
if( xpos < 30 ) xpos = 30;
if( xpos < 30 )
xpos = 30;
int xmax = xpos + gHUD.m_scrinfo.charWidths['M'] * m_iMaxLength;
int height = LINE_HEIGHT * m_iLines;
int ypos_r=ypos;
@ -138,7 +139,6 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
m_iMaxLength = 0;
m_iFlags |= HUD_ACTIVE;
for( char *sz = m_szMOTD; *sz != 0; sz++ ) // count the number of lines in the MOTD
{
if( *sz == '\n' )

View File

@ -344,8 +344,10 @@ void CStudioModelRenderer::StudioSlerpBones( vec4_t q1[], float pos1[][3], vec4_
vec4_t q3;
float s1;
if (s < 0) s = 0;
else if (s > 1.0) s = 1.0;
if( s < 0 )
s = 0;
else if( s > 1.0 )
s = 1.0;
s1 = 1.0 - s;
@ -488,7 +490,6 @@ void CStudioModelRenderer::StudioSetUpTransform (int trivial_accept)
// NOTE: Because multiplayer lag can be relatively large, we don't want to cap
// f at 1.5 anymore.
//if( f > -1.0 && f < 1.5 ) {}
//Con_DPrintf( "%.0f %.0f\n",m_pCurrentEntity->msg_angles[0][YAW], m_pCurrentEntity->msg_angles[1][YAW] );
for( i = 0; i < 3; i++ )
{
@ -546,12 +547,9 @@ void CStudioModelRenderer::StudioSetUpTransform (int trivial_accept)
{
for( i = 0; i < 4; i++ )
{
(*m_paliastransform)[0][i] *= m_fSoftwareXScale *
(1.0 / (ZISCALE * 0x10000));
(*m_paliastransform)[1][i] *= m_fSoftwareYScale *
(1.0 / (ZISCALE * 0x10000));
(*m_paliastransform)[0][i] *= m_fSoftwareXScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
(*m_paliastransform)[1][i] *= m_fSoftwareYScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
(*m_paliastransform)[2][i] *= 1.0 / ( ZISCALE * 0x10000 );
}
}
}
@ -561,7 +559,6 @@ void CStudioModelRenderer::StudioSetUpTransform (int trivial_accept)
(*m_protationmatrix)[2][3] = modelpos[2];
}
/*
====================
StudioEstimateInterpolant
@ -619,7 +616,6 @@ void CStudioModelRenderer::StudioCalcRotations ( float pos[][3], vec4_t *q, mstu
// Con_DPrintf( "frame %d %d\n", frame1, frame2 );
dadt = StudioEstimateInterpolant();
s = ( f - frame );
@ -707,7 +703,6 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
transform[2][1] *= scale;
}
break;
}
}
@ -730,7 +725,6 @@ float CStudioModelRenderer::StudioEstimateFrame( mstudioseqdesc_t *pseqdesc )
else
{
dfdt = ( m_clTime - m_pCurrentEntity->curstate.animtime ) * m_pCurrentEntity->curstate.framerate * pseqdesc->fps;
}
}
else
@ -846,8 +840,7 @@ void CStudioModelRenderer::StudioSetupBones ( void )
}
}
if (m_fDoInterp &&
m_pCurrentEntity->latched.sequencetime &&
if( m_fDoInterp && m_pCurrentEntity->latched.sequencetime &&
( m_pCurrentEntity->latched.sequencetime + 0.2 > m_clTime ) &&
( m_pCurrentEntity->latched.prevsequence < m_pStudioHeader->numseq ) )
{
@ -961,7 +954,6 @@ void CStudioModelRenderer::StudioSetupBones ( void )
}
}
/*
====================
StudioSaveBones
@ -985,7 +977,6 @@ void CStudioModelRenderer::StudioSaveBones( void )
}
}
/*
====================
StudioMergeBones
@ -1025,7 +1016,6 @@ void CStudioModelRenderer::StudioMergeBones ( model_t *m_pSubModel )
pbones = (mstudiobone_t *)( (byte *)m_pStudioHeader + m_pStudioHeader->boneindex );
for( i = 0; i < m_pStudioHeader->numbones; i++ )
{
for( j = 0; j < m_nCachedBones; j++ )
@ -1255,7 +1245,6 @@ void CStudioModelRenderer::StudioEstimateGait( entity_state_t *pplayer )
if( m_pPlayerInfo->gaityaw < -180 )
m_pPlayerInfo->gaityaw = -180;
}
}
/*
@ -1700,4 +1689,3 @@ void CStudioModelRenderer::StudioRenderFinal(void)
StudioRenderFinal_Software();
}
}

View File

@ -68,7 +68,6 @@ int WeaponsResource :: HasAmmo( WEAPON *p )
|| CountAmmo( p->iAmmo2Type ) || ( p->iFlags & WEAPON_FLAGS_SELECTONEMPTY );
}
void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
{
int i, iRes;
@ -191,7 +190,6 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
}
else
pWeapon->hAmmo2 = 0;
}
// Returns the first weapon for a given slot.
@ -211,7 +209,6 @@ WEAPON *WeaponsResource :: GetFirstPos( int iSlot )
return pret;
}
WEAPON* WeaponsResource::GetNextActivePos( int iSlot, int iSlotPos )
{
if ( iSlotPos >= MAX_WEAPON_POSITIONS || iSlot >= MAX_WEAPON_SLOTS )
@ -225,32 +222,31 @@ WEAPON* WeaponsResource :: GetNextActivePos( int iSlot, int iSlotPos )
return p;
}
int giBucketHeight, giBucketWidth, giABHeight, giABWidth; // Ammo Bar width and height
HSPRITE ghsprBuckets; // Sprite for top row of weapons menu
DECLARE_MESSAGE(m_Ammo, CurWeapon ); // Current weapon and clip
DECLARE_MESSAGE(m_Ammo, WeaponList); // new weapon type
DECLARE_MESSAGE(m_Ammo, AmmoX); // update known ammo type's count
DECLARE_MESSAGE(m_Ammo, AmmoPickup); // flashes an ammo pickup record
DECLARE_MESSAGE(m_Ammo, WeapPickup); // flashes a weapon pickup record
DECLARE_MESSAGE(m_Ammo, HideWeapon); // hides the weapon, ammo, and crosshair displays temporarily
DECLARE_MESSAGE(m_Ammo, ItemPickup);
DECLARE_MESSAGE( m_Ammo, CurWeapon ) // Current weapon and clip
DECLARE_MESSAGE( m_Ammo, WeaponList ) // new weapon type
DECLARE_MESSAGE( m_Ammo, AmmoX ) // update known ammo type's count
DECLARE_MESSAGE( m_Ammo, AmmoPickup ) // flashes an ammo pickup record
DECLARE_MESSAGE( m_Ammo, WeapPickup ) // flashes a weapon pickup record
DECLARE_MESSAGE( m_Ammo, HideWeapon ) // hides the weapon, ammo, and crosshair displays temporarily
DECLARE_MESSAGE( m_Ammo, ItemPickup )
DECLARE_COMMAND(m_Ammo, Slot1);
DECLARE_COMMAND(m_Ammo, Slot2);
DECLARE_COMMAND(m_Ammo, Slot3);
DECLARE_COMMAND(m_Ammo, Slot4);
DECLARE_COMMAND(m_Ammo, Slot5);
DECLARE_COMMAND(m_Ammo, Slot6);
DECLARE_COMMAND(m_Ammo, Slot7);
DECLARE_COMMAND(m_Ammo, Slot8);
DECLARE_COMMAND(m_Ammo, Slot9);
DECLARE_COMMAND(m_Ammo, Slot10);
DECLARE_COMMAND(m_Ammo, Close);
DECLARE_COMMAND(m_Ammo, NextWeapon);
DECLARE_COMMAND(m_Ammo, PrevWeapon);
DECLARE_COMMAND( m_Ammo, Slot1 )
DECLARE_COMMAND( m_Ammo, Slot2 )
DECLARE_COMMAND( m_Ammo, Slot3 )
DECLARE_COMMAND( m_Ammo, Slot4 )
DECLARE_COMMAND( m_Ammo, Slot5 )
DECLARE_COMMAND( m_Ammo, Slot6 )
DECLARE_COMMAND( m_Ammo, Slot7 )
DECLARE_COMMAND( m_Ammo, Slot8 )
DECLARE_COMMAND( m_Ammo, Slot9 )
DECLARE_COMMAND( m_Ammo, Slot10 )
DECLARE_COMMAND( m_Ammo, Close )
DECLARE_COMMAND( m_Ammo, NextWeapon )
DECLARE_COMMAND( m_Ammo, PrevWeapon )
// width of ammo fonts
#define AMMO_SMALL_WIDTH 10
@ -295,7 +291,7 @@ int CHudAmmo::Init(void)
gHR.Init();
return 1;
};
}
void CHudAmmo::Reset( void )
{
@ -309,7 +305,6 @@ void CHudAmmo::Reset(void)
gHR.Reset();
//VidInit();
}
int CHudAmmo::VidInit( void )
@ -392,7 +387,6 @@ void CHudAmmo::Think(void)
//
// Helper function to return a Ammo pointer from id
//
HSPRITE* WeaponsResource::GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect )
{
for( int i = 0; i < MAX_WEAPONS; i++ )
@ -412,13 +406,12 @@ HSPRITE* WeaponsResource :: GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect )
return NULL;
}
// Menu Selection Code
void WeaponsResource::SelectSlot( int iSlot, int fAdvance, int iDirection )
{
if( gHUD.m_Menu.m_fMenuDisplayed && ( fAdvance == FALSE ) && ( iDirection == 1 ) )
{ // menu is overriding slot use commands
{
// menu is overriding slot use commands
gHUD.m_Menu.SelectMenuItem( iSlot + 1 ); // slots are one off the key numbers
return;
}
@ -449,7 +442,8 @@ void WeaponsResource :: SelectSlot( int iSlot, int fAdvance, int iDirection )
// but only if there is only one item in the bucket
WEAPON *p2 = GetNextActivePos( p->iSlot, p->iSlotPos );
if ( !p2 )
{ // only one active item in bucket, so change directly to weapon
{
// only one active item in bucket, so change directly to weapon
ServerCmd( p->szName );
g_weaponselect = p->iId;
return;
@ -531,7 +525,6 @@ int CHudAmmo::MsgFunc_ItemPickup( const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -606,21 +599,22 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
else
pWeapon->iClip = iClip;
if( iState == 0 ) // we're not the current weapon, so update no more
return 1;
m_pWeapon = pWeapon;
if( gHUD.m_iFOV >= 90 )
{ // normal crosshairs
{
// 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
{ // zoomed crosshairs
{
// zoomed crosshairs
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 );
else
@ -664,7 +658,6 @@ int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf )
gWR.AddWeapon( &Weapon );
return 1;
}
//------------------------------------------------------------------------
@ -825,12 +818,9 @@ void CHudAmmo::UserCmd_PrevWeapon(void)
gpActiveSel = NULL;
}
//-------------------------------------------------------------------------
// Drawing code
//-------------------------------------------------------------------------
int CHudAmmo::Draw( float flTime )
{
int a, x, y, r, g, b;
@ -860,7 +850,6 @@ int CHudAmmo::Draw(float flTime)
if( ( pw->iAmmoType < 0 ) && ( pw->iAmmo2Type < 0 ) )
return 0;
int iFlags = DHN_DRAWZERO; // draw 0 values
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
@ -885,7 +874,6 @@ int CHudAmmo::Draw(float flTime)
if( pw->iClip >= 0 )
{
// room for the number and the '|' and the current ammo
x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth;
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b );
@ -904,13 +892,11 @@ int CHudAmmo::Draw(float flTime)
// draw the | bar
FillRGBA( x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a );
x += iBarWidth + AmmoWidth/2;;
x += iBarWidth + AmmoWidth / 2;
// GL Seems to need this
ScaleColors( r, g, b, a );
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo( pw->iAmmoType ), r, g, b );
}
else
{
@ -946,7 +932,6 @@ int CHudAmmo::Draw(float flTime)
return 1;
}
//
// Draws the ammo bar on the hud
//
@ -979,8 +964,6 @@ int DrawBar(int x, int y, int width, int height, float f)
return ( x + width );
}
void DrawAmmoBar( WEAPON *p, int x, int y, int width, int height )
{
if( !p )
@ -995,9 +978,7 @@ void DrawAmmoBar(WEAPON *p, int x, int y, int width, int height)
x = DrawBar( x, y, width, height, f );
// Do we have secondary ammo too?
if( p->iAmmo2Type != -1 )
{
f = (float)gWR.CountAmmo( p->iAmmo2Type ) / (float)p->iMax2;
@ -1009,9 +990,6 @@ void DrawAmmoBar(WEAPON *p, int x, int y, int width, int height)
}
}
//
// Draw Weapon Menu
//
@ -1032,7 +1010,6 @@ int CHudAmmo::DrawWList(float flTime)
x = 10; //!!!
y = 10; //!!!
// Ensure that there are available choices in the active slot
if( iActiveSlot > 0 )
{
@ -1075,7 +1052,6 @@ int CHudAmmo::DrawWList(float flTime)
x += iWidth + 5;
}
a = 128; //!!!
x = 10;
@ -1103,7 +1079,6 @@ int CHudAmmo::DrawWList(float flTime)
UnpackRGB( r, g, b, RGB_YELLOWISH );
// if active, then we must have ammo.
if( gpActiveSel == p )
{
SPR_Set( p->hActive, r, g, b );
@ -1115,7 +1090,6 @@ int CHudAmmo::DrawWList(float flTime)
else
{
// Draw Weapon if Red if no ammo
if( gWR.HasAmmo( p ) )
ScaleColors( r, g, b, 192 );
else
@ -1129,19 +1103,16 @@ int CHudAmmo::DrawWList(float flTime)
}
// Draw Ammo Bar
DrawAmmoBar( p, x + giABWidth / 2, y, giABWidth, giABHeight );
y += p->rcActive.bottom - p->rcActive.top + 5;
}
x += iWidth + 5;
}
else
{
// Draw Row of weapons.
UnpackRGB( r, g, b, RGB_YELLOWISH );
for( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ )
@ -1172,10 +1143,8 @@ int CHudAmmo::DrawWList(float flTime)
}
return 1;
}
/* =================================
GetSpriteList

View File

@ -18,7 +18,6 @@
#define MAX_WEAPON_NAME 128
#define WEAPON_FLAGS_SELECTONEMPTY 1
#define WEAPON_IS_ONTARGET 0x40
@ -57,6 +56,4 @@ struct WEAPON
};
typedef int AMMO;
#endif

View File

@ -24,8 +24,8 @@
#include <stdio.h>
#include "parsemsg.h"
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoVal );
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoIcon );
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoVal )
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoIcon )
int CHudAmmoSecondary::Init( void )
{
@ -81,7 +81,8 @@ int CHudAmmoSecondary :: Draw(float flTime)
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_ammoicon ) );
}
else
{ // move the cursor by the '0' char instead, since we don't have an icon to work with
{
// move the cursor by the '0' char instead, since we don't have an icon to work with
x -= AmmoWidth;
y -= ( gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).top - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).bottom );
}
@ -145,7 +146,8 @@ int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, voi
}
if( count == 0 )
{ // the ammo fields are all empty, so turn off this hud area
{
// the ammo fields are all empty, so turn off this hud area
m_iFlags &= ~HUD_ACTIVE;
return 1;
}
@ -155,5 +157,3 @@ int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, voi
return 1;
}

View File

@ -49,7 +49,8 @@ void HistoryResource :: AddToHistory( int iType, int iId, int iCount )
return; // no amount, so don't add
if( ( ( ( AMMO_PICKUP_GAP * iCurrentHistorySlot ) + AMMO_PICKUP_PICK_HEIGHT ) > AMMO_PICKUP_HEIGHT_MAX ) || ( iCurrentHistorySlot >= MAX_HISTORY ) )
{ // the pic would have to be drawn too high
{
// the pic would have to be drawn too high
// so start from the bottom
iCurrentHistorySlot = 0;
}
@ -69,7 +70,8 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
return;
if( ( ( ( AMMO_PICKUP_GAP * iCurrentHistorySlot ) + AMMO_PICKUP_PICK_HEIGHT ) > AMMO_PICKUP_HEIGHT_MAX ) || ( iCurrentHistorySlot >= MAX_HISTORY ) )
{ // the pic would have to be drawn too high
{
// the pic would have to be drawn too high
// so start from the bottom
iCurrentHistorySlot = 0;
}
@ -77,7 +79,6 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot
// I am really unhappy with all the code in this file
int i = gHUD.GetSpriteIndex( szName );
if( i == -1 )
return; // unknown sprite name, don't add it to history
@ -90,7 +91,6 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;
}
void HistoryResource::CheckClearHistory( void )
{
for( int i = 0; i < MAX_HISTORY; i++ )
@ -114,7 +114,8 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
if( rgAmmoHistory[i].DisplayTime <= flTime )
{ // pic drawing time has expired
{
// pic drawing time has expired
memset( &rgAmmoHistory[i], 0, sizeof(HIST_ITEM) );
CheckClearHistory();
}
@ -132,7 +133,8 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - 24;
if( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic
{ // the dll has to make sure it has sent info the weapons you need
{
// the dll has to make sure it has sent info the weapons you need
SPR_Set( *spr, r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &rcPic );
}
@ -185,8 +187,5 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
}
}
return 1;
}

View File

@ -94,13 +94,12 @@ public:
extern WeaponsResource gWR;
#define MAX_HISTORY 12
enum {
HISTSLOT_EMPTY,
HISTSLOT_AMMO,
HISTSLOT_WEAP,
HISTSLOT_ITEM,
HISTSLOT_ITEM
};
class HistoryResource
@ -138,6 +137,3 @@ public:
};
extern HistoryResource gHR;

View File

@ -38,8 +38,7 @@ int CHudBattery::Init(void)
gHUD.AddHudElem( this );
return 1;
};
}
int CHudBattery::VidInit( void )
{
@ -52,13 +51,12 @@ int CHudBattery::VidInit(void)
m_iHeight = m_prc2->bottom - m_prc1->top;
m_fFade = 0;
return 1;
};
}
int CHudBattery::MsgFunc_Battery( const char *pszName, int iSize, void *pbuf )
{
m_iFlags |= HUD_ACTIVE;
BEGIN_READ( pbuf, iSize );
int x = READ_SHORT();
@ -71,7 +69,6 @@ int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudBattery::Draw( float flTime )
{
if( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
@ -102,9 +99,7 @@ int CHudBattery::Draw(float flTime)
}
// Fade the health number back to dim
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
}
else
a = MIN_ALPHA;

View File

@ -20,5 +20,4 @@ void CAM_Init( void );
void CAM_ClearStates( void );
void CAM_StartMouseMove( void );
void CAM_EndMouseMove( void );
#endif // _CAMERA_H_

View File

@ -198,7 +198,6 @@ void DLLEXPORT HUD_Init( void )
gHUD.Init();
}
/*
==========================
HUD_Redraw
@ -215,7 +214,6 @@ int DLLEXPORT HUD_Redraw( float time, int intermission )
return 1;
}
/*
==========================
HUD_UpdateClientData
@ -258,11 +256,9 @@ Called by engine every frame that client .dll is loaded
*/
void DLLEXPORT HUD_Frame( double time )
{
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
{ gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
}
/*
==========================
HUD_VoiceStatus

View File

@ -15,6 +15,7 @@
//
// cl_util.h
//
#include "exportdef.h"
#include "cvardef.h"
@ -32,14 +33,12 @@
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
}
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
{ \
gHUD.y.UserCmd_##x( ); \
}
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) { return gEngfuncs.pfnRegisterVariable( (char*)cv, (char*)val, flags ); }
@ -63,7 +62,6 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl
//
#define FillRGBA ( *gEngfuncs.pfnFillRGBA )
// ScreenHeight returns the height of the screen, in pixels
#define ScreenHeight ( gHUD.m_scrinfo.iHeight )
// ScreenWidth returns the width of the screen, in pixels
@ -91,6 +89,7 @@ inline void DrawSetTextColor(float r, float g, float b)
else
gEngfuncs.pfnDrawSetTextColor( r, g, b );
}
// Gets the height & width of a sprite, at the specified frame
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); }

View File

@ -151,7 +151,6 @@ void HUD_SetMaxSpeed( const edict_t *ed, float speed )
{
}
/*
=====================
UTIL_WeaponTimeBase
@ -236,7 +235,6 @@ UTIL_SharedRandomFloat
*/
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
{
//
unsigned int range;
U_Srand( (int)seed + *(int *)&low + *(int *)&high );
@ -270,8 +268,26 @@ stub functions for such things as precaching. So we don't have to modify weapon
is compiled into both game and client .dlls.
======================
*/
int stub_PrecacheModel ( char* s ) { return 0; }
int stub_PrecacheSound ( char* s ) { return 0; }
unsigned short stub_PrecacheEvent ( int type, const char *s ) { return 0; }
const char *stub_NameForFunction ( unsigned long function ) { return "func"; }
void stub_SetModel ( edict_t *e, const char *m ) {}
int stub_PrecacheModel( char* s )
{
return 0;
}
int stub_PrecacheSound( char* s )
{
return 0;
}
unsigned short stub_PrecacheEvent( int type, const char *s )
{
return 0;
}
const char *stub_NameForFunction( unsigned long function )
{
return "func";
}
void stub_SetModel( edict_t *e, const char *m )
{
}

View File

@ -37,12 +37,10 @@ unsigned short stub_PrecacheEvent( int type, const char *s );
const char *stub_NameForFunction( unsigned long function );
void stub_SetModel( struct edict_s *e, const char *m );
extern cvar_t *cl_lw;
extern int g_runfuncs;
extern vec3_t v_angles;
extern float g_lastFOV;
extern struct local_state_s *g_finalstate;
#endif

View File

@ -15,6 +15,7 @@
//
// death notice
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
@ -22,7 +23,7 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_DeathNotice, DeathMsg );
DECLARE_MESSAGE( m_DeathNotice, DeathMsg )
struct DeathNoticeItem {
char szKiller[MAX_PLAYER_NAME_LENGTH * 2];
@ -58,7 +59,6 @@ float *GetClientColor( int clientIndex )
case 3: return g_ColorYellow;
case 4: return g_ColorGreen;
case 0: return g_ColorYellow;
default: return g_ColorGrey;
}
@ -76,13 +76,11 @@ int CHudDeathNotice :: Init( void )
return 1;
}
void CHudDeathNotice::InitHUDData( void )
{
memset( rgDeathNoticeList, 0, sizeof(rgDeathNoticeList) );
}
int CHudDeathNotice::VidInit( void )
{
m_HUD_d_skull = gHUD.GetSpriteIndex( "d_skull" );
@ -100,7 +98,8 @@ int CHudDeathNotice :: Draw( float flTime )
break; // we've gone through them all
if( rgDeathNoticeList[i].flDisplayTime < flTime )
{ // display time has expired
{
// display time has expired
// remove the current item from the list
memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i + 1], sizeof(DeathNoticeItem) * ( MAX_DEATHNOTICES - i ) );
i--; // continue on the next item; stop the counter getting incremented
@ -167,8 +166,7 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
char killedwith[32];
strcpy( killedwith, "d_" );
strncat( killedwith, READ_STRING(), 32 );
strncat( killedwith, READ_STRING(), sizeof(killedwith) - strlen(killedwith) - 1 );
gHUD.m_Spectator.DeathMessage( victim );
@ -178,7 +176,8 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
break;
}
if( i == MAX_DEATHNOTICES )
{ // move the rest of the list forward to make room for this item
{
// move the rest of the list forward to make room for this item
memmove( rgDeathNoticeList, rgDeathNoticeList + 1, sizeof(DeathNoticeItem) * MAX_DEATHNOTICES );
i = MAX_DEATHNOTICES - 1;
}
@ -187,7 +186,6 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
// gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
// Get the Killer's name
char *killer_name = g_PlayerInfoList[killer].name;
if( !killer_name )
@ -298,7 +296,3 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
return 1;
}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "hud.h"
#include "cl_util.h"
#include "demo.h"

View File

@ -23,5 +23,4 @@ extern int g_demosniperdamage;
extern float g_demosniperorg[3];
extern float g_demosniperangles[3];
extern float g_demozoom;
#endif

View File

@ -20,7 +20,6 @@
#include "pmtrace.h"
#include "pm_shared.h"
void Game_AddObjects( void );
extern vec3_t v_origin;
@ -69,7 +68,6 @@ int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *mode
if( ( g_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) &&
ent->index == g_iUser2 )
return 0; // don't draw the player we are following in eye
}
return 1;
@ -211,7 +209,6 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct
pcd->iuser1 = g_iUser1; // observer mode
pcd->iuser2 = g_iUser2; // first target
pcd->iuser3 = g_iUser3; // second target
}
// Fire prevention
@ -269,9 +266,7 @@ void MoveModel( void )
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &mymodel[i * 3 + j] );
}
}
}
#endif
//#define TRACE_TEST
@ -302,7 +297,6 @@ void TraceModel( void )
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &hit );
}
#endif
*/
@ -348,7 +342,7 @@ void Particles( void )
for( j = 0; j < 3; j++ )
{
p->org[ j ] = v_origin[ j ] + gEngfuncs.pfnRandomFloat( -32.0, 32.0 );;
p->org[j] = v_origin[j] + gEngfuncs.pfnRandomFloat( -32.0, 32.0 );
p->vel[j] = gEngfuncs.pfnRandomFloat( -100.0, 100.0 );
}
@ -519,7 +513,6 @@ void DLLEXPORT HUD_CreateEntities( void )
#if defined( TEST_IT )
MoveModel();
#endif
#if defined( TRACE_TEST )
TraceModel();
#endif
@ -530,11 +523,9 @@ void DLLEXPORT HUD_CreateEntities( void )
/*
TempEnts();
*/
#if defined( BEAM_TEST )
Beams();
#endif
// Add in any game specific objects
Game_AddObjects();
}
@ -654,7 +645,6 @@ void DLLEXPORT HUD_TempEntUpdate (
pTemp->entity.curstate.renderamt = pTemp->entity.baseline.renderamt * ( 1 + life * pTemp->fadeSpeed );
if( pTemp->entity.curstate.renderamt <= 0 )
active = 0;
}
else
active = 0;
@ -727,7 +717,6 @@ void DLLEXPORT HUD_TempEntUpdate (
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (int)(size_t)pTemp );
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
}
else
{
for( i = 0; i < 3; i++ )
@ -775,7 +764,7 @@ void DLLEXPORT HUD_TempEntUpdate (
if( pTemp->flags & ( FTENT_COLLIDEALL | FTENT_COLLIDEWORLD ) )
{
vec3_t traceNormal;
vec3_t traceNormal( 0.0f, 0.0f, 0.0f );
float traceFraction = 1;
if( pTemp->flags & FTENT_COLLIDEALL )
@ -787,7 +776,6 @@ void DLLEXPORT HUD_TempEntUpdate (
gEngfuncs.pEventAPI->EV_PlayerTrace( pTemp->entity.prevstate.origin, pTemp->entity.origin, PM_STUDIO_BOX, -1, &pmtrace );
if( pmtrace.fraction != 1 )
{
pe = gEngfuncs.pEventAPI->EV_GetPhysent( pmtrace.ent );
@ -892,7 +880,6 @@ void DLLEXPORT HUD_TempEntUpdate (
}
}
if( ( pTemp->flags & FTENT_FLICKER ) && gTempEntFrame == pTemp->entity.curstate.effects )
{
dlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight(0);
@ -937,7 +924,6 @@ void DLLEXPORT HUD_TempEntUpdate (
}
pTemp = pnext;
}
finish:
// Restore state info
gEngfuncs.pEventAPI->EV_PopPMStates();
@ -971,4 +957,3 @@ cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index )
return NULL;
#endif
}

View File

@ -13,6 +13,7 @@
*
****/
// shared event functions
#include "hud.h"
#include "cl_util.h"
#include "const.h"

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "hud.h"
#include "cl_util.h"
#include "const.h"
@ -48,7 +49,6 @@ extern cvar_t *cl_lw;
extern "C"
{
// HLDM
void EV_FireGlock1( struct event_args_s *args );
void EV_FireGlock2( struct event_args_s *args );
@ -69,7 +69,6 @@ void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args );
}
@ -107,7 +106,6 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
// FIXME check if playtexture sounds movevar is set
//
chTextureType = 0;
// Player
@ -149,47 +147,63 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
switch (chTextureType)
{
default:
case CHAR_TEX_CONCRETE: fvol = 0.9; fvolbar = 0.6;
case CHAR_TEX_CONCRETE:
fvol = 0.9;
fvolbar = 0.6;
rgsz[0] = "player/pl_step1.wav";
rgsz[1] = "player/pl_step2.wav";
cnt = 2;
break;
case CHAR_TEX_METAL: fvol = 0.9; fvolbar = 0.3;
case CHAR_TEX_METAL:
fvol = 0.9;
fvolbar = 0.3;
rgsz[0] = "player/pl_metal1.wav";
rgsz[1] = "player/pl_metal2.wav";
cnt = 2;
break;
case CHAR_TEX_DIRT: fvol = 0.9; fvolbar = 0.1;
case CHAR_TEX_DIRT:
fvol = 0.9;
fvolbar = 0.1;
rgsz[0] = "player/pl_dirt1.wav";
rgsz[1] = "player/pl_dirt2.wav";
rgsz[2] = "player/pl_dirt3.wav";
cnt = 3;
break;
case CHAR_TEX_VENT: fvol = 0.5; fvolbar = 0.3;
case CHAR_TEX_VENT:
fvol = 0.5;
fvolbar = 0.3;
rgsz[0] = "player/pl_duct1.wav";
rgsz[1] = "player/pl_duct1.wav";
cnt = 2;
break;
case CHAR_TEX_GRATE: fvol = 0.9; fvolbar = 0.5;
case CHAR_TEX_GRATE:
fvol = 0.9;
fvolbar = 0.5;
rgsz[0] = "player/pl_grate1.wav";
rgsz[1] = "player/pl_grate4.wav";
cnt = 2;
break;
case CHAR_TEX_TILE: fvol = 0.8; fvolbar = 0.2;
case CHAR_TEX_TILE:
fvol = 0.8;
fvolbar = 0.2;
rgsz[0] = "player/pl_tile1.wav";
rgsz[1] = "player/pl_tile3.wav";
rgsz[2] = "player/pl_tile2.wav";
rgsz[3] = "player/pl_tile4.wav";
cnt = 4;
break;
case CHAR_TEX_SLOSH: fvol = 0.9; fvolbar = 0.0;
case CHAR_TEX_SLOSH:
fvol = 0.9;
fvolbar = 0.0;
rgsz[0] = "player/pl_slosh1.wav";
rgsz[1] = "player/pl_slosh3.wav";
rgsz[2] = "player/pl_slosh2.wav";
rgsz[3] = "player/pl_slosh4.wav";
cnt = 4;
break;
case CHAR_TEX_WOOD: fvol = 0.9; fvolbar = 0.2;
case CHAR_TEX_WOOD:
fvol = 0.9;
fvolbar = 0.2;
rgsz[0] = "debris/wood1.wav";
rgsz[1] = "debris/wood2.wav";
rgsz[2] = "debris/wood3.wav";
@ -197,7 +211,8 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
break;
case CHAR_TEX_GLASS:
case CHAR_TEX_COMPUTER:
fvol = 0.8; fvolbar = 0.2;
fvol = 0.8;
fvolbar = 0.2;
rgsz[0] = "debris/glass1.wav";
rgsz[1] = "debris/glass2.wav";
rgsz[2] = "debris/glass3.wav";
@ -206,7 +221,8 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
case CHAR_TEX_FLESH:
if( iBulletType == BULLET_PLAYER_CROWBAR )
return 0.0; // crowbar already makes this sound
fvol = 1.0; fvolbar = 0.2;
fvol = 1.0;
fvolbar = 0.2;
rgsz[0] = "weapons/bullet_hit1.wav";
rgsz[1] = "weapons/bullet_hit2.wav";
fattn = 1.0;
@ -253,11 +269,21 @@ void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName )
{
switch( iRand % 5 )
{
case 0: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 1: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 2: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 3: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 4: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 2:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 3:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
case 4:
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
break;
}
}
@ -342,7 +368,6 @@ int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, flo
return tracer;
}
/*
================
FireBullets
@ -360,8 +385,8 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
for( iShot = 1; iShot <= cShots; iShot++ )
{
vec3_t vecDir, vecEnd;
float x, y, z;
//We randomize for the Shotgun.
if( iBulletType == BULLET_PLAYER_BUCKSHOT )
{
@ -379,7 +404,6 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
}//But other guns already have their spread randomized in the synched spread.
else
{
for( i = 0 ; i < 3; i++ )
{
vecDir[i] = vecDirShooting[i] + flSpreadX * right[i] + flSpreadY * up [i];
@ -407,13 +431,10 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
{
default:
case BULLET_PLAYER_9MM:
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
EV_HLDM_DecalGunshot( &tr, iBulletType );
break;
case BULLET_PLAYER_MP5:
if( !tracer )
{
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
@ -421,17 +442,12 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
}
break;
case BULLET_PLAYER_BUCKSHOT:
EV_HLDM_DecalGunshot( &tr, iBulletType );
break;
case BULLET_PLAYER_357:
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
EV_HLDM_DecalGunshot( &tr, iBulletType );
break;
}
}
@ -530,7 +546,6 @@ void EV_FireGlock2( event_args_t *args )
VectorCopy( forward, vecAiming );
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
//======================
// GLOCK END
@ -890,7 +905,6 @@ void EV_FireGauss( event_args_t *args )
if( m_fPrimaryFire == false )
g_flApplyVel = flDamage;
}
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/gauss2.wav", 0.5 + flDamage * ( 1.0 / 400.0 ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
@ -1000,7 +1014,6 @@ void EV_FireGauss( event_args_t *args )
}
flDamage = flDamage * ( 1 - n );
}
else
{
@ -1035,10 +1048,8 @@ void EV_FireGauss( event_args_t *args )
if( !beam_tr.allsolid )
{
vec3_t delta;
float n;
// trace backwards to find exit point
gEngfuncs.pEventAPI->EV_PlayerTrace( beam_tr.endpos, tr.endpos, PM_STUDIO_BOX, -1, &beam_tr );
VectorSubtract( beam_tr.endpos, tr.endpos, delta );
@ -1091,7 +1102,6 @@ void EV_FireGauss( event_args_t *args )
// slug doesn't punch through ever with primary
// fire, so leave a little glowy bit and make some balls
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0 / 255.0, 0.3, FTENT_FADEOUT );
{
vec3_t fwd;
VectorAdd( tr.endpos, tr.plane.normal, fwd );
@ -1117,8 +1127,8 @@ void EV_FireGauss( event_args_t *args )
//======================
// CROWBAR START
//======================
enum crowbar_e {
enum crowbar_e
{
CROWBAR_IDLE = 0,
CROWBAR_DRAW,
CROWBAR_HOLSTER,
@ -1154,11 +1164,14 @@ void EV_Crowbar( event_args_t *args )
switch( (g_iSwing++) % 3 )
{
case 0:
gEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK1MISS, 1 ); break;
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 );
break;
case 1:
gEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK2MISS, 1 ); break;
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK2MISS, 1 );
break;
case 2:
gEngfuncs.pEventAPI->EV_WeaponAnimation ( CROWBAR_ATTACK3MISS, 1 ); break;
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK3MISS, 1 );
break;
}
}
}
@ -1169,7 +1182,8 @@ void EV_Crowbar( event_args_t *args )
//======================
// CROSSBOW START
//======================
enum crossbow_e {
enum crossbow_e
{
CROSSBOW_IDLE1 = 0, // full
CROSSBOW_IDLE2, // empty
CROSSBOW_FIDGET1, // full
@ -1181,7 +1195,7 @@ enum crossbow_e {
CROSSBOW_DRAW1, // full
CROSSBOW_DRAW2, // empty
CROSSBOW_HOLSTER1, // full
CROSSBOW_HOLSTER2, // empty
CROSSBOW_HOLSTER2 // empty
};
//=====================
@ -1248,9 +1262,11 @@ void EV_FireCrossbow2( event_args_t *args )
switch( gEngfuncs.pfnRandomLong( 0, 1 ) )
{
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM, 0, PITCH_NORM ); break;
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM, 0, PITCH_NORM );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM, 0, PITCH_NORM ); break;
gEngfuncs.pEventAPI->EV_PlaySound( idx, tr.endpos, CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM, 0, PITCH_NORM );
break;
}
}
//Stick to world but don't stick to glass, it might break and leave the bolt floating. It can still stick to other non-transparent breakables though.
@ -1312,7 +1328,8 @@ void EV_FireCrossbow( event_args_t *args )
//======================
// RPG START
//======================
enum rpg_e {
enum rpg_e
{
RPG_IDLE = 0,
RPG_FIDGET,
RPG_RELOAD, // to reload
@ -1322,7 +1339,7 @@ enum rpg_e {
RPG_HOLSTER2, // unloaded
RPG_DRAW_UL, // unloaded
RPG_IDLE_UL, // unloaded idle
RPG_FIDGET_UL, // unloaded fidget
RPG_FIDGET_UL // unloaded fidget
};
void EV_FireRpg( event_args_t *args )
@ -1351,7 +1368,8 @@ void EV_FireRpg( event_args_t *args )
//======================
// EGON END
//======================
enum egon_e {
enum egon_e
{
EGON_IDLE1 = 0,
EGON_FIDGET1,
EGON_ALTFIREON,
@ -1368,8 +1386,17 @@ enum egon_e {
int g_fireAnims1[] = { EGON_FIRE1, EGON_FIRE2, EGON_FIRE3, EGON_FIRE4 };
int g_fireAnims2[] = { EGON_ALTFIRECYCLE };
enum EGON_FIRESTATE { FIRE_OFF, FIRE_CHARGE };
enum EGON_FIREMODE { FIRE_NARROW, FIRE_WIDE};
enum EGON_FIRESTATE
{
FIRE_OFF,
FIRE_CHARGE
};
enum EGON_FIREMODE
{
FIRE_NARROW,
FIRE_WIDE
};
#define EGON_PRIMARY_VOLUME 450
#define EGON_BEAM_SPRITE "sprites/xbeam1.spr"
@ -1394,7 +1421,6 @@ void EV_EgonFire( event_args_t *args )
iFireMode = args->iparam2;
int iStartup = args->bparam1;
if( iStartup )
{
if( iFireMode == FIRE_WIDE )
@ -1416,7 +1442,7 @@ void EV_EgonFire( event_args_t *args )
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.
{
vec3_t vecSrc, vecEnd, origin, angles, forward, right, up;
vec3_t vecSrc, vecEnd, angles, forward, right, up;
pmtrace_t tr;
cl_entity_t *pl = gEngfuncs.GetEntityByIndex( idx );
@ -1456,7 +1482,6 @@ void EV_EgonFire( event_args_t *args )
g /= 100.0f;
}
pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b );
if( pBeam )
@ -1488,7 +1513,6 @@ void EV_EgonStop( event_args_t *args )
pBeam = NULL;
}
if( pBeam2 )
{
pBeam2->die = 0.0;
@ -1503,7 +1527,8 @@ void EV_EgonStop( event_args_t *args )
//======================
// HORNET START
//======================
enum hgun_e {
enum hgun_e
{
HGUN_IDLE1 = 0,
HGUN_FIDGETSWAY,
HGUN_FIDGETSHAKE,
@ -1531,9 +1556,15 @@ void EV_HornetGunFire( event_args_t *args )
switch( gEngfuncs.pfnRandomLong( 0 , 2 ) )
{
case 0: gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 ); break;
case 1: gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire2.wav", 1, ATTN_NORM, 0, 100 ); break;
case 2: gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire3.wav", 1, ATTN_NORM, 0, 100 ); break;
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire2.wav", 1, ATTN_NORM, 0, 100 );
break;
case 2:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire3.wav", 1, ATTN_NORM, 0, 100 );
break;
}
}
//======================
@ -1543,7 +1574,8 @@ void EV_HornetGunFire( event_args_t *args )
//======================
// TRIPMINE START
//======================
enum tripmine_e {
enum tripmine_e
{
TRIPMINE_IDLE1 = 0,
TRIPMINE_IDLE2,
TRIPMINE_ARM1,
@ -1552,7 +1584,7 @@ enum tripmine_e {
TRIPMINE_HOLSTER,
TRIPMINE_DRAW,
TRIPMINE_WORLD,
TRIPMINE_GROUND,
TRIPMINE_GROUND
};
//We only check if it's possible to put a trip mine
@ -1598,7 +1630,8 @@ void EV_TripmineFire( event_args_t *args )
//======================
// SQUEAK START
//======================
enum squeak_e {
enum squeak_e
{
SQUEAK_IDLE1 = 0,
SQUEAK_FIDGETFIT,
SQUEAK_FIDGETNIP,
@ -1672,12 +1705,24 @@ void EV_TrainPitchAdjust( event_args_t *args )
switch( noise )
{
case 1: strcpy( sz, "plats/ttrain1.wav"); break;
case 2: strcpy( sz, "plats/ttrain2.wav"); break;
case 3: strcpy( sz, "plats/ttrain3.wav"); break;
case 4: strcpy( sz, "plats/ttrain4.wav"); break;
case 5: strcpy( sz, "plats/ttrain6.wav"); break;
case 6: strcpy( sz, "plats/ttrain7.wav"); break;
case 1:
strcpy( sz, "plats/ttrain1.wav" );
break;
case 2:
strcpy( sz, "plats/ttrain2.wav" );
break;
case 3:
strcpy( sz, "plats/ttrain3.wav" );
break;
case 4:
strcpy( sz, "plats/ttrain4.wav");
break;
case 5:
strcpy( sz, "plats/ttrain6.wav");
break;
case 6:
strcpy( sz, "plats/ttrain7.wav");
break;
default:
// no sound
strcpy( sz, "" );

View File

@ -20,10 +20,11 @@ typedef enum
BULLET_MONSTER_9MM,
BULLET_MONSTER_MP5,
BULLET_MONSTER_12MM,
BULLET_MONSTER_12MM
}Bullet;
enum glock_e {
enum glock_e
{
GLOCK_IDLE1 = 0,
GLOCK_IDLE2,
GLOCK_IDLE3,
@ -36,7 +37,8 @@ enum glock_e {
GLOCK_ADD_SILENCER
};
enum shotgun_e {
enum shotgun_e
{
SHOTGUN_IDLE = 0,
SHOTGUN_FIRE,
SHOTGUN_FIRE2,
@ -58,10 +60,11 @@ enum mp5_e
MP5_DEPLOY,
MP5_FIRE1,
MP5_FIRE2,
MP5_FIRE3,
MP5_FIRE3
};
enum python_e {
enum python_e
{
PYTHON_IDLE1 = 0,
PYTHON_FIDGET,
PYTHON_FIRE1,
@ -75,7 +78,8 @@ enum python_e {
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
enum gauss_e {
enum gauss_e
{
GAUSS_IDLE = 0,
GAUSS_IDLE2,
GAUSS_FIDGET,
@ -91,5 +95,4 @@ void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName );
void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType );
int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, float *right, int iBulletType, int iTracerFreq, int *tracerCount );
void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int cShots, float *vecSrc, float *vecDirShooting, float flDistance, int iBulletType, int iTracerFreq, int *tracerCount, float flSpreadX, float flSpreadY );
#endif // EV_HLDMH

View File

@ -15,49 +15,6 @@
#define FTENT_FADEOUT 0x00000080
#define DMG_GENERIC 0 // generic damage was done
#define DMG_CRUSH (1 << 0) // crushed by falling or moving object
#define DMG_BULLET (1 << 1) // shot
#define DMG_SLASH (1 << 2) // cut, clawed, stabbed
#define DMG_BURN (1 << 3) // heat burned
#define DMG_FREEZE (1 << 4) // frozen
#define DMG_FALL (1 << 5) // fell too far
#define DMG_BLAST (1 << 6) // explosive blast damage
#define DMG_CLUB (1 << 7) // crowbar, punch, headbutt
#define DMG_SHOCK (1 << 8) // electric shock
#define DMG_SONIC (1 << 9) // sound pulse shockwave
#define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam
#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
// time-based damage
//mask off TF-specific stuff too
#define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage
#define DMG_DROWN (1 << 14) // Drowning
#define DMG_FIRSTTIMEBASED DMG_DROWN
#define DMG_PARALYZE (1 << 15) // slows affected creature down
#define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad
#define DMG_POISON (1 << 17) // blood poisioning
#define DMG_RADIATION (1 << 18) // radiation exposure
#define DMG_DROWNRECOVER (1 << 19) // drowning recovery
#define DMG_ACID (1 << 20) // toxic chemicals or acid burns
#define DMG_SLOWBURN (1 << 21) // in an oven
#define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer
#define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar)
//TF ADDITIONS
#define DMG_IGNITE (1 << 24) // Players hit by this begin to burn
#define DMG_RADIUS_MAX (1 << 25) // Radius damage with this flag doesn't decrease over distance
#define DMG_RADIUS_QUAKE (1 << 26) // Radius damage is done like Quake. 1/2 damage at 1/2 radius.
#define DMG_IGNOREARMOR (1 << 27) // Damage ignores target's armor
#define DMG_AIMED (1 << 28) // Does Hit location damage
#define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls
#define DMG_CALTROP (1<<30)
#define DMG_HALLUC (1<<31)
// Some of these are HL/TFC specific?
void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype );
void EV_GetGunPosition( struct event_args_s *args, float *pos, float *origin );
@ -69,5 +26,4 @@ void EV_CreateTracer( float *start, float *end );
struct cl_entity_s *GetEntity( int idx );
struct cl_entity_s *GetViewEntity( void );
void EV_MuzzleFlash( void );
#endif // EVENTSCRIPTSH

View File

@ -25,8 +25,6 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_Flash, FlashBat )
DECLARE_MESSAGE( m_Flash, Flashlight )
@ -45,7 +43,7 @@ int CHudFlashlight::Init(void)
gHUD.AddHudElem( this );
return 1;
};
}
void CHudFlashlight::Reset( void )
{
@ -68,12 +66,10 @@ int CHudFlashlight::VidInit(void)
m_iWidth = m_prc2->right - m_prc2->left;
return 1;
};
}
int CHudFlashlight::MsgFunc_FlashBat( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int x = READ_BYTE();
m_iBat = x;
@ -84,7 +80,6 @@ int CHudFlashlight:: MsgFunc_FlashBat(const char *pszName, int iSize, void *pbu
int CHudFlashlight::MsgFunc_Flashlight( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_fOn = READ_BYTE();
int x = READ_BYTE();
@ -134,7 +129,8 @@ int CHudFlashlight::Draw(float flTime)
SPR_DrawAdditive( 0, x, y, m_prc1 );
if( m_fOn )
{ // draw the flashlight beam
{
// draw the flashlight beam
x = ScreenWidth - m_iWidth / 2;
SPR_Set( m_hBeam, r, g, b );
@ -153,6 +149,5 @@ int CHudFlashlight::Draw(float flTime)
SPR_DrawAdditive( 0, x + iOffset, y, &rc );
}
return 1;
}

View File

@ -40,12 +40,12 @@ int CHudGeiger::Init(void)
srand( (unsigned)time( NULL ) );
return 1;
};
}
int CHudGeiger::VidInit( void )
{
return 1;
};
}
int CHudGeiger::MsgFunc_Geiger( const char *pszName, int iSize, void *pbuf )
{
@ -176,7 +176,6 @@ int CHudGeiger::Draw (float flTime)
sprintf( sz, "player/geiger%d.wav", j + 1 );
PlaySound( sz, flvol );
}
}

View File

@ -67,7 +67,6 @@ int CHudHealth::Init(void)
memset( m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES );
gHUD.AddHudElem( this );
return 1;
}
@ -77,7 +76,6 @@ void CHudHealth::Reset( void )
// make sure the pain compass is cleared when the player respawns
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
// force all the flashing damage icons to expire
m_bitsDamage = 0;
for( int i = 0; i < NUM_DMG_TYPES; i++ )
@ -95,6 +93,7 @@ int CHudHealth::VidInit(void)
giDmgHeight = gHUD.GetSpriteRect( m_HUD_dmg_bio ).right - gHUD.GetSpriteRect( m_HUD_dmg_bio ).left;
giDmgWidth = gHUD.GetSpriteRect( m_HUD_dmg_bio ).bottom - gHUD.GetSpriteRect( m_HUD_dmg_bio ).top;
return 1;
}
@ -116,7 +115,6 @@ int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudHealth::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -141,7 +139,8 @@ int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
{
float time = damageTaken * 4.0f;
if( time > 200.0f ) time = 200.0f;
if( time > 200.0f )
time = 200.0f;
gMobileEngfuncs->pfnVibrate( time, 0 );
}
}
@ -149,7 +148,6 @@ int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
return 1;
}
// Returns back a color from the
// Green <-> Yellow <-> Red ramp
void CHudHealth::GetPainColor( int &r, int &g, int &b )
@ -201,9 +199,7 @@ int CHudHealth::Draw(float flTime)
}
// Fade the health number back to dim
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
}
else
a = MIN_ALPHA;
@ -254,11 +250,9 @@ void CHudHealth::CalcDamageDirection(vec3_t vecFrom)
return;
}
memcpy( vecOrigin, gHUD.m_vecOrigin, sizeof(vec3_t) );
memcpy( vecAngles, gHUD.m_vecAngles, sizeof(vec3_t) );
VectorSubtract( vecFrom, vecOrigin, vecFrom );
float flDistToTarget = vecFrom.Length();
@ -340,7 +334,8 @@ int CHudHealth::DrawPain(float flTime)
y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2;
SPR_DrawAdditive( 1, x, y, NULL );
m_fAttackRight = max( 0, m_fAttackRight - fFade );
} else
}
else
m_fAttackRight = 0;
if( m_fAttackRear > 0.4 )
@ -354,7 +349,8 @@ int CHudHealth::DrawPain(float flTime)
y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2;
SPR_DrawAdditive( 2, x, y, NULL );
m_fAttackRear = max( 0, m_fAttackRear - fFade );
} else
}
else
m_fAttackRear = 0;
if( m_fAttackLeft > 0.4 )
@ -389,25 +385,17 @@ int CHudHealth::DrawDamage(float flTime)
ScaleColors( r, g, b, a );
// Draw all the items
for (i = 0; i < NUM_DMG_TYPES; i++)
{
if (m_bitsDamage & giDmgFlags[i])
{
pdmg = &m_dmg[i];
SPR_Set(gHUD.GetSprite(m_HUD_dmg_bio + i), r, g, b );
SPR_DrawAdditive(0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect(m_HUD_dmg_bio + i));
}
}
// check for bits that should be expired
for( i = 0; i < NUM_DMG_TYPES; i++ )
{
pdmg = &m_dmg[i];
if( m_bitsDamage & giDmgFlags[i] )
{
pdmg = &m_dmg[i];
// Draw all the items
SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b );
SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) );
pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
if( pdmg->fExpire <= flTime // when the time has expired
@ -435,7 +423,6 @@ int CHudHealth::DrawDamage(float flTime)
return 1;
}
void CHudHealth::UpdateTiles( float flTime, long bitsDamage )
{
DAMAGE_IMAGE *pdmg;
@ -472,7 +459,6 @@ void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
pdmg = &m_dmg[j];
if( pdmg->y )
pdmg->y -= giDmgHeight;
}
pdmg = &m_dmg[i];
}

View File

@ -23,6 +23,7 @@
#define DMG_IMAGE_NERVE 5
#define DMG_IMAGE_RAD 6
#define DMG_IMAGE_SHOCK 7
//tf defines
#define DMG_IMAGE_CALTROP 8
#define DMG_IMAGE_TRANQ 9
@ -46,12 +47,10 @@
#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
// time-based damage
//mask off TF-specific stuff too
#define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage
#define DMG_DROWN (1 << 14) // Drowning
#define DMG_FIRSTTIMEBASED DMG_DROWN
@ -78,16 +77,14 @@
// TF Healing Additions for TakeHealth
#define DMG_IGNORE_MAXHEALTH DMG_IGNITE
// TF Redefines since we never use the originals
#define DMG_NAIL DMG_SLASH
#define DMG_NOT_SELF DMG_FREEZE
#define DMG_TRANQ DMG_MORTAR
#define DMG_CONCUSS DMG_SONIC
typedef struct
{
float fExpire;

View File

@ -21,6 +21,7 @@ This file contains "stubs" of class member implementations so that we can predic
add in the functionality you need.
==========================
*/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -108,7 +109,6 @@ void CBeam::PointEntInit( const Vector &start, int endIndex ) { }
CBeam *CBeam::BeamCreate( const char *pSpriteName, int width ) { return NULL; }
void CSprite::Expand( float scaleSpeed, float fadeSpeed ) { }
CBaseEntity* CBaseMonster::CheckTraceHullAttack( float flDist, int iDamage, int iDmgType ) { return NULL; }
void CBaseMonster::Eat( float flFullDuration ) { }
BOOL CBaseMonster::FShouldEat( void ) { return TRUE; }

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "event_api.h"
@ -38,8 +39,6 @@ void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args );
}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "../demo.h"

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -67,7 +68,6 @@ CSatchel g_Satchel;
CTripmine g_Tripmine;
CSqueak g_Snark;
/*
======================
AlertMessage
@ -94,6 +94,7 @@ bool bIsMultiplayer ( void )
{
return gEngfuncs.GetMaxClients() == 1 ? 0 : 1;
}
//Just loads a v_ model.
void LoadVModel( char *szViewModel, CBasePlayer *m_pPlayer )
{
@ -147,7 +148,6 @@ CBasePlayerWeapon :: DefaultReload
*/
BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, int body )
{
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
return FALSE;
@ -309,7 +309,6 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
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;
}
}
return Vector( x * vecSpread.x, y * vecSpread.y, 0.0 );
@ -366,7 +365,6 @@ void CBasePlayerWeapon::ItemPostFrame( void )
else if( !( m_pPlayer->pev->button & ( IN_ATTACK | IN_ATTACK2 ) ) )
{
// no fire buttons down
m_fFireOnEmpty = FALSE;
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
@ -404,7 +402,6 @@ void CBasePlayer::SelectItem(const char *pstr)
if( !pItem )
return;
if( pItem == m_pActiveItem )
return;
@ -584,7 +581,6 @@ int RandomLong( int a, int b )
return gEngfuncs.pfnRandomLong( a, b );
}
/*
=====================
HUD_InitClientWeapons
@ -692,11 +688,9 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
int buttonsChanged;
CBasePlayerWeapon *pWeapon = NULL;
CBasePlayerWeapon *pCurrent;
weapon_data_t nulldata, *pfrom, *pto;
weapon_data_t nulldata = {0}, *pfrom, *pto;
static int lasthealth;
memset( &nulldata, 0, sizeof( nulldata ) );
HUD_InitClientWeapons();
// Get current clock
@ -709,55 +703,42 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
case WEAPON_CROWBAR:
pWeapon = &g_Crowbar;
break;
case WEAPON_GLOCK:
pWeapon = &g_Glock;
break;
case WEAPON_PYTHON:
pWeapon = &g_Python;
break;
case WEAPON_MP5:
pWeapon = &g_Mp5;
break;
case WEAPON_CROSSBOW:
pWeapon = &g_Crossbow;
break;
case WEAPON_SHOTGUN:
pWeapon = &g_Shotgun;
break;
case WEAPON_RPG:
pWeapon = &g_Rpg;
break;
case WEAPON_GAUSS:
pWeapon = &g_Gauss;
break;
case WEAPON_EGON:
pWeapon = &g_Egon;
break;
case WEAPON_HORNETGUN:
pWeapon = &g_HGun;
break;
case WEAPON_HANDGRENADE:
pWeapon = &g_HandGren;
break;
case WEAPON_SATCHEL:
pWeapon = &g_Satchel;
break;
case WEAPON_TRIPMINE:
pWeapon = &g_Tripmine;
break;
case WEAPON_SNARK:
pWeapon = &g_Snark;
break;
@ -775,7 +756,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
if( to->client.health <= 0 && lasthealth > 0 )
{
player.Killed( NULL, 0 );
}
else if( to->client.health > 0 && lasthealth <= 0 )
{
@ -860,7 +840,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
player.ammo_hornets = (int)from->client.vuser2[0];
player.ammo_rockets = (int)from->client.ammo_rockets;
// Point to current weapon object
if( from->client.m_iId )
{

View File

@ -25,14 +25,12 @@
#include "parsemsg.h"
#include "hud_servers.h"
#include "demo.h"
#include "demo_api.h"
cvar_t *hud_textmode;
float g_hud_text_color[3];
extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz, int iRes, int iCount );
extern cvar_t *sensitivity;
@ -142,7 +140,6 @@ int __MsgFunc_ServerName(const char *pszName, int iSize, void *pbuf)
return 0;
}
int __MsgFunc_Spectator( const char *pszName, int iSize, void *pbuf )
{
return 0;
@ -235,7 +232,6 @@ void CHud :: Init( void )
m_Menu.Init();
MsgFunc_ResetHUD( 0, 0, NULL );
}
@ -258,8 +254,6 @@ CHud :: ~CHud()
}
m_pHudList = NULL;
}
}
// GetSpriteIndex()
@ -404,7 +398,6 @@ void CHud :: VidInit( void )
m_StatusIcons.VidInit();
m_Scoreboard.VidInit();
m_MOTD.VidInit();
}
int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf )
@ -441,7 +434,6 @@ void COM_FileBase ( const char *in, char *out)
else
end--; // Found ',', copy to left of '.'
// Scan backward for '/'
start = len - 1;
while( start >= 0 && in[start] != '/' && in[start] != '\\' )
@ -457,6 +449,7 @@ void COM_FileBase ( const char *in, char *out)
// Copy partial string
strncpy( out, &in[start], len );
// Terminate it
out[len] = 0;
}
@ -550,7 +543,6 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
return 1;
}
void CHud::AddHudElem( CHudBase *phudelem )
{
HUDLIST *pdl, *ptemp;
@ -585,5 +577,3 @@ float CHud::GetSensitivity( void )
{
return m_flMouseSensitivity;
}

View File

@ -20,7 +20,6 @@
// CHud handles the message, calculation, and drawing the HUD
//
#define RGB_YELLOWISH 0x00FFA000 //255,160,0
#define RGB_REDISH 0x00FF1010 //255,160,0
#define RGB_GREENISH 0x0000A000 //0,160,0
@ -36,7 +35,8 @@
#define HUDELEM_ACTIVE 1
typedef struct {
typedef struct
{
int x, y;
} POSITION;
@ -44,16 +44,16 @@ enum
{
MAX_PLAYERS = 64,
MAX_TEAMS = 64,
MAX_TEAM_NAME = 16,
MAX_TEAM_NAME = 16
};
typedef struct {
typedef struct
{
unsigned char r, g, b, a;
} RGBA;
typedef struct cvar_s cvar_t;
#define HUD_ACTIVE 1
#define HUD_INTERMISSION 2
@ -77,21 +77,18 @@ public:
virtual void Think( void ) { return; }
virtual void Reset( void ) { return; }
virtual void InitHUDData( void ) {} // called every time a server is connected to
};
struct HUDLIST {
struct HUDLIST
{
CHudBase *p;
HUDLIST *pNext;
};
//
//-----------------------------------------------------
#include "hud_spectator.h"
//
//-----------------------------------------------------
//
@ -133,13 +130,11 @@ private:
WEAPON *m_pWeapon;
int m_HUD_bucket0;
int m_HUD_selection;
};
//
//-----------------------------------------------------
//
class CHudAmmoSecondary : public CHudBase
{
public:
@ -181,7 +176,6 @@ public:
private:
int m_iGeigerRange;
};
//
@ -198,7 +192,6 @@ public:
private:
HSPRITE m_hSprite;
int m_iPos;
};
//
@ -206,7 +199,6 @@ private:
//
// REMOVED: Vgui has replaced this.
//
class CHudMOTD : public CHudBase
{
public:
@ -229,7 +221,6 @@ protected:
int m_iMaxLength;
};
class CHudScoreboard : public CHudBase
{
public:
@ -257,7 +248,6 @@ public:
void GetAllPlayersInfo( void );
};
//
//-----------------------------------------------------
//
@ -274,10 +264,11 @@ public:
int MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf );
protected:
enum {
enum
{
MAX_STATUSTEXT_LENGTH = 128,
MAX_STATUSBAR_VALUES = 8,
MAX_STATUSBAR_LINES = 2,
MAX_STATUSBAR_LINES = 2
};
char m_szStatusText[MAX_STATUSBAR_LINES][MAX_STATUSTEXT_LENGTH]; // a text string describing how the status bar is to be drawn
@ -319,9 +310,9 @@ public:
int m_iShowscoresHeld;
void GetAllPlayersInfo( void );
private:
struct cvar_s *cl_showpacketloss;
};
*/
@ -353,7 +344,6 @@ extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional pl
extern team_info_t g_TeamInfo[MAX_TEAMS + 1];
extern int g_IsSpectator[MAX_PLAYERS + 1];
//
//-----------------------------------------------------
//
@ -407,7 +397,6 @@ public:
friend class CHudSpectator;
private:
struct cvar_s * m_HUD_saytext;
struct cvar_s * m_HUD_saytext_time;
};
@ -433,7 +422,6 @@ private:
int m_iHeight; // width of the battery innards
};
//
//-----------------------------------------------------
//
@ -545,19 +533,18 @@ public:
int Draw( float flTime );
int MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf );
enum {
enum
{
MAX_ICONSPRITENAME_LENGTH = MAX_SPRITE_NAME_LENGTH,
MAX_ICONSPRITES = 4,
MAX_ICONSPRITES = 4
};
//had to make these public so CHud could access them (to enable concussion icon)
//could use a friend declaration instead...
void EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );
void DisableIcon( char *pszIconName );
private:
typedef struct
{
char szSpriteName[MAX_ICONSPRITENAME_LENGTH];
@ -567,15 +554,11 @@ private:
} icon_sprite_t;
icon_sprite_t m_IconList[MAX_ICONSPRITES];
};
//
//-----------------------------------------------------
//
class CHud
{
private:
@ -589,7 +572,6 @@ private:
int m_iConcussionEffect;
public:
HSPRITE m_hsprCursor;
float m_flTime; // the current client time
float m_fOldTime; // the time at which the HUD was last redrawn
@ -632,7 +614,6 @@ public:
return m_rgrcRects[index];
}
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array
CHudAmmo m_Ammo;
@ -653,7 +634,6 @@ public:
CHudScoreboard m_Scoreboard;
CHudMOTD m_MOTD;
void Init( void );
void VidInit( void );
void Think(void);
@ -688,10 +668,8 @@ public:
void AddHudElem( CHudBase *p );
float GetSensitivity();
};
extern CHud gHUD;
extern int g_iPlayerClass;
@ -699,4 +677,3 @@ extern int g_iTeamNumber;
extern int g_iUser1;
extern int g_iUser2;
extern int g_iUser3;

View File

@ -15,5 +15,4 @@ typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "wrect.h"
#include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs;
#endif

View File

@ -74,7 +74,6 @@ void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
pBeam = pBeam2 = NULL;
}
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -83,7 +82,6 @@ int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHud::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
{
int armor, blood;
@ -104,7 +102,6 @@ int CHud :: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
count = 10;
// TODO: kick viewangles, show damage visually
return 1;
}

View File

@ -20,7 +20,6 @@
#include "cl_util.h"
//#include "triangleapi.h"
#define MAX_LOGO_FRAMES 56
int grgLogoFrame[MAX_LOGO_FRAMES] =
@ -30,7 +29,6 @@ int grgLogoFrame[MAX_LOGO_FRAMES] =
29, 29, 29, 29, 29, 28, 27, 26, 25, 24, 30, 31
};
extern int g_iVisibleMouse;
float HUD_GetFOV( void );
@ -61,7 +59,6 @@ void CHud::Think(void)
}
// the clients fov is actually set in the client data update section of the hud
// Set a new sensitivity
if( m_iFOV == default_fov->value )
{
@ -76,7 +73,8 @@ void CHud::Think(void)
// think about default fov
if( m_iFOV == 0 )
{ // only let players adjust up in fov, and only if they are not overriden by something else
{
// only let players adjust up in fov, and only if they are not overriden by something else
m_iFOV = max( default_fov->value, 90 );
}
}
@ -95,7 +93,6 @@ int CHud :: Redraw( float flTime, int intermission )
if( m_flTimeDelta < 0 )
m_flTimeDelta = 0;
if( m_flShotTime && m_flShotTime < flTime )
{
gEngfuncs.pfnClientCmd( "snapshot\n" );
@ -119,7 +116,8 @@ int CHud :: Redraw( float flTime, int intermission )
pList->p->Draw( flTime );
}
else
{ // it's an intermission, so only draw hud elements that are set to draw during intermissions
{
// it's an intermission, so only draw hud elements that are set to draw during intermissions
if( pList->p->m_iFlags & HUD_INTERMISSION )
pList->p->Draw( flTime );
}
@ -238,13 +236,11 @@ int CHud :: DrawHudStringLen( char *szIt )
return l;
}
int CHud::DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b )
{
char szString[32];
sprintf( szString, "%d", iNumber );
return DrawHudStringReverse( xpos, ypos, iMinX, szString, r, g, b );
}
// draws a string from right to left (right-aligned)
@ -318,7 +314,6 @@ int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g,
}
// SPR_Draw ones
SPR_DrawAdditive( 0, x, y, &GetSpriteRect( m_HUD_number_0 ) );
x += iWidth;
}
@ -326,7 +321,6 @@ int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g,
return x;
}
int CHud::GetNumWidth( int iNumber, int iFlags )
{
if( iFlags & ( DHN_3DIGITS ) )
@ -350,10 +344,8 @@ int CHud::GetNumWidth( int iNumber, int iFlags )
return 2;
return 3;
}
void CHud::DrawDarkRectangle( int x, int y, int wide, int tall )
{
//gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );

View File

@ -89,6 +89,7 @@ void NET_CALLBACK RulesResponse( struct net_response_s *response )
g_pServers->RulesResponse( response );
}
}
/*
===================
PlayersResponse
@ -103,6 +104,7 @@ void NET_CALLBACK PlayersResponse( struct net_response_s *response )
g_pServers->PlayersResponse( response );
}
}
/*
===================
ListResponse
@ -846,7 +848,6 @@ int CHudServers::LoadMasterAddresses( int maxservers, int *count, netadr_t *padr
}
}
}
finish_master:
if( !nCount )
{
@ -855,7 +856,6 @@ finish_master:
// Convert to netadr_t
if( NET_API->StringToAdr( szMaster, &adr ) )
{
padr[nCount++] = adr;
}
}
@ -914,8 +914,7 @@ void CHudServers::RequestBroadcastList( int clearpending )
m_nDone = 0;
m_dStarted = m_fElapsed;
netadr_t adr;
memset( &adr, 0, sizeof( adr ) );
netadr_t adr = {0};
if( clearpending )
{
@ -999,7 +998,6 @@ int CHudServers::isQuerying()
return m_nRequesting ? 1 : 0;
}
/*
===================
GetServerCount
@ -1031,7 +1029,6 @@ CHudServers::CHudServers( void )
m_fElapsed = 0.0;
m_pPingRequest = NULL;
m_pRulesRequest = NULL;
m_pPlayersRequest = NULL;
@ -1055,7 +1052,6 @@ CHudServers::~CHudServers( void )
{
delete m_pPingRequest;
m_pPingRequest = NULL;
}
if( m_pRulesRequest )

View File

@ -37,5 +37,4 @@ int ServersGetCount( void );
const char *ServersGetInfo( int server );
int ServersIsQuerying( void );
void SortServers( const char *fieldname );
#endif // HUD_SERVERSH

View File

@ -94,5 +94,4 @@ private:
request_t *m_pRulesRequest;
request_t *m_pPlayersRequest;
};
#endif // HUD_SERVERS_PRIVH

View File

@ -24,14 +24,12 @@
#include "studio_util.h"
#include "screenfade.h"
#pragma warning(disable: 4244)
extern "C" int iJumpSpectator;
extern "C" float vJumpOrigin[3];
extern "C" float vJumpAngles[3];
extern void V_GetInEyePos( int entity, float * origin, float * angles );
extern void V_ResetChaseCam();
extern void V_GetChasePos( int target, float * cl_angles, float * origin, float * angles );
@ -46,8 +44,6 @@ extern vec3_t v_sim_org; // last sim origin
void SpectatorMode( void )
{
if( gEngfuncs.Cmd_Argc() <= 1 )
{
gEngfuncs.Con_Printf( "usage: spec_mode <Main Mode> [<Inset Mode>]\n" );
@ -79,7 +75,6 @@ void SpectatorSpray(void)
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
gEngfuncs.pfnServerCmd( string );
}
}
void SpectatorHelp( void )
{
@ -105,7 +100,6 @@ void SpectatorMenu( void )
gEngfuncs.Con_Printf( "usage: spec_menu <0|1>\n" );
return;
}
}
void ToggleScores( void )
@ -151,11 +145,9 @@ int CHudSpectator::Init()
return 1;
}
//-----------------------------------------------------------------------------
// UTIL_StringToVector originally from ..\dlls\util.cpp, slightly changed
//-----------------------------------------------------------------------------
void UTIL_StringToVector( float * pVector, const char *pString )
{
char *pstr, *pfront, tempString[128];
@ -170,7 +162,7 @@ void UTIL_StringToVector( float * pVector, const char *pString )
while( *pstr && *pstr != ' ' )
pstr++;
if (!*pstr)
if( !( *pstr ) )
break;
pstr++;
pfront = pstr;
@ -191,9 +183,11 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
cl_entity_t * pEnt = gEngfuncs.GetEntityByIndex( 0 ); // get world model
if ( !pEnt ) return 0;
if( !pEnt )
return 0;
if ( !pEnt->model ) return 0;
if( !pEnt->model )
return 0;
char * data = pEnt->model->entities;
@ -217,7 +211,6 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
}
// we parse the first { now parse entities properties
while( 1 )
{
// parse key
@ -229,7 +222,7 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
{
gEngfuncs.Con_DPrintf( "UTIL_FindEntityInMap: EOF without closing brace\n" );
return 0;
};
}
strcpy( keyname, token );
@ -247,7 +240,7 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
{
gEngfuncs.Con_DPrintf( "UTIL_FindEntityInMap: EOF without closing brace\n" );
return 0;
};
}
if( token[0] == '}' )
{
@ -261,7 +254,7 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
{
found = 1; // thats our entity
}
};
}
if( !strcmp( keyname, "angle" ) )
{
@ -294,25 +287,20 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
if( !strcmp( keyname, "origin" ) )
{
UTIL_StringToVector( origin, token );
};
}
} // while (1)
if( found )
return 1;
}
return 0; // we search all entities, but didn't found the correct
}
//-----------------------------------------------------------------------------
// SetSpectatorStartPosition():
// Get valid map position and 'beam' spectator to this position
//-----------------------------------------------------------------------------
void CHudSpectator::SetSpectatorStartPosition()
{
// search for info_player start
@ -394,7 +382,6 @@ int CHudSpectator::Draw(float flTime)
VectorScale( right, m_moveDelta, right );
VectorAdd( m_mapOrigin, right, m_mapOrigin )
}
// Only draw the icon names only if map mode is in Main Mode
@ -408,12 +395,9 @@ int CHudSpectator::Draw(float flTime)
//gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
// loop through all the players and draw additional infos to their sprites on the map
for( int i = 0; i < MAX_PLAYERS; i++ )
{
if( m_vPlayerPos[i][2] < 0 ) // marked as invisible ?
continue;
@ -423,8 +407,8 @@ int CHudSpectator::Draw(float flTime)
if( m_vPlayerPos[i][0] > XRES( m_OverviewData.insetWindowX ) &&
m_vPlayerPos[i][1] > YRES( m_OverviewData.insetWindowY ) &&
m_vPlayerPos[i][0] < XRES( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) &&
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight)
) continue;
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight) )
continue;
}
color = GetClientColor( i + 1 );
@ -436,13 +420,11 @@ int CHudSpectator::Draw(float flTime)
DrawSetTextColor( color[0], color[1], color[2] );
DrawConsoleString( m_vPlayerPos[i][0] - lx,m_vPlayerPos[i][1], string );
}
return 1;
}
void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
{
float value;
@ -462,9 +444,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
// fake a InitHUD & ResetHUD message
gHUD.MsgFunc_InitHUD( NULL, 0, NULL );
gHUD.MsgFunc_ResetHUD( NULL, 0, NULL );
break;
case DRC_CMD_EVENT:
m_lastPrimaryObject = READ_WORD();
m_lastSecondaryObject = READ_WORD();
@ -481,14 +461,12 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
// gEngfuncs.Con_Printf( "Director Camera: %i %i\n", firstObject, secondObject );
break;
case DRC_CMD_MODE:
if( m_autoDirector->value )
{
SetModes( READ_BYTE(), -1 );
}
break;
case DRC_CMD_CAMERA:
if( m_autoDirector->value )
{
@ -505,7 +483,6 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
iJumpSpectator = 1;
}
break;
case DRC_CMD_MESSAGE:
{
client_textmessage_t * msg = &m_HUDMessages[m_lastHudMessage];
@ -536,45 +513,33 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
m_lastHudMessage++;
m_lastHudMessage %= MAX_SPEC_HUD_MESSAGES;
}
break;
case DRC_CMD_SOUND:
string = READ_STRING();
value = READ_FLOAT();
// gEngfuncs.Con_Printf("DRC_CMD_FX_SOUND: %s %.2f\n", string, value );
gEngfuncs.pEventAPI->EV_PlaySound( 0, v_origin, CHAN_BODY, string, value, ATTN_NORM, 0, PITCH_NORM );
break;
case DRC_CMD_TIMESCALE:
value = READ_FLOAT();
break;
case DRC_CMD_STATUS:
READ_LONG(); // total number of spectator slots
m_iSpectatorNumber = READ_LONG(); // total number of spectator
READ_WORD(); // total number of relay proxies
break;
case DRC_CMD_BANNER:
// gEngfuncs.Con_DPrintf( "GUI: Banner %s\n",READ_STRING() ); // name of banner tga eg gfx/temp/7454562234563475.tga
break;
case DRC_CMD_FADE:
break;
case DRC_CMD_STUFFTEXT:
ClientCmd( READ_STRING() );
break;
default : gEngfuncs.Con_DPrintf("CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
default:
gEngfuncs.Con_DPrintf( "CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
}
}
@ -611,8 +576,6 @@ void CHudSpectator::FindNextPlayer(bool bReverse)
//gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
do
{
iCurrent += iDir;
@ -629,10 +592,8 @@ void CHudSpectator::FindNextPlayer(bool bReverse)
continue;
// MOD AUTHORS: Add checks on target here.
g_iUser2 = iCurrent;
break;
} while( iCurrent != iStart );
// Did we find a target?
@ -695,19 +656,14 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
{
if( g_iUser1 == OBS_CHASE_LOCKED )
newMainMode = OBS_CHASE_FREE;
else if( g_iUser1 == OBS_CHASE_FREE )
newMainMode = OBS_IN_EYE;
else if( g_iUser1 == OBS_IN_EYE )
newMainMode = OBS_ROAMING;
else if( g_iUser1 == OBS_ROAMING )
newMainMode = OBS_MAP_FREE;
else if( g_iUser1 == OBS_MAP_FREE )
newMainMode = OBS_MAP_CHASE;
else
newMainMode = OBS_CHASE_FREE; // don't use OBS_CHASE_LOCKED anymore
}
@ -721,7 +677,6 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
{
gEngfuncs.SetViewAngles( vJumpAngles );
iJumpSpectator = 1;
}
// lease directed mode if player want to see another player
m_autoDirector->value = 0.0f;
@ -750,7 +705,6 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
void CHudSpectator::HandleButtonsUp( int ButtonPressed )
{
if( ButtonPressed & ( IN_FORWARD | IN_BACK ) )
m_zoomDelta = 0.0f;
@ -799,12 +753,12 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
switch( iNewMainMode )
{
case OBS_CHASE_LOCKED: g_iUser1 = OBS_CHASE_LOCKED;
case OBS_CHASE_LOCKED:
g_iUser1 = OBS_CHASE_LOCKED;
break;
case OBS_CHASE_FREE : g_iUser1 = OBS_CHASE_FREE;
case OBS_CHASE_FREE:
g_iUser1 = OBS_CHASE_FREE;
break;
case OBS_ROAMING: // jump to current vJumpOrigin/angle
g_iUser1 = OBS_ROAMING;
if( g_iUser2 )
@ -814,17 +768,17 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
iJumpSpectator = 1;
}
break;
case OBS_IN_EYE : g_iUser1 = OBS_IN_EYE;
case OBS_IN_EYE:
g_iUser1 = OBS_IN_EYE;
break;
case OBS_MAP_FREE : g_iUser1 = OBS_MAP_FREE;
case OBS_MAP_FREE:
g_iUser1 = OBS_MAP_FREE;
// reset user values
m_mapZoom = m_OverviewData.zoom;
m_mapOrigin = m_OverviewData.origin;
break;
case OBS_MAP_CHASE : g_iUser1 = OBS_MAP_CHASE;
case OBS_MAP_CHASE:
g_iUser1 = OBS_MAP_CHASE;
// reset user values
m_mapZoom = m_OverviewData.zoom;
m_mapOrigin = m_OverviewData.origin;
@ -864,7 +818,6 @@ bool CHudSpectator::IsActivePlayer(cl_entity_t * ent)
);
}
bool CHudSpectator::ParseOverviewFile()
{
char filename[255] = { 0 };
@ -905,7 +858,6 @@ bool CHudSpectator::ParseOverviewFile( )
return false;
}
while( true )
{
pfile = gEngfuncs.COM_ParseFile( pfile, token );
@ -956,7 +908,6 @@ bool CHudSpectator::ParseOverviewFile( )
m_OverviewData.insetWindowWidth = atof( token );
pfile = gEngfuncs.COM_ParseFile( pfile, token );
m_OverviewData.insetWindowHeight = atof( token );
}
else
{
@ -965,13 +916,11 @@ bool CHudSpectator::ParseOverviewFile( )
}
pfile = gEngfuncs.COM_ParseFile( pfile, token ); // parse next token
}
}
else if( !stricmp( token, "layer" ) )
{
// parse a layer data
if( m_OverviewData.layers == OVERVIEW_MAX_LAYERS )
{
gEngfuncs.Con_Printf( "Error parsing overview file %s. ( too many layers )\n", filename );
@ -980,7 +929,6 @@ bool CHudSpectator::ParseOverviewFile( )
pfile = gEngfuncs.COM_ParseFile( pfile, token );
if( stricmp( token, "{" ) )
{
gEngfuncs.Con_Printf( "Error parsing overview file %s. (expected { )\n", filename );
@ -995,8 +943,6 @@ bool CHudSpectator::ParseOverviewFile( )
{
pfile = gEngfuncs.COM_ParseFile( pfile, token );
strcpy( m_OverviewData.layersImages[m_OverviewData.layers], token );
}
else if ( !stricmp( token, "height" ) )
{
@ -1014,7 +960,6 @@ bool CHudSpectator::ParseOverviewFile( )
}
m_OverviewData.layers++;
}
}
@ -1024,7 +969,6 @@ bool CHudSpectator::ParseOverviewFile( )
m_mapOrigin = m_OverviewData.origin;
return true;
}
void CHudSpectator::LoadMapSprites()
@ -1059,10 +1003,8 @@ void CHudSpectator::DrawOverviewLayer()
yTiles = 6;
}
screenaspect = 4.0f / 3.0f;
xs = m_OverviewData.origin[0];
ys = m_OverviewData.origin[1];
z = ( 90.0f - v_angles[0] ) / 90.0f;
@ -1076,7 +1018,6 @@ void CHudSpectator::DrawOverviewLayer()
frame = 0;
// rotated view ?
if( m_OverviewData.rotated )
{
@ -1122,14 +1063,10 @@ void CHudSpectator::DrawOverviewLayer()
xStep = -( 2 * 4096.0f / m_OverviewData.zoom ) / xTiles;
yStep = -( 2 * 4096.0f / ( m_OverviewData.zoom* screenaspect ) ) / yTiles;
x = xs + ( 4096.0f / ( m_OverviewData.zoom * screenaspect ) );
for( ix = 0; ix < yTiles; ix++ )
{
y = ys + ( 4096.0f / ( m_OverviewData.zoom ) );
for( iy = 0; iy < xTiles; iy++ )
@ -1159,7 +1096,6 @@ void CHudSpectator::DrawOverviewLayer()
}
x += xStep;
}
}
}
@ -1175,7 +1111,6 @@ void CHudSpectator::DrawOverviewEntities()
float zScale = ( 90.0f - v_angles[0] ) / 90.0f;
z = m_OverviewData.layersHeights[0] * zScale;
// get yellow/brown HUD color
UnpackRGB( ir, ig, ib, RGB_YELLOWISH );
@ -1202,7 +1137,6 @@ void CHudSpectator::DrawOverviewEntities()
// see R_DrawSpriteModel
// draws players sprite
AngleVectors( ent->angles, right, up, NULL );
VectorCopy( ent->origin,origin );
@ -1238,9 +1172,9 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->End();
if( !ent->player )
continue;
// draw line under player icons
origin[2] *= zScale;
@ -1304,7 +1238,6 @@ void CHudSpectator::DrawOverviewEntities()
return;
// get current camera position and angle
if( m_pip->value == INSET_IN_EYE || g_iUser1 == OBS_IN_EYE )
{
V_GetInEyePos( g_iUser2, origin, angles );
@ -1321,9 +1254,7 @@ void CHudSpectator::DrawOverviewEntities()
else
V_GetChasePos( g_iUser2, NULL, origin, angles );
// draw camera sprite
x = origin[0];
y = origin[1];
z = origin[2];
@ -1334,7 +1265,6 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
gEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );
gEngfuncs.pTriAPI->Color4f( r, g, b, 1.0 );
AngleVectors( angles, forward, NULL, NULL );
@ -1361,11 +1291,8 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( x + left[0], y + left[1], ( z + left[2] ) * zScale );
gEngfuncs.pTriAPI->End ();
}
void CHudSpectator::DrawOverview()
{
// draw only in sepctator mode
@ -1383,6 +1310,7 @@ void CHudSpectator::DrawOverview()
DrawOverviewEntities();
CheckOverviewEntities();
}
void CHudSpectator::CheckOverviewEntities()
{
double time = gEngfuncs.GetClientTime();
@ -1413,9 +1341,15 @@ bool CHudSpectator::AddOverviewEntity( int type, struct cl_entity_s *ent, const
switch ( g_PlayerExtraInfo[ent->index].teamnumber )
{
// blue and red teams are swapped in CS and TFC
case 1 : hSprite = m_hsprPlayerBlue; break;
case 2 : hSprite = m_hsprPlayerRed; break;
default : hSprite = m_hsprPlayer; break;
case 1:
hSprite = m_hsprPlayerBlue;
break;
case 2:
hSprite = m_hsprPlayerRed;
break;
default:
hSprite = m_hsprPlayer;
break;
}
}
else
@ -1456,10 +1390,10 @@ bool CHudSpectator::AddOverviewEntityToList(HSPRITE sprite, cl_entity_t *ent, do
return false; // maximum overview entities reached
}
void CHudSpectator::CheckSettings()
{
// disallow same inset mode as main mode:
m_pip->value = (int)m_pip->value;
if( ( g_iUser1 < OBS_MAP_FREE ) && ( m_pip->value == INSET_CHASE_FREE || m_pip->value == INSET_IN_EYE ) )
@ -1509,8 +1443,6 @@ void CHudSpectator::CheckSettings()
SetCrosshair( 0, m_crosshairRect, 0, 0, 0 );
}
// if we are a real player on server don't allow inset window
// in First Person mode since this is our resticted forcecamera mode 2
// team number 3 = SPECTATOR see player.h
@ -1551,6 +1483,7 @@ int CHudSpectator::ToggleInset(bool allowOff)
return newInsetMode;
}
void CHudSpectator::Reset()
{
// Reset HUD
@ -1592,4 +1525,3 @@ void CHudSpectator::InitHUDData()
// reset HUD FOV
gHUD.m_iFOV = CVAR_GET_FLOAT( "default_fov" );
}

View File

@ -11,8 +11,6 @@
#include "cl_entity.h"
#define INSET_OFF 0
#define INSET_CHASE_FREE 1
#define INSET_IN_EYE 2
@ -21,8 +19,6 @@
#define MAX_SPEC_HUD_MESSAGES 8
#define OVERVIEW_TILE_SIZE 128 // don't change this
#define OVERVIEW_MAX_LAYERS 1
@ -30,7 +26,8 @@
// Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it )
//-----------------------------------------------------------------------------
typedef struct overviewInfo_s {
typedef struct overviewInfo_s
{
char map[64]; // cl.levelname or empty
vec3_t origin; // center of map
float zoom; // zoom of map images
@ -45,8 +42,8 @@ typedef struct overviewInfo_s {
int insetWindowWidth;
} overviewInfo_t;
typedef struct overviewEntity_s {
typedef struct overviewEntity_s
{
HSPRITE hSprite;
struct cl_entity_s * entity;
double killTime;
@ -100,13 +97,11 @@ public:
cvar_t *m_autoDirector;
cvar_t *m_pip;
qboolean m_chatEnabled;
vec3_t m_cameraOrigin; // a help camera
vec3_t m_cameraAngles; // and it's angles
private:
vec3_t m_vPlayerPos[MAX_PLAYERS];
HSPRITE m_hsprPlayerBlue;
@ -128,5 +123,4 @@ private:
int m_lastPrimaryObject;
int m_lastSecondaryObject;
};
#endif // SPECTATOR_H

View File

@ -50,5 +50,3 @@ int CHud::UpdateClientData(client_data_t *cdata, float time)
// return 1 if in anything in the client_data struct has been changed, 0 otherwise
return 1;
}

View File

@ -15,7 +15,6 @@
#include "camera.h"
#include "in_defs.h"
float CL_KeyState( kbutton_t *key );
extern "C"
@ -66,7 +65,6 @@ cvar_t *c_mindistance;
// pitch, yaw, dist
vec3_t cam_ofs;
// In third person
int cam_thirdperson;
int cam_mousemove; //true if we are moving the cam with the mouse, False if not
@ -87,7 +85,6 @@ void CAM_ToFirstPerson(void);
void CAM_StartDistance(void);
void CAM_EndDistance(void);
//-------------------------------------------------- Local Functions
float MoveToward( float cur, float goal, float maxspeed )
@ -118,7 +115,6 @@ float MoveToward( float cur, float goal, float maxspeed )
}
}
// bring cur back into range
if( cur < 0 )
cur += 360.0;
@ -128,7 +124,6 @@ float MoveToward( float cur, float goal, float maxspeed )
return cur;
}
//-------------------------------------------------- Gobal Functions
typedef struct
@ -163,11 +158,9 @@ void DLLEXPORT CAM_Think( void )
case CAM_COMMAND_TOTHIRDPERSON:
CAM_ToThirdPerson();
break;
case CAM_COMMAND_TOFIRSTPERSON:
CAM_ToFirstPerson();
break;
case CAM_COMMAND_NONE:
default:
break;
@ -175,7 +168,6 @@ void DLLEXPORT CAM_Think( void )
if( !cam_thirdperson )
return;
#ifdef LATER
if( cam_contain->value )
{
@ -183,10 +175,10 @@ void DLLEXPORT CAM_Think( void )
ext[0] = ext[1] = ext[2] = 0.0;
}
#endif
camAngles[PITCH] = cam_idealpitch->value;
camAngles[YAW] = cam_idealyaw->value;
dist = cam_idealdist->value;
//
//movement of the camera with the mouse
//
@ -194,23 +186,22 @@ void DLLEXPORT CAM_Think( void )
{
//get windows cursor position
GetCursorPos( &cam_mouse );
//check for X delta values and adjust accordingly
//eventually adjust YAW based on amount of movement
//don't do any movement of the cam using YAW/PITCH if we are zooming in/out the camera
if( !cam_distancemove )
{
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
if( cam_mouse.x>gEngfuncs.GetWindowCenterX() )
{
//if( ( camAngles[YAW] >= 225.0 ) || ( camAngles[YAW] < 135.0 ) )
if( camAngles[YAW] < c_maxyaw->value )
{
camAngles[ YAW ] += (CAM_ANGLE_MOVE)*((cam_mouse.x-gEngfuncs.GetWindowCenterX())/2);
camAngles[YAW] += CAM_ANGLE_MOVE * ( ( cam_mouse.x - gEngfuncs.GetWindowCenterX() ) / 2 );
}
if( camAngles[YAW] > c_maxyaw->value )
{
camAngles[YAW] = c_maxyaw->value;
}
}
@ -219,13 +210,11 @@ void DLLEXPORT CAM_Think( void )
//if( ( camAngles[YAW] <= 135.0 ) || ( camAngles[YAW] > 225.0 ) )
if( camAngles[YAW] > c_minyaw->value )
{
camAngles[ YAW ] -= (CAM_ANGLE_MOVE)* ((gEngfuncs.GetWindowCenterX()-cam_mouse.x)/2);
camAngles[YAW] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterX() - cam_mouse.x ) / 2 );
}
if( camAngles[YAW] < c_minyaw->value )
{
camAngles[YAW] = c_minyaw->value;
}
}
@ -236,7 +225,7 @@ void DLLEXPORT CAM_Think( void )
{
if( camAngles[PITCH] < c_maxpitch->value )
{
camAngles[PITCH] +=(CAM_ANGLE_MOVE)* ((cam_mouse.y-gEngfuncs.GetWindowCenterY())/2);
camAngles[PITCH] += CAM_ANGLE_MOVE * ( ( cam_mouse.y - gEngfuncs.GetWindowCenterY() ) / 2 );
}
if( camAngles[PITCH] > c_maxpitch->value )
{
@ -247,7 +236,7 @@ void DLLEXPORT CAM_Think( void )
{
if( camAngles[PITCH] > c_minpitch->value )
{
camAngles[PITCH] -= (CAM_ANGLE_MOVE)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2);
camAngles[PITCH] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterY() - cam_mouse.y ) / 2 );
}
if( camAngles[PITCH] < c_minpitch->value )
{
@ -257,7 +246,6 @@ void DLLEXPORT CAM_Think( void )
//set old mouse coordinates to current mouse coordinates
//since we are done with the mouse
if( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
{
cam_old_mouse_x = cam_mouse.x * flSensitivity;
@ -293,7 +281,6 @@ void DLLEXPORT CAM_Think( void )
camAngles[YAW] = 0;
dist = CAM_MIN_DIST;
}
}
else if( CL_KeyState( &cam_out ) )
dist += CAM_DIST_DELTA;
@ -315,7 +302,7 @@ void DLLEXPORT CAM_Think( void )
{
if( dist > c_mindistance->value )
{
dist -= (CAM_DIST_DELTA)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2);
dist -= CAM_DIST_DELTA * ( ( gEngfuncs.GetWindowCenterY() - cam_mouse.y ) / 2 );
}
if ( dist < c_mindistance->value )
{
@ -409,23 +396,69 @@ void DLLEXPORT CAM_Think( void )
extern void KeyDown( kbutton_t *b ); // HACK
extern void KeyUp( kbutton_t *b ); // HACK
void CAM_PitchUpDown(void) { KeyDown( &cam_pitchup ); }
void CAM_PitchUpUp(void) { KeyUp( &cam_pitchup ); }
void CAM_PitchDownDown(void) { KeyDown( &cam_pitchdown ); }
void CAM_PitchDownUp(void) { KeyUp( &cam_pitchdown ); }
void CAM_YawLeftDown(void) { KeyDown( &cam_yawleft ); }
void CAM_YawLeftUp(void) { KeyUp( &cam_yawleft ); }
void CAM_YawRightDown(void) { KeyDown( &cam_yawright ); }
void CAM_YawRightUp(void) { KeyUp( &cam_yawright ); }
void CAM_InDown(void) { KeyDown( &cam_in ); }
void CAM_InUp(void) { KeyUp( &cam_in ); }
void CAM_OutDown(void) { KeyDown( &cam_out ); }
void CAM_OutUp(void) { KeyUp( &cam_out ); }
void CAM_PitchUpDown( void )
{
KeyDown( &cam_pitchup );
}
void CAM_PitchUpUp( void )
{
KeyUp( &cam_pitchup );
}
void CAM_PitchDownDown( void )
{
KeyDown( &cam_pitchdown );
}
void CAM_PitchDownUp( void )
{
KeyUp( &cam_pitchdown );
}
void CAM_YawLeftDown( void )
{
KeyDown( &cam_yawleft );
}
void CAM_YawLeftUp( void )
{
KeyUp( &cam_yawleft );
}
void CAM_YawRightDown( void )
{
KeyDown( &cam_yawright );
}
void CAM_YawRightUp( void )
{
KeyUp( &cam_yawright );
}
void CAM_InDown( void )
{
KeyDown( &cam_in );
}
void CAM_InUp( void )
{
KeyUp( &cam_in );
}
void CAM_OutDown( void )
{
KeyDown( &cam_out );
}
void CAM_OutUp( void )
{
KeyUp( &cam_out );
}
void CAM_ToThirdPerson( void )
{
vec3_t viewangles;
#if !defined( _DEBUG )
if( gEngfuncs.GetMaxClients() > 1 )
{
@ -433,7 +466,6 @@ void CAM_ToThirdPerson(void)
return;
}
#endif
gEngfuncs.GetViewAngles( (float *)viewangles );
if( !cam_thirdperson )
@ -569,7 +601,6 @@ void CAM_EndMouseMove(void)
iMouseInUse = 0;
}
//----------------------------------------------------------
//routines to start the process of moving the cam in or out
//using the mouse

View File

@ -21,12 +21,12 @@
#include <windows.h>
#undef HSPRITE
#else
typedef struct point_s{
typedef struct point_s
{
int x;
int y;
} POINT;
#define GetCursorPos(x)
#define SetCursorPos(x,y)
#endif
#endif

View File

@ -11,6 +11,7 @@
// Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All
// rights reserved.
#include "hud.h"
#include "cl_util.h"
#include "camera.h"
@ -27,8 +28,6 @@ extern "C"
#include <string.h>
#include <ctype.h>
extern "C"
{
struct kbutton_s DLLEXPORT *KB_Find( const char *name );
@ -76,6 +75,7 @@ cvar_t *cl_yawspeed;
cvar_t *cl_pitchspeed;
cvar_t *cl_anglespeedkey;
cvar_t *cl_vsmoothing;
/*
===============================================================================
@ -97,7 +97,6 @@ state bit 2 is edge triggered on the down to up transition
===============================================================================
*/
kbutton_t in_mlook;
kbutton_t in_klook;
kbutton_t in_jlook;
@ -343,7 +342,8 @@ void KeyUp (kbutton_t *b)
if( c[0] )
k = atoi(c);
else
{ // typed manually at the console, assume for unsticking, so clear all
{
// typed manually at the console, assume for unsticking, so clear all
b->down[0] = b->down[1] = 0;
b->state = 4; // impulse up
return;
@ -377,25 +377,83 @@ Return 1 to allow engine to process the key, otherwise, act on it as needed
*/
int DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBinding )
{
return 1;
}
void IN_BreakDown( void ) { KeyDown( &in_break );};
void IN_BreakUp( void ) { KeyUp( &in_break ); };
void IN_KLookDown (void) {KeyDown(&in_klook);}
void IN_KLookUp (void) {KeyUp(&in_klook);}
void IN_JLookDown (void) {KeyDown(&in_jlook);}
void IN_JLookUp (void) {KeyUp(&in_jlook);}
void IN_MLookDown (void) {KeyDown(&in_mlook);}
void IN_UpDown(void) {KeyDown(&in_up);}
void IN_UpUp(void) {KeyUp(&in_up);}
void IN_DownDown(void) {KeyDown(&in_down);}
void IN_DownUp(void) {KeyUp(&in_down);}
void IN_LeftDown(void) {KeyDown(&in_left);}
void IN_LeftUp(void) {KeyUp(&in_left);}
void IN_RightDown(void) {KeyDown(&in_right);}
void IN_RightUp(void) {KeyUp(&in_right);}
void IN_BreakDown( void )
{
KeyDown( &in_break );
}
void IN_BreakUp( void )
{
KeyUp( &in_break );
}
void IN_KLookDown( void )
{
KeyDown( &in_klook );
}
void IN_KLookUp( void )
{
KeyUp( &in_klook );
}
void IN_JLookDown( void )
{
KeyDown( &in_jlook );
}
void IN_JLookUp( void )
{
KeyUp( &in_jlook );
}
void IN_MLookDown( void )
{
KeyDown( &in_mlook );
}
void IN_UpDown( void )
{
KeyDown( &in_up );
}
void IN_UpUp( void )
{
KeyUp( &in_up );
}
void IN_DownDown( void )
{
KeyDown( &in_down );
}
void IN_DownUp( void )
{
KeyUp( &in_down );
}
void IN_LeftDown( void )
{
KeyDown( &in_left );
}
void IN_LeftUp( void )
{
KeyUp( &in_left );
}
void IN_RightDown( void )
{
KeyDown( &in_right );
}
void IN_RightUp( void )
{
KeyUp( &in_right );
}
void IN_ForwardDown( void )
{
@ -420,10 +478,27 @@ void IN_BackUp(void)
KeyUp( &in_back );
gHUD.m_Spectator.HandleButtonsUp( IN_BACK );
}
void IN_LookupDown(void) {KeyDown(&in_lookup);}
void IN_LookupUp(void) {KeyUp(&in_lookup);}
void IN_LookdownDown(void) {KeyDown(&in_lookdown);}
void IN_LookdownUp(void) {KeyUp(&in_lookdown);}
void IN_LookupDown( void )
{
KeyDown( &in_lookup );
}
void IN_LookupUp( void )
{
KeyUp( &in_lookup );
}
void IN_LookdownDown( void )
{
KeyDown( &in_lookdown );
}
void IN_LookdownUp( void )
{
KeyUp( &in_lookdown );
}
void IN_MoveleftDown( void )
{
KeyDown( &in_moveleft );
@ -447,10 +522,26 @@ void IN_MoverightUp(void)
KeyUp( &in_moveright );
gHUD.m_Spectator.HandleButtonsUp( IN_MOVERIGHT );
}
void IN_SpeedDown(void) {KeyDown(&in_speed);}
void IN_SpeedUp(void) {KeyUp(&in_speed);}
void IN_StrafeDown(void) {KeyDown(&in_strafe);}
void IN_StrafeUp(void) {KeyUp(&in_strafe);}
void IN_SpeedDown( void )
{
KeyDown( &in_speed );
}
void IN_SpeedUp( void )
{
KeyUp( &in_speed );
}
void IN_StrafeDown( void )
{
KeyDown( &in_strafe );
}
void IN_StrafeUp( void )
{
KeyUp( &in_strafe );
}
// needs capture by hud/vgui also
extern void __CmdFunc_InputPlayerSpecial( void );
@ -462,33 +553,71 @@ void IN_Attack2Down(void)
gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 );
}
void IN_Attack2Up(void) {KeyUp(&in_attack2);}
void IN_Attack2Up( void )
{
KeyUp( &in_attack2 );
}
void IN_UseDown( void )
{
KeyDown( &in_use );
gHUD.m_Spectator.HandleButtonsDown( IN_USE );
}
void IN_UseUp (void) {KeyUp(&in_use);}
void IN_UseUp( void )
{
KeyUp( &in_use );
}
void IN_JumpDown( void )
{
KeyDown( &in_jump );
gHUD.m_Spectator.HandleButtonsDown( IN_JUMP );
}
void IN_JumpUp (void) {KeyUp(&in_jump);}
void IN_JumpUp( void )
{
KeyUp( &in_jump );
}
void IN_DuckDown( void )
{
KeyDown( &in_duck );
gHUD.m_Spectator.HandleButtonsDown( IN_DUCK );
}
void IN_DuckUp(void) {KeyUp(&in_duck);}
void IN_ReloadDown(void) {KeyDown(&in_reload);}
void IN_ReloadUp(void) {KeyUp(&in_reload);}
void IN_Alt1Down(void) {KeyDown(&in_alt1);}
void IN_Alt1Up(void) {KeyUp(&in_alt1);}
void IN_GraphDown(void) {KeyDown(&in_graph);}
void IN_GraphUp(void) {KeyUp(&in_graph);}
void IN_DuckUp( void )
{
KeyUp( &in_duck );
}
void IN_ReloadDown( void )
{
KeyDown( &in_reload );
}
void IN_ReloadUp( void )
{
KeyUp( &in_reload );
}
void IN_Alt1Down( void )
{
KeyDown( &in_alt1 );
}
void IN_Alt1Up( void )
{
KeyUp( &in_alt1 );
}
void IN_GraphDown( void )
{
KeyDown( &in_graph );
}
void IN_GraphUp( void )
{
KeyUp( &in_graph );
}
void IN_AttackDown( void )
{
@ -611,6 +740,7 @@ void CL_AdjustAngles ( float frametime, float *viewangles )
viewangles[YAW] += speed * cl_yawspeed->value * CL_KeyState( &in_left );
viewangles[YAW] = anglemod( viewangles[YAW] );
}
if( in_klook.state & 1 )
{
viewangles[PITCH] -= speed * cl_pitchspeed->value * CL_KeyState( &in_forward );
@ -717,7 +847,6 @@ void DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int activ
//
cmd->buttons = CL_ButtonBits( 1 );
// Using joystick?
if( in_joystick->value )
{
@ -778,7 +907,6 @@ int CL_ButtonBits( int bResetState )
bits |= IN_ATTACK;
}
if( in_duck.state & 3 )
{
bits |= IN_DUCK;

View File

@ -133,7 +133,6 @@ void IN_ToggleButtons( float forwardmove, float sidemove )
moveflags &= ~L;
in_moveleft.state &= ~BUTTON_DOWN;
}
}
void IN_ClientMoveEvent( float forwardmove, float sidemove )
@ -150,6 +149,7 @@ void IN_ClientLookEvent( float relyaw, float relpitch )
rel_yaw += relyaw;
rel_pitch += relpitch;
}
// Rotate camera and add move values to usercmd
void IN_Move( float frametime, usercmd_t *cmd )
{
@ -219,8 +219,11 @@ void IN_Move( float frametime, usercmd_t *cmd )
if( ac_movecount )
{
IN_ToggleButtons( ac_forwardmove / ac_movecount, ac_sidemove / ac_movecount );
if( ac_forwardmove ) cmd->forwardmove = ac_forwardmove * cl_forwardspeed->value / ac_movecount;
if( ac_sidemove ) cmd->sidemove = ac_sidemove * cl_sidespeed->value / ac_movecount;
if( ac_forwardmove )
cmd->forwardmove = ac_forwardmove * cl_forwardspeed->value / ac_movecount;
if( ac_sidemove )
cmd->sidemove = ac_sidemove * cl_sidespeed->value / ac_movecount;
if( ( in_speed.state & 1 ) && ( ac_sidemove || ac_forwardmove ) )
{
cmd->forwardmove *= cl_movespeedkey->value;
@ -282,6 +285,7 @@ void IN_Commands ( void )
void IN_Shutdown( void )
{
}
// Register cvars and reset data
void IN_Init( void )
{

View File

@ -187,7 +187,6 @@ void DLLEXPORT IN_DeactivateMouse (void)
{
if( restore_spi )
SystemParametersInfo( SPI_SETMOUSE, 0, originalmouseparms, 0 );
mouseactive = 0;
}
}
@ -410,7 +409,6 @@ void DLLEXPORT IN_Accumulate (void)
IN_ResetMouse();
}
}
}
/*
@ -494,7 +492,6 @@ void IN_StartupJoystick (void)
joy_advancedinit = 0;
}
/*
===========
RawValuePointer
@ -521,7 +518,6 @@ PDWORD RawValuePointer (int axis)
return &ji.dwXpos;
}
/*
===========
Joy_AdvancedUpdate_f
@ -529,7 +525,6 @@ Joy_AdvancedUpdate_f
*/
void Joy_AdvancedUpdate_f( void )
{
// called once by IN_ReadJoystick and by user whenever an update is needed
// cvars are now available
int i;
@ -593,7 +588,6 @@ void Joy_AdvancedUpdate_f (void)
}
}
/*
===========
IN_Commands
@ -609,7 +603,6 @@ void IN_Commands (void)
return;
}
// loop through the joystick buttons
// key a joystick event or auxillary event for higher number buttons for each state change
buttonstate = ji.dwButtons;
@ -663,7 +656,6 @@ void IN_Commands (void)
}
}
/*
===============
IN_ReadJoystick
@ -671,7 +663,6 @@ IN_ReadJoystick
*/
int IN_ReadJoystick( void )
{
memset( &ji, 0, sizeof(ji) );
ji.dwSize = sizeof(ji);
ji.dwFlags = joy_flags;
@ -698,7 +689,6 @@ int IN_ReadJoystick (void)
}
}
/*
===========
IN_JoyMove
@ -713,7 +703,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
gEngfuncs.GetViewAngles( (float *)viewangles );
// complete initialization if first time in
// this is needed as cvars are not available at initialization time
if( joy_advancedinit != 1 )
@ -797,14 +786,12 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
}
}
break;
case AxisSide:
if( fabs( fAxisValue ) > joy_sidethreshold->value )
{
cmd->sidemove += ( fAxisValue * joy_sidesensitivity->value ) * speed * cl_sidespeed->value;
}
break;
case AxisTurn:
if( ( in_strafe.state & 1 ) || ( lookstrafe->value && ( in_jlook.state & 1 ) ) )
{
@ -830,7 +817,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
}
}
break;
case AxisLook:
if( in_jlook.state & 1 )
{
@ -848,7 +834,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
}
}
break;
default:
break;
}
@ -861,7 +846,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
viewangles[PITCH] = -cl_pitchup->value;
gEngfuncs.SetViewAngles( (float *)viewangles );
}
/*

View File

@ -14,5 +14,4 @@ typedef struct kbutton_s
int down[2]; // key nums holding it down
int state; // low bit is down state
} kbutton_t;
#endif // !KBUTTONH

View File

@ -17,21 +17,20 @@
//
// generic menu handler
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include <string.h>
#include <stdio.h>
#define MAX_MENU_STRING 512
char g_szMenuString[MAX_MENU_STRING];
char g_szPrelocalisedMenuString[MAX_MENU_STRING];
int KB_ConvertString( char *in, char **ppout );
DECLARE_MESSAGE( m_Menu, ShowMenu );
DECLARE_MESSAGE( m_Menu, ShowMenu )
int CHudMenu::Init( void )
{
@ -70,7 +69,8 @@ int CHudMenu :: Draw( float flTime )
if( m_flShutoffTime > 0 )
{
if( m_flShutoffTime <= gHUD.m_flTime )
{ // times up, shutoff
{
// times up, shutoff
m_fMenuDisplayed = 0;
m_iFlags &= ~HUD_ACTIVE;
return 1;
@ -78,11 +78,7 @@ int CHudMenu :: Draw( float flTime )
}
// don't draw the menu if the scoreboard is being shown
// draw the menu, along the left-hand side of the screen
// count the number of newlines
int nlc = 0;
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
@ -126,7 +122,6 @@ void CHudMenu :: SelectMenuItem( int menu_item )
}
}
// Message handler for ShowMenu message
// takes four values:
// short: a bitfield of keys that are valid input
@ -156,13 +151,15 @@ int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
}
else
{ // append to the current menu string
{
// append to the current menu string
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen( g_szPrelocalisedMenuString ) );
}
g_szPrelocalisedMenuString[MAX_MENU_STRING - 1] = 0; // ensure null termination (strncat/strncpy does not)
if( !NeedMore )
{ // we have the whole string, so we can localise it now
{
// we have the whole string, so we can localise it now
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) );
// Swap in characters

View File

@ -42,7 +42,7 @@ int CHudMessage::Init(void)
Reset();
return 1;
};
}
int CHudMessage::VidInit( void )
{
@ -50,8 +50,7 @@ int CHudMessage::VidInit( void )
m_HUD_title_life = gHUD.GetSpriteIndex( "title_life" );
return 1;
};
}
void CHudMessage::Reset( void )
{
@ -62,7 +61,6 @@ void CHudMessage::Reset( void )
m_pGameTitle = NULL;
}
float CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float localTime )
{
float fadeTime = fadein + hold;
@ -113,7 +111,6 @@ int CHudMessage::XPosition( float x, int width, int totalWidth )
return xPos;
}
int CHudMessage::YPosition( float y, int height )
{
int yPos;
@ -137,7 +134,6 @@ int CHudMessage::YPosition( float y, int height )
return yPos;
}
void CHudMessage::MessageScanNextChar( void )
{
int srcRed, srcGreen, srcBlue, destRed = 0, destGreen = 0, destBlue = 0;
@ -156,7 +152,6 @@ void CHudMessage::MessageScanNextChar( void )
destRed = destGreen = destBlue = 0;
blend = m_parms.fadeBlend;
break;
case 2:
m_parms.charTime += m_parms.pMessage->fadein;
if( m_parms.charTime > m_parms.time )
@ -201,7 +196,6 @@ void CHudMessage::MessageScanNextChar( void )
}
}
void CHudMessage::MessageScanStart( void )
{
switch( m_parms.pMessage->effect )
@ -230,7 +224,6 @@ void CHudMessage::MessageScanStart( void )
if( m_parms.pMessage->effect == 1 && ( rand() % 100 ) < 10 )
m_parms.charTime = 1;
break;
case 2:
m_parms.fadeTime = (m_parms.pMessage->fadein * m_parms.length) + m_parms.pMessage->holdtime;
@ -274,7 +267,6 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
m_parms.length = length;
m_parms.totalHeight = ( m_parms.lines * gHUD.m_scrinfo.iCharHeight );
m_parms.y = YPosition( pMessage->y, m_parms.totalHeight );
pText = pMessage->pMessage;
@ -314,7 +306,6 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
}
}
int CHudMessage::Draw( float fTime )
{
int i, drawn;
@ -345,7 +336,6 @@ int CHudMessage::Draw( float fTime )
int x = XPosition( m_pGameTitle->x, fullWidth, fullWidth );
int y = YPosition( m_pGameTitle->y, fullHeight );
SPR_Set( gHUD.GetSprite( m_HUD_title_half ), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_title_half ) );
@ -416,7 +406,6 @@ int CHudMessage::Draw( float fTime )
return 1;
}
void CHudMessage::MessageAdd( const char *pName, float time )
{
int i, j;
@ -481,7 +470,6 @@ void CHudMessage::MessageAdd( const char *pName, float time )
}
}
int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -489,6 +477,7 @@ int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
char *pString = READ_STRING();
MessageAdd( pString, gHUD.m_flTime );
// Remember the time -- to fix up level transitions
m_parms.time = gHUD.m_flTime;
@ -499,7 +488,6 @@ int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudMessage::MsgFunc_GameTitle( const char *pszName, int iSize, void *pbuf )
{
m_pGameTitle = TextMessageGet( "GAMETITLE" );
@ -532,5 +520,4 @@ void CHudMessage::MessageAdd(client_textmessage_t * newMessage )
return;
}
}
}

View File

@ -58,7 +58,7 @@ int CHudOverview::Draw(float flTime)
// calculate player size on the overview
int x1, y1, x2, y2;
float v0[3]={0,0,0}, v1[3]={64,64,0};
float v0[3] = { 0.0f }, v1[3] = { 64.0f, 64.0f };
gEngfuncs.Overview_WorldToScreen( v0, &x1, &y1 );
gEngfuncs.Overview_WorldToScreen( v1, &x2, &y2 );
float scale = abs( x2 - x1 );
@ -146,7 +146,6 @@ int CHudOverview::Draw(float flTime)
DrawConsoleString( x, y + ( 1.1 * scale ), string );
}
}
#endif
return 1;
}
@ -160,4 +159,3 @@ void CHudOverview::InitHUDData()
//gEngfuncs.Overview_SetDrawOverview( 1 );
//gEngfuncs.Overview_SetDrawInset( 0 );
}

View File

@ -9,7 +9,6 @@
#define OVERVIEW_H
#pragma once
//-----------------------------------------------------------------------------
// Purpose: Handles the drawing of the top-down map and all the things on it
//-----------------------------------------------------------------------------
@ -26,6 +25,4 @@ private:
HSPRITE m_hsprPlayer;
HSPRITE m_hsprViewcone;
};
#endif // OVERVIEW_H

View File

@ -15,6 +15,7 @@
//
// parsemsg.cpp
//
typedef unsigned char byte;
#define true 1
@ -31,7 +32,6 @@ void BEGIN_READ( void *buf, int size )
gpBuf = (byte*)buf;
}
int READ_CHAR( void )
{
int c;
@ -86,7 +86,6 @@ int READ_WORD( void )
return READ_SHORT();
}
int READ_LONG( void )
{
int c;
@ -163,4 +162,3 @@ float READ_HIRESANGLE( void )
{
return (float)( READ_SHORT() * ( 360.0 / 65536 ) );
}

View File

@ -25,7 +25,6 @@
#include <string.h>
#include <stdio.h>
extern float *GetClientColor( int clientIndex );
#define MAX_LINES 5
@ -44,7 +43,7 @@ static float flScrollTime = 0; // the time at which the lines next scroll up
static int Y_START = 0;
static int line_height = 0;
DECLARE_MESSAGE( m_SayText, SayText );
DECLARE_MESSAGE( m_SayText, SayText )
int CHudSayText::Init( void )
{
@ -62,7 +61,6 @@ int CHudSayText :: Init( void )
return 1;
}
void CHudSayText::InitHUDData( void )
{
memset( g_szLineBuffer, 0, sizeof g_szLineBuffer );
@ -75,7 +73,6 @@ int CHudSayText :: VidInit( void )
return 1;
}
int ScrollTextUp( void )
{
ConsolePrint( g_szLineBuffer[0] ); // move the first line into the console buffer
@ -113,7 +110,8 @@ int CHudSayText :: Draw( float flTime )
ScrollTextUp();
}
else
{ // buffer is empty, just disable drawing of this section
{
// buffer is empty, just disable drawing of this section
m_iFlags &= ~HUD_ACTIVE;
}
}
@ -146,7 +144,6 @@ int CHudSayText :: Draw( float flTime )
y += line_height;
}
return 1;
}
@ -168,7 +165,7 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
// find an empty string slot
for( i = 0; i < MAX_LINES; i++ )
{
if ( ! *g_szLineBuffer[i] )
if( !( *g_szLineBuffer[i] ) )
break;
}
if( i == MAX_LINES )
@ -218,7 +215,6 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
else
Y_START = ScreenHeight - 45;
Y_START -= ( line_height * ( MAX_LINES + 1 ) );
}
void CHudSayText::EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
@ -227,7 +223,8 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
GetConsoleStringSize( g_szLineBuffer[line], &line_width, &line_height );
if( ( line_width + LINE_START ) > MAX_LINE_WIDTH )
{ // string is too long to fit on line
{
// string is too long to fit on line
// scan the string until we find what word is too long, and wrap the end of the sentence after the word
int length = LINE_START;
int tmp_len = 0;
@ -260,7 +257,8 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
length += tmp_len;
if( length > MAX_LINE_WIDTH )
{ // needs to be broken up
{
// needs to be broken up
if( !last_break )
last_break = x - 1;
@ -272,7 +270,7 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
{
for( j = 0; j < MAX_LINES; j++ )
{
if ( ! *g_szLineBuffer[j] )
if( !( *g_szLineBuffer[j] ) )
break;
}
if( j == MAX_LINES )

View File

@ -38,12 +38,12 @@ int g_iPlayerClass;
//#include "vgui_TeamFortressViewport.h"
DECLARE_COMMAND( m_Scoreboard, ShowScores );
DECLARE_COMMAND( m_Scoreboard, HideScores );
DECLARE_COMMAND( m_Scoreboard, ShowScores )
DECLARE_COMMAND( m_Scoreboard, HideScores )
DECLARE_MESSAGE( m_Scoreboard, ScoreInfo );
DECLARE_MESSAGE( m_Scoreboard, TeamInfo );
DECLARE_MESSAGE( m_Scoreboard, TeamScore );
DECLARE_MESSAGE( m_Scoreboard, ScoreInfo )
DECLARE_MESSAGE( m_Scoreboard, TeamInfo )
DECLARE_MESSAGE( m_Scoreboard, TeamScore )
int CHudScoreboard::Init( void )
{
@ -64,7 +64,6 @@ int CHudScoreboard :: Init( void )
return 1;
}
int CHudScoreboard::VidInit( void )
{
// Load sprites here
@ -105,7 +104,6 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
int SCOREBOARD_WIDTH = 320;
// Y positions
#define ROW_GAP 13
#define ROW_RANGE_MIN 15
@ -162,7 +160,6 @@ int CHudScoreboard :: Draw( float fTime )
gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
}
list_slot += 1.2;
ypos = ROW_RANGE_MIN + ( list_slot * ROW_GAP );
xpos = NAME_RANGE_MIN + xpos_rel;
@ -319,7 +316,9 @@ int CHudScoreboard :: Draw( float fTime )
return 1;
}
extern float *GetClientColor( int client );
// returns the ypos where it finishes drawing
int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, char *team )
{
@ -344,7 +343,8 @@ int CHudScoreboard :: DrawPlayers( int xpos_rel, float list_slot, int nameoffset
while( 1 )
{
// Find the top ranking player
int highest_frags = -99999; int lowest_deaths = 99999;
int highest_frags = -99999;
int lowest_deaths = 99999;
int best_player = 0;
for( int i = 1; i < MAX_PLAYERS; i++ )
@ -383,11 +383,13 @@ int CHudScoreboard :: DrawPlayers( int xpos_rel, float list_slot, int nameoffset
if( best_player == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime )
{
if( pl_info->thisplayer )
{ // green is the suicide color? i wish this could do grey...
{
// green is the suicide color? i wish this could do grey...
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 80, 155, 0, 70 );
}
else
{ // Highlight the killers name - overlay the background in red, then draw the score text over it
{
// Highlight the killers name - overlay the background in red, then draw the score text over it
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 255, 0, 0, ( (float)15 * (float)( m_fLastKillTime - gHUD.m_flTime ) ) );
}
}
@ -443,7 +445,6 @@ int CHudScoreboard :: DrawPlayers( int xpos_rel, float list_slot, int nameoffset
return list_slot;
}
void CHudScoreboard::GetAllPlayersInfo( void )
{
for( int i = 1; i < MAX_PLAYERS; i++ )
@ -490,12 +491,12 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb
short cl = READ_BYTE();
if( cl > 0 && cl <= MAX_PLAYERS )
{ // set the players team
{
// set the players team
strncpy( g_PlayerExtraInfo[cl].teamname, READ_STRING(), MAX_TEAM_NAME );
}
// rebuild the list of teams
// clear out player counts from teams
for( i = 1; i <= m_iNumTeams; i++ )
{
@ -524,7 +525,8 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb
}
if( j > m_iNumTeams )
{ // they aren't in a listed team, so make a new one
{
// they aren't in a listed team, so make a new one
// search through for an empty team slot
for( j = 1; j <= m_iNumTeams; j++ )
{
@ -592,8 +594,6 @@ void CHudScoreboard :: DeathMsg( int killer, int victim )
}
}
void CHudScoreboard::UserCmd_ShowScores( void )
{
m_iShowscoresHeld = TRUE;

View File

@ -15,6 +15,7 @@
//
// $NoKeywords: $
//=============================================================================
#include <windows.h>
#include <dsound.h>
#include <mmsystem.h>

View File

@ -15,6 +15,7 @@
//
// status_icons.cpp
//
#include "hud.h"
#include "cl_util.h"
#include "const.h"
@ -25,7 +26,7 @@
#include "parsemsg.h"
#include "event_api.h"
DECLARE_MESSAGE( m_StatusIcons, StatusIcon );
DECLARE_MESSAGE( m_StatusIcons, StatusIcon )
int CHudStatusIcons::Init( void )
{
@ -40,7 +41,6 @@ int CHudStatusIcons::Init( void )
int CHudStatusIcons::VidInit( void )
{
return 1;
}

View File

@ -26,8 +26,8 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_StatusBar, StatusText );
DECLARE_MESSAGE( m_StatusBar, StatusValue );
DECLARE_MESSAGE( m_StatusBar, StatusText )
DECLARE_MESSAGE( m_StatusBar, StatusValue )
#define STATUSBAR_ID_LINE 1
@ -51,7 +51,6 @@ int CHudStatusBar :: Init( void )
int CHudStatusBar::VidInit( void )
{
// Load sprites here
return 1;
}
@ -74,8 +73,7 @@ void CHudStatusBar :: Reset( void )
void CHudStatusBar::ParseStatusString( int line_num )
{
// localise string first
char szBuffer[MAX_STATUSTEXT_LENGTH];
memset( szBuffer, 0, sizeof szBuffer );
char szBuffer[MAX_STATUSTEXT_LENGTH] = {0};
gHUD.m_TextMessage.LocaliseTextString( m_szStatusText[line_num], szBuffer, MAX_STATUSTEXT_LENGTH );
// parse m_szStatusText & m_iStatusValues into m_szStatusBar
@ -96,7 +94,8 @@ void CHudStatusBar :: ParseStatusString( int line_num )
int index = atoi( src );
// should we draw this line?
if( ( index >= 0 && index < MAX_STATUSBAR_VALUES ) && ( m_iStatusValues[index] != 0 ) )
{ // parse this line and append result to the status bar
{
// parse this line and append result to the status bar
while ( *src >= '0' && *src <= '9' )
src++;
@ -107,7 +106,8 @@ void CHudStatusBar :: ParseStatusString( int line_num )
while( *src != '\n' && *src != 0 )
{
if( *src != '%' )
{ // just copy the character
{
// just copy the character
*dst = *src;
dst++, src++;
}
@ -148,7 +148,6 @@ void CHudStatusBar :: ParseStatusString( int line_num )
{
strcpy( szRepString, "******" );
}
break;
case 'i': // number
sprintf( szRepString, "%d", indexval );

View File

@ -199,7 +199,8 @@ void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
sclp = 1.0 - t;
sclq = t;
}
for (i = 0; i < 4; i++) {
for( i = 0; i < 4; i++ )
{
qt[i] = sclp * p[i] + sclq * q[i];
}
}

View File

@ -36,5 +36,4 @@ void MatrixCopy( float in[3][4], float out[3][4] );
void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] );
void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt );
void AngleQuaternion( float *angles, vec4_t quaternion );
#endif // STUDIO_UTIL_H

View File

@ -26,8 +26,7 @@
#include <stdio.h>
#include "parsemsg.h"
DECLARE_MESSAGE( m_TextMessage, TextMsg );
DECLARE_MESSAGE( m_TextMessage, TextMsg )
int CHudTextMessage::Init( void )
{
@ -38,7 +37,7 @@ int CHudTextMessage::Init(void)
Reset();
return 1;
};
}
// Searches through the string for any msg names (indicated by a '#')
// any found are looked up in titles.txt and the new message substituted
@ -122,7 +121,8 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
return (char*)clmsg->pMessage;
}
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;
}
}
@ -187,18 +187,15 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
CenterPrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer
sprintf( psz + 1, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTTALK:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
break;
case HUD_PRINTCONSOLE:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
ConsolePrint( ConvertCRtoNL( psz ) );

View File

@ -362,7 +362,6 @@ enum
// Silent Spy Feign
#define TF_SPY_SILENTDIE 199
/*==================================================*/
/* Defines for the ENGINEER's Building ability */
/*==================================================*/
@ -1382,8 +1381,5 @@ public:
void Spawn( void );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
};
#endif // TF_DEFS_ONLY
#endif // __TF_DEFS_H

View File

@ -26,7 +26,6 @@
DECLARE_MESSAGE( m_Train, Train )
int CHudTrain::Init( void )
{
HOOK_MESSAGE( Train );
@ -36,14 +35,14 @@ int CHudTrain::Init(void)
gHUD.AddHudElem( this );
return 1;
};
}
int CHudTrain::VidInit( void )
{
m_hSprite = 0;
return 1;
};
}
int CHudTrain::Draw( float fTime )
{
@ -62,13 +61,11 @@ int CHudTrain::Draw(float fTime)
x = ScreenWidth / 3 + SPR_Width( m_hSprite, 0 ) / 4;
SPR_DrawAdditive( m_iPos - 1, x, y, NULL );
}
return 1;
}
int CHudTrain::MsgFunc_Train( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );

View File

@ -21,7 +21,7 @@ extern "C"
{
void DLLEXPORT HUD_DrawNormalTriangles( void );
void DLLEXPORT HUD_DrawTransparentTriangles( void );
};
}
//#define TEST_IT
#if defined( TEST_IT )
@ -86,7 +86,6 @@ void Draw_Triangles( void )
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
}
#endif
/*
@ -98,9 +97,7 @@ Non-transparent triangles-- add them here
*/
void DLLEXPORT HUD_DrawNormalTriangles( void )
{
gHUD.m_Spectator.DrawOverview();
#if defined( TEST_IT )
// Draw_Triangles();
#endif
@ -115,7 +112,6 @@ Render any triangles with transparent rendermode needs here
*/
void DLLEXPORT HUD_DrawTransparentTriangles( void )
{
#if defined( TEST_IT )
// Draw_Triangles();
#endif

View File

@ -92,7 +92,6 @@ float VectorNormalize (float *v)
}
return length;
}
void VectorInverse( float *v )
@ -130,4 +129,3 @@ HSPRITE LoadSprite(const char *pszName)
return SPR_Load( sz );
}

View File

@ -109,11 +109,16 @@ public:
return Vec2;
}
inline float Length2D(void) const { return (float)sqrt(x*x + y*y); }
inline float Length2D( void ) const
{
return (float)sqrt( x * x + y * y );
}
// Members
vec_t x, y, z;
};
inline Vector operator*( float fl, const Vector& v ) { return v * fl; }
inline float DotProduct( const Vector& a, const Vector& b) { return( a.x * b.x + a.y * b.y + a.z * b.z ); }
inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x ); }

View File

@ -121,6 +121,7 @@ float v_idlescale; // used by TFC for concussion grenade effect
void V_NormalizeAngles( float *angles )
{
int i;
// Normalize angles
for( i = 0; i < 3; i++ )
{
@ -135,7 +136,6 @@ void V_NormalizeAngles( float *angles )
}
}
===================
V_InterpolateAngles
@ -183,7 +183,6 @@ float V_CalcBob ( struct ref_params_s *pparams )
static float lasttime;
vec3_t vel;
if( pparams->onground == -1 ||
pparams->time == lasttime )
{
@ -216,7 +215,6 @@ float V_CalcBob ( struct ref_params_s *pparams )
bob = min( bob, 4 );
bob = max( bob, -7 );
return bob;
}
/*
@ -260,7 +258,6 @@ typedef struct pitchdrift_s
static pitchdrift_t pd;
/*
===============
V_DriftPitch
@ -317,7 +314,6 @@ void V_AddIdle ( struct ref_params_s *pparams )
pparams->viewangles[YAW] += v_idlescale * sin( pparams->time * v_iyaw_cycle.value ) * v_iyaw_level.value;
}
/*
==============
V_CalcViewRoll
@ -347,7 +343,6 @@ void V_CalcViewRoll ( struct ref_params_s *pparams )
}
}
/*
==================
V_CalcIntermissionRefdef
@ -444,7 +439,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
// refresh position
VectorCopy( pparams->simorg, pparams->vieworg );
pparams->vieworg[2] += ( bob );
pparams->vieworg[2] += bob ;
VectorAdd( pparams->vieworg, pparams->viewheight, pparams->vieworg );
if( pparams->health <= 0 )
@ -463,7 +458,6 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
// dissapear when viewed with the eye exactly on it.
// FIXME, we send origin at 1/128 now, change this?
// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
pparams->vieworg[0] += 1.0 / 32;
pparams->vieworg[1] += 1.0 / 32;
pparams->vieworg[2] += 1.0 / 32;
@ -587,7 +581,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
// Use predicted origin as view origin.
VectorCopy( pparams->simorg, view->origin );
view->origin[2] += ( waterOffset );
view->origin[2] += waterOffset;
VectorAdd( view->origin, pparams->viewheight, view->origin );
// Let the viewmodel shake at about 10% of the amplitude
@ -643,6 +637,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
float steptime;
steptime = pparams->time - lasttime;
if( steptime < 0 )
//FIXME I_Error( "steptime < 0" );
steptime = 0;
@ -660,7 +655,6 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
oldz = pparams->simorg[2];
}
#endif
{
static float lastorg[3];
vec3_t delta;
@ -722,7 +716,6 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
VectorAdd( pparams->simorg, delta, pparams->simorg );
VectorAdd( pparams->vieworg, delta, pparams->vieworg );
VectorAdd( view->origin, delta, view->origin );
}
}
}
@ -824,7 +817,6 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
{
finalAngle[i] = endAngle[i];
}
}
NormalizeAngles( finalAngle );
@ -969,7 +961,6 @@ void V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)
newOrigin[2] += 2; //laying on ground
else
newOrigin[2] += 17; // head level of living player
}
else
newOrigin[2]+= 8; // object, tricky, must be above bomb in CS
@ -982,7 +973,6 @@ void V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)
if( flags & DRC_FLAG_FACEPLAYER )
newAngle[1] += 180.0f;
newAngle[0] += 12.5f * dfactor; // lower angle if dramatic
// if final scene (bomb), show from real high pos
@ -1031,7 +1021,7 @@ float MaxAngleBetweenAngles( float * a1, float * a2 )
void V_GetDoubleTargetsCam( cl_entity_t *ent1, cl_entity_t *ent2, float *angle, float *origin )
{
float newAngle[3]; float newOrigin[3]; float tempVec[3];
float newAngle[3], newOrigin[3], tempVec[3];
int flags = gHUD.m_Spectator.m_iObserverFlags;
@ -1111,14 +1101,10 @@ void V_GetDoubleTargetsCam(cl_entity_t * ent1, cl_entity_t * ent2,float * angle
/* take middle between two viewangles
InterpolateAngles( newAngle, tempVec, newAngle, 0.5f ); */
}
void V_GetDirectedChasePosition(cl_entity_t *ent1, cl_entity_t *ent2,float *angle, float *origin)
{
if( v_resetCamera )
{
v_lastDistance = 4096.0f;
@ -1178,7 +1164,7 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
if( target )
{
ent = gEngfuncs.GetEntityByIndex( target );
};
}
if( !ent )
{
@ -1188,8 +1174,6 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
return;
}
if( gHUD.m_Spectator.m_autoDirector->value )
{
if( g_iUser3 )
@ -1209,7 +1193,6 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
else
VectorCopy( cl_angles, angles );
VectorCopy( ent->origin, origin );
origin[2] += 28; // DEFAULT_VIEWHEIGHT - some offset
@ -1225,7 +1208,6 @@ void V_ResetChaseCam()
v_resetCamera = true;
}
void V_GetInEyePos( int target, float *origin, float *angles )
{
if( !target )
@ -1236,7 +1218,6 @@ void V_GetInEyePos(int target, float * origin, float * angles )
return;
};
cl_entity_t *ent = gEngfuncs.GetEntityByIndex( target );
if( !ent )
@ -1274,7 +1255,6 @@ void V_GetMapFreePosition( float * cl_angles, float * origin, float * angles )
zScaledTarget[1] = gHUD.m_Spectator.m_mapOrigin[1];
zScaledTarget[2] = gHUD.m_Spectator.m_mapOrigin[2] * ( ( 90.0f - angles[0] ) / 90.0f );
AngleVectors( angles, forward, NULL, NULL );
VectorNormalize( forward );
@ -1327,8 +1307,8 @@ void V_GetMapChasePosition(int target, float * cl_angles, float * origin, float
int V_FindViewModelByWeaponModel( int weaponindex )
{
static char * modelmap[][2] = {
static char *modelmap[][2] =
{
{ "models/p_crossbow.mdl", "models/v_crossbow.mdl" },
{ "models/p_crowbar.mdl", "models/v_crowbar.mdl" },
{ "models/p_egon.mdl", "models/v_egon.mdl" },
@ -1344,7 +1324,8 @@ int V_FindViewModelByWeaponModel(int weaponindex)
{ "models/p_tripmine.mdl", "models/v_tripmine.mdl" },
{ "models/p_satchel_radio.mdl", "models/v_satchel_radio.mdl" },
{ "models/p_satchel.mdl", "models/v_satchel.mdl" },
{ NULL, NULL } };
{ NULL, NULL }
};
struct model_s * weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
@ -1366,10 +1347,8 @@ int V_FindViewModelByWeaponModel(int weaponindex)
}
else
return 0;
}
/*
==================
V_CalcSpectatorRefdef
@ -1425,7 +1404,6 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
if( lastWeaponModelIndex != ent->curstate.weaponmodel )
{
// weapon model changed
lastWeaponModelIndex = ent->curstate.weaponmodel;
lastViewModelIndex = V_FindViewModelByWeaponModel( lastWeaponModelIndex );
if( lastViewModelIndex )
@ -1466,27 +1444,27 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
if( pparams->nextView == 0 )
{
// first renderer cycle, full screen
switch( g_iUser1 )
{
case OBS_CHASE_LOCKED: V_GetChasePos( g_iUser2, NULL, v_origin, v_angles );
case OBS_CHASE_LOCKED:
V_GetChasePos( g_iUser2, NULL, v_origin, v_angles );
break;
case OBS_CHASE_FREE: V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
case OBS_CHASE_FREE:
V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
case OBS_ROAMING : VectorCopy (v_cl_angles, v_angles);
case OBS_ROAMING:
VectorCopy( v_cl_angles, v_angles );
VectorCopy( v_sim_org, v_origin );
break;
case OBS_IN_EYE : V_CalcNormalRefdef ( pparams );
case OBS_IN_EYE:
V_CalcNormalRefdef( pparams );
break;
case OBS_MAP_FREE : pparams->onlyClientDraw = true;
case OBS_MAP_FREE:
pparams->onlyClientDraw = true;
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
break;
case OBS_MAP_CHASE : pparams->onlyClientDraw = true;
case OBS_MAP_CHASE:
pparams->onlyClientDraw = true;
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
}
@ -1495,12 +1473,10 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
pparams->nextView = 1; // force a second renderer view
gHUD.m_Spectator.m_iDrawCycle = 0;
}
else
{
// second renderer cycle, inset window
// set inset parameters
pparams->viewport[0] = XRES( gHUD.m_Spectator.m_OverviewData.insetWindowX ); // change viewport to inset window
pparams->viewport[1] = YRES( gHUD.m_Spectator.m_OverviewData.insetWindowY );
@ -1511,23 +1487,22 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
// override some settings in certain modes
switch( (int)gHUD.m_Spectator.m_pip->value )
{
case INSET_CHASE_FREE : V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
case INSET_CHASE_FREE:
V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
case INSET_IN_EYE : V_CalcNormalRefdef ( pparams );
case INSET_IN_EYE:
V_CalcNormalRefdef( pparams );
break;
case INSET_MAP_FREE : pparams->onlyClientDraw = true;
case INSET_MAP_FREE:
pparams->onlyClientDraw = true;
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
break;
case INSET_MAP_CHASE : pparams->onlyClientDraw = true;
case INSET_MAP_CHASE:
pparams->onlyClientDraw = true;
if( g_iUser1 == OBS_ROAMING )
V_GetMapChasePosition( 0, v_cl_angles, v_origin, v_angles );
else
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
break;
}
@ -1538,11 +1513,8 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
VectorCopy( v_cl_angles, pparams->cl_viewangles );
VectorCopy( v_angles, pparams->viewangles )
VectorCopy( v_origin, pparams->vieworg );
}
void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
{
// intermission / finale rendering
@ -1558,7 +1530,6 @@ void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
{
V_CalcNormalRefdef( pparams );
}
/*
// Example of how to overlay the whole screen with red at 50 % alpha
#define SF_TEST
@ -1614,7 +1585,6 @@ V_Init
*/
void V_Init( void )
{
scr_ofsx = gEngfuncs.pfnRegisterVariable( "scr_ofsx","0", 0 );
scr_ofsy = gEngfuncs.pfnRegisterVariable( "scr_ofsy","0", 0 );
scr_ofsz = gEngfuncs.pfnRegisterVariable( "scr_ofsz","0", 0 );
@ -1629,7 +1599,6 @@ void V_Init (void)
cl_chasedist = gEngfuncs.pfnRegisterVariable( "cl_chasedist","112", 0 );
}
//#define TRACE_TEST
#if defined( TRACE_TEST )
@ -1709,5 +1678,4 @@ void V_Move( int mx, int my )
hitent = -1;
}
}
#endif

View File

@ -11,5 +11,4 @@
void V_StartPitchDrift( void );
void V_StopPitchDrift( void );
#endif // !VIEWH

View File

@ -119,7 +119,7 @@ enum
AMBIENT_SKY, // wind
AMBIENT_SLIME, // never used in quake
AMBIENT_LAVA, // never used in quake
NUM_AMBIENTS, // automatic ambient sounds
NUM_AMBIENTS // automatic ambient sounds
};
//

View File

@ -699,7 +699,7 @@ enum
kRenderGlow, // src*a+dest -- No Z buffer checks
kRenderTransAlpha, // src*srca+dest*(1-srca)
kRenderTransAdd, // src*a+dest
kRenderWorldGlow, // Same as kRenderGlow but not fixed size in screen space
kRenderWorldGlow // Same as kRenderGlow but not fixed size in screen space
};
enum
@ -724,7 +724,7 @@ enum
kRenderFxDeadPlayer, // kRenderAmt is the player index
kRenderFxExplode, // Scale up really big!
kRenderFxGlowShell, // Glowing Shell
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
kRenderFxClampMinScale // Keep this sprite from getting very small (SPRITES only!)
};
typedef unsigned int func_t;

View File

@ -19,7 +19,7 @@
typedef enum
{
TRI_FRONT = 0,
TRI_NONE = 1,
TRI_NONE = 1
} TRICULLSTYLE;
#define TRI_API_VERSION 1

View File

@ -65,8 +65,8 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
gman.cpp \
h_ai.cpp \
h_battery.cpp \
h_cine.cpp \
h_cycler.cpp \
h_cine.cpp \
h_export.cpp \
handgrenade.cpp \
hassassin.cpp \
@ -114,8 +114,8 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
subs.cpp \
talkmonster.cpp \
teamplay_gamerules.cpp \
tempmonster.cpp \
tentacle.cpp \
tempentity.cpp \
triggers.cpp \
tripmine.cpp \
turret.cpp \

View File

@ -16,7 +16,6 @@
#ifndef ACTIVITY_H
#define ACTIVITY_H
typedef enum {
ACT_RESET = 0, // Set m_Activity to this invalid value to force a reset to m_IdealActivity
ACT_IDLE = 1,
@ -94,16 +93,14 @@ typedef enum {
ACT_FLINCH_LEFTARM,
ACT_FLINCH_RIGHTARM,
ACT_FLINCH_LEFTLEG,
ACT_FLINCH_RIGHTLEG,
ACT_FLINCH_RIGHTLEG
} Activity;
typedef struct {
typedef struct
{
int type;
char *name;
} activity_map_t;
extern activity_map_t activity_map[];
#endif //ACTIVITY_H

View File

@ -14,6 +14,7 @@
****/
//=========================================================
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -55,7 +56,7 @@ TYPEDESCRIPTION CFlockingFlyerFlock::m_SaveData[] =
DEFINE_FIELD( CFlockingFlyerFlock, m_flFlockRadius, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CFlockingFlyerFlock, CBaseMonster );
IMPLEMENT_SAVERESTORE( CFlockingFlyerFlock, CBaseMonster )
//=========================================================
//=========================================================
@ -106,8 +107,9 @@ public:
float m_flAlertTime;
float m_flFlockNextSoundTime;
};
LINK_ENTITY_TO_CLASS( monster_flyer, CFlockingFlyer );
LINK_ENTITY_TO_CLASS( monster_flyer_flock, CFlockingFlyerFlock );
LINK_ENTITY_TO_CLASS( monster_flyer, CFlockingFlyer )
LINK_ENTITY_TO_CLASS( monster_flyer_flock, CFlockingFlyerFlock )
TYPEDESCRIPTION CFlockingFlyer::m_SaveData[] =
{
@ -125,7 +127,7 @@ TYPEDESCRIPTION CFlockingFlyer::m_SaveData[] =
//DEFINE_FIELD( CFlockingFlyer, m_flFlockNextSoundTime, FIELD_TIME ), // don't need to save
};
IMPLEMENT_SAVERESTORE( CFlockingFlyer, CBaseMonster );
IMPLEMENT_SAVERESTORE( CFlockingFlyer, CBaseMonster )
//=========================================================
//=========================================================
@ -163,7 +165,6 @@ void CFlockingFlyerFlock :: Precache( )
PrecacheFlockSounds();
}
void CFlockingFlyerFlock::PrecacheFlockSounds( void )
{
PRECACHE_SOUND( "boid/boid_alert1.wav" );
@ -250,8 +251,12 @@ void CFlockingFlyer :: MakeSound( void )
// make agitated sounds
switch ( RANDOM_LONG( 0, 1 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "boid/boid_alert1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "boid/boid_alert2.wav", 1, ATTN_NORM ); break;
case 0:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "boid/boid_alert1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "boid/boid_alert2.wav", 1, ATTN_NORM );
break;
}
return;
@ -260,8 +265,12 @@ void CFlockingFlyer :: MakeSound( void )
// make normal sound
switch( RANDOM_LONG( 0, 1 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "boid/boid_idle1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "boid/boid_idle2.wav", 1, ATTN_NORM ); break;
case 0:
EMIT_SOUND( ENT(pev), CHAN_WEAPON, "boid/boid_idle1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT(pev), CHAN_WEAPON, "boid/boid_idle2.wav", 1, ATTN_NORM );
break;
}
}
@ -341,9 +350,12 @@ void CFlockingFlyer :: BoidAdvanceFrame ( )
float flapspeed = ( pev->speed - pev->armorvalue ) / AFLOCK_ACCELERATE;
pev->armorvalue = pev->armorvalue * .8 + pev->speed * .2;
if (flapspeed < 0) flapspeed = -flapspeed;
if (flapspeed < 0.25) flapspeed = 0.25;
if (flapspeed > 1.9) flapspeed = 1.9;
if( flapspeed < 0 )
flapspeed = -flapspeed;
if( flapspeed < 0.25 )
flapspeed = 0.25;
if( flapspeed > 1.9 )
flapspeed = 1.9;
pev->framerate = flapspeed;
@ -386,7 +398,6 @@ void CFlockingFlyer :: Start( void )
{
SetThink( &CFlockingFlyer::FlockFollowerThink );
}
/*
Vector vecTakeOff;
vecTakeOff = Vector( 0, 0, 0 );
@ -397,7 +408,6 @@ void CFlockingFlyer :: Start( void )
pev->velocity = vecTakeOff;
pev->speed = pev->velocity.Length();
pev->sequence = 0;
*/
@ -456,7 +466,7 @@ void CFlockingFlyer :: SpreadFlock( )
if( pList != this && ( pev->origin - pList->pev->origin ).Length() <= AFLOCK_TOO_CLOSE )
{
// push the other away
vecDir = ( pList->pev->origin - pev->origin );
vecDir = pList->pev->origin - pev->origin;
vecDir = vecDir.Normalize();
// store the magnitude of the other boid's velocity, and normalize it so we
@ -485,10 +495,10 @@ void CFlockingFlyer :: SpreadFlock2 ( )
{
if( pList != this && ( pev->origin - pList->pev->origin ).Length() <= AFLOCK_TOO_CLOSE )
{
vecDir = ( pev->origin - pList->pev->origin );
vecDir = pev->origin - pList->pev->origin;
vecDir = vecDir.Normalize();
pev->velocity = (pev->velocity + vecDir);
pev->velocity = pev->velocity + vecDir;
}
pList = pList->m_pSquadNext;
@ -549,7 +559,6 @@ BOOL CFlockingFlyer :: FPathBlocked( )
return fBlocked;
}
//=========================================================
// Leader boids use this think every tenth
//=========================================================
@ -562,7 +571,6 @@ void CFlockingFlyer :: FlockLeaderThink( void )
float flLeftSide;
float flRightSide;
pev->nextthink = gpGlobals->time + 0.1;
UTIL_MakeVectors( pev->angles );
@ -600,7 +608,7 @@ void CFlockingFlyer :: FlockLeaderThink( void )
flRightSide = vecDist.Length();
UTIL_TraceLine( pev->origin, pev->origin - gpGlobals->v_right * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
vecDist = (tr.vecEndPos - pev->origin);
vecDist = tr.vecEndPos - pev->origin;
flLeftSide = vecDist.Length();
// turn right if more clearance on right side
@ -761,11 +769,11 @@ void CFlockingFlyer :: FlockFollowerThink( void )
// measure clearance on left and right to pick the best dir to turn
UTIL_TraceLine( pev->origin, pev->origin + gpGlobals->v_right * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
vecDist = (tr.vecEndPos - pev->origin);
vecDist = tr.vecEndPos - pev->origin;
flRightSide = vecDist.Length();
UTIL_TraceLine( pev->origin, pev->origin - gpGlobals->v_right * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
vecDist = (tr.vecEndPos - pev->origin);
vecDist = tr.vecEndPos - pev->origin;
flLeftSide = vecDist.Length();
// slide right if more clearance on right side
@ -786,7 +794,6 @@ void CFlockingFlyer :: FlockFollowerThink( void )
m_fCourseAdjust = FALSE;
*/
//=========================================================
//
// SquadUnlink(), Unlink the squad pointers.
@ -813,6 +820,7 @@ void CFlockingFlyer :: SquadAdd( CFlockingFlyer *pAdd )
m_pSquadNext = pAdd;
pAdd->m_pSquadLeader = this;
}
//=========================================================
//
// SquadRemove(), remove pRemove from my squad.
@ -872,6 +880,7 @@ void CFlockingFlyer :: SquadRemove( CFlockingFlyer *pRemove )
else
SquadDisband();
}
//=========================================================
//
// SquadCount(), return the number of members of this squad

View File

@ -32,7 +32,7 @@
enum
{
SCHED_AGRUNT_SUPPRESS = LAST_COMMON_SCHEDULE + 1,
SCHED_AGRUNT_THREAT_DISPLAY,
SCHED_AGRUNT_THREAT_DISPLAY
};
//=========================================================
@ -41,7 +41,7 @@ enum
enum
{
TASK_AGRUNT_SETUP_HIDE_ATTACK = LAST_COMMON_TASK + 1,
TASK_AGRUNT_GET_PATH_TO_ENEMY_CORPSE,
TASK_AGRUNT_GET_PATH_TO_ENEMY_CORPSE
};
int iAgruntMuzzleFlash;
@ -64,8 +64,6 @@ int iAgruntMuzzleFlash;
#define AGRUNT_AE_LEFT_PUNCH ( 12 )
#define AGRUNT_AE_RIGHT_PUNCH ( 13 )
#define AGRUNT_MELEE_DIST 100
class CAGrunt : public CSquadMonster
@ -98,7 +96,7 @@ public:
int IRelationship( CBaseEntity *pTarget );
void StopTalking( void );
BOOL ShouldSpeak( void );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
@ -122,7 +120,8 @@ public:
float m_flNextWordTime;
int m_iLastWord;
};
LINK_ENTITY_TO_CLASS( monster_alien_grunt, CAGrunt );
LINK_ENTITY_TO_CLASS( monster_alien_grunt, CAGrunt )
TYPEDESCRIPTION CAGrunt::m_SaveData[] =
{
@ -134,7 +133,7 @@ TYPEDESCRIPTION CAGrunt::m_SaveData[] =
DEFINE_FIELD( CAGrunt, m_iLastWord, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CAGrunt, CSquadMonster );
IMPLEMENT_SAVERESTORE( CAGrunt, CSquadMonster )
const char *CAGrunt::pAttackHitSounds[] =
{
@ -207,10 +206,7 @@ int CAGrunt::IRelationship ( CBaseEntity *pTarget )
//=========================================================
int CAGrunt::ISoundMask( void )
{
return bits_SOUND_WORLD |
bits_SOUND_COMBAT |
bits_SOUND_PLAYER |
bits_SOUND_DANGER;
return ( bits_SOUND_WORLD | bits_SOUND_COMBAT | bits_SOUND_PLAYER | bits_SOUND_DANGER );
}
//=========================================================
@ -402,7 +398,9 @@ void CAGrunt :: SetYawSpeed ( void )
case ACT_TURN_RIGHT:
ys = 110;
break;
default: ys = 100;
default:
ys = 100;
break;
}
pev->yaw_speed = ys;
@ -468,13 +466,17 @@ void CAGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
UTIL_MakeVectors ( pHornet->pev->angles );
pHornet->pev->velocity = gpGlobals->v_forward * 300;
switch( RANDOM_LONG ( 0 , 2 ) )
{
case 0: EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, "agrunt/ag_fire1.wav", 1.0, ATTN_NORM, 0, 100 ); break;
case 1: EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, "agrunt/ag_fire2.wav", 1.0, ATTN_NORM, 0, 100 ); break;
case 2: EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, "agrunt/ag_fire3.wav", 1.0, ATTN_NORM, 0, 100 ); break;
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "agrunt/ag_fire1.wav", 1.0, ATTN_NORM, 0, 100 );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "agrunt/ag_fire2.wav", 1.0, ATTN_NORM, 0, 100 );
break;
case 2:
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "agrunt/ag_fire3.wav", 1.0, ATTN_NORM, 0, 100 );
break;
}
CBaseMonster *pHornetMonster = pHornet->MyMonsterPointer();
@ -485,21 +487,28 @@ void CAGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
case AGRUNT_AE_LEFT_FOOT:
switch( RANDOM_LONG( 0, 1 ) )
{
// left foot
case 0: EMIT_SOUND_DYN ( ENT(pev), CHAN_BODY, "player/pl_ladder2.wav", 1, ATTN_NORM, 0, 70 ); break;
case 1: EMIT_SOUND_DYN ( ENT(pev), CHAN_BODY, "player/pl_ladder4.wav", 1, ATTN_NORM, 0, 70 ); break;
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "player/pl_ladder2.wav", 1, ATTN_NORM, 0, 70 );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "player/pl_ladder4.wav", 1, ATTN_NORM, 0, 70 );
break;
}
break;
case AGRUNT_AE_RIGHT_FOOT:
// right foot
switch( RANDOM_LONG( 0, 1 ) )
{
case 0: EMIT_SOUND_DYN ( ENT(pev), CHAN_BODY, "player/pl_ladder1.wav", 1, ATTN_NORM, 0, 70 ); break;
case 1: EMIT_SOUND_DYN ( ENT(pev), CHAN_BODY, "player/pl_ladder3.wav", 1, ATTN_NORM, 0 ,70); break;
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "player/pl_ladder1.wav", 1, ATTN_NORM, 0, 70 );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "player/pl_ladder3.wav", 1, ATTN_NORM, 0 ,70);
break;
}
break;
@ -532,7 +541,6 @@ void CAGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
case AGRUNT_AE_RIGHT_PUNCH:
{
CBaseEntity *pHurt = CheckTraceHullAttack( AGRUNT_MELEE_DIST, gSkillData.agruntDmgPunch, DMG_CLUB );
@ -562,7 +570,6 @@ void CAGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
default:
CSquadMonster::HandleAnimEvent( pEvent );
break;
@ -593,7 +600,6 @@ void CAGrunt :: Spawn()
m_flNextSpeakTime = m_flNextWordTime = gpGlobals->time + 10 + RANDOM_LONG( 0, 10 );
MonsterInit();
}
@ -627,7 +633,6 @@ void CAGrunt :: Precache()
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( (char *)pAlertSounds[i] );
PRECACHE_SOUND( "hassault/hw_shoot1.wav" );
iAgruntMuzzleFlash = PRECACHE_MODEL( "sprites/muz4.spr" );
@ -707,7 +712,6 @@ Schedule_t slAGruntStandoff[] =
bits_COND_SEE_ENEMY |
bits_COND_NEW_ENEMY |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Agrunt Standoff"
}
@ -751,13 +755,11 @@ Schedule_t slAGruntRangeAttack1[] =
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_HEAVY_DAMAGE,
0,
"AGrunt Range Attack1"
},
};
Task_t tlAGruntHiddenRangeAttack1[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_STANDOFF },
@ -775,7 +777,6 @@ Schedule_t slAGruntHiddenRangeAttack[] =
bits_COND_NEW_ENEMY |
bits_COND_HEAVY_DAMAGE |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"AGrunt Hidden Range Attack1"
},
@ -863,7 +864,6 @@ Schedule_t slAGruntThreatDisplay[] =
bits_COND_NEW_ENEMY |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE,
bits_SOUND_PLAYER |
bits_SOUND_COMBAT |
bits_SOUND_WORLD,
@ -884,7 +884,7 @@ DEFINE_CUSTOM_SCHEDULES( CAGrunt )
slAGruntThreatDisplay,
};
IMPLEMENT_CUSTOM_SCHEDULES( CAGrunt, CSquadMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CAGrunt, CSquadMonster )
//=========================================================
// FCanCheckAttacks - this is overridden for alien grunts
@ -976,12 +976,10 @@ void CAGrunt :: StartTask ( Task_t *pTask )
}
}
break;
case TASK_AGRUNT_SETUP_HIDE_ATTACK:
// alien grunt shoots hornets back out into the open from a concealed location.
// try to find a spot to throw that gives the smart weapon a good chance of finding the enemy.
// ideally, this spot is along a line that is perpendicular to a line drawn from the agrunt to the enemy.
CBaseMonster *pEnemyMonsterPtr;
pEnemyMonsterPtr = m_hEnemy->MyMonsterPointer();
@ -1049,7 +1047,6 @@ void CAGrunt :: StartTask ( Task_t *pTask )
TaskFail();
}
break;
default:
CSquadMonster::StartTask( pTask );
break;
@ -1118,6 +1115,9 @@ Schedule_t *CAGrunt :: GetSchedule ( void )
return GetScheduleOfType( SCHED_STANDOFF );
}
break;
default:
break;
}
return CSquadMonster::GetSchedule();
@ -1132,7 +1132,6 @@ Schedule_t* CAGrunt :: GetScheduleOfType ( int Type )
case SCHED_TAKE_COVER_FROM_ENEMY:
return &slAGruntTakeCoverFromEnemy[0];
break;
case SCHED_RANGE_ATTACK1:
if( HasConditions( bits_COND_SEE_ENEMY ) )
{
@ -1146,23 +1145,18 @@ Schedule_t* CAGrunt :: GetScheduleOfType ( int Type )
return &slAGruntRangeAttack1[0];
}
break;
case SCHED_AGRUNT_THREAT_DISPLAY:
return &slAGruntThreatDisplay[0];
break;
case SCHED_AGRUNT_SUPPRESS:
return &slAGruntSuppress[0];
break;
case SCHED_STANDOFF:
return &slAGruntStandoff[0];
break;
case SCHED_VICTORY_DANCE:
return &slAGruntVictoryDance[0];
break;
case SCHED_FAIL:
// no fail schedule specified, so pick a good generic one.
{
@ -1178,9 +1172,7 @@ Schedule_t* CAGrunt :: GetScheduleOfType ( int Type )
return &slAGruntFail[0];
}
break;
}
return CSquadMonster::GetScheduleOfType( Type );
}

View File

@ -37,15 +37,14 @@ class CAirtank : public CGrenade
int m_state;
};
LINK_ENTITY_TO_CLASS( item_airtank, CAirtank )
LINK_ENTITY_TO_CLASS( item_airtank, CAirtank );
TYPEDESCRIPTION CAirtank::m_SaveData[] =
{
DEFINE_FIELD( CAirtank, m_state, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CAirtank, CGrenade );
IMPLEMENT_SAVERESTORE( CAirtank, CGrenade )
void CAirtank::Spawn( void )
{
@ -74,7 +73,6 @@ void CAirtank::Precache( void )
PRECACHE_SOUND( "doors/aliendoor3.wav" );
}
void CAirtank::Killed( entvars_t *pevAttacker, int iGib )
{
pev->owner = ENT( pevAttacker );
@ -84,7 +82,6 @@ void CAirtank :: Killed( entvars_t *pevAttacker, int iGib )
Explode( pev->origin, Vector( 0, 0, -1 ) );
}
void CAirtank::TankThink( void )
{
// Fire trigger
@ -92,7 +89,6 @@ void CAirtank::TankThink( void )
SUB_UseTargets( this, USE_TOGGLE, 0 );
}
void CAirtank::TankTouch( CBaseEntity *pOther )
{
if( !pOther->IsPlayer() )

View File

@ -35,8 +35,7 @@ TYPEDESCRIPTION CBaseAnimating::m_SaveData[] =
DEFINE_FIELD( CBaseMonster, m_fSequenceLoops, FIELD_BOOLEAN ),
};
IMPLEMENT_SAVERESTORE( CBaseAnimating, CBaseDelay );
IMPLEMENT_SAVERESTORE( CBaseAnimating, CBaseDelay )
//=========================================================
// StudioFrameAdvance - advance the animation frame up to the current time
@ -46,7 +45,7 @@ float CBaseAnimating :: StudioFrameAdvance ( float flInterval )
{
if( flInterval == 0.0 )
{
flInterval = (gpGlobals->time - pev->animtime);
flInterval = gpGlobals->time - pev->animtime;
if( flInterval <= 0.001 )
{
pev->animtime = gpGlobals->time;
@ -104,7 +103,6 @@ int CBaseAnimating :: LookupSequence ( const char *label )
return ::LookupSequence( pmodel, label );
}
//=========================================================
//=========================================================
void CBaseAnimating::ResetSequenceInfo()
@ -119,8 +117,6 @@ void CBaseAnimating :: ResetSequenceInfo ( )
m_flLastEventCheck = gpGlobals->time;
}
//=========================================================
//=========================================================
BOOL CBaseAnimating::GetSequenceFlags()
@ -165,7 +161,6 @@ void CBaseAnimating :: DispatchAnimEvents ( float flInterval )
}
}
//=========================================================
//=========================================================
float CBaseAnimating::SetBoneController( int iController, float flValue )
@ -246,7 +241,6 @@ int CBaseAnimating :: GetBodygroup( int iGroup )
return ::GetBodygroup( GET_MODEL_PTR( ENT( pev ) ), pev, iGroup );
}
int CBaseAnimating::ExtractBbox( int sequence, float *mins, float *maxs )
{
return ::ExtractBbox( GET_MODEL_PTR( ENT( pev ) ), sequence, mins, maxs );
@ -315,4 +309,3 @@ void CBaseAnimating :: SetSequenceBox( void )
UTIL_SetSize( pev, rmin, rmax );
}
}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -53,8 +54,6 @@ extern globalvars_t *gpGlobals;
#pragma warning( disable : 4244 )
int ExtractBbox( void *pmodel, int sequence, float *mins, float *maxs )
{
studiohdr_t *pstudiohdr;
@ -78,7 +77,6 @@ int ExtractBbox( void *pmodel, int sequence, float *mins, float *maxs )
return 1;
}
int LookupActivity( void *pmodel, entvars_t *pev, int activity )
{
studiohdr_t *pstudiohdr;
@ -106,7 +104,6 @@ int LookupActivity( void *pmodel, entvars_t *pev, int activity )
return seq;
}
int LookupActivityHeaviest( void *pmodel, entvars_t *pev, int activity )
{
studiohdr_t *pstudiohdr;
@ -172,7 +169,6 @@ int LookupSequence( void *pmodel, const char *label )
return -1;
}
int IsSoundEvent( int eventNumber )
{
if( eventNumber == SCRIPT_EVENT_SOUND || eventNumber == SCRIPT_EVENT_SOUND_VOICE )
@ -180,7 +176,6 @@ int IsSoundEvent( int eventNumber )
return 0;
}
void SequencePrecache( void *pmodel, const char *pSequenceName )
{
int index = LookupSequence( pmodel, pSequenceName );
@ -219,8 +214,6 @@ void SequencePrecache( void *pmodel, const char *pSequenceName )
}
}
void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed )
{
studiohdr_t *pstudiohdr;
@ -253,7 +246,6 @@ void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *
}
}
int GetSequenceFlags( void *pmodel, entvars_t *pev )
{
studiohdr_t *pstudiohdr;
@ -268,7 +260,6 @@ int GetSequenceFlags( void *pmodel, entvars_t *pev )
return pseqdesc->flags;
}
int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index )
{
studiohdr_t *pstudiohdr;
@ -337,7 +328,6 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
return flValue;
// wrap 0..360 if it's a rotational controller
if( pbonecontroller->type & ( STUDIO_XR | STUDIO_YR | STUDIO_ZR ) )
{
// ugly hack, invert value if end < start
@ -363,14 +353,15 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
int setting = 255 * ( flValue - pbonecontroller->start ) / ( pbonecontroller->end - pbonecontroller->start );
if (setting < 0) setting = 0;
if (setting > 255) setting = 255;
if( setting < 0 )
setting = 0;
if( setting > 255 )
setting = 255;
pev->controller[iController] = setting;
return setting * ( 1.0 / 255.0 ) * (pbonecontroller->end - pbonecontroller->start ) + pbonecontroller->start;
}
float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
{
studiohdr_t *pstudiohdr;
@ -404,17 +395,16 @@ float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
int setting = 255 * ( flValue - pseqdesc->blendstart[iBlender] ) / ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] );
if (setting < 0) setting = 0;
if (setting > 255) setting = 255;
if( setting < 0 )
setting = 0;
if(setting > 255)
setting = 255;
pev->blending[iBlender] = setting;
return setting * ( 1.0 / 255.0 ) * ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] ) + pseqdesc->blendstart[iBlender];
}
int FindTransition( void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir )
{
studiohdr_t *pstudiohdr;
@ -503,7 +493,6 @@ void SetBodygroup( void *pmodel, entvars_t *pev, int iGroup, int iValue )
pev->body = ( pev->body - ( iCurrent * pbodypart->base ) + ( iValue * pbodypart->base ) );
}
int GetBodygroup( void *pmodel, entvars_t *pev, int iGroup )
{
studiohdr_t *pstudiohdr;

View File

@ -42,6 +42,4 @@ int ExtractBbox( void *pmodel, int sequence, float *mins, float *maxs );
// From /engine/studio.h
#define STUDIO_LOOPING 0x0001
#endif //ANIMATION_H

View File

@ -88,7 +88,8 @@ class CApache : public CBaseMonster
int m_iDoSmokePuff;
CBeam *m_pBeam;
};
LINK_ENTITY_TO_CLASS( monster_apache, CApache );
LINK_ENTITY_TO_CLASS( monster_apache, CApache )
TYPEDESCRIPTION CApache::m_SaveData[] =
{
@ -111,8 +112,8 @@ TYPEDESCRIPTION CApache::m_SaveData[] =
DEFINE_FIELD( CApache, m_flGoalSpeed, FIELD_FLOAT ),
DEFINE_FIELD( CApache, m_iDoSmokePuff, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CApache, CBaseMonster );
IMPLEMENT_SAVERESTORE( CApache, CBaseMonster )
void CApache::Spawn( void )
{
@ -151,7 +152,6 @@ void CApache :: Spawn( void )
m_iRockets = 10;
}
void CApache::Precache( void )
{
PRECACHE_MODEL( "models/apache.mdl" );
@ -175,15 +175,12 @@ void CApache::Precache( void )
UTIL_PrecacheOther( "hvr_rocket" );
}
void CApache::NullThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.5;
}
void CApache::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
SetThink( &CApache::HuntThink );
@ -281,7 +278,6 @@ void CApache :: DyingThink( void )
WRITE_BYTE( 30 );// 3.0 seconds
// flags
WRITE_BYTE( BREAK_METAL );
MESSAGE_END();
@ -398,7 +394,6 @@ void CApache :: DyingThink( void )
WRITE_BYTE( 200 );// 10.0 seconds
// flags
WRITE_BYTE( BREAK_METAL );
MESSAGE_END();
@ -407,7 +402,6 @@ void CApache :: DyingThink( void )
}
}
void CApache::FlyTouch( CBaseEntity *pOther )
{
// bounce if we hit something solid
@ -420,7 +414,6 @@ void CApache::FlyTouch( CBaseEntity *pOther )
}
}
void CApache::CrashTouch( CBaseEntity *pOther )
{
// only crash if we hit something solid
@ -432,14 +425,11 @@ void CApache::CrashTouch( CBaseEntity *pOther )
}
}
void CApache::GibMonster( void )
{
// EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "common/bodysplat.wav", 0.75, ATTN_NORM, 0, 200 );
}
void CApache::HuntThink( void )
{
StudioFrameAdvance();
@ -587,7 +577,6 @@ void CApache :: HuntThink( void )
}
}
void CApache::Flight( void )
{
// tilt model 5 degrees
@ -649,7 +638,6 @@ void CApache :: Flight( void )
}
else
{
if( pev->angles.z < 30 && pev->avelocity.z < 15 )
pev->avelocity.z += 4;
else
@ -718,7 +706,6 @@ void CApache :: Flight( void )
// UNDONE: this needs to send different sounds to every player for multiplayer.
if( pPlayer )
{
float pitch = DotProduct( pev->velocity - pPlayer->pev->velocity, ( pPlayer->pev->origin - pev->origin ).Normalize() );
pitch = (int)( 100 + pitch / 50.0 );
@ -742,7 +729,6 @@ void CApache :: Flight( void )
}
}
void CApache::FireRocket( void )
{
static float side = 1.0;
@ -756,11 +742,20 @@ void CApache :: FireRocket( void )
switch( m_iRockets % 5 )
{
case 0: vecSrc = vecSrc + gpGlobals->v_right * 10; break;
case 1: vecSrc = vecSrc - gpGlobals->v_right * 10; break;
case 2: vecSrc = vecSrc + gpGlobals->v_up * 10; break;
case 3: vecSrc = vecSrc - gpGlobals->v_up * 10; break;
case 4: break;
case 0:
vecSrc = vecSrc + gpGlobals->v_right * 10;
break;
case 1:
vecSrc = vecSrc - gpGlobals->v_right * 10;
break;
case 2:
vecSrc = vecSrc + gpGlobals->v_up * 10;
break;
case 3:
vecSrc = vecSrc - gpGlobals->v_up * 10;
break;
case 4:
break;
}
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
@ -782,8 +777,6 @@ void CApache :: FireRocket( void )
side = - side;
}
BOOL CApache::FireGun()
{
UTIL_MakeAimVectors( pev->angles );
@ -865,8 +858,6 @@ BOOL CApache :: FireGun( )
return FALSE;
}
void CApache::ShowDamage( void )
{
if( m_iDoSmokePuff > 0 || RANDOM_LONG( 0, 99 ) > pev->health )
@ -885,7 +876,6 @@ void CApache :: ShowDamage( void )
m_iDoSmokePuff--;
}
int CApache::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
if( pevInflictor->owner == edict() )
@ -908,8 +898,6 @@ int CApache :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, floa
return CBaseEntity::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void CApache::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
{
// ALERT( at_console, "%d %.0f\n", ptr->iHitgroup, flDamage );
@ -933,10 +921,6 @@ void CApache::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
}
}
class CApacheHVR : public CGrenade
{
void Spawn( void );
@ -951,7 +935,8 @@ class CApacheHVR : public CGrenade
int m_iTrail;
Vector m_vecForward;
};
LINK_ENTITY_TO_CLASS( hvr_rocket, CApacheHVR );
LINK_ENTITY_TO_CLASS( hvr_rocket, CApacheHVR )
TYPEDESCRIPTION CApacheHVR::m_SaveData[] =
{
@ -959,7 +944,7 @@ TYPEDESCRIPTION CApacheHVR::m_SaveData[] =
DEFINE_FIELD( CApacheHVR, m_vecForward, FIELD_VECTOR ),
};
IMPLEMENT_SAVERESTORE( CApacheHVR, CGrenade );
IMPLEMENT_SAVERESTORE( CApacheHVR, CGrenade )
void CApacheHVR::Spawn( void )
{
@ -984,7 +969,6 @@ void CApacheHVR :: Spawn( void )
pev->dmg = 150;
}
void CApacheHVR::Precache( void )
{
PRECACHE_MODEL( "models/HVR.mdl" );
@ -992,7 +976,6 @@ void CApacheHVR :: Precache( void )
PRECACHE_SOUND("weapons/rocket1.wav");
}
void CApacheHVR::IgniteThink( void )
{
// pev->movetype = MOVETYPE_TOSS;
@ -1005,7 +988,6 @@ void CApacheHVR :: IgniteThink( void )
// rocket trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMFOLLOW );
WRITE_SHORT( entindex() ); // entity
WRITE_SHORT( m_iTrail ); // model
@ -1015,7 +997,6 @@ void CApacheHVR :: IgniteThink( void )
WRITE_BYTE( 224 ); // r, g, b
WRITE_BYTE( 255 ); // r, g, b
WRITE_BYTE( 255 ); // brightness
MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)
// set to accelerate
@ -1023,7 +1004,6 @@ void CApacheHVR :: IgniteThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
void CApacheHVR::AccelerateThink( void )
{
// check world boundaries
@ -1045,6 +1025,4 @@ void CApacheHVR :: AccelerateThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
#endif

View File

@ -65,7 +65,8 @@ public:
}
#endif
};
LINK_ENTITY_TO_CLASS( monster_barnacle, CBarnacle );
LINK_ENTITY_TO_CLASS( monster_barnacle, CBarnacle )
TYPEDESCRIPTION CBarnacle::m_SaveData[] =
{
@ -78,8 +79,7 @@ TYPEDESCRIPTION CBarnacle::m_SaveData[] =
DEFINE_FIELD( CBarnacle, m_flCachedLength, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CBarnacle, CBaseMonster );
IMPLEMENT_SAVERESTORE( CBarnacle, CBaseMonster )
//=========================================================
// Classify - indicates this monster's place in the
@ -160,12 +160,11 @@ void CBarnacle :: BarnacleThink ( void )
CBaseEntity *pTouchEnt;
CBaseMonster *pVictim;
float flLength;
#ifdef BARNACLE_FIX_VISIBILITY
if( m_flCachedLength != ( m_flAltitude + m_flTongueAdj ) || ( pev->absmin.z != pev->origin.z + -m_flCachedLength ) )
{
// recalc collision box here to avoid barnacle disappears bug
m_flCachedLength = (m_flAltitude + m_flTongueAdj);
m_flCachedLength = m_flAltitude + m_flTongueAdj;
UTIL_SetOrigin( pev, pev->origin );
}
#endif
@ -174,7 +173,6 @@ void CBarnacle :: BarnacleThink ( void )
if( m_hEnemy != NULL )
{
// barnacle has prey.
if( !m_hEnemy->IsAlive() )
{
// someone (maybe even the barnacle) killed the prey. Reset barnacle.
@ -228,7 +226,6 @@ void CBarnacle :: BarnacleThink ( void )
else
{
// prey is lifted fully into feeding position and is dangling there.
pVictim = m_hEnemy->MyMonsterPointer();
if( m_flKillVictimTime != -1 && gpGlobals->time > m_flKillVictimTime )
@ -248,26 +245,31 @@ void CBarnacle :: BarnacleThink ( void )
{
switch( RANDOM_LONG( 0, 2 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew2.wav", 1, ATTN_NORM ); break;
case 2: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew3.wav", 1, ATTN_NORM ); break;
case 0:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_chew1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_chew2.wav", 1, ATTN_NORM );
break;
case 2:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_chew3.wav", 1, ATTN_NORM );
break;
}
pVictim->BarnacleVictimBitten( pev );
}
}
}
else
{
// barnacle has no prey right now, so just idle and check to see if anything is touching the tongue.
// If idle and no nearby client, don't think so often
if( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 1, 1.5 ); // Stagger a bit to keep barnacles from thinking on the same frame
if( m_fSequenceFinished )
{// this is done so barnacle will fidget.
{
// this is done so barnacle will fidget.
SetActivity ( ACT_IDLE );
m_flTongueAdj = -100;
}
@ -280,9 +282,15 @@ void CBarnacle :: BarnacleThink ( void )
switch ( RANDOM_LONG( 0, 2 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew2.wav", 1, ATTN_NORM ); break;
case 2: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_chew3.wav", 1, ATTN_NORM ); break;
case 0:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_chew1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_chew2.wav", 1, ATTN_NORM );
break;
case 2:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_chew3.wav", 1, ATTN_NORM );
break;
}
}
@ -309,7 +317,7 @@ void CBarnacle :: BarnacleThink ( void )
m_fLiftingPrey = TRUE;// indicate that we should be lifting prey.
m_flKillVictimTime = -1;// set this to a bogus time while the victim is lifted.
m_flAltitude = (pev->origin.z - pTouchEnt->EyePosition().z);
m_flAltitude = pev->origin.z - pTouchEnt->EyePosition().z;
}
}
else
@ -326,9 +334,7 @@ void CBarnacle :: BarnacleThink ( void )
m_flAltitude = flLength;
m_fTongueExtended = TRUE;
}
}
}
// ALERT( at_console, "tounge %f\n", m_flAltitude + m_flTongueAdj );
@ -360,8 +366,12 @@ void CBarnacle :: Killed( entvars_t *pevAttacker, int iGib )
switch( RANDOM_LONG ( 0, 1 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die3.wav", 1, ATTN_NORM ); break;
case 0:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_die1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_die3.wav", 1, ATTN_NORM );
break;
}
SetActivity( ACT_DIESIMPLE );

View File

@ -85,10 +85,10 @@ public:
// UNDONE: What is this for? It isn't used?
float m_flPlayerDamage;// how much pain has the player inflicted on me?
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
};
LINK_ENTITY_TO_CLASS( monster_barney, CBarney );
LINK_ENTITY_TO_CLASS( monster_barney, CBarney )
TYPEDESCRIPTION CBarney::m_SaveData[] =
{
@ -99,7 +99,7 @@ TYPEDESCRIPTION CBarney::m_SaveData[] =
DEFINE_FIELD( CBarney, m_flPlayerDamage, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CBarney, CTalkMonster );
IMPLEMENT_SAVERESTORE( CBarney, CTalkMonster )
//=========================================================
// AI Schedules Specific to this monster
@ -171,7 +171,6 @@ Schedule_t slBaFaceTarget[] =
},
};
Task_t tlIdleBaStand[] =
{
{ TASK_STOP_MOVING, 0 },
@ -191,11 +190,9 @@ Schedule_t slIdleBaStand[] =
bits_COND_HEAR_SOUND |
bits_COND_SMELL |
bits_COND_PROVOKED,
bits_SOUND_COMBAT |// sound flags - change these, and you'll break the talking code.
//bits_SOUND_PLAYER |
//bits_SOUND_WORLD |
bits_SOUND_DANGER |
bits_SOUND_MEAT |// scents
bits_SOUND_CARCASS |
@ -212,8 +209,7 @@ DEFINE_CUSTOM_SCHEDULES( CBarney )
slIdleBaStand,
};
IMPLEMENT_CUSTOM_SCHEDULES( CBarney, CTalkMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CBarney, CTalkMonster )
void CBarney::StartTask( Task_t *pTask )
{
@ -237,9 +233,6 @@ void CBarney :: RunTask( Task_t *pTask )
}
}
//=========================================================
// ISoundMask - returns a bit mask indicating which types
// of sounds this monster regards.
@ -276,8 +269,8 @@ void CBarney :: AlertSound( void )
PlaySentence( "BA_ATTACK", RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
}
}
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
@ -307,7 +300,6 @@ void CBarney :: SetYawSpeed ( void )
pev->yaw_speed = ys;
}
//=========================================================
// CheckRangeAttack1
//=========================================================
@ -335,7 +327,6 @@ BOOL CBarney :: CheckRangeAttack1 ( float flDot, float flDist )
return FALSE;
}
//=========================================================
// BarneyFirePistol - shoots one round from the pistol at
// the enemy barney is facing.
@ -382,19 +373,16 @@ void CBarney :: HandleAnimEvent( MonsterEvent_t *pEvent )
case BARNEY_AE_SHOOT:
BarneyFirePistol();
break;
case BARNEY_AE_DRAW:
// barney's bodygroup switches here so he can pull gun from holster
pev->body = BARNEY_BODY_GUNDRAWN;
m_fGunDrawn = TRUE;
break;
case BARNEY_AE_HOLSTER:
// change bodygroup to replace gun in holster
pev->body = BARNEY_BODY_GUNHOLSTERED;
m_fGunDrawn = FALSE;
break;
default:
CTalkMonster::HandleAnimEvent( pEvent );
}
@ -454,11 +442,9 @@ void CBarney :: Precache()
// Init talk data
void CBarney::TalkInit()
{
CTalkMonster::TalkInit();
// scientists speach group names (group names are in sentences.txt)
m_szGrp[TLK_ANSWER] = "BA_ANSWER";
m_szGrp[TLK_QUESTION] = "BA_QUESTION";
m_szGrp[TLK_IDLE] = "BA_IDLE";
@ -487,16 +473,16 @@ void CBarney :: TalkInit()
m_voicePitch = 100;
}
static BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
{
Vector vecDir = (reference - pevTest->origin);
Vector vecDir = reference - pevTest->origin;
vecDir.z = 0;
vecDir = vecDir.Normalize();
Vector forward, angle;
angle = pevTest->v_angle;
angle.x = 0;
UTIL_MakeVectorsPrivate( angle, forward, NULL, NULL );
// He's facing me, he meant it
if( DotProduct( forward, vecDir ) > 0.96 ) // +/- 15 degrees or so
{
@ -505,7 +491,6 @@ static BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
return FALSE;
}
int CBarney::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
// make sure friends talk about it if player hurts talkmonsters...
@ -546,7 +531,6 @@ int CBarney :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, floa
return ret;
}
//=========================================================
// PainSound
//=========================================================
@ -559,9 +543,15 @@ void CBarney :: PainSound ( void )
switch( RANDOM_LONG( 0, 2 ) )
{
case 0: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "barney/ba_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
case 1: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "barney/ba_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
case 2: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "barney/ba_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
break;
case 2:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
break;
}
}
@ -572,13 +562,18 @@ void CBarney :: DeathSound ( void )
{
switch( RANDOM_LONG( 0, 2 ) )
{
case 0: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "barney/ba_die1.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
case 1: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "barney/ba_die2.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
case 2: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "barney/ba_die3.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die1.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die2.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
break;
case 2:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die3.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
break;
}
}
void CBarney::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
{
switch( ptr->iHitgroup )
@ -600,6 +595,7 @@ void CBarney::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
flDamage = 0.01;
}
}
// always a head shot
ptr->iHitgroup = HITGROUP_HEAD;
break;
@ -608,11 +604,11 @@ void CBarney::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
CTalkMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );
}
void CBarney::Killed( entvars_t *pevAttacker, int iGib )
{
if( pev->body < BARNEY_BODY_GUNGONE )
{// drop the gun!
{
// drop the gun!
Vector vecGunPos;
Vector vecGunAngles;
@ -630,7 +626,6 @@ void CBarney::Killed( entvars_t *pevAttacker, int iGib )
//=========================================================
// AI Schedules Specific to this monster
//=========================================================
Schedule_t *CBarney::GetScheduleOfType( int Type )
{
Schedule_t *psched;
@ -644,7 +639,6 @@ Schedule_t* CBarney :: GetScheduleOfType ( int Type )
return slBarneyEnemyDraw;
}
break;
// Hook these to make a looping schedule
case SCHED_TARGET_FACE:
// call base class default so that barney will talk
@ -655,10 +649,8 @@ Schedule_t* CBarney :: GetScheduleOfType ( int Type )
return slBaFaceTarget; // override this for different target face behavior
else
return psched;
case SCHED_TARGET_CHASE:
return slBaFollow;
case SCHED_IDLE_STAND:
// call base class default so that scientist will talk
// when standing during idle
@ -721,7 +713,6 @@ Schedule_t *CBarney :: GetSchedule ( void )
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY );
}
break;
case MONSTERSTATE_ALERT:
case MONSTERSTATE_IDLE:
if( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) )
@ -756,6 +747,8 @@ Schedule_t *CBarney :: GetSchedule ( void )
// try to say something about smells
TrySmellTalk();
break;
default:
break;
}
return CTalkMonster::GetSchedule();
@ -766,17 +759,11 @@ MONSTERSTATE CBarney :: GetIdealState ( void )
return CTalkMonster::GetIdealState();
}
void CBarney::DeclineFollowing( void )
{
PlaySentence( "BA_POK", 2, VOL_NORM, ATTN_NORM );
}
//=========================================================
// DEAD BARNEY PROP
//
@ -812,7 +799,7 @@ void CDeadBarney::KeyValue( KeyValueData *pkvd )
CBaseMonster::KeyValue( pkvd );
}
LINK_ENTITY_TO_CLASS( monster_barney_dead, CDeadBarney );
LINK_ENTITY_TO_CLASS( monster_barney_dead, CDeadBarney )
//=========================================================
// ********** DeadBarney SPAWN **********
@ -837,5 +824,3 @@ void CDeadBarney :: Spawn( )
MonsterInitDead();
}

View File

@ -31,11 +31,9 @@ public:
SCRIPT_WAIT, // Waiting on everyone in the script to be ready
SCRIPT_CLEANUP, // Cancelling the script / cleaning up
SCRIPT_WALK_TO_MARK,
SCRIPT_RUN_TO_MARK,
SCRIPT_RUN_TO_MARK
} SCRIPTSTATE;
// these fields have been added in the process of reworking the state machine. (sjb)
EHANDLE m_hEnemy; // the entity that the monster is fighting.
EHANDLE m_hTargetEnt; // the entity that the monster is trying to reach
@ -110,7 +108,6 @@ public:
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
void KeyValue( KeyValueData *pkvd );
@ -120,7 +117,6 @@ public:
void EXPORT CorpseUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
// overrideable Monster member functions
virtual int BloodColor( void ) { return m_bloodColor; }
virtual CBaseMonster *MyMonsterPointer( void ) { return this; }
@ -333,7 +329,4 @@ public:
CBaseEntity* DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item.
};
#endif // BASEMONSTER_H

View File

@ -17,6 +17,7 @@
//=========================================================
// monster template
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -51,20 +52,19 @@ public:
int m_preSequence;
};
LINK_ENTITY_TO_CLASS( info_bigmomma, CInfoBM );
LINK_ENTITY_TO_CLASS( info_bigmomma, CInfoBM )
TYPEDESCRIPTION CInfoBM::m_SaveData[] =
{
DEFINE_FIELD( CInfoBM, m_preSequence, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CInfoBM, CPointEntity );
IMPLEMENT_SAVERESTORE( CInfoBM, CPointEntity )
void CInfoBM::Spawn( void )
{
}
void CInfoBM::KeyValue( KeyValueData* pkvd )
{
if( FStrEq( pkvd->szKeyName, "radius" ) )
@ -115,15 +115,14 @@ public:
int m_maxFrame;
};
LINK_ENTITY_TO_CLASS( bmortar, CBMortar );
LINK_ENTITY_TO_CLASS( bmortar, CBMortar )
TYPEDESCRIPTION CBMortar::m_SaveData[] =
{
DEFINE_FIELD( CBMortar, m_maxFrame, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CBMortar, CBaseEntity );
IMPLEMENT_SAVERESTORE( CBMortar, CBaseEntity )
//=========================================================
// Monster's Anim Events Go Here
@ -147,8 +146,6 @@ IMPLEMENT_SAVERESTORE( CBMortar, CBaseEntity );
#define BIG_AE_BIRTH_SOUND 17 // birth sound
#define BIG_AE_EARLY_TARGET 50 // Fire target early
// User defined conditions
#define bits_COND_NODE_SEQUENCE ( bits_COND_SPECIAL1 ) // pev->netname contains the name of a sequence to play
@ -157,7 +154,6 @@ IMPLEMENT_SAVERESTORE( CBMortar, CBaseEntity );
#define BIG_MORTARDIST 800
#define BIG_MAXCHILDREN 20 // Max # of live headcrab children
#define bits_MEMORY_CHILDPAIR ( bits_MEMORY_CUSTOM1 )
#define bits_MEMORY_ADVANCE_NODE ( bits_MEMORY_CUSTOM2 )
#define bits_MEMORY_COMPLETED_NODE ( bits_MEMORY_CUSTOM3 )
@ -167,7 +163,6 @@ int gSpitSprite, gSpitDebrisSprite;
Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float maxHeight );
void MortarSpray( const Vector &position, const Vector &direction, int spriteModel, int count );
// UNDONE:
//
#define BIG_CHILDCLASS "monster_babycrab"
@ -206,7 +201,6 @@ public:
return 0;
}
int GetNodePresequence( void )
{
CInfoBM *pTarget = (CInfoBM *)(CBaseEntity *)m_hTargetEnt;
@ -303,7 +297,7 @@ public:
static const char *pPainSounds[];
static const char *pFootSounds[];
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
private:
float m_nodeTime;
@ -312,7 +306,8 @@ private:
float m_painSoundTime;
int m_crabCount;
};
LINK_ENTITY_TO_CLASS( monster_bigmomma, CBigMomma );
LINK_ENTITY_TO_CLASS( monster_bigmomma, CBigMomma )
TYPEDESCRIPTION CBigMomma::m_SaveData[] =
{
@ -323,7 +318,7 @@ TYPEDESCRIPTION CBigMomma::m_SaveData[] =
DEFINE_FIELD( CBigMomma, m_crabCount, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CBigMomma, CBaseMonster );
IMPLEMENT_SAVERESTORE( CBigMomma, CBaseMonster )
const char *CBigMomma::pChildDieSounds[] =
{
@ -350,6 +345,7 @@ const char *CBigMomma::pAttackSounds[] =
"gonarch/gon_attack2.wav",
"gonarch/gon_attack3.wav",
};
const char *CBigMomma::pAttackHitSounds[] =
{
"zombie/claw_strike1.wav",
@ -385,8 +381,6 @@ const char *CBigMomma::pFootSounds[] =
"gonarch/gon_step3.wav",
};
void CBigMomma::KeyValue( KeyValueData *pkvd )
{
#if 0
@ -472,11 +466,9 @@ void CBigMomma :: HandleAnimEvent( MonsterEvent_t *pEvent )
case BIG_AE_MELEE_ATTACKBR:
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 150 ) + Vector( 0, 0, 250 ) - ( right * 200 );
break;
case BIG_AE_MELEE_ATTACKBL:
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 150 ) + Vector( 0, 0, 250 ) + ( right * 200 );
break;
case BIG_AE_MELEE_ATTACK1:
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 220 ) + Vector( 0, 0, 200 );
break;
@ -487,59 +479,47 @@ void CBigMomma :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
case BIG_AE_SCREAM:
EMIT_SOUND_ARRAY_DYN( CHAN_VOICE, pAlertSounds );
break;
case BIG_AE_PAIN_SOUND:
EMIT_SOUND_ARRAY_DYN( CHAN_VOICE, pPainSounds );
break;
case BIG_AE_ATTACK_SOUND:
EMIT_SOUND_ARRAY_DYN( CHAN_WEAPON, pAttackSounds );
break;
case BIG_AE_BIRTH_SOUND:
EMIT_SOUND_ARRAY_DYN( CHAN_BODY, pBirthSounds );
break;
case BIG_AE_SACK:
if( RANDOM_LONG( 0, 100 ) < 30 )
EMIT_SOUND_ARRAY_DYN( CHAN_BODY, pSackSounds );
break;
case BIG_AE_DEATHSOUND:
EMIT_SOUND_ARRAY_DYN( CHAN_VOICE, pDeathSounds );
break;
case BIG_AE_STEP1: // Footstep left
case BIG_AE_STEP3: // Footstep back left
EMIT_SOUND_ARRAY_DYN( CHAN_ITEM, pFootSounds );
break;
case BIG_AE_STEP4: // Footstep back right
case BIG_AE_STEP2: // Footstep right
EMIT_SOUND_ARRAY_DYN( CHAN_BODY, pFootSounds );
break;
case BIG_AE_MORTAR_ATTACK1:
LaunchMortar();
break;
case BIG_AE_LAY_CRAB:
LayHeadcrab();
break;
case BIG_AE_JUMP_FORWARD:
ClearBits( pev->flags, FL_ONGROUND );
UTIL_SetOrigin( pev, pev->origin + Vector( 0, 0, 1) );// take him off ground so engine doesn't instantly reset onground
UTIL_MakeVectors( pev->angles );
pev->velocity = (gpGlobals->v_forward * 200) + gpGlobals->v_up * 500;
pev->velocity = gpGlobals->v_forward * 200 + gpGlobals->v_up * 500;
break;
case BIG_AE_EARLY_TARGET:
{
CBaseEntity *pTarget = m_hTargetEnt;
@ -548,7 +528,6 @@ void CBigMomma :: HandleAnimEvent( MonsterEvent_t *pEvent )
Remember( bits_MEMORY_FIRED_NODE );
}
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
@ -560,7 +539,6 @@ void CBigMomma :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector ve
if( ptr->iHitgroup != 1 )
{
// didn't hit the sack?
if( pev->dmgtime != gpGlobals->time || ( RANDOM_LONG( 0, 10 ) < 1 ) )
{
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1, 2) );
@ -575,11 +553,9 @@ void CBigMomma :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector ve
EMIT_SOUND_ARRAY_DYN( CHAN_VOICE, pPainSounds );
}
CBaseMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );
}
int CBigMomma::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
// Don't take any acid damage -- BigMomma's mortar is acid
@ -625,8 +601,6 @@ void CBigMomma :: LayHeadcrab( void )
m_crabCount++;
}
void CBigMomma::DeathNotice( entvars_t *pevChild )
{
if( m_crabCount > 0 ) // Some babies may cross a transition, but we reset the count then
@ -638,7 +612,6 @@ void CBigMomma::DeathNotice( entvars_t *pevChild )
}
}
void CBigMomma::LaunchMortar( void )
{
m_mortarTime = gpGlobals->time + RANDOM_FLOAT( 2, 15 );
@ -702,14 +675,12 @@ void CBigMomma :: Precache()
PRECACHE_SOUND( "bullchicken/bc_spithit2.wav" );
}
void CBigMomma::Activate( void )
{
if( m_hTargetEnt == NULL )
Remember( bits_MEMORY_ADVANCE_NODE ); // Start 'er up
}
void CBigMomma::NodeStart( int iszNextNode )
{
pev->netname = iszNextNode;
@ -724,7 +695,6 @@ void CBigMomma::NodeStart( int iszNextNode )
pTarget = Instance( pentTarget );
}
if( !pTarget )
{
ALERT( at_aiconsole, "BM: Finished the path!!\n" );
@ -735,7 +705,6 @@ void CBigMomma::NodeStart( int iszNextNode )
m_hTargetEnt = pTarget;
}
void CBigMomma::NodeReach( void )
{
CBaseEntity *pTarget = m_hTargetEnt;
@ -760,7 +729,6 @@ void CBigMomma::NodeReach( void )
Remember( bits_MEMORY_ADVANCE_NODE ); // Move on if no health at this node
}
// Slash
BOOL CBigMomma::CheckMeleeAttack1( float flDot, float flDist )
{
@ -772,14 +740,12 @@ BOOL CBigMomma::CheckMeleeAttack1( float flDot, float flDist )
return FALSE;
}
// Lay a crab
BOOL CBigMomma::CheckMeleeAttack2( float flDot, float flDist )
{
return CanLayCrab();
}
// Mortar launch
BOOL CBigMomma::CheckRangeAttack1( float flDot, float flDist )
{
@ -802,11 +768,10 @@ BOOL CBigMomma::CheckRangeAttack1( float flDot, float flDist )
//=========================================================
// AI Schedules Specific to this monster
//=========================================================
enum
{
SCHED_BIG_NODE = LAST_COMMON_SCHEDULE + 1,
SCHED_NODE_FAIL,
SCHED_NODE_FAIL
};
enum
@ -818,10 +783,9 @@ enum
TASK_PROCESS_NODE, // Fire targets, etc.
TASK_WAIT_NODE, // Wait at the node
TASK_NODE_DELAY, // Delay walking toward node for a bit. You've failed to get there
TASK_NODE_YAW, // Get the best facing direction for this node
TASK_NODE_YAW // Get the best facing direction for this node
};
Task_t tlBigNode[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_NODE_FAIL },
@ -849,7 +813,6 @@ Schedule_t slBigNode[] =
},
};
Task_t tlNodeFail[] =
{
{ TASK_NODE_DELAY, (float)10 }, // Try to do something else for 10 seconds
@ -873,10 +836,7 @@ DEFINE_CUSTOM_SCHEDULES( CBigMomma )
slNodeFail,
};
IMPLEMENT_CUSTOM_SCHEDULES( CBigMomma, CBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CBigMomma, CBaseMonster )
Schedule_t *CBigMomma::GetScheduleOfType( int Type )
{
@ -885,7 +845,6 @@ Schedule_t *CBigMomma::GetScheduleOfType( int Type )
case SCHED_BIG_NODE:
return slBigNode;
break;
case SCHED_NODE_FAIL:
return slNodeFail;
break;
@ -894,7 +853,6 @@ Schedule_t *CBigMomma::GetScheduleOfType( int Type )
return CBaseMonster::GetScheduleOfType( Type );
}
BOOL CBigMomma::ShouldGoToNode( void )
{
if( HasMemory( bits_MEMORY_ADVANCE_NODE ) )
@ -905,8 +863,6 @@ BOOL CBigMomma::ShouldGoToNode( void )
return FALSE;
}
Schedule_t *CBigMomma::GetSchedule( void )
{
if( ShouldGoToNode() )
@ -917,7 +873,6 @@ Schedule_t *CBigMomma::GetSchedule( void )
return CBaseMonster::GetSchedule();
}
void CBigMomma::StartTask( Task_t *pTask )
{
switch( pTask->iTask )
@ -935,19 +890,16 @@ void CBigMomma::StartTask( Task_t *pTask )
ALERT( at_aiconsole, "BM: Found node %s\n", STRING( pev->netname ) );
}
break;
case TASK_NODE_DELAY:
m_nodeTime = gpGlobals->time + pTask->flData;
TaskComplete();
ALERT( at_aiconsole, "BM: FAIL! Delay %.2f\n", pTask->flData );
break;
case TASK_PROCESS_NODE:
ALERT( at_aiconsole, "BM: Reached node %s\n", STRING( pev->netname ) );
NodeReach();
TaskComplete();
break;
case TASK_PLAY_NODE_PRESEQUENCE:
case TASK_PLAY_NODE_SEQUENCE:
{
@ -973,12 +925,10 @@ void CBigMomma::StartTask( Task_t *pTask )
TaskComplete();
}
break;
case TASK_NODE_YAW:
pev->ideal_yaw = GetNodeYaw();
TaskComplete();
break;
case TASK_WAIT_NODE:
m_flWait = gpGlobals->time + GetNodeDelay();
if( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT )
@ -1012,15 +962,12 @@ void CBigMomma::StartTask( Task_t *pTask )
}
}
ALERT( at_aiconsole, "BM: Moving to node %s\n", STRING( pev->netname ) );
break;
case TASK_MELEE_ATTACK1:
// Play an attack sound here
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, ATTN_NORM, 0, PITCH_NORM );
CBaseMonster::StartTask( pTask );
break;
default:
CBaseMonster::StartTask( pTask );
break;
@ -1053,9 +1000,7 @@ void CBigMomma::RunTask( Task_t *pTask )
}
}
}
break;
case TASK_WAIT_NODE:
if( m_hTargetEnt != NULL && ( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT ) )
return;
@ -1064,7 +1009,6 @@ void CBigMomma::RunTask( Task_t *pTask )
TaskComplete();
ALERT( at_aiconsole, "BM: The WAIT is over!\n" );
break;
case TASK_PLAY_NODE_PRESEQUENCE:
case TASK_PLAY_NODE_SEQUENCE:
if( m_fSequenceFinished )
@ -1073,15 +1017,12 @@ void CBigMomma::RunTask( Task_t *pTask )
TaskComplete();
}
break;
default:
CBaseMonster::RunTask( pTask );
break;
}
}
Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float maxHeight )
{
TraceResult tr;
@ -1107,13 +1048,13 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
// Don't worry about actually hitting the target, this won't hurt us!
// How high should the grenade travel (subtract 15 so the grenade doesn't hit the ceiling)?
float height = (vecApex.z - vecSpot1.z) - 15;
float height = vecApex.z - vecSpot1.z - 15;
// How fast does the grenade need to travel to reach that height given gravity?
float speed = sqrt( 2 * flGravity * height );
// How much time does it take to get there?
float time = speed / flGravity;
vecGrenadeVel = (vecSpot2 - vecSpot1);
vecGrenadeVel = vecSpot2 - vecSpot1;
vecGrenadeVel.z = 0;
float distance = vecGrenadeVel.Length();
@ -1125,9 +1066,6 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
return vecGrenadeVel;
}
// ---------------------------------
//
// Mortar
@ -1150,7 +1088,6 @@ void MortarSpray( const Vector &position, const Vector &direction, int spriteMod
MESSAGE_END();
}
// UNDONE: right now this is pretty much a copy of the squid spit with minor changes to the way it does damage
void CBMortar::Spawn( void )
{
@ -1204,7 +1141,6 @@ CBMortar *CBMortar::Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocity
return pSpit;
}
void CBMortar::Touch( CBaseEntity *pOther )
{
TraceResult tr;
@ -1237,6 +1173,7 @@ void CBMortar::Touch( CBaseEntity *pOther )
tr.vecEndPos = pev->origin;
tr.vecPlaneNormal = -1 * pev->velocity.Normalize();
}
// make some flecks
MortarSpray( tr.vecEndPos, tr.vecPlaneNormal, gSpitSprite, 24 );
@ -1247,5 +1184,4 @@ void CBMortar::Touch( CBaseEntity *pOther )
RadiusDamage( pev->origin, pev, pevOwner, gSkillData.bigmommaDmgBlast, gSkillData.bigmommaRadiusBlast, CLASS_NONE, DMG_ACID );
UTIL_Remove( this );
}
#endif

View File

@ -22,13 +22,11 @@
#include "monsters.h"
#include "schedule.h"
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
#define BLOATER_AE_ATTACK_MELEE1 0x01
class CBloater : public CBaseMonster
{
public:
@ -49,7 +47,7 @@ public:
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
};
LINK_ENTITY_TO_CLASS( monster_bloater, CBloater );
LINK_ENTITY_TO_CLASS( monster_bloater, CBloater )
//=========================================================
// Classify - indicates this monster's place in the
@ -69,13 +67,11 @@ void CBloater :: SetYawSpeed ( void )
int ys;
ys = 120;
#if 0
switch( m_Activity )
{
}
#endif
pev->yaw_speed = ys;
}
@ -161,7 +157,6 @@ void CBloater :: AttackSnd( void )
#endif
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
@ -176,7 +171,6 @@ void CBloater :: HandleAnimEvent( MonsterEvent_t *pEvent )
AttackSnd();
}
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
@ -216,4 +210,3 @@ void CBloater :: Precache()
//=========================================================
// AI Schedules Specific to this monster
//=========================================================

View File

@ -60,7 +60,7 @@ public:
virtual int ObjectCaps( void ) { return CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
};
LINK_ENTITY_TO_CLASS( func_wall, CFuncWall );
LINK_ENTITY_TO_CLASS( func_wall, CFuncWall )
void CFuncWall::Spawn( void )
{
@ -73,14 +73,12 @@ void CFuncWall :: Spawn( void )
pev->flags |= FL_WORLDBRUSH;
}
void CFuncWall::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if( ShouldToggle( useType, (int)( pev->frame ) ) )
pev->frame = 1 - pev->frame;
}
#define SF_WALL_START_OFF 0x0001
class CFuncWallToggle : public CFuncWall
@ -93,7 +91,7 @@ public:
BOOL IsOn( void );
};
LINK_ENTITY_TO_CLASS( func_wall_toggle, CFuncWallToggle );
LINK_ENTITY_TO_CLASS( func_wall_toggle, CFuncWallToggle )
void CFuncWallToggle::Spawn( void )
{
@ -102,7 +100,6 @@ void CFuncWallToggle :: Spawn( void )
TurnOff();
}
void CFuncWallToggle::TurnOff( void )
{
pev->solid = SOLID_NOT;
@ -110,7 +107,6 @@ void CFuncWallToggle :: TurnOff( void )
UTIL_SetOrigin( pev, pev->origin );
}
void CFuncWallToggle::TurnOn( void )
{
pev->solid = SOLID_BSP;
@ -118,7 +114,6 @@ void CFuncWallToggle :: TurnOn( void )
UTIL_SetOrigin( pev, pev->origin );
}
BOOL CFuncWallToggle::IsOn( void )
{
if( pev->solid == SOLID_NOT )
@ -126,7 +121,6 @@ BOOL CFuncWallToggle :: IsOn( void )
return TRUE;
}
void CFuncWallToggle::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
int status = IsOn();
@ -140,7 +134,6 @@ void CFuncWallToggle :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
}
}
#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002
@ -152,7 +145,8 @@ public:
void UpdateSpeed( float speed );
};
LINK_ENTITY_TO_CLASS( func_conveyor, CFuncConveyor );
LINK_ENTITY_TO_CLASS( func_conveyor, CFuncConveyor )
void CFuncConveyor::Spawn( void )
{
SetMovedir( pev );
@ -174,7 +168,6 @@ void CFuncConveyor :: Spawn( void )
UpdateSpeed( pev->speed );
}
// HACKHACK -- This is ugly, but encode the speed in the rendercolor to avoid adding more data to the network stream
void CFuncConveyor::UpdateSpeed( float speed )
{
@ -186,19 +179,16 @@ void CFuncConveyor :: UpdateSpeed( float speed )
else
pev->rendercolor.x = 0;
pev->rendercolor.y = (speedCode >> 8);
pev->rendercolor.z = (speedCode & 0xFF);
pev->rendercolor.y = speedCode >> 8;
pev->rendercolor.z = speedCode & 0xFF;
}
void CFuncConveyor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
pev->speed = -pev->speed;
UpdateSpeed( pev->speed );
}
// =================== FUNC_ILLUSIONARY ==============================================
@ -214,7 +204,7 @@ public:
virtual int ObjectCaps( void ) { return CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
};
LINK_ENTITY_TO_CLASS( func_illusionary, CFuncIllusionary );
LINK_ENTITY_TO_CLASS( func_illusionary, CFuncIllusionary )
void CFuncIllusionary::KeyValue( KeyValueData *pkvd )
{
@ -240,7 +230,6 @@ void CFuncIllusionary :: Spawn( void )
// MAKE_STATIC(ENT(pev));
}
// -------------------------------------------------------------------------------
//
// Monster only clip brush
@ -259,7 +248,7 @@ public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) {} // Clear out func_wall's use function
};
LINK_ENTITY_TO_CLASS( func_monsterclip, CFuncMonsterClip );
LINK_ENTITY_TO_CLASS( func_monsterclip, CFuncMonsterClip )
void CFuncMonsterClip::Spawn( void )
{
@ -269,7 +258,6 @@ void CFuncMonsterClip::Spawn( void )
pev->flags |= FL_MONSTERCLIP;
}
// =================== FUNC_ROTATING ==============================================
class CFuncRotating : public CBaseEntity
{
@ -307,10 +295,9 @@ TYPEDESCRIPTION CFuncRotating::m_SaveData[] =
DEFINE_FIELD( CFuncRotating, m_sounds, FIELD_INTEGER )
};
IMPLEMENT_SAVERESTORE( CFuncRotating, CBaseEntity );
IMPLEMENT_SAVERESTORE( CFuncRotating, CBaseEntity )
LINK_ENTITY_TO_CLASS( func_rotating, CFuncRotating );
LINK_ENTITY_TO_CLASS( func_rotating, CFuncRotating )
void CFuncRotating::KeyValue( KeyValueData* pkvd )
{
@ -358,12 +345,10 @@ check either the X_AXIS or Y_AXIS box to change that.
REVERSE will cause the it to rotate in the opposite direction.
*/
void CFuncRotating::Spawn()
{
// set final pitch. Must not be PITCH_NORM, since we
// plan on pitch shifting later.
m_pitch = PITCH_NORM - 1;
// maintain compatibility with previous maps
@ -443,21 +428,19 @@ void CFuncRotating :: Spawn( )
Precache();
}
void CFuncRotating::Precache( void )
{
char* szSoundFile = (char*)STRING( pev->message );
// set up fan sounds
if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 )
{
// if a path is set for a wave, use it
PRECACHE_SOUND( szSoundFile );
pev->noiseRunning = ALLOC_STRING( szSoundFile );
} else
}
else
{
// otherwise use preset sound
switch( m_sounds )
@ -482,7 +465,6 @@ void CFuncRotating :: Precache( void )
PRECACHE_SOUND( "fans/fan5.wav" );
pev->noiseRunning = ALLOC_STRING( "fans/fan5.wav" );
break;
case 0:
default:
if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 )
@ -491,7 +473,8 @@ void CFuncRotating :: Precache( void )
pev->noiseRunning = ALLOC_STRING( szSoundFile );
break;
} else
}
else
{
pev->noiseRunning = ALLOC_STRING( "common/null.wav" );
break;
@ -509,8 +492,6 @@ void CFuncRotating :: Precache( void )
}
}
//
// Touch - will hurt others based on how fast the brush is spinning
//
@ -539,7 +520,6 @@ void CFuncRotating :: HurtTouch ( CBaseEntity *pOther )
void CFuncRotating::RampPitchVol( int fUp )
{
Vector vecAVel = pev->avelocity;
vec_t vecCur;
vec_t vecFinal;
@ -549,17 +529,14 @@ void CFuncRotating :: RampPitchVol (int fUp)
int pitch;
// get current angular velocity
vecCur = fabs( vecAVel.x != 0 ? vecAVel.x : ( vecAVel.y != 0 ? vecAVel.y : vecAVel.z ) );
// get target angular velocity
vecFinal = ( pev->movedir.x != 0 ? pev->movedir.x : ( pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z ) );
vecFinal *= pev->speed;
vecFinal = fabs( vecFinal );
// calc volume and pitch as % of final vol and pitch
fpct = vecCur / vecFinal;
//if (fUp)
// fvol = m_flVolume * (0.5 + fpct/2.0); // spinup volume ramps up from 50% max vol
@ -573,10 +550,8 @@ void CFuncRotating :: RampPitchVol (int fUp)
pitch = PITCH_NORM - 1;
// change the fan's vol and pitch
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, (char *)STRING( pev->noiseRunning ),
fvol, m_flAttenuation, SND_CHANGE_PITCH | SND_CHANGE_VOL, pitch );
}
//
@ -706,24 +681,14 @@ void CFuncRotating :: RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller
}
}
//
// RotatingBlocked - An entity has blocked the brush
//
void CFuncRotating::Blocked( CBaseEntity *pOther )
{
pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );
}
//#endif
class CPendulum : public CBaseEntity
{
public:
@ -742,7 +707,7 @@ public:
static TYPEDESCRIPTION m_SaveData[];
float m_accel; // Acceleration
float m_distance; //
float m_distance;
float m_time;
float m_damp;
float m_maxSpeed;
@ -751,7 +716,7 @@ public:
vec3_t m_start;
};
LINK_ENTITY_TO_CLASS( func_pendulum, CPendulum );
LINK_ENTITY_TO_CLASS( func_pendulum, CPendulum )
TYPEDESCRIPTION CPendulum::m_SaveData[] =
{
@ -765,9 +730,7 @@ TYPEDESCRIPTION CPendulum::m_SaveData[] =
DEFINE_FIELD( CPendulum, m_start, FIELD_VECTOR ),
};
IMPLEMENT_SAVERESTORE( CPendulum, CBaseEntity );
IMPLEMENT_SAVERESTORE( CPendulum, CBaseEntity )
void CPendulum::KeyValue( KeyValueData *pkvd )
{
@ -785,7 +748,6 @@ void CPendulum :: KeyValue( KeyValueData *pkvd )
CBaseEntity::KeyValue( pkvd );
}
void CPendulum::Spawn( void )
{
// set the axis of rotation
@ -824,7 +786,6 @@ void CPendulum :: Spawn( void )
}
}
void CPendulum::PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if( pev->speed ) // Pendulum is moving, stop it and auto-return if necessary
@ -855,7 +816,6 @@ void CPendulum :: PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, US
}
}
void CPendulum::Stop( void )
{
pev->angles = m_start;
@ -864,13 +824,11 @@ void CPendulum :: Stop( void )
pev->avelocity = g_vecZero;
}
void CPendulum::Blocked( CBaseEntity *pOther )
{
m_time = gpGlobals->time;
}
void CPendulum::Swing( void )
{
float delta, dt;
@ -908,11 +866,9 @@ void CPendulum :: Swing( void )
pev->speed = m_dampSpeed;
else if( pev->speed < -m_dampSpeed )
pev->speed = -m_dampSpeed;
}
}
void CPendulum::Touch( CBaseEntity *pOther )
{
entvars_t *pevOther = pOther->pev;
@ -940,13 +896,15 @@ void CPendulum :: RopeTouch ( CBaseEntity *pOther )
entvars_t *pevOther = pOther->pev;
if( !pOther->IsPlayer() )
{// not a player!
{
// not a player!
ALERT( at_console, "Not a client\n" );
return;
}
if( ENT( pevOther ) == pev->enemy )
{// this player already on the rope.
{
// this player already on the rope.
return;
}
@ -954,5 +912,3 @@ void CPendulum :: RopeTouch ( CBaseEntity *pOther )
pevOther->velocity = g_vecZero;
pevOther->movetype = MOVETYPE_NONE;
}

View File

@ -31,7 +31,6 @@
int iSquidSpitSprite;
//=========================================================
// monster-specific schedule types
//=========================================================
@ -42,7 +41,7 @@ enum
SCHED_SQUID_SEECRAB,
SCHED_SQUID_EAT,
SCHED_SQUID_SNIFF_AND_EAT,
SCHED_SQUID_WALLOW,
SCHED_SQUID_WALLOW
};
//=========================================================
@ -50,7 +49,7 @@ enum
//=========================================================
enum
{
TASK_SQUID_HOPTURN = LAST_COMMON_TASK + 1,
TASK_SQUID_HOPTURN = LAST_COMMON_TASK + 1
};
//=========================================================
@ -72,14 +71,14 @@ public:
int m_maxFrame;
};
LINK_ENTITY_TO_CLASS( squidspit, CSquidSpit );
LINK_ENTITY_TO_CLASS( squidspit, CSquidSpit )
TYPEDESCRIPTION CSquidSpit::m_SaveData[] =
{
DEFINE_FIELD( CSquidSpit, m_maxFrame, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CSquidSpit, CBaseEntity );
IMPLEMENT_SAVERESTORE( CSquidSpit, CBaseEntity )
void CSquidSpit::Spawn( void )
{
@ -147,7 +146,6 @@ void CSquidSpit :: Touch ( CBaseEntity *pOther )
if( !pOther->pev->takedamage )
{
// make a splat on the wall
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 10, dont_ignore_monsters, ENT( pev ), &tr );
UTIL_DecalTrace( &tr, DECAL_SPIT1 + RANDOM_LONG( 0, 1 ) );
@ -217,7 +215,7 @@ public:
int Save( CSave &save );
int Restore( CRestore &restore );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
static TYPEDESCRIPTION m_SaveData[];
BOOL m_fCanThreatDisplay;// this is so the squid only does the "I see a headcrab!" dance one time.
@ -225,7 +223,8 @@ public:
float m_flLastHurtTime;// we keep track of this, because if something hurts a squid, it will forget about its love of headcrabs for a while.
float m_flNextSpitTime;// last time the bullsquid used the spit attack.
};
LINK_ENTITY_TO_CLASS( monster_bullchicken, CBullsquid );
LINK_ENTITY_TO_CLASS( monster_bullchicken, CBullsquid )
TYPEDESCRIPTION CBullsquid::m_SaveData[] =
{
@ -234,7 +233,7 @@ TYPEDESCRIPTION CBullsquid::m_SaveData[] =
DEFINE_FIELD( CBullsquid, m_flNextSpitTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CBullsquid, CBaseMonster );
IMPLEMENT_SAVERESTORE( CBullsquid, CBaseMonster )
//=========================================================
// IgnoreConditions
@ -258,7 +257,6 @@ int CBullsquid::IgnoreConditions ( void )
}
}
return iIgnore;
}
@ -508,10 +506,18 @@ void CBullsquid :: SetYawSpeed ( void )
switch ( m_Activity )
{
case ACT_WALK: ys = 90; break;
case ACT_RUN: ys = 90; break;
case ACT_IDLE: ys = 90; break;
case ACT_RANGE_ATTACK1: ys = 90; break;
case ACT_WALK:
ys = 90;
break;
case ACT_RUN:
ys = 90;
break;
case ACT_IDLE:
ys = 90;
break;
case ACT_RANGE_ATTACK1:
ys = 90;
break;
default:
ys = 90;
break;
@ -545,7 +551,6 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
vecSpitDir.y += RANDOM_FLOAT( -0.05, 0.05 );
vecSpitDir.z += RANDOM_FLOAT( -0.05, 0 );
// do stuff for this event.
AttackSound();
@ -567,7 +572,6 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
CSquidSpit::Shoot( pev, vecSpitOffset, vecSpitDir * 900 );
}
break;
case BSQUID_AE_BITE:
{
// SOUND HERE!
@ -582,10 +586,10 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
case BSQUID_AE_TAILWHIP:
{
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.bullsquidDmgWhip, DMG_CLUB | DMG_ALWAYSGIB );
if( pHurt )
{
pHurt->pev->punchangle.z = -20;
@ -595,14 +599,12 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
case BSQUID_AE_BLINK:
{
// close eye.
pev->skin = 1;
}
break;
case BSQUID_AE_HOP:
{
float flGravity = g_psv_gravity->value;
@ -618,7 +620,6 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
pev->velocity.z += ( 0.625 * flGravity ) * 0.5;
}
break;
case BSQUID_AE_THROW:
{
int iPitch;
@ -626,7 +627,6 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
// squid throws its prey IF the prey is a client.
CBaseEntity *pHurt = CheckTraceHullAttack( 70, 0, 0 );
if( pHurt )
{
// croonchy bite sound
@ -641,7 +641,6 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
break;
}
//pHurt->pev->punchangle.x = RANDOM_LONG( 0, 34 ) - 5;
//pHurt->pev->punchangle.z = RANDOM_LONG( 0, 49 ) - 25;
//pHurt->pev->punchangle.y = RANDOM_LONG( 0, 89 ) - 45;
@ -657,7 +656,6 @@ void CBullsquid :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
}
@ -729,7 +727,6 @@ void CBullsquid :: Precache()
PRECACHE_SOUND( "bullchicken/bc_spithit1.wav" );
PRECACHE_SOUND( "bullchicken/bc_spithit2.wav" );
}
//=========================================================
@ -767,7 +764,6 @@ void CBullsquid :: AttackSound ( void )
}
}
//========================================================
// RunAI - overridden for bullsquid because there are things
// that need to be checked every think.
@ -796,7 +792,6 @@ void CBullsquid :: RunAI ( void )
pev->framerate = 1.25;
}
}
}
//========================================================
@ -849,7 +844,6 @@ Schedule_t slSquidChaseEnemy[] =
bits_COND_CAN_MELEE_ATTACK2 |
bits_COND_TASK_FAILED |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER |
bits_SOUND_MEAT,
"Squid Chase Enemy"
@ -922,7 +916,6 @@ Schedule_t slSquidEat[] =
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_NEW_ENEMY,
// even though HEAR_SOUND/SMELL FOOD doesn't break this schedule, we need this mask
// here or the monster won't detect these sounds at ALL while running this schedule.
bits_SOUND_MEAT |
@ -960,7 +953,6 @@ Schedule_t slSquidSniffAndEat[] =
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_NEW_ENEMY,
// even though HEAR_SOUND/SMELL FOOD doesn't break this schedule, we need this mask
// here or the monster won't detect these sounds at ALL while running this schedule.
bits_SOUND_MEAT |
@ -994,11 +986,9 @@ Schedule_t slSquidWallow[] =
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_NEW_ENEMY,
// even though HEAR_SOUND/SMELL FOOD doesn't break this schedule, we need this mask
// here or the monster won't detect these sounds at ALL while running this schedule.
bits_SOUND_GARBAGE,
"SquidWallow"
}
};
@ -1014,7 +1004,7 @@ DEFINE_CUSTOM_SCHEDULES( CBullsquid )
slSquidWallow
};
IMPLEMENT_CUSTOM_SCHEDULES( CBullsquid, CBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CBullsquid, CBaseMonster )
//=========================================================
// GetSchedule
@ -1055,7 +1045,6 @@ Schedule_t *CBullsquid :: GetSchedule( void )
if( pSound )
return GetScheduleOfType( SCHED_SQUID_WALLOW );
}
break;
}
case MONSTERSTATE_COMBAT:
@ -1113,9 +1102,10 @@ Schedule_t *CBullsquid :: GetSchedule( void )
}
return GetScheduleOfType( SCHED_CHASE_ENEMY );
break;
}
default:
break;
}
return CBaseMonster::GetSchedule();
@ -1238,7 +1228,6 @@ void CBullsquid :: RunTask ( Task_t *pTask )
}
}
//=========================================================
// GetIdealState - Overridden for Bullsquid to deal with
// the feature that makes it lose interest in headcrabs for
@ -1266,10 +1255,11 @@ MONSTERSTATE CBullsquid :: GetIdealState ( void )
}
break;
}
default:
break;
}
m_IdealMonsterState = CBaseMonster::GetIdealState();
return m_IdealMonsterState;
}

View File

@ -26,7 +26,6 @@
#include "saverestore.h"
#include "doors.h"
#define SF_BUTTON_DONTMOVE 1
#define SF_ROTBUTTON_NOTSOLID 1
#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated
@ -44,7 +43,6 @@ public:
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
string_t m_globalstate;
@ -59,9 +57,9 @@ TYPEDESCRIPTION CEnvGlobal::m_SaveData[] =
DEFINE_FIELD( CEnvGlobal, m_initialstate, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CEnvGlobal, CBaseEntity );
IMPLEMENT_SAVERESTORE( CEnvGlobal, CBaseEntity )
LINK_ENTITY_TO_CLASS( env_global, CEnvGlobal );
LINK_ENTITY_TO_CLASS( env_global, CEnvGlobal )
void CEnvGlobal::KeyValue( KeyValueData *pkvd )
{
@ -91,7 +89,6 @@ void CEnvGlobal::Spawn( void )
}
}
void CEnvGlobal::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
GLOBALESTATE oldState = gGlobalState.EntityGetState( m_globalstate );
@ -102,15 +99,12 @@ void CEnvGlobal::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
case 0:
newState = GLOBAL_OFF;
break;
case 1:
newState = GLOBAL_ON;
break;
case 2:
newState = GLOBAL_DEAD;
break;
default:
case 3:
if( oldState == GLOBAL_ON )
@ -127,8 +121,6 @@ void CEnvGlobal::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
gGlobalState.EntityAdd( m_globalstate, gpGlobals->mapname, newState );
}
TYPEDESCRIPTION CMultiSource::m_SaveData[] =
{
//!!!BUGBUG FIX
@ -138,13 +130,13 @@ TYPEDESCRIPTION CMultiSource::m_SaveData[] =
DEFINE_FIELD( CMultiSource, m_globalstate, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CMultiSource, CBaseEntity );
IMPLEMENT_SAVERESTORE( CMultiSource, CBaseEntity )
LINK_ENTITY_TO_CLASS( multisource, CMultiSource )
LINK_ENTITY_TO_CLASS( multisource, CMultiSource );
//
// Cache user-entity-field values until spawn is called.
//
void CMultiSource::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "style" ) ||
@ -193,21 +185,19 @@ void CMultiSource::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
}
// CONSIDER: a Use input to the multisource always toggles. Could check useType for ON/OFF/TOGGLE
m_rgTriggered[i - 1] ^= 1;
//
if( IsTriggered( pActivator ) )
{
ALERT( at_aiconsole, "Multisource %s enabled (%d inputs)\n", STRING( pev->targetname ), m_iTotal );
USE_TYPE useType = USE_TOGGLE;
useType = USE_TOGGLE;
if( m_globalstate )
useType = USE_ON;
SUB_UseTargets( NULL, useType, 0 );
}
}
BOOL CMultiSource::IsTriggered( CBaseEntity * )
{
// Is everything triggered?
@ -243,7 +233,6 @@ void CMultiSource::Register(void)
SetThink( &CBaseEntity::SUB_DoNothing );
// search for all entities which target this multisource (pev->targetname)
pentTarget = FIND_ENTITY_BY_STRING( NULL, "target", STRING( pev->targetname ) );
while( !FNullEnt( pentTarget ) && ( m_iTotal < MS_MAX_TARGETS ) )
@ -264,7 +253,6 @@ void CMultiSource::Register(void)
pentTarget = FIND_ENTITY_BY_STRING( pentTarget, "classname", "multi_manager" );
}
pev->spawnflags &= ~SF_MULTI_INIT;
}
@ -283,8 +271,7 @@ TYPEDESCRIPTION CBaseButton::m_SaveData[] =
//DEFINE_FIELD( CBaseButton, m_ls, FIELD_??? ), // This is restored in Precache()
};
IMPLEMENT_SAVERESTORE( CBaseButton, CBaseToggle );
IMPLEMENT_SAVERESTORE( CBaseButton, CBaseToggle )
void CBaseButton::Precache( void )
{
@ -301,7 +288,6 @@ void CBaseButton::Precache( void )
}
// get door button sounds, for doors which require buttons to open
if( m_bLockedSound )
{
pszSound = ButtonSound( (int)m_bLockedSound );
@ -317,41 +303,75 @@ void CBaseButton::Precache( void )
}
// get sentence group names, for doors which are directly 'touched' to open
switch( m_bLockedSentence )
{
case 1: m_ls.sLockedSentence = MAKE_STRING("NA"); break; // access denied
case 2: m_ls.sLockedSentence = MAKE_STRING("ND"); break; // security lockout
case 3: m_ls.sLockedSentence = MAKE_STRING("NF"); break; // blast door
case 4: m_ls.sLockedSentence = MAKE_STRING("NFIRE"); break; // fire door
case 5: m_ls.sLockedSentence = MAKE_STRING("NCHEM"); break; // chemical door
case 6: m_ls.sLockedSentence = MAKE_STRING("NRAD"); break; // radiation door
case 7: m_ls.sLockedSentence = MAKE_STRING("NCON"); break; // gen containment
case 8: m_ls.sLockedSentence = MAKE_STRING("NH"); break; // maintenance door
case 9: m_ls.sLockedSentence = MAKE_STRING("NG"); break; // broken door
default: m_ls.sLockedSentence = 0; break;
case 1: // access denied
m_ls.sLockedSentence = MAKE_STRING( "NA" );
break;
case 2: // security lockout
m_ls.sLockedSentence = MAKE_STRING( "ND" );
break;
case 3: // blast door
m_ls.sLockedSentence = MAKE_STRING( "NF" );
break;
case 4: // fire door
m_ls.sLockedSentence = MAKE_STRING( "NFIRE" );
break;
case 5: // chemical door
m_ls.sLockedSentence = MAKE_STRING( "NCHEM" );
break;
case 6: // radiation door
m_ls.sLockedSentence = MAKE_STRING( "NRAD" );
break;
case 7: // gen containment
m_ls.sLockedSentence = MAKE_STRING( "NCON" );
break;
case 8: // maintenance door
m_ls.sLockedSentence = MAKE_STRING( "NH" );
break;
case 9: // broken door
m_ls.sLockedSentence = MAKE_STRING( "NG" );
break;
default:
m_ls.sLockedSentence = 0;
break;
}
switch( m_bUnlockedSentence )
{
case 1: m_ls.sUnlockedSentence = MAKE_STRING("EA"); break; // access granted
case 2: m_ls.sUnlockedSentence = MAKE_STRING("ED"); break; // security door
case 3: m_ls.sUnlockedSentence = MAKE_STRING("EF"); break; // blast door
case 4: m_ls.sUnlockedSentence = MAKE_STRING("EFIRE"); break; // fire door
case 5: m_ls.sUnlockedSentence = MAKE_STRING("ECHEM"); break; // chemical door
case 6: m_ls.sUnlockedSentence = MAKE_STRING("ERAD"); break; // radiation door
case 7: m_ls.sUnlockedSentence = MAKE_STRING("ECON"); break; // gen containment
case 8: m_ls.sUnlockedSentence = MAKE_STRING("EH"); break; // maintenance door
default: m_ls.sUnlockedSentence = 0; break;
case 1: // access granted
m_ls.sUnlockedSentence = MAKE_STRING( "EA" );
break;
case 2: // security door
m_ls.sUnlockedSentence = MAKE_STRING("ED");
break;
case 3: // blast door
m_ls.sUnlockedSentence = MAKE_STRING("EF");
break;
case 4: // fire door
m_ls.sUnlockedSentence = MAKE_STRING("EFIRE");
break;
case 5: // chemical door
m_ls.sUnlockedSentence = MAKE_STRING("ECHEM");
break;
case 6: // radiation door
m_ls.sUnlockedSentence = MAKE_STRING("ERAD");
break;
case 7: // gen containment
m_ls.sUnlockedSentence = MAKE_STRING("ECON");
break;
case 8: // maintenance door
m_ls.sUnlockedSentence = MAKE_STRING("EH");
break;
default:
m_ls.sUnlockedSentence = 0;
break;
}
}
//
// Cache user-entity-field values until spawn is called.
//
void CBaseButton::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "changetarget" ) )
@ -436,8 +456,8 @@ where it can be triggered again.
2) metallic click
3) in-out
*/
LINK_ENTITY_TO_CLASS( func_button, CBaseButton );
LINK_ENTITY_TO_CLASS( func_button, CBaseButton )
void CBaseButton::Spawn()
{
@ -483,16 +503,14 @@ void CBaseButton::Spawn( )
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2 ) ) + fabs( pev->movedir.y * ( pev->size.y - 2 ) ) + fabs( pev->movedir.z * ( pev->size.z - 2 ) ) - m_flLip ) );
// Is this a non-moving button?
if( ( ( m_vecPosition2 - m_vecPosition1 ).Length() < 1 ) || ( pev->spawnflags & SF_BUTTON_DONTMOVE ) )
m_vecPosition2 = m_vecPosition1;
m_fStayPushed = (m_flWait == -1 ? TRUE : FALSE);
m_fStayPushed = m_flWait == -1 ? TRUE : FALSE;
m_fRotating = FALSE;
// if the button is flagged for USE button activation only, take away it's touch function and add a use function
if( FBitSet( pev->spawnflags, SF_BUTTON_TOUCH_ONLY ) ) // touchable button
{
SetTouch( &CBaseButton::ButtonTouch );
@ -504,7 +522,6 @@ void CBaseButton::Spawn( )
}
}
// Button sound table.
// Also used by CBaseDoor to get 'touched' door lock/unlock sounds
@ -514,31 +531,72 @@ char *ButtonSound( int sound )
switch( sound )
{
case 0: pszSound = "common/null.wav"; break;
case 1: pszSound = "buttons/button1.wav"; break;
case 2: pszSound = "buttons/button2.wav"; break;
case 3: pszSound = "buttons/button3.wav"; break;
case 4: pszSound = "buttons/button4.wav"; break;
case 5: pszSound = "buttons/button5.wav"; break;
case 6: pszSound = "buttons/button6.wav"; break;
case 7: pszSound = "buttons/button7.wav"; break;
case 8: pszSound = "buttons/button8.wav"; break;
case 9: pszSound = "buttons/button9.wav"; break;
case 10: pszSound = "buttons/button10.wav"; break;
case 11: pszSound = "buttons/button11.wav"; break;
case 12: pszSound = "buttons/latchlocked1.wav"; break;
case 13: pszSound = "buttons/latchunlocked1.wav"; break;
case 14: pszSound = "buttons/lightswitch2.wav";break;
case 0:
pszSound = "common/null.wav";
break;
case 1:
pszSound = "buttons/button1.wav";
break;
case 2:
pszSound = "buttons/button2.wav";
break;
case 3:
pszSound = "buttons/button3.wav";
break;
case 4:
pszSound = "buttons/button4.wav";
break;
case 5:
pszSound = "buttons/button5.wav";
break;
case 6:
pszSound = "buttons/button6.wav";
break;
case 7:
pszSound = "buttons/button7.wav";
break;
case 8:
pszSound = "buttons/button8.wav";
break;
case 9:
pszSound = "buttons/button9.wav";
break;
case 10:
pszSound = "buttons/button10.wav";
break;
case 11:
pszSound = "buttons/button11.wav";
break;
case 12:
pszSound = "buttons/latchlocked1.wav";
break;
case 13:
pszSound = "buttons/latchunlocked1.wav";
break;
case 14:
pszSound = "buttons/lightswitch2.wav";
break;
// next 6 slots reserved for any additional sliding button sounds we may add
case 21: pszSound = "buttons/lever1.wav"; break;
case 22: pszSound = "buttons/lever2.wav"; break;
case 23: pszSound = "buttons/lever3.wav"; break;
case 24: pszSound = "buttons/lever4.wav"; break;
case 25: pszSound = "buttons/lever5.wav"; break;
default:pszSound = "buttons/button9.wav"; break;
case 21:
pszSound = "buttons/lever1.wav";
break;
case 22:
pszSound = "buttons/lever2.wav";
break;
case 23:
pszSound = "buttons/lever3.wav";
break;
case 24:
pszSound = "buttons/lever4.wav";
break;
case 25:
pszSound = "buttons/lever5.wav";
break;
default:
pszSound = "buttons/button9.wav";
break;
}
return pszSound;
@ -547,7 +605,6 @@ char *ButtonSound( int sound )
//
// Makes flagged buttons spark when turned off
//
void DoSpark( entvars_t *pev, const Vector &location )
{
Vector tmp = location + pev->size * 0.5;
@ -556,24 +613,35 @@ void DoSpark(entvars_t *pev, const Vector &location )
float flVolume = RANDOM_FLOAT( 0.25 , 0.75 ) * 0.4;//random volume range
switch( (int)( RANDOM_FLOAT( 0, 1 ) * 6 ) )
{
case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM); break;
case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark2.wav", flVolume, ATTN_NORM); break;
case 2: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark3.wav", flVolume, ATTN_NORM); break;
case 3: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark4.wav", flVolume, ATTN_NORM); break;
case 4: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM); break;
case 5: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break;
case 0:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "buttons/spark2.wav", flVolume, ATTN_NORM );
break;
case 2:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "buttons/spark3.wav", flVolume, ATTN_NORM );
break;
case 3:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "buttons/spark4.wav", flVolume, ATTN_NORM );
break;
case 4:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM );
break;
case 5:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM );
break;
}
}
void CBaseButton::ButtonSpark( void )
{
SetThink( &CBaseButton::ButtonSpark );
pev->nextthink = gpGlobals->time + ( 0.1 + RANDOM_FLOAT ( 0, 1.5 ) );// spark again at random interval
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT( 0, 1.5 );// spark again at random interval
DoSpark( pev, pev->mins );
}
//
// Button's Use function
//
@ -599,7 +667,6 @@ void CBaseButton::ButtonUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE
ButtonActivate();
}
CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch( void )
{
// Ignore touches if button is moving, or pushed-in and waiting to auto-come-out.
@ -621,7 +688,6 @@ CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch( void )
return BUTTON_NOTHING;
}
//
// Touching a button simply "activates" it.
//
@ -719,11 +785,9 @@ void CBaseButton::TriggerAndWait( void )
pev->frame = 1; // use alternate textures
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
}
//
// Starts the button moving "out/down".
//
@ -741,7 +805,6 @@ void CBaseButton::ButtonReturn( void )
pev->frame = 0; // use normal textures
}
//
// Button has returned to start state. Quiesce it.
//
@ -757,7 +820,6 @@ void CBaseButton::ButtonBackHome( void )
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
}
if( !FStringNull( pev->target ) )
{
edict_t *pentTarget = NULL;
@ -794,8 +856,6 @@ void CBaseButton::ButtonBackHome( void )
}
}
//
// Rotating button (aka "lever")
//
@ -805,7 +865,7 @@ public:
void Spawn( void );
};
LINK_ENTITY_TO_CLASS( func_rot_button, CRotButton );
LINK_ENTITY_TO_CLASS( func_rot_button, CRotButton )
void CRotButton::Spawn( void )
{
@ -850,7 +910,7 @@ void CRotButton::Spawn( void )
m_vecAngle2 = pev->angles + pev->movedir * m_flMoveDistance;
ASSERTSZ( m_vecAngle1 != m_vecAngle2, "rotating button start/end positions are equal" );
m_fStayPushed = (m_flWait == -1 ? TRUE : FALSE);
m_fStayPushed = m_flWait == -1 ? TRUE : FALSE;
m_fRotating = TRUE;
// if the button is flagged for USE button activation only, take away it's touch function and add a use function
@ -865,7 +925,6 @@ void CRotButton::Spawn( void )
//SetTouch( &ButtonTouch );
}
// Make this button behave like a door (HACKHACK)
// This will disable use and make the button solid
// rotating buttons were made SOLID_NOT by default since their were some
@ -897,7 +956,6 @@ public:
static CMomentaryRotButton *Instance( edict_t *pent ) { return (CMomentaryRotButton *)GET_PRIVATE( pent ); };
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
int m_lastUsed;
@ -907,6 +965,7 @@ public:
vec3_t m_end;
int m_sounds;
};
TYPEDESCRIPTION CMomentaryRotButton::m_SaveData[] =
{
DEFINE_FIELD( CMomentaryRotButton, m_lastUsed, FIELD_INTEGER ),
@ -917,9 +976,9 @@ TYPEDESCRIPTION CMomentaryRotButton::m_SaveData[] =
DEFINE_FIELD( CMomentaryRotButton, m_sounds, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CMomentaryRotButton, CBaseToggle );
IMPLEMENT_SAVERESTORE( CMomentaryRotButton, CBaseToggle )
LINK_ENTITY_TO_CLASS( momentary_rot_button, CMomentaryRotButton );
LINK_ENTITY_TO_CLASS( momentary_rot_button, CMomentaryRotButton )
void CMomentaryRotButton::Spawn( void )
{
@ -995,7 +1054,6 @@ void CMomentaryRotButton::UpdateAllButtons( float value, int start )
edict_t *pentTarget = NULL;
for( ; ; )
{
pentTarget = FIND_ENTITY_BY_STRING( pentTarget, "target", STRING( pev->target ) );
if( FNullEnt( pentTarget ) )
break;
@ -1048,7 +1106,7 @@ void CMomentaryRotButton::UpdateSelf( float value )
else
pev->nextthink += 0.1;
pev->avelocity = (m_direction * pev->speed) * pev->movedir;
pev->avelocity = m_direction * pev->speed * pev->movedir;
SetThink( &CMomentaryRotButton::Off );
}
@ -1094,7 +1152,6 @@ void CMomentaryRotButton::Return( void )
UpdateTarget( value );
}
void CMomentaryRotButton::UpdateSelfReturn( float value )
{
if( value <= 0 )
@ -1111,7 +1168,6 @@ void CMomentaryRotButton::UpdateSelfReturn( float value )
}
}
//----------------------------------------------------------------
// Spark
//----------------------------------------------------------------
@ -1128,22 +1184,20 @@ public:
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
float m_flDelay;
};
TYPEDESCRIPTION CEnvSpark::m_SaveData[] =
{
DEFINE_FIELD( CEnvSpark, m_flDelay, FIELD_FLOAT),
};
IMPLEMENT_SAVERESTORE( CEnvSpark, CBaseEntity );
IMPLEMENT_SAVERESTORE( CEnvSpark, CBaseEntity )
LINK_ENTITY_TO_CLASS(env_spark, CEnvSpark);
LINK_ENTITY_TO_CLASS(env_debris, CEnvSpark);
LINK_ENTITY_TO_CLASS( env_spark, CEnvSpark )
LINK_ENTITY_TO_CLASS( env_debris, CEnvSpark )
void CEnvSpark::Spawn( void )
{
@ -1163,7 +1217,7 @@ void CEnvSpark::Spawn(void)
else
SetThink( &CEnvSpark::SparkThink );
pev->nextthink = gpGlobals->time + ( 0.1 + RANDOM_FLOAT ( 0, 1.5 ) );
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT( 0, 1.5 );
if( m_flDelay <= 0 )
m_flDelay = 1.5;
@ -1171,7 +1225,6 @@ void CEnvSpark::Spawn(void)
Precache();
}
void CEnvSpark::Precache( void )
{
PRECACHE_SOUND( "buttons/spark1.wav" );
@ -1210,7 +1263,7 @@ void EXPORT CEnvSpark::SparkStart(CBaseEntity *pActivator, CBaseEntity *pCaller,
{
SetUse( &CEnvSpark::SparkStop );
SetThink( &CEnvSpark::SparkThink );
pev->nextthink = gpGlobals->time + (0.1 + RANDOM_FLOAT ( 0, m_flDelay));
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT( 0, m_flDelay );
}
void EXPORT CEnvSpark::SparkStop( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
@ -1229,10 +1282,9 @@ public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
int ObjectCaps( void );
};
LINK_ENTITY_TO_CLASS( button_target, CButtonTarget );
LINK_ENTITY_TO_CLASS( button_target, CButtonTarget )
void CButtonTarget::Spawn( void )
{
@ -1256,7 +1308,6 @@ void CButtonTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
SUB_UseTargets( pActivator, USE_OFF, 0 );
}
int CButtonTarget::ObjectCaps( void )
{
int caps = CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION;
@ -1267,7 +1318,6 @@ int CButtonTarget :: ObjectCaps( void )
return caps;
}
int CButtonTarget::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
Use( Instance( pevAttacker ), this, USE_TOGGLE, 0 );

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -128,7 +129,6 @@ int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion )
}
#endif
int DispatchSpawn( edict_t *pent )
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE( pent );
@ -154,7 +154,6 @@ int DispatchSpawn( edict_t *pent )
return -1;
}
// Handle global stuff here
if( pEntity && pEntity->pev->globalname )
{
@ -202,10 +201,10 @@ void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd )
pEntity->KeyValue( pkvd );
}
// HACKHACK -- this is a hack to keep the node graph entity from "touching" things (like triggers)
// while it builds the graph
BOOL gTouchDisabled = FALSE;
void DispatchTouch( edict_t *pentTouched, edict_t *pentOther )
{
if( gTouchDisabled )
@ -218,7 +217,6 @@ void DispatchTouch( edict_t *pentTouched, edict_t *pentOther )
pEntity->Touch( pOther );
}
void DispatchUse( edict_t *pentUsed, edict_t *pentOther )
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE( pentUsed );
@ -281,7 +279,6 @@ void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData )
}
}
// Find the matching global entity. Spit out an error if the designer made entities of
// different classes with the same global name
CBaseEntity *FindGlobalEntity( string_t classname, string_t globalname )
@ -300,7 +297,6 @@ CBaseEntity *FindGlobalEntity( string_t classname, string_t globalname )
return pReturn;
}
int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity )
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE( pent );
@ -322,7 +318,6 @@ int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity
pSaveData->pCurrentData = pSaveData->pBaseData + pSaveData->size;
// -------------------
const globalentity_t *pGlobal = gGlobalState.EntityFromTable( tmpVars.globalname );
// Don't overlay any instance of the global that isn't the latest
@ -352,7 +347,6 @@ int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity
// or call EntityUpdate() to move it to this level, we haven't changed global state at all.
return 0;
}
}
if( pEntity->ObjectCaps() & FCAP_MUST_SPAWN )
@ -368,14 +362,12 @@ int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity
// Again, could be deleted, get the pointer again.
pEntity = (CBaseEntity *)GET_PRIVATE( pent );
#if 0
if( pEntity && pEntity->pev->globalname && globalEntity )
{
ALERT( at_console, "Global %s is %s\n", STRING( pEntity->pev->globalname ), STRING( pEntity->pev->model ) );
}
#endif
// Is this an overriding global entity (coming over the transition), or one restoring in a level
if( globalEntity )
{
@ -412,7 +404,6 @@ int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity
return 0;
}
void DispatchObjectCollsionBox( edict_t *pent )
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE( pent );
@ -424,21 +415,18 @@ void DispatchObjectCollsionBox( edict_t *pent )
SetObjectCollisionBox( &pent->v );
}
void SaveWriteFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount )
{
CSave saveHelper( pSaveData );
saveHelper.WriteFields( pname, pBaseData, pFields, fieldCount );
}
void SaveReadFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount )
{
CRestore restoreHelper( pSaveData );
restoreHelper.ReadFields( pname, pBaseData, pFields, fieldCount );
}
edict_t *EHANDLE::Get( void )
{
if( m_pent )
@ -449,7 +437,7 @@ edict_t * EHANDLE::Get( void )
return NULL;
}
return NULL;
};
}
edict_t *EHANDLE::Set( edict_t *pent )
{
@ -457,14 +445,12 @@ edict_t * EHANDLE::Set( edict_t *pent )
if( pent )
m_serialnumber = m_pent->serialnumber;
return pent;
};
}
EHANDLE::operator CBaseEntity *()
{
return (CBaseEntity *)GET_PRIVATE( Get() );
};
}
CBaseEntity *EHANDLE::operator = ( CBaseEntity *pEntity )
{
@ -492,7 +478,6 @@ CBaseEntity * EHANDLE :: operator -> ()
return (CBaseEntity *)GET_PRIVATE( Get() );
}
// give health
int CBaseEntity::TakeHealth( float flHealth, int bitsDamageType )
{
@ -526,19 +511,18 @@ int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker,
// (that is, no actual entity projectile was involved in the attack so use the shooter's origin).
if( pevAttacker == pevInflictor )
{
vecTemp = pevInflictor->origin - ( VecBModelOrigin(pev) );
vecTemp = pevInflictor->origin - VecBModelOrigin( pev );
}
else
// an actual missile was involved.
{
vecTemp = pevInflictor->origin - ( VecBModelOrigin(pev) );
vecTemp = pevInflictor->origin - VecBModelOrigin( pev );
}
// this global is still used for glass and other non-monster killables, along with decals.
g_vecAttackDir = vecTemp.Normalize();
// save damage based on the target's armor level
// figure momentum add (don't let hurt brushes or other triggers move player)
if( ( !FNullEnt( pevInflictor ) ) && (pev->movetype == MOVETYPE_WALK || pev->movetype == MOVETYPE_STEP ) && ( pevAttacker->solid != SOLID_TRIGGER ) )
{
@ -563,7 +547,6 @@ int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker,
return 1;
}
void CBaseEntity::Killed( entvars_t *pevAttacker, int iGib )
{
pev->takedamage = DAMAGE_NO;
@ -571,7 +554,6 @@ void CBaseEntity :: Killed( entvars_t *pevAttacker, int iGib )
UTIL_Remove( this );
}
CBaseEntity *CBaseEntity::GetNextTarget( void )
{
if( FStringNull( pev->target ) )
@ -594,7 +576,6 @@ TYPEDESCRIPTION CBaseEntity::m_SaveData[] =
DEFINE_FIELD( CBaseEntity, m_pfnBlocked, FIELD_FUNCTION ),
};
int CBaseEntity::Save( CSave &save )
{
if( save.WriteEntVars( "ENTVARS", pev ) )
@ -617,7 +598,6 @@ int CBaseEntity::Restore( CRestore &restore )
mins = pev->mins; // Set model is about to destroy these
maxs = pev->maxs;
PRECACHE_MODEL( (char *)STRING( pev->model ) );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
UTIL_SetSize( pev, mins, maxs ); // Reset them
@ -626,13 +606,13 @@ int CBaseEntity::Restore( CRestore &restore )
return status;
}
// Initialize absmin & absmax to the appropriate box
void SetObjectCollisionBox( entvars_t *pev )
{
if( ( pev->solid == SOLID_BSP ) &&
( pev->angles.x || pev->angles.y || pev->angles.z ) )
{ // expand for rotation
{
// expand for rotation
float max, v;
int i;
@ -666,13 +646,11 @@ void SetObjectCollisionBox( entvars_t *pev )
pev->absmax.z += 1;
}
void CBaseEntity::SetObjectCollisionBox( void )
{
::SetObjectCollisionBox( pev );
}
int CBaseEntity::Intersects( CBaseEntity *pOther )
{
if( pOther->pev->absmin.x > pev->absmax.x ||
@ -709,19 +687,31 @@ int CBaseEntity :: IsDormant( void )
BOOL CBaseEntity::IsInWorld( void )
{
// position
if (pev->origin.x >= 4096) return FALSE;
if (pev->origin.y >= 4096) return FALSE;
if (pev->origin.z >= 4096) return FALSE;
if (pev->origin.x <= -4096) return FALSE;
if (pev->origin.y <= -4096) return FALSE;
if (pev->origin.z <= -4096) return FALSE;
if( pev->origin.x >= 4096 )
return FALSE;
if( pev->origin.y >= 4096 )
return FALSE;
if( pev->origin.z >= 4096 )
return FALSE;
if( pev->origin.x <= -4096 )
return FALSE;
if( pev->origin.y <= -4096 )
return FALSE;
if( pev->origin.z <= -4096 )
return FALSE;
// speed
if (pev->velocity.x >= 2000) return FALSE;
if (pev->velocity.y >= 2000) return FALSE;
if (pev->velocity.z >= 2000) return FALSE;
if (pev->velocity.x <= -2000) return FALSE;
if (pev->velocity.y <= -2000) return FALSE;
if (pev->velocity.z <= -2000) return FALSE;
if( pev->velocity.x >= 2000 )
return FALSE;
if( pev->velocity.y >= 2000 )
return FALSE;
if( pev->velocity.z >= 2000 )
return FALSE;
if( pev->velocity.x <= -2000 )
return FALSE;
if( pev->velocity.y <= -2000 )
return FALSE;
if( pev->velocity.z <= -2000 )
return FALSE;
return TRUE;
}
@ -736,7 +726,6 @@ int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState )
return 1;
}
int CBaseEntity::DamageDecal( int bitsDamageType )
{
if( pev->rendermode == kRenderTransAlpha )
@ -748,8 +737,6 @@ int CBaseEntity :: DamageDecal( int bitsDamageType )
return DECAL_GUNSHOT1 + RANDOM_LONG( 0, 4 );
}
// NOTE: szName must be a pointer to constant memory, e.g. "monster_class" because the entity
// will keep a pointer to it after this call.
CBaseEntity *CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner )
@ -770,5 +757,3 @@ CBaseEntity * CBaseEntity::Create( char *szName, const Vector &vecOrigin, const
DispatchSpawn( pEntity->edict() );
return pEntity;
}

View File

@ -72,7 +72,13 @@ extern void SaveGlobalState( SAVERESTOREDATA *pSaveData );
extern void RestoreGlobalState( SAVERESTOREDATA *pSaveData );
extern void ResetGlobalState( void );
typedef enum { USE_OFF = 0, USE_ON = 1, USE_SET = 2, USE_TOGGLE = 3 } USE_TYPE;
typedef enum
{
USE_OFF = 0,
USE_ON = 1,
USE_SET = 2,
USE_TOGGLE = 3
} USE_TYPE;
extern void FireTargets( const char *targetName, CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
@ -102,7 +108,6 @@ class CBaseMonster;
class CBasePlayerItem;
class CSquadMonster;
#define SF_NORESPAWN ( 1 << 30 )// !!!set this bit on guns and stuff that should never respawn.
//
@ -125,7 +130,6 @@ public:
CBaseEntity *operator ->();
};
//
// Base Entity. All entity types derive from this
//
@ -157,7 +161,6 @@ public:
virtual int Classify( void ) { return CLASS_NONE; };
virtual void DeathNotice( entvars_t *pevChild ) {}// monster maker children use this to tell the monster maker that they have died.
static TYPEDESCRIPTION m_SaveData[];
virtual void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
@ -194,7 +197,6 @@ public:
virtual BOOL IsNetClient( void ) { return FALSE; }
virtual const char *TeamID( void ) { return ""; }
//virtual void SetActivator( CBaseEntity *pActivator ) {}
virtual CBaseEntity *GetNextTarget( void );
@ -204,8 +206,8 @@ public:
void ( CBaseEntity ::*m_pfnUse )( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void ( CBaseEntity ::*m_pfnBlocked )( CBaseEntity *pOther );
virtual void Think( void ) { if (m_pfnThink) (this->*m_pfnThink)(); };
virtual void Touch( CBaseEntity *pOther ) { if (m_pfnTouch) (this->*m_pfnTouch)( pOther ); };
virtual void Think( void ) { if( m_pfnThink ) ( this->*m_pfnThink )(); }
virtual void Touch( CBaseEntity *pOther ) { if( m_pfnTouch ) (this->*m_pfnTouch)( pOther ); }
virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if( m_pfnUse )
@ -274,7 +276,6 @@ public:
return NULL;
}
// Ugly code to lookup all functions to make sure they are exported when set.
#ifdef _DEBUG
void FunctionCheck( void *pFunction, char *name )
@ -307,17 +308,12 @@ public:
FunctionCheck( (void *)*( (int *)( (char *)this + ( offsetof( CBaseEntity, m_pfnBlocked ) ) ) ), name );
return func;
}
#endif
// virtual functions used by a few classes
// used by monsters that are created by the MonsterMaker
virtual void UpdateOwner( void ) { return; };
//
static CBaseEntity *Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL );
virtual BOOL FBecomeProne( void ) {return FALSE;};
@ -354,8 +350,6 @@ public:
int m_fireState;
};
// Ugly technique to override base member functions
// Normally it's illegal to cast a pointer to a member function of a derived class to a pointer to a
// member function of a base class. static_cast is a sleezy way around that problem.
@ -378,10 +372,8 @@ public:
#define ResetUse( ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (NULL)
#define ResetBlocked( ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
#endif
class CPointEntity : public CBaseEntity
{
public:
@ -390,7 +382,6 @@ public:
private:
};
typedef struct locksounds // sounds that doors and buttons make when locked/unlocked
{
string_t sLockedSound; // sound a door makes when it's locked
@ -425,9 +416,9 @@ public:
int ObjectCaps( void ) { return ( CPointEntity::ObjectCaps() | FCAP_MASTER ); }
BOOL IsTriggered( CBaseEntity *pActivator );
void EXPORT Register( void );
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
EHANDLE m_rgEntities[MS_MAX_TARGETS];
@ -450,20 +441,17 @@ public:
virtual void KeyValue( KeyValueData *pkvd );
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
// common member functions
void SUB_UseTargets( CBaseEntity *pActivator, USE_TYPE useType, float value );
void EXPORT DelayThink( void );
};
class CBaseAnimating : public CBaseDelay
{
public:
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
// Basic Monster Animation functions
@ -495,7 +483,6 @@ public:
BOOL m_fSequenceLoops; // true if the sequence loops
};
//
// generic Toggle entity.
//
@ -671,7 +658,6 @@ class CSound;
char *ButtonSound( int sound ); // get string of button sound number
//
// Generic Button
//
@ -723,7 +709,6 @@ public:
//
// Weapons
//
#define BAD_WEAPON 0x00007FFF
//
@ -750,7 +735,6 @@ template <class T> T * GetClassPtr( T *a )
return a;
}
/*
bit_PUSHBRUSH_DATA | bit_TOGGLE_DATA
bit_MONSTER_DATA
@ -784,7 +768,6 @@ typedef struct _SelAmmo
BYTE Ammo2;
} SelAmmo;
// this moved here from world.cpp, to allow classes to be derived from it
//=======================
// CWorld

View File

@ -42,5 +42,4 @@
#define WEAPON_SUIT 31
#endif

View File

@ -83,10 +83,8 @@ BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddres
// a client connecting during an intermission can cause problems
// if( intermission_running )
// ExitIntermission();
}
/*
===========
ClientDisconnect
@ -127,7 +125,6 @@ void ClientDisconnect( edict_t *pEntity )
g_pGameRules->ClientDisconnected( pEntity );
}
// called by ClientKill and DeadThink
void respawn( entvars_t *pev, BOOL fCopyCorpse )
{
@ -201,10 +198,8 @@ void ClientPutInServer( edict_t *pEntity )
pPlayer->pev->iuser1 = 0;
pPlayer->pev->iuser2 = 0;
}
#ifndef NO_VOICEGAMEMGR
#include "voice_gamemgr.h"
extern CVoiceGameMgr g_VoiceGameMgr;
@ -295,7 +290,6 @@ void Host_Say( edict_t *pEntity, int teamonly )
strcat( text, p );
strcat( text, "\n" );
player->m_flNextChatTime = gpGlobals->time + CHAT_INTERVAL;
// loop through all players
@ -314,13 +308,11 @@ void Host_Say( edict_t *pEntity, int teamonly )
if( !( client->IsNetClient() ) ) // Not a client ? (should never be true)
continue;
#ifndef NO_VOICEGAMEMGR
// can the receiver hear the sender? or has he muted him?
if( g_VoiceGameMgr.PlayerHasBlockedPlayer( client, player ) )
continue;
#endif
if( teamonly && g_pGameRules->PlayerRelationship( client, CBaseEntity::Instance( pEntity ) ) != GR_TEAMMATE )
continue;
@ -328,7 +320,6 @@ void Host_Say( edict_t *pEntity, int teamonly )
WRITE_BYTE( ENTINDEX( pEntity ) );
WRITE_STRING( text );
MESSAGE_END();
}
// print to the sending client
@ -369,7 +360,6 @@ void Host_Say( edict_t *pEntity, int teamonly )
}
}
/*
===========
ClientCommand
@ -476,10 +466,10 @@ void ClientCommand( edict_t *pEntity )
edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer );
pPlayer->StartObserver( pev->origin, VARS( pentSpawnSpot )->angles );
}
else if ( g_pGameRules->ClientCommand( GetClassPtr((CBasePlayer *)pev), pcmd ) )
/*else if( g_pGameRules->ClientCommand( GetClassPtr( (CBasePlayer *)pev ), pcmd ) )
{
// MenuSelect returns true only if the command is properly handled, so don't print a warning
}
}*/
else if( FStrEq( pcmd, "VModEnable" ) )
{
// clear 'Unknown command: VModEnable' in singleplayer
@ -500,7 +490,6 @@ void ClientCommand( edict_t *pEntity )
}
}
/*
========================
ClientUserInfoChanged
@ -621,7 +610,6 @@ void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
LinkUserMessages();
}
/*
================
PlayerPreThink
@ -658,13 +646,10 @@ void PlayerPostThink( edict_t *pEntity )
pPlayer->PostThink();
}
void ParmsNewLevel( void )
{
}
void ParmsChangeLevel( void )
{
// retrieve the pointer to the save data
@ -674,7 +659,6 @@ void ParmsChangeLevel( void )
pSaveData->connectionCount = BuildChangeList( pSaveData->levelList, MAX_LEVEL_CONNECTIONS );
}
//
// GLOBALS ASSUMED SET: g_ulFrameCount
//
@ -787,16 +771,13 @@ void ClientPrecache( void )
PRECACHE_MODEL( "models/player.mdl" );
// hud sounds
PRECACHE_SOUND( "common/wpn_hudoff.wav" );
PRECACHE_SOUND( "common/wpn_hudon.wav" );
PRECACHE_SOUND( "common/wpn_moveselect.wav" );
PRECACHE_SOUND( "common/wpn_select.wav" );
PRECACHE_SOUND( "common/wpn_denyselect.wav" );
// geiger sounds
PRECACHE_SOUND( "player/geiger6.wav" );
PRECACHE_SOUND( "player/geiger5.wav" );
PRECACHE_SOUND( "player/geiger4.wav" );
@ -1002,8 +983,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
int i;
// don't send if flagged for NODRAW and it's not the host getting the message
if ( ( ent->v.effects == EF_NODRAW ) &&
( ent != host ) )
if( ( ent->v.effects == EF_NODRAW ) && ( ent != host ) )
return 0;
// Ignore ents without valid / visible models
@ -1030,11 +1010,12 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
}
}
// Don't send entity to local client if the client says it's predicting the entity itself.
if( ent->v.flags & FL_SKIPLOCALHOST )
{
if ( hostflags & 4 ) return 0; // it's a portal pass
if( hostflags & 4 )
return 0; // it's a portal pass
if( ( hostflags & 1 ) && ( ent->v.owner == host ) )
return 0;
}
@ -1180,7 +1161,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
state->gravity = ent->v.gravity;
//state->team = ent->v.team;
//
state->usehull = ( ent->v.flags & FL_DUCKING ) ? 1 : 0;
state->health = ent->v.health;
}
@ -1508,8 +1489,6 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
CBasePlayer *pl = (CBasePlayer *)CBasePlayer::Instance( pev );
CBasePlayerWeapon *gun;
ItemInfo II;
memset( info, 0, 32 * sizeof(weapon_data_t) );
if( !pl )
@ -1528,8 +1507,8 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
gun = (CBasePlayerWeapon *)pPlayerItem->GetWeaponPtr();
if( gun && gun->UseDecrement() )
{
ItemInfo II = {0};
// Get The ID.
memset( &II, 0, sizeof( II ) );
gun->GetItemInfo( &II );
if( II.iId >= 0 && II.iId < 32 )
@ -1551,7 +1530,6 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
item->iuser2 = gun->m_fInAttack;
item->iuser3 = gun->m_fireState;
//item->m_flPumpTime = max( gun->m_flPumpTime, -0.001 );
}
}
@ -1624,15 +1602,13 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien
cd->ammo_cells = pl->ammo_uranium;
cd->vuser2.x = pl->ammo_hornets;
if( pl->m_pActiveItem )
{
CBasePlayerWeapon *gun;
gun = (CBasePlayerWeapon *)pl->m_pActiveItem->GetWeaponPtr();
if( gun && gun->UseDecrement() )
{
ItemInfo II;
memset( &II, 0, sizeof( II ) );
ItemInfo II = {0};
gun->GetItemInfo( &II );
cd->m_iId = II.iId;

View File

@ -61,5 +61,4 @@ extern void CreateInstancedBaselines ( void );
extern int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message );
extern int AllowLagCompensation( void );
#endif // CLIENT_H

View File

@ -111,7 +111,6 @@ void CGib :: SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs
pGib->pev->velocity = pGib->pev->velocity * 4;
}
pGib->pev->movetype = MOVETYPE_TOSS;
pGib->pev->solid = SOLID_BBOX;
UTIL_SetSize( pGib->pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
@ -157,7 +156,6 @@ void CGib :: SpawnHeadGib( entvars_t *pevVictim )
pGib->pev->velocity = Vector( RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( 200, 300 ) );
}
pGib->pev->avelocity.x = RANDOM_FLOAT( 100, 200 );
pGib->pev->avelocity.y = RANDOM_FLOAT( 100, 300 );
@ -252,7 +250,6 @@ void CGib :: SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human )
}
}
BOOL CBaseMonster::HasHumanGibs( void )
{
int myClass = Classify();
@ -267,7 +264,6 @@ BOOL CBaseMonster :: HasHumanGibs( void )
return FALSE;
}
BOOL CBaseMonster::HasAlienGibs( void )
{
int myClass = Classify();
@ -284,7 +280,6 @@ BOOL CBaseMonster :: HasAlienGibs( void )
return FALSE;
}
void CBaseMonster::FadeMonster( void )
{
StopAnimation();
@ -373,15 +368,12 @@ Activity CBaseMonster :: GetDeathActivity ( void )
case HITGROUP_HEAD:
deathActivity = ACT_DIE_HEADSHOT;
break;
case HITGROUP_STOMACH:
deathActivity = ACT_DIE_GUTSHOT;
break;
case HITGROUP_GENERIC:
// try to pick a death based on attack direction
fTriedDirection = TRUE;
if( flDot > 0.3 )
{
deathActivity = ACT_DIEFORWARD;
@ -391,7 +383,6 @@ Activity CBaseMonster :: GetDeathActivity ( void )
deathActivity = ACT_DIEBACKWARD;
}
break;
default:
// try to pick a death based on attack direction
fTriedDirection = TRUE;
@ -407,7 +398,6 @@ Activity CBaseMonster :: GetDeathActivity ( void )
break;
}
// can we perform the prescribed death?
if( LookupActivity( deathActivity ) == ACTIVITY_NOT_AVAILABLE )
{
@ -504,7 +494,6 @@ Activity CBaseMonster :: GetSmallFlinchActivity ( void )
break;
}
// do we have a sequence for the ideal activity?
if( LookupActivity( flinchActivity ) == ACTIVITY_NOT_AVAILABLE )
{
@ -531,7 +520,6 @@ void CBaseMonster::BecomeDead( void )
//pev->velocity = pev->velocity * RANDOM_FLOAT( 300, 400 );
}
BOOL CBaseMonster::ShouldGibMonster( int iGib )
{
if( ( iGib == GIB_NORMAL && pev->health < GIB_HEALTH_VALUE ) || ( iGib == GIB_ALWAYS ) )
@ -540,7 +528,6 @@ BOOL CBaseMonster::ShouldGibMonster( int iGib )
return FALSE;
}
void CBaseMonster::CallGibMonster( void )
{
BOOL fade = FALSE;
@ -582,7 +569,6 @@ void CBaseMonster::CallGibMonster( void )
UTIL_Remove( this );
}
/*
============
Killed
@ -830,8 +816,6 @@ bitsDamageType indicates the type of damage sustained, ie: DMG_SHOCK
Time-based damage: only occurs while the monster is within the trigger_hurt.
When a monster is poisoned via an arrow etc it takes all the poison damage at once.
GLOBALS ASSUMED SET: g_iSkillLevel
============
*/
@ -898,7 +882,6 @@ int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
// do the damage
pev->health -= flTake;
// HACKHACK Don't kill monsters in a script. Let them break their scripts first
if( m_MonsterState == MONSTERSTATE_SCRIPT )
{
@ -932,8 +915,8 @@ int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
if( ( pev->flags & FL_MONSTER ) && !FNullEnt( pevAttacker ) )
{
if( pevAttacker->flags & ( FL_MONSTER | FL_CLIENT ) )
{// only if the attack was a monster or client!
{
// only if the attack was a monster or client!
// enemy's last known position is somewhere down the vector that the attack came from.
if( pevInflictor )
{
@ -997,9 +980,7 @@ int CBaseMonster :: DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttac
{
pev->velocity = pev->velocity + vecDir * -DamageForce( flDamage );
}
#endif
// kill the corpse if enough damage was done to destroy the corpse and the damage is of a type that is allowed to destroy the corpse.
if( bitsDamageType & DMG_GIB_CORPSE )
{
@ -1016,7 +997,6 @@ int CBaseMonster :: DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttac
return 1;
}
float CBaseMonster::DamageForce( float damage )
{
float force = damage * ( ( 32 * 32 * 72.0 ) / ( pev->size.x * pev->size.y * pev->size.z ) ) * 5;
@ -1033,8 +1013,6 @@ float CBaseMonster :: DamageForce( float damage )
// RadiusDamage - this entity is exploding, or otherwise needs to inflict damage upon entities within a certain range.
//
// only damage ents that can clearly be seen by the explosion!
void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType )
{
CBaseEntity *pEntity = NULL;
@ -1061,7 +1039,8 @@ void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
{
// UNDONE: this should check a damage mask, not an ignore
if( iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore )
{// houndeyes don't hurt other houndeyes with their attack
{
// houndeyes don't hurt other houndeyes with their attack
continue;
}
@ -1076,7 +1055,8 @@ void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
UTIL_TraceLine( vecSrc, vecSpot, dont_ignore_monsters, ENT( pevInflictor ), &tr );
if( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() )
{// the explosion can 'see' this entity, so hurt them!
{
// the explosion can 'see' this entity, so hurt them!
if( tr.fStartSolid )
{
// if we're stuck inside them, fixup the position and distance
@ -1109,19 +1089,16 @@ void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
}
}
void CBaseMonster::RadiusDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType )
{
::RadiusDamage( pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * 2.5, iClassIgnore, bitsDamageType );
}
void CBaseMonster::RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType )
{
::RadiusDamage( vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * 2.5, iClassIgnore, bitsDamageType );
}
//=========================================================
// CheckTraceHullAttack - expects a length to trace, amount
// of damage to do, and damage type. Returns a pointer to
@ -1160,7 +1137,6 @@ CBaseEntity* CBaseMonster :: CheckTraceHullAttack( float flDist, int iDamage, in
return NULL;
}
//=========================================================
// FInViewCone - returns true is the passed ent is in
// the caller's forward view cone. The dot product is performed
@ -1299,7 +1275,6 @@ void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vec
}
}
/*
//=========================================================
// TraceAttack
@ -1310,7 +1285,6 @@ void CBaseMonster::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector ve
ALERT( at_console, "%d\n", ptr->iHitgroup );
if( pev->takedamage )
{
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
@ -1412,7 +1386,8 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
Vector vecTracerSrc;
if( IsPlayer() )
{// adjust tracer position for player
{
// adjust tracer position for player
vecTracerSrc = vecSrc + Vector( 0, 0, -4 ) + gpGlobals->v_right * 2 + gpGlobals->v_forward * 16;
}
else
@ -1460,17 +1435,13 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
TEXTURETYPE_PlaySound( &tr, vecSrc, vecEnd, iBulletType );
DecalGunshot( &tr, iBulletType );
break;
case BULLET_MONSTER_MP5:
pEntity->TraceAttack( pevAttacker, gSkillData.monDmgMP5, vecDir, &tr, DMG_BULLET );
TEXTURETYPE_PlaySound( &tr, vecSrc, vecEnd, iBulletType );
DecalGunshot( &tr, iBulletType );
break;
case BULLET_MONSTER_12MM:
pEntity->TraceAttack( pevAttacker, gSkillData.monDmg12MM, vecDir, &tr, DMG_BULLET );
if( !tracer )
@ -1479,7 +1450,6 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
DecalGunshot( &tr, iBulletType );
}
break;
case BULLET_NONE: // FIX
pEntity->TraceAttack( pevAttacker, 50, vecDir, &tr, DMG_CLUB );
TEXTURETYPE_PlaySound( &tr, vecSrc, vecEnd, iBulletType );
@ -1498,7 +1468,6 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
ApplyMultiDamage( pev, pevAttacker );
}
/*
================
FireBullets
@ -1556,20 +1525,16 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
case BULLET_PLAYER_9MM:
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg9MM, vecDir, &tr, DMG_BULLET );
break;
case BULLET_PLAYER_MP5:
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgMP5, vecDir, &tr, DMG_BULLET );
break;
case BULLET_PLAYER_BUCKSHOT:
// make distance based!
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgBuckshot, vecDir, &tr, DMG_BULLET );
break;
case BULLET_PLAYER_357:
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET );
break;
case BULLET_NONE: // FIX
pEntity->TraceAttack( pevAttacker, 50, vecDir, &tr, DMG_CLUB );
TEXTURETYPE_PlaySound( &tr, vecSrc, vecEnd, iBulletType );
@ -1623,7 +1588,6 @@ void CBaseEntity :: TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr,
}
}
*/
if( flDamage < 10 )
{
flNoise = 0.1;

View File

@ -59,7 +59,7 @@ public:
Schedule_t *GetScheduleOfType( int Type );
void StartTask( Task_t *pTask );
void RunTask( Task_t *pTask );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
void Stop( void );
void Move( float flInterval );
@ -101,7 +101,7 @@ public:
int m_fInCombat;
};
LINK_ENTITY_TO_CLASS( monster_alien_controller, CController );
LINK_ENTITY_TO_CLASS( monster_alien_controller, CController )
TYPEDESCRIPTION CController::m_SaveData[] =
{
@ -111,8 +111,8 @@ TYPEDESCRIPTION CController::m_SaveData[] =
DEFINE_ARRAY( CController, m_iBallCurrent, FIELD_INTEGER, 2 ),
DEFINE_FIELD( CController, m_vecEstVelocity, FIELD_VECTOR ),
};
IMPLEMENT_SAVERESTORE( CController, CSquadMonster );
IMPLEMENT_SAVERESTORE( CController, CSquadMonster )
const char *CController::pAttackSounds[] =
{
@ -150,7 +150,6 @@ const char *CController::pDeathSounds[] =
"controller/con_die2.wav",
};
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
@ -169,13 +168,11 @@ void CController :: SetYawSpeed ( void )
int ys;
ys = 120;
#if 0
switch ( m_Activity )
{
}
#endif
pev->yaw_speed = ys;
}
@ -187,7 +184,6 @@ int CController :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void CController::Killed( entvars_t *pevAttacker, int iGib )
{
// shut off balls
@ -213,7 +209,6 @@ void CController::Killed( entvars_t *pevAttacker, int iGib )
CSquadMonster::Killed( pevAttacker, iGib );
}
void CController::GibMonster( void )
{
// delete balls
@ -230,9 +225,6 @@ void CController::GibMonster( void )
CSquadMonster::GibMonster();
}
void CController::PainSound( void )
{
if( RANDOM_LONG( 0, 5 ) < 2 )
@ -291,10 +283,8 @@ void CController :: HandleAnimEvent( MonsterEvent_t *pEvent )
m_iBallTime[0] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
m_iBall[1] = 255;
m_iBallTime[1] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
}
break;
case CONTROLLER_AE_BALL_SHOOT:
{
Vector vecStart, angleGun;
@ -324,7 +314,6 @@ void CController :: HandleAnimEvent( MonsterEvent_t *pEvent )
m_iBall[1] = 0;
}
break;
case CONTROLLER_AE_SMALL_SHOOT:
{
AttackSound();
@ -399,13 +388,11 @@ void CController :: Precache()
// AI Schedules Specific to this monster
//=========================================================
// Chase enemy schedule
Task_t tlControllerChaseEnemy[] =
{
{ TASK_GET_PATH_TO_ENEMY, (float)128 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
};
Schedule_t slControllerChaseEnemy[] =
@ -420,8 +407,6 @@ Schedule_t slControllerChaseEnemy[] =
},
};
Task_t tlControllerStrafe[] =
{
{ TASK_WAIT, (float)0.2 },
@ -441,7 +426,6 @@ Schedule_t slControllerStrafe[] =
},
};
Task_t tlControllerTakeCover[] =
{
{ TASK_WAIT, (float)0.2 },
@ -461,7 +445,6 @@ Schedule_t slControllerTakeCover[] =
},
};
Task_t tlControllerFail[] =
{
{ TASK_STOP_MOVING, 0 },
@ -481,8 +464,6 @@ Schedule_t slControllerFail[] =
},
};
DEFINE_CUSTOM_SCHEDULES( CController )
{
slControllerChaseEnemy,
@ -491,9 +472,7 @@ DEFINE_CUSTOM_SCHEDULES( CController )
slControllerFail,
};
IMPLEMENT_CUSTOM_SCHEDULES( CController, CSquadMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CController, CSquadMonster )
//=========================================================
// StartTask
@ -547,7 +526,6 @@ void CController :: StartTask ( Task_t *pTask )
}
}
Vector Intersect( Vector vecSrc, Vector vecDst, Vector vecMove, float flSpeed )
{
Vector vecTo = vecDst - vecSrc;
@ -555,8 +533,8 @@ Vector Intersect( Vector vecSrc, Vector vecDst, Vector vecMove, float flSpeed )
float a = DotProduct( vecMove, vecMove ) - flSpeed * flSpeed;
float b = 0 * DotProduct( vecTo, vecMove ); // why does this work?
float c = DotProduct( vecTo, vecTo );
float t;
if( a == 0 )
{
t = c / ( flSpeed * flSpeed );
@ -585,7 +563,6 @@ Vector Intersect( Vector vecSrc, Vector vecDst, Vector vecMove, float flSpeed )
return vecHit.Normalize() * flSpeed;
}
int CController::LookupFloat()
{
if( m_velocity.Length() < 32.0 )
@ -621,13 +598,11 @@ int CController::LookupFloat( )
}
}
//=========================================================
// RunTask
//=========================================================
void CController::RunTask( Task_t *pTask )
{
if( m_flShootEnd > gpGlobals->time )
{
Vector vecHand, vecAngle;
@ -720,7 +695,6 @@ void CController :: RunTask ( Task_t *pTask )
}
}
//=========================================================
// GetSchedule - Decides which type of schedule best suits
// the monster's current state and conditions. Then calls
@ -731,12 +705,6 @@ Schedule_t *CController :: GetSchedule ( void )
{
switch( m_MonsterState )
{
case MONSTERSTATE_IDLE:
break;
case MONSTERSTATE_ALERT:
break;
case MONSTERSTATE_COMBAT:
{
Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 );
@ -752,13 +720,16 @@ Schedule_t *CController :: GetSchedule ( void )
}
}
break;
case MONSTERSTATE_IDLE:
case MONSTERSTATE_ALERT:
break;
default:
break;
}
return CSquadMonster::GetSchedule();
}
//=========================================================
//=========================================================
Schedule_t *CController::GetScheduleOfType( int Type )
@ -782,10 +753,6 @@ Schedule_t* CController :: GetScheduleOfType ( int Type )
return CBaseMonster::GetScheduleOfType( Type );
}
//=========================================================
// CheckRangeAttack1 - shoot a bigass energy ball out of their head
//
@ -799,7 +766,6 @@ BOOL CController :: CheckRangeAttack1 ( float flDot, float flDist )
return FALSE;
}
BOOL CController::CheckRangeAttack2( float flDot, float flDist )
{
if( flDot > 0.5 && flDist > 64 && flDist <= 2048 )
@ -809,13 +775,11 @@ BOOL CController :: CheckRangeAttack2 ( float flDot, float flDist )
return FALSE;
}
BOOL CController::CheckMeleeAttack1( float flDot, float flDist )
{
return FALSE;
}
void CController::SetActivity( Activity NewActivity )
{
CBaseMonster::SetActivity( NewActivity );
@ -831,8 +795,6 @@ void CController :: SetActivity ( Activity NewActivity )
}
}
//=========================================================
// RunAI
//=========================================================
@ -883,7 +845,6 @@ void CController :: RunAI( void )
}
}
extern void DrawRoute( entvars_t *pev, WayPoint_t *m_Route, int m_iRouteIndex, int r, int g, int b );
void CController::Stop( void )
@ -891,8 +852,8 @@ void CController::Stop( void )
m_IdealActivity = GetStoppedActivity();
}
#define DIST_TO_CHECK 200
void CController::Move( float flInterval )
{
float flWaypointDist;
@ -929,7 +890,6 @@ void CController :: Move ( float flInterval )
// Debug, draw the route
// DrawRoute( pev, m_Route, m_iRouteIndex, 0, 0, 255 );
#endif
// if the monster is moving directly towards an entity (enemy for instance), we'll set this pointer
// to that entity for the CheckLocalMove and Triangulate functions.
pTargetEnt = NULL;
@ -1073,8 +1033,6 @@ void CController :: Move ( float flInterval )
}
}
BOOL CController::ShouldAdvanceRoute( float flWaypointDist )
{
if( flWaypointDist <= 32 )
@ -1085,7 +1043,6 @@ BOOL CController:: ShouldAdvanceRoute( float flWaypointDist )
return FALSE;
}
int CController::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist )
{
TraceResult tr;
@ -1111,7 +1068,6 @@ int CController :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd
return LOCALMOVE_VALID;
}
void CController::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval )
{
if( m_IdealActivity != m_movementActivity )
@ -1125,12 +1081,8 @@ void CController::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, fl
m_velocity = m_velocity * 0.8 + m_flGroundSpeed * vecDir * 0.2;
UTIL_MoveToOrigin( ENT( pev ), pev->origin + m_velocity, m_velocity.Length() * flInterval, MOVE_STRAFE );
}
//=========================================================
// Controller bouncy ball attack
//=========================================================
@ -1148,9 +1100,8 @@ class CControllerHeadBall : public CBaseMonster
Vector m_vecIdeal;
EHANDLE m_hOwner;
};
LINK_ENTITY_TO_CLASS( controller_head_ball, CControllerHeadBall );
LINK_ENTITY_TO_CLASS( controller_head_ball, CControllerHeadBall )
void CControllerHeadBall::Spawn( void )
{
@ -1181,7 +1132,6 @@ void CControllerHeadBall :: Spawn( void )
pev->dmgtime = gpGlobals->time;
}
void CControllerHeadBall::Precache( void )
{
PRECACHE_MODEL( "sprites/xspark1.spr" );
@ -1189,7 +1139,6 @@ void CControllerHeadBall :: Precache( void )
PRECACHE_SOUND( "weapons/electro4.wav" );
}
void CControllerHeadBall::HuntThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -1264,13 +1213,11 @@ void CControllerHeadBall :: HuntThink( void )
//Crawl();
}
void CControllerHeadBall::DieThink( void )
{
UTIL_Remove( this );
}
void CControllerHeadBall::MovetoTarget( Vector vecTarget )
{
// accelerate
@ -1289,11 +1236,8 @@ void CControllerHeadBall :: MovetoTarget( Vector vecTarget )
pev->velocity = m_vecIdeal;
}
void CControllerHeadBall::Crawl( void )
{
Vector vecAim = Vector( RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ) ).Normalize();
Vector vecPnt = pev->origin + pev->velocity * 0.3 + vecAim * 64;
@ -1317,7 +1261,6 @@ void CControllerHeadBall :: Crawl( void )
MESSAGE_END();
}
void CControllerHeadBall::BounceTouch( CBaseEntity *pOther )
{
Vector vecDir = m_vecIdeal.Normalize();
@ -1331,9 +1274,6 @@ void CControllerHeadBall::BounceTouch( CBaseEntity *pOther )
m_vecIdeal = vecDir * m_vecIdeal.Length();
}
class CControllerZapBall : public CBaseMonster
{
void Spawn( void );
@ -1343,8 +1283,8 @@ class CControllerZapBall : public CBaseMonster
EHANDLE m_hOwner;
};
LINK_ENTITY_TO_CLASS( controller_energy_ball, CControllerZapBall );
LINK_ENTITY_TO_CLASS( controller_energy_ball, CControllerZapBall )
void CControllerZapBall::Spawn( void )
{
@ -1372,7 +1312,6 @@ void CControllerZapBall :: Spawn( void )
pev->nextthink = gpGlobals->time + 0.1;
}
void CControllerZapBall::Precache( void )
{
PRECACHE_MODEL( "sprites/xspark4.spr" );
@ -1380,7 +1319,6 @@ void CControllerZapBall :: Precache( void )
// PRECACHE_SOUND( "weapons/electro4.wav" );
}
void CControllerZapBall::AnimateThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -1394,7 +1332,6 @@ void CControllerZapBall :: AnimateThink( void )
}
}
void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
{
if( pOther->pev->takedamage )
@ -1402,6 +1339,7 @@ void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
TraceResult tr = UTIL_GetGlobalTrace();
entvars_t *pevOwner;
if( m_hOwner != NULL )
{
pevOwner = m_hOwner->pev;
@ -1416,12 +1354,8 @@ void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
ApplyMultiDamage( pevOwner, pevOwner );
UTIL_EmitAmbientSound( ENT( pev ), tr.vecEndPos, "weapons/electro4.wav", 0.3, ATTN_NORM, 0, RANDOM_LONG( 90, 99 ) );
}
UTIL_Remove( this );
}
#endif //!OEM && !HLDEMO

View File

@ -46,7 +46,8 @@ class CCrossbowBolt : public CBaseEntity
public:
static CCrossbowBolt *BoltCreate( void );
};
LINK_ENTITY_TO_CLASS( crossbow_bolt, CCrossbowBolt );
LINK_ENTITY_TO_CLASS( crossbow_bolt, CCrossbowBolt )
CCrossbowBolt *CCrossbowBolt::BoltCreate( void )
{
@ -76,7 +77,6 @@ void CCrossbowBolt::Spawn( )
pev->nextthink = gpGlobals->time + 0.2;
}
void CCrossbowBolt::Precache()
{
PRECACHE_MODEL( "models/crossbow_bolt.mdl" );
@ -88,7 +88,6 @@ void CCrossbowBolt::Precache( )
m_iTrail = PRECACHE_MODEL( "sprites/streak.spr" );
}
int CCrossbowBolt::Classify( void )
{
return CLASS_NONE;
@ -125,9 +124,11 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
switch( RANDOM_LONG( 0, 1 ) )
{
case 0:
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM); break;
EMIT_SOUND( ENT( pev ), CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM); break;
EMIT_SOUND( ENT( pev ), CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM );
break;
}
if( !g_pGameRules->IsMultiplayer() )
@ -235,7 +236,8 @@ void CCrossbowBolt::ExplodeThink( void )
}
#endif
enum crossbow_e {
enum crossbow_e
{
CROSSBOW_IDLE1 = 0, // full
CROSSBOW_IDLE2, // empty
CROSSBOW_FIDGET1, // full
@ -247,10 +249,10 @@ enum crossbow_e {
CROSSBOW_DRAW1, // full
CROSSBOW_DRAW2, // empty
CROSSBOW_HOLSTER1, // full
CROSSBOW_HOLSTER2, // empty
CROSSBOW_HOLSTER2 // empty
};
LINK_ENTITY_TO_CLASS( weapon_crossbow, CCrossbow );
LINK_ENTITY_TO_CLASS( weapon_crossbow, CCrossbow )
void CCrossbow::Spawn()
{
@ -290,7 +292,6 @@ void CCrossbow::Precache( void )
m_usCrossbow2 = PRECACHE_EVENT( 1, "events/crossbow2.sc" );
}
int CCrossbow::GetItemInfo( ItemInfo *p )
{
p->pszName = STRING( pev->classname );
@ -307,7 +308,6 @@ int CCrossbow::GetItemInfo(ItemInfo *p)
return 1;
}
BOOL CCrossbow::Deploy()
{
if( m_iClip )
@ -333,7 +333,6 @@ void CCrossbow::Holster( int skiplocal /* = 0 */ )
void CCrossbow::PrimaryAttack( void )
{
#ifdef CLIENT_DLL
if( m_fInZoom && bIsMultiplayer() )
#else
@ -458,7 +457,6 @@ void CCrossbow::FireBolt()
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
}
void CCrossbow::SecondaryAttack()
{
if( m_pPlayer->pev->fov != 0 )
@ -476,7 +474,6 @@ void CCrossbow::SecondaryAttack()
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
}
void CCrossbow::Reload( void )
{
if( m_pPlayer->ammo_bolts <= 0 )
@ -493,7 +490,6 @@ void CCrossbow::Reload( void )
}
}
void CCrossbow::WeaponIdle( void )
{
m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES ); // get the autoaim vector but ignore it; used for autoaim crosshair in DM
@ -532,8 +528,6 @@ void CCrossbow::WeaponIdle( void )
}
}
class CCrossbowAmmo : public CBasePlayerAmmo
{
void Spawn( void )
@ -557,8 +551,6 @@ class CCrossbowAmmo : public CBasePlayerAmmo
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( ammo_crossbow, CCrossbowAmmo );
LINK_ENTITY_TO_CLASS( ammo_crossbow, CCrossbowAmmo )
#endif

View File

@ -22,15 +22,13 @@
#include "player.h"
#include "gamerules.h"
#define CROWBAR_BODYHIT_VOLUME 128
#define CROWBAR_WALLHIT_VOLUME 512
LINK_ENTITY_TO_CLASS( weapon_crowbar, CCrowbar );
LINK_ENTITY_TO_CLASS( weapon_crowbar, CCrowbar )
enum gauss_e {
enum gauss_e
{
CROWBAR_IDLE = 0,
CROWBAR_DRAW,
CROWBAR_HOLSTER,
@ -53,7 +51,6 @@ void CCrowbar::Spawn( )
FallInit();// get ready to fall down.
}
void CCrowbar::Precache( void )
{
PRECACHE_MODEL( "models/v_crowbar.mdl ");
@ -84,8 +81,6 @@ int CCrowbar::GetItemInfo(ItemInfo *p)
return 1;
}
BOOL CCrowbar::Deploy()
{
return DefaultDeploy( "models/v_crowbar.mdl", "models/p_crowbar.mdl", CROWBAR_DRAW, "crowbar" );
@ -97,7 +92,6 @@ void CCrowbar::Holster( int skiplocal /* = 0 */ )
SendWeaponAnim( CROWBAR_HOLSTER );
}
void FindHullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity )
{
int i, j, k;
@ -142,7 +136,6 @@ void FindHullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, f
}
}
void CCrowbar::PrimaryAttack()
{
if( !Swing( 1 ) )
@ -152,19 +145,16 @@ void CCrowbar::PrimaryAttack()
}
}
void CCrowbar::Smack()
{
DecalGunshot( &m_trHit, BULLET_PLAYER_CROWBAR );
}
void CCrowbar::SwingAgain( void )
{
Swing( 0 );
}
int CCrowbar::Swing( int fFirst )
{
int fDidHit = FALSE;
@ -192,12 +182,10 @@ int CCrowbar::Swing( int fFirst )
}
}
#endif
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
0.0, 0, 0.0 );
if( tr.flFraction >= 1.0 )
{
if( fFirst )
@ -214,18 +202,20 @@ int CCrowbar::Swing( int fFirst )
switch( ( ( m_iSwing++ ) % 2 ) + 1 )
{
case 0:
SendWeaponAnim( CROWBAR_ATTACK1HIT ); break;
SendWeaponAnim( CROWBAR_ATTACK1HIT );
break;
case 1:
SendWeaponAnim( CROWBAR_ATTACK2HIT ); break;
SendWeaponAnim( CROWBAR_ATTACK2HIT );
break;
case 2:
SendWeaponAnim( CROWBAR_ATTACK3HIT ); break;
SendWeaponAnim( CROWBAR_ATTACK3HIT );
break;
}
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
#ifndef CLIENT_DLL
// hit
fDidHit = TRUE;
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
@ -256,11 +246,14 @@ int CCrowbar::Swing( int fFirst )
switch( RANDOM_LONG( 0, 2 ) )
{
case 0:
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1, ATTN_NORM); break;
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1, ATTN_NORM); break;
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1, ATTN_NORM );
break;
case 2:
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1, ATTN_NORM); break;
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1, ATTN_NORM );
break;
}
m_pPlayer->m_iWeaponVolume = CROWBAR_BODYHIT_VOLUME;
if( !pEntity->IsAlive() )
@ -308,11 +301,6 @@ int CCrowbar::Swing( int fFirst )
SetThink( &CCrowbar::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
}
return fDidHit;
}

View File

@ -61,7 +61,7 @@ enum decal_e
DECAL_SMALLSCORCH2, // Small scorch mark
DECAL_SMALLSCORCH3, // Small scorch mark
DECAL_MOMMABIRTH, // Big momma birth splatter
DECAL_MOMMASPLAT,
DECAL_MOMMASPLAT
};
typedef struct
@ -71,5 +71,4 @@ typedef struct
} DLL_DECALLIST;
extern DLL_DECALLIST gDecals[];
#endif //DECALS_H

View File

@ -95,7 +95,6 @@ Schedule_t slIdleTrigger[] =
},
};
Task_t tlIdleWalk1[] =
{
{ TASK_WALK_PATH, (float)9999 },
@ -144,7 +143,6 @@ Schedule_t slAmbush[] =
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_PROVOKED,
0,
"Ambush"
},
@ -184,7 +182,6 @@ Schedule_t slActiveIdle[] =
bits_COND_HEAVY_DAMAGE |
bits_COND_PROVOKED |
bits_COND_HEAR_SOUND,
bits_SOUND_COMBAT |
bits_SOUND_WORLD |
bits_SOUND_PLAYER |
@ -288,12 +285,10 @@ Schedule_t slAlertStand[] =
bits_COND_SMELL |
bits_COND_SMELL_FOOD |
bits_COND_HEAR_SOUND,
bits_SOUND_COMBAT |// sound flags
bits_SOUND_WORLD |
bits_SOUND_PLAYER |
bits_SOUND_DANGER |
bits_SOUND_MEAT |// scent flags
bits_SOUND_CARCASS |
bits_SOUND_GARBAGE,
@ -331,7 +326,6 @@ Schedule_t slInvestigateSound[] =
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"InvestigateSound"
},
@ -407,7 +401,6 @@ Schedule_t slStandoff[] =
bits_COND_ENEMY_DEAD |
bits_COND_NEW_ENEMY |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Standoff"
}
@ -477,7 +470,6 @@ Schedule_t slRangeAttack1[] =
bits_COND_ENEMY_OCCLUDED |
bits_COND_NO_AMMO_LOADED |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Range Attack1"
},
@ -502,7 +494,6 @@ Schedule_t slRangeAttack2[] =
bits_COND_HEAVY_DAMAGE |
bits_COND_ENEMY_OCCLUDED |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Range Attack2"
},
@ -574,7 +565,6 @@ Schedule_t slSpecialAttack1[] =
bits_COND_ENEMY_OCCLUDED |
bits_COND_NO_AMMO_LOADED |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Special Attack1"
},
@ -600,7 +590,6 @@ Schedule_t slSpecialAttack2[] =
bits_COND_ENEMY_OCCLUDED |
bits_COND_NO_AMMO_LOADED |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Special Attack2"
},
@ -627,7 +616,6 @@ Schedule_t slChaseEnemy[] =
bits_COND_CAN_MELEE_ATTACK2 |
bits_COND_TASK_FAILED |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Chase Enemy"
},
@ -659,13 +647,11 @@ Schedule_t slChaseEnemyFailed[] =
bits_COND_CAN_RANGE_ATTACK2 |
bits_COND_CAN_MELEE_ATTACK2 |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"tlChaseEnemyFailed"
},
};
//=========================================================
// small flinch, played when minor damage is taken.
//=========================================================
@ -777,7 +763,6 @@ Schedule_t slBarnacleVictimChomp[] =
}
};
// Universal Error Schedule
Task_t tlError[] =
{
@ -819,7 +804,6 @@ Schedule_t slWalkToScript[] =
},
};
Task_t tlScriptedRun[] =
{
{ TASK_RUN_TO_TARGET, (float)TARGET_MOVE_SCRIPTED },
@ -1025,7 +1009,6 @@ Schedule_t *CBaseMonster::ScheduleFromName( const char *pName )
return ScheduleInList( pName, m_scheduleList, ARRAYSIZE( m_scheduleList ) );
}
Schedule_t *CBaseMonster::ScheduleInList( const char *pName, Schedule_t **pList, int listCount )
{
int i;
@ -1036,7 +1019,6 @@ Schedule_t *CBaseMonster :: ScheduleInList( const char *pName, Schedule_t **pLis
return NULL;
}
for( i = 0; i < listCount; i++ )
{
if( !pList[i]->pName )

View File

@ -23,7 +23,6 @@
#include "cbase.h"
#include "doors.h"
extern void SetMovedir( entvars_t *ev );
#define noiseMoving noise1
@ -38,7 +37,6 @@ public:
virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
virtual void Blocked( CBaseEntity *pOther );
virtual int ObjectCaps( void )
{
if( pev->spawnflags & SF_ITEM_USE_ONLY )
@ -48,7 +46,6 @@ public:
};
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
virtual void SetToggleState( int state );
@ -76,7 +73,6 @@ public:
BYTE m_bUnlockedSentence;
};
TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
{
DEFINE_FIELD( CBaseDoor, m_bHealthValue, FIELD_CHARACTER ),
@ -87,11 +83,9 @@ TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
DEFINE_FIELD( CBaseDoor, m_bLockedSentence, FIELD_CHARACTER ),
DEFINE_FIELD( CBaseDoor, m_bUnlockedSound, FIELD_CHARACTER ),
DEFINE_FIELD( CBaseDoor, m_bUnlockedSentence, FIELD_CHARACTER ),
};
IMPLEMENT_SAVERESTORE( CBaseDoor, CBaseToggle );
IMPLEMENT_SAVERESTORE( CBaseDoor, CBaseToggle )
#define DOOR_SENTENCEWAIT 6
#define DOOR_SOUNDWAIT 3
@ -191,10 +185,8 @@ void PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton)
//
// Cache user-entity-field values until spawn is called.
//
void CBaseDoor::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "skin" ) )//skin is used for content type
{
pev->skin = atof( pkvd->szValue );
@ -269,12 +261,11 @@ touch or takedamage doors).
4) screechy metal
*/
LINK_ENTITY_TO_CLASS( func_door, CBaseDoor );
LINK_ENTITY_TO_CLASS( func_door, CBaseDoor )
//
// func_water - same as a door.
//
LINK_ENTITY_TO_CLASS( func_water, CBaseDoor );
LINK_ENTITY_TO_CLASS( func_water, CBaseDoor )
void CBaseDoor::Spawn()
{
@ -282,14 +273,16 @@ void CBaseDoor::Spawn( )
SetMovedir( pev );
if( pev->skin == 0 )
{//normal door
{
//normal door
if( FBitSet( pev->spawnflags, SF_DOOR_PASSABLE ) )
pev->solid = SOLID_NOT;
else
pev->solid = SOLID_BSP;
}
else
{// special contents
{
// special contents
pev->solid = SOLID_NOT;
SetBits( pev->spawnflags, SF_DOOR_SILENT ); // water is silent for now
}
@ -302,11 +295,13 @@ void CBaseDoor::Spawn( )
pev->speed = 100;
m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2 ) ) + fabs( pev->movedir.y * ( pev->size.y - 2 ) ) + fabs( pev->movedir.z * ( pev->size.z - 2 ) ) - m_flLip ) );
ASSERTSZ( m_vecPosition1 != m_vecPosition2, "door start/end positions are equal" );
if( FBitSet( pev->spawnflags, SF_DOOR_START_OPEN ) )
{ // swap pos1 and pos2, put door at pos2
{
// swap pos1 and pos2, put door at pos2
UTIL_SetOrigin( pev, m_vecPosition2 );
m_vecPosition2 = m_vecPosition1;
m_vecPosition1 = pev->origin;
@ -323,7 +318,6 @@ void CBaseDoor::Spawn( )
SetTouch( &CBaseDoor::DoorTouch );
}
void CBaseDoor::SetToggleState( int state )
{
if( state == TS_AT_TOP )
@ -332,7 +326,6 @@ void CBaseDoor :: SetToggleState( int state )
UTIL_SetOrigin( pev, m_vecPosition1 );
}
void CBaseDoor::Precache( void )
{
char *pszSound;
@ -432,7 +425,6 @@ void CBaseDoor::Precache( void )
}
// get door button sounds, for doors which are directly 'touched' to open
if( m_bLockedSound )
{
pszSound = ButtonSound( (int)m_bLockedSound );
@ -448,34 +440,86 @@ void CBaseDoor::Precache( void )
}
// get sentence group names, for doors which are directly 'touched' to open
switch( m_bLockedSentence )
{
case 1: m_ls.sLockedSentence = ALLOC_STRING("NA"); break; // access denied
case 2: m_ls.sLockedSentence = ALLOC_STRING("ND"); break; // security lockout
case 3: m_ls.sLockedSentence = ALLOC_STRING("NF"); break; // blast door
case 4: m_ls.sLockedSentence = ALLOC_STRING("NFIRE"); break; // fire door
case 5: m_ls.sLockedSentence = ALLOC_STRING("NCHEM"); break; // chemical door
case 6: m_ls.sLockedSentence = ALLOC_STRING("NRAD"); break; // radiation door
case 7: m_ls.sLockedSentence = ALLOC_STRING("NCON"); break; // gen containment
case 8: m_ls.sLockedSentence = ALLOC_STRING("NH"); break; // maintenance door
case 9: m_ls.sLockedSentence = ALLOC_STRING("NG"); break; // broken door
default: m_ls.sLockedSentence = 0; break;
case 1:
// access denied
m_ls.sLockedSentence = ALLOC_STRING( "NA" );
break;
case 2:
// security lockout
m_ls.sLockedSentence = ALLOC_STRING( "ND" );
break;
case 3:
// blast door
m_ls.sLockedSentence = ALLOC_STRING( "NF" );
break;
case 4:
// fire door
m_ls.sLockedSentence = ALLOC_STRING( "NFIRE" );
break;
case 5:
// chemical door
m_ls.sLockedSentence = ALLOC_STRING( "NCHEM" );
break;
case 6:
// radiation door
m_ls.sLockedSentence = ALLOC_STRING( "NRAD" );
break;
case 7:
// gen containment
m_ls.sLockedSentence = ALLOC_STRING( "NCON" );
break;
case 8:
// maintenance door
m_ls.sLockedSentence = ALLOC_STRING( "NH" );
break;
case 9:
// broken door
m_ls.sLockedSentence = ALLOC_STRING( "NG" );
break;
default:
m_ls.sLockedSentence = 0;
break;
}
switch( m_bUnlockedSentence )
{
case 1: m_ls.sUnlockedSentence = ALLOC_STRING("EA"); break; // access granted
case 2: m_ls.sUnlockedSentence = ALLOC_STRING("ED"); break; // security door
case 3: m_ls.sUnlockedSentence = ALLOC_STRING("EF"); break; // blast door
case 4: m_ls.sUnlockedSentence = ALLOC_STRING("EFIRE"); break; // fire door
case 5: m_ls.sUnlockedSentence = ALLOC_STRING("ECHEM"); break; // chemical door
case 6: m_ls.sUnlockedSentence = ALLOC_STRING("ERAD"); break; // radiation door
case 7: m_ls.sUnlockedSentence = ALLOC_STRING("ECON"); break; // gen containment
case 8: m_ls.sUnlockedSentence = ALLOC_STRING("EH"); break; // maintenance door
default: m_ls.sUnlockedSentence = 0; break;
case 1:
// access granted
m_ls.sUnlockedSentence = ALLOC_STRING( "EA" );
break;
case 2:
// security door
m_ls.sUnlockedSentence = ALLOC_STRING( "ED" );
break;
case 3:
// blast door
m_ls.sUnlockedSentence = ALLOC_STRING( "EF" );
break;
case 4:
// fire door
m_ls.sUnlockedSentence = ALLOC_STRING( "EFIRE" );
break;
case 5:
// chemical door
m_ls.sUnlockedSentence = ALLOC_STRING( "ECHEM" );
break;
case 6:
// radiation door
m_ls.sUnlockedSentence = ALLOC_STRING( "ERAD" );
break;
case 7:
// gen containment
m_ls.sUnlockedSentence = ALLOC_STRING( "ECON" );
break;
case 8:
// maintenance door
m_ls.sUnlockedSentence = ALLOC_STRING( "EH" );
break;
default:
m_ls.sUnlockedSentence = 0;
break;
}
}
@ -492,13 +536,11 @@ void CBaseDoor::DoorTouch( CBaseEntity *pOther )
// If door has master, and it's not ready to trigger,
// play 'locked' sound
if( m_sMaster && !UTIL_IsMasterTriggered( m_sMaster, pOther ) )
PlayLockSounds( pev, &m_ls, TRUE, FALSE );
// If door is somebody's target, then touching does nothing.
// You have to activate the owner (e.g. button).
if( !FStringNull( pev->targetname ) )
{
// play locked sound
@ -512,7 +554,6 @@ void CBaseDoor::DoorTouch( CBaseEntity *pOther )
SetTouch( NULL ); // Temporarily disable the touch function, until movement is finished.
}
//
// Used by SUB_UseTargets, when a door is the target of a button.
//
@ -533,18 +574,19 @@ int CBaseDoor::DoorActivate( )
return 0;
if( FBitSet( pev->spawnflags, SF_DOOR_NO_AUTO_RETURN ) && m_toggle_state == TS_AT_TOP )
{// door should close
{
// door should close
DoorGoDown();
}
else
{// door should open
{
// door should open
if( m_hActivator != NULL && 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;
m_hActivator->TakeHealth( m_bHealthValue, DMG_GENERIC );
}
// play door unlock sounds
@ -605,7 +647,6 @@ void CBaseDoor::DoorGoUp( void )
LinearMove( m_vecPosition2, pev->speed );
}
//
// The door has reached the "up" position. Either go back down, or wait for another activation.
//
@ -646,7 +687,6 @@ void CBaseDoor::DoorHitTop( void )
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); // this isn't finished
}
//
// Starts the door going to its "down" position (simply ToggleData->vecPosition1).
//
@ -655,7 +695,6 @@ void CBaseDoor::DoorGoDown( void )
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
EMIT_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ), 1, ATTN_NORM );
#ifdef DOOR_ASSERT
ASSERT( m_toggle_state == TS_AT_TOP );
#endif // DOOR_ASSERT
@ -684,7 +723,8 @@ void CBaseDoor::DoorHitBottom( void )
// Re-instate touch method, cycle is complete
if( FBitSet( pev->spawnflags, SF_DOOR_USE_ONLY ) )
{// use only door
{
// use only door
SetTouch( NULL );
}
else // touchable door
@ -702,14 +742,12 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
edict_t *pentTarget = NULL;
CBaseDoor *pDoor = NULL;
// Hurt the blocker a little.
if( pev->dmg )
pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if( m_flWait >= 0 )
{
if( m_toggle_state == TS_GOING_DOWN )
@ -736,7 +774,6 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
if( FClassnameIs( pentTarget, "func_door" ) || FClassnameIs( pentTarget, "func_door_rotating" ) )
{
pDoor = GetClassPtr( (CBaseDoor *)VARS( pentTarget ) );
if( pDoor->m_flWait >= 0 )
@ -745,12 +782,14 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
{
// this is the most hacked, evil, bastardized thing I've ever seen. kjb
if( FClassnameIs( pentTarget, "func_door" ) )
{// set origin to realign normal doors
{
// set origin to realign normal doors
pDoor->pev->origin = pev->origin;
pDoor->pev->velocity = g_vecZero;// stop!
}
else
{// set angles to realign rotating doors
{
// set angles to realign rotating doors
pDoor->pev->angles = pev->angles;
pDoor->pev->avelocity = g_vecZero;
}
@ -758,7 +797,6 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) );
if( pDoor->m_toggle_state == TS_GOING_DOWN )
pDoor->DoorGoUp();
else
@ -770,7 +808,6 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
}
}
/*QUAKED FuncRotDoorSpawn (0 .5 .8) ? START_OPEN REVERSE
DOOR_DONT_LINK TOGGLE X_AXIS Y_AXIS
if two doors touch, they are assumed to be connected and operate as
@ -809,6 +846,7 @@ button or trigger field activates the door.
3) stone chain
4) screechy metal
*/
class CRotDoor : public CBaseDoor
{
public:
@ -816,8 +854,7 @@ public:
virtual void SetToggleState( int state );
};
LINK_ENTITY_TO_CLASS( func_door_rotating, CRotDoor );
LINK_ENTITY_TO_CLASS( func_door_rotating, CRotDoor )
void CRotDoor::Spawn( void )
{
@ -850,7 +887,8 @@ void CRotDoor::Spawn( void )
// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
// but spawn in the open position
if( FBitSet( pev->spawnflags, SF_DOOR_START_OPEN ) )
{ // swap pos1 and pos2, put door at pos2, invert movement direction
{
// swap pos1 and pos2, put door at pos2, invert movement direction
pev->angles = m_vecAngle2;
Vector vecSav = m_vecAngle1;
m_vecAngle2 = m_vecAngle1;
@ -868,7 +906,6 @@ void CRotDoor::Spawn( void )
SetTouch( &CBaseDoor::DoorTouch );
}
void CRotDoor::SetToggleState( int state )
{
if( state == TS_AT_TOP )
@ -879,7 +916,6 @@ void CRotDoor :: SetToggleState( int state )
UTIL_SetOrigin( pev, pev->origin );
}
class CMomentaryDoor : public CBaseToggle
{
public:
@ -899,7 +935,7 @@ public:
BYTE m_bStopSnd; // sound a door makes when it stops
};
LINK_ENTITY_TO_CLASS( momentary_door, CMomentaryDoor );
LINK_ENTITY_TO_CLASS( momentary_door, CMomentaryDoor )
TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] =
{
@ -907,7 +943,7 @@ TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] =
DEFINE_FIELD( CMomentaryDoor, m_bStopSnd, FIELD_CHARACTER ),
};
IMPLEMENT_SAVERESTORE( CMomentaryDoor, CBaseToggle );
IMPLEMENT_SAVERESTORE( CMomentaryDoor, CBaseToggle )
void CMomentaryDoor::Spawn( void )
{
@ -942,7 +978,6 @@ void CMomentaryDoor::Spawn( void )
void CMomentaryDoor::Precache( void )
{
// set the door's "in-motion" sound
switch( m_bMoveSnd )
{

View File

@ -27,7 +27,4 @@
#define SF_DOOR_USE_ONLY 256 // door must be opened by player's use button.
#define SF_DOOR_NOMONSTERS 512 // Monster can't open
#define SF_DOOR_SILENT 0x80000000
#endif //DOORS_H

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -27,10 +28,8 @@
#define SF_FUNNEL_REVERSE 1 // funnel effect repels particles instead of attracting them.
// Lightning target, just alias landmark
LINK_ENTITY_TO_CLASS( info_target, CPointEntity );
LINK_ENTITY_TO_CLASS( info_target, CPointEntity )
class CBubbling : public CBaseEntity
{
@ -53,7 +52,7 @@ public:
int m_state;
};
LINK_ENTITY_TO_CLASS( env_bubbles, CBubbling );
LINK_ENTITY_TO_CLASS( env_bubbles, CBubbling )
TYPEDESCRIPTION CBubbling::m_SaveData[] =
{
@ -64,8 +63,7 @@ TYPEDESCRIPTION CBubbling::m_SaveData[] =
//DEFINE_FIELD( CBubbling, m_bubbleModel, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CBubbling, CBaseEntity );
IMPLEMENT_SAVERESTORE( CBubbling, CBaseEntity )
#define SF_BUBBLES_STARTOFF 0x0001
@ -84,7 +82,6 @@ void CBubbling::Spawn( void )
pev->rendercolor.y = speed & 255;
pev->rendercolor.z = ( pev->speed < 0 ) ? 1 : 0;
if( !( pev->spawnflags & SF_BUBBLES_STARTOFF ) )
{
SetThink( &CBubbling::FizzThink );
@ -100,7 +97,6 @@ void CBubbling::Precache( void )
m_bubbleModel = PRECACHE_MODEL( "sprites/bubble.spr" ); // Precache bubble sprite
}
void CBubbling::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if( ShouldToggle( useType, m_state ) )
@ -118,7 +114,6 @@ void CBubbling::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
}
}
void CBubbling::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "density" ) )
@ -140,7 +135,6 @@ void CBubbling::KeyValue( KeyValueData *pkvd )
CBaseEntity::KeyValue( pkvd );
}
void CBubbling::FizzThink( void )
{
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, VecBModelOrigin( pev ) );
@ -162,7 +156,7 @@ void CBubbling::FizzThink( void )
//
// --------------------------------------------------
LINK_ENTITY_TO_CLASS( beam, CBeam );
LINK_ENTITY_TO_CLASS( beam, CBeam )
void CBeam::Spawn( void )
{
@ -190,7 +184,6 @@ void CBeam::SetEndEntity( int entityIndex )
pev->aiment = g_engfuncs.pfnPEntityOfEntIndex( entityIndex );
}
// These don't take attachments into account
const Vector &CBeam::GetStartPos( void )
{
@ -202,7 +195,6 @@ const Vector &CBeam::GetStartPos( void )
return pev->origin;
}
const Vector &CBeam::GetEndPos( void )
{
int type = GetType();
@ -217,7 +209,6 @@ const Vector &CBeam::GetEndPos( void )
return pev->angles;
}
CBeam *CBeam::BeamCreate( const char *pSpriteName, int width )
{
// Create a new entity with CBeam private data
@ -229,7 +220,6 @@ CBeam *CBeam::BeamCreate( const char *pSpriteName, int width )
return pBeam;
}
void CBeam::BeamInit( const char *pSpriteName, int width )
{
pev->flags |= FL_CUSTOMENTITY;
@ -246,7 +236,6 @@ void CBeam::BeamInit( const char *pSpriteName, int width )
pev->rendermode = 0;
}
void CBeam::PointsInit( const Vector &start, const Vector &end )
{
SetType( BEAM_POINTS );
@ -257,7 +246,6 @@ void CBeam::PointsInit( const Vector &start, const Vector &end )
RelinkBeam();
}
void CBeam::HoseInit( const Vector &start, const Vector &direction )
{
SetType( BEAM_HOSE );
@ -268,7 +256,6 @@ void CBeam::HoseInit( const Vector &start, const Vector &direction )
RelinkBeam();
}
void CBeam::PointEntInit( const Vector &start, int endIndex )
{
SetType( BEAM_ENTPOINT );
@ -289,7 +276,6 @@ void CBeam::EntsInit( int startIndex, int endIndex )
RelinkBeam();
}
void CBeam::RelinkBeam( void )
{
const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
@ -321,7 +307,6 @@ void CBeam::SetObjectCollisionBox( void )
}
#endif
void CBeam::TriggerTouch( CBaseEntity *pOther )
{
if( pOther->pev->flags & ( FL_CLIENT | FL_MONSTER ) )
@ -335,7 +320,6 @@ void CBeam::TriggerTouch( CBaseEntity *pOther )
}
}
CBaseEntity *CBeam::RandomTargetname( const char *szName )
{
int total = 0;
@ -351,7 +335,6 @@ CBaseEntity *CBeam::RandomTargetname( const char *szName )
return pEntity;
}
void CBeam::DoSparks( const Vector &start, const Vector &end )
{
if( pev->spawnflags & ( SF_BEAM_SPARKSTART | SF_BEAM_SPARKEND ) )
@ -367,7 +350,6 @@ void CBeam::DoSparks( const Vector &start, const Vector &end )
}
}
class CLightning : public CBeam
{
public:
@ -413,8 +395,8 @@ public:
float m_radius;
};
LINK_ENTITY_TO_CLASS( env_lightning, CLightning );
LINK_ENTITY_TO_CLASS( env_beam, CLightning );
LINK_ENTITY_TO_CLASS( env_lightning, CLightning )
LINK_ENTITY_TO_CLASS( env_beam, CLightning )
// UNDONE: Jay -- This is only a test
#if _DEBUG
@ -422,7 +404,8 @@ class CTripBeam : public CLightning
{
void Spawn( void );
};
LINK_ENTITY_TO_CLASS( trip_beam, CTripBeam );
LINK_ENTITY_TO_CLASS( trip_beam, CTripBeam )
void CTripBeam::Spawn( void )
{
@ -433,8 +416,6 @@ void CTripBeam::Spawn( void )
}
#endif
TYPEDESCRIPTION CLightning::m_SaveData[] =
{
DEFINE_FIELD( CLightning, m_active, FIELD_INTEGER ),
@ -452,8 +433,7 @@ TYPEDESCRIPTION CLightning::m_SaveData[] =
DEFINE_FIELD( CLightning, m_radius, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CLightning, CBeam );
IMPLEMENT_SAVERESTORE( CLightning, CBeam )
void CLightning::Spawn( void )
{
@ -510,14 +490,12 @@ void CLightning::Precache( void )
CBeam::Precache();
}
void CLightning::Activate( void )
{
if( ServerSide() )
BeamUpdateVars();
}
void CLightning::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "LightningStart" ) )
@ -579,7 +557,6 @@ void CLightning::KeyValue( KeyValueData *pkvd )
CBeam::KeyValue( pkvd );
}
void CLightning::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if( !ShouldToggle( useType, m_active ) )
@ -603,7 +580,6 @@ void CLightning::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
}
}
void CLightning::StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if( !ShouldToggle( useType, m_active ) )
@ -624,7 +600,6 @@ void CLightning::StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
SetUse( NULL );
}
int IsPointEntity( CBaseEntity *pEnt )
{
if( !pEnt->pev->modelindex )
@ -635,7 +610,6 @@ int IsPointEntity( CBaseEntity *pEnt )
return 0;
}
void CLightning::StrikeThink( void )
{
if( m_life != 0 )
@ -707,7 +681,6 @@ void CLightning::StrikeThink( void )
WRITE_COORD( pEnd->pev->origin.z );
}
}
else
{
@ -741,7 +714,6 @@ void CLightning::StrikeThink( void )
}
}
void CBeam::BeamDamage( TraceResult *ptr )
{
RelinkBeam();
@ -763,7 +735,6 @@ void CBeam::BeamDamage( TraceResult *ptr )
pev->dmgtime = gpGlobals->time;
}
void CLightning::DamageThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -772,8 +743,6 @@ void CLightning::DamageThink( void )
BeamDamage( &tr );
}
void CLightning::Zap( const Vector &vecSrc, const Vector &vecDest )
{
#if 1
@ -817,7 +786,7 @@ void CLightning::Zap( const Vector &vecSrc, const Vector &vecDest )
void CLightning::RandomArea( void )
{
int iLoops = 0;
int iLoops;
for( iLoops = 0; iLoops < 10; iLoops++ )
{
@ -832,7 +801,8 @@ void CLightning::RandomArea( void )
continue;
Vector vecDir2;
do {
do
{
vecDir2 = Vector( RANDOM_FLOAT( -1.0, 1.0 ), RANDOM_FLOAT( -1.0, 1.0 ),RANDOM_FLOAT( -1.0, 1.0 ) );
} while( DotProduct( vecDir1, vecDir2 ) > 0 );
vecDir2 = vecDir2.Normalize();
@ -856,10 +826,9 @@ void CLightning::RandomArea( void )
}
}
void CLightning::RandomPoint( Vector &vecSrc )
{
int iLoops = 0;
int iLoops;
for( iLoops = 0; iLoops < 10; iLoops++ )
{
@ -879,8 +848,6 @@ void CLightning::RandomPoint( Vector &vecSrc )
}
}
void CLightning::BeamUpdateVars( void )
{
int beamType;
@ -945,8 +912,7 @@ void CLightning::BeamUpdateVars( void )
SetFlags( BEAM_FSHADEOUT );
}
LINK_ENTITY_TO_CLASS( env_laser, CLaser );
LINK_ENTITY_TO_CLASS( env_laser, CLaser )
TYPEDESCRIPTION CLaser::m_SaveData[] =
{
@ -955,7 +921,7 @@ TYPEDESCRIPTION CLaser::m_SaveData[] =
DEFINE_FIELD( CLaser, m_firePosition, FIELD_POSITION_VECTOR ),
};
IMPLEMENT_SAVERESTORE( CLaser, CBeam );
IMPLEMENT_SAVERESTORE( CLaser, CBeam )
void CLaser::Spawn( void )
{
@ -993,7 +959,6 @@ void CLaser::Precache( void )
PRECACHE_MODEL( (char *)STRING( m_iszSpriteName ) );
}
void CLaser::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "LaserTarget" ) )
@ -1040,7 +1005,6 @@ void CLaser::KeyValue( KeyValueData *pkvd )
CBeam::KeyValue( pkvd );
}
int CLaser::IsOn( void )
{
if( pev->effects & EF_NODRAW )
@ -1048,7 +1012,6 @@ int CLaser::IsOn( void )
return 1;
}
void CLaser::TurnOff( void )
{
pev->effects |= EF_NODRAW;
@ -1057,7 +1020,6 @@ void CLaser::TurnOff( void )
m_pSprite->TurnOff();
}
void CLaser::TurnOn( void )
{
pev->effects &= ~EF_NODRAW;
@ -1067,7 +1029,6 @@ void CLaser::TurnOn( void )
pev->nextthink = gpGlobals->time;
}
void CLaser::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
int active = IsOn();
@ -1084,7 +1045,6 @@ void CLaser::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp
}
}
void CLaser::FireAtPoint( TraceResult &tr )
{
SetEndPos( tr.vecEndPos );
@ -1109,8 +1069,6 @@ void CLaser::StrikeThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
class CGlow : public CPointEntity
{
public:
@ -1125,7 +1083,7 @@ public:
float m_maxFrame;
};
LINK_ENTITY_TO_CLASS( env_glow, CGlow );
LINK_ENTITY_TO_CLASS( env_glow, CGlow )
TYPEDESCRIPTION CGlow::m_SaveData[] =
{
@ -1133,7 +1091,7 @@ TYPEDESCRIPTION CGlow::m_SaveData[] =
DEFINE_FIELD( CGlow, m_maxFrame, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CGlow, CPointEntity );
IMPLEMENT_SAVERESTORE( CGlow, CPointEntity )
void CGlow::Spawn( void )
{
@ -1152,7 +1110,6 @@ void CGlow::Spawn( void )
m_lastTime = gpGlobals->time;
}
void CGlow::Think( void )
{
Animate( pev->framerate * ( gpGlobals->time - m_lastTime ) );
@ -1161,15 +1118,13 @@ void CGlow::Think( void )
m_lastTime = gpGlobals->time;
}
void CGlow::Animate( float frames )
{
if( m_maxFrame > 0 )
pev->frame = fmod( pev->frame + frames, m_maxFrame );
}
LINK_ENTITY_TO_CLASS( env_sprite, CSprite );
LINK_ENTITY_TO_CLASS( env_sprite, CSprite )
TYPEDESCRIPTION CSprite::m_SaveData[] =
{
@ -1177,7 +1132,7 @@ TYPEDESCRIPTION CSprite::m_SaveData[] =
DEFINE_FIELD( CSprite, m_maxFrame, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CSprite, CPointEntity );
IMPLEMENT_SAVERESTORE( CSprite, CPointEntity )
void CSprite::Spawn( void )
{
@ -1203,7 +1158,6 @@ void CSprite::Spawn( void )
}
}
void CSprite::Precache( void )
{
PRECACHE_MODEL( (char *)STRING( pev->model ) );
@ -1219,7 +1173,6 @@ void CSprite::Precache( void )
}
}
void CSprite::SpriteInit( const char *pSpriteName, const Vector &origin )
{
pev->model = MAKE_STRING( pSpriteName );
@ -1240,7 +1193,6 @@ CSprite *CSprite::SpriteCreate( const char *pSpriteName, const Vector &origin, B
return pSprite;
}
void CSprite::AnimateThink( void )
{
Animate( pev->framerate * ( gpGlobals->time - m_lastTime ) );
@ -1270,7 +1222,6 @@ void CSprite::Expand( float scaleSpeed, float fadeSpeed )
m_lastTime = gpGlobals->time;
}
void CSprite::ExpandThink( void )
{
float frametime = gpGlobals->time - m_lastTime;
@ -1288,7 +1239,6 @@ void CSprite::ExpandThink( void )
}
}
void CSprite::Animate( float frames )
{
pev->frame += frames;
@ -1306,14 +1256,12 @@ void CSprite::Animate( float frames )
}
}
void CSprite::TurnOff( void )
{
pev->effects = EF_NODRAW;
pev->nextthink = 0;
}
void CSprite::TurnOn( void )
{
pev->effects = 0;
@ -1326,7 +1274,6 @@ void CSprite::TurnOn( void )
pev->frame = 0;
}
void CSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
int on = pev->effects != EF_NODRAW;
@ -1343,7 +1290,6 @@ void CSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
}
}
class CGibShooter : public CBaseDelay
{
public:
@ -1379,9 +1325,8 @@ TYPEDESCRIPTION CGibShooter::m_SaveData[] =
DEFINE_FIELD( CGibShooter, m_flGibLife, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CGibShooter, CBaseDelay );
LINK_ENTITY_TO_CLASS( gibshooter, CGibShooter );
IMPLEMENT_SAVERESTORE( CGibShooter, CBaseDelay )
LINK_ENTITY_TO_CLASS( gibshooter, CGibShooter )
void CGibShooter::Precache( void )
{
@ -1395,7 +1340,6 @@ void CGibShooter :: Precache ( void )
}
}
void CGibShooter::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "m_iGibs" ) )
@ -1451,7 +1395,6 @@ void CGibShooter::Spawn( void )
pev->body = MODEL_FRAMES( m_iGibModelIndex );
}
CGib *CGibShooter::CreateGib( void )
{
if( CVAR_GET_FLOAT( "violence_hgibs" ) == 0 )
@ -1471,7 +1414,6 @@ CGib *CGibShooter :: CreateGib ( void )
return pGib;
}
void CGibShooter::ShootThink( void )
{
pev->nextthink = gpGlobals->time + m_flDelay;
@ -1503,7 +1445,6 @@ void CGibShooter :: ShootThink ( void )
pGib->pev->nextthink = gpGlobals->time + pGib->m_lifeTime;
pGib->m_lifeTime = 0;
}
}
if( --m_iGibs <= 0 )
@ -1522,7 +1463,6 @@ void CGibShooter :: ShootThink ( void )
}
}
class CEnvShooter : public CGibShooter
{
void Precache( void );
@ -1531,7 +1471,7 @@ class CEnvShooter : public CGibShooter
CGib *CreateGib( void );
};
LINK_ENTITY_TO_CLASS( env_shooter, CEnvShooter );
LINK_ENTITY_TO_CLASS( env_shooter, CEnvShooter )
void CEnvShooter::KeyValue( KeyValueData *pkvd )
{
@ -1561,7 +1501,6 @@ void CEnvShooter :: KeyValue( KeyValueData *pkvd )
case 4:
m_iGibMaterial = matRocks;
break;
default:
case -1:
m_iGibMaterial = matNone;
@ -1574,14 +1513,12 @@ void CEnvShooter :: KeyValue( KeyValueData *pkvd )
}
}
void CEnvShooter::Precache( void )
{
m_iGibModelIndex = PRECACHE_MODEL( (char *)STRING( pev->model ) );
CBreakable::MaterialSoundPrecache( (Materials)m_iGibMaterial );
}
CGib *CEnvShooter::CreateGib( void )
{
CGib *pGib = GetClassPtr( (CGib *)NULL );
@ -1607,9 +1544,6 @@ CGib *CEnvShooter :: CreateGib ( void )
return pGib;
}
class CTestEffect : public CBaseDelay
{
public:
@ -1626,8 +1560,7 @@ public:
float m_flStartTime;
};
LINK_ENTITY_TO_CLASS( test_effect, CTestEffect );
LINK_ENTITY_TO_CLASS( test_effect, CTestEffect )
void CTestEffect::Spawn( void )
{
@ -1642,7 +1575,7 @@ void CTestEffect::Precache( void )
void CTestEffect::TestThink( void )
{
int i;
float t = (gpGlobals->time - m_flStartTime);
float t = gpGlobals->time - m_flStartTime;
if( m_iBeam < 24 )
{
@ -1664,7 +1597,6 @@ void CTestEffect::TestThink( void )
m_flBeamTime[m_iBeam] = gpGlobals->time;
m_pBeam[m_iBeam] = pbeam;
m_iBeam++;
#if 0
Vector vecMid = ( vecSrc + tr.vecEndPos ) * 0.5;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
@ -1705,7 +1637,6 @@ void CTestEffect::TestThink( void )
}
}
void CTestEffect::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
SetThink( &CTestEffect::TestThink );
@ -1713,8 +1644,6 @@ void CTestEffect::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
m_flStartTime = gpGlobals->time;
}
// Blood effects
class CBlood : public CPointEntity
{
@ -1723,21 +1652,32 @@ public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void KeyValue( KeyValueData *pkvd );
inline int Color( void ) { return pev->impulse; }
inline float BloodAmount( void ) { return pev->dmg; }
inline int Color( void )
{
return pev->impulse;
}
inline void SetColor( int color ) { pev->impulse = color; }
inline void SetBloodAmount( float amount ) { pev->dmg = amount; }
inline float BloodAmount( void )
{
return pev->dmg;
}
inline void SetColor( int color )
{
pev->impulse = color;
}
inline void SetBloodAmount( float amount )
{
pev->dmg = amount;
}
Vector Direction( void );
Vector BloodPosition( CBaseEntity *pActivator );
private:
};
LINK_ENTITY_TO_CLASS( env_blood, CBlood );
LINK_ENTITY_TO_CLASS( env_blood, CBlood )
#define SF_BLOOD_RANDOM 0x0001
#define SF_BLOOD_STREAM 0x0002
@ -1753,7 +1693,6 @@ void CBlood::Spawn( void )
SetMovedir( pev );
}
void CBlood::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "color" ) )
@ -1780,7 +1719,6 @@ void CBlood::KeyValue( KeyValueData *pkvd )
CPointEntity::KeyValue( pkvd );
}
Vector CBlood::Direction( void )
{
if( pev->spawnflags & SF_BLOOD_RANDOM )
@ -1789,7 +1727,6 @@ Vector CBlood::Direction( void )
return pev->movedir;
}
Vector CBlood::BloodPosition( CBaseEntity *pActivator )
{
if( pev->spawnflags & SF_BLOOD_PLAYER )
@ -1809,7 +1746,6 @@ Vector CBlood::BloodPosition( CBaseEntity *pActivator )
return pev->origin;
}
void CBlood::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if( pev->spawnflags & SF_BLOOD_STREAM )
@ -1829,8 +1765,6 @@ void CBlood::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp
}
}
// Screen shake
class CShake : public CPointEntity
{
@ -1839,19 +1773,49 @@ public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void KeyValue( KeyValueData *pkvd );
inline float Amplitude( void ) { return pev->scale; }
inline float Frequency( void ) { return pev->dmg_save; }
inline float Duration( void ) { return pev->dmg_take; }
inline float Radius( void ) { return pev->dmg; }
inline float Amplitude( void )
{
return pev->scale;
}
inline void SetAmplitude( float amplitude ) { pev->scale = amplitude; }
inline void SetFrequency( float frequency ) { pev->dmg_save = frequency; }
inline void SetDuration( float duration ) { pev->dmg_take = duration; }
inline void SetRadius( float radius ) { pev->dmg = radius; }
inline float Frequency( void )
{
return pev->dmg_save;
}
inline float Duration( void )
{
return pev->dmg_take;
}
inline float Radius( void )
{
return pev->dmg;
}
inline void SetAmplitude( float amplitude )
{
pev->scale = amplitude;
}
inline void SetFrequency( float frequency )
{
pev->dmg_save = frequency;
}
inline void SetDuration( float duration )
{
pev->dmg_take = duration;
}
inline void SetRadius( float radius )
{
pev->dmg = radius;
}
private:
};
LINK_ENTITY_TO_CLASS( env_shake, CShake );
LINK_ENTITY_TO_CLASS( env_shake, CShake )
// pev->scale is amplitude
// pev->dmg_save is frequency
@ -1876,7 +1840,6 @@ void CShake::Spawn( void )
pev->dmg = 0;
}
void CShake::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "amplitude" ) )
@ -1903,7 +1866,6 @@ void CShake::KeyValue( KeyValueData *pkvd )
CPointEntity::KeyValue( pkvd );
}
void CShake::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
UTIL_ScreenShake( pev->origin, Amplitude(), Frequency(), Duration(), Radius() );
@ -1917,15 +1879,29 @@ public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void KeyValue( KeyValueData *pkvd );
inline float Duration( void ) { return pev->dmg_take; }
inline float HoldTime( void ) { return pev->dmg_save; }
inline float Duration( void )
{
return pev->dmg_take;
}
inline void SetDuration( float duration ) { pev->dmg_take = duration; }
inline void SetHoldTime( float hold ) { pev->dmg_save = hold; }
inline float HoldTime( void )
{
return pev->dmg_save;
}
inline void SetDuration( float duration )
{
pev->dmg_take = duration;
}
inline void SetHoldTime( float hold )
{
pev->dmg_save = hold;
}
private:
};
LINK_ENTITY_TO_CLASS( env_fade, CFade );
LINK_ENTITY_TO_CLASS( env_fade, CFade )
// pev->dmg_take is duration
// pev->dmg_save is hold duration
@ -1941,7 +1917,6 @@ void CFade::Spawn( void )
pev->frame = 0;
}
void CFade::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "duration" ) )
@ -1958,7 +1933,6 @@ void CFade::KeyValue( KeyValueData *pkvd )
CPointEntity::KeyValue( pkvd );
}
void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
int fadeFlags = 0;
@ -1983,7 +1957,6 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
SUB_UseTargets( this, USE_TOGGLE, 0 );
}
class CMessage : public CPointEntity
{
public:
@ -1994,8 +1967,7 @@ public:
private:
};
LINK_ENTITY_TO_CLASS( env_message, CMessage );
LINK_ENTITY_TO_CLASS( env_message, CMessage )
void CMessage::Spawn( void )
{
@ -2006,18 +1978,18 @@ void CMessage::Spawn( void )
switch( pev->impulse )
{
case 1: // Medium radius
case 1:
// Medium radius
pev->speed = ATTN_STATIC;
break;
case 2: // Large radius
case 2:
// Large radius
pev->speed = ATTN_NORM;
break;
case 3: //EVERYWHERE
case 3:
//EVERYWHERE
pev->speed = ATTN_NONE;
break;
default:
case 0: // Small radius
pev->speed = ATTN_IDLE;
@ -2030,7 +2002,6 @@ void CMessage::Spawn( void )
pev->scale = 1.0;
}
void CMessage::Precache( void )
{
if( pev->noise )
@ -2058,7 +2029,6 @@ void CMessage::KeyValue( KeyValueData *pkvd )
CPointEntity::KeyValue( pkvd );
}
void CMessage::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
CBaseEntity *pPlayer = NULL;
@ -2086,8 +2056,6 @@ void CMessage::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useT
SUB_UseTargets( this, USE_TOGGLE, 0 );
}
//=========================================================
// FunnelEffect
//=========================================================
@ -2106,7 +2074,7 @@ void CEnvFunnel :: Precache ( void )
m_iSprite = PRECACHE_MODEL ( "sprites/flare6.spr" );
}
LINK_ENTITY_TO_CLASS( env_funnel, CEnvFunnel );
LINK_ENTITY_TO_CLASS( env_funnel, CEnvFunnel )
void CEnvFunnel::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -2126,7 +2094,6 @@ void CEnvFunnel::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
WRITE_SHORT( 0 );
}
MESSAGE_END();
SetThink( &CBaseEntity::SUB_Remove );
@ -2159,7 +2126,7 @@ void CEnvBeverage :: Precache ( void )
PRECACHE_SOUND( "weapons/g_bounce3.wav" );
}
LINK_ENTITY_TO_CLASS( env_beverage, CEnvBeverage );
LINK_ENTITY_TO_CLASS( env_beverage, CEnvBeverage )
void CEnvBeverage::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -2217,7 +2184,7 @@ void CItemSoda :: Precache ( void )
{
}
LINK_ENTITY_TO_CLASS( item_sodacan, CItemSoda );
LINK_ENTITY_TO_CLASS( item_sodacan, CItemSoda )
void CItemSoda::Spawn( void )
{
@ -2250,7 +2217,6 @@ void CItemSoda::CanTouch ( CBaseEntity *pOther )
}
// spoit sound here
pOther->TakeHealth( 1, DMG_GENERIC );// a bit of health.
if( !FNullEnt( pev->owner ) )

Some files were not shown because too many files have changed in this diff Show More