mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-03 02:24:28 +00:00
Reformat some files yet.
This commit is contained in:
parent
07347addc2
commit
3b8bc0a417
File diff suppressed because it is too large
Load Diff
@ -27,76 +27,76 @@ public:
|
||||
// Initialization
|
||||
virtual void Init( void );
|
||||
|
||||
public:
|
||||
public:
|
||||
// Public Interfaces
|
||||
virtual int StudioDrawModel ( int flags );
|
||||
virtual int StudioDrawPlayer ( int flags, struct entity_state_s *pplayer );
|
||||
virtual int StudioDrawModel( int flags );
|
||||
virtual int StudioDrawPlayer( int flags, struct entity_state_s *pplayer );
|
||||
|
||||
public:
|
||||
// Local interfaces
|
||||
//
|
||||
|
||||
// Look up animation data for sequence
|
||||
virtual mstudioanim_t *StudioGetAnim ( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc );
|
||||
virtual mstudioanim_t *StudioGetAnim( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc );
|
||||
|
||||
// Interpolate model position and angles and set up matrices
|
||||
virtual void StudioSetUpTransform (int trivial_accept);
|
||||
virtual void StudioSetUpTransform( int trivial_accept );
|
||||
|
||||
// Set up model bone positions
|
||||
virtual void StudioSetupBones ( void );
|
||||
virtual void StudioSetupBones( void );
|
||||
|
||||
// Find final attachment points
|
||||
virtual void StudioCalcAttachments ( void );
|
||||
virtual void StudioCalcAttachments( void );
|
||||
|
||||
// Save bone matrices and names
|
||||
virtual void StudioSaveBones( void );
|
||||
|
||||
// Merge cached bones with current bones for model
|
||||
virtual void StudioMergeBones ( model_t *m_pSubModel );
|
||||
virtual void StudioMergeBones( model_t *m_pSubModel );
|
||||
|
||||
// Determine interpolation fraction
|
||||
virtual float StudioEstimateInterpolant( void );
|
||||
|
||||
// Determine current frame for rendering
|
||||
virtual float StudioEstimateFrame ( mstudioseqdesc_t *pseqdesc );
|
||||
virtual float StudioEstimateFrame( mstudioseqdesc_t *pseqdesc );
|
||||
|
||||
// Apply special effects to transform matrix
|
||||
virtual void StudioFxTransform( cl_entity_t *ent, float transform[3][4] );
|
||||
|
||||
// Spherical interpolation of bones
|
||||
virtual void StudioSlerpBones ( vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s );
|
||||
virtual void StudioSlerpBones( vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s );
|
||||
|
||||
// Compute bone adjustments ( bone controllers )
|
||||
virtual void StudioCalcBoneAdj ( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen );
|
||||
// Compute bone adjustments( bone controllers )
|
||||
virtual void StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen );
|
||||
|
||||
// Get bone quaternions
|
||||
virtual void StudioCalcBoneQuaterion ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q );
|
||||
virtual void StudioCalcBoneQuaterion( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q );
|
||||
|
||||
// Get bone positions
|
||||
virtual void StudioCalcBonePosition ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos );
|
||||
virtual void StudioCalcBonePosition( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos );
|
||||
|
||||
// Compute rotations
|
||||
virtual void StudioCalcRotations ( float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f );
|
||||
virtual void StudioCalcRotations( float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f );
|
||||
|
||||
// Send bones and verts to renderer
|
||||
virtual void StudioRenderModel ( void );
|
||||
virtual void StudioRenderModel( void );
|
||||
|
||||
// Finalize rendering
|
||||
virtual void StudioRenderFinal (void);
|
||||
virtual void StudioRenderFinal( void );
|
||||
|
||||
// GL&D3D vs. Software renderer finishing functions
|
||||
virtual void StudioRenderFinal_Software ( void );
|
||||
virtual void StudioRenderFinal_Hardware ( void );
|
||||
virtual void StudioRenderFinal_Software( void );
|
||||
virtual void StudioRenderFinal_Hardware( void );
|
||||
|
||||
// Player specific data
|
||||
// Determine pitch and blending amounts for players
|
||||
virtual void StudioPlayerBlend ( mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch );
|
||||
virtual void StudioPlayerBlend( mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch );
|
||||
|
||||
// Estimate gait frame for player
|
||||
virtual void StudioEstimateGait ( entity_state_t *pplayer );
|
||||
virtual void StudioEstimateGait( entity_state_t *pplayer );
|
||||
|
||||
// Process movement of player
|
||||
virtual void StudioProcessGait ( entity_state_t *pplayer );
|
||||
virtual void StudioProcessGait( entity_state_t *pplayer );
|
||||
|
||||
public:
|
||||
|
||||
@ -145,7 +145,7 @@ public:
|
||||
mstudiomodel_t *m_pSubModel;
|
||||
|
||||
// Palette substition for top and bottom of model
|
||||
int m_nTopColor;
|
||||
int m_nTopColor;
|
||||
int m_nBottomColor;
|
||||
|
||||
//
|
||||
@ -156,34 +156,34 @@ public:
|
||||
// Number of bones in bone cache
|
||||
int m_nCachedBones;
|
||||
// Names of cached bones
|
||||
char m_nCachedBoneNames[ MAXSTUDIOBONES ][ 32 ];
|
||||
char m_nCachedBoneNames[MAXSTUDIOBONES][32];
|
||||
// Cached bone & light transformation matrices
|
||||
float m_rgCachedBoneTransform [ MAXSTUDIOBONES ][ 3 ][ 4 ];
|
||||
float m_rgCachedLightTransform[ MAXSTUDIOBONES ][ 3 ][ 4 ];
|
||||
float m_rgCachedBoneTransform[MAXSTUDIOBONES][3][4];
|
||||
float m_rgCachedLightTransform[MAXSTUDIOBONES][3][4];
|
||||
|
||||
// Software renderer scale factors
|
||||
float m_fSoftwareXScale, m_fSoftwareYScale;
|
||||
|
||||
// Current view vectors and render origin
|
||||
float m_vUp[ 3 ];
|
||||
float m_vRight[ 3 ];
|
||||
float m_vNormal[ 3 ];
|
||||
float m_vUp[3];
|
||||
float m_vRight[3];
|
||||
float m_vNormal[3];
|
||||
|
||||
float m_vRenderOrigin[3];
|
||||
|
||||
float m_vRenderOrigin[ 3 ];
|
||||
|
||||
// Model render counters ( from engine )
|
||||
int *m_pStudioModelCount;
|
||||
int *m_pModelsDrawn;
|
||||
|
||||
// Matrices
|
||||
// Model to world transformation
|
||||
float (*m_protationmatrix)[ 3 ][ 4 ];
|
||||
float (*m_protationmatrix)[3][4];
|
||||
// Model to view transformation
|
||||
float (*m_paliastransform)[ 3 ][ 4 ];
|
||||
float (*m_paliastransform)[3][4];
|
||||
|
||||
// Concatenated bone and light transforms
|
||||
float (*m_pbonetransform) [ MAXSTUDIOBONES ][ 3 ][ 4 ];
|
||||
float (*m_plighttransform)[ MAXSTUDIOBONES ][ 3 ][ 4 ];
|
||||
float (*m_pbonetransform)[MAXSTUDIOBONES][3][4];
|
||||
float (*m_plighttransform)[MAXSTUDIOBONES][3][4];
|
||||
};
|
||||
|
||||
#endif // STUDIOMODELRENDERER_H
|
||||
#endif // STUDIOMODELRENDERER_H
|
||||
|
@ -66,8 +66,8 @@ enum decal_e
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int index;
|
||||
char *name;
|
||||
int index;
|
||||
} DLL_DECALLIST;
|
||||
|
||||
extern DLL_DECALLIST gDecals[];
|
||||
|
@ -15,7 +15,6 @@
|
||||
#ifndef EXTDLL_H
|
||||
#define EXTDLL_H
|
||||
|
||||
|
||||
//
|
||||
// Global header file for extension DLLs
|
||||
//
|
||||
@ -57,15 +56,14 @@ typedef int BOOL;
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
// Misc C-runtime library headers
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
|
||||
// Header file containing definition of globalvars_t and entvars_t
|
||||
typedef unsigned int func_t; //
|
||||
typedef unsigned int string_t; // from engine's pr_comp.h;
|
||||
typedef unsigned int func_t;
|
||||
typedef unsigned int string_t; // from engine's pr_comp.h;
|
||||
typedef float vec_t; // needed before including progdefs.h
|
||||
|
||||
// Vector class
|
||||
@ -84,5 +82,4 @@ typedef float vec_t; // needed before including progdefs.h
|
||||
|
||||
// Shared header between the client DLL and the game DLLs
|
||||
#include "cdll_dll.h"
|
||||
|
||||
#endif //EXTDLL_H
|
||||
|
290
dlls/leech.cpp
290
dlls/leech.cpp
@ -46,14 +46,14 @@
|
||||
|
||||
// Movement constants
|
||||
|
||||
#define LEECH_ACCELERATE 10
|
||||
#define LEECH_CHECK_DIST 45
|
||||
#define LEECH_SWIM_SPEED 50
|
||||
#define LEECH_SWIM_ACCEL 80
|
||||
#define LEECH_SWIM_DECEL 10
|
||||
#define LEECH_TURN_RATE 90
|
||||
#define LEECH_SIZEX 10
|
||||
#define LEECH_FRAMETIME 0.1
|
||||
#define LEECH_ACCELERATE 10
|
||||
#define LEECH_CHECK_DIST 45
|
||||
#define LEECH_SWIM_SPEED 50
|
||||
#define LEECH_SWIM_ACCEL 80
|
||||
#define LEECH_SWIM_DECEL 10
|
||||
#define LEECH_TURN_RATE 90
|
||||
#define LEECH_SIZEX 10
|
||||
#define LEECH_FRAMETIME 0.1
|
||||
|
||||
#define DEBUG_BEAMS 0
|
||||
|
||||
@ -71,10 +71,10 @@ public:
|
||||
void EXPORT DeadThink( void );
|
||||
void Touch( CBaseEntity *pOther )
|
||||
{
|
||||
if ( pOther->IsPlayer() )
|
||||
if( pOther->IsPlayer() )
|
||||
{
|
||||
// If the client is pushing me, give me some base velocity
|
||||
if ( gpGlobals->trace_ent && gpGlobals->trace_ent == edict() )
|
||||
if( gpGlobals->trace_ent && gpGlobals->trace_ent == edict() )
|
||||
{
|
||||
pev->basevelocity = pOther->pev->velocity;
|
||||
pev->flags |= FL_BASEVELOCITY;
|
||||
@ -84,8 +84,8 @@ public:
|
||||
|
||||
void SetObjectCollisionBox( void )
|
||||
{
|
||||
pev->absmin = pev->origin + Vector(-8,-8,0);
|
||||
pev->absmax = pev->origin + Vector(8,8,2);
|
||||
pev->absmin = pev->origin + Vector( -8, -8, 0 );
|
||||
pev->absmax = pev->origin + Vector( 8, 8, 2 );
|
||||
}
|
||||
|
||||
void AttackSound( void );
|
||||
@ -98,38 +98,38 @@ public:
|
||||
|
||||
// Base entity functions
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
int BloodColor( void ) { return DONT_BLEED; }
|
||||
int BloodColor( void ) { return DONT_BLEED; }
|
||||
void Killed( entvars_t *pevAttacker, int iGib );
|
||||
void Activate( void );
|
||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
|
||||
int Classify( void ) { return CLASS_INSECT; }
|
||||
int Classify( void ) { return CLASS_INSECT; }
|
||||
int IRelationship( CBaseEntity *pTarget );
|
||||
|
||||
virtual int Save( CSave &save );
|
||||
virtual int Restore( CRestore &restore );
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
virtual int Save( CSave &save );
|
||||
virtual int Restore( CRestore &restore );
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
static const char *pAttackSounds[];
|
||||
static const char *pAlertSounds[];
|
||||
|
||||
private:
|
||||
// UNDONE: Remove unused boid vars, do group behavior
|
||||
float m_flTurning;// is this boid turning?
|
||||
BOOL m_fPathBlocked;// TRUE if there is an obstacle ahead
|
||||
float m_flAccelerate;
|
||||
float m_obstacle;
|
||||
float m_top;
|
||||
float m_bottom;
|
||||
float m_height;
|
||||
float m_waterTime;
|
||||
float m_sideTime; // Timer to randomly check clearance on sides
|
||||
float m_zTime;
|
||||
float m_stateTime;
|
||||
float m_attackSoundTime;
|
||||
float m_flTurning;// is this boid turning?
|
||||
BOOL m_fPathBlocked;// TRUE if there is an obstacle ahead
|
||||
float m_flAccelerate;
|
||||
float m_obstacle;
|
||||
float m_top;
|
||||
float m_bottom;
|
||||
float m_height;
|
||||
float m_waterTime;
|
||||
float m_sideTime; // Timer to randomly check clearance on sides
|
||||
float m_zTime;
|
||||
float m_stateTime;
|
||||
float m_attackSoundTime;
|
||||
|
||||
#if DEBUG_BEAMS
|
||||
CBeam *m_pb;
|
||||
CBeam *m_pt;
|
||||
CBeam *m_pb;
|
||||
CBeam *m_pt;
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -169,20 +169,20 @@ const char *CLeech::pAlertSounds[] =
|
||||
void CLeech::Spawn( void )
|
||||
{
|
||||
Precache();
|
||||
SET_MODEL(ENT(pev), "models/leech.mdl");
|
||||
SET_MODEL( ENT( pev ), "models/leech.mdl" );
|
||||
// Just for fun
|
||||
// SET_MODEL(ENT(pev), "models/icky.mdl");
|
||||
// SET_MODEL( ENT( pev ), "models/icky.mdl" );
|
||||
|
||||
//UTIL_SetSize( pev, g_vecZero, g_vecZero );
|
||||
UTIL_SetSize( pev, Vector(-1,-1,0), Vector(1,1,2));
|
||||
UTIL_SetSize( pev, Vector( -1, -1, 0 ), Vector( 1, 1, 2 ) );
|
||||
// Don't push the minz down too much or the water check will fail because this entity is really point-sized
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
SetBits(pev->flags, FL_SWIM);
|
||||
pev->health = gSkillData.leechHealth;
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
SetBits( pev->flags, FL_SWIM );
|
||||
pev->health = gSkillData.leechHealth;
|
||||
|
||||
m_flFieldOfView = -0.5; // 180 degree FOV
|
||||
m_flDistLook = 750;
|
||||
m_flFieldOfView = -0.5; // 180 degree FOV
|
||||
m_flDistLook = 750;
|
||||
MonsterInit();
|
||||
SetThink( &CLeech::SwimThink );
|
||||
SetUse( NULL );
|
||||
@ -204,12 +204,12 @@ void CLeech::Activate( void )
|
||||
void CLeech::RecalculateWaterlevel( void )
|
||||
{
|
||||
// Calculate boundaries
|
||||
Vector vecTest = pev->origin - Vector(0,0,400);
|
||||
Vector vecTest = pev->origin - Vector( 0, 0, 400 );
|
||||
|
||||
TraceResult tr;
|
||||
|
||||
UTIL_TraceLine(pev->origin, vecTest, missile, edict(), &tr);
|
||||
if ( tr.flFraction != 1.0 )
|
||||
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
|
||||
if( tr.flFraction != 1.0 )
|
||||
m_bottom = tr.vecEndPos.z + 1;
|
||||
else
|
||||
m_bottom = vecTest.z;
|
||||
@ -227,7 +227,7 @@ void CLeech::RecalculateWaterlevel( void )
|
||||
void CLeech::SwitchLeechState( void )
|
||||
{
|
||||
m_stateTime = gpGlobals->time + RANDOM_FLOAT( 3, 6 );
|
||||
if ( m_MonsterState == MONSTERSTATE_COMBAT )
|
||||
if( m_MonsterState == MONSTERSTATE_COMBAT )
|
||||
{
|
||||
m_hEnemy = NULL;
|
||||
SetState( MONSTERSTATE_IDLE );
|
||||
@ -238,7 +238,7 @@ void CLeech::SwitchLeechState( void )
|
||||
{
|
||||
Look( m_flDistLook );
|
||||
CBaseEntity *pEnemy = BestVisibleEnemy();
|
||||
if ( pEnemy && pEnemy->pev->waterlevel != 0 )
|
||||
if( pEnemy && pEnemy->pev->waterlevel != 0 )
|
||||
{
|
||||
m_hEnemy = pEnemy;
|
||||
SetState( MONSTERSTATE_COMBAT );
|
||||
@ -250,36 +250,36 @@ void CLeech::SwitchLeechState( void )
|
||||
|
||||
int CLeech::IRelationship( CBaseEntity *pTarget )
|
||||
{
|
||||
if ( pTarget->IsPlayer() )
|
||||
if( pTarget->IsPlayer() )
|
||||
return R_DL;
|
||||
return CBaseMonster::IRelationship( pTarget );
|
||||
}
|
||||
|
||||
void CLeech::AttackSound( void )
|
||||
{
|
||||
if ( gpGlobals->time > m_attackSoundTime )
|
||||
if( gpGlobals->time > m_attackSoundTime )
|
||||
{
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAttackSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackSounds)-1) ], 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
m_attackSoundTime = gpGlobals->time + 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
void CLeech::AlertSound( void )
|
||||
{
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAlertSounds[ RANDOM_LONG(0,ARRAYSIZE(pAlertSounds)-1) ], 1.0, ATTN_NORM * 0.5, 0, PITCH_NORM );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM * 0.5, 0, PITCH_NORM );
|
||||
}
|
||||
|
||||
void CLeech::Precache( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
//PRECACHE_MODEL("models/icky.mdl");
|
||||
PRECACHE_MODEL("models/leech.mdl");
|
||||
//PRECACHE_MODEL( "models/icky.mdl" );
|
||||
PRECACHE_MODEL( "models/leech.mdl" );
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAttackSounds[i]);
|
||||
for ( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAlertSounds[i]);
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAttackSounds[i] );
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND( (char *)pAlertSounds[i] );
|
||||
}
|
||||
|
||||
int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
||||
@ -287,9 +287,9 @@ int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float f
|
||||
pev->velocity = g_vecZero;
|
||||
|
||||
// Nudge the leech away from the damage
|
||||
if ( pevInflictor )
|
||||
if( pevInflictor )
|
||||
{
|
||||
pev->velocity = (pev->origin - pevInflictor->origin).Normalize() * 25;
|
||||
pev->velocity = ( pev->origin - pevInflictor->origin ).Normalize() * 25;
|
||||
}
|
||||
|
||||
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
||||
@ -304,7 +304,7 @@ void CLeech::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
CBaseEntity *pEnemy;
|
||||
|
||||
pEnemy = m_hEnemy;
|
||||
if ( pEnemy != NULL )
|
||||
if( pEnemy != NULL )
|
||||
{
|
||||
Vector dir, face;
|
||||
|
||||
@ -315,7 +315,7 @@ void CLeech::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
dir = dir.Normalize();
|
||||
face = face.Normalize();
|
||||
|
||||
if ( DotProduct(dir, face) > 0.9 ) // Only take damage if the leech is facing the prey
|
||||
if( DotProduct( dir, face ) > 0.9 ) // Only take damage if the leech is facing the prey
|
||||
pEnemy->TakeDamage( pev, pev, gSkillData.leechDmgBite, DMG_SLASH );
|
||||
}
|
||||
m_stateTime -= 2;
|
||||
@ -333,7 +333,7 @@ void CLeech::MakeVectors( void )
|
||||
{
|
||||
Vector tmp = pev->angles;
|
||||
tmp.x = -tmp.x;
|
||||
UTIL_MakeVectors ( tmp );
|
||||
UTIL_MakeVectors( tmp );
|
||||
}
|
||||
|
||||
//
|
||||
@ -341,8 +341,8 @@ void CLeech::MakeVectors( void )
|
||||
//
|
||||
float CLeech::ObstacleDistance( CBaseEntity *pTarget )
|
||||
{
|
||||
TraceResult tr;
|
||||
Vector vecTest;
|
||||
TraceResult tr;
|
||||
Vector vecTest;
|
||||
|
||||
// use VELOCITY, not angles, not all boids point the direction they are flying
|
||||
//Vector vecDir = UTIL_VecToAngles( pev->velocity );
|
||||
@ -350,58 +350,58 @@ float CLeech::ObstacleDistance( CBaseEntity *pTarget )
|
||||
|
||||
// check for obstacle ahead
|
||||
vecTest = pev->origin + gpGlobals->v_forward * LEECH_CHECK_DIST;
|
||||
UTIL_TraceLine(pev->origin, vecTest, missile, edict(), &tr);
|
||||
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
|
||||
|
||||
if ( tr.fStartSolid )
|
||||
if( tr.fStartSolid )
|
||||
{
|
||||
pev->speed = -LEECH_SWIM_SPEED * 0.5;
|
||||
// ALERT( at_console, "Stuck from (%f %f %f) to (%f %f %f)\n", pev->oldorigin.x, pev->oldorigin.y, pev->oldorigin.z, pev->origin.x, pev->origin.y, pev->origin.z );
|
||||
// UTIL_SetOrigin( pev, pev->oldorigin );
|
||||
//ALERT( at_console, "Stuck from (%f %f %f) to (%f %f %f)\n", pev->oldorigin.x, pev->oldorigin.y, pev->oldorigin.z, pev->origin.x, pev->origin.y, pev->origin.z );
|
||||
//UTIL_SetOrigin( pev, pev->oldorigin );
|
||||
}
|
||||
|
||||
if ( tr.flFraction != 1.0 )
|
||||
if( tr.flFraction != 1.0 )
|
||||
{
|
||||
if ( (pTarget == NULL || tr.pHit != pTarget->edict()) )
|
||||
if( ( pTarget == NULL || tr.pHit != pTarget->edict() ) )
|
||||
{
|
||||
return tr.flFraction;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fabs(m_height - pev->origin.z) > 10 )
|
||||
if( fabs( m_height - pev->origin.z ) > 10 )
|
||||
return tr.flFraction;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_sideTime < gpGlobals->time )
|
||||
if( m_sideTime < gpGlobals->time )
|
||||
{
|
||||
// extra wide checks
|
||||
vecTest = pev->origin + gpGlobals->v_right * LEECH_SIZEX * 2 + gpGlobals->v_forward * LEECH_CHECK_DIST;
|
||||
UTIL_TraceLine(pev->origin, vecTest, missile, edict(), &tr);
|
||||
if (tr.flFraction != 1.0)
|
||||
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
|
||||
if( tr.flFraction != 1.0 )
|
||||
return tr.flFraction;
|
||||
|
||||
vecTest = pev->origin - gpGlobals->v_right * LEECH_SIZEX * 2 + gpGlobals->v_forward * LEECH_CHECK_DIST;
|
||||
UTIL_TraceLine(pev->origin, vecTest, missile, edict(), &tr);
|
||||
if (tr.flFraction != 1.0)
|
||||
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
|
||||
if( tr.flFraction != 1.0 )
|
||||
return tr.flFraction;
|
||||
|
||||
// Didn't hit either side, so stop testing for another 0.5 - 1 seconds
|
||||
m_sideTime = gpGlobals->time + RANDOM_FLOAT(0.5,1);
|
||||
m_sideTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 1 );
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
void CLeech::DeadThink( void )
|
||||
{
|
||||
if ( m_fSequenceFinished )
|
||||
if( m_fSequenceFinished )
|
||||
{
|
||||
if ( m_Activity == ACT_DIEFORWARD )
|
||||
if( m_Activity == ACT_DIEFORWARD )
|
||||
{
|
||||
SetThink( NULL );
|
||||
StopAnimation();
|
||||
return;
|
||||
}
|
||||
else if ( pev->flags & FL_ONGROUND )
|
||||
else if( pev->flags & FL_ONGROUND )
|
||||
{
|
||||
pev->solid = SOLID_NOT;
|
||||
SetActivity(ACT_DIEFORWARD);
|
||||
@ -411,13 +411,13 @@ void CLeech::DeadThink( void )
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
// Apply damage velocity, but keep out of the walls
|
||||
if ( pev->velocity.x != 0 || pev->velocity.y != 0 )
|
||||
if( pev->velocity.x != 0 || pev->velocity.y != 0 )
|
||||
{
|
||||
TraceResult tr;
|
||||
|
||||
// Look 0.5 seconds ahead
|
||||
UTIL_TraceLine(pev->origin, pev->origin + pev->velocity * 0.5, missile, edict(), &tr);
|
||||
if (tr.flFraction != 1.0)
|
||||
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 0.5, missile, edict(), &tr );
|
||||
if( tr.flFraction != 1.0 )
|
||||
{
|
||||
pev->velocity.x = 0;
|
||||
pev->velocity.y = 0;
|
||||
@ -427,27 +427,27 @@ void CLeech::DeadThink( void )
|
||||
|
||||
void CLeech::UpdateMotion( void )
|
||||
{
|
||||
float flapspeed = (pev->speed - m_flAccelerate) / LEECH_ACCELERATE;
|
||||
float flapspeed = ( pev->speed - m_flAccelerate ) / LEECH_ACCELERATE;
|
||||
m_flAccelerate = m_flAccelerate * 0.8 + pev->speed * 0.2;
|
||||
|
||||
if (flapspeed < 0)
|
||||
if( flapspeed < 0 )
|
||||
flapspeed = -flapspeed;
|
||||
flapspeed += 1.0;
|
||||
if (flapspeed < 0.5)
|
||||
if( flapspeed < 0.5 )
|
||||
flapspeed = 0.5;
|
||||
if (flapspeed > 1.9)
|
||||
if( flapspeed > 1.9 )
|
||||
flapspeed = 1.9;
|
||||
|
||||
pev->framerate = flapspeed;
|
||||
|
||||
if ( !m_fPathBlocked )
|
||||
if( !m_fPathBlocked )
|
||||
pev->avelocity.y = pev->ideal_yaw;
|
||||
else
|
||||
pev->avelocity.y = pev->ideal_yaw * m_obstacle;
|
||||
|
||||
if ( pev->avelocity.y > 150 )
|
||||
if( pev->avelocity.y > 150 )
|
||||
m_IdealActivity = ACT_TURN_LEFT;
|
||||
else if ( pev->avelocity.y < -150 )
|
||||
else if( pev->avelocity.y < -150 )
|
||||
m_IdealActivity = ACT_TURN_RIGHT;
|
||||
else
|
||||
m_IdealActivity = ACT_SWIM;
|
||||
@ -456,9 +456,9 @@ void CLeech::UpdateMotion( void )
|
||||
float targetPitch, delta;
|
||||
delta = m_height - pev->origin.z;
|
||||
|
||||
if ( delta < -10 )
|
||||
if( delta < -10 )
|
||||
targetPitch = -30;
|
||||
else if ( delta > 10 )
|
||||
else if( delta > 10 )
|
||||
targetPitch = 30;
|
||||
else
|
||||
targetPitch = 0;
|
||||
@ -466,13 +466,13 @@ void CLeech::UpdateMotion( void )
|
||||
pev->angles.x = UTIL_Approach( targetPitch, pev->angles.x, 60 * LEECH_FRAMETIME );
|
||||
|
||||
// bank
|
||||
pev->avelocity.z = - (pev->angles.z + (pev->avelocity.y * 0.25));
|
||||
pev->avelocity.z = -( pev->angles.z + ( pev->avelocity.y * 0.25 ) );
|
||||
|
||||
if ( m_MonsterState == MONSTERSTATE_COMBAT && HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
|
||||
if( m_MonsterState == MONSTERSTATE_COMBAT && HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
|
||||
m_IdealActivity = ACT_MELEE_ATTACK1;
|
||||
|
||||
// Out of water check
|
||||
if ( !pev->waterlevel )
|
||||
if( !pev->waterlevel )
|
||||
{
|
||||
pev->movetype = MOVETYPE_TOSS;
|
||||
m_IdealActivity = ACT_TWITCH;
|
||||
@ -482,10 +482,10 @@ void CLeech::UpdateMotion( void )
|
||||
pev->angles.z = 0;
|
||||
pev->angles.x = 0;
|
||||
|
||||
if ( pev->framerate < 1.0 )
|
||||
if( pev->framerate < 1.0 )
|
||||
pev->framerate = 1.0;
|
||||
}
|
||||
else if ( pev->movetype == MOVETYPE_TOSS )
|
||||
else if( pev->movetype == MOVETYPE_TOSS )
|
||||
{
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->flags &= ~FL_ONGROUND;
|
||||
@ -493,25 +493,25 @@ void CLeech::UpdateMotion( void )
|
||||
m_waterTime = gpGlobals->time + 2; // Recalc again soon, water may be rising
|
||||
}
|
||||
|
||||
if ( m_Activity != m_IdealActivity )
|
||||
if( m_Activity != m_IdealActivity )
|
||||
{
|
||||
SetActivity ( m_IdealActivity );
|
||||
SetActivity( m_IdealActivity );
|
||||
}
|
||||
float flInterval = StudioFrameAdvance();
|
||||
DispatchAnimEvents ( flInterval );
|
||||
DispatchAnimEvents( flInterval );
|
||||
#if DEBUG_BEAMS
|
||||
if ( !m_pb )
|
||||
if( !m_pb )
|
||||
m_pb = CBeam::BeamCreate( "sprites/laserbeam.spr", 5 );
|
||||
if ( !m_pt )
|
||||
if( !m_pt )
|
||||
m_pt = CBeam::BeamCreate( "sprites/laserbeam.spr", 5 );
|
||||
m_pb->PointsInit( pev->origin, pev->origin + gpGlobals->v_forward * LEECH_CHECK_DIST );
|
||||
m_pt->PointsInit( pev->origin, pev->origin - gpGlobals->v_right * (pev->avelocity.y*0.25) );
|
||||
if ( m_fPathBlocked )
|
||||
m_pt->PointsInit( pev->origin, pev->origin - gpGlobals->v_right * ( pev->avelocity.y * 0.25 ) );
|
||||
if( m_fPathBlocked )
|
||||
{
|
||||
float color = m_obstacle * 30;
|
||||
if ( m_obstacle == 1.0 )
|
||||
if( m_obstacle == 1.0 )
|
||||
color = 0;
|
||||
if ( color > 255 )
|
||||
if( color > 255 )
|
||||
color = 255;
|
||||
m_pb->SetColor( 255, (int)color, (int)color );
|
||||
}
|
||||
@ -523,16 +523,16 @@ void CLeech::UpdateMotion( void )
|
||||
|
||||
void CLeech::SwimThink( void )
|
||||
{
|
||||
TraceResult tr;
|
||||
float flLeftSide;
|
||||
float flRightSide;
|
||||
float targetSpeed;
|
||||
float targetYaw = 0;
|
||||
CBaseEntity *pTarget;
|
||||
TraceResult tr;
|
||||
float flLeftSide;
|
||||
float flRightSide;
|
||||
float targetSpeed;
|
||||
float targetYaw = 0;
|
||||
CBaseEntity *pTarget;
|
||||
|
||||
if ( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
|
||||
if( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
|
||||
{
|
||||
pev->nextthink = gpGlobals->time + RANDOM_FLOAT(1,1.5);
|
||||
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 1, 1.5 );
|
||||
pev->velocity = g_vecZero;
|
||||
return;
|
||||
}
|
||||
@ -541,10 +541,10 @@ void CLeech::SwimThink( void )
|
||||
|
||||
targetSpeed = LEECH_SWIM_SPEED;
|
||||
|
||||
if ( m_waterTime < gpGlobals->time )
|
||||
if( m_waterTime < gpGlobals->time )
|
||||
RecalculateWaterlevel();
|
||||
|
||||
if ( m_stateTime < gpGlobals->time )
|
||||
if( m_stateTime < gpGlobals->time )
|
||||
SwitchLeechState();
|
||||
|
||||
ClearConditions( bits_COND_CAN_MELEE_ATTACK1 );
|
||||
@ -552,47 +552,47 @@ void CLeech::SwimThink( void )
|
||||
{
|
||||
case MONSTERSTATE_COMBAT:
|
||||
pTarget = m_hEnemy;
|
||||
if ( !pTarget )
|
||||
if( !pTarget )
|
||||
SwitchLeechState();
|
||||
else
|
||||
{
|
||||
// Chase the enemy's eyes
|
||||
m_height = pTarget->pev->origin.z + pTarget->pev->view_ofs.z - 5;
|
||||
// Clip to viable water area
|
||||
if ( m_height < m_bottom )
|
||||
if( m_height < m_bottom )
|
||||
m_height = m_bottom;
|
||||
else if ( m_height > m_top )
|
||||
else if( m_height > m_top )
|
||||
m_height = m_top;
|
||||
Vector location = pTarget->pev->origin - pev->origin;
|
||||
location.z += (pTarget->pev->view_ofs.z);
|
||||
if ( location.Length() < 40 )
|
||||
if( location.Length() < 40 )
|
||||
SetConditions( bits_COND_CAN_MELEE_ATTACK1 );
|
||||
// Turn towards target ent
|
||||
targetYaw = UTIL_VecToYaw( location );
|
||||
|
||||
targetYaw = UTIL_AngleDiff( targetYaw, UTIL_AngleMod( pev->angles.y ) );
|
||||
|
||||
if ( targetYaw < (-LEECH_TURN_RATE*0.75) )
|
||||
targetYaw = (-LEECH_TURN_RATE*0.75);
|
||||
else if ( targetYaw > (LEECH_TURN_RATE*0.75) )
|
||||
targetYaw = (LEECH_TURN_RATE*0.75);
|
||||
if( targetYaw < ( -LEECH_TURN_RATE * 0.75 ) )
|
||||
targetYaw = ( -LEECH_TURN_RATE * 0.75 );
|
||||
else if( targetYaw > ( LEECH_TURN_RATE * 0.75 ) )
|
||||
targetYaw = ( LEECH_TURN_RATE * 0.75 );
|
||||
else
|
||||
targetSpeed *= 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( m_zTime < gpGlobals->time )
|
||||
if( m_zTime < gpGlobals->time )
|
||||
{
|
||||
float newHeight = RANDOM_FLOAT( m_bottom, m_top );
|
||||
m_height = 0.5 * m_height + 0.5 * newHeight;
|
||||
m_zTime = gpGlobals->time + RANDOM_FLOAT( 1, 4 );
|
||||
}
|
||||
if ( RANDOM_LONG( 0, 100 ) < 10 )
|
||||
if( RANDOM_LONG( 0, 100 ) < 10 )
|
||||
targetYaw = RANDOM_LONG( -30, 30 );
|
||||
pTarget = NULL;
|
||||
|
||||
// oldorigin test
|
||||
if ( (pev->origin - pev->oldorigin).Length() < 1 )
|
||||
if( ( pev->origin - pev->oldorigin ).Length() < 1 )
|
||||
{
|
||||
// If leech didn't move, there must be something blocking it, so try to turn
|
||||
m_sideTime = 0;
|
||||
@ -602,14 +602,14 @@ void CLeech::SwimThink( void )
|
||||
|
||||
m_obstacle = ObstacleDistance( pTarget );
|
||||
pev->oldorigin = pev->origin;
|
||||
if ( m_obstacle < 0.1 )
|
||||
if( m_obstacle < 0.1 )
|
||||
m_obstacle = 0.1;
|
||||
|
||||
// is the way ahead clear?
|
||||
if ( m_obstacle == 1.0 )
|
||||
if( m_obstacle == 1.0 )
|
||||
{
|
||||
// if the leech is turning, stop the trend.
|
||||
if ( m_flTurning != 0 )
|
||||
if( m_flTurning != 0 )
|
||||
{
|
||||
m_flTurning = 0;
|
||||
}
|
||||
@ -625,55 +625,55 @@ void CLeech::SwimThink( void )
|
||||
// IF we get this far in the function, the leader's path is blocked!
|
||||
m_fPathBlocked = TRUE;
|
||||
|
||||
if ( m_flTurning == 0 )// something in the way and leech is not already turning to avoid
|
||||
if( m_flTurning == 0 )// something in the way and leech is not already turning to avoid
|
||||
{
|
||||
Vector vecTest;
|
||||
// measure clearance on left and right to pick the best dir to turn
|
||||
vecTest = pev->origin + (gpGlobals->v_right * LEECH_SIZEX) + (gpGlobals->v_forward * LEECH_CHECK_DIST);
|
||||
UTIL_TraceLine(pev->origin, vecTest, missile, edict(), &tr);
|
||||
vecTest = pev->origin + ( gpGlobals->v_right * LEECH_SIZEX ) + ( gpGlobals->v_forward * LEECH_CHECK_DIST );
|
||||
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
|
||||
flRightSide = tr.flFraction;
|
||||
|
||||
vecTest = pev->origin + (gpGlobals->v_right * -LEECH_SIZEX) + (gpGlobals->v_forward * LEECH_CHECK_DIST);
|
||||
UTIL_TraceLine(pev->origin, vecTest, missile, edict(), &tr);
|
||||
vecTest = pev->origin + ( gpGlobals->v_right * -LEECH_SIZEX ) + ( gpGlobals->v_forward * LEECH_CHECK_DIST );
|
||||
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
|
||||
flLeftSide = tr.flFraction;
|
||||
|
||||
// turn left, right or random depending on clearance ratio
|
||||
float delta = (flRightSide - flLeftSide);
|
||||
if ( delta > 0.1 || (delta > -0.1 && RANDOM_LONG(0,100)<50) )
|
||||
float delta = ( flRightSide - flLeftSide );
|
||||
if( delta > 0.1 || ( delta > -0.1 && RANDOM_LONG( 0, 100 ) < 50 ) )
|
||||
m_flTurning = -LEECH_TURN_RATE;
|
||||
else
|
||||
m_flTurning = LEECH_TURN_RATE;
|
||||
}
|
||||
pev->speed = UTIL_Approach( -(LEECH_SWIM_SPEED*0.5), pev->speed, LEECH_SWIM_DECEL * LEECH_FRAMETIME * m_obstacle );
|
||||
pev->speed = UTIL_Approach( -( LEECH_SWIM_SPEED * 0.5 ), pev->speed, LEECH_SWIM_DECEL * LEECH_FRAMETIME * m_obstacle );
|
||||
pev->velocity = gpGlobals->v_forward * pev->speed;
|
||||
}
|
||||
pev->ideal_yaw = m_flTurning + targetYaw;
|
||||
UpdateMotion();
|
||||
}
|
||||
|
||||
void CLeech::Killed(entvars_t *pevAttacker, int iGib)
|
||||
void CLeech::Killed( entvars_t *pevAttacker, int iGib )
|
||||
{
|
||||
Vector vecSplatDir;
|
||||
TraceResult tr;
|
||||
Vector vecSplatDir;
|
||||
TraceResult tr;
|
||||
|
||||
//ALERT(at_aiconsole, "Leech: killed\n");
|
||||
// tell owner ( if any ) that we're dead.This is mostly for MonsterMaker functionality.
|
||||
CBaseEntity *pOwner = CBaseEntity::Instance(pev->owner);
|
||||
if (pOwner)
|
||||
pOwner->DeathNotice(pev);
|
||||
CBaseEntity *pOwner = CBaseEntity::Instance( pev->owner );
|
||||
if( pOwner )
|
||||
pOwner->DeathNotice( pev );
|
||||
|
||||
// When we hit the ground, play the "death_end" activity
|
||||
if ( pev->waterlevel )
|
||||
if( pev->waterlevel )
|
||||
{
|
||||
pev->angles.z = 0;
|
||||
pev->angles.x = 0;
|
||||
pev->origin.z += 1;
|
||||
pev->avelocity = g_vecZero;
|
||||
if ( RANDOM_LONG( 0, 99 ) < 70 )
|
||||
if( RANDOM_LONG( 0, 99 ) < 70 )
|
||||
pev->avelocity.y = RANDOM_LONG( -720, 720 );
|
||||
|
||||
pev->gravity = 0.02;
|
||||
ClearBits(pev->flags, FL_ONGROUND);
|
||||
ClearBits( pev->flags, FL_ONGROUND );
|
||||
SetActivity( ACT_DIESIMPLE );
|
||||
}
|
||||
else
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int event;
|
||||
char *options;
|
||||
} MonsterEvent_t;
|
||||
int event;
|
||||
char *options;
|
||||
}MonsterEvent_t;
|
||||
|
||||
#define EVENT_SPECIFIC 0
|
||||
#define EVENT_SCRIPTED 1000
|
||||
@ -30,6 +30,5 @@ typedef struct
|
||||
#define MONSTER_EVENT_BODYDROP_LIGHT 2001
|
||||
#define MONSTER_EVENT_BODYDROP_HEAVY 2002
|
||||
|
||||
#define MONSTER_EVENT_SWISHSOUND 2010
|
||||
|
||||
#define MONSTER_EVENT_SWISHSOUND 2010
|
||||
#endif //MONSTEREVENT_H
|
||||
|
@ -41,10 +41,10 @@
|
||||
|
||||
// Monster Spawnflags
|
||||
#define SF_MONSTER_WAIT_TILL_SEEN 1// spawnflag that makes monsters wait until player can see them before attacking.
|
||||
#define SF_MONSTER_GAG 2 // no idle noises from this monster
|
||||
#define SF_MONSTER_GAG 2 // no idle noises from this monster
|
||||
#define SF_MONSTER_HITMONSTERCLIP 4
|
||||
// 8
|
||||
#define SF_MONSTER_PRISONER 16 // monster won't attack anyone, no one will attacke him.
|
||||
#define SF_MONSTER_PRISONER 16 // monster won't attack anyone, no one will attacke him.
|
||||
// 32
|
||||
// 64
|
||||
#define SF_MONSTER_WAIT_FOR_SCRIPT 128 //spawnflag that makes monsters wait to check for attacking until the script is done or they've been attacked
|
||||
@ -58,27 +58,27 @@
|
||||
#define SF_MONSTER_WAIT_UNTIL_PROVOKED 64 // don't attack the player unless provoked
|
||||
|
||||
// MoveToOrigin stuff
|
||||
#define MOVE_START_TURN_DIST 64 // when this far away from moveGoal, start turning to face next goal
|
||||
#define MOVE_STUCK_DIST 32 // if a monster can't step this far, it is stuck.
|
||||
#define MOVE_START_TURN_DIST 64 // when this far away from moveGoal, start turning to face next goal
|
||||
#define MOVE_STUCK_DIST 32 // if a monster can't step this far, it is stuck.
|
||||
|
||||
// MoveToOrigin stuff
|
||||
#define MOVE_NORMAL 0// normal move in the direction monster is facing
|
||||
#define MOVE_STRAFE 1// moves in direction specified, no matter which way monster is facing
|
||||
#define MOVE_NORMAL 0// normal move in the direction monster is facing
|
||||
#define MOVE_STRAFE 1// moves in direction specified, no matter which way monster is facing
|
||||
|
||||
// spawn flags 256 and above are already taken by the engine
|
||||
extern void UTIL_MoveToOrigin( edict_t* pent, const Vector &vecGoal, float flDist, int iMoveType );
|
||||
|
||||
Vector VecCheckToss ( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj = 1.0 );
|
||||
Vector VecCheckThrow ( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj = 1.0 );
|
||||
extern DLL_GLOBAL Vector g_vecAttackDir;
|
||||
Vector VecCheckToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj = 1.0 );
|
||||
Vector VecCheckThrow( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj = 1.0 );
|
||||
extern DLL_GLOBAL Vector g_vecAttackDir;
|
||||
extern DLL_GLOBAL CONSTANT float g_flMeleeRange;
|
||||
extern DLL_GLOBAL CONSTANT float g_flMediumRange;
|
||||
extern DLL_GLOBAL CONSTANT float g_flLongRange;
|
||||
extern void EjectBrass (const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype );
|
||||
extern void EjectBrass(const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype );
|
||||
extern void ExplodeModel( const Vector &vecOrigin, float speed, int model, int count );
|
||||
|
||||
BOOL FBoxVisible ( entvars_t *pevLooker, entvars_t *pevTarget );
|
||||
BOOL FBoxVisible ( entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize = 0.0 );
|
||||
BOOL FBoxVisible( entvars_t *pevLooker, entvars_t *pevTarget );
|
||||
BOOL FBoxVisible( entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize = 0.0 );
|
||||
|
||||
// monster to monster relationship types
|
||||
#define R_AL -2 // (ALLY) pals. Good alternative to R_NO when applicable.
|
||||
@ -140,20 +140,20 @@ class CGib : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
void Spawn( const char *szGibModel );
|
||||
void EXPORT BounceGibTouch ( CBaseEntity *pOther );
|
||||
void EXPORT StickyGibTouch ( CBaseEntity *pOther );
|
||||
void EXPORT BounceGibTouch( CBaseEntity *pOther );
|
||||
void EXPORT StickyGibTouch( CBaseEntity *pOther );
|
||||
void EXPORT WaitTillLand( void );
|
||||
void LimitVelocity( void );
|
||||
void LimitVelocity( void );
|
||||
|
||||
virtual int ObjectCaps( void ) { return (CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE; }
|
||||
static void SpawnHeadGib( entvars_t *pevVictim );
|
||||
static void SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human );
|
||||
static void SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs );
|
||||
virtual int ObjectCaps( void ) { return ( CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION ) | FCAP_DONT_SAVE; }
|
||||
static void SpawnHeadGib( entvars_t *pevVictim );
|
||||
static void SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human );
|
||||
static void SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs );
|
||||
|
||||
int m_bloodColor;
|
||||
int m_cBloodDecals;
|
||||
int m_material;
|
||||
float m_lifeTime;
|
||||
int m_bloodColor;
|
||||
int m_cBloodDecals;
|
||||
int m_material;
|
||||
float m_lifeTime;
|
||||
};
|
||||
|
||||
#define CUSTOM_SCHEDULES\
|
||||
@ -166,10 +166,9 @@ public:
|
||||
#define IMPLEMENT_CUSTOM_SCHEDULES(derivedClass, baseClass)\
|
||||
Schedule_t *derivedClass::ScheduleFromName( const char *pName )\
|
||||
{\
|
||||
Schedule_t *pSchedule = ScheduleInList( pName, m_scheduleList, ARRAYSIZE(m_scheduleList) );\
|
||||
if ( !pSchedule )\
|
||||
return baseClass::ScheduleFromName(pName);\
|
||||
Schedule_t *pSchedule = ScheduleInList( pName, m_scheduleList, ARRAYSIZE( m_scheduleList ) );\
|
||||
if( !pSchedule )\
|
||||
return baseClass::ScheduleFromName( pName );\
|
||||
return pSchedule;\
|
||||
}
|
||||
|
||||
#endif //MONSTERS_H
|
||||
|
143
dlls/mp5.cpp
143
dlls/mp5.cpp
@ -45,11 +45,11 @@ int CMP5::SecondaryAmmoIndex( void )
|
||||
return m_iSecondaryAmmoType;
|
||||
}
|
||||
|
||||
void CMP5::Spawn( )
|
||||
void CMP5::Spawn()
|
||||
{
|
||||
pev->classname = MAKE_STRING("weapon_9mmAR"); // hack to allow for old names
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_9mmAR.mdl");
|
||||
pev->classname = MAKE_STRING( "weapon_9mmAR" ); // hack to allow for old names
|
||||
Precache();
|
||||
SET_MODEL( ENT( pev ), "models/w_9mmAR.mdl" );
|
||||
m_iId = WEAPON_MP5;
|
||||
|
||||
m_iDefaultAmmo = MP5_DEFAULT_GIVE;
|
||||
@ -59,36 +59,36 @@ void CMP5::Spawn( )
|
||||
|
||||
void CMP5::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_9mmAR.mdl");
|
||||
PRECACHE_MODEL("models/w_9mmAR.mdl");
|
||||
PRECACHE_MODEL("models/p_9mmAR.mdl");
|
||||
PRECACHE_MODEL( "models/v_9mmAR.mdl" );
|
||||
PRECACHE_MODEL( "models/w_9mmAR.mdl" );
|
||||
PRECACHE_MODEL( "models/p_9mmAR.mdl" );
|
||||
|
||||
m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shellTE_MODEL
|
||||
m_iShell = PRECACHE_MODEL( "models/shell.mdl" );// brass shellTE_MODEL
|
||||
|
||||
PRECACHE_MODEL("models/grenade.mdl"); // grenade
|
||||
PRECACHE_MODEL( "models/grenade.mdl" ); // grenade
|
||||
|
||||
PRECACHE_MODEL("models/w_9mmARclip.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
PRECACHE_MODEL( "models/w_9mmARclip.mdl" );
|
||||
PRECACHE_SOUND( "items/9mmclip1.wav" );
|
||||
|
||||
PRECACHE_SOUND("items/clipinsert1.wav");
|
||||
PRECACHE_SOUND("items/cliprelease1.wav");
|
||||
PRECACHE_SOUND( "items/clipinsert1.wav" );
|
||||
PRECACHE_SOUND( "items/cliprelease1.wav" );
|
||||
|
||||
PRECACHE_SOUND ("weapons/hks1.wav");// H to the K
|
||||
PRECACHE_SOUND ("weapons/hks2.wav");// H to the K
|
||||
PRECACHE_SOUND ("weapons/hks3.wav");// H to the K
|
||||
PRECACHE_SOUND( "weapons/hks1.wav" );// H to the K
|
||||
PRECACHE_SOUND( "weapons/hks2.wav" );// H to the K
|
||||
PRECACHE_SOUND( "weapons/hks3.wav" );// H to the K
|
||||
|
||||
PRECACHE_SOUND( "weapons/glauncher.wav" );
|
||||
PRECACHE_SOUND( "weapons/glauncher2.wav" );
|
||||
|
||||
PRECACHE_SOUND ("weapons/357_cock1.wav");
|
||||
PRECACHE_SOUND( "weapons/357_cock1.wav" );
|
||||
|
||||
m_usMP5 = PRECACHE_EVENT( 1, "events/mp5.sc" );
|
||||
m_usMP52 = PRECACHE_EVENT( 1, "events/mp52.sc" );
|
||||
}
|
||||
|
||||
int CMP5::GetItemInfo(ItemInfo *p)
|
||||
int CMP5::GetItemInfo( ItemInfo *p )
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszName = STRING( pev->classname );
|
||||
p->pszAmmo1 = "9mm";
|
||||
p->iMaxAmmo1 = _9MM_MAX_CARRY;
|
||||
p->pszAmmo2 = "ARgrenades";
|
||||
@ -105,7 +105,7 @@ int CMP5::GetItemInfo(ItemInfo *p)
|
||||
|
||||
int CMP5::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
if( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
@ -115,7 +115,7 @@ int CMP5::AddToPlayer( CBasePlayer *pPlayer )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CMP5::Deploy( )
|
||||
BOOL CMP5::Deploy()
|
||||
{
|
||||
return DefaultDeploy( "models/v_9mmAR.mdl", "models/p_9mmAR.mdl", MP5_DEPLOY, "mp5" );
|
||||
}
|
||||
@ -123,14 +123,14 @@ BOOL CMP5::Deploy( )
|
||||
void CMP5::PrimaryAttack()
|
||||
{
|
||||
// don't fire underwater
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
if( m_pPlayer->pev->waterlevel == 3 )
|
||||
{
|
||||
PlayEmptySound( );
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iClip <= 0)
|
||||
if( m_iClip <= 0 )
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
@ -142,18 +142,18 @@ void CMP5::PrimaryAttack()
|
||||
|
||||
m_iClip--;
|
||||
|
||||
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
|
||||
m_pPlayer->pev->effects = (int)( m_pPlayer->pev->effects ) | EF_MUZZLEFLASH;
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition();
|
||||
Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
|
||||
Vector vecDir;
|
||||
#ifdef CLIENT_DLL
|
||||
if ( !bIsMultiplayer() )
|
||||
if( !bIsMultiplayer() )
|
||||
#else
|
||||
if ( !g_pGameRules->IsMultiplayer() )
|
||||
if( !g_pGameRules->IsMultiplayer() )
|
||||
#endif
|
||||
{
|
||||
// optimized multiplayer. Widened to make it easier to hit a moving player
|
||||
@ -173,13 +173,13 @@ void CMP5::PrimaryAttack()
|
||||
#endif
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
|
||||
if ( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
@ -188,16 +188,16 @@ void CMP5::PrimaryAttack()
|
||||
void CMP5::SecondaryAttack( void )
|
||||
{
|
||||
// don't fire underwater
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
if( m_pPlayer->pev->waterlevel == 3 )
|
||||
{
|
||||
PlayEmptySound( );
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] == 0)
|
||||
if( m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] == 0 )
|
||||
{
|
||||
PlayEmptySound( );
|
||||
PlayEmptySound();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ void CMP5::SecondaryAttack( void )
|
||||
|
||||
m_pPlayer->m_iExtraSoundTypes = bits_SOUND_DANGER;
|
||||
m_pPlayer->m_flStopExtraSoundTime = UTIL_WeaponTimeBase() + 0.2;
|
||||
|
||||
|
||||
m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType]--;
|
||||
|
||||
// player "shoot" animation
|
||||
@ -215,9 +215,9 @@ void CMP5::SecondaryAttack( void )
|
||||
UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle );
|
||||
|
||||
// we don't add in player velocity anymore.
|
||||
CGrenade::ShootContact( m_pPlayer->pev,
|
||||
m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16,
|
||||
gpGlobals->v_forward * 800 );
|
||||
CGrenade::ShootContact( m_pPlayer->pev,
|
||||
m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16,
|
||||
gpGlobals->v_forward * 800 );
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
@ -226,19 +226,19 @@ void CMP5::SecondaryAttack( void )
|
||||
flags = 0;
|
||||
#endif
|
||||
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 );
|
||||
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1;
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting.
|
||||
|
||||
if (!m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType])
|
||||
if( !m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] )
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||
}
|
||||
|
||||
void CMP5::Reload( void )
|
||||
{
|
||||
if ( m_pPlayer->ammo_9mm <= 0 )
|
||||
if( m_pPlayer->ammo_9mm <= 0 )
|
||||
return;
|
||||
|
||||
DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5 );
|
||||
@ -246,20 +246,19 @@ void CMP5::Reload( void )
|
||||
|
||||
void CMP5::WeaponIdle( void )
|
||||
{
|
||||
ResetEmptySound( );
|
||||
ResetEmptySound();
|
||||
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
|
||||
|
||||
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
int iAnim;
|
||||
switch ( RANDOM_LONG( 0, 1 ) )
|
||||
switch( RANDOM_LONG( 0, 1 ) )
|
||||
{
|
||||
case 0:
|
||||
iAnim = MP5_LONGIDLE;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 1:
|
||||
iAnim = MP5_IDLE1;
|
||||
@ -274,22 +273,22 @@ void CMP5::WeaponIdle( void )
|
||||
class CMP5AmmoClip : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_9mmARclip.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
{
|
||||
Precache();
|
||||
SET_MODEL( ENT( pev ), "models/w_9mmARclip.mdl" );
|
||||
CBasePlayerAmmo::Spawn();
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_9mmARclip.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
PRECACHE_MODEL( "models/w_9mmARclip.mdl" );
|
||||
PRECACHE_SOUND( "items/9mmclip1.wav" );
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
int bResult = (pOther->GiveAmmo( AMMO_MP5CLIP_GIVE, "9mm", _9MM_MAX_CARRY) != -1);
|
||||
if (bResult)
|
||||
int bResult = ( pOther->GiveAmmo( AMMO_MP5CLIP_GIVE, "9mm", _9MM_MAX_CARRY ) != -1 );
|
||||
if( bResult )
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM );
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
@ -302,21 +301,21 @@ class CMP5Chainammo : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_chainammo.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
Precache();
|
||||
SET_MODEL( ENT( pev ), "models/w_chainammo.mdl" );
|
||||
CBasePlayerAmmo::Spawn();
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_chainammo.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
PRECACHE_MODEL( "models/w_chainammo.mdl" );
|
||||
PRECACHE_SOUND( "items/9mmclip1.wav" );
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
int bResult = (pOther->GiveAmmo( AMMO_CHAINBOX_GIVE, "9mm", _9MM_MAX_CARRY) != -1);
|
||||
if (bResult)
|
||||
int bResult = ( pOther->GiveAmmo( AMMO_CHAINBOX_GIVE, "9mm", _9MM_MAX_CARRY ) != -1 );
|
||||
if( bResult )
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM );
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
@ -327,23 +326,23 @@ LINK_ENTITY_TO_CLASS( ammo_9mmbox, CMP5Chainammo )
|
||||
class CMP5AmmoGrenade : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_ARgrenade.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
{
|
||||
Precache();
|
||||
SET_MODEL( ENT( pev ), "models/w_ARgrenade.mdl" );
|
||||
CBasePlayerAmmo::Spawn();
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_ARgrenade.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
PRECACHE_MODEL( "models/w_ARgrenade.mdl" );
|
||||
PRECACHE_SOUND( "items/9mmclip1.wav" );
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
int bResult = (pOther->GiveAmmo( AMMO_M203BOX_GIVE, "ARgrenades", M203_GRENADE_MAX_CARRY ) != -1);
|
||||
int bResult = ( pOther->GiveAmmo( AMMO_M203BOX_GIVE, "ARgrenades", M203_GRENADE_MAX_CARRY ) != -1 );
|
||||
|
||||
if (bResult)
|
||||
if( bResult )
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM );
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
|
1164
dlls/plats.cpp
1164
dlls/plats.cpp
File diff suppressed because it is too large
Load Diff
575
dlls/prop.cpp
575
dlls/prop.cpp
File diff suppressed because it is too large
Load Diff
@ -26,34 +26,34 @@ CSoundEnt *pSoundEnt;
|
||||
//=========================================================
|
||||
// CSound - Clear - zeros all fields for a sound
|
||||
//=========================================================
|
||||
void CSound :: Clear ( void )
|
||||
void CSound::Clear( void )
|
||||
{
|
||||
m_vecOrigin = g_vecZero;
|
||||
m_iType = 0;
|
||||
m_iVolume = 0;
|
||||
m_flExpireTime = 0;
|
||||
m_iNext = SOUNDLIST_EMPTY;
|
||||
m_iNextAudible = 0;
|
||||
m_vecOrigin = g_vecZero;
|
||||
m_iType = 0;
|
||||
m_iVolume = 0;
|
||||
m_flExpireTime = 0;
|
||||
m_iNext = SOUNDLIST_EMPTY;
|
||||
m_iNextAudible = 0;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Reset - clears the volume, origin, and type for a sound,
|
||||
// but doesn't expire or unlink it.
|
||||
//=========================================================
|
||||
void CSound :: Reset ( void )
|
||||
void CSound::Reset( void )
|
||||
{
|
||||
m_vecOrigin = g_vecZero;
|
||||
m_iType = 0;
|
||||
m_iVolume = 0;
|
||||
m_iNext = SOUNDLIST_EMPTY;
|
||||
m_vecOrigin = g_vecZero;
|
||||
m_iType = 0;
|
||||
m_iVolume = 0;
|
||||
m_iNext = SOUNDLIST_EMPTY;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// FIsSound - returns TRUE if the sound is an Audible sound
|
||||
//=========================================================
|
||||
BOOL CSound :: FIsSound ( void )
|
||||
BOOL CSound::FIsSound( void )
|
||||
{
|
||||
if ( m_iType & ( bits_SOUND_COMBAT | bits_SOUND_WORLD | bits_SOUND_PLAYER | bits_SOUND_DANGER ) )
|
||||
if( m_iType & ( bits_SOUND_COMBAT | bits_SOUND_WORLD | bits_SOUND_PLAYER | bits_SOUND_DANGER ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -64,9 +64,9 @@ BOOL CSound :: FIsSound ( void )
|
||||
//=========================================================
|
||||
// FIsScent - returns TRUE if the sound is actually a scent
|
||||
//=========================================================
|
||||
BOOL CSound :: FIsScent ( void )
|
||||
BOOL CSound::FIsScent( void )
|
||||
{
|
||||
if ( m_iType & ( bits_SOUND_CARCASS | bits_SOUND_MEAT | bits_SOUND_GARBAGE ) )
|
||||
if( m_iType & ( bits_SOUND_CARCASS | bits_SOUND_MEAT | bits_SOUND_GARBAGE ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -77,7 +77,7 @@ BOOL CSound :: FIsScent ( void )
|
||||
//=========================================================
|
||||
// Spawn
|
||||
//=========================================================
|
||||
void CSoundEnt :: Spawn( void )
|
||||
void CSoundEnt::Spawn( void )
|
||||
{
|
||||
pev->solid = SOLID_NOT;
|
||||
Initialize();
|
||||
@ -90,7 +90,7 @@ void CSoundEnt :: Spawn( void )
|
||||
// for sounds that have ExpireTimes less than or equal
|
||||
// to the current world time, and these sounds are deallocated.
|
||||
//=========================================================
|
||||
void CSoundEnt :: Think ( void )
|
||||
void CSoundEnt::Think( void )
|
||||
{
|
||||
int iSound;
|
||||
int iPreviousSound;
|
||||
@ -100,9 +100,9 @@ void CSoundEnt :: Think ( void )
|
||||
iPreviousSound = SOUNDLIST_EMPTY;
|
||||
iSound = m_iActiveSound;
|
||||
|
||||
while ( iSound != SOUNDLIST_EMPTY )
|
||||
while( iSound != SOUNDLIST_EMPTY )
|
||||
{
|
||||
if ( m_SoundPool[ iSound ].m_flExpireTime <= gpGlobals->time && m_SoundPool[ iSound ].m_flExpireTime != SOUND_NEVER_EXPIRE )
|
||||
if( m_SoundPool[ iSound ].m_flExpireTime <= gpGlobals->time && m_SoundPool[ iSound ].m_flExpireTime != SOUND_NEVER_EXPIRE )
|
||||
{
|
||||
int iNext = m_SoundPool[ iSound ].m_iNext;
|
||||
|
||||
@ -118,17 +118,17 @@ void CSoundEnt :: Think ( void )
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_fShowReport )
|
||||
if( m_fShowReport )
|
||||
{
|
||||
ALERT ( at_aiconsole, "Soundlist: %d / %d (%d)\n", ISoundsInList( SOUNDLISTTYPE_ACTIVE ),ISoundsInList( SOUNDLISTTYPE_FREE ), ISoundsInList( SOUNDLISTTYPE_ACTIVE ) - m_cLastActiveSounds );
|
||||
m_cLastActiveSounds = ISoundsInList ( SOUNDLISTTYPE_ACTIVE );
|
||||
ALERT( at_aiconsole, "Soundlist: %d / %d (%d)\n", ISoundsInList( SOUNDLISTTYPE_ACTIVE ),ISoundsInList( SOUNDLISTTYPE_FREE ), ISoundsInList( SOUNDLISTTYPE_ACTIVE ) - m_cLastActiveSounds );
|
||||
m_cLastActiveSounds = ISoundsInList( SOUNDLISTTYPE_ACTIVE );
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Precache - dummy function
|
||||
//=========================================================
|
||||
void CSoundEnt :: Precache ( void )
|
||||
void CSoundEnt::Precache( void )
|
||||
{
|
||||
}
|
||||
|
||||
@ -137,29 +137,29 @@ void CSoundEnt :: Precache ( void )
|
||||
// to the top of the free list. TAKE CARE to only call this
|
||||
// function for sounds in the Active list!!
|
||||
//=========================================================
|
||||
void CSoundEnt :: FreeSound ( int iSound, int iPrevious )
|
||||
void CSoundEnt::FreeSound( int iSound, int iPrevious )
|
||||
{
|
||||
if ( !pSoundEnt )
|
||||
if( !pSoundEnt )
|
||||
{
|
||||
// no sound ent!
|
||||
return;
|
||||
}
|
||||
|
||||
if ( iPrevious != SOUNDLIST_EMPTY )
|
||||
if( iPrevious != SOUNDLIST_EMPTY )
|
||||
{
|
||||
// iSound is not the head of the active list, so
|
||||
// must fix the index for the Previous sound
|
||||
//pSoundEnt->m_SoundPool[ iPrevious ].m_iNext = m_SoundPool[ iSound ].m_iNext;
|
||||
pSoundEnt->m_SoundPool[ iPrevious ].m_iNext = pSoundEnt->m_SoundPool[ iSound ].m_iNext;
|
||||
//pSoundEnt->m_SoundPool[iPrevious].m_iNext = m_SoundPool[iSound].m_iNext;
|
||||
pSoundEnt->m_SoundPool[iPrevious].m_iNext = pSoundEnt->m_SoundPool[iSound].m_iNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
// the sound we're freeing IS the head of the active list.
|
||||
pSoundEnt->m_iActiveSound = pSoundEnt->m_SoundPool [ iSound ].m_iNext;
|
||||
pSoundEnt->m_iActiveSound = pSoundEnt->m_SoundPool[iSound].m_iNext;
|
||||
}
|
||||
|
||||
// make iSound the head of the Free list.
|
||||
pSoundEnt->m_SoundPool[ iSound ].m_iNext = pSoundEnt->m_iFreeSound;
|
||||
pSoundEnt->m_SoundPool[iSound].m_iNext = pSoundEnt->m_iFreeSound;
|
||||
pSoundEnt->m_iFreeSound = iSound;
|
||||
}
|
||||
|
||||
@ -167,25 +167,25 @@ void CSoundEnt :: FreeSound ( int iSound, int iPrevious )
|
||||
// IAllocSound - moves a sound from the Free list to the
|
||||
// Active list returns the index of the alloc'd sound
|
||||
//=========================================================
|
||||
int CSoundEnt :: IAllocSound( void )
|
||||
int CSoundEnt::IAllocSound( void )
|
||||
{
|
||||
int iNewSound;
|
||||
|
||||
if ( m_iFreeSound == SOUNDLIST_EMPTY )
|
||||
if( m_iFreeSound == SOUNDLIST_EMPTY )
|
||||
{
|
||||
// no free sound!
|
||||
ALERT ( at_console, "Free Sound List is full!\n" );
|
||||
ALERT( at_console, "Free Sound List is full!\n" );
|
||||
return SOUNDLIST_EMPTY;
|
||||
}
|
||||
|
||||
// there is at least one sound available, so move it to the
|
||||
// Active sound list, and return its SoundPool index.
|
||||
|
||||
|
||||
iNewSound = m_iFreeSound;// copy the index of the next free sound
|
||||
|
||||
m_iFreeSound = m_SoundPool[ m_iFreeSound ].m_iNext;// move the index down into the free list.
|
||||
m_iFreeSound = m_SoundPool[m_iFreeSound].m_iNext;// move the index down into the free list.
|
||||
|
||||
m_SoundPool[ iNewSound ].m_iNext = m_iActiveSound;// point the new sound at the top of the active list.
|
||||
m_SoundPool[iNewSound].m_iNext = m_iActiveSound;// point the new sound at the top of the active list.
|
||||
|
||||
m_iActiveSound = iNewSound;// now make the new sound the top of the active list. You're done.
|
||||
|
||||
@ -196,11 +196,11 @@ int CSoundEnt :: IAllocSound( void )
|
||||
// InsertSound - Allocates a free sound and fills it with
|
||||
// sound info.
|
||||
//=========================================================
|
||||
void CSoundEnt :: InsertSound ( int iType, const Vector &vecOrigin, int iVolume, float flDuration )
|
||||
void CSoundEnt::InsertSound( int iType, const Vector &vecOrigin, int iVolume, float flDuration )
|
||||
{
|
||||
int iThisSound;
|
||||
int iThisSound;
|
||||
|
||||
if ( !pSoundEnt )
|
||||
if( !pSoundEnt )
|
||||
{
|
||||
// no sound ent!
|
||||
return;
|
||||
@ -208,23 +208,23 @@ void CSoundEnt :: InsertSound ( int iType, const Vector &vecOrigin, int iVolume,
|
||||
|
||||
iThisSound = pSoundEnt->IAllocSound();
|
||||
|
||||
if ( iThisSound == SOUNDLIST_EMPTY )
|
||||
if( iThisSound == SOUNDLIST_EMPTY )
|
||||
{
|
||||
ALERT ( at_console, "Could not AllocSound() for InsertSound() (DLL)\n" );
|
||||
ALERT( at_console, "Could not AllocSound() for InsertSound() (DLL)\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
pSoundEnt->m_SoundPool[ iThisSound ].m_vecOrigin = vecOrigin;
|
||||
pSoundEnt->m_SoundPool[ iThisSound ].m_iType = iType;
|
||||
pSoundEnt->m_SoundPool[ iThisSound ].m_iVolume = iVolume;
|
||||
pSoundEnt->m_SoundPool[ iThisSound ].m_flExpireTime = gpGlobals->time + flDuration;
|
||||
pSoundEnt->m_SoundPool[iThisSound].m_vecOrigin = vecOrigin;
|
||||
pSoundEnt->m_SoundPool[iThisSound].m_iType = iType;
|
||||
pSoundEnt->m_SoundPool[iThisSound].m_iVolume = iVolume;
|
||||
pSoundEnt->m_SoundPool[iThisSound].m_flExpireTime = gpGlobals->time + flDuration;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Initialize - clears all sounds and moves them into the
|
||||
// free sound list.
|
||||
//=========================================================
|
||||
void CSoundEnt :: Initialize ( void )
|
||||
void CSoundEnt::Initialize( void )
|
||||
{
|
||||
int i;
|
||||
int iSound;
|
||||
@ -233,30 +233,30 @@ void CSoundEnt :: Initialize ( void )
|
||||
m_iFreeSound = 0;
|
||||
m_iActiveSound = SOUNDLIST_EMPTY;
|
||||
|
||||
for ( i = 0 ; i < MAX_WORLD_SOUNDS ; i++ )
|
||||
for( i = 0; i < MAX_WORLD_SOUNDS; i++ )
|
||||
{
|
||||
// clear all sounds, and link them into the free sound list.
|
||||
m_SoundPool[ i ].Clear();
|
||||
m_SoundPool[ i ].m_iNext = i + 1;
|
||||
m_SoundPool[i].Clear();
|
||||
m_SoundPool[i].m_iNext = i + 1;
|
||||
}
|
||||
|
||||
m_SoundPool[ i - 1 ].m_iNext = SOUNDLIST_EMPTY;// terminate the list here.
|
||||
m_SoundPool[i - 1].m_iNext = SOUNDLIST_EMPTY;// terminate the list here.
|
||||
|
||||
// now reserve enough sounds for each client
|
||||
for ( i = 0 ; i < gpGlobals->maxClients ; i++ )
|
||||
for( i = 0; i < gpGlobals->maxClients; i++ )
|
||||
{
|
||||
iSound = pSoundEnt->IAllocSound();
|
||||
|
||||
if ( iSound == SOUNDLIST_EMPTY )
|
||||
if( iSound == SOUNDLIST_EMPTY )
|
||||
{
|
||||
ALERT ( at_console, "Could not AllocSound() for Client Reserve! (DLL)\n" );
|
||||
ALERT( at_console, "Could not AllocSound() for Client Reserve! (DLL)\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
pSoundEnt->m_SoundPool[ iSound ].m_flExpireTime = SOUND_NEVER_EXPIRE;
|
||||
pSoundEnt->m_SoundPool[iSound].m_flExpireTime = SOUND_NEVER_EXPIRE;
|
||||
}
|
||||
|
||||
if ( CVAR_GET_FLOAT("displaysoundlist") == 1 )
|
||||
if( CVAR_GET_FLOAT( "displaysoundlist" ) == 1 )
|
||||
{
|
||||
m_fShowReport = TRUE;
|
||||
}
|
||||
@ -270,36 +270,36 @@ void CSoundEnt :: Initialize ( void )
|
||||
// ISoundsInList - returns the number of sounds in the desired
|
||||
// sound list.
|
||||
//=========================================================
|
||||
int CSoundEnt :: ISoundsInList ( int iListType )
|
||||
int CSoundEnt::ISoundsInList( int iListType )
|
||||
{
|
||||
int i;
|
||||
int iThisSound = 0;
|
||||
|
||||
if ( iListType == SOUNDLISTTYPE_FREE )
|
||||
if( iListType == SOUNDLISTTYPE_FREE )
|
||||
{
|
||||
iThisSound = m_iFreeSound;
|
||||
}
|
||||
else if ( iListType == SOUNDLISTTYPE_ACTIVE )
|
||||
else if( iListType == SOUNDLISTTYPE_ACTIVE )
|
||||
{
|
||||
iThisSound = m_iActiveSound;
|
||||
}
|
||||
else
|
||||
{
|
||||
ALERT ( at_console, "Unknown Sound List Type!\n" );
|
||||
ALERT( at_console, "Unknown Sound List Type!\n" );
|
||||
}
|
||||
|
||||
if ( iThisSound == SOUNDLIST_EMPTY )
|
||||
if( iThisSound == SOUNDLIST_EMPTY )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
||||
while ( iThisSound != SOUNDLIST_EMPTY )
|
||||
while( iThisSound != SOUNDLIST_EMPTY )
|
||||
{
|
||||
i++;
|
||||
|
||||
iThisSound = m_SoundPool[ iThisSound ].m_iNext;
|
||||
iThisSound = m_SoundPool[iThisSound].m_iNext;
|
||||
}
|
||||
|
||||
return i;
|
||||
@ -308,9 +308,9 @@ int CSoundEnt :: ISoundsInList ( int iListType )
|
||||
//=========================================================
|
||||
// ActiveList - returns the head of the active sound list
|
||||
//=========================================================
|
||||
int CSoundEnt :: ActiveList ( void )
|
||||
int CSoundEnt::ActiveList( void )
|
||||
{
|
||||
if ( !pSoundEnt )
|
||||
if( !pSoundEnt )
|
||||
{
|
||||
return SOUNDLIST_EMPTY;
|
||||
}
|
||||
@ -321,9 +321,9 @@ int CSoundEnt :: ActiveList ( void )
|
||||
//=========================================================
|
||||
// FreeList - returns the head of the free sound list
|
||||
//=========================================================
|
||||
int CSoundEnt :: FreeList ( void )
|
||||
int CSoundEnt::FreeList( void )
|
||||
{
|
||||
if ( !pSoundEnt )
|
||||
if( !pSoundEnt )
|
||||
{
|
||||
return SOUNDLIST_EMPTY;
|
||||
}
|
||||
@ -335,26 +335,26 @@ int CSoundEnt :: FreeList ( void )
|
||||
// SoundPointerForIndex - returns a pointer to the instance
|
||||
// of CSound at index's position in the sound pool.
|
||||
//=========================================================
|
||||
CSound* CSoundEnt :: SoundPointerForIndex( int iIndex )
|
||||
CSound *CSoundEnt::SoundPointerForIndex( int iIndex )
|
||||
{
|
||||
if ( !pSoundEnt )
|
||||
if( !pSoundEnt )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( iIndex > ( MAX_WORLD_SOUNDS - 1 ) )
|
||||
if( iIndex > ( MAX_WORLD_SOUNDS - 1 ) )
|
||||
{
|
||||
ALERT ( at_console, "SoundPointerForIndex() - Index too large!\n" );
|
||||
ALERT( at_console, "SoundPointerForIndex() - Index too large!\n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( iIndex < 0 )
|
||||
if( iIndex < 0 )
|
||||
{
|
||||
ALERT ( at_console, "SoundPointerForIndex() - Index < 0!\n" );
|
||||
ALERT( at_console, "SoundPointerForIndex() - Index < 0!\n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &pSoundEnt->m_SoundPool[ iIndex ];
|
||||
return &pSoundEnt->m_SoundPool[iIndex];
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
@ -363,14 +363,14 @@ CSound* CSoundEnt :: SoundPointerForIndex( int iIndex )
|
||||
// so this function ensures that a client gets the proper index
|
||||
// to his reserved sound in the soundlist.
|
||||
//=========================================================
|
||||
int CSoundEnt :: ClientSoundIndex ( edict_t *pClient )
|
||||
int CSoundEnt::ClientSoundIndex( edict_t *pClient )
|
||||
{
|
||||
int iReturn = ENTINDEX( pClient ) - 1;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if ( iReturn < 0 || iReturn > gpGlobals->maxClients )
|
||||
if( iReturn < 0 || iReturn > gpGlobals->maxClients )
|
||||
{
|
||||
ALERT ( at_console, "** ClientSoundIndex returning a bogus value! **\n" );
|
||||
ALERT( at_console, "** ClientSoundIndex returning a bogus value! **\n" );
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
|
503
dlls/weapons.cpp
503
dlls/weapons.cpp
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user