Remove extra commas and semicolons. Format.

This commit is contained in:
Night Owl 2016-06-25 21:33:39 +05:00
parent 3a691b21a4
commit 1aac42f504
135 changed files with 1955 additions and 4019 deletions

View File

@ -230,27 +230,27 @@ int giBucketHeight, giBucketWidth, giABHeight, giABWidth; // Ammo Bar width and
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 +295,7 @@ int CHudAmmo::Init(void)
gHR.Init();
return 1;
};
}
void CHudAmmo::Reset(void)
{

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 )
{

View File

@ -100,7 +100,7 @@ enum {
HISTSLOT_EMPTY,
HISTSLOT_AMMO,
HISTSLOT_WEAP,
HISTSLOT_ITEM,
HISTSLOT_ITEM
};
class HistoryResource

View File

@ -38,7 +38,7 @@ int CHudBattery::Init(void)
gHUD.AddHudElem(this);
return 1;
};
}
int CHudBattery::VidInit(void)
@ -52,7 +52,7 @@ 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 )
{
@ -135,4 +135,4 @@ int CHudBattery::Draw(float flTime)
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b);
return 1;
}
}

View File

@ -22,7 +22,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];

View File

@ -1181,7 +1181,7 @@ enum crossbow_e {
CROSSBOW_DRAW1, // full
CROSSBOW_DRAW2, // empty
CROSSBOW_HOLSTER1, // full
CROSSBOW_HOLSTER2, // empty
CROSSBOW_HOLSTER2 // empty
};
//=====================
@ -1322,7 +1322,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 )
@ -1552,7 +1552,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
@ -1697,4 +1697,4 @@ void EV_TrainPitchAdjust( event_args_t *args )
int EV_TFC_IsAllyTeam( int iTeam1, int iTeam2 )
{
return 0;
}
}

View File

@ -20,7 +20,7 @@ typedef enum
BULLET_MONSTER_9MM,
BULLET_MONSTER_MP5,
BULLET_MONSTER_12MM,
BULLET_MONSTER_12MM
} Bullet;
enum glock_e {
@ -58,7 +58,7 @@ enum mp5_e
MP5_DEPLOY,
MP5_FIRE1,
MP5_FIRE2,
MP5_FIRE3,
MP5_FIRE3
};
enum python_e {
@ -92,4 +92,4 @@ 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
#endif // EV_HLDMH

View File

@ -45,7 +45,7 @@ int CHudFlashlight::Init(void)
gHUD.AddHudElem(this);
return 1;
};
}
void CHudFlashlight::Reset(void)
{
@ -68,7 +68,7 @@ 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 )
{
@ -155,4 +155,4 @@ int CHudFlashlight::Draw(float flTime)
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)
{

View File

@ -44,7 +44,7 @@ enum
{
MAX_PLAYERS = 64,
MAX_TEAMS = 64,
MAX_TEAM_NAME = 16,
MAX_TEAM_NAME = 16
};
typedef struct {
@ -277,7 +277,7 @@ protected:
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
@ -547,9 +547,8 @@ public:
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...
@ -574,8 +573,6 @@ private:
//-----------------------------------------------------
//
class CHud
{
private:
@ -631,7 +628,6 @@ public:
{
return m_rgrcRects[index];
}
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array
@ -653,7 +649,6 @@ public:
CHudScoreboard m_Scoreboard;
CHudMOTD m_MOTD;
void Init( void );
void VidInit( void );
void Think(void);
@ -691,7 +686,6 @@ public:
};
extern CHud gHUD;
extern int g_iPlayerClass;

View File

@ -27,8 +27,6 @@ extern "C"
#include <string.h>
#include <ctype.h>
extern "C"
{
struct kbutton_s DLLEXPORT *KB_Find( const char *name );
@ -381,8 +379,8 @@ 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_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);}

View File

@ -20,18 +20,16 @@
#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 )
{

View File

@ -42,7 +42,7 @@ int CHudMessage::Init(void)
Reset();
return 1;
};
}
int CHudMessage::VidInit( void )
{
@ -50,7 +50,7 @@ int CHudMessage::VidInit( void )
m_HUD_title_life = gHUD.GetSpriteIndex( "title_life" );
return 1;
};
}
void CHudMessage::Reset( void )

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;
@ -777,4 +777,4 @@ typedef struct
int hitgroup; // 0 == generic, non zero is specific body part
} trace_t;
#endif//CONST_H
#endif//CONST_H

View File

@ -19,7 +19,7 @@
typedef enum
{
TRI_FRONT = 0,
TRI_NONE = 1,
TRI_NONE = 1
} TRICULLSTYLE;
#define TRI_API_VERSION 1
@ -59,4 +59,4 @@ typedef struct triangleapi_s
void (*FogParams)( float flDensity, int iFogSkybox );
} triangleapi_t;
#endif//TRIANGLEAPI_H
#endif//TRIANGLEAPI_H

View File

@ -94,7 +94,7 @@ typedef enum {
ACT_FLINCH_LEFTARM,
ACT_FLINCH_RIGHTARM,
ACT_FLINCH_LEFTLEG,
ACT_FLINCH_RIGHTLEG,
ACT_FLINCH_RIGHTLEG
} Activity;

View File

@ -55,7 +55,7 @@ TYPEDESCRIPTION CFlockingFlyerFlock::m_SaveData[] =
DEFINE_FIELD( CFlockingFlyerFlock, m_flFlockRadius, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CFlockingFlyerFlock, CBaseMonster );
IMPLEMENT_SAVERESTORE( CFlockingFlyerFlock, CBaseMonster )
//=========================================================
//=========================================================
@ -106,8 +106,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 +126,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 +164,6 @@ void CFlockingFlyerFlock :: Precache( )
PrecacheFlockSounds();
}
void CFlockingFlyerFlock :: PrecacheFlockSounds( void )
{
PRECACHE_SOUND("boid/boid_alert1.wav" );
@ -549,7 +549,6 @@ BOOL CFlockingFlyer :: FPathBlocked( )
return fBlocked;
}
//=========================================================
// Leader boids use this think every tenth
//=========================================================
@ -785,7 +784,6 @@ void CFlockingFlyer :: FlockFollowerThink( void )
// if we make it this far, boids path is CLEAR!
m_fCourseAdjust = FALSE;
*/
//=========================================================
//
@ -813,6 +811,7 @@ void CFlockingFlyer :: SquadAdd( CFlockingFlyer *pAdd )
m_pSquadNext = pAdd;
pAdd->m_pSquadLeader = this;
}
//=========================================================
//
// SquadRemove(), remove pRemove from my squad.
@ -872,6 +871,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;
@ -98,7 +98,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 +122,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 +135,7 @@ TYPEDESCRIPTION CAGrunt::m_SaveData[] =
DEFINE_FIELD( CAGrunt, m_iLastWord, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CAGrunt, CSquadMonster );
IMPLEMENT_SAVERESTORE( CAGrunt, CSquadMonster )
const char *CAGrunt::pAttackHitSounds[] =
{
@ -627,7 +628,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" );
@ -757,7 +757,6 @@ Schedule_t slAGruntRangeAttack1[] =
},
};
Task_t tlAGruntHiddenRangeAttack1[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_STANDOFF },
@ -884,7 +883,7 @@ DEFINE_CUSTOM_SCHEDULES( CAGrunt )
slAGruntThreatDisplay,
};
IMPLEMENT_CUSTOM_SCHEDULES( CAGrunt, CSquadMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CAGrunt, CSquadMonster )
//=========================================================
// FCanCheckAttacks - this is overridden for alien grunts
@ -1130,7 +1129,7 @@ Schedule_t *CAGrunt :: GetSchedule ( void )
//=========================================================
Schedule_t* CAGrunt :: GetScheduleOfType ( int Type )
{
switch ( Type )
switch( Type )
{
case SCHED_TAKE_COVER_FROM_ENEMY:
return &slAGruntTakeCoverFromEnemy[ 0 ];

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
@ -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 );

View File

@ -53,8 +53,6 @@ extern globalvars_t *gpGlobals;
#pragma warning( disable : 4244 )
int ExtractBbox( void *pmodel, int sequence, float *mins, float *maxs )
{
studiohdr_t *pstudiohdr;
@ -78,7 +76,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 +103,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 +168,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 +175,6 @@ int IsSoundEvent( int eventNumber )
return 0;
}
void SequencePrecache( void *pmodel, const char *pSequenceName )
{
int index = LookupSequence( pmodel, pSequenceName );
@ -219,8 +213,6 @@ void SequencePrecache( void *pmodel, const char *pSequenceName )
}
}
void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed )
{
studiohdr_t *pstudiohdr;
@ -253,7 +245,6 @@ void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *
}
}
int GetSequenceFlags( void *pmodel, entvars_t *pev )
{
studiohdr_t *pstudiohdr;
@ -268,7 +259,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;
@ -370,7 +360,6 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
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;
@ -412,9 +401,6 @@ float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
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 +489,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;
@ -523,4 +508,4 @@ int GetBodygroup( void *pmodel, entvars_t *pev, int iGroup )
int iCurrent = (pev->body / pbodypart->base) % pbodypart->nummodels;
return iCurrent;
}
}

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 );
@ -407,7 +404,6 @@ void CApache :: DyingThink( void )
}
}
void CApache::FlyTouch( CBaseEntity *pOther )
{
// bounce if we hit something solid
@ -420,7 +416,6 @@ void CApache::FlyTouch( CBaseEntity *pOther )
}
}
void CApache::CrashTouch( CBaseEntity *pOther )
{
// only crash if we hit something solid
@ -432,14 +427,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 +579,6 @@ void CApache :: HuntThink( void )
}
}
void CApache :: Flight( void )
{
// tilt model 5 degrees
@ -742,7 +733,6 @@ void CApache :: Flight( void )
}
}
void CApache :: FireRocket( void )
{
static float side = 1.0;
@ -782,8 +772,6 @@ void CApache :: FireRocket( void )
side = - side;
}
BOOL CApache :: FireGun( )
{
UTIL_MakeAimVectors( pev->angles );
@ -865,8 +853,6 @@ BOOL CApache :: FireGun( )
return FALSE;
}
void CApache :: ShowDamage( void )
{
if (m_iDoSmokePuff > 0 || RANDOM_LONG(0,99) > pev->health)
@ -885,7 +871,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 +893,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 +916,6 @@ void CApache::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
}
}
class CApacheHVR : public CGrenade
{
void Spawn( void );
@ -951,7 +930,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 +939,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 +964,6 @@ void CApacheHVR :: Spawn( void )
pev->dmg = 150;
}
void CApacheHVR :: Precache( void )
{
PRECACHE_MODEL("models/HVR.mdl");
@ -992,7 +971,6 @@ void CApacheHVR :: Precache( void )
PRECACHE_SOUND ("weapons/rocket1.wav");
}
void CApacheHVR :: IgniteThink( void )
{
// pev->movetype = MOVETYPE_TOSS;
@ -1023,8 +1001,7 @@ void CApacheHVR :: IgniteThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
void CApacheHVR :: AccelerateThink( void )
void CApacheHVR :: AccelerateThink( void )
{
// check world boundaries
if (pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096)
@ -1045,6 +1022,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
@ -173,8 +173,7 @@ void CBarnacle :: BarnacleThink ( void )
if ( m_hEnemy != NULL )
{
// barnacle has prey.
// barnacle has prey.
if ( !m_hEnemy->IsAlive() )
{
// someone (maybe even the barnacle) killed the prey. Reset barnacle.
@ -193,7 +192,7 @@ void CBarnacle :: BarnacleThink ( void )
return;
}
// still pulling prey.
// still pulling prey.
Vector vecNewEnemyOrigin = m_hEnemy->pev->origin;
vecNewEnemyOrigin.x = pev->origin.x;
vecNewEnemyOrigin.y = pev->origin.y;
@ -207,7 +206,7 @@ void CBarnacle :: BarnacleThink ( void )
if ( fabs( pev->origin.z - ( vecNewEnemyOrigin.z + m_hEnemy->pev->view_ofs.z - 8 ) ) < BARNACLE_BODY_HEIGHT )
{
// prey has just been lifted into position ( if the victim origin + eye height + 8 is higher than the bottom of the barnacle, it is assumed that the head is within barnacle's body )
// prey has just been lifted into position ( if the victim origin + eye height + 8 is higher than the bottom of the barnacle, it is assumed that the head is within barnacle's body )
m_fLiftingPrey = FALSE;
EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_bite3.wav", 1, ATTN_NORM );
@ -227,8 +226,7 @@ void CBarnacle :: BarnacleThink ( void )
}
else
{
// prey is lifted fully into feeding position and is dangling there.
// prey is lifted fully into feeding position and is dangling there.
pVictim = m_hEnemy->MyMonsterPointer();
if ( m_flKillVictimTime != -1 && gpGlobals->time > m_flKillVictimTime )
@ -260,14 +258,14 @@ void CBarnacle :: BarnacleThink ( void )
}
else
{
// barnacle has no prey right now, so just idle and check to see if anything is touching the tongue.
// 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;
}

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 },
@ -212,8 +211,7 @@ DEFINE_CUSTOM_SCHEDULES( CBarney )
slIdleBaStand,
};
IMPLEMENT_CUSTOM_SCHEDULES( CBarney, CTalkMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CBarney, CTalkMonster )
void CBarney :: StartTask( Task_t *pTask )
{
@ -237,9 +235,6 @@ void CBarney :: RunTask( Task_t *pTask )
}
}
//=========================================================
// ISoundMask - returns a bit mask indicating which types
// of sounds this monster regards.
@ -276,8 +271,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 +302,6 @@ void CBarney :: SetYawSpeed ( void )
pev->yaw_speed = ys;
}
//=========================================================
// CheckRangeAttack1
//=========================================================
@ -335,7 +329,6 @@ BOOL CBarney :: CheckRangeAttack1 ( float flDot, float flDist )
return FALSE;
}
//=========================================================
// BarneyFirePistol - shoots one round from the pistol at
// the enemy barney is facing.
@ -453,8 +446,7 @@ void CBarney :: Precache()
// Init talk data
void CBarney :: TalkInit()
{
{
CTalkMonster::TalkInit();
// scientists speach group names (group names are in sentences.txt)
@ -487,7 +479,6 @@ void CBarney :: TalkInit()
m_voicePitch = 100;
}
static BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
{
Vector vecDir = (reference - pevTest->origin);
@ -497,6 +488,7 @@ static BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
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 +497,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...
@ -545,7 +536,6 @@ int CBarney :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, floa
return ret;
}
//=========================================================
// PainSound
@ -600,6 +590,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 +599,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;
@ -768,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
//
@ -814,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 **********
@ -839,5 +824,3 @@ void CDeadBarney :: Spawn( )
MonsterInitDead();
}

View File

@ -31,7 +31,7 @@ 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;
@ -104,7 +104,7 @@ public:
Vector m_HackedGunPos; // HACK until we can query end of gun
// Scripted sequence Info
// Scripted sequence Info
SCRIPTSTATE m_scriptState; // internal cinematic state
CCineMonster *m_pCine;
@ -115,11 +115,11 @@ public:
void KeyValue( KeyValueData *pkvd );
// monster use function
// monster use function
void EXPORT MonsterUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT CorpseUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
// overrideable Monster member functions
// overrideable Monster member functions
virtual int BloodColor( void ) { return m_bloodColor; }
@ -131,14 +131,14 @@ public:
virtual BOOL IsAlive( void ) { return (pev->deadflag != DEAD_DEAD); }
virtual BOOL ShouldFadeOnDeath( void );
// Basic Monster AI functions
// Basic Monster AI functions
virtual float ChangeYaw ( int speed );
float VecToYaw( Vector vecDir );
float FlYawDiff ( void );
float DamageForce( float damage );
// stuff written for new state machine
// stuff written for new state machine
virtual void MonsterThink( void );
void EXPORT CallMonsterThink( void ) { this->MonsterThink(); }
virtual int IRelationship ( CBaseEntity *pTarget );
@ -333,7 +333,4 @@ public:
CBaseEntity* DropItem ( char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item.
};
#endif // BASEMONSTER_H

View File

@ -51,20 +51,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 +114,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 +145,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 +153,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 +162,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"
@ -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[] =
{
@ -344,49 +339,48 @@ const char *CBigMomma::pDeathSounds[] =
"gonarch/gon_die1.wav",
};
const char *CBigMomma::pAttackSounds[] =
const char *CBigMomma::pAttackSounds[] =
{
"gonarch/gon_attack1.wav",
"gonarch/gon_attack2.wav",
"gonarch/gon_attack3.wav",
};
const char *CBigMomma::pAttackHitSounds[] =
const char *CBigMomma::pAttackHitSounds[] =
{
"zombie/claw_strike1.wav",
"zombie/claw_strike2.wav",
"zombie/claw_strike3.wav",
};
const char *CBigMomma::pBirthSounds[] =
const char *CBigMomma::pBirthSounds[] =
{
"gonarch/gon_birth1.wav",
"gonarch/gon_birth2.wav",
"gonarch/gon_birth3.wav",
};
const char *CBigMomma::pAlertSounds[] =
const char *CBigMomma::pAlertSounds[] =
{
"gonarch/gon_alert1.wav",
"gonarch/gon_alert2.wav",
"gonarch/gon_alert3.wav",
};
const char *CBigMomma::pPainSounds[] =
const char *CBigMomma::pPainSounds[] =
{
"gonarch/gon_pain2.wav",
"gonarch/gon_pain4.wav",
"gonarch/gon_pain5.wav",
};
const char *CBigMomma::pFootSounds[] =
const char *CBigMomma::pFootSounds[] =
{
"gonarch/gon_step1.wav",
"gonarch/gon_step2.wav",
"gonarch/gon_step3.wav",
};
void CBigMomma :: KeyValue( KeyValueData *pkvd )
{
#if 0
@ -575,11 +569,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 +617,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 +628,6 @@ void CBigMomma::DeathNotice( entvars_t *pevChild )
}
}
void CBigMomma::LaunchMortar( void )
{
m_mortarTime = gpGlobals->time + RANDOM_FLOAT( 2, 15 );
@ -702,14 +691,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;
@ -735,7 +722,6 @@ void CBigMomma::NodeStart( int iszNextNode )
m_hTargetEnt = pTarget;
}
void CBigMomma::NodeReach( void )
{
CBaseEntity *pTarget = m_hTargetEnt;
@ -760,8 +746,7 @@ void CBigMomma::NodeReach( void )
Remember( bits_MEMORY_ADVANCE_NODE ); // Move on if no health at this node
}
// Slash
// Slash
BOOL CBigMomma::CheckMeleeAttack1( float flDot, float flDist )
{
if (flDot >= 0.7)
@ -772,7 +757,6 @@ BOOL CBigMomma::CheckMeleeAttack1( float flDot, float flDist )
return FALSE;
}
// Lay a crab
BOOL CBigMomma::CheckMeleeAttack2( float flDot, float flDist )
{
@ -806,7 +790,7 @@ BOOL CBigMomma::CheckRangeAttack1( float flDot, float flDist )
enum
{
SCHED_BIG_NODE = LAST_COMMON_SCHEDULE + 1,
SCHED_NODE_FAIL,
SCHED_NODE_FAIL
};
enum
@ -818,10 +802,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 +832,6 @@ Schedule_t slBigNode[] =
},
};
Task_t tlNodeFail[] =
{
{ TASK_NODE_DELAY, (float)10 }, // Try to do something else for 10 seconds
@ -873,10 +855,7 @@ DEFINE_CUSTOM_SCHEDULES( CBigMomma )
slNodeFail,
};
IMPLEMENT_CUSTOM_SCHEDULES( CBigMomma, CBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CBigMomma, CBaseMonster )
Schedule_t *CBigMomma::GetScheduleOfType( int Type )
{
@ -894,7 +873,6 @@ Schedule_t *CBigMomma::GetScheduleOfType( int Type )
return CBaseMonster::GetScheduleOfType( Type );
}
BOOL CBigMomma::ShouldGoToNode( void )
{
if ( HasMemory( bits_MEMORY_ADVANCE_NODE ) )
@ -905,8 +883,6 @@ BOOL CBigMomma::ShouldGoToNode( void )
return FALSE;
}
Schedule_t *CBigMomma::GetSchedule( void )
{
if ( ShouldGoToNode() )
@ -917,7 +893,6 @@ Schedule_t *CBigMomma::GetSchedule( void )
return CBaseMonster::GetSchedule();
}
void CBigMomma::StartTask( Task_t *pTask )
{
switch ( pTask->iTask )
@ -1053,9 +1028,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 +1037,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 +1045,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;
@ -1125,9 +1094,6 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
return vecGrenadeVel;
}
// ---------------------------------
//
// Mortar
@ -1150,7 +1116,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 +1169,6 @@ CBMortar *CBMortar::Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocity
return pSpit;
}
void CBMortar::Touch( CBaseEntity *pOther )
{
TraceResult tr;
@ -1237,6 +1201,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 +1212,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.
@ -171,11 +166,11 @@ void CBloater :: HandleAnimEvent( MonsterEvent_t *pEvent )
switch( pEvent->event )
{
case BLOATER_AE_ATTACK_MELEE1:
{
// do stuff for this event.
AttackSnd();
}
break;
{
// do stuff for this event.
AttackSnd();
}
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );

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 )
{
@ -190,15 +183,12 @@ void CFuncConveyor :: UpdateSpeed( float speed )
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,7 +345,6 @@ 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
@ -443,7 +429,6 @@ void CFuncRotating :: Spawn( )
Precache( );
}
void CFuncRotating :: Precache( void )
{
char* szSoundFile = (char*) STRING(pev->message);
@ -457,7 +442,8 @@ void CFuncRotating :: Precache( void )
PRECACHE_SOUND(szSoundFile);
pev->noiseRunning = ALLOC_STRING(szSoundFile);
} else
}
else
{
// otherwise use preset sound
switch (m_sounds)
@ -509,8 +495,6 @@ void CFuncRotating :: Precache( void )
}
}
//
// Touch - will hurt others based on how fast the brush is spinning
//
@ -573,10 +557,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);
}
//
@ -592,9 +574,9 @@ void CFuncRotating :: SpinUp( void )
vecAVel = pev->avelocity;// cache entity's rotational velocity
// if we've met or exceeded target speed, set target speed and stop thinking
if ( fabs(vecAVel.x) >= fabs(pev->movedir.x * pev->speed) &&
fabs(vecAVel.y) >= fabs(pev->movedir.y * pev->speed) &&
fabs(vecAVel.z) >= fabs(pev->movedir.z * pev->speed) )
if( fabs( vecAVel.x ) >= fabs( pev->movedir.x * pev->speed ) &&
fabs( vecAVel.y ) >= fabs( pev->movedir.y * pev->speed ) &&
fabs( vecAVel.z ) >= fabs( pev->movedir.z * pev->speed ) )
{
pev->avelocity = pev->movedir * pev->speed;// set speed in case we overshot
EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning),
@ -706,24 +688,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:
@ -751,9 +723,9 @@ public:
vec3_t m_start;
};
LINK_ENTITY_TO_CLASS( func_pendulum, CPendulum );
LINK_ENTITY_TO_CLASS( func_pendulum, CPendulum )
TYPEDESCRIPTION CPendulum::m_SaveData[] =
TYPEDESCRIPTION CPendulum::m_SaveData[] =
{
DEFINE_FIELD( CPendulum, m_accel, FIELD_FLOAT ),
DEFINE_FIELD( CPendulum, m_distance, FIELD_FLOAT ),
@ -765,9 +737,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 +755,6 @@ void CPendulum :: KeyValue( KeyValueData *pkvd )
CBaseEntity::KeyValue( pkvd );
}
void CPendulum :: Spawn( void )
{
// set the axis of rotation
@ -824,7 +793,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 +823,6 @@ void CPendulum :: PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, US
}
}
void CPendulum :: Stop( void )
{
pev->angles = m_start;
@ -864,13 +831,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;
@ -912,7 +877,6 @@ void CPendulum :: Swing( void )
}
}
void CPendulum :: Touch ( CBaseEntity *pOther )
{
entvars_t *pevOther = pOther->pev;
@ -954,5 +918,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 )
{
@ -225,16 +224,17 @@ 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 );
TYPEDESCRIPTION CBullsquid::m_SaveData[] =
LINK_ENTITY_TO_CLASS( monster_bullchicken, CBullsquid )
TYPEDESCRIPTION CBullsquid::m_SaveData[] =
{
DEFINE_FIELD( CBullsquid, m_fCanThreatDisplay, FIELD_BOOLEAN ),
DEFINE_FIELD( CBullsquid, m_flLastHurtTime, FIELD_TIME ),
DEFINE_FIELD( CBullsquid, m_flNextSpitTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CBullsquid, CBaseMonster );
IMPLEMENT_SAVERESTORE( CBullsquid, CBaseMonster )
//=========================================================
// IgnoreConditions
@ -258,7 +258,6 @@ int CBullsquid::IgnoreConditions ( void )
}
}
return iIgnore;
}
@ -626,7 +625,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
@ -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;
}
}
}
//========================================================
@ -1014,7 +1009,7 @@ DEFINE_CUSTOM_SCHEDULES( CBullsquid )
slSquidWallow
};
IMPLEMENT_CUSTOM_SCHEDULES( CBullsquid, CBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CBullsquid, CBaseMonster )
//=========================================================
// GetSchedule
@ -1240,7 +1235,6 @@ void CBullsquid :: RunTask ( Task_t *pTask )
}
}
//=========================================================
// GetIdealState - Overridden for Bullsquid to deal with
// the feature that makes it lose interest in headcrabs for
@ -1276,4 +1270,3 @@ MONSTERSTATE CBullsquid :: GetIdealState ( void )
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
@ -59,9 +58,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 +90,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 +100,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 )
@ -138,9 +133,10 @@ 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.
//
@ -207,7 +203,6 @@ void CMultiSource::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
}
}
BOOL CMultiSource::IsTriggered( CBaseEntity * )
{
// Is everything triggered?
@ -264,7 +259,6 @@ void CMultiSource::Register(void)
pentTarget = FIND_ENTITY_BY_STRING( pentTarget, "classname", "multi_manager" );
}
pev->spawnflags &= ~SF_MULTI_INIT;
}
@ -283,8 +277,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 )
{
@ -436,8 +429,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( )
{
@ -504,7 +497,6 @@ void CBaseButton::Spawn( )
}
}
// Button sound table.
// Also used by CBaseDoor to get 'touched' door lock/unlock sounds
@ -530,8 +522,8 @@ char *ButtonSound( int sound )
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
// 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;
@ -573,7 +565,6 @@ void CBaseButton::ButtonSpark ( void )
DoSpark( pev, pev->mins );
}
//
// Button's Use function
//
@ -599,7 +590,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 +611,6 @@ CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch( void )
return BUTTON_NOTHING;
}
//
// Touching a button simply "activates" it.
//
@ -723,7 +712,6 @@ void CBaseButton::TriggerAndWait( void )
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
}
//
// Starts the button moving "out/down".
//
@ -741,7 +729,6 @@ void CBaseButton::ButtonReturn( void )
pev->frame = 0; // use normal textures
}
//
// Button has returned to start state. Quiesce it.
//
@ -777,16 +764,16 @@ void CBaseButton::ButtonBackHome( void )
}
}
// Re-instate touch method, movement cycle is complete.
// Re-instate touch method, movement cycle is complete.
if ( !FBitSet ( pev->spawnflags, SF_BUTTON_TOUCH_ONLY ) ) // this button only works if USED, not touched!
{
// All buttons are now use only
// All buttons are now use only
SetTouch( NULL );
}
else
SetTouch( &CBaseButton::ButtonTouch );
// reset think for a sparking button
// reset think for a sparking button
if ( FBitSet ( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )
{
SetThink( &CBaseButton::ButtonSpark );
@ -794,8 +781,6 @@ void CBaseButton::ButtonBackHome( void )
}
}
//
// Rotating button (aka "lever")
//
@ -805,7 +790,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 )
{
@ -865,7 +850,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
@ -907,6 +891,7 @@ public:
vec3_t m_end;
int m_sounds;
};
TYPEDESCRIPTION CMomentaryRotButton::m_SaveData[] =
{
DEFINE_FIELD( CMomentaryRotButton, m_lastUsed, FIELD_INTEGER ),
@ -917,9 +902,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 )
{
@ -1094,7 +1079,6 @@ void CMomentaryRotButton::Return( void )
UpdateTarget( value );
}
void CMomentaryRotButton::UpdateSelfReturn( float value )
{
if ( value <= 0 )
@ -1111,7 +1095,6 @@ void CMomentaryRotButton::UpdateSelfReturn( float value )
}
}
//----------------------------------------------------------------
// Spark
//----------------------------------------------------------------
@ -1134,16 +1117,15 @@ public:
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)
{
@ -1171,7 +1153,6 @@ void CEnvSpark::Spawn(void)
Precache( );
}
void CEnvSpark::Precache(void)
{
PRECACHE_SOUND( "buttons/spark1.wav" );
@ -1228,11 +1209,10 @@ public:
void Spawn( void );
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 );
int ObjectCaps( void );
};
LINK_ENTITY_TO_CLASS( button_target, CButtonTarget );
LINK_ENTITY_TO_CLASS( button_target, CButtonTarget )
void CButtonTarget::Spawn( void )
{
@ -1256,7 +1236,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 +1246,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);
@ -202,10 +202,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 +218,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 +280,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 +298,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 +319,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
@ -368,14 +364,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 +406,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 +417,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 +439,7 @@ edict_t * EHANDLE::Get( void )
return NULL;
}
return NULL;
};
}
edict_t * EHANDLE::Set( edict_t *pent )
{
@ -457,14 +447,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,14 +480,13 @@ CBaseEntity * EHANDLE :: operator -> ()
return (CBaseEntity *)GET_PRIVATE( Get( ) );
}
// give health
int CBaseEntity :: TakeHealth( float flHealth, int bitsDamageType )
{
if (!pev->takedamage)
return 0;
// heal
// heal
if ( pev->health >= pev->max_health )
return 0;
@ -534,12 +521,11 @@ int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker,
vecTemp = pevInflictor->origin - ( VecBModelOrigin(pev) );
}
// this global is still used for glass and other non-monster killables, along with decals.
// 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)
// 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) )
{
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
@ -552,7 +538,7 @@ int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker,
pev->velocity = pev->velocity + vecDir * flForce;
}
// do the damage
// do the damage
pev->health -= flDamage;
if (pev->health <= 0)
{
@ -563,7 +549,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 +556,6 @@ void CBaseEntity :: Killed( entvars_t *pevAttacker, int iGib )
UTIL_Remove( this );
}
CBaseEntity *CBaseEntity::GetNextTarget( void )
{
if ( FStringNull( pev->target ) )
@ -594,7 +578,6 @@ TYPEDESCRIPTION CBaseEntity::m_SaveData[] =
DEFINE_FIELD( CBaseEntity, m_pfnBlocked, FIELD_FUNCTION ),
};
int CBaseEntity::Save( CSave &save )
{
if ( save.WriteEntVars( "ENTVARS", pev ) )
@ -611,13 +594,12 @@ int CBaseEntity::Restore( CRestore &restore )
if ( status )
status = restore.ReadFields( "BASE", this, m_SaveData, ARRAYSIZE(m_SaveData) );
if ( pev->modelindex != 0 && !FStringNull(pev->model) )
if ( pev->modelindex != 0 && !FStringNull(pev->model) )
{
Vector mins, maxs;
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,7 +608,6 @@ int CBaseEntity::Restore( CRestore &restore )
return status;
}
// Initialize absmin & absmax to the appropriate box
void SetObjectCollisionBox( entvars_t *pev )
{
@ -666,14 +647,12 @@ void SetObjectCollisionBox( entvars_t *pev )
pev->absmax.z += 1;
}
void CBaseEntity::SetObjectCollisionBox( void )
{
::SetObjectCollisionBox( pev );
}
int CBaseEntity :: Intersects( CBaseEntity *pOther )
int CBaseEntity :: Intersects( CBaseEntity *pOther )
{
if ( pOther->pev->absmin.x > pev->absmax.x ||
pOther->pev->absmin.y > pev->absmax.y ||
@ -737,7 +716,7 @@ int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState )
}
int CBaseEntity :: DamageDecal( int bitsDamageType )
int CBaseEntity :: DamageDecal( int bitsDamageType )
{
if ( pev->rendermode == kRenderTransAlpha )
return -1;
@ -748,8 +727,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 +747,3 @@ CBaseEntity * CBaseEntity::Create( char *szName, const Vector &vecOrigin, const
DispatchSpawn( pEntity->edict() );
return pEntity;
}

View File

@ -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)
@ -324,7 +316,6 @@ void CController :: HandleAnimEvent( MonsterEvent_t *pEvent )
m_iBall[1] = 0;
}
break;
case CONTROLLER_AE_SMALL_SHOOT:
{
AttackSound( );
@ -399,7 +390,6 @@ void CController :: Precache()
// AI Schedules Specific to this monster
//=========================================================
// Chase enemy schedule
Task_t tlControllerChaseEnemy[] =
{
@ -420,8 +410,6 @@ Schedule_t slControllerChaseEnemy[] =
},
};
Task_t tlControllerStrafe[] =
{
{ TASK_WAIT, (float)0.2 },
@ -441,7 +429,6 @@ Schedule_t slControllerStrafe[] =
},
};
Task_t tlControllerTakeCover[] =
{
{ TASK_WAIT, (float)0.2 },
@ -461,7 +448,6 @@ Schedule_t slControllerTakeCover[] =
},
};
Task_t tlControllerFail[] =
{
{ TASK_STOP_MOVING, 0 },
@ -481,8 +467,6 @@ Schedule_t slControllerFail[] =
},
};
DEFINE_CUSTOM_SCHEDULES( CController )
{
slControllerChaseEnemy,
@ -491,9 +475,7 @@ DEFINE_CUSTOM_SCHEDULES( CController )
slControllerFail,
};
IMPLEMENT_CUSTOM_SCHEDULES( CController, CSquadMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CController, CSquadMonster )
//=========================================================
// StartTask
@ -547,7 +529,6 @@ void CController :: StartTask ( Task_t *pTask )
}
}
Vector Intersect( Vector vecSrc, Vector vecDst, Vector vecMove, float flSpeed )
{
Vector vecTo = vecDst - vecSrc;
@ -585,7 +566,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,7 +601,6 @@ int CController::LookupFloat( )
}
}
//=========================================================
// RunTask
//=========================================================
@ -720,7 +699,6 @@ void CController :: RunTask ( Task_t *pTask )
}
}
//=========================================================
// GetSchedule - Decides which type of schedule best suits
// the monster's current state and conditions. Then calls
@ -756,8 +734,6 @@ Schedule_t *CController :: GetSchedule ( void )
return CSquadMonster :: GetSchedule();
}
//=========================================================
//=========================================================
Schedule_t* CController :: GetScheduleOfType ( int Type )
@ -781,10 +757,6 @@ Schedule_t* CController :: GetScheduleOfType ( int Type )
return CBaseMonster :: GetScheduleOfType( Type );
}
//=========================================================
// CheckRangeAttack1 - shoot a bigass energy ball out of their head
//
@ -798,7 +770,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 )
@ -808,13 +779,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 );
@ -830,8 +799,6 @@ void CController :: SetActivity ( Activity NewActivity )
}
}
//=========================================================
// RunAI
//=========================================================
@ -882,7 +849,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 )
@ -890,8 +856,8 @@ void CController::Stop( void )
m_IdealActivity = GetStoppedActivity();
}
#define DIST_TO_CHECK 200
void CController :: Move ( float flInterval )
{
float flWaypointDist;
@ -928,7 +894,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;
@ -994,7 +959,7 @@ void CController :: Move ( float flInterval )
{
// Wait for a second
m_flMoveWaitFinished = gpGlobals->time + m_moveWaitTime;
// ALERT( at_aiconsole, "Move %s!!!\n", STRING( pBlocker->pev->classname ) );
//ALERT( at_aiconsole, "Move %s!!!\n", STRING( pBlocker->pev->classname ) );
return;
}
}
@ -1008,7 +973,7 @@ void CController :: Move ( float flInterval )
}
else
{
ALERT ( at_aiconsole, "Couldn't Triangulate\n" );
ALERT ( at_aiconsole, "Couldn't Triangulate\n" );
Stop();
if ( m_moveWaitTime > 0 )
{
@ -1072,8 +1037,6 @@ void CController :: Move ( float flInterval )
}
}
BOOL CController:: ShouldAdvanceRoute( float flWaypointDist )
{
if ( flWaypointDist <= 32 )
@ -1084,7 +1047,6 @@ BOOL CController:: ShouldAdvanceRoute( float flWaypointDist )
return FALSE;
}
int CController :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist )
{
TraceResult tr;
@ -1110,7 +1072,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 )
@ -1123,13 +1084,9 @@ 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 );
UTIL_MoveToOrigin ( ENT(pev), pev->origin + m_velocity, m_velocity.Length() * flInterval, MOVE_STRAFE );
}
//=========================================================
// Controller bouncy ball attack
//=========================================================
@ -1147,9 +1104,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 )
{
@ -1180,7 +1136,6 @@ void CControllerHeadBall :: Spawn( void )
pev->dmgtime = gpGlobals->time;
}
void CControllerHeadBall :: Precache( void )
{
PRECACHE_MODEL("sprites/xspark1.spr");
@ -1188,7 +1143,6 @@ void CControllerHeadBall :: Precache( void )
PRECACHE_SOUND("weapons/electro4.wav");
}
void CControllerHeadBall :: HuntThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -1260,16 +1214,14 @@ void CControllerHeadBall :: HuntThink( void )
pev->nextthink = gpGlobals->time + 0.3;
}
// Crawl( );
//Crawl( );
}
void CControllerHeadBall :: DieThink( void )
{
UTIL_Remove( this );
}
void CControllerHeadBall :: MovetoTarget( Vector vecTarget )
{
// accelerate
@ -1288,8 +1240,6 @@ void CControllerHeadBall :: MovetoTarget( Vector vecTarget )
pev->velocity = m_vecIdeal;
}
void CControllerHeadBall :: Crawl( void )
{
@ -1316,7 +1266,6 @@ void CControllerHeadBall :: Crawl( void )
MESSAGE_END();
}
void CControllerHeadBall::BounceTouch( CBaseEntity *pOther )
{
Vector vecDir = m_vecIdeal.Normalize( );
@ -1330,9 +1279,6 @@ void CControllerHeadBall::BounceTouch( CBaseEntity *pOther )
m_vecIdeal = vecDir * m_vecIdeal.Length();
}
class CControllerZapBall : public CBaseMonster
{
void Spawn( void );
@ -1342,8 +1288,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 )
{
@ -1371,7 +1317,6 @@ void CControllerZapBall :: Spawn( void )
pev->nextthink = gpGlobals->time + 0.1;
}
void CControllerZapBall :: Precache( void )
{
PRECACHE_MODEL("sprites/xspark4.spr");
@ -1379,7 +1324,6 @@ void CControllerZapBall :: Precache( void )
// PRECACHE_SOUND("weapons/electro4.wav");
}
void CControllerZapBall :: AnimateThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -1393,7 +1337,6 @@ void CControllerZapBall :: AnimateThink( void )
}
}
void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
{
if (pOther->pev->takedamage)
@ -1420,7 +1363,4 @@ void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
UTIL_Remove( this );
}
#endif // !OEM && !HLDEMO
#endif //!OEM && !HLDEMO

View File

@ -247,10 +247,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( )
{

View File

@ -26,9 +26,7 @@
#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 {
CROWBAR_IDLE = 0,

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
#endif //DECALS_H

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)
@ -76,8 +74,7 @@ public:
BYTE m_bUnlockedSentence;
};
TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
{
DEFINE_FIELD( CBaseDoor, m_bHealthValue, FIELD_CHARACTER ),
DEFINE_FIELD( CBaseDoor, m_bMoveSnd, FIELD_CHARACTER ),
@ -90,8 +87,7 @@ TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
};
IMPLEMENT_SAVERESTORE( CBaseDoor, CBaseToggle );
IMPLEMENT_SAVERESTORE( CBaseDoor, CBaseToggle )
#define DOOR_SENTENCEWAIT 6
#define DOOR_SOUNDWAIT 3
@ -269,12 +265,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 +277,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 +299,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 +322,6 @@ void CBaseDoor::Spawn( )
SetTouch( &CBaseDoor::DoorTouch );
}
void CBaseDoor :: SetToggleState( int state )
{
if ( state == TS_AT_TOP )
@ -332,12 +330,11 @@ void CBaseDoor :: SetToggleState( int state )
UTIL_SetOrigin( pev, m_vecPosition1 );
}
void CBaseDoor::Precache( void )
{
char *pszSound;
// set the door's "in-motion" sound
// set the door's "in-motion" sound
switch (m_bMoveSnd)
{
case 0:
@ -388,7 +385,7 @@ void CBaseDoor::Precache( void )
break;
}
// set the door's 'reached destination' stop sound
// set the door's 'reached destination' stop sound
switch (m_bStopSnd)
{
case 0:
@ -432,7 +429,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,7 +444,6 @@ 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
@ -512,7 +507,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,15 +527,17 @@ 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)
// VARS( m_eoActivator )->health += m_bHealthValue;
{
// give health if player opened the door (medikit)
//VARS( m_eoActivator )->health += m_bHealthValue;
m_hActivator->TakeHealth( m_bHealthValue, DMG_GENERIC );
@ -592,7 +588,7 @@ void CBaseDoor::DoorGoUp( void )
angles.x = 0;
angles.z = 0;
UTIL_MakeVectors (angles);
// Vector vnext = (pevToucher->origin + (pevToucher->velocity * 10)) - pev->origin;
//Vector vnext = (pevToucher->origin + (pevToucher->velocity * 10)) - pev->origin;
UTIL_MakeVectors ( pevActivator->angles );
Vector vnext = (pevActivator->origin + (gpGlobals->v_forward * 10)) - pev->origin;
if ( (vec.x*vnext.y - vec.y*vnext.x) < 0 )
@ -605,7 +601,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 +641,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).
//
@ -654,8 +648,7 @@ void CBaseDoor::DoorGoDown( void )
{
if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
#ifdef DOOR_ASSERT
ASSERT(m_toggle_state == TS_AT_TOP);
#endif // DOOR_ASSERT
@ -684,7 +677,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
@ -700,8 +694,7 @@ void CBaseDoor::DoorHitBottom( void )
void CBaseDoor::Blocked( CBaseEntity *pOther )
{
edict_t *pentTarget = NULL;
CBaseDoor *pDoor = NULL;
CBaseDoor *pDoor = NULL;
// Hurt the blocker a little.
if ( pev->dmg )
@ -770,7 +763,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 +801,7 @@ button or trigger field activates the door.
3) stone chain
4) screechy metal
*/
class CRotDoor : public CBaseDoor
{
public:
@ -816,8 +809,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 )
{
@ -829,7 +821,7 @@ void CRotDoor::Spawn( void )
if ( FBitSet (pev->spawnflags, SF_DOOR_ROTATE_BACKWARDS) )
pev->movedir = pev->movedir * -1;
//m_flWait = 2; who the hell did this? (sjb)
//m_flWait = 2; who the hell did this? (sjb)
m_vecAngle1 = pev->angles;
m_vecAngle2 = pev->angles + pev->movedir * m_flMoveDistance;
@ -847,10 +839,11 @@ void CRotDoor::Spawn( void )
if (pev->speed == 0)
pev->speed = 100;
// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
// but spawn in the open position
// 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 +861,6 @@ void CRotDoor::Spawn( void )
SetTouch( &CBaseDoor::DoorTouch );
}
void CRotDoor :: SetToggleState( int state )
{
if ( state == TS_AT_TOP )
@ -879,7 +871,6 @@ void CRotDoor :: SetToggleState( int state )
UTIL_SetOrigin( pev, pev->origin );
}
class CMomentaryDoor : public CBaseToggle
{
public:
@ -899,7 +890,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 +898,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,8 +933,7 @@ void CMomentaryDoor::Spawn( void )
void CMomentaryDoor::Precache( void )
{
// set the door's "in-motion" sound
// set the door's "in-motion" sound
switch (m_bMoveSnd)
{
case 0:
@ -986,7 +976,7 @@ void CMomentaryDoor::Precache( void )
break;
}
// set the door's 'reached destination' stop sound
// set the door's 'reached destination' stop sound
switch (m_bStopSnd)
{
case 0:
@ -1045,7 +1035,7 @@ void CMomentaryDoor::KeyValue( KeyValueData *pkvd )
}
else if (FStrEq(pkvd->szKeyName, "healthvalue"))
{
// m_bHealthValue = atof(pkvd->szValue);
//m_bHealthValue = atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else

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,19 +52,18 @@ public:
int m_state;
};
LINK_ENTITY_TO_CLASS( env_bubbles, CBubbling );
LINK_ENTITY_TO_CLASS( env_bubbles, CBubbling )
TYPEDESCRIPTION CBubbling::m_SaveData[] =
TYPEDESCRIPTION CBubbling::m_SaveData[] =
{
DEFINE_FIELD( CBubbling, m_density, FIELD_INTEGER ),
DEFINE_FIELD( CBubbling, m_frequency, FIELD_INTEGER ),
DEFINE_FIELD( CBubbling, m_state, FIELD_INTEGER ),
// Let spawn restore this!
// DEFINE_FIELD( CBubbling, m_bubbleModel, FIELD_INTEGER ),
//DEFINE_FIELD( CBubbling, m_bubbleModel, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CBubbling, CBaseEntity );
IMPLEMENT_SAVERESTORE( CBubbling, CBaseEntity )
#define SF_BUBBLES_STARTOFF 0x0001
@ -100,7 +98,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 +115,6 @@ void CBubbling::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
}
}
void CBubbling::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "density"))
@ -140,7 +136,6 @@ void CBubbling::KeyValue( KeyValueData *pkvd )
CBaseEntity::KeyValue( pkvd );
}
void CBubbling::FizzThink( void )
{
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, VecBModelOrigin(pev) );
@ -162,7 +157,7 @@ void CBubbling::FizzThink( void )
//
// --------------------------------------------------
LINK_ENTITY_TO_CLASS( beam, CBeam );
LINK_ENTITY_TO_CLASS( beam, CBeam )
void CBeam::Spawn( void )
{
@ -190,7 +185,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 +196,6 @@ const Vector &CBeam::GetStartPos( void )
return pev->origin;
}
const Vector &CBeam::GetEndPos( void )
{
int type = GetType();
@ -217,7 +210,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 +221,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 +237,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 +247,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 +257,6 @@ void CBeam::HoseInit( const Vector &start, const Vector &direction )
RelinkBeam();
}
void CBeam::PointEntInit( const Vector &start, int endIndex )
{
SetType( BEAM_ENTPOINT );
@ -289,7 +277,6 @@ void CBeam::EntsInit( int startIndex, int endIndex )
RelinkBeam();
}
void CBeam::RelinkBeam( void )
{
const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
@ -321,7 +308,6 @@ void CBeam::SetObjectCollisionBox( void )
}
#endif
void CBeam::TriggerTouch( CBaseEntity *pOther )
{
if ( pOther->pev->flags & (FL_CLIENT | FL_MONSTER) )
@ -335,7 +321,6 @@ void CBeam::TriggerTouch( CBaseEntity *pOther )
}
}
CBaseEntity *CBeam::RandomTargetname( const char *szName )
{
int total = 0;
@ -351,7 +336,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 +351,6 @@ void CBeam::DoSparks( const Vector &start, const Vector &end )
}
}
class CLightning : public CBeam
{
public:
@ -413,8 +396,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 +405,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 +417,6 @@ void CTripBeam::Spawn( void )
}
#endif
TYPEDESCRIPTION CLightning::m_SaveData[] =
{
DEFINE_FIELD( CLightning, m_active, FIELD_INTEGER ),
@ -452,8 +434,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 +491,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 +558,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 +581,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 +601,6 @@ void CLightning::StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
SetUse( NULL );
}
int IsPointEntity( CBaseEntity *pEnt )
{
if ( !pEnt->pev->modelindex )
@ -635,7 +611,6 @@ int IsPointEntity( CBaseEntity *pEnt )
return 0;
}
void CLightning::StrikeThink( void )
{
if ( m_life != 0 )
@ -741,7 +716,6 @@ void CLightning::StrikeThink( void )
}
}
void CBeam::BeamDamage( TraceResult *ptr )
{
RelinkBeam();
@ -763,7 +737,6 @@ void CBeam::BeamDamage( TraceResult *ptr )
pev->dmgtime = gpGlobals->time;
}
void CLightning::DamageThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -772,8 +745,6 @@ void CLightning::DamageThink( void )
BeamDamage( &tr );
}
void CLightning::Zap( const Vector &vecSrc, const Vector &vecDest )
{
#if 1
@ -856,7 +827,6 @@ void CLightning::RandomArea( void )
}
}
void CLightning::RandomPoint( Vector &vecSrc )
{
int iLoops = 0;
@ -879,8 +849,6 @@ void CLightning::RandomPoint( Vector &vecSrc )
}
}
void CLightning::BeamUpdateVars( void )
{
int beamType;
@ -945,8 +913,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 +922,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 +960,6 @@ void CLaser::Precache( void )
PRECACHE_MODEL( (char *)STRING(m_iszSpriteName) );
}
void CLaser::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "LaserTarget"))
@ -1040,7 +1006,6 @@ void CLaser::KeyValue( KeyValueData *pkvd )
CBeam::KeyValue( pkvd );
}
int CLaser::IsOn( void )
{
if (pev->effects & EF_NODRAW)
@ -1048,7 +1013,6 @@ int CLaser::IsOn( void )
return 1;
}
void CLaser::TurnOff( void )
{
pev->effects |= EF_NODRAW;
@ -1057,7 +1021,6 @@ void CLaser::TurnOff( void )
m_pSprite->TurnOff();
}
void CLaser::TurnOn( void )
{
pev->effects &= ~EF_NODRAW;
@ -1067,7 +1030,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 +1046,6 @@ void CLaser::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp
}
}
void CLaser::FireAtPoint( TraceResult &tr )
{
SetEndPos( tr.vecEndPos );
@ -1109,8 +1070,6 @@ void CLaser::StrikeThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
class CGlow : public CPointEntity
{
public:
@ -1125,7 +1084,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 +1092,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 +1111,6 @@ void CGlow::Spawn( void )
m_lastTime = gpGlobals->time;
}
void CGlow::Think( void )
{
Animate( pev->framerate * (gpGlobals->time - m_lastTime) );
@ -1161,15 +1119,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 +1133,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 +1159,6 @@ void CSprite::Spawn( void )
}
}
void CSprite::Precache( void )
{
PRECACHE_MODEL( (char *)STRING(pev->model) );
@ -1219,7 +1174,6 @@ void CSprite::Precache( void )
}
}
void CSprite::SpriteInit( const char *pSpriteName, const Vector &origin )
{
pev->model = MAKE_STRING(pSpriteName);
@ -1240,7 +1194,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 +1223,6 @@ void CSprite::Expand( float scaleSpeed, float fadeSpeed )
m_lastTime = gpGlobals->time;
}
void CSprite::ExpandThink( void )
{
float frametime = gpGlobals->time - m_lastTime;
@ -1288,7 +1240,6 @@ void CSprite::ExpandThink( void )
}
}
void CSprite::Animate( float frames )
{
pev->frame += frames;
@ -1306,14 +1257,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 +1275,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 +1291,6 @@ void CSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
}
}
class CGibShooter : public CBaseDelay
{
public:
@ -1379,9 +1326,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 +1341,6 @@ void CGibShooter :: Precache ( void )
}
}
void CGibShooter::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "m_iGibs"))
@ -1451,7 +1396,6 @@ void CGibShooter::Spawn( void )
pev->body = MODEL_FRAMES( m_iGibModelIndex );
}
CGib *CGibShooter :: CreateGib ( void )
{
if ( CVAR_GET_FLOAT("violence_hgibs") == 0 )
@ -1471,7 +1415,6 @@ CGib *CGibShooter :: CreateGib ( void )
return pGib;
}
void CGibShooter :: ShootThink ( void )
{
pev->nextthink = gpGlobals->time + m_flDelay;
@ -1522,7 +1465,6 @@ void CGibShooter :: ShootThink ( void )
}
}
class CEnvShooter : public CGibShooter
{
void Precache( void );
@ -1531,7 +1473,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 )
{
@ -1574,14 +1516,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 +1547,6 @@ CGib *CEnvShooter :: CreateGib ( void )
return pGib;
}
class CTestEffect : public CBaseDelay
{
public:
@ -1626,8 +1563,7 @@ public:
float m_flStartTime;
};
LINK_ENTITY_TO_CLASS( test_effect, CTestEffect );
LINK_ENTITY_TO_CLASS( test_effect, CTestEffect )
void CTestEffect::Spawn( void )
{
@ -1664,7 +1600,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 +1640,6 @@ void CTestEffect::TestThink( void )
}
}
void CTestEffect::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
SetThink( &CTestEffect::TestThink );
@ -1713,8 +1647,6 @@ void CTestEffect::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
m_flStartTime = gpGlobals->time;
}
// Blood effects
class CBlood : public CPointEntity
{
@ -1735,9 +1667,7 @@ public:
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 +1683,6 @@ void CBlood::Spawn( void )
SetMovedir( pev );
}
void CBlood::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "color"))
@ -1780,7 +1709,6 @@ void CBlood::KeyValue( KeyValueData *pkvd )
CPointEntity::KeyValue( pkvd );
}
Vector CBlood::Direction( void )
{
if ( pev->spawnflags & SF_BLOOD_RANDOM )
@ -1789,7 +1717,6 @@ Vector CBlood::Direction( void )
return pev->movedir;
}
Vector CBlood::BloodPosition( CBaseEntity *pActivator )
{
if ( pev->spawnflags & SF_BLOOD_PLAYER )
@ -1809,7 +1736,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 +1755,6 @@ void CBlood::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp
}
}
// Screen shake
class CShake : public CPointEntity
{
@ -1851,7 +1775,7 @@ public:
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 +1800,6 @@ void CShake::Spawn( void )
pev->dmg = 0;
}
void CShake::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "amplitude"))
@ -1903,7 +1826,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() );
@ -1925,7 +1847,7 @@ public:
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 +1863,6 @@ void CFade::Spawn( void )
pev->frame = 0;
}
void CFade::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "duration"))
@ -1958,7 +1879,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 +1903,6 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
SUB_UseTargets( this, USE_TOGGLE, 0 );
}
class CMessage : public CPointEntity
{
public:
@ -1994,8 +1913,7 @@ public:
private:
};
LINK_ENTITY_TO_CLASS( env_message, CMessage );
LINK_ENTITY_TO_CLASS( env_message, CMessage )
void CMessage::Spawn( void )
{
@ -2030,7 +1948,6 @@ void CMessage::Spawn( void )
pev->scale = 1.0;
}
void CMessage::Precache( void )
{
if ( pev->noise )
@ -2058,7 +1975,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 +2002,6 @@ void CMessage::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useT
SUB_UseTargets( this, USE_TOGGLE, 0 );
}
//=========================================================
// FunnelEffect
//=========================================================
@ -2106,7 +2020,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 +2040,6 @@ void CEnvFunnel::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
WRITE_SHORT( 0 );
}
MESSAGE_END();
SetThink( &CBaseEntity::SUB_Remove );
@ -2159,7 +2072,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 +2130,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 +2163,6 @@ void CItemSoda::CanTouch ( CBaseEntity *pOther )
}
// spoit sound here
pOther->TakeHealth( 1, DMG_GENERIC );// a bit of health.
if ( !FNullEnt( pev->owner ) )

View File

@ -49,7 +49,7 @@ enum egon_e {
EGON_HOLSTER
};
LINK_ENTITY_TO_CLASS( weapon_egon, CEgon );
LINK_ENTITY_TO_CLASS( weapon_egon, CEgon )
void CEgon::Spawn( )
{
@ -62,7 +62,6 @@ void CEgon::Spawn( )
FallInit();// get ready to fall down.
}
void CEgon::Precache( void )
{
PRECACHE_MODEL("models/w_egon.mdl");
@ -277,10 +276,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
m_pSprite->pev->effects |= EF_NODRAW;
}
}
#endif
float timedist;
switch ( m_fireMode )
@ -408,14 +404,11 @@ void CEgon::UpdateEffect( const Vector &startPoint, const Vector &endPoint, floa
m_pSprite->pev->frame = 0;
m_pNoise->SetStartPos( endPoint );
#endif
}
void CEgon::CreateEffect( void )
{
#ifndef CLIENT_DLL
DestroyEffect();
@ -458,10 +451,8 @@ void CEgon::CreateEffect( void )
m_pNoise->SetNoise( 2 );
}
#endif
}
void CEgon::DestroyEffect( void )
{
@ -485,11 +476,8 @@ void CEgon::DestroyEffect( void )
m_pSprite = NULL;
}
#endif
}
void CEgon::WeaponIdle( void )
{
ResetEmptySound( );
@ -563,6 +551,6 @@ class CEgonAmmo : public CBasePlayerAmmo
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( ammo_egonclip, CEgonAmmo );
LINK_ENTITY_TO_CLASS( ammo_egonclip, CEgonAmmo )
#endif
#endif

View File

@ -34,7 +34,7 @@ class CShower : public CBaseEntity
int ObjectCaps( void ) { return FCAP_DONT_SAVE; }
};
LINK_ENTITY_TO_CLASS( spark_shower, CShower );
LINK_ENTITY_TO_CLASS( spark_shower, CShower )
void CShower::Spawn( void )
{
@ -57,7 +57,6 @@ void CShower::Spawn( void )
pev->angles = g_vecZero;
}
void CShower::Think( void )
{
UTIL_Sparks( pev->origin );
@ -103,8 +102,8 @@ TYPEDESCRIPTION CEnvExplosion::m_SaveData[] =
DEFINE_FIELD( CEnvExplosion, m_spriteScale, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CEnvExplosion, CBaseMonster );
LINK_ENTITY_TO_CLASS( env_explosion, CEnvExplosion );
IMPLEMENT_SAVERESTORE( CEnvExplosion, CBaseMonster )
LINK_ENTITY_TO_CLASS( env_explosion, CEnvExplosion )
void CEnvExplosion::KeyValue( KeyValueData *pkvd )
{
@ -253,7 +252,6 @@ void CEnvExplosion::Smoke( void )
}
}
// HACKHACK -- create one of these and fake a keyvalue to get the right explosion setup
void ExplosionCreate( const Vector &center, const Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage )
{

View File

@ -12,6 +12,7 @@
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -22,7 +23,6 @@
#define FLYING_AE_FLAP (8)
#define FLYING_AE_FLAPSOUND (9)
extern DLL_GLOBAL edict_t *g_pBodyQueueHead;
int CFlyingMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist )
@ -57,13 +57,11 @@ int CFlyingMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vec
return LOCALMOVE_VALID;
}
BOOL CFlyingMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex )
{
return CBaseMonster::FTriangulate( vecStart, vecEnd, flDist, pTargetEnt, pApex );
}
Activity CFlyingMonster :: GetStoppedActivity( void )
{
if ( pev->movetype != MOVETYPE_FLY ) // UNDONE: Ground idle here, IDLE may be something else
@ -72,7 +70,6 @@ Activity CFlyingMonster :: GetStoppedActivity( void )
return ACT_HOVER;
}
void CFlyingMonster :: Stop( void )
{
Activity stopped = GetStoppedActivity();
@ -86,7 +83,6 @@ void CFlyingMonster :: Stop( void )
m_vecTravel = g_vecZero;
}
float CFlyingMonster :: ChangeYaw( int speed )
{
if ( pev->movetype == MOVETYPE_FLY )
@ -106,7 +102,6 @@ float CFlyingMonster :: ChangeYaw( int speed )
return CBaseMonster::ChangeYaw( speed );
}
void CFlyingMonster :: Killed( entvars_t *pevAttacker, int iGib )
{
pev->movetype = MOVETYPE_STEP;
@ -116,7 +111,6 @@ void CFlyingMonster :: Killed( entvars_t *pevAttacker, int iGib )
CBaseMonster::Killed( pevAttacker, iGib );
}
void CFlyingMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
@ -124,19 +118,16 @@ void CFlyingMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
case FLYING_AE_FLAP:
m_flightSpeed = 400;
break;
case FLYING_AE_FLAPSOUND:
if ( m_pFlapSound )
EMIT_SOUND( edict(), CHAN_BODY, m_pFlapSound, 1, ATTN_NORM );
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
void CFlyingMonster :: Move( float flInterval )
{
if ( pev->movetype == MOVETYPE_FLY )
@ -144,7 +135,6 @@ void CFlyingMonster :: Move( float flInterval )
CBaseMonster::Move( flInterval );
}
BOOL CFlyingMonster:: ShouldAdvanceRoute( float flWaypointDist )
{
// Get true 3D distance to the goal so we actually reach the correct height
@ -157,7 +147,6 @@ BOOL CFlyingMonster:: ShouldAdvanceRoute( float flWaypointDist )
return FALSE;
}
void CFlyingMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval )
{
if ( pev->movetype == MOVETYPE_FLY )
@ -180,7 +169,7 @@ void CFlyingMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir,
}
else
m_flightSpeed = UTIL_Approach( 20, m_flightSpeed, 300 * gpGlobals->frametime );
if ( CheckLocalMove ( pev->origin, vecMove, pTargetEnt, NULL ) )
{
m_vecTravel = (vecMove - pev->origin);
@ -198,7 +187,6 @@ void CFlyingMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir,
CBaseMonster::MoveExecute( pTargetEnt, vecDir, flInterval );
}
float CFlyingMonster::CeilingZ( const Vector &position )
{
TraceResult tr;
@ -278,4 +266,3 @@ float CFlyingMonster::FloorZ( const Vector &position )
return down.z;
}

View File

@ -37,8 +37,7 @@ public:
float CeilingZ( const Vector &position );
float FloorZ( const Vector &position );
BOOL ProbeZ( const Vector &position, const Vector &probe, float *pFraction );
// UNDONE: Save/restore this stuff!!!
protected:
Vector m_vecTravel; // Current direction
@ -47,7 +46,4 @@ protected:
float m_momentum; // Weight for desired vs. momentum velocity
const char *m_pFlapSound;
};
#endif //FLYINGMONSTER_H
#endif //FLYINGMONSTER_H

View File

@ -93,7 +93,7 @@ void CBreakable::KeyValue( KeyValueData* pkvd )
}
else if (FStrEq(pkvd->szKeyName, "shards"))
{
// m_iShards = atof(pkvd->szValue);
//m_iShards = atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "gibmodel") )
@ -123,7 +123,8 @@ void CBreakable::KeyValue( KeyValueData* pkvd )
//
// func_breakable - bmodel that breaks into pieces after taking damage
//
LINK_ENTITY_TO_CLASS( func_breakable, CBreakable );
LINK_ENTITY_TO_CLASS( func_breakable, CBreakable )
TYPEDESCRIPTION CBreakable::m_SaveData[] =
{
DEFINE_FIELD( CBreakable, m_Material, FIELD_INTEGER ),
@ -139,7 +140,7 @@ TYPEDESCRIPTION CBreakable::m_SaveData[] =
// Explosion magnitude is stored in pev->impulse
};
IMPLEMENT_SAVERESTORE( CBreakable, CBaseEntity );
IMPLEMENT_SAVERESTORE( CBreakable, CBaseEntity )
void CBreakable::Spawn( void )
{
@ -151,8 +152,8 @@ void CBreakable::Spawn( void )
pev->takedamage = DAMAGE_YES;
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
m_angle = pev->angles.y;
pev->movetype = MOVETYPE_PUSH;
m_angle = pev->angles.y;
pev->angles.y = 0;
// HACK: matGlass can receive decals, we need the client to know about this
@ -173,7 +174,6 @@ void CBreakable::Spawn( void )
pev->flags |= FL_WORLDBRUSH;
}
const char *CBreakable::pSoundsWood[] =
{
"debris/wood1.wav",
@ -205,7 +205,6 @@ const char *CBreakable::pSoundsConcrete[] =
"debris/concrete3.wav",
};
const char *CBreakable::pSoundsGlass[] =
{
"debris/glass1.wav",
@ -217,7 +216,7 @@ const char **CBreakable::MaterialSoundList( Materials precacheMaterial, int &sou
{
const char **pSoundList = NULL;
switch ( precacheMaterial )
switch ( precacheMaterial )
{
case matWood:
pSoundList = pSoundsWood;
@ -280,12 +279,11 @@ void CBreakable::MaterialSoundRandom( edict_t *pEdict, Materials soundMaterial,
EMIT_SOUND( pEdict, CHAN_BODY, pSoundList[ RANDOM_LONG(0,soundCount-1) ], volume, 1.0 );
}
void CBreakable::Precache( void )
{
const char *pGibName = NULL;
switch (m_Material)
switch (m_Material)
{
case matWood:
pGibName = "models/woodgibs.mdl";
@ -390,21 +388,18 @@ void CBreakable::DamageSound( void )
rgpsz[2] = "debris/glass3.wav";
i = 3;
break;
case matWood:
rgpsz[0] = "debris/wood1.wav";
rgpsz[1] = "debris/wood2.wav";
rgpsz[2] = "debris/wood3.wav";
i = 3;
break;
case matMetal:
rgpsz[0] = "debris/metal1.wav";
rgpsz[1] = "debris/metal3.wav";
rgpsz[2] = "debris/metal2.wav";
i = 2;
break;
case matFlesh:
rgpsz[0] = "debris/flesh1.wav";
rgpsz[1] = "debris/flesh2.wav";
@ -414,7 +409,6 @@ void CBreakable::DamageSound( void )
rgpsz[5] = "debris/flesh7.wav";
i = 6;
break;
case matRocks:
case matCinderBlock:
rgpsz[0] = "debris/concrete1.wav";
@ -422,7 +416,6 @@ void CBreakable::DamageSound( void )
rgpsz[2] = "debris/concrete3.wav";
i = 3;
break;
case matCeilingTile:
// UNDONE: no ceiling tile shard sound yet
i = 0;
@ -445,7 +438,8 @@ void CBreakable::BreakTouch( CBaseEntity *pOther )
}
if ( FBitSet ( pev->spawnflags, SF_BREAK_TOUCH ) )
{// can be broken when run into
{
// can be broken when run into
flDamage = pevToucher->velocity.Length() * 0.01;
if (flDamage >= pev->health)
@ -459,26 +453,24 @@ void CBreakable::BreakTouch( CBaseEntity *pOther )
}
if ( FBitSet ( pev->spawnflags, SF_BREAK_PRESSURE ) && pevToucher->absmin.z >= pev->maxs.z - 2 )
{// can be broken when stood upon
{
// can be broken when stood upon
// play creaking sound here.
DamageSound();
SetThink( &CBreakable::Die );
SetTouch( NULL );
if ( m_flDelay == 0 )
{// !!!BUGBUG - why doesn't zero delay work?
{
// !!!BUGBUG - why doesn't zero delay work?
m_flDelay = 0.1;
}
pev->nextthink = pev->ltime + m_flDelay;
}
}
//
// Smash the our breakable object
//
@ -515,8 +507,7 @@ void CBreakable::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break;
}
}
break;
break;
case matUnbreakableGlass:
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT(0.5,1.5) );
break;
@ -565,10 +556,10 @@ int CBreakable :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, f
if ( bitsDamageType & DMG_POISON )
flDamage *= 0.1;
// this global is still used for glass and other non-monster killables, along with decals.
// this global is still used for glass and other non-monster killables, along with decals.
g_vecAttackDir = vecTemp.Normalize();
// do the damage
// do the damage
pev->health -= flDamage;
if (pev->health <= 0)
{
@ -579,7 +570,6 @@ int CBreakable :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, f
// Make a shard noise each time func breakable is hit.
// Don't play shard noise if cbreakable actually died.
DamageSound();
return 1;
@ -608,7 +598,6 @@ void CBreakable::Die( void )
if (fvol > 1.0)
fvol = 1.0;
switch (m_Material)
{
case matGlass:
@ -621,7 +610,6 @@ void CBreakable::Die( void )
}
cFlag = BREAK_GLASS;
break;
case matWood:
switch ( RANDOM_LONG(0,1) )
{
@ -632,7 +620,6 @@ void CBreakable::Die( void )
}
cFlag = BREAK_WOOD;
break;
case matComputer:
case matMetal:
switch ( RANDOM_LONG(0,1) )
@ -644,7 +631,6 @@ void CBreakable::Die( void )
}
cFlag = BREAK_METAL;
break;
case matFlesh:
switch ( RANDOM_LONG(0,1) )
{
@ -655,7 +641,6 @@ void CBreakable::Die( void )
}
cFlag = BREAK_FLESH;
break;
case matRocks:
case matCinderBlock:
switch ( RANDOM_LONG(0,1) )
@ -667,7 +652,6 @@ void CBreakable::Die( void )
}
cFlag = BREAK_CONCRETE;
break;
case matCeilingTile:
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustceiling.wav", fvol, ATTN_NORM, 0, pitch);
break;
@ -678,8 +662,7 @@ void CBreakable::Die( void )
default:
break;
}
if (m_Explosion == expDirected)
vecVelocity = g_vecAttackDir * 200;
else
@ -753,6 +736,7 @@ void CBreakable::Die( void )
pev->targetname = 0;
pev->solid = SOLID_NOT;
// Fire targets on break
SUB_UseTargets( NULL, USE_TOGGLE, 0 );
@ -761,22 +745,18 @@ void CBreakable::Die( void )
if ( m_iszSpawnObject )
CBaseEntity::Create( (char *)STRING(m_iszSpawnObject), VecBModelOrigin(pev), pev->angles, edict() );
if ( Explodable() )
{
ExplosionCreate( Center(), pev->angles, edict(), ExplosionMagnitude(), TRUE );
}
}
BOOL CBreakable :: IsBreakable( void )
{
return m_Material != matUnbreakableGlass;
}
int CBreakable :: DamageDecal( int bitsDamageType )
int CBreakable :: DamageDecal( int bitsDamageType )
{
if ( m_Material == matGlass )
return DECAL_GLASSBREAK1 + RANDOM_LONG(0,2);
@ -787,7 +767,6 @@ int CBreakable :: DamageDecal( int bitsDamageType )
return CBaseEntity::DamageDecal( bitsDamageType );
}
class CPushable : public CBreakable
{
public:
@ -798,17 +777,17 @@ public:
void KeyValue( KeyValueData *pkvd );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT StopSound( void );
// virtual void SetActivator( CBaseEntity *pActivator ) { m_pPusher = pActivator; }
//virtual void SetActivator( CBaseEntity *pActivator ) { m_pPusher = pActivator; }
virtual int ObjectCaps( void ) { return (CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_CONTINUOUS_USE; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
inline float MaxSpeed( void ) { return m_maxSpeed; }
// breakables use an overridden takedamage
virtual int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
static TYPEDESCRIPTION m_SaveData[];
static char *m_soundNames[3];
@ -817,19 +796,18 @@ public:
float m_soundTime;
};
TYPEDESCRIPTION CPushable::m_SaveData[] =
TYPEDESCRIPTION CPushable::m_SaveData[] =
{
DEFINE_FIELD( CPushable, m_maxSpeed, FIELD_FLOAT ),
DEFINE_FIELD( CPushable, m_soundTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CPushable, CBreakable );
IMPLEMENT_SAVERESTORE( CPushable, CBreakable )
LINK_ENTITY_TO_CLASS( func_pushable, CPushable );
LINK_ENTITY_TO_CLASS( func_pushable, CPushable )
char *CPushable :: m_soundNames[3] = { "debris/pushbox1.wav", "debris/pushbox2.wav", "debris/pushbox3.wav" };
void CPushable :: Spawn( void )
{
if ( pev->spawnflags & SF_PUSH_BREAKABLE )
@ -856,7 +834,6 @@ void CPushable :: Spawn( void )
m_soundTime = 0;
}
void CPushable :: Precache( void )
{
for ( int i = 0; i < 3; i++ )
@ -866,7 +843,6 @@ void CPushable :: Precache( void )
CBreakable::Precache( );
}
void CPushable :: KeyValue( KeyValueData *pkvd )
{
if ( FStrEq(pkvd->szKeyName, "size") )
@ -879,21 +855,17 @@ void CPushable :: KeyValue( KeyValueData *pkvd )
case 0: // Point
UTIL_SetSize(pev, Vector(-8, -8, -8), Vector(8, 8, 8));
break;
case 2: // Big Hull!?!? !!!BUGBUG Figure out what this hull really is
UTIL_SetSize(pev, VEC_DUCK_HULL_MIN*2, VEC_DUCK_HULL_MAX*2);
break;
case 3: // Player duck
UTIL_SetSize(pev, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX);
break;
default:
case 1: // Player
UTIL_SetSize(pev, VEC_HULL_MIN, VEC_HULL_MAX);
break;
}
}
else if ( FStrEq(pkvd->szKeyName, "buoyancy") )
{
@ -904,7 +876,6 @@ void CPushable :: KeyValue( KeyValueData *pkvd )
CBreakable::KeyValue( pkvd );
}
// Pull the func_pushable
void CPushable :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -919,7 +890,6 @@ void CPushable :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
Move( pActivator, 0 );
}
void CPushable :: Touch( CBaseEntity *pOther )
{
if ( FClassnameIs( pOther->pev, "worldspawn" ) )
@ -928,7 +898,6 @@ void CPushable :: Touch( CBaseEntity *pOther )
Move( pOther, 1 );
}
void CPushable :: Move( CBaseEntity *pOther, int push )
{
entvars_t* pevToucher = pOther->pev;
@ -990,8 +959,8 @@ void CPushable :: Move( CBaseEntity *pOther, int push )
{
m_lastSound = RANDOM_LONG(0,2);
EMIT_SOUND(ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound], 0.5, ATTN_NORM);
// SetThink( &StopSound );
// pev->nextthink = pev->ltime + 0.1;
//SetThink( &StopSound );
//pev->nextthink = pev->ltime + 0.1;
}
else
STOP_SOUND( ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound] );
@ -1015,4 +984,3 @@ int CPushable::TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, floa
return 1;
}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -21,7 +22,6 @@
#include "player.h"
#define SF_TANK_ACTIVE 0x0001
#define SF_TANK_PLAYER 0x0002
#define SF_TANK_HUMANS 0x0004
@ -35,7 +35,7 @@ enum TANKBULLET
TANK_BULLET_NONE = 0,
TANK_BULLET_9MM = 1,
TANK_BULLET_MP5 = 2,
TANK_BULLET_12MM = 3,
TANK_BULLET_12MM = 3
};
// Custom damage
@ -94,7 +94,6 @@ public:
void StopControl( void );
void ControllerPostFrame( void );
protected:
CBasePlayer* m_pController;
float m_flNextAttack;
@ -130,7 +129,6 @@ protected:
int m_iszMaster; // Master entity (game_team_master or multisource)
};
TYPEDESCRIPTION CFuncTank::m_SaveData[] =
{
DEFINE_FIELD( CFuncTank, m_yawCenter, FIELD_FLOAT ),
@ -161,7 +159,7 @@ TYPEDESCRIPTION CFuncTank::m_SaveData[] =
DEFINE_FIELD( CFuncTank, m_iszMaster, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CFuncTank, CBaseEntity );
IMPLEMENT_SAVERESTORE( CFuncTank, CBaseEntity )
static Vector gTankSpread[] =
{
@ -171,8 +169,8 @@ static Vector gTankSpread[] =
Vector( 0.1, 0.1, 0.1 ), // large cone
Vector( 0.25, 0.25, 0.25 ), // extra-large cone
};
#define MAX_FIRING_SPREADS ARRAYSIZE(gTankSpread)
#define MAX_FIRING_SPREADS ARRAYSIZE(gTankSpread)
void CFuncTank :: Spawn( void )
{
@ -198,7 +196,6 @@ void CFuncTank :: Spawn( void )
pev->oldorigin = pev->origin;
}
void CFuncTank :: Precache( void )
{
if ( m_iszSpriteSmoke )
@ -210,7 +207,6 @@ void CFuncTank :: Precache( void )
PRECACHE_SOUND( (char *)STRING(pev->noise) );
}
void CFuncTank :: KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "yawrate"))
@ -416,7 +412,6 @@ void CFuncTank :: ControllerPostFrame( void )
}
////////////// END NEW STUFF //////////////
void CFuncTank :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( pev->spawnflags & SF_TANK_CANCONTROL )
@ -451,14 +446,11 @@ void CFuncTank :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
}
}
edict_t *CFuncTank :: FindTarget( edict_t *pPlayer )
{
return pPlayer;
}
BOOL CFuncTank :: InRange( float range )
{
if ( range < m_minRange )
@ -469,7 +461,6 @@ BOOL CFuncTank :: InRange( float range )
return TRUE;
}
void CFuncTank :: Think( void )
{
pev->avelocity = g_vecZero;
@ -539,10 +530,9 @@ void CFuncTank::TrackTarget( void )
}
// Track sight origin
// !!! I'm not sure what i changed
// !!! I'm not sure what i changed
direction = m_sightOrigin - pev->origin;
// direction = m_sightOrigin - barrelEnd;
//direction = m_sightOrigin - barrelEnd;
angles = UTIL_VecToAngles( direction );
// Calculate the additional rotation to point the end of the barrel at the target (not the gun's center)
@ -623,7 +613,6 @@ void CFuncTank::TrackTarget( void )
m_fireLast = 0;
}
// If barrel is offset, add in additional rotation
void CFuncTank::AdjustAnglesForBarrel( Vector &angles, float distance )
{
@ -647,7 +636,6 @@ void CFuncTank::AdjustAnglesForBarrel( Vector &angles, float distance )
}
}
// Fire targets and spawn sprites
void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker )
{
@ -676,7 +664,6 @@ void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t
m_fireLast = gpGlobals->time;
}
void CFuncTank::TankTrace( const Vector &vecStart, const Vector &vecForward, const Vector &vecSpread, TraceResult &tr )
{
// get circular gaussian spread
@ -694,7 +681,6 @@ void CFuncTank::TankTrace( const Vector &vecStart, const Vector &vecForward, con
vecEnd = vecStart + vecDir * 4096;
UTIL_TraceLine( vecStart, vecEnd, dont_ignore_monsters, edict(), &tr );
}
void CFuncTank::StartRotSound( void )
{
@ -704,7 +690,6 @@ void CFuncTank::StartRotSound( void )
EMIT_SOUND( edict(), CHAN_STATIC, (char*)STRING(pev->noise), 0.85, ATTN_NORM);
}
void CFuncTank::StopRotSound( void )
{
if ( pev->spawnflags & SF_TANK_SOUNDON )
@ -717,7 +702,8 @@ class CFuncTankGun : public CFuncTank
public:
void Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker );
};
LINK_ENTITY_TO_CLASS( func_tank, CFuncTankGun );
LINK_ENTITY_TO_CLASS( func_tank, CFuncTankGun )
void CFuncTankGun::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker )
{
@ -759,8 +745,6 @@ void CFuncTankGun::Fire( const Vector &barrelEnd, const Vector &forward, entvars
CFuncTank::Fire( barrelEnd, forward, pevAttacker );
}
class CFuncTankLaser : public CFuncTank
{
public:
@ -778,7 +762,8 @@ private:
CLaser *m_pLaser;
float m_laserTime;
};
LINK_ENTITY_TO_CLASS( func_tanklaser, CFuncTankLaser );
LINK_ENTITY_TO_CLASS( func_tanklaser, CFuncTankLaser )
TYPEDESCRIPTION CFuncTankLaser::m_SaveData[] =
{
@ -786,7 +771,7 @@ TYPEDESCRIPTION CFuncTankLaser::m_SaveData[] =
DEFINE_FIELD( CFuncTankLaser, m_laserTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CFuncTankLaser, CFuncTank );
IMPLEMENT_SAVERESTORE( CFuncTankLaser, CFuncTank )
void CFuncTankLaser::Activate( void )
{
@ -801,7 +786,6 @@ void CFuncTankLaser::Activate( void )
}
}
void CFuncTankLaser::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "laserentity"))
@ -813,7 +797,6 @@ void CFuncTankLaser::KeyValue( KeyValueData *pkvd )
CFuncTank::KeyValue( pkvd );
}
CLaser *CFuncTankLaser::GetLaser( void )
{
if ( m_pLaser )
@ -837,7 +820,6 @@ CLaser *CFuncTankLaser::GetLaser( void )
return m_pLaser;
}
void CFuncTankLaser::Think( void )
{
if ( m_pLaser && (gpGlobals->time > m_laserTime) )
@ -846,7 +828,6 @@ void CFuncTankLaser::Think( void )
CFuncTank::Think();
}
void CFuncTankLaser::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker )
{
int i;
@ -886,7 +867,8 @@ public:
void Precache( void );
void Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker );
};
LINK_ENTITY_TO_CLASS( func_tankrocket, CFuncTankRocket );
LINK_ENTITY_TO_CLASS( func_tankrocket, CFuncTankRocket )
void CFuncTankRocket::Precache( void )
{
@ -894,8 +876,6 @@ void CFuncTankRocket::Precache( void )
CFuncTank::Precache();
}
void CFuncTankRocket::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker )
{
int i;
@ -916,15 +896,14 @@ void CFuncTankRocket::Fire( const Vector &barrelEnd, const Vector &forward, entv
CFuncTank::Fire( barrelEnd, forward, pev );
}
class CFuncTankMortar : public CFuncTank
{
public:
void KeyValue( KeyValueData *pkvd );
void Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker );
};
LINK_ENTITY_TO_CLASS( func_tankmortar, CFuncTankMortar );
LINK_ENTITY_TO_CLASS( func_tankmortar, CFuncTankMortar );
void CFuncTankMortar::KeyValue( KeyValueData *pkvd )
{
@ -937,7 +916,6 @@ void CFuncTankMortar::KeyValue( KeyValueData *pkvd )
CFuncTank::KeyValue( pkvd );
}
void CFuncTankMortar::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker )
{
if ( m_fireLast != 0 )
@ -962,8 +940,6 @@ void CFuncTankMortar::Fire( const Vector &barrelEnd, const Vector &forward, entv
CFuncTank::Fire( barrelEnd, forward, pev );
}
//============================================================================
// FUNC TANK CONTROLS
//============================================================================
@ -981,30 +957,30 @@ public:
CFuncTank *m_pTank;
};
LINK_ENTITY_TO_CLASS( func_tankcontrols, CFuncTankControls );
LINK_ENTITY_TO_CLASS( func_tankcontrols, CFuncTankControls )
TYPEDESCRIPTION CFuncTankControls::m_SaveData[] =
{
DEFINE_FIELD( CFuncTankControls, m_pTank, FIELD_CLASSPTR ),
};
IMPLEMENT_SAVERESTORE( CFuncTankControls, CBaseEntity );
IMPLEMENT_SAVERESTORE( CFuncTankControls, CBaseEntity )
int CFuncTankControls :: ObjectCaps( void )
{
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE;
}
void CFuncTankControls :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{ // pass the Use command onto the controls
{
// pass the Use command onto the controls
if ( m_pTank )
m_pTank->Use( pActivator, pCaller, useType, value );
ASSERT( m_pTank != NULL ); // if this fails, most likely means save/restore hasn't worked properly
}
void CFuncTankControls :: Think( void )
{
edict_t *pTarget = NULL;

View File

@ -43,7 +43,7 @@ enum
GR_PLR_DROP_AMMO_ALL,
GR_PLR_DROP_AMMO_ACTIVE,
GR_PLR_DROP_AMMO_NO,
GR_PLR_DROP_AMMO_NO
};
// Player relationship return codes
@ -53,7 +53,7 @@ enum
GR_TEAMMATE,
GR_ENEMY,
GR_ALLY,
GR_NEUTRAL,
GR_NEUTRAL
};
class CGameRules
@ -67,25 +67,25 @@ public:
virtual BOOL FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon ) = 0;// should the player switch to this weapon?
virtual BOOL GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon ) = 0;// I can't use this weapon anymore, get me the next best one.
// Functions to verify the single/multiplayer status of a game
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer( void ) = 0;// is this a multiplayer game? (either coop or deathmatch)
virtual BOOL IsDeathmatch( void ) = 0;//is this a deathmatch game?
virtual BOOL IsTeamplay( void ) { return FALSE; };// is this deathmatch game being played with team rules?
virtual BOOL IsCoOp( void ) = 0;// is this a coop game?
virtual const char *GetGameDescription( void ) { return "Half-Life"; } // this is the game name that gets seen in the server browser
// Client connection/disconnection
// Client connection/disconnection
virtual BOOL ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ) = 0;// a client just connected to the server (player hasn't spawned yet)
virtual void InitHUD( CBasePlayer *pl ) = 0; // the client dll is ready for updating
virtual void ClientDisconnected( edict_t *pClient ) = 0;// a client just disconnected from the server
virtual void UpdateGameMode( CBasePlayer *pPlayer ) {} // the client needs to be informed of the current game mode
// Client damage rules
// Client damage rules
virtual float FlPlayerFallDamage( CBasePlayer *pPlayer ) = 0;// this client just hit the ground after a fall. How much damage?
virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker ) {return TRUE;};// can this player take damage from this attacker?
virtual BOOL ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target ) { return TRUE; }
// Client spawn/respawn control
// Client spawn/respawn control
virtual void PlayerSpawn( CBasePlayer *pPlayer ) = 0;// called by CBasePlayer::Spawn just before releasing player into the game
virtual void PlayerThink( CBasePlayer *pPlayer ) = 0; // called by CBasePlayer::PreThink every frame, before physics are run and after keys are accepted
virtual BOOL FPlayerCanRespawn( CBasePlayer *pPlayer ) = 0;// is this player allowed to respawn now?
@ -96,50 +96,51 @@ public:
virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) { return FALSE; }; // handles the user commands; returns TRUE if command handled properly
virtual void ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer ) {} // the player has changed userinfo; can change it now
// Client kills/scoring
// Client kills/scoring
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled ) = 0;// how many points do I award whoever kills this player?
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor ) = 0;// Called each time a player dies
virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )= 0;// Call this from within a GameRules class to report an obituary.
// Weapon retrieval
// Weapon retrieval
virtual BOOL CanHavePlayerItem( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );// The player is touching an CBasePlayerItem, do I give it to him?
virtual void PlayerGotWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon ) = 0;// Called each time a player picks up a weapon from the ground
// Weapon spawn/respawn control
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn( CBasePlayerItem *pWeapon ) = 0;// should this weapon respawn?
virtual float FlWeaponRespawnTime( CBasePlayerItem *pWeapon ) = 0;// when may this weapon respawn?
virtual float FlWeaponTryRespawn( CBasePlayerItem *pWeapon ) = 0; // can i respawn now, and if not, when should i try again?
virtual Vector VecWeaponRespawnSpot( CBasePlayerItem *pWeapon ) = 0;// where in the world should this weapon respawn?
// Item retrieval
// Item retrieval
virtual BOOL CanHaveItem( CBasePlayer *pPlayer, CItem *pItem ) = 0;// is this player allowed to take this item?
virtual void PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem ) = 0;// call each time a player picks up an item (battery, healthkit, longjump)
// Item spawn/respawn control
// Item spawn/respawn control
virtual int ItemShouldRespawn( CItem *pItem ) = 0;// Should this item respawn?
virtual float FlItemRespawnTime( CItem *pItem ) = 0;// when may this item respawn?
virtual Vector VecItemRespawnSpot( CItem *pItem ) = 0;// where in the world should this item respawn?
// Ammo retrieval
// Ammo retrieval
virtual BOOL CanHaveAmmo( CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry );// can this player take more of this ammo?
virtual void PlayerGotAmmo( CBasePlayer *pPlayer, char *szName, int iCount ) = 0;// called each time a player picks up some ammo in the world
// Ammo spawn/respawn control
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn( CBasePlayerAmmo *pAmmo ) = 0;// should this ammo item respawn?
virtual float FlAmmoRespawnTime( CBasePlayerAmmo *pAmmo ) = 0;// when should this ammo item respawn?
virtual Vector VecAmmoRespawnSpot( CBasePlayerAmmo *pAmmo ) = 0;// where in the world should this ammo item respawn?
// by default, everything spawns
// by default, everything spawns
// Healthcharger respawn control
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime( void ) = 0;// how long until a depleted HealthCharger recharges itself?
virtual float FlHEVChargerRechargeTime( void ) { return 0; }// how long until a depleted HealthCharger recharges itself?
// What happens to a dead player's weapons
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons( CBasePlayer *pPlayer ) = 0;// what do I do with a player's weapons when he's killed?
// What happens to a dead player's ammo
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo( CBasePlayer *pPlayer ) = 0;// Do I drop ammo when the player dies? How much?
// Teamplay stuff
// Teamplay stuff
virtual const char *GetTeamID( CBaseEntity *pEntity ) = 0;// what team is this entity on?
virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget ) = 0;// What is the player's relationship with this entity?
virtual int GetTeamIndex( const char *pTeamName ) { return -1; }
@ -148,11 +149,11 @@ public:
virtual void ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib ) {}
virtual const char *SetDefaultPlayerTeam( CBasePlayer *pPlayer ) { return ""; }
// Sounds
// Sounds
virtual BOOL PlayTextureSounds( void ) { return TRUE; }
virtual BOOL PlayFootstepSounds( CBasePlayer *pl, float fvol ) { return TRUE; }
// Monsters
// Monsters
virtual BOOL FAllowMonsters( void ) = 0;//are monsters allowed
// Immediately end a multiplayer game
@ -171,7 +172,7 @@ class CHalfLifeRules : public CGameRules
public:
CHalfLifeRules ( void );
// GR_Think
// GR_Think
virtual void Think( void );
virtual BOOL IsAllowedToSpawn( CBaseEntity *pEntity );
virtual BOOL FAllowFlashlight( void ) { return TRUE; };
@ -179,20 +180,20 @@ public:
virtual BOOL FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );
virtual BOOL GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon );
// Functions to verify the single/multiplayer status of a game
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer( void );
virtual BOOL IsDeathmatch( void );
virtual BOOL IsCoOp( void );
// Client connection/disconnection
// Client connection/disconnection
virtual BOOL ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
virtual void InitHUD( CBasePlayer *pl ); // the client dll is ready for updating
virtual void ClientDisconnected( edict_t *pClient );
// Client damage rules
// Client damage rules
virtual float FlPlayerFallDamage( CBasePlayer *pPlayer );
// Client spawn/respawn control
// Client spawn/respawn control
virtual void PlayerSpawn( CBasePlayer *pPlayer );
virtual void PlayerThink( CBasePlayer *pPlayer );
virtual BOOL FPlayerCanRespawn( CBasePlayer *pPlayer );
@ -200,50 +201,50 @@ public:
virtual BOOL AllowAutoTargetCrosshair( void );
// Client kills/scoring
// Client kills/scoring
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled );
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
// Weapon retrieval
// Weapon retrieval
virtual void PlayerGotWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );
// Weapon spawn/respawn control
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn( CBasePlayerItem *pWeapon );
virtual float FlWeaponRespawnTime( CBasePlayerItem *pWeapon );
virtual float FlWeaponTryRespawn( CBasePlayerItem *pWeapon );
virtual Vector VecWeaponRespawnSpot( CBasePlayerItem *pWeapon );
// Item retrieval
// Item retrieval
virtual BOOL CanHaveItem( CBasePlayer *pPlayer, CItem *pItem );
virtual void PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem );
// Item spawn/respawn control
// Item spawn/respawn control
virtual int ItemShouldRespawn( CItem *pItem );
virtual float FlItemRespawnTime( CItem *pItem );
virtual Vector VecItemRespawnSpot( CItem *pItem );
// Ammo retrieval
// Ammo retrieval
virtual void PlayerGotAmmo( CBasePlayer *pPlayer, char *szName, int iCount );
// Ammo spawn/respawn control
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn( CBasePlayerAmmo *pAmmo );
virtual float FlAmmoRespawnTime( CBasePlayerAmmo *pAmmo );
virtual Vector VecAmmoRespawnSpot( CBasePlayerAmmo *pAmmo );
// Healthcharger respawn control
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime( void );
// What happens to a dead player's weapons
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons( CBasePlayer *pPlayer );
// What happens to a dead player's ammo
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo( CBasePlayer *pPlayer );
// Monsters
// Monsters
virtual BOOL FAllowMonsters( void );
// Teamplay stuff
// Teamplay stuff
virtual const char *GetTeamID( CBaseEntity *pEntity ) {return "";};
virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget );
};
@ -257,7 +258,7 @@ class CHalfLifeMultiplay : public CGameRules
public:
CHalfLifeMultiplay();
// GR_Think
// GR_Think
virtual void Think( void );
virtual void RefreshSkillData( void );
virtual BOOL IsAllowedToSpawn( CBaseEntity *pEntity );
@ -266,12 +267,12 @@ public:
virtual BOOL FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );
virtual BOOL GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon );
// Functions to verify the single/multiplayer status of a game
// Functions to verify the single/multiplayer status of a game
virtual BOOL IsMultiplayer( void );
virtual BOOL IsDeathmatch( void );
virtual BOOL IsCoOp( void );
// Client connection/disconnection
// Client connection/disconnection
// If ClientConnected returns FALSE, the connection is rejected and the user is provided the reason specified in
// svRejectReason
// Only the client's name and remote address are provided to the dll for verification.
@ -280,11 +281,11 @@ public:
virtual void ClientDisconnected( edict_t *pClient );
virtual void UpdateGameMode( CBasePlayer *pPlayer ); // the client needs to be informed of the current game mode
// Client damage rules
// Client damage rules
virtual float FlPlayerFallDamage( CBasePlayer *pPlayer );
virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker );
// Client spawn/respawn control
// Client spawn/respawn control
virtual void PlayerSpawn( CBasePlayer *pPlayer );
virtual void PlayerThink( CBasePlayer *pPlayer );
virtual BOOL FPlayerCanRespawn( CBasePlayer *pPlayer );
@ -294,56 +295,56 @@ public:
virtual BOOL AllowAutoTargetCrosshair( void );
virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd );
// Client kills/scoring
// Client kills/scoring
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled );
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
// Weapon retrieval
// Weapon retrieval
virtual void PlayerGotWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );
virtual BOOL CanHavePlayerItem( CBasePlayer *pPlayer, CBasePlayerItem *pWeapon );// The player is touching an CBasePlayerItem, do I give it to him?
// Weapon spawn/respawn control
// Weapon spawn/respawn control
virtual int WeaponShouldRespawn( CBasePlayerItem *pWeapon );
virtual float FlWeaponRespawnTime( CBasePlayerItem *pWeapon );
virtual float FlWeaponTryRespawn( CBasePlayerItem *pWeapon );
virtual Vector VecWeaponRespawnSpot( CBasePlayerItem *pWeapon );
// Item retrieval
// Item retrieval
virtual BOOL CanHaveItem( CBasePlayer *pPlayer, CItem *pItem );
virtual void PlayerGotItem( CBasePlayer *pPlayer, CItem *pItem );
// Item spawn/respawn control
// Item spawn/respawn control
virtual int ItemShouldRespawn( CItem *pItem );
virtual float FlItemRespawnTime( CItem *pItem );
virtual Vector VecItemRespawnSpot( CItem *pItem );
// Ammo retrieval
// Ammo retrieval
virtual void PlayerGotAmmo( CBasePlayer *pPlayer, char *szName, int iCount );
// Ammo spawn/respawn control
// Ammo spawn/respawn control
virtual int AmmoShouldRespawn( CBasePlayerAmmo *pAmmo );
virtual float FlAmmoRespawnTime( CBasePlayerAmmo *pAmmo );
virtual Vector VecAmmoRespawnSpot( CBasePlayerAmmo *pAmmo );
// Healthcharger respawn control
// Healthcharger respawn control
virtual float FlHealthChargerRechargeTime( void );
virtual float FlHEVChargerRechargeTime( void );
// What happens to a dead player's weapons
// What happens to a dead player's weapons
virtual int DeadPlayerWeapons( CBasePlayer *pPlayer );
// What happens to a dead player's ammo
// What happens to a dead player's ammo
virtual int DeadPlayerAmmo( CBasePlayer *pPlayer );
// Teamplay stuff
// Teamplay stuff
virtual const char *GetTeamID( CBaseEntity *pEntity ) {return "";}
virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget );
virtual BOOL PlayTextureSounds( void ) { return FALSE; }
virtual BOOL PlayFootstepSounds( CBasePlayer *pl, float fvol );
// Monsters
// Monsters
virtual BOOL FAllowMonsters( void );
// Immediately end a multiplayer game

View File

@ -73,8 +73,8 @@ public:
int ObjectCaps( void ) { return FCAP_DONT_SAVE; }
static CSpiral *Create( const Vector &origin, float height, float radius, float duration );
};
LINK_ENTITY_TO_CLASS( streak_spiral, CSpiral );
LINK_ENTITY_TO_CLASS( streak_spiral, CSpiral )
class CStomp : public CBaseEntity
{
@ -88,7 +88,8 @@ private:
// CSprite *m_pSprites[ STOMP_SPRITE_COUNT ];
};
LINK_ENTITY_TO_CLASS( garg_stomp, CStomp );
LINK_ENTITY_TO_CLASS( garg_stomp, CStomp )
CStomp *CStomp::StompCreate( const Vector &origin, const Vector &end, float speed )
{
CStomp *pStomp = GetClassPtr( (CStomp *)NULL );
@ -116,7 +117,6 @@ void CStomp::Spawn( void )
EMIT_SOUND_DYN( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND, 1, ATTN_NORM, 0, PITCH_NORM * 0.55);
}
#define STOMP_INTERVAL 0.025
void CStomp::Think( void )
@ -166,6 +166,7 @@ void CStomp::Think( void )
}
}
pev->dmgtime += STOMP_INTERVAL;
// Scale has the "life" of this effect
pev->scale -= STOMP_INTERVAL * pev->speed;
if ( pev->scale <= 0 )
@ -174,7 +175,6 @@ void CStomp::Think( void )
UTIL_Remove(this);
STOP_SOUND( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND );
}
}
}
@ -196,7 +196,6 @@ void StreakSplash( const Vector &origin, const Vector &direction, int color, int
MESSAGE_END();
}
class CGargantua : public CBaseMonster
{
public:
@ -272,7 +271,7 @@ private:
float m_flameY;
};
LINK_ENTITY_TO_CLASS( monster_gargantua, CGargantua );
LINK_ENTITY_TO_CLASS( monster_gargantua, CGargantua )
TYPEDESCRIPTION CGargantua::m_SaveData[] =
{
@ -287,7 +286,7 @@ TYPEDESCRIPTION CGargantua::m_SaveData[] =
DEFINE_FIELD( CGargantua, m_flameY, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CGargantua, CBaseMonster );
IMPLEMENT_SAVERESTORE( CGargantua, CBaseMonster )
const char *CGargantua::pAttackHitSounds[] =
{
@ -303,7 +302,6 @@ const char *CGargantua::pBeamAttackSounds[] =
"garg/gar_flamerun1.wav",
};
const char *CGargantua::pAttackMissSounds[] =
{
"zombie/claw_miss1.wav",
@ -332,7 +330,6 @@ const char *CGargantua::pFootSounds[] =
"garg/gar_step2.wav",
};
const char *CGargantua::pIdleSounds[] =
{
"garg/gar_idle1.wav",
@ -342,7 +339,6 @@ const char *CGargantua::pIdleSounds[] =
"garg/gar_idle5.wav",
};
const char *CGargantua::pAttackSounds[] =
{
"garg/gar_attack1.wav",
@ -381,14 +377,14 @@ const char *CGargantua::pBreatheSounds[] =
#if 0
enum
{
SCHED_ = LAST_COMMON_SCHEDULE + 1,
SCHED_ = LAST_COMMON_SCHEDULE + 1
};
#endif
enum
{
TASK_SOUND_ATTACK = LAST_COMMON_TASK + 1,
TASK_FLAME_SWEEP,
TASK_FLAME_SWEEP
};
Task_t tlGargFlame[] =
@ -413,7 +409,6 @@ Schedule_t slGargFlame[] =
},
};
// primary melee attack
Task_t tlGargSwipe[] =
{
@ -433,28 +428,24 @@ Schedule_t slGargSwipe[] =
},
};
DEFINE_CUSTOM_SCHEDULES( CGargantua )
{
slGargFlame,
slGargSwipe,
};
IMPLEMENT_CUSTOM_SCHEDULES( CGargantua, CBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CGargantua, CBaseMonster )
void CGargantua::EyeOn( int level )
{
m_eyeBrightness = level;
}
void CGargantua::EyeOff( void )
{
m_eyeBrightness = 0;
}
void CGargantua::EyeUpdate( void )
{
if ( m_pEyeGlow )
@ -468,7 +459,6 @@ void CGargantua::EyeUpdate( void )
}
}
void CGargantua::StompAttack( void )
{
TraceResult trace;
@ -488,7 +478,6 @@ void CGargantua::StompAttack( void )
UTIL_DecalTrace( &trace, DECAL_GARGSTOMP1 );
}
void CGargantua :: FlameCreate( void )
{
int i;
@ -529,7 +518,6 @@ void CGargantua :: FlameCreate( void )
EMIT_SOUND_DYN ( edict(), CHAN_WEAPON, pBeamAttackSounds[ 2 ], 1.0, ATTN_NORM, 0, PITCH_NORM );
}
void CGargantua :: FlameControls( float angleX, float angleY )
{
if ( angleY < -180 )
@ -548,7 +536,6 @@ void CGargantua :: FlameControls( float angleX, float angleY )
SetBoneController( 1, m_flameX );
}
void CGargantua :: FlameUpdate( void )
{
int i;
@ -581,6 +568,7 @@ void CGargantua :: FlameUpdate( void )
streaks = TRUE;
UTIL_DecalTrace( &trace, DECAL_SMALLSCORCH1 + RANDOM_LONG(0,2) );
}
// RadiusDamage( trace.vecEndPos, pev, pev, gSkillData.gargantuaDmgFire, CLASS_ALIEN_MONSTER, DMG_BURN );
FlameDamage( vecStart, trace.vecEndPos, pev, pev, gSkillData.gargantuaDmgFire, CLASS_ALIEN_MONSTER, DMG_BURN );
@ -603,8 +591,6 @@ void CGargantua :: FlameUpdate( void )
m_streakTime = gpGlobals->time;
}
void CGargantua :: FlameDamage( Vector vecStart, Vector vecEnd, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType )
{
CBaseEntity *pEntity = NULL;
@ -642,7 +628,8 @@ void CGargantua :: FlameDamage( Vector vecStart, Vector vecEnd, entvars_t *pevIn
UTIL_TraceLine ( vecSrc, vecSpot, dont_ignore_monsters, ENT(pev), &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!
// decrease damage for an ent that's farther from the flame.
dist = ( vecSrc - tr.vecEndPos ).Length();
@ -673,7 +660,6 @@ void CGargantua :: FlameDamage( Vector vecStart, Vector vecEnd, entvars_t *pevIn
}
}
void CGargantua :: FlameDestroy( void )
{
int i;
@ -689,7 +675,6 @@ void CGargantua :: FlameDestroy( void )
}
}
void CGargantua :: PrescheduleThink( void )
{
if ( !HasConditions( bits_COND_SEE_ENEMY ) )
@ -703,7 +688,6 @@ void CGargantua :: PrescheduleThink( void )
EyeUpdate();
}
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
@ -734,7 +718,6 @@ void CGargantua :: SetYawSpeed ( void )
case ACT_RUN:
ys = 60;
break;
default:
ys = 60;
break;
@ -743,7 +726,6 @@ void CGargantua :: SetYawSpeed ( void )
pev->yaw_speed = ys;
}
//=========================================================
// Spawn
//=========================================================
@ -772,7 +754,6 @@ void CGargantua :: Spawn()
m_flameTime = gpGlobals->time + 2;
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
@ -822,7 +803,6 @@ void CGargantua :: Precache()
PRECACHE_SOUND((char *)pBreatheSounds[i]);
}
void CGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
{
ALERT( at_aiconsole, "CGargantua::TraceAttack\n");
@ -858,11 +838,8 @@ void CGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
}
CBaseMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );
}
int CGargantua::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
ALERT( at_aiconsole, "CGargantua::TakeDamage\n");
@ -878,7 +855,6 @@ int CGargantua::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void CGargantua::DeathEffect( void )
{
int i;
@ -903,7 +879,6 @@ void CGargantua::DeathEffect( void )
pSmoker->pev->nextthink = gpGlobals->time + 2.5; // Start in 2.5 seconds
}
void CGargantua::Killed( entvars_t *pevAttacker, int iGib )
{
EyeOff();
@ -929,7 +904,6 @@ BOOL CGargantua::CheckMeleeAttack1( float flDot, float flDist )
return FALSE;
}
// Flame thrower madness!
BOOL CGargantua::CheckMeleeAttack2( float flDot, float flDist )
{
@ -946,7 +920,6 @@ BOOL CGargantua::CheckMeleeAttack2( float flDot, float flDist )
return FALSE;
}
//=========================================================
// CheckRangeAttack1
// flDot is the cos of the angle of the cone within which
@ -968,9 +941,6 @@ BOOL CGargantua::CheckRangeAttack1( float flDot, float flDist )
return FALSE;
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
@ -1024,7 +994,6 @@ void CGargantua::HandleAnimEvent(MonsterEvent_t *pEvent)
}
}
//=========================================================
// CheckTraceHullAttack - expects a length to trace, amount
// of damage to do, and damage type. Returns a pointer to
@ -1062,7 +1031,6 @@ CBaseEntity* CGargantua::GargantuaCheckTraceHullAttack(float flDist, int iDamage
return NULL;
}
Schedule_t *CGargantua::GetScheduleOfType( int Type )
{
// HACKHACK - turn off the flames if they are on and garg goes scripted / dead
@ -1081,7 +1049,6 @@ Schedule_t *CGargantua::GetScheduleOfType( int Type )
return CBaseMonster::GetScheduleOfType( Type );
}
void CGargantua::StartTask( Task_t *pTask )
{
switch ( pTask->iTask )
@ -1187,7 +1154,6 @@ void CGargantua::RunTask( Task_t *pTask )
else
CBaseMonster::RunTask(pTask);
break;
case TASK_FLAME_SWEEP:
if ( gpGlobals->time > m_flWaitFinished )
{
@ -1228,14 +1194,12 @@ void CGargantua::RunTask( Task_t *pTask )
FlameControls( angles.x, angles.y );
}
break;
default:
CBaseMonster::RunTask( pTask );
break;
}
}
class CSmoker : public CBaseEntity
{
public:
@ -1243,7 +1207,7 @@ public:
void Think( void );
};
LINK_ENTITY_TO_CLASS( env_smoker, CSmoker );
LINK_ENTITY_TO_CLASS( env_smoker, CSmoker )
void CSmoker::Spawn( void )
{
@ -1255,7 +1219,6 @@ void CSmoker::Spawn( void )
pev->angles = g_vecZero;
}
void CSmoker::Think( void )
{
// lots of smoke
@ -1276,7 +1239,6 @@ void CSmoker::Think( void )
UTIL_Remove( this );
}
void CSpiral::Spawn( void )
{
pev->movetype = MOVETYPE_NONE;
@ -1287,7 +1249,6 @@ void CSpiral::Spawn( void )
pev->angles = g_vecZero;
}
CSpiral *CSpiral::Create( const Vector &origin, float height, float radius, float duration )
{
if ( duration <= 0 )
@ -1341,7 +1302,6 @@ void CSpiral::Think( void )
UTIL_Remove( this );
}
// HACKHACK Cut and pasted from explode.cpp
void SpawnExplosion( Vector center, float randomRange, float time, int magnitude )
{
@ -1362,7 +1322,4 @@ void SpawnExplosion( Vector center, float randomRange, float time, int magnitude
pExplosion->SetThink( &CBaseEntity::SUB_CallUseToggle );
pExplosion->pev->nextthink = gpGlobals->time + time;
}
#endif

View File

@ -25,7 +25,6 @@
#include "shake.h"
#include "gamerules.h"
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
@ -41,7 +40,7 @@ enum gauss_e {
GAUSS_DRAW
};
LINK_ENTITY_TO_CLASS( weapon_gauss, CGauss );
LINK_ENTITY_TO_CLASS( weapon_gauss, CGauss )
float CGauss::GetFullChargeTime( void )
{
@ -72,7 +71,6 @@ void CGauss::Spawn( )
FallInit();// get ready to fall down.
}
void CGauss::Precache( void )
{
PRECACHE_MODEL("models/w_gauss.mdl");
@ -140,7 +138,6 @@ void CGauss::Holster( int skiplocal /* = 0 */ )
m_fInAttack = 0;
}
void CGauss::PrimaryAttack()
{
// don't fire underwater
@ -335,7 +332,6 @@ void CGauss::StartFire( void )
if (m_fInAttack != 3)
{
//ALERT ( at_console, "Time:%f Damage:%f\n", gpGlobals->time - m_pPlayer->m_flStartCharge, flDamage );
#ifndef CLIENT_DLL
float flZVel = m_pPlayer->pev->velocity.z;
@ -345,7 +341,6 @@ void CGauss::StartFire( void )
}
if ( !g_pGameRules->IsMultiplayer() )
{
// in deathmatch, gauss can pop you up into the air. Not in single play.
m_pPlayer->pev->velocity.z = flZVel;
@ -380,8 +375,7 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
#ifdef CLIENT_DLL
if ( m_fPrimaryFire == false )
g_irunninggausspred = true;
#endif
#endif
// The main firing event is sent unreliably so it won't be delayed.
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussFire, 0.0, (float *)&m_pPlayer->pev->origin, (float *)&m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0 );
@ -395,9 +389,8 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
/*ALERT( at_console, "%f %f %f\n%f %f %f\n",
vecSrc.x, vecSrc.y, vecSrc.z,
vecDest.x, vecDest.y, vecDest.z );*/
// ALERT( at_console, "%f %f\n", tr.flFraction, flMaxFrac );
//ALERT( at_console, "%f %f\n", tr.flFraction, flMaxFrac );
#ifndef CLIENT_DLL
while (flDamage > 10 && nMaxHits > 0)
@ -535,9 +528,6 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
// ALERT( at_console, "%d bytes\n", nTotal );
}
void CGauss::WeaponIdle( void )
{
ResetEmptySound( );
@ -588,11 +578,6 @@ void CGauss::WeaponIdle( void )
}
}
class CGaussAmmo : public CBasePlayerAmmo
{
void Spawn( void )
@ -616,6 +601,6 @@ class CGaussAmmo : public CBasePlayerAmmo
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( ammo_gaussclip, CGaussAmmo );
LINK_ENTITY_TO_CLASS( ammo_gaussclip, CGaussAmmo )
#endif

View File

@ -38,7 +38,8 @@ public:
void HandleAnimEvent( MonsterEvent_t *pEvent );
int ISoundMask ( void );
};
LINK_ENTITY_TO_CLASS( monster_generic, CGenericMonster );
LINK_ENTITY_TO_CLASS( monster_generic, CGenericMonster )
//=========================================================
// Classify - indicates this monster's place in the

View File

@ -31,7 +31,7 @@
//===================grenade
LINK_ENTITY_TO_CLASS( grenade, CGrenade );
LINK_ENTITY_TO_CLASS( grenade, CGrenade )
// Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges
#define SF_DETONATE 0x0001
@ -125,7 +125,6 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
}
}
void CGrenade::Smoke( void )
{
if (UTIL_PointContents ( pev->origin ) == CONTENTS_WATER)
@ -152,7 +151,6 @@ void CGrenade::Killed( entvars_t *pevAttacker, int iGib )
Detonate( );
}
// Timed grenade, this think is called when time runs out.
void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -168,7 +166,6 @@ void CGrenade::PreDetonate( void )
pev->nextthink = gpGlobals->time + 1;
}
void CGrenade::Detonate( void )
{
TraceResult tr;
@ -197,7 +194,6 @@ void CGrenade::ExplodeTouch( CBaseEntity *pOther )
Explode( &tr, DMG_BLAST );
}
void CGrenade::DangerSoundThink( void )
{
if (!IsInWorld())
@ -215,7 +211,6 @@ void CGrenade::DangerSoundThink( void )
}
}
void CGrenade::BounceTouch( CBaseEntity *pOther )
{
// don't hit the guy that launched this grenade
@ -277,8 +272,6 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
}
void CGrenade::SlideTouch( CBaseEntity *pOther )
{
// don't hit the guy that launched this grenade
@ -340,7 +333,6 @@ void CGrenade :: TumbleThink( void )
}
}
void CGrenade:: Spawn( void )
{
pev->movetype = MOVETYPE_BOUNCE;
@ -355,7 +347,6 @@ void CGrenade:: Spawn( void )
m_fRegisteredSound = FALSE;
}
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
@ -382,7 +373,6 @@ CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector v
return pGrenade;
}
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
@ -422,7 +412,6 @@ CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector v
return pGrenade;
}
CGrenade * CGrenade :: ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
@ -452,8 +441,6 @@ CGrenade * CGrenade :: ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart,
return pGrenade;
}
void CGrenade :: UseSatchelCharges( entvars_t *pevOwner, SATCHELCODE code )
{
edict_t *pentFind;
@ -485,4 +472,3 @@ void CGrenade :: UseSatchelCharges( entvars_t *pevOwner, SATCHELCODE code )
}
//======================end grenade

View File

@ -34,9 +34,8 @@ enum glock_e {
GLOCK_ADD_SILENCER
};
LINK_ENTITY_TO_CLASS( weapon_glock, CGlock );
LINK_ENTITY_TO_CLASS( weapon_9mmhandgun, CGlock );
LINK_ENTITY_TO_CLASS( weapon_glock, CGlock )
LINK_ENTITY_TO_CLASS( weapon_9mmhandgun, CGlock )
void CGlock::Spawn( )
{
@ -50,7 +49,6 @@ void CGlock::Spawn( )
FallInit();// get ready to fall down.
}
void CGlock::Precache( void )
{
PRECACHE_MODEL("models/v_9mmhandgun.mdl");
@ -121,13 +119,11 @@ void CGlock::GlockFire( float flSpread , float flCycleTime, BOOL fUseAutoAim )
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
int flags;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
#else
flags = 0;
#endif
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
@ -170,7 +166,6 @@ void CGlock::GlockFire( float flSpread , float flCycleTime, BOOL fUseAutoAim )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
void CGlock::Reload( void )
{
if ( m_pPlayer->ammo_9mm <= 0 )
@ -189,8 +184,6 @@ void CGlock::Reload( void )
}
}
void CGlock::WeaponIdle( void )
{
ResetEmptySound( );
@ -225,13 +218,6 @@ void CGlock::WeaponIdle( void )
}
}
class CGlockAmmo : public CBasePlayerAmmo
{
void Spawn( void )
@ -255,20 +241,6 @@ class CGlockAmmo : public CBasePlayerAmmo
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( ammo_glockclip, CGlockAmmo );
LINK_ENTITY_TO_CLASS( ammo_9mmclip, CGlockAmmo );
LINK_ENTITY_TO_CLASS( ammo_glockclip, CGlockAmmo )
LINK_ENTITY_TO_CLASS( ammo_9mmclip, CGlockAmmo )

View File

@ -51,16 +51,16 @@ public:
EHANDLE m_hTalkTarget;
float m_flTalkTime;
};
LINK_ENTITY_TO_CLASS( monster_gman, CGMan );
LINK_ENTITY_TO_CLASS( monster_gman, CGMan )
TYPEDESCRIPTION CGMan::m_SaveData[] =
{
DEFINE_FIELD( CGMan, m_hTalkTarget, FIELD_EHANDLE ),
DEFINE_FIELD( CGMan, m_flTalkTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CGMan, CBaseMonster );
IMPLEMENT_SAVERESTORE( CGMan, CBaseMonster )
//=========================================================
// Classify - indicates this monster's place in the
@ -140,12 +140,10 @@ void CGMan :: Precache()
PRECACHE_MODEL( "models/gman.mdl" );
}
//=========================================================
// AI Schedules Specific to this monster
//=========================================================
void CGMan :: StartTask( Task_t *pTask )
{
switch( pTask->iTask )
@ -200,7 +198,6 @@ void CGMan :: RunTask( Task_t *pTask )
}
}
//=========================================================
// Override all damage
//=========================================================
@ -220,14 +217,12 @@ int CGMan :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float
return TRUE;
}
void CGMan::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
UTIL_Ricochet( ptr->vecEndPos, 1.0 );
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
}
void CGMan::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener )
{
CBaseMonster::PlayScriptedSentence( pszSentence, duration, volume, attenuation, bConcurrent, pListener );

View File

@ -58,10 +58,9 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] =
DEFINE_FIELD( CRecharge, m_flSoundTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CRecharge, CBaseEntity );
LINK_ENTITY_TO_CLASS(func_recharge, CRecharge);
IMPLEMENT_SAVERESTORE( CRecharge, CBaseEntity )
LINK_ENTITY_TO_CLASS( func_recharge, CRecharge )
void CRecharge::KeyValue( KeyValueData *pkvd )
{
@ -103,7 +102,6 @@ void CRecharge::Precache()
PRECACHE_SOUND("items/suitchargeok1.wav");
}
void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
// if it's not a player, ignore
@ -160,7 +158,6 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
EMIT_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav", 0.85, ATTN_NORM );
}
// charge the player
if (m_hActivator->pev->armorvalue < 100)
{

View File

@ -28,7 +28,6 @@
#include "monsters.h"
#include "decals.h"
class CLegacyCineMonster : public CBaseMonster
{
public:
@ -44,11 +43,13 @@ class CCineScientist : public CLegacyCineMonster
public:
void Spawn( void ) { CineSpawn("models/cine-scientist.mdl"); }
};
class CCine2Scientist : public CLegacyCineMonster
{
public:
void Spawn( void ) { CineSpawn("models/cine2-scientist.mdl"); }
};
class CCinePanther : public CLegacyCineMonster
{
public:
@ -89,14 +90,14 @@ public:
// ********** Scientist SPAWN **********
//
LINK_ENTITY_TO_CLASS( monster_cine_scientist, CCineScientist );
LINK_ENTITY_TO_CLASS( monster_cine_panther, CCinePanther );
LINK_ENTITY_TO_CLASS( monster_cine_barney, CCineBarney );
LINK_ENTITY_TO_CLASS( monster_cine2_scientist, CCine2Scientist );
LINK_ENTITY_TO_CLASS( monster_cine2_hvyweapons, CCine2HeavyWeapons );
LINK_ENTITY_TO_CLASS( monster_cine2_slave, CCine2Slave );
LINK_ENTITY_TO_CLASS( monster_cine3_scientist, CCine3Scientist );
LINK_ENTITY_TO_CLASS( monster_cine3_barney, CCine3Barney );
LINK_ENTITY_TO_CLASS( monster_cine_scientist, CCineScientist )
LINK_ENTITY_TO_CLASS( monster_cine_panther, CCinePanther )
LINK_ENTITY_TO_CLASS( monster_cine_barney, CCineBarney )
LINK_ENTITY_TO_CLASS( monster_cine2_scientist, CCine2Scientist )
LINK_ENTITY_TO_CLASS( monster_cine2_hvyweapons, CCine2HeavyWeapons )
LINK_ENTITY_TO_CLASS( monster_cine2_slave, CCine2Slave )
LINK_ENTITY_TO_CLASS( monster_cine3_scientist, CCine3Scientist )
LINK_ENTITY_TO_CLASS( monster_cine3_barney, CCine3Barney )
//
// ********** Scientist SPAWN **********
@ -129,7 +130,6 @@ void CLegacyCineMonster :: CineSpawn( char *szModel )
}
}
//
// CineStart
//
@ -190,8 +190,7 @@ public:
void EXPORT BloodGush ( void );
};
LINK_ENTITY_TO_CLASS( cine_blood, CCineBlood );
LINK_ENTITY_TO_CLASS( cine_blood, CCineBlood )
void CCineBlood :: BloodGush ( void )
{
@ -202,19 +201,20 @@ void CCineBlood :: BloodGush ( void )
UTIL_MakeVectors(pev->angles);
if ( pev->health-- < 0 )
REMOVE_ENTITY(ENT(pev));
// CHANGE_METHOD ( ENT(pev), em_think, SUB_Remove );
// CHANGE_METHOD ( ENT(pev), em_think, SUB_Remove );
if ( RANDOM_FLOAT ( 0 , 1 ) < 0.7 )// larger chance of globs
{
UTIL_BloodDrips( pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, 10 );
}
else// slim chance of geyser
else // slim chance of geyser
{
UTIL_BloodStream( pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, RANDOM_LONG(50, 150) );
}
if ( RANDOM_FLOAT ( 0, 1 ) < 0.75 )
{// decals the floor with blood.
{
// decals the floor with blood.
vecSplatDir = Vector ( 0 , 0 , -1 );
vecSplatDir = vecSplatDir + (RANDOM_FLOAT(-1,1) * 0.6 * gpGlobals->v_right) + (RANDOM_FLOAT(-1,1) * 0.6 * gpGlobals->v_forward);// randomize a bit
UTIL_TraceLine( pev->origin + Vector ( 0, 0 , 64) , pev->origin + vecSplatDir * 256, ignore_monsters, ENT(pev), &tr);
@ -238,4 +238,3 @@ void CCineBlood :: Spawn ( void )
SetUse( &CCineBlood::BloodStart );
pev->health = 20;//hacked health to count iterations
}

View File

@ -28,7 +28,6 @@
#include "weapons.h"
#include "player.h"
#define TEMP_FOR_SCREEN_SHOTS
#ifdef TEMP_FOR_SCREEN_SHOTS //===================================================
@ -58,8 +57,7 @@ TYPEDESCRIPTION CCycler::m_SaveData[] =
DEFINE_FIELD( CCycler, m_animate, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CCycler, CBaseMonster );
IMPLEMENT_SAVERESTORE( CCycler, CBaseMonster )
//
// we should get rid of all the other cyclers and replace them with this.
@ -69,9 +67,8 @@ class CGenericCycler : public CCycler
public:
void Spawn( void ) { GenericCyclerSpawn( (char *)STRING(pev->model), Vector(-16, -16, 0), Vector(16, 16, 72) ); }
};
LINK_ENTITY_TO_CLASS( cycler, CGenericCycler );
LINK_ENTITY_TO_CLASS( cycler, CGenericCycler )
// Probe droid imported for tech demo compatibility
//
@ -82,15 +79,15 @@ class CCyclerProbe : public CCycler
public:
void Spawn( void );
};
LINK_ENTITY_TO_CLASS( cycler_prdroid, CCyclerProbe );
LINK_ENTITY_TO_CLASS( cycler_prdroid, CCyclerProbe )
void CCyclerProbe :: Spawn( void )
{
pev->origin = pev->origin + Vector ( 0, 0, 16 );
GenericCyclerSpawn( "models/prdroid.mdl", Vector(-16,-16,-16), Vector(16,16,16));
}
// Cycler member functions
void CCycler :: GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
@ -111,7 +108,6 @@ void CCycler :: GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
UTIL_SetSize(pev, vecMin, vecMax);
}
void CCycler :: Spawn( )
{
InitBoneControllers();
@ -142,9 +138,6 @@ void CCycler :: Spawn( )
}
}
//
// cycler think
//
@ -211,10 +204,8 @@ int CCycler :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, floa
return 0;
}
#endif
class CCyclerSprite : public CBaseEntity
{
public:
@ -235,7 +226,7 @@ public:
float m_maxFrame;
};
LINK_ENTITY_TO_CLASS( cycler_sprite, CCyclerSprite );
LINK_ENTITY_TO_CLASS( cycler_sprite, CCyclerSprite )
TYPEDESCRIPTION CCyclerSprite::m_SaveData[] =
{
@ -244,8 +235,7 @@ TYPEDESCRIPTION CCyclerSprite::m_SaveData[] =
DEFINE_FIELD( CCyclerSprite, m_maxFrame, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CCyclerSprite, CBaseEntity );
IMPLEMENT_SAVERESTORE( CCyclerSprite, CBaseEntity )
void CCyclerSprite::Spawn( void )
{
@ -265,7 +255,6 @@ void CCyclerSprite::Spawn( void )
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
}
void CCyclerSprite::Think( void )
{
if ( ShouldAnimate() )
@ -275,14 +264,12 @@ void CCyclerSprite::Think( void )
m_lastTime = gpGlobals->time;
}
void CCyclerSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
m_animate = !m_animate;
ALERT( at_console, "Sprite: %s\n", STRING(pev->model) );
}
int CCyclerSprite::TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType )
{
if ( m_maxFrame > 1.0 )
@ -299,12 +286,6 @@ void CCyclerSprite::Animate( float frames )
pev->frame = fmod( pev->frame, m_maxFrame );
}
class CWeaponCycler : public CBasePlayerWeapon
{
public:
@ -319,8 +300,8 @@ public:
int m_iszModel;
int m_iModel;
};
LINK_ENTITY_TO_CLASS( cycler_weapon, CWeaponCycler );
LINK_ENTITY_TO_CLASS( cycler_weapon, CWeaponCycler )
void CWeaponCycler::Spawn( )
{
@ -337,8 +318,6 @@ void CWeaponCycler::Spawn( )
SetTouch( &CBasePlayerItem::DefaultTouch );
}
BOOL CWeaponCycler::Deploy( )
{
m_pPlayer->pev->viewmodel = m_iszModel;
@ -348,13 +327,11 @@ BOOL CWeaponCycler::Deploy( )
return TRUE;
}
void CWeaponCycler::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
}
void CWeaponCycler::PrimaryAttack()
{
@ -363,7 +340,6 @@ void CWeaponCycler::PrimaryAttack()
m_flNextPrimaryAttack = gpGlobals->time + 0.3;
}
void CWeaponCycler::SecondaryAttack( void )
{
float flFrameRate, flGroundSpeed;
@ -385,8 +361,6 @@ void CWeaponCycler::SecondaryAttack( void )
m_flNextSecondaryAttack = gpGlobals->time + 0.3;
}
// Flaming Wreakage
class CWreckage : public CBaseMonster
{
@ -400,14 +374,15 @@ class CWreckage : public CBaseMonster
int m_flStartTime;
};
TYPEDESCRIPTION CWreckage::m_SaveData[] =
{
DEFINE_FIELD( CWreckage, m_flStartTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CWreckage, CBaseMonster );
IMPLEMENT_SAVERESTORE( CWreckage, CBaseMonster )
LINK_ENTITY_TO_CLASS( cycler_wreckage, CWreckage );
LINK_ENTITY_TO_CLASS( cycler_wreckage, CWreckage )
void CWreckage::Spawn( void )
{

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -20,7 +21,6 @@
#include "nodes.h"
#include "player.h"
#define HANDGRENADE_PRIMARY_VOLUME 450
enum handgrenade_e {
@ -34,9 +34,7 @@ enum handgrenade_e {
HANDGRENADE_DRAW
};
LINK_ENTITY_TO_CLASS( weapon_handgrenade, CHandGrenade );
LINK_ENTITY_TO_CLASS( weapon_handgrenade, CHandGrenade )
void CHandGrenade::Spawn( )
{
@ -47,13 +45,11 @@ void CHandGrenade::Spawn( )
#ifndef CLIENT_DLL
pev->dmg = gSkillData.plrDmgHandGrenade;
#endif
m_iDefaultAmmo = HANDGRENADE_DEFAULT_GIVE;
FallInit();// get ready to fall down.
}
void CHandGrenade::Precache( void )
{
PRECACHE_MODEL("models/w_grenade.mdl");
@ -78,7 +74,6 @@ int CHandGrenade::GetItemInfo(ItemInfo *p)
return 1;
}
BOOL CHandGrenade::Deploy( )
{
m_flReleaseThrow = -1;
@ -122,7 +117,6 @@ void CHandGrenade::PrimaryAttack()
}
}
void CHandGrenade::WeaponIdle( void )
{
if ( m_flReleaseThrow == 0 && m_flStartThrow )
@ -227,7 +221,3 @@ void CHandGrenade::WeaponIdle( void )
SendWeaponAnim( iAnim );
}
}

View File

@ -38,7 +38,7 @@ enum
SCHED_ASSASSIN_EXPOSED = LAST_COMMON_SCHEDULE + 1,// cover was blown.
SCHED_ASSASSIN_JUMP, // fly through the air
SCHED_ASSASSIN_JUMP_ATTACK, // fly through the air and shoot
SCHED_ASSASSIN_JUMP_LAND, // hit and run away
SCHED_ASSASSIN_JUMP_LAND // hit and run away
};
//=========================================================
@ -47,10 +47,9 @@ enum
enum
{
TASK_ASSASSIN_FALL_TO_GROUND = LAST_COMMON_TASK + 1, // falling and waiting to hit ground
TASK_ASSASSIN_FALL_TO_GROUND = LAST_COMMON_TASK + 1 // falling and waiting to hit ground
};
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
@ -58,7 +57,6 @@ enum
#define ASSASSIN_AE_TOSS1 2
#define ASSASSIN_AE_JUMP 3
#define bits_MEMORY_BADJUMP (bits_MEMORY_CUSTOM1)
class CHAssassin : public CBaseMonster
@ -104,8 +102,8 @@ public:
int m_iShell;
};
LINK_ENTITY_TO_CLASS( monster_human_assassin, CHAssassin );
LINK_ENTITY_TO_CLASS( monster_human_assassin, CHAssassin )
TYPEDESCRIPTION CHAssassin::m_SaveData[] =
{
@ -123,8 +121,7 @@ TYPEDESCRIPTION CHAssassin::m_SaveData[] =
DEFINE_FIELD( CHAssassin, m_iFrustration, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CHAssassin, CBaseMonster );
IMPLEMENT_SAVERESTORE( CHAssassin, CBaseMonster )
//=========================================================
// DieSound
@ -152,12 +149,11 @@ int CHAssassin :: ISoundMask ( void)
bits_SOUND_PLAYER;
}
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int CHAssassin :: Classify ( void )
int CHAssassin :: Classify ( void )
{
return CLASS_HUMAN_MILITARY;
}
@ -184,7 +180,6 @@ void CHAssassin :: SetYawSpeed ( void )
pev->yaw_speed = ys;
}
//=========================================================
// Shoot
//=========================================================
@ -234,7 +229,6 @@ void CHAssassin :: Shoot ( void )
m_cAmmoLoaded--;
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
@ -317,8 +311,6 @@ void CHAssassin :: Precache()
m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shell
}
//=========================================================
// AI Schedules Specific to this monster
@ -355,7 +347,6 @@ Schedule_t slAssassinFail[] =
},
};
//=========================================================
// Enemy exposed Agrunt's cover
//=========================================================
@ -378,7 +369,6 @@ Schedule_t slAssassinExposed[] =
},
};
//=========================================================
// Take cover from enemy! Tries lateral cover before node
// cover!
@ -409,7 +399,6 @@ Schedule_t slAssassinTakeCoverFromEnemy[] =
},
};
//=========================================================
// Take cover from enemy! Tries lateral cover before node
// cover!
@ -442,7 +431,6 @@ Schedule_t slAssassinTakeCoverFromEnemy2[] =
},
};
//=========================================================
// hide from the loudest sound source
//=========================================================
@ -468,10 +456,6 @@ Schedule_t slAssassinTakeCoverFromBestSound[] =
},
};
//=========================================================
// AlertIdle Schedules
//=========================================================
@ -501,8 +485,6 @@ Schedule_t slAssassinHide[] =
},
};
//=========================================================
// HUNT Schedules
//=========================================================
@ -528,7 +510,6 @@ Schedule_t slAssassinHunt[] =
},
};
//=========================================================
// Jumping Schedules
//=========================================================
@ -550,7 +531,6 @@ Schedule_t slAssassinJump[] =
},
};
//=========================================================
// repel
//=========================================================
@ -561,7 +541,6 @@ Task_t tlAssassinJumpAttack[] =
{ TASK_ASSASSIN_FALL_TO_GROUND, (float)0 },
};
Schedule_t slAssassinJumpAttack[] =
{
{
@ -573,7 +552,6 @@ Schedule_t slAssassinJumpAttack[] =
},
};
//=========================================================
// repel
//=========================================================
@ -617,8 +595,7 @@ DEFINE_CUSTOM_SCHEDULES( CHAssassin )
slAssassinJumpLand,
};
IMPLEMENT_CUSTOM_SCHEDULES( CHAssassin, CBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CHAssassin, CBaseMonster )
//=========================================================
// CheckMeleeAttack1 - jump like crazy if the enemy gets too close.
@ -706,7 +683,6 @@ BOOL CHAssassin :: CheckRangeAttack2 ( float flDot, float flDist )
return FALSE;
}
//=========================================================
// RunAI
//=========================================================
@ -755,7 +731,6 @@ void CHAssassin :: RunAI( void )
}
}
//=========================================================
// StartTask
//=========================================================
@ -781,7 +756,6 @@ void CHAssassin :: StartTask ( Task_t *pTask )
}
}
//=========================================================
// RunTask
//=========================================================
@ -1013,5 +987,4 @@ Schedule_t* CHAssassin :: GetScheduleOfType ( int Type )
return CBaseMonster :: GetScheduleOfType( Type );
}
#endif

View File

@ -97,7 +97,7 @@ public:
virtual float GetSoundVolue( void ) { return 1.0; }
Schedule_t* GetScheduleOfType ( int Type );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
static const char *pIdleSounds[];
static const char *pAlertSounds[];
@ -106,7 +106,8 @@ public:
static const char *pDeathSounds[];
static const char *pBiteSounds[];
};
LINK_ENTITY_TO_CLASS( monster_headcrab, CHeadCrab );
LINK_ENTITY_TO_CLASS( monster_headcrab, CHeadCrab )
DEFINE_CUSTOM_SCHEDULES( CHeadCrab )
{
@ -114,24 +115,27 @@ DEFINE_CUSTOM_SCHEDULES( CHeadCrab )
slHCRangeAttack1Fast,
};
IMPLEMENT_CUSTOM_SCHEDULES( CHeadCrab, CBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CHeadCrab, CBaseMonster )
const char *CHeadCrab::pIdleSounds[] =
const char *CHeadCrab::pIdleSounds[] =
{
"headcrab/hc_idle1.wav",
"headcrab/hc_idle2.wav",
"headcrab/hc_idle3.wav",
};
const char *CHeadCrab::pAlertSounds[] =
const char *CHeadCrab::pAlertSounds[] =
{
"headcrab/hc_alert1.wav",
};
const char *CHeadCrab::pPainSounds[] =
const char *CHeadCrab::pPainSounds[] =
{
"headcrab/hc_pain1.wav",
"headcrab/hc_pain2.wav",
"headcrab/hc_pain3.wav",
};
const char *CHeadCrab::pAttackSounds[] =
{
"headcrab/hc_attack1.wav",
@ -169,7 +173,6 @@ Vector CHeadCrab :: Center ( void )
return Vector( pev->origin.x, pev->origin.y, pev->origin.z + 6 );
}
Vector CHeadCrab :: BodyTarget( const Vector &posSrc )
{
return Center( );
@ -310,7 +313,6 @@ void CHeadCrab :: Precache()
PRECACHE_MODEL("models/headcrab.mdl");
}
//=========================================================
// RunTask
//=========================================================
@ -395,7 +397,6 @@ void CHeadCrab :: StartTask ( Task_t *pTask )
}
}
//=========================================================
// CheckRangeAttack1
//=========================================================
@ -480,7 +481,6 @@ Schedule_t* CHeadCrab :: GetScheduleOfType ( int Type )
return CBaseMonster::GetScheduleOfType( Type );
}
class CBabyCrab : public CHeadCrab
{
public:
@ -493,7 +493,8 @@ public:
virtual int GetVoicePitch( void ) { return PITCH_NORM + RANDOM_LONG(40,50); }
virtual float GetSoundVolue( void ) { return 0.8; }
};
LINK_ENTITY_TO_CLASS( monster_babycrab, CBabyCrab );
LINK_ENTITY_TO_CLASS( monster_babycrab, CBabyCrab )
void CBabyCrab :: Spawn( void )
{
@ -512,13 +513,11 @@ void CBabyCrab :: Precache( void )
CHeadCrab::Precache();
}
void CBabyCrab :: SetYawSpeed ( void )
{
pev->yaw_speed = 120;
}
BOOL CBabyCrab :: CheckRangeAttack1( float flDot, float flDist )
{
if ( pev->flags & FL_ONGROUND )
@ -534,7 +533,6 @@ BOOL CBabyCrab :: CheckRangeAttack1( float flDot, float flDist )
return FALSE;
}
Schedule_t* CBabyCrab :: GetScheduleOfType ( int Type )
{
switch( Type )

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -29,27 +30,24 @@ class CHealthKit : public CItem
void Spawn( void );
void Precache( void );
BOOL MyTouch( CBasePlayer *pPlayer );
/*
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
*/
};
LINK_ENTITY_TO_CLASS( item_healthkit, CHealthKit );
LINK_ENTITY_TO_CLASS( item_healthkit, CHealthKit )
/*
TYPEDESCRIPTION CHealthKit::m_SaveData[] =
TYPEDESCRIPTION CHealthKit::m_SaveData[] =
{
};
IMPLEMENT_SAVERESTORE( CHealthKit, CItem);
IMPLEMENT_SAVERESTORE( CHealthKit, CItem)
*/
void CHealthKit :: Spawn( void )
@ -96,8 +94,6 @@ BOOL CHealthKit::MyTouch( CBasePlayer *pPlayer )
return FALSE;
}
//-------------------------------------------------------------
// Wall mounted health kit
//-------------------------------------------------------------
@ -132,10 +128,9 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] =
DEFINE_FIELD( CWallHealth, m_flSoundTime, FIELD_TIME),
};
IMPLEMENT_SAVERESTORE( CWallHealth, CBaseEntity );
LINK_ENTITY_TO_CLASS(func_healthcharger, CWallHealth);
IMPLEMENT_SAVERESTORE( CWallHealth, CBaseEntity )
LINK_ENTITY_TO_CLASS(func_healthcharger, CWallHealth)
void CWallHealth::KeyValue( KeyValueData *pkvd )
{
@ -167,8 +162,7 @@ void CWallHealth::Spawn()
UTIL_SetSize(pev, pev->mins, pev->maxs);
SET_MODEL(ENT(pev), STRING(pev->model) );
m_iJuice = gSkillData.healthchargerCapacity;
pev->frame = 0;
pev->frame = 0;
}
void CWallHealth::Precache()
@ -178,7 +172,6 @@ void CWallHealth::Precache()
PRECACHE_SOUND("items/medcharge4.wav");
}
void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
// Make sure that we have a caller
@ -210,7 +203,6 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
SetThink( &CWallHealth::Off );
// Time to recharge yet?
if (m_flNextCharge >= gpGlobals->time)
return;
@ -227,7 +219,6 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
EMIT_SOUND(ENT(pev), CHAN_STATIC, "items/medcharge4.wav", 1.0, ATTN_NORM );
}
// charge the player
if ( pActivator->TakeHealth( 1, DMG_GENERIC ) )
{

View File

@ -27,7 +27,6 @@
*/
#include "extdll.h"
#include "plane.h"
#include "util.h"
@ -102,7 +101,7 @@ enum
SCHED_GRUNT_REPEL_LAND,
SCHED_GRUNT_WAIT_FACE_ENEMY,
SCHED_GRUNT_TAKECOVER_FAILED,// special schedule type that forces analysis of conditions and picks the best possible schedule to recover from this type of failure.
SCHED_GRUNT_ELOF_FAIL,
SCHED_GRUNT_ELOF_FAIL
};
//=========================================================
@ -112,7 +111,7 @@ enum
{
TASK_GRUNT_FACE_TOSS_DIR = LAST_COMMON_TASK + 1,
TASK_GRUNT_SPEAK_SENTENCE,
TASK_GRUNT_CHECK_FIRE,
TASK_GRUNT_CHECK_FIRE
};
//=========================================================
@ -147,7 +146,7 @@ public:
void GibMonster( void );
void SpeakSentence( void );
int Save( CSave &save );
int Save( CSave &save );
int Restore( CRestore &restore );
CBaseEntity *Kick( void );
@ -161,7 +160,7 @@ public:
BOOL FOkToSpeak( void );
void JustSpoke( void );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
static TYPEDESCRIPTION m_SaveData[];
// checking the feasibility of a grenade toss is kind of costly, so we do it every couple of seconds,
@ -187,9 +186,9 @@ public:
static const char *pGruntSentences[];
};
LINK_ENTITY_TO_CLASS( monster_human_grunt, CHGrunt );
LINK_ENTITY_TO_CLASS( monster_human_grunt, CHGrunt )
TYPEDESCRIPTION CHGrunt::m_SaveData[] =
TYPEDESCRIPTION CHGrunt::m_SaveData[] =
{
DEFINE_FIELD( CHGrunt, m_flNextGrenadeCheck, FIELD_TIME ),
DEFINE_FIELD( CHGrunt, m_flNextPainTime, FIELD_TIME ),
@ -205,9 +204,9 @@ TYPEDESCRIPTION CHGrunt::m_SaveData[] =
DEFINE_FIELD( CHGrunt, m_iSentence, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CHGrunt, CSquadMonster );
IMPLEMENT_SAVERESTORE( CHGrunt, CSquadMonster )
const char *CHGrunt::pGruntSentences[] =
const char *CHGrunt::pGruntSentences[] =
{
"HG_GREN", // grenade scared grunt
"HG_ALERT", // sees player
@ -227,7 +226,7 @@ enum
HGRUNT_SENT_COVER,
HGRUNT_SENT_THROW,
HGRUNT_SENT_CHARGE,
HGRUNT_SENT_TAUNT,
HGRUNT_SENT_TAUNT
} HGRUNT_SENTENCE_TYPES;
//=========================================================
@ -280,7 +279,8 @@ void CHGrunt :: GibMonster ( void )
Vector vecGunAngles;
if ( GetBodygroup( 2 ) != 2 )
{// throw a gun if the grunt has one
{
// throw a gun if the grunt has one
GetAttachment( 0, vecGunPos, vecGunAngles );
CBaseEntity *pGun;
@ -330,7 +330,7 @@ int CHGrunt :: ISoundMask ( void )
//=========================================================
BOOL CHGrunt :: FOkToSpeak( void )
{
// if someone else is talking, don't speak
// if someone else is talking, don't speak
if (gpGlobals->time <= CTalkMonster::g_talkWaitTime)
return FALSE;
@ -344,8 +344,8 @@ BOOL CHGrunt :: FOkToSpeak( void )
}
// if player is not in pvs, don't speak
// if (FNullEnt(FIND_CLIENT_IN_PVS(edict())))
// return FALSE;
//if (FNullEnt(FIND_CLIENT_IN_PVS(edict())))
// return FALSE;
return TRUE;
}
@ -406,7 +406,6 @@ BOOL CHGrunt :: FCanCheckAttacks ( void )
}
}
//=========================================================
// CheckMeleeAttack1
//=========================================================
@ -499,7 +498,7 @@ BOOL CHGrunt :: CheckRangeAttack2 ( float flDot, float flDist )
m_fThrowGrenade = FALSE;
return m_fThrowGrenade;
}
Vector vecTarget;
if (FBitSet( pev->weapons, HGRUNT_HANDGRENADE))
@ -539,7 +538,7 @@ BOOL CHGrunt :: CheckRangeAttack2 ( float flDot, float flDist )
m_fThrowGrenade = FALSE;
}
}
if ( ( vecTarget - pev->origin ).Length2D() <= 256 )
{
// crap, I don't want to blow myself up
@ -548,7 +547,7 @@ BOOL CHGrunt :: CheckRangeAttack2 ( float flDot, float flDist )
return m_fThrowGrenade;
}
if (FBitSet( pev->weapons, HGRUNT_HANDGRENADE))
{
Vector vecToss = VecCheckToss( pev, GetGunPosition(), vecTarget, 0.5 );
@ -592,12 +591,9 @@ BOOL CHGrunt :: CheckRangeAttack2 ( float flDot, float flDist )
}
}
return m_fThrowGrenade;
}
//=========================================================
// TraceAttack - make sure we're not taking it in the helmet
//=========================================================
@ -755,7 +751,7 @@ CBaseEntity *CHGrunt :: Kick( void )
Vector vecEnd = vecStart + (gpGlobals->v_forward * 70);
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT(pev), &tr );
if ( tr.pHit )
{
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
@ -847,7 +843,7 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
switch( pEvent->event )
{
case HGRUNT_AE_DROP_GUN:
{
{
Vector vecGunPos;
Vector vecGunAngles;
@ -869,16 +865,13 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
DropItem( "ammo_ARgrenades", BodyTarget( pev->origin ), vecGunAngles );
}
}
}
break;
case HGRUNT_AE_RELOAD:
EMIT_SOUND( ENT(pev), CHAN_WEAPON, "hgrunt/gr_reload1.wav", 1, ATTN_NORM );
m_cAmmoLoaded = m_cClipSize;
ClearConditions(bits_COND_NO_AMMO_LOADED);
break;
case HGRUNT_AE_GREN_TOSS:
{
UTIL_MakeVectors( pev->angles );
@ -889,7 +882,7 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
m_flNextGrenadeCheck = gpGlobals->time + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
// !!!LATER - when in a group, only try to throw grenade if ordered.
}
break;
break;
case HGRUNT_AE_GREN_LAUNCH:
{
@ -901,15 +894,13 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
else
m_flNextGrenadeCheck = gpGlobals->time + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
}
break;
break;
case HGRUNT_AE_GREN_DROP:
{
UTIL_MakeVectors( pev->angles );
CGrenade::ShootTimed( pev, pev->origin + gpGlobals->v_forward * 17 - gpGlobals->v_right * 27 + gpGlobals->v_up * 6, g_vecZero, 3 );
}
break;
break;
case HGRUNT_AE_BURST1:
{
if ( FBitSet( pev->weapons, HGRUNT_9MMAR ))
@ -935,13 +926,11 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, 384, 0.3 );
}
break;
break;
case HGRUNT_AE_BURST2:
case HGRUNT_AE_BURST3:
Shoot();
break;
case HGRUNT_AE_KICK:
{
CBaseEntity *pHurt = Kick();
@ -955,8 +944,7 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->TakeDamage( pev, pev, gSkillData.hgruntDmgKick, DMG_CLUB );
}
}
break;
break;
case HGRUNT_AE_CAUGHT_ENEMY:
{
if ( FOkToSpeak() )
@ -966,7 +954,6 @@ void CHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
default:
CSquadMonster::HandleAnimEvent( pEvent );
break;
@ -1094,26 +1081,21 @@ void CHGrunt :: StartTask ( Task_t *pTask )
}
TaskComplete();
break;
case TASK_GRUNT_SPEAK_SENTENCE:
SpeakSentence();
TaskComplete();
break;
case TASK_WALK_PATH:
case TASK_RUN_PATH:
// grunt no longer assumes he is covered if he moves
Forget( bits_MEMORY_INCOVER );
CSquadMonster ::StartTask( pTask );
break;
case TASK_RELOAD:
m_IdealActivity = ACT_RELOAD;
break;
case TASK_GRUNT_FACE_TOSS_DIR:
break;
case TASK_FACE_IDEAL:
case TASK_FACE_ENEMY:
CSquadMonster :: StartTask( pTask );
@ -1122,7 +1104,6 @@ void CHGrunt :: StartTask ( Task_t *pTask )
m_IdealActivity = ACT_GLIDE;
}
break;
default:
CSquadMonster :: StartTask( pTask );
break;
@ -1174,7 +1155,7 @@ void CHGrunt :: PainSound ( void )
return;
}
}
#endif
#endif
switch ( RANDOM_LONG(0,6) )
{
case 0:
@ -1457,7 +1438,6 @@ Schedule_t slGruntSuppress[] =
},
};
//=========================================================
// grunt wait in cover - we don't allow danger or the ability
// to attack to break a grunt's run to cover schedule, but
@ -1541,7 +1521,6 @@ Schedule_t slGruntGrenadeCover[] =
},
};
//=========================================================
// drop grenade then run to cover.
//=========================================================
@ -1687,7 +1666,6 @@ Schedule_t slGruntRangeAttack1A[] =
},
};
//=========================================================
// primary range attack. Overriden because base class stops attacking when the enemy is occluded.
// grunt's grenade toss requires the enemy be occluded.
@ -1750,7 +1728,6 @@ Schedule_t slGruntRangeAttack2[] =
},
};
//=========================================================
// repel
//=========================================================
@ -1779,7 +1756,6 @@ Schedule_t slGruntRepel[] =
},
};
//=========================================================
// repel
//=========================================================
@ -1858,7 +1834,7 @@ DEFINE_CUSTOM_SCHEDULES( CHGrunt )
slGruntRepelLand,
};
IMPLEMENT_CUSTOM_SCHEDULES( CHGrunt, CSquadMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CHGrunt, CSquadMonster )
//=========================================================
// SetActivity
@ -2216,7 +2192,7 @@ Schedule_t *CHGrunt :: GetSchedule( void )
default:
break;
}
// no special cases here, call the base class
return CSquadMonster :: GetSchedule();
}
@ -2374,7 +2350,6 @@ Schedule_t* CHGrunt :: GetScheduleOfType ( int Type )
}
}
//=========================================================
// CHGruntRepel - when triggered, spawns a monster_human_grunt
// repelling down a line.
@ -2389,7 +2364,7 @@ public:
int m_iSpriteTexture; // Don't save, precache
};
LINK_ENTITY_TO_CLASS( monster_grunt_repel, CHGruntRepel );
LINK_ENTITY_TO_CLASS( monster_grunt_repel, CHGruntRepel )
void CHGruntRepel::Spawn( void )
{
@ -2432,8 +2407,6 @@ void CHGruntRepel::RepelUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE
UTIL_Remove( this );
}
//=========================================================
// DEAD HGRUNT PROP
//=========================================================
@ -2462,7 +2435,7 @@ void CDeadHGrunt::KeyValue( KeyValueData *pkvd )
CBaseMonster::KeyValue( pkvd );
}
LINK_ENTITY_TO_CLASS( monster_hgrunt_dead, CDeadHGrunt );
LINK_ENTITY_TO_CLASS( monster_hgrunt_dead, CDeadHGrunt )
//=========================================================
// ********** DeadHGrunt SPAWN **********

View File

@ -25,23 +25,22 @@
#include "hornet.h"
#include "gamerules.h"
int iHornetTrail;
int iHornetPuff;
LINK_ENTITY_TO_CLASS( hornet, CHornet );
LINK_ENTITY_TO_CLASS( hornet, CHornet )
//=========================================================
// Save/Restore
//=========================================================
TYPEDESCRIPTION CHornet::m_SaveData[] =
TYPEDESCRIPTION CHornet::m_SaveData[] =
{
DEFINE_FIELD( CHornet, m_flStopAttack, FIELD_TIME ),
DEFINE_FIELD( CHornet, m_iHornetType, FIELD_INTEGER ),
DEFINE_FIELD( CHornet, m_flFlySpeed, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CHornet, CBaseMonster );
IMPLEMENT_SAVERESTORE( CHornet, CBaseMonster )
//=========================================================
// don't let hornets gib, ever.
@ -114,7 +113,6 @@ void CHornet :: Spawn( void )
ResetSequenceInfo( );
}
void CHornet :: Precache()
{
PRECACHE_MODEL("models/hornet.mdl");
@ -215,7 +213,6 @@ old colors
break;
*/
// trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMFOLLOW );
@ -264,7 +261,8 @@ void CHornet :: TrackTarget ( void )
// UNDONE: The player pointer should come back after returning from another level
if ( m_hEnemy == NULL )
{// enemy is dead.
{
// enemy is dead.
Look( 512 );
m_hEnemy = BestVisibleEnemy( );
}
@ -289,7 +287,8 @@ void CHornet :: TrackTarget ( void )
flDelta = DotProduct ( vecFlightDir, vecDirToEnemy );
if ( flDelta < 0.5 )
{// hafta turn wide again. play sound
{
// hafta turn wide again. play sound
switch (RANDOM_LONG(0,2))
{
case 0: EMIT_SOUND( ENT(pev), CHAN_VOICE, "hornet/ag_buzz1.wav", HORNET_BUZZ_VOLUME, ATTN_NORM); break;
@ -299,7 +298,8 @@ void CHornet :: TrackTarget ( void )
}
if ( flDelta <= 0 && m_iHornetType == HORNET_TYPE_RED )
{// no flying backwards, but we don't want to invert this, cause we'd go fast when we have to turn REAL far.
{
// no flying backwards, but we don't want to invert this, cause we'd go fast when we have to turn REAL far.
flDelta = 0.25;
}
@ -308,7 +308,6 @@ void CHornet :: TrackTarget ( void )
if ( pev->owner && (pev->owner->v.flags & FL_MONSTER) )
{
// random pattern only applies to hornets fired by monsters, not players.
pev->velocity.x += RANDOM_FLOAT ( -0.10, 0.10 );// scramble the flight dir a bit.
pev->velocity.y += RANDOM_FLOAT ( -0.10, 0.10 );
pev->velocity.z += RANDOM_FLOAT ( -0.10, 0.10 );
@ -367,7 +366,8 @@ void CHornet :: TrackTarget ( void )
void CHornet :: TrackTouch ( CBaseEntity *pOther )
{
if ( pOther->edict() == pev->owner || pOther->pev->modelindex == pev->modelindex )
{// bumped into the guy that shot it.
{
// bumped into the guy that shot it.
pev->solid = SOLID_NOT;
return;
}
@ -398,10 +398,11 @@ void CHornet::DartTouch( CBaseEntity *pOther )
void CHornet::DieTouch ( CBaseEntity *pOther )
{
if ( pOther && pOther->pev->takedamage )
{// do the damage
{
// do the damage
switch (RANDOM_LONG(0,2))
{// buzz when you plug someone
{
// buzz when you plug someone
case 0: EMIT_SOUND( ENT(pev), CHAN_VOICE, "hornet/ag_hornethit1.wav", 1, ATTN_NORM); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_VOICE, "hornet/ag_hornethit2.wav", 1, ATTN_NORM); break;
case 2: EMIT_SOUND( ENT(pev), CHAN_VOICE, "hornet/ag_hornethit3.wav", 1, ATTN_NORM); break;
@ -416,4 +417,3 @@ void CHornet::DieTouch ( CBaseEntity *pOther )
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 1;// stick around long enough for the sound to finish!
}

View File

@ -24,7 +24,6 @@
#include "hornet.h"
#include "gamerules.h"
enum hgun_e {
HGUN_IDLE1 = 0,
HGUN_FIDGETSWAY,
@ -40,8 +39,7 @@ enum firemode_e
FIREMODE_FAST
};
LINK_ENTITY_TO_CLASS( weapon_hornetgun, CHgun );
LINK_ENTITY_TO_CLASS( weapon_hornetgun, CHgun )
BOOL CHgun::IsUseable( void )
{
@ -60,7 +58,6 @@ void CHgun::Spawn( )
FallInit();// get ready to fall down.
}
void CHgun::Precache( void )
{
PRECACHE_MODEL("models/v_hgun.mdl");
@ -76,7 +73,6 @@ int CHgun::AddToPlayer( CBasePlayer *pPlayer )
{
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{
#ifndef CLIENT_DLL
if ( g_pGameRules->IsMultiplayer() )
{
@ -84,7 +80,6 @@ int CHgun::AddToPlayer( CBasePlayer *pPlayer )
pPlayer->m_rgAmmo[ PrimaryAmmoIndex() ] = HORNET_MAX_CARRY;
}
#endif
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId );
MESSAGE_END();
@ -110,7 +105,6 @@ int CHgun::GetItemInfo(ItemInfo *p)
return 1;
}
BOOL CHgun::Deploy( )
{
return DefaultDeploy( "models/v_hgun.mdl", "models/p_hgun.mdl", HGUN_UP, "hive" );
@ -128,7 +122,6 @@ void CHgun::Holster( int skiplocal /* = 0 */ )
}
}
void CHgun::PrimaryAttack()
{
Reload( );
@ -137,7 +130,6 @@ void CHgun::PrimaryAttack()
{
return;
}
#ifndef CLIENT_DLL
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
@ -146,10 +138,8 @@ void CHgun::PrimaryAttack()
m_flRechargeTime = gpGlobals->time + 0.5;
#endif
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
@ -162,8 +152,6 @@ void CHgun::PrimaryAttack()
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, FIREMODE_TRACK, 0, 0, 0 );
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
@ -177,8 +165,6 @@ void CHgun::PrimaryAttack()
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
void CHgun::SecondaryAttack( void )
{
Reload();
@ -239,17 +225,14 @@ void CHgun::SecondaryAttack( void )
m_flRechargeTime = gpGlobals->time + 0.5;
#endif
int flags;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, FIREMODE_FAST, 0, 0, 0 );
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH;
@ -261,7 +244,6 @@ void CHgun::SecondaryAttack( void )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
void CHgun::Reload( void )
{
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= HORNET_MAX_CARRY)
@ -274,7 +256,6 @@ void CHgun::Reload( void )
}
}
void CHgun::WeaponIdle( void )
{
Reload( );
@ -301,5 +282,4 @@ void CHgun::WeaponIdle( void )
}
SendWeaponAnim( iAnim );
}
#endif
#endif

View File

@ -59,7 +59,7 @@ enum
{
SCHED_HOUND_AGITATED = LAST_COMMON_SCHEDULE + 1,
SCHED_HOUND_HOP_RETREAT,
SCHED_HOUND_FAIL,
SCHED_HOUND_FAIL
};
//=========================================================
@ -99,10 +99,10 @@ public:
Schedule_t *GetScheduleOfType ( int Type );
Schedule_t *GetSchedule( void );
int Save( CSave &save );
int Save( CSave &save );
int Restore( CRestore &restore );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
static TYPEDESCRIPTION m_SaveData[];
int m_iSpriteTexture;
@ -110,7 +110,8 @@ public:
BOOL m_fDontBlink;// don't try to open/close eye if this bit is set!
Vector m_vecPackCenter; // the center of the pack. The leader maintains this by averaging the origins of all pack members.
};
LINK_ENTITY_TO_CLASS( monster_houndeye, CHoundeye );
LINK_ENTITY_TO_CLASS( monster_houndeye, CHoundeye )
TYPEDESCRIPTION CHoundeye::m_SaveData[] =
{
@ -120,7 +121,7 @@ TYPEDESCRIPTION CHoundeye::m_SaveData[] =
DEFINE_FIELD( CHoundeye, m_vecPackCenter, FIELD_POSITION_VECTOR ),
};
IMPLEMENT_SAVERESTORE( CHoundeye, CSquadMonster );
IMPLEMENT_SAVERESTORE( CHoundeye, CSquadMonster )
//=========================================================
// Classify - indicates this monster's place in the
@ -548,7 +549,6 @@ void CHoundeye :: WriteBeamColor ( void )
WRITE_BYTE( bGreen );
WRITE_BYTE( bBlue );
}
//=========================================================
// SonicAttack
@ -608,7 +608,6 @@ void CHoundeye :: SonicAttack ( void )
WRITE_BYTE( 0 ); // speed
MESSAGE_END();
CBaseEntity *pEntity = NULL;
// iterate on all entities in the vicinity.
while ((pEntity = UTIL_FindEntityInSphere( pEntity, pev->origin, HOUNDEYE_MAX_ATTACK_RADIUS )) != NULL)
@ -616,8 +615,8 @@ void CHoundeye :: SonicAttack ( void )
if ( pEntity->pev->takedamage != DAMAGE_NO )
{
if ( !FClassnameIs(pEntity->pev, "monster_houndeye") )
{// houndeyes don't hurt other houndeyes with their attack
{
// houndeyes don't hurt other houndeyes with their attack
// houndeyes do FULL damage if the ent in question is visible. Half damage otherwise.
// This means that you must get out of the houndeye's attack range entirely to avoid damage.
// Calculate full damage first
@ -663,7 +662,7 @@ void CHoundeye :: SonicAttack ( void )
}
}
}
//=========================================================
// start task
//=========================================================
@ -745,7 +744,6 @@ void CHoundeye :: StartTask ( Task_t *pTask )
}
}
*/
break;
}
case TASK_SPECIAL_ATTACK1:
@ -782,7 +780,6 @@ void CHoundeye :: RunTask ( Task_t *pTask )
{
TaskComplete();
}
break;
}
case TASK_HOUND_CLOSE_EYE:
@ -827,7 +824,6 @@ void CHoundeye :: RunTask ( Task_t *pTask )
SonicAttack();
TaskComplete();
}
break;
}
default:
@ -853,11 +849,13 @@ void CHoundeye::PrescheduleThink ( void )
if ( !m_fDontBlink )
{
if ( ( pev->skin == 0 ) && RANDOM_LONG(0,0x7F) == 0 )
{// start blinking!
{
// start blinking!
pev->skin = HOUNDEYE_EYE_FRAMES - 1;
}
else if ( pev->skin != 0 )
{// already blinking
{
// already blinking
pev->skin--;
}
}
@ -964,7 +962,7 @@ Task_t tlHoundSleep[] =
Schedule_t slHoundSleep[] =
{
{
{
tlHoundSleep,
ARRAYSIZE ( tlHoundSleep ),
bits_COND_HEAR_SOUND |
@ -1020,7 +1018,6 @@ Schedule_t slHoundWakeUrgent[] =
},
};
Task_t tlHoundSpecialAttack1[] =
{
{ TASK_STOP_MOVING, 0 },
@ -1140,7 +1137,7 @@ DEFINE_CUSTOM_SCHEDULES( CHoundeye )
slHoundCombatFailNoPVS,
};
IMPLEMENT_CUSTOM_SCHEDULES( CHoundeye, CSquadMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CHoundeye, CSquadMonster )
//=========================================================
// GetScheduleOfType
@ -1259,7 +1256,7 @@ Schedule_t *CHoundeye :: GetSchedule( void )
{
case MONSTERSTATE_COMBAT:
{
// dead enemy
// dead enemy
if ( HasConditions( bits_COND_ENEMY_DEAD ) )
{
// call base class, all code to handle dead enemies is centralized there.

View File

@ -23,7 +23,7 @@
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
#include "flyingmonster.h"
#include "flyingmonster.h"
#include "nodes.h"
#include "soundent.h"
#include "animation.h"
@ -42,8 +42,6 @@ extern CGraph WorldGraph;
#define EYE_BACK 3
#define EYE_LOOK 4
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
@ -57,7 +55,7 @@ public:
void SetYawSpeed( void );
int Classify( void );
void HandleAnimEvent( MonsterEvent_t *pEvent );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
int Save( CSave &save );
int Restore( CRestore &restore );
@ -123,9 +121,9 @@ public:
void PainSound( void );
};
LINK_ENTITY_TO_CLASS( monster_ichthyosaur, CIchthyosaur );
LINK_ENTITY_TO_CLASS( monster_ichthyosaur, CIchthyosaur )
TYPEDESCRIPTION CIchthyosaur::m_SaveData[] =
TYPEDESCRIPTION CIchthyosaur::m_SaveData[] =
{
DEFINE_FIELD( CIchthyosaur, m_SaveVelocity, FIELD_VECTOR ),
DEFINE_FIELD( CIchthyosaur, m_idealDist, FIELD_FLOAT ),
@ -138,10 +136,9 @@ TYPEDESCRIPTION CIchthyosaur::m_SaveData[] =
DEFINE_FIELD( CIchthyosaur, m_flNextAlert, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CIchthyosaur, CFlyingMonster );
IMPLEMENT_SAVERESTORE( CIchthyosaur, CFlyingMonster )
const char *CIchthyosaur::pIdleSounds[] =
const char *CIchthyosaur::pIdleSounds[] =
{
"ichy/ichy_idle1.wav",
"ichy/ichy_idle2.wav",
@ -149,32 +146,32 @@ const char *CIchthyosaur::pIdleSounds[] =
"ichy/ichy_idle4.wav",
};
const char *CIchthyosaur::pAlertSounds[] =
const char *CIchthyosaur::pAlertSounds[] =
{
"ichy/ichy_alert2.wav",
"ichy/ichy_alert3.wav",
};
const char *CIchthyosaur::pAttackSounds[] =
const char *CIchthyosaur::pAttackSounds[] =
{
"ichy/ichy_attack1.wav",
"ichy/ichy_attack2.wav",
};
const char *CIchthyosaur::pBiteSounds[] =
const char *CIchthyosaur::pBiteSounds[] =
{
"ichy/ichy_bite1.wav",
"ichy/ichy_bite2.wav",
};
const char *CIchthyosaur::pPainSounds[] =
const char *CIchthyosaur::pPainSounds[] =
{
"ichy/ichy_pain2.wav",
"ichy/ichy_pain3.wav",
"ichy/ichy_pain5.wav",
};
const char *CIchthyosaur::pDieSounds[] =
const char *CIchthyosaur::pDieSounds[] =
{
"ichy/ichy_die2.wav",
"ichy/ichy_die4.wav",
@ -183,7 +180,6 @@ const char *CIchthyosaur::pDieSounds[] =
#define EMIT_ICKY_SOUND( chan, array ) \
EMIT_SOUND_DYN ( ENT(pev), chan , array [ RANDOM_LONG(0,ARRAYSIZE( array )-1) ], 1.0, 0.6, 0, RANDOM_LONG(95,105) );
void CIchthyosaur :: IdleSound( void )
{
EMIT_ICKY_SOUND( CHAN_VOICE, pIdleSounds );
@ -221,7 +217,7 @@ enum
{
TASK_ICHTHYOSAUR_CIRCLE_ENEMY = LAST_COMMON_TASK + 1,
TASK_ICHTHYOSAUR_SWIM,
TASK_ICHTHYOSAUR_FLOAT,
TASK_ICHTHYOSAUR_FLOAT
};
//=========================================================
@ -268,7 +264,6 @@ static Schedule_t slSwimAgitated[] =
},
};
static Task_t tlCircleEnemy[] =
{
{ TASK_SET_ACTIVITY, (float)ACT_WALK },
@ -290,7 +285,6 @@ static Schedule_t slCircleEnemy[] =
},
};
Task_t tlTwitchDie[] =
{
{ TASK_STOP_MOVING, 0 },
@ -310,15 +304,15 @@ Schedule_t slTwitchDie[] =
},
};
DEFINE_CUSTOM_SCHEDULES(CIchthyosaur)
DEFINE_CUSTOM_SCHEDULES( CIchthyosaur )
{
slSwimAround,
slSwimAgitated,
slCircleEnemy,
slTwitchDie,
};
IMPLEMENT_CUSTOM_SCHEDULES(CIchthyosaur, CFlyingMonster);
IMPLEMENT_CUSTOM_SCHEDULES( CIchthyosaur, CFlyingMonster )
//=========================================================
// Classify - indicates this monster's place in the
@ -329,7 +323,6 @@ int CIchthyosaur :: Classify ( void )
return CLASS_ALIEN_MONSTER;
}
//=========================================================
// CheckMeleeAttack1
//=========================================================
@ -390,8 +383,6 @@ void CIchthyosaur :: SetYawSpeed ( void )
pev->yaw_speed = 100;
}
//=========================================================
// Killed - overrides CFlyingMonster.
//
@ -413,7 +404,6 @@ void CIchthyosaur::BecomeDead( void )
#define ICHTHYOSAUR_AE_SHAKE_RIGHT 1
#define ICHTHYOSAUR_AE_SHAKE_LEFT 2
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
@ -569,7 +559,6 @@ Schedule_t* CIchthyosaur::GetSchedule()
return CFlyingMonster :: GetSchedule();
}
//=========================================================
//=========================================================
Schedule_t* CIchthyosaur :: GetScheduleOfType ( int Type )
@ -592,8 +581,6 @@ Schedule_t* CIchthyosaur :: GetScheduleOfType ( int Type )
return CBaseMonster :: GetScheduleOfType( Type );
}
//=========================================================
// Start task - selects the correct activity and performs
// any necessary calculations to start the next task on the
@ -619,12 +606,10 @@ void CIchthyosaur::StartTask(Task_t *pTask)
}
CFlyingMonster::StartTask(pTask);
break;
case TASK_ICHTHYOSAUR_FLOAT:
pev->skin = EYE_BASE;
SetSequenceByName( "bellyup" );
break;
default:
CFlyingMonster::StartTask(pTask);
break;
@ -646,7 +631,7 @@ void CIchthyosaur :: RunTask ( Task_t *pTask )
Vector vecDelta = (pev->origin - vecFrom).Normalize( );
Vector vecSwim = CrossProduct( vecDelta, Vector( 0, 0, 1 ) ).Normalize( );
if (DotProduct( vecSwim, m_SaveVelocity ) < 0)
vecSwim = vecSwim * -1.0;
@ -655,7 +640,7 @@ void CIchthyosaur :: RunTask ( Task_t *pTask )
// ALERT( at_console, "vecPos %.0f %.0f %.0f\n", vecPos.x, vecPos.y, vecPos.z );
TraceResult tr;
UTIL_TraceHull( vecFrom, vecPos, ignore_monsters, large_hull, m_hEnemy->edict(), &tr );
if (tr.flFraction > 0.5)
@ -728,7 +713,6 @@ void CIchthyosaur :: RunTask ( Task_t *pTask )
TaskComplete( );
}
break;
case TASK_ICHTHYOSAUR_FLOAT:
pev->angles.x = UTIL_ApproachAngle( 0, pev->angles.x, 20 );
pev->velocity = pev->velocity * 0.8;
@ -742,15 +726,12 @@ void CIchthyosaur :: RunTask ( Task_t *pTask )
}
// ALERT( at_console, "%f\n", pev->velocity.z );
break;
default:
CFlyingMonster :: RunTask ( pTask );
break;
}
}
float CIchthyosaur::VectorToPitch( const Vector &vec )
{
float pitch;
@ -835,7 +816,6 @@ float CIchthyosaur::ChangeYaw( int speed )
return CFlyingMonster::ChangeYaw( speed );
}
Activity CIchthyosaur:: GetStoppedActivity( void )
{
if ( pev->movetype != MOVETYPE_FLY ) // UNDONE: Ground idle here, IDLE may be something else
@ -848,7 +828,6 @@ void CIchthyosaur::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, f
m_SaveVelocity = vecDir * m_flightSpeed;
}
void CIchthyosaur::MonsterThink ( void )
{
CFlyingMonster::MonsterThink( );
@ -925,7 +904,6 @@ void CIchthyosaur::Swim( )
pev->framerate = m_flightSpeed / 150.0;
// ALERT( at_console, "run %.2f\n", pev->framerate );
}
/*
if (!m_pBeam)
{
@ -965,16 +943,13 @@ void CIchthyosaur::Swim( )
// ALERT( at_console, "%.0f %.0f\n", m_flightSpeed, pev->velocity.Length() );
// ALERT( at_console, "Steer %f %f %f\n", SteeringVector.x, SteeringVector.y, SteeringVector.z );
/*
m_pBeam->SetStartPos( pev->origin + pev->velocity );
m_pBeam->RelinkBeam( );
*/
// ALERT( at_console, "speed %f\n", m_flightSpeed );
Angles = UTIL_VecToAngles( m_SaveVelocity );
// Smooth Pitch
@ -1068,7 +1043,6 @@ void CIchthyosaur::Swim( )
// UTIL_MoveToOrigin ( ENT(pev), pev->origin + Forward * speed, speed, MOVE_STRAFE );
}
Vector CIchthyosaur::DoProbe(const Vector &Probe)
{
Vector WallNormal = Vector(0,0,-1); // WATER normal is Straight Down for fish.
@ -1107,5 +1081,4 @@ Vector CIchthyosaur::DoProbe(const Vector &Probe)
}
return Vector(0, 0, 0);
}
#endif

View File

@ -62,12 +62,12 @@ public:
void Killed( entvars_t *pevAttacker, int iGib );
void StartTask ( Task_t *pTask );
void StartTask ( Task_t *pTask );
Schedule_t *GetSchedule( void );
Schedule_t *GetScheduleOfType ( int Type );
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
int Save( CSave &save );
int Save( CSave &save );
int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
@ -93,9 +93,9 @@ public:
static const char *pPainSounds[];
static const char *pDeathSounds[];
};
LINK_ENTITY_TO_CLASS( monster_alien_slave, CISlave );
LINK_ENTITY_TO_CLASS( monster_vortigaunt, CISlave );
LINK_ENTITY_TO_CLASS( monster_alien_slave, CISlave )
LINK_ENTITY_TO_CLASS( monster_vortigaunt, CISlave )
TYPEDESCRIPTION CISlave::m_SaveData[] =
{
@ -111,31 +111,28 @@ TYPEDESCRIPTION CISlave::m_SaveData[] =
};
IMPLEMENT_SAVERESTORE( CISlave, CSquadMonster );
IMPLEMENT_SAVERESTORE( CISlave, CSquadMonster )
const char *CISlave::pAttackHitSounds[] =
const char *CISlave::pAttackHitSounds[] =
{
"zombie/claw_strike1.wav",
"zombie/claw_strike2.wav",
"zombie/claw_strike3.wav",
};
const char *CISlave::pAttackMissSounds[] =
const char *CISlave::pAttackMissSounds[] =
{
"zombie/claw_miss1.wav",
"zombie/claw_miss2.wav",
};
const char *CISlave::pPainSounds[] =
const char *CISlave::pPainSounds[] =
{
"aslave/slv_pain1.wav",
"aslave/slv_pain2.wav",
};
const char *CISlave::pDeathSounds[] =
const char *CISlave::pDeathSounds[] =
{
"aslave/slv_die1.wav",
"aslave/slv_die2.wav",
@ -145,12 +142,11 @@ const char *CISlave::pDeathSounds[] =
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int CISlave :: Classify ( void )
int CISlave :: Classify ( void )
{
return CLASS_ALIEN_MILITARY;
}
int CISlave::IRelationship( CBaseEntity *pTarget )
{
if ( (pTarget->IsPlayer()) )
@ -159,7 +155,6 @@ int CISlave::IRelationship( CBaseEntity *pTarget )
return CBaseMonster::IRelationship( pTarget );
}
void CISlave :: CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation )
{
// ALERT( at_aiconsole, "help " );
@ -185,7 +180,6 @@ void CISlave :: CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Ve
}
}
//=========================================================
// ALertSound - scream
//=========================================================
@ -208,7 +202,6 @@ void CISlave :: IdleSound( void )
{
SENTENCEG_PlayRndSz(ENT(pev), "SLV_IDLE", 0.85, ATTN_NORM, 0, m_voicePitch);
}
#if 0
int side = RANDOM_LONG( 0, 1 ) * 2 - 1;
@ -254,7 +247,6 @@ void CISlave :: DeathSound( void )
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pDeathSounds[ RANDOM_LONG(0,ARRAYSIZE(pDeathSounds)-1) ], 1.0, ATTN_NORM, 0, m_voicePitch );
}
//=========================================================
// ISoundMask - returns a bit mask indicating which types
// of sounds this monster regards.
@ -267,7 +259,6 @@ int CISlave :: ISoundMask ( void)
bits_SOUND_PLAYER;
}
void CISlave::Killed( entvars_t *pevAttacker, int iGib )
{
ClearBeams( );
@ -332,8 +323,7 @@ void CISlave :: HandleAnimEvent( MonsterEvent_t *pEvent )
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, m_voicePitch );
}
}
break;
break;
case ISLAVE_AE_CLAWRAKE:
{
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.slaveDmgClawrake, DMG_SLASH );
@ -351,8 +341,7 @@ void CISlave :: HandleAnimEvent( MonsterEvent_t *pEvent )
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, m_voicePitch );
}
}
break;
break;
case ISLAVE_AE_ZAP_POWERUP:
{
// speed up attack when on hard
@ -393,8 +382,7 @@ void CISlave :: HandleAnimEvent( MonsterEvent_t *pEvent )
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 + m_iBeams * 10 );
pev->skin = m_iBeams / 2;
}
break;
break;
case ISLAVE_AE_ZAP_SHOOT:
{
ClearBeams( );
@ -414,7 +402,6 @@ void CISlave :: HandleAnimEvent( MonsterEvent_t *pEvent )
WackBeam( 1, pNew );
UTIL_Remove( m_hDead );
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "hassault/hw_shoot1.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 130, 160 ) );
/*
CBaseEntity *pEffect = Create( "test_effect", pNew->Center(), pev->angles );
pEffect->Use( this, this, USE_ON, 1 );
@ -435,14 +422,12 @@ void CISlave :: HandleAnimEvent( MonsterEvent_t *pEvent )
m_flNextAttack = gpGlobals->time + RANDOM_FLOAT( 0.5, 4.0 );
}
break;
break;
case ISLAVE_AE_ZAP_DONE:
{
ClearBeams( );
}
break;
break;
default:
CSquadMonster::HandleAnimEvent( pEvent );
break;
@ -507,7 +492,6 @@ BOOL CISlave :: CheckRangeAttack2 ( float flDot, float flDist )
return FALSE;
}
//=========================================================
// StartTask
//=========================================================
@ -518,7 +502,6 @@ void CISlave :: StartTask ( Task_t *pTask )
CSquadMonster :: StartTask ( pTask );
}
//=========================================================
// Spawn
//=========================================================
@ -576,7 +559,6 @@ void CISlave :: Precache()
UTIL_PrecacheOther( "test_effect" );
}
//=========================================================
// TakeDamage - get provoked when injured
//=========================================================
@ -591,7 +573,6 @@ int CISlave :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, floa
return CSquadMonster::TakeDamage(pevInflictor, pevAttacker, flDamage, bitsDamageType);
}
void CISlave::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if (bitsDamageType & DMG_SHOCK)
@ -600,13 +581,10 @@ void CISlave::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
CSquadMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );
}
//=========================================================
// AI Schedules Specific to this monster
//=========================================================
// primary range attack
Task_t tlSlaveAttack1[] =
{
@ -629,21 +607,18 @@ Schedule_t slSlaveAttack1[] =
},
};
DEFINE_CUSTOM_SCHEDULES( CISlave )
{
slSlaveAttack1,
};
IMPLEMENT_CUSTOM_SCHEDULES( CISlave, CSquadMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CISlave, CSquadMonster )
//=========================================================
//=========================================================
Schedule_t *CISlave :: GetSchedule( void )
{
ClearBeams( );
/*
if (pev->spawnflags)
{
@ -651,7 +626,6 @@ Schedule_t *CISlave :: GetSchedule( void )
return GetScheduleOfType( SCHED_RELOAD );
}
*/
if ( HasConditions( bits_COND_HEAR_SOUND ) )
{
CSound *pSound;
@ -698,10 +672,9 @@ Schedule_t *CISlave :: GetSchedule( void )
return CSquadMonster::GetSchedule( );
}
Schedule_t *CISlave :: GetScheduleOfType ( int Type )
{
switch ( Type )
switch( Type )
{
case SCHED_FAIL:
if (HasConditions( bits_COND_CAN_MELEE_ATTACK1 ))
@ -717,7 +690,6 @@ Schedule_t *CISlave :: GetScheduleOfType ( int Type )
return CSquadMonster :: GetScheduleOfType( Type );
}
//=========================================================
// ArmBeam - small beam from arm to nearby geometry
//=========================================================
@ -764,7 +736,6 @@ void CISlave :: ArmBeam( int side )
m_iBeams++;
}
//=========================================================
// BeamGlow - brighten all beams
//=========================================================
@ -783,7 +754,6 @@ void CISlave :: BeamGlow( )
}
}
//=========================================================
// WackBeam - regenerate dead colleagues
//=========================================================
@ -791,7 +761,7 @@ void CISlave :: WackBeam( int side, CBaseEntity *pEntity )
{
Vector vecDest;
float flDist = 1.0;
if (m_iBeams >= ISLAVE_MAX_BEAMS)
return;
@ -847,7 +817,6 @@ void CISlave :: ZapBeam( int side )
UTIL_EmitAmbientSound( ENT(pev), tr.vecEndPos, "weapons/electro4.wav", 0.5, ATTN_NORM, 0, RANDOM_LONG( 140, 160 ) );
}
//=========================================================
// ClearBeams - remove all beams
//=========================================================

View File

@ -39,7 +39,7 @@ public:
int m_iType;
};
LINK_ENTITY_TO_CLASS(world_items, CWorldItem);
LINK_ENTITY_TO_CLASS(world_items, CWorldItem)
void CWorldItem::KeyValue(KeyValueData *pkvd)
{
@ -86,7 +86,6 @@ void CWorldItem::Spawn( void )
REMOVE_ENTITY(edict());
}
void CItem::Spawn( void )
{
pev->movetype = MOVETYPE_TOSS;
@ -198,9 +197,7 @@ class CItemSuit : public CItem
}
};
LINK_ENTITY_TO_CLASS(item_suit, CItemSuit);
LINK_ENTITY_TO_CLASS(item_suit, CItemSuit)
class CItemBattery : public CItem
{
@ -236,17 +233,16 @@ class CItemBattery : public CItem
MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev );
WRITE_STRING( STRING(pev->classname) );
MESSAGE_END();
// Suit reports new power level
// For some reason this wasn't working in release build -- round it.
pct = (int)( (float)(pPlayer->pev->armorvalue * 100.0) * (1.0/MAX_NORMAL_BATTERY) + 0.5);
pct = (pct / 5);
if (pct > 0)
pct--;
sprintf( szcharge,"!HEV_%1dP", pct );
//EMIT_SOUND_SUIT(ENT(pev), szcharge);
pPlayer->SetSuitUpdate(szcharge, FALSE, SUIT_NEXT_IN_30SEC);
return TRUE;
@ -255,8 +251,7 @@ class CItemBattery : public CItem
}
};
LINK_ENTITY_TO_CLASS(item_battery, CItemBattery);
LINK_ENTITY_TO_CLASS( item_battery, CItemBattery )
class CItemAntidote : public CItem
{
@ -279,8 +274,7 @@ class CItemAntidote : public CItem
}
};
LINK_ENTITY_TO_CLASS(item_antidote, CItemAntidote);
LINK_ENTITY_TO_CLASS( item_antidote, CItemAntidote )
class CItemSecurity : public CItem
{
@ -301,7 +295,7 @@ class CItemSecurity : public CItem
}
};
LINK_ENTITY_TO_CLASS(item_security, CItemSecurity);
LINK_ENTITY_TO_CLASS( item_security, CItemSecurity )
class CItemLongJump : public CItem
{
@ -339,4 +333,4 @@ class CItemLongJump : public CItem
}
};
LINK_ENTITY_TO_CLASS( item_longjump, CItemLongJump );
LINK_ENTITY_TO_CLASS( item_longjump, CItemLongJump )

View File

@ -15,7 +15,6 @@
#ifndef ITEMS_H
#define ITEMS_H
class CItem : public CBaseEntity
{
public:

View File

@ -34,21 +34,16 @@
// Try this on a model with hulls/tracehull?
//
#include "float.h"
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
// Animation events
#define LEECH_AE_ATTACK 1
#define LEECH_AE_FLOP 2
// Movement constants
#define LEECH_ACCELERATE 10
@ -60,15 +55,12 @@
#define LEECH_SIZEX 10
#define LEECH_FRAMETIME 0.1
#define DEBUG_BEAMS 0
#if DEBUG_BEAMS
#include "effects.h"
#endif
class CLeech : public CBaseMonster
{
public:
@ -141,11 +133,9 @@ private:
#endif
};
LINK_ENTITY_TO_CLASS( monster_leech, CLeech )
LINK_ENTITY_TO_CLASS( monster_leech, CLeech );
TYPEDESCRIPTION CLeech::m_SaveData[] =
TYPEDESCRIPTION CLeech::m_SaveData[] =
{
DEFINE_FIELD( CLeech, m_flTurning, FIELD_FLOAT ),
DEFINE_FIELD( CLeech, m_fPathBlocked, FIELD_BOOLEAN ),
@ -161,8 +151,7 @@ TYPEDESCRIPTION CLeech::m_SaveData[] =
DEFINE_FIELD( CLeech, m_attackSoundTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CLeech, CBaseMonster );
IMPLEMENT_SAVERESTORE( CLeech, CBaseMonster )
const char *CLeech::pAttackSounds[] =
{
@ -177,7 +166,6 @@ const char *CLeech::pAlertSounds[] =
"leech/leech_alert2.wav",
};
void CLeech::Spawn( void )
{
Precache();
@ -185,7 +173,7 @@ void CLeech::Spawn( void )
// Just for fun
// SET_MODEL(ENT(pev), "models/icky.mdl");
// UTIL_SetSize( pev, g_vecZero, g_vecZero );
//UTIL_SetSize( pev, g_vecZero, g_vecZero );
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;
@ -208,14 +196,11 @@ void CLeech::Spawn( void )
m_stateTime = gpGlobals->time + RANDOM_FLOAT( 1, 5 );
}
void CLeech::Activate( void )
{
RecalculateWaterlevel();
}
void CLeech::RecalculateWaterlevel( void )
{
// Calculate boundaries
@ -239,7 +224,6 @@ void CLeech::RecalculateWaterlevel( void )
m_waterTime = gpGlobals->time + RANDOM_FLOAT( 5, 7 );
}
void CLeech::SwitchLeechState( void )
{
m_stateTime = gpGlobals->time + RANDOM_FLOAT( 3, 6 );
@ -264,7 +248,6 @@ void CLeech::SwitchLeechState( void )
}
}
int CLeech::IRelationship( CBaseEntity *pTarget )
{
if ( pTarget->IsPlayer() )
@ -272,8 +255,6 @@ int CLeech::IRelationship( CBaseEntity *pTarget )
return CBaseMonster::IRelationship( pTarget );
}
void CLeech::AttackSound( void )
{
if ( gpGlobals->time > m_attackSoundTime )
@ -283,13 +264,11 @@ void CLeech::AttackSound( void )
}
}
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 );
}
void CLeech::Precache( void )
{
int i;
@ -303,7 +282,6 @@ void CLeech::Precache( void )
PRECACHE_SOUND((char *)pAlertSounds[i]);
}
int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
pev->velocity = g_vecZero;
@ -317,7 +295,6 @@ int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float f
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void CLeech::HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
@ -338,24 +315,20 @@ 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
pEnemy->TakeDamage( pev, pev, gSkillData.leechDmgBite, DMG_SLASH );
}
m_stateTime -= 2;
break;
case LEECH_AE_FLOP:
// Play flop sound
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
void CLeech::MakeVectors( void )
{
Vector tmp = pev->angles;
@ -363,7 +336,6 @@ void CLeech::MakeVectors( void )
UTIL_MakeVectors ( tmp );
}
//
// ObstacleDistance - returns normalized distance to obstacle
//
@ -419,7 +391,6 @@ float CLeech::ObstacleDistance( CBaseEntity *pTarget )
return 1.0;
}
void CLeech::DeadThink( void )
{
if ( m_fSequenceFinished )
@ -454,8 +425,6 @@ void CLeech::DeadThink( void )
}
}
void CLeech::UpdateMotion( void )
{
float flapspeed = (pev->speed - m_flAccelerate) / LEECH_ACCELERATE;
@ -530,7 +499,6 @@ void CLeech::UpdateMotion( void )
}
float flInterval = StudioFrameAdvance();
DispatchAnimEvents ( flInterval );
#if DEBUG_BEAMS
if ( !m_pb )
m_pb = CBeam::BeamCreate( "sprites/laserbeam.spr", 5 );
@ -553,7 +521,6 @@ void CLeech::UpdateMotion( void )
#endif
}
void CLeech::SwimThink( void )
{
TraceResult tr;
@ -612,9 +579,7 @@ void CLeech::SwimThink( void )
else
targetSpeed *= 2;
}
break;
default:
if ( m_zTime < gpGlobals->time )
{
@ -625,13 +590,13 @@ void CLeech::SwimThink( void )
if ( RANDOM_LONG( 0, 100 ) < 10 )
targetYaw = RANDOM_LONG( -30, 30 );
pTarget = NULL;
// oldorigin test
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;
}
break;
}
@ -686,7 +651,6 @@ void CLeech::SwimThink( void )
UpdateMotion();
}
void CLeech::Killed(entvars_t *pevAttacker, int iGib)
{
Vector vecSplatDir;
@ -719,5 +683,3 @@ void CLeech::Killed(entvars_t *pevAttacker, int iGib)
pev->takedamage = DAMAGE_NO;
SetThink( &CLeech::DeadThink );
}

View File

@ -24,8 +24,6 @@
#include "util.h"
#include "cbase.h"
class CLight : public CPointEntity
{
public:
@ -42,7 +40,8 @@ private:
int m_iStyle;
int m_iszPattern;
};
LINK_ENTITY_TO_CLASS( light, CLight );
LINK_ENTITY_TO_CLASS( light, CLight )
TYPEDESCRIPTION CLight::m_SaveData[] =
{
@ -50,8 +49,7 @@ TYPEDESCRIPTION CLight::m_SaveData[] =
DEFINE_FIELD( CLight, m_iszPattern, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CLight, CPointEntity );
IMPLEMENT_SAVERESTORE( CLight, CPointEntity )
//
// Cache user-entity-field values until spawn is called.
@ -96,7 +94,7 @@ void CLight :: Spawn( void )
if (m_iStyle >= 32)
{
// CHANGE_METHOD(ENT(pev), em_use, light_use);
//CHANGE_METHOD(ENT(pev), em_use, light_use);
if (FBitSet(pev->spawnflags, SF_LIGHT_START_OFF))
LIGHT_STYLE(m_iStyle, "a");
else if (m_iszPattern)
@ -106,7 +104,6 @@ void CLight :: Spawn( void )
}
}
void CLight :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if (m_iStyle >= 32)
@ -133,8 +130,7 @@ void CLight :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useT
//
// shut up spawn functions for new spotlights
//
LINK_ENTITY_TO_CLASS( light_spot, CLight );
LINK_ENTITY_TO_CLASS( light_spot, CLight )
class CEnvLight : public CLight
{
@ -143,7 +139,7 @@ public:
void Spawn( void );
};
LINK_ENTITY_TO_CLASS( light_environment, CEnvLight );
LINK_ENTITY_TO_CLASS( light_environment, CEnvLight )
void CEnvLight::KeyValue( KeyValueData* pkvd )
{
@ -182,7 +178,6 @@ void CEnvLight::KeyValue( KeyValueData* pkvd )
}
}
void CEnvLight :: Spawn( void )
{
char szVector[64];

View File

@ -53,8 +53,7 @@ TYPEDESCRIPTION CRuleEntity::m_SaveData[] =
DEFINE_FIELD( CRuleEntity, m_iszMaster, FIELD_STRING),
};
IMPLEMENT_SAVERESTORE( CRuleEntity, CBaseEntity );
IMPLEMENT_SAVERESTORE( CRuleEntity, CBaseEntity )
void CRuleEntity::Spawn( void )
{
@ -63,7 +62,6 @@ void CRuleEntity::Spawn( void )
pev->effects = EF_NODRAW;
}
void CRuleEntity::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "master"))
@ -122,7 +120,6 @@ void CRuleBrushEntity::Spawn( void )
CRuleEntity::Spawn();
}
// CGameScore / game_score -- award points to player / team
// Points +/- total
// Flag: Allow negative scores SF_SCORE_NEGATIVE
@ -147,15 +144,13 @@ public:
private:
};
LINK_ENTITY_TO_CLASS( game_score, CGameScore );
LINK_ENTITY_TO_CLASS( game_score, CGameScore )
void CGameScore::Spawn( void )
{
CRulePointEntity::Spawn();
}
void CGameScore::KeyValue( KeyValueData *pkvd )
{
if (FStrEq(pkvd->szKeyName, "points"))
@ -167,8 +162,6 @@ void CGameScore::KeyValue( KeyValueData *pkvd )
CRulePointEntity::KeyValue( pkvd );
}
void CGameScore::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( !CanFireForActivator( pActivator ) )
@ -188,7 +181,6 @@ void CGameScore::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
}
}
// CGameEnd / game_end -- Ends the game in MP
class CGameEnd : public CRulePointEntity
@ -198,8 +190,7 @@ public:
private:
};
LINK_ENTITY_TO_CLASS( game_end, CGameEnd );
LINK_ENTITY_TO_CLASS( game_end, CGameEnd )
void CGameEnd::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -209,16 +200,13 @@ void CGameEnd::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useT
g_pGameRules->EndMultiplayerGame();
}
//
// CGameText / game_text -- NON-Localized HUD Message (use env_message to display a titles.txt message)
// Flag: All players SF_ENVTEXT_ALLPLAYERS
//
#define SF_ENVTEXT_ALLPLAYERS 0x0001
class CGameText : public CRulePointEntity
{
public:
@ -238,7 +226,7 @@ private:
hudtextparms_t m_textParms;
};
LINK_ENTITY_TO_CLASS( game_text, CGameText );
LINK_ENTITY_TO_CLASS( game_text, CGameText )
// Save parms as a block. Will break save/restore if the structure changes, but this entity didn't ship with Half-Life, so
// it can't impact saved Half-Life games.
@ -247,8 +235,7 @@ TYPEDESCRIPTION CGameText::m_SaveData[] =
DEFINE_ARRAY( CGameText, m_textParms, FIELD_CHARACTER, sizeof(hudtextparms_t) ),
};
IMPLEMENT_SAVERESTORE( CGameText, CRulePointEntity );
IMPLEMENT_SAVERESTORE( CGameText, CRulePointEntity )
void CGameText::KeyValue( KeyValueData *pkvd )
{
@ -316,7 +303,6 @@ void CGameText::KeyValue( KeyValueData *pkvd )
CRulePointEntity::KeyValue( pkvd );
}
void CGameText::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( !CanFireForActivator( pActivator ) )
@ -335,7 +321,6 @@ void CGameText::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
}
}
//
// CGameTeamMaster / game_team_master -- "Masters" like multisource, but based on the team of the activator
// Only allows mastered entity to fire if the team matches my team
@ -367,7 +352,7 @@ private:
USE_TYPE triggerType;
};
LINK_ENTITY_TO_CLASS( game_team_master, CGameTeamMaster );
LINK_ENTITY_TO_CLASS( game_team_master, CGameTeamMaster )
void CGameTeamMaster::KeyValue( KeyValueData *pkvd )
{
@ -397,7 +382,6 @@ void CGameTeamMaster::KeyValue( KeyValueData *pkvd )
CRulePointEntity::KeyValue( pkvd );
}
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( !CanFireForActivator( pActivator ) )
@ -424,13 +408,11 @@ void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
}
BOOL CGameTeamMaster::IsTriggered( CBaseEntity *pActivator )
{
return TeamMatch( pActivator );
}
const char *CGameTeamMaster::TeamID( void )
{
if ( m_teamIndex < 0 ) // Currently set to "no team"
@ -439,7 +421,6 @@ const char *CGameTeamMaster::TeamID( void )
return g_pGameRules->GetIndexedTeamName( m_teamIndex ); // UNDONE: Fill this in with the team from the "teamlist"
}
BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator )
{
if ( m_teamIndex < 0 && AnyTeam() )
@ -451,7 +432,6 @@ BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator )
return UTIL_TeamsMatch( pActivator->TeamID(), TeamID() );
}
//
// CGameTeamSet / game_team_set -- Changes the team of the entity it targets to the activator's team
// Flag: Fire once
@ -470,8 +450,7 @@ public:
private:
};
LINK_ENTITY_TO_CLASS( game_team_set, CGameTeamSet );
LINK_ENTITY_TO_CLASS( game_team_set, CGameTeamSet )
void CGameTeamSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -493,7 +472,6 @@ void CGameTeamSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
}
}
//
// CGamePlayerZone / game_player_zone -- players in the zone fire my target when I'm fired
//
@ -515,8 +493,8 @@ private:
string_t m_iszOutCount;
};
LINK_ENTITY_TO_CLASS( game_zone_player, CGamePlayerZone );
TYPEDESCRIPTION CGamePlayerZone::m_SaveData[] =
LINK_ENTITY_TO_CLASS( game_zone_player, CGamePlayerZone )
TYPEDESCRIPTION CGamePlayerZone::m_SaveData[] =
{
DEFINE_FIELD( CGamePlayerZone, m_iszInTarget, FIELD_STRING ),
DEFINE_FIELD( CGamePlayerZone, m_iszOutTarget, FIELD_STRING ),
@ -524,7 +502,7 @@ TYPEDESCRIPTION CGamePlayerZone::m_SaveData[] =
DEFINE_FIELD( CGamePlayerZone, m_iszOutCount, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CGamePlayerZone, CRuleBrushEntity );
IMPLEMENT_SAVERESTORE( CGamePlayerZone, CRuleBrushEntity )
void CGamePlayerZone::KeyValue( KeyValueData *pkvd )
{
@ -608,13 +586,12 @@ void CGamePlayerZone::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
}
//
// CGamePlayerHurt / game_player_hurt -- Damages the player who fires it
// Flag: Fire once
#define SF_PKILL_FIREONCE 0x0001
class CGamePlayerHurt : public CRulePointEntity
{
public:
@ -624,8 +601,7 @@ public:
private:
};
LINK_ENTITY_TO_CLASS( game_player_hurt, CGamePlayerHurt );
LINK_ENTITY_TO_CLASS( game_player_hurt, CGamePlayerHurt )
void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -639,7 +615,7 @@ void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
else
pActivator->TakeDamage( pev, pev, pev->dmg, DMG_GENERIC );
}
SUB_UseTargets( pActivator, useType, value );
if ( RemoveOnFire() )
@ -648,8 +624,6 @@ void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
}
//
// CGameCounter / game_counter -- Counts events and fires target
// Flag: Fire once
@ -671,7 +645,7 @@ public:
inline void ResetCount( void ) { pev->frags = pev->dmg; }
inline int CountValue( void ) { return pev->frags; }
inline int LimitValue( void ) { return pev->health; }
inline BOOL HitLimit( void ) { return CountValue() == LimitValue(); }
private:
@ -680,7 +654,7 @@ private:
inline void SetInitialValue( int value ) { pev->dmg = value; }
};
LINK_ENTITY_TO_CLASS( game_counter, CGameCounter );
LINK_ENTITY_TO_CLASS( game_counter, CGameCounter )
void CGameCounter::Spawn( void )
{
@ -689,7 +663,6 @@ void CGameCounter::Spawn( void )
CRulePointEntity::Spawn();
}
void CGameCounter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( !CanFireForActivator( pActivator ) )
@ -701,11 +674,9 @@ void CGameCounter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
case USE_TOGGLE:
CountUp();
break;
case USE_OFF:
CountDown();
break;
case USE_SET:
SetCountValue( (int)value );
break;
@ -726,8 +697,6 @@ void CGameCounter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
}
}
//
// CGameCounterSet / game_counter_set -- Sets the counter's value
// Flag: Fire once
@ -743,8 +712,7 @@ public:
private:
};
LINK_ENTITY_TO_CLASS( game_counter_set, CGameCounterSet );
LINK_ENTITY_TO_CLASS( game_counter_set, CGameCounterSet )
void CGameCounterSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -759,7 +727,6 @@ void CGameCounterSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
}
//
// CGamePlayerEquip / game_playerequip -- Sets the default player equipment
// Flag: USE Only
@ -777,15 +744,13 @@ public:
inline BOOL UseOnly( void ) { return (pev->spawnflags & SF_PLAYEREQUIP_USEONLY) ? TRUE : FALSE; }
private:
void EquipPlayer( CBaseEntity *pPlayer );
string_t m_weaponNames[MAX_EQUIP];
int m_weaponCount[MAX_EQUIP];
};
LINK_ENTITY_TO_CLASS( game_player_equip, CGamePlayerEquip );
LINK_ENTITY_TO_CLASS( game_player_equip, CGamePlayerEquip )
void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
{
@ -811,7 +776,6 @@ void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
}
}
void CGamePlayerEquip::Touch( CBaseEntity *pOther )
{
if ( !CanFireForActivator( pOther ) )
@ -846,13 +810,11 @@ void CGamePlayerEquip::EquipPlayer( CBaseEntity *pEntity )
}
}
void CGamePlayerEquip::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
EquipPlayer( pActivator );
}
//
// CGamePlayerTeam / game_player_team -- Changes the team of the player who fired it
// Flag: Fire once
@ -869,7 +831,6 @@ public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
private:
inline BOOL RemoveOnFire( void ) { return (pev->spawnflags & SF_PTEAM_FIREONCE) ? TRUE : FALSE; }
inline BOOL ShouldKillPlayer( void ) { return (pev->spawnflags & SF_PTEAM_KILL) ? TRUE : FALSE; }
inline BOOL ShouldGibPlayer( void ) { return (pev->spawnflags & SF_PTEAM_GIB) ? TRUE : FALSE; }
@ -877,8 +838,7 @@ private:
const char *TargetTeamName( const char *pszTargetName );
};
LINK_ENTITY_TO_CLASS( game_player_team, CGamePlayerTeam );
LINK_ENTITY_TO_CLASS( game_player_team, CGamePlayerTeam )
const char *CGamePlayerTeam::TargetTeamName( const char *pszTargetName )
{
@ -893,7 +853,6 @@ const char *CGamePlayerTeam::TargetTeamName( const char *pszTargetName )
return NULL;
}
void CGamePlayerTeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( !CanFireForActivator( pActivator ) )
@ -914,5 +873,3 @@ void CGamePlayerTeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
UTIL_Remove( this );
}
}

View File

@ -15,8 +15,5 @@
#ifndef MAPRULES_H
#define MAPRULES_H
#endif // MAPRULES_H
#endif //MAPRULES_H

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#ifndef MONSTEREVENT_H
#define MONSTEREVENT_H
@ -31,4 +32,4 @@ typedef struct
#define MONSTER_EVENT_SWISHSOUND 2010
#endif // MONSTEREVENT_H
#endif //MONSTEREVENT_H

View File

@ -51,7 +51,6 @@ public:
string_t m_iszMonsterClassname;// classname of the monster(s) that will be created.
int m_cNumMonsters;// max number of monsters this ent can create
int m_cLiveChildren;// how many monsters made by this monster maker that are currently alive
int m_iMaxLiveChildren;// max number of monsters that this maker may have out at one time.
@ -62,9 +61,9 @@ public:
BOOL m_fFadeChildren;// should we make the children fadeout?
};
LINK_ENTITY_TO_CLASS( monstermaker, CMonsterMaker );
LINK_ENTITY_TO_CLASS( monstermaker, CMonsterMaker )
TYPEDESCRIPTION CMonsterMaker::m_SaveData[] =
TYPEDESCRIPTION CMonsterMaker::m_SaveData[] =
{
DEFINE_FIELD( CMonsterMaker, m_iszMonsterClassname, FIELD_STRING ),
DEFINE_FIELD( CMonsterMaker, m_cNumMonsters, FIELD_INTEGER ),
@ -75,12 +74,10 @@ TYPEDESCRIPTION CMonsterMaker::m_SaveData[] =
DEFINE_FIELD( CMonsterMaker, m_fFadeChildren, FIELD_BOOLEAN ),
};
IMPLEMENT_SAVERESTORE( CMonsterMaker, CBaseMonster );
IMPLEMENT_SAVERESTORE( CMonsterMaker, CBaseMonster )
void CMonsterMaker :: KeyValue( KeyValueData *pkvd )
{
if ( FStrEq(pkvd->szKeyName, "monstercount") )
{
m_cNumMonsters = atoi(pkvd->szValue);
@ -100,7 +97,6 @@ void CMonsterMaker :: KeyValue( KeyValueData *pkvd )
CBaseMonster::KeyValue( pkvd );
}
void CMonsterMaker :: Spawn( )
{
pev->solid = SOLID_NOT;
@ -119,21 +115,24 @@ void CMonsterMaker :: Spawn( )
}
if ( FBitSet ( pev->spawnflags, SF_MONSTERMAKER_START_ON ) )
{// start making monsters as soon as monstermaker spawns
{
// start making monsters as soon as monstermaker spawns
m_fActive = TRUE;
SetThink( &CMonsterMaker::MakerThink );
}
else
{// wait to be activated.
{
// wait to be activated.
m_fActive = FALSE;
SetThink( &CBaseEntity::SUB_DoNothing );
}
}
else
{// no targetname, just start.
pev->nextthink = gpGlobals->time + m_flDelay;
m_fActive = TRUE;
SetThink( &CMonsterMaker::MakerThink );
{
// no targetname, just start.
pev->nextthink = gpGlobals->time + m_flDelay;
m_fActive = TRUE;
SetThink( &CMonsterMaker::MakerThink );
}
if ( m_cNumMonsters == 1 )
@ -164,7 +163,8 @@ void CMonsterMaker::MakeMonster( void )
entvars_t *pevCreate;
if ( m_iMaxLiveChildren > 0 && m_cLiveChildren >= m_iMaxLiveChildren )
{// not allowed to make a new one yet. Too many live ones out right now.
{
// not allowed to make a new one yet. Too many live ones out right now.
return;
}
@ -275,7 +275,6 @@ void CMonsterMaker :: MakerThink ( void )
MakeMonster();
}
//=========================================================
//=========================================================
void CMonsterMaker :: DeathNotice ( entvars_t *pevChild )
@ -288,5 +287,3 @@ void CMonsterMaker :: DeathNotice ( entvars_t *pevChild )
pevChild->owner = NULL;
}
}

View File

@ -36,7 +36,6 @@
#define MONSTER_CUT_CORNER_DIST 8 // 8 means the monster's bounding box is contained without the box of the node in WC
Vector VecBModelOrigin( entvars_t* pevBModel );
extern DLL_GLOBAL BOOL g_fDrawLines;
@ -45,8 +44,6 @@ extern DLL_GLOBAL short g_sModelIndexLaserDot;// holds the index for the laser b
extern CGraph WorldGraph;// the world node graph
// Global Savedata for monster
// UNDONE: Save schedule data? Can this be done? We may
// lose our enemy pointer or other data (goal ent, target, etc)
@ -74,15 +71,15 @@ TYPEDESCRIPTION CBaseMonster::m_SaveData[] =
DEFINE_FIELD( CBaseMonster, m_iScheduleIndex, FIELD_INTEGER ),
DEFINE_FIELD( CBaseMonster, m_afConditions, FIELD_INTEGER ),
//WayPoint_t m_Route[ ROUTE_SIZE ];
// DEFINE_FIELD( CBaseMonster, m_movementGoal, FIELD_INTEGER ),
// DEFINE_FIELD( CBaseMonster, m_iRouteIndex, FIELD_INTEGER ),
// DEFINE_FIELD( CBaseMonster, m_moveWaitTime, FIELD_FLOAT ),
//DEFINE_FIELD( CBaseMonster, m_movementGoal, FIELD_INTEGER ),
//DEFINE_FIELD( CBaseMonster, m_iRouteIndex, FIELD_INTEGER ),
//DEFINE_FIELD( CBaseMonster, m_moveWaitTime, FIELD_FLOAT ),
DEFINE_FIELD( CBaseMonster, m_vecMoveGoal, FIELD_POSITION_VECTOR ),
DEFINE_FIELD( CBaseMonster, m_movementActivity, FIELD_INTEGER ),
// int m_iAudibleList; // first index of a linked list of sounds that the monster can hear.
// DEFINE_FIELD( CBaseMonster, m_afSoundTypes, FIELD_INTEGER ),
//int m_iAudibleList; // first index of a linked list of sounds that the monster can hear.
//DEFINE_FIELD( CBaseMonster, m_afSoundTypes, FIELD_INTEGER ),
DEFINE_FIELD( CBaseMonster, m_vecLastPosition, FIELD_POSITION_VECTOR ),
DEFINE_FIELD( CBaseMonster, m_iHintNode, FIELD_INTEGER ),
DEFINE_FIELD( CBaseMonster, m_afMemory, FIELD_INTEGER ),
@ -110,7 +107,8 @@ TYPEDESCRIPTION CBaseMonster::m_SaveData[] =
DEFINE_FIELD( CBaseMonster, m_pCine, FIELD_CLASSPTR ),
};
//IMPLEMENT_SAVERESTORE( CBaseMonster, CBaseToggle );
//IMPLEMENT_SAVERESTORE( CBaseMonster, CBaseToggle )
int CBaseMonster::Save( CSave &save )
{
if ( !CBaseToggle::Save(save) )
@ -141,7 +139,6 @@ int CBaseMonster::Restore( CRestore &restore )
return status;
}
//=========================================================
// Eat - makes a monster full for a little while.
//=========================================================
@ -244,7 +241,7 @@ void CBaseMonster :: Listen ( void )
else
{
// if not a sound, must be a smell - determine if it's just a scent, or if it's a food scent
// if ( g_pSoundEnt->m_SoundPool[ iSound ].m_iType & ( bits_SOUND_MEAT | bits_SOUND_CARCASS ) )
//if ( g_pSoundEnt->m_SoundPool[ iSound ].m_iType & ( bits_SOUND_MEAT | bits_SOUND_CARCASS ) )
if ( pCurrentSound->m_iType & ( bits_SOUND_MEAT | bits_SOUND_CARCASS ) )
{
// the detected scent is a food item, so set both conditions.
@ -258,14 +255,13 @@ void CBaseMonster :: Listen ( void )
SetConditions( bits_COND_SMELL );
}
}
// m_afSoundTypes |= g_pSoundEnt->m_SoundPool[ iSound ].m_iType;
//m_afSoundTypes |= g_pSoundEnt->m_SoundPool[ iSound ].m_iType;
m_afSoundTypes |= pCurrentSound->m_iType;
m_iAudibleList = iSound;
}
// iSound = g_pSoundEnt->m_SoundPool[ iSound ].m_iNext;
//iSound = g_pSoundEnt->m_SoundPool[ iSound ].m_iNext;
iSound = pCurrentSound->m_iNext;
}
}
@ -341,6 +337,7 @@ void CBaseMonster :: Look ( int iDistance )
CBaseMonster *pClient;
pClient = pSightEnt->MyMonsterPointer();
// don't link this client in the list if the monster is wait till seen and the player isn't facing the monster
if ( pSightEnt && !pClient->FInViewCone( this ) )
{
@ -393,7 +390,7 @@ void CBaseMonster :: Look ( int iDistance )
}
}
}
SetConditions( iSighted );
}
@ -512,8 +509,6 @@ CSound* CBaseMonster :: PBestScent ( void )
return NULL;
}
//=========================================================
// Monster Think - calls out to core AI functions and handles this
// monster's specific animation events
@ -522,13 +517,13 @@ void CBaseMonster :: MonsterThink ( void )
{
pev->nextthink = gpGlobals->time + 0.1;// keep monster thinking.
RunAI();
float flInterval = StudioFrameAdvance( ); // animate
// start or end a fidget
// This needs a better home -- switching animations over time should be encapsulated on a per-activity basis
// perhaps MaintainActivity() or a ShiftAnimationOverTime() or something.
// start or end a fidget
// This needs a better home -- switching animations over time should be encapsulated on a per-activity basis
// perhaps MaintainActivity() or a ShiftAnimationOverTime() or something.
if ( m_MonsterState != MONSTERSTATE_SCRIPT && m_MonsterState != MONSTERSTATE_DEAD && m_Activity == ACT_IDLE && m_fSequenceFinished )
{
int iSequence;
@ -671,22 +666,18 @@ BOOL CBaseMonster :: FRefreshRoute ( void )
}
returnCode = TRUE;
break;
case MOVEGOAL_ENEMY:
returnCode = BuildRoute( m_vecEnemyLKP, bits_MF_TO_ENEMY, m_hEnemy );
break;
case MOVEGOAL_LOCATION:
returnCode = BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, NULL );
break;
case MOVEGOAL_TARGETENT:
if (m_hTargetEnt != NULL)
{
returnCode = BuildRoute( m_hTargetEnt->pev->origin, bits_MF_TO_TARGETENT, m_hTargetEnt );
}
break;
case MOVEGOAL_NODE:
returnCode = FGetNodeRoute( m_vecMoveGoal );
// if ( returnCode )
@ -707,28 +698,25 @@ BOOL CBaseMonster::MoveToEnemy( Activity movementAct, float waitTime )
return FRefreshRoute();
}
BOOL CBaseMonster::MoveToLocation( Activity movementAct, float waitTime, const Vector &goal )
{
m_movementActivity = movementAct;
m_moveWaitTime = waitTime;
m_movementGoal = MOVEGOAL_LOCATION;
m_vecMoveGoal = goal;
return FRefreshRoute();
}
BOOL CBaseMonster::MoveToTarget( Activity movementAct, float waitTime )
{
m_movementActivity = movementAct;
m_moveWaitTime = waitTime;
m_movementGoal = MOVEGOAL_TARGETENT;
return FRefreshRoute();
}
BOOL CBaseMonster::MoveToNode( Activity movementAct, float waitTime, const Vector &goal )
{
m_movementActivity = movementAct;
@ -739,7 +727,6 @@ BOOL CBaseMonster::MoveToNode( Activity movementAct, float waitTime, const Vecto
return FRefreshRoute();
}
#ifdef _DEBUG
void DrawRoute( entvars_t *pev, WayPoint_t *m_Route, int m_iRouteIndex, int r, int g, int b )
{
@ -780,7 +767,6 @@ void DrawRoute( entvars_t *pev, WayPoint_t *m_Route, int m_iRouteIndex, int r, i
if ( (m_Route[ i ].iType & bits_MF_IS_GOAL) || (m_Route[ i+1 ].iType == 0) )
break;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMPOINTS );
WRITE_COORD( m_Route[ i ].vecLocation.x );
@ -807,7 +793,6 @@ void DrawRoute( entvars_t *pev, WayPoint_t *m_Route, int m_iRouteIndex, int r, i
}
#endif
int ShouldSimplify( int routeType )
{
routeType &= ~bits_MF_IS_GOAL;
@ -845,7 +830,7 @@ void CBaseMonster :: RouteSimplify( CBaseEntity *pTargetEnt )
// Can't simplify a direct route!
if ( count < 2 )
{
// DrawRoute( pev, m_Route, m_iRouteIndex, 0, 0, 255 );
//DrawRoute( pev, m_Route, m_iRouteIndex, 0, 0, 255 );
return;
}
@ -900,12 +885,12 @@ void CBaseMonster :: RouteSimplify( CBaseEntity *pTargetEnt )
ASSERT( i < count );
outRoute[outCount] = m_Route[ m_iRouteIndex + i ];
outCount++;
// Terminate
outRoute[outCount].iType = 0;
ASSERT( outCount < (ROUTE_SIZE*2) );
// Copy the simplified route, disable for testing
// Copy the simplified route, disable for testing
m_iRouteIndex = 0;
for ( i = 0; i < ROUTE_SIZE && i < outCount; i++ )
{
@ -1009,7 +994,7 @@ void CBaseMonster :: CheckAttacks ( CBaseEntity *pTarget, float flDist )
// we know the enemy is in front now. We'll find which attacks the monster is capable of by
// checking for corresponding Activities in the model file, then do the simple checks to validate
// those attack types.
// Clear all attack conditions
ClearConditions( bits_COND_CAN_RANGE_ATTACK1 | bits_COND_CAN_RANGE_ATTACK2 | bits_COND_CAN_MELEE_ATTACK1 |bits_COND_CAN_MELEE_ATTACK2 );
@ -1061,7 +1046,7 @@ int CBaseMonster :: CheckEnemy ( CBaseEntity *pEnemy )
iUpdatedLKP = FALSE;
ClearConditions ( bits_COND_ENEMY_FACING_ME );
if ( !FVisible( pEnemy ) )
{
ASSERT(!HasConditions(bits_COND_SEE_ENEMY));
@ -1078,9 +1063,11 @@ int CBaseMonster :: CheckEnemy ( CBaseEntity *pEnemy )
}
Vector vecEnemyPos = pEnemy->pev->origin;
// distance to enemy's origin
flDistToEnemy = ( vecEnemyPos - pev->origin ).Length();
vecEnemyPos.z += pEnemy->pev->size.z * 0.5;
// distance to enemy's head
float flDistToEnemy2 = (vecEnemyPos - pev->origin).Length();
if (flDistToEnemy2 < flDistToEnemy)
@ -1247,11 +1234,9 @@ void CBaseMonster :: SetActivity ( Activity NewActivity )
}
m_Activity = NewActivity; // Go ahead and set this so it doesn't keep trying when the anim is not present
// In case someone calls this with something other than the ideal activity
m_IdealActivity = m_Activity;
}
//=========================================================
@ -1306,8 +1291,7 @@ int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEn
int iReturn;
vecStartPos = pev->origin;
flYaw = UTIL_VecToYaw ( vecEnd - vecStart );// build a yaw that points to the goal.
flDist = ( vecEnd - vecStart ).Length2D();// get the distance.
iReturn = LOCALMOVE_VALID;// assume everything will be ok.
@ -1322,7 +1306,7 @@ int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEn
//pev->origin.z = vecStartPos.z;//!!!HACKHACK
// pev->origin = vecStart;
//pev->origin = vecStart;
/*
if ( flDist > 1024 )
@ -1343,12 +1327,12 @@ int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEn
if ( (flStep + LOCAL_STEP_SIZE) >= (flDist-1) )
stepSize = (flDist - flStep) - 1;
// UTIL_ParticleEffect ( pev->origin, g_vecZero, 255, 25 );
//UTIL_ParticleEffect ( pev->origin, g_vecZero, 255, 25 );
if ( !WALK_MOVE( ENT(pev), flYaw, stepSize, WALKMOVE_CHECKONLY ) )
{// can't take the next step, fail!
{
// can't take the next step, fail!
if ( pflDist != NULL )
{
*pflDist = flStep;
@ -1362,9 +1346,9 @@ int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEn
else
{
// If we're going toward an entity, and we're almost getting there, it's OK.
// if ( pTarget && fabs( flDist - iStep ) < LOCAL_STEP_SIZE )
// fReturn = TRUE;
// else
//if ( pTarget && fabs( flDist - iStep ) < LOCAL_STEP_SIZE )
// fReturn = TRUE;
//else
iReturn = LOCALMOVE_INVALID;
break;
}
@ -1399,7 +1383,6 @@ int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEn
return iReturn;
}
float CBaseMonster :: OpenDoorAndWait( entvars_t *pevDoor )
{
float flTravelTime = 0;
@ -1442,7 +1425,6 @@ float CBaseMonster :: OpenDoorAndWait( entvars_t *pevDoor )
return gpGlobals->time + flTravelTime;
}
//=========================================================
// AdvanceRoute - poorly named function that advances the
// m_iRouteIndex. If it goes beyond ROUTE_SIZE, the route
@ -1490,7 +1472,7 @@ void CBaseMonster :: AdvanceRoute ( float distance )
if (pevDoor)
{
m_flMoveWaitFinished = OpenDoorAndWait( pevDoor );
// ALERT( at_aiconsole, "Wating for door %.2f\n", m_flMoveWaitFinished-gpGlobals->time );
//ALERT( at_aiconsole, "Wating for door %.2f\n", m_flMoveWaitFinished-gpGlobals->time );
}
}
}
@ -1508,7 +1490,6 @@ void CBaseMonster :: AdvanceRoute ( float distance )
}
}
int CBaseMonster :: RouteClassify( int iMoveFlag )
{
int movementGoal;
@ -1541,11 +1522,11 @@ BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEnt
RouteNew();
m_movementGoal = RouteClassify( iMoveFlag );
// so we don't end up with no moveflags
// so we don't end up with no moveflags
m_Route[ 0 ].vecLocation = vecGoal;
m_Route[ 0 ].iType = iMoveFlag | bits_MF_IS_GOAL;
// check simple local move
// check simple local move
iLocalMove = CheckLocalMove( pev->origin, vecGoal, pTarget, &flDist );
if ( iLocalMove == LOCALMOVE_VALID )
@ -1553,7 +1534,8 @@ BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEnt
// monster can walk straight there!
return TRUE;
}
// try to triangulate around any obstacles.
// try to triangulate around any obstacles.
else if ( iLocalMove != LOCALMOVE_INVALID_DONT_TRIANGULATE && FTriangulate( pev->origin, vecGoal, flDist, pTarget, &vecApex ) )
{
// there is a slightly more complicated path that allows the monster to reach vecGoal
@ -1562,7 +1544,6 @@ BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEnt
m_Route[ 1 ].vecLocation = vecGoal;
m_Route[ 1 ].iType = iMoveFlag | bits_MF_IS_GOAL;
/*
WRITE_BYTE(MSG_BROADCAST, SVC_TEMPENTITY);
WRITE_BYTE(MSG_BROADCAST, TE_SHOWLINE);
@ -1573,15 +1554,14 @@ BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEnt
WRITE_COORD(MSG_BROADCAST, vecApex.y );
WRITE_COORD(MSG_BROADCAST, vecApex.z + 128 );
*/
RouteSimplify( pTarget );
return TRUE;
}
// last ditch, try nodes
// last ditch, try nodes
if ( FGetNodeRoute( vecGoal ) )
{
// ALERT ( at_console, "Can get there on nodes\n" );
//ALERT ( at_console, "Can get there on nodes\n" );
m_vecMoveGoal = vecGoal;
RouteSimplify( pTarget );
return TRUE;
@ -1602,7 +1582,6 @@ void CBaseMonster :: InsertWaypoint ( Vector vecLocation, int afMoveFlags )
{
int i, type;
// we have to save some Index and Type information from the real
// path_corner or node waypoint that the monster was trying to reach. This makes sure that data necessary
// to refresh the original path exists even in the new waypoints that don't correspond directy to a path_corner
@ -1666,7 +1645,7 @@ BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEn
}
vecFarSide = m_Route[ m_iRouteIndex ].vecLocation;
vecDir = vecDir * sizeX * 2;
if (pev->movetype == MOVETYPE_FLY)
vecDirUp = vecDirUp * sizeZ * 2;
@ -1695,7 +1674,6 @@ BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEn
WRITE_COORD( vecLeft.z );
MESSAGE_END();
#endif
#if 0
if (pev->movetype == MOVETYPE_FLY)
{
@ -1720,7 +1698,6 @@ BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEn
MESSAGE_END();
}
#endif
if ( CheckLocalMove( pev->origin, vecRight, pTargetEnt, NULL ) == LOCALMOVE_VALID )
{
if ( CheckLocalMove ( vecRight, vecFarSide, pTargetEnt, NULL ) == LOCALMOVE_VALID )
@ -1816,7 +1793,7 @@ void CBaseMonster :: Move ( float flInterval )
return;
}
}
if ( m_flMoveWaitFinished > gpGlobals->time )
return;
@ -1835,7 +1812,6 @@ void CBaseMonster :: Move ( float flInterval )
// Debug, draw the route
// DrawRoute( pev, m_Route, m_iRouteIndex, 0, 200, 0 );
#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;
@ -1843,7 +1819,7 @@ void CBaseMonster :: Move ( float flInterval )
// local move to waypoint.
vecDir = ( m_Route[ m_iRouteIndex ].vecLocation - pev->origin ).Normalize();
flWaypointDist = ( m_Route[ m_iRouteIndex ].vecLocation - pev->origin ).Length2D();
MakeIdealYaw ( m_Route[ m_iRouteIndex ].vecLocation );
ChangeYaw ( pev->yaw_speed );
@ -1856,7 +1832,7 @@ void CBaseMonster :: Move ( float flInterval )
{
flCheckDist = DIST_TO_CHECK;
}
if ( (m_Route[ m_iRouteIndex ].iType & (~bits_MF_NOT_TO_MASK)) == bits_MF_TO_ENEMY )
{
// only on a PURE move to enemy ( i.e., ONLY MF_TO_ENEMY set, not MF_TO_ENEMY and DETOUR )
@ -1877,6 +1853,7 @@ void CBaseMonster :: Move ( float flInterval )
// Can't move, stop
Stop();
// Blocking entity is in global trace_ent
pBlocker = CBaseEntity::Instance( gpGlobals->trace_ent );
if (pBlocker)
@ -1905,8 +1882,9 @@ void CBaseMonster :: Move ( float flInterval )
}
else
{
// ALERT ( at_aiconsole, "Couldn't Triangulate\n" );
//ALERT ( at_aiconsole, "Couldn't Triangulate\n" );
Stop();
// Only do this once until your route is cleared
if ( m_moveWaitTime > 0 && !(m_afMemory & bits_MEMORY_MOVE_FAILED) )
{
@ -1964,7 +1942,6 @@ void CBaseMonster :: Move ( float flInterval )
}
}
BOOL CBaseMonster:: ShouldAdvanceRoute( float flWaypointDist )
{
if ( flWaypointDist <= MONSTER_CUT_CORNER_DIST )
@ -1976,11 +1953,10 @@ BOOL CBaseMonster:: ShouldAdvanceRoute( float flWaypointDist )
return FALSE;
}
void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval )
{
// float flYaw = UTIL_VecToYaw ( m_Route[ m_iRouteIndex ].vecLocation - pev->origin );// build a yaw that points to the goal.
// WALK_MOVE( ENT(pev), flYaw, m_flGroundSpeed * flInterval, WALKMOVE_NORMAL );
//float flYaw = UTIL_VecToYaw ( m_Route[ m_iRouteIndex ].vecLocation - pev->origin );// build a yaw that points to the goal.
//WALK_MOVE( ENT(pev), flYaw, m_flGroundSpeed * flInterval, WALKMOVE_NORMAL );
if ( m_IdealActivity != m_movementActivity )
m_IdealActivity = m_movementActivity;
@ -1996,7 +1972,6 @@ void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, f
// ALERT( at_console, "dist %f\n", m_flGroundSpeed * pev->framerate * flInterval );
}
//=========================================================
// MonsterInit - after a monster is spawned, it needs to
// be dropped into the world, checked for mobility problems,
@ -2010,7 +1985,7 @@ void CBaseMonster :: MonsterInit ( void )
if (!g_pGameRules->FAllowMonsters())
{
pev->flags |= FL_KILLME; // Post this because some monster code modifies class data after calling this function
// REMOVE_ENTITY(ENT(pev));
//REMOVE_ENTITY(ENT(pev));
return;
}
@ -2087,6 +2062,7 @@ void CBaseMonster :: StartMonster ( void )
{
pev->origin.z += 1;
DROP_TO_FLOOR ( ENT(pev) );
// Try to move the monster to make sure it's not stuck in a brush.
if (!WALK_MOVE ( ENT(pev), 0, 0, WALKMOVE_NORMAL ) )
{
@ -2121,12 +2097,11 @@ void CBaseMonster :: StartMonster ( void )
ALERT(at_warning, "ReadyMonster--monster's initial goal '%s' is not a path_corner", STRING(pev->target));
}
#endif
// set the monster up to walk a path corner path.
// !!!BUGBUG - this is a minor bit of a hack.
// JAYJAY
m_movementGoal = MOVEGOAL_PATHCORNER;
if ( pev->movetype == MOVETYPE_FLY )
m_movementActivity = ACT_FLY;
else
@ -2140,7 +2115,7 @@ void CBaseMonster :: StartMonster ( void )
ChangeSchedule( GetScheduleOfType( SCHED_IDLE_WALK ) );
}
}
//SetState ( m_IdealMonsterState );
//SetActivity ( m_IdealActivity );
@ -2148,7 +2123,7 @@ void CBaseMonster :: StartMonster ( void )
// Spread think times so that they don't all happen at the same time (Carmack)
SetThink( &CBaseMonster::CallMonsterThink );
pev->nextthink += RANDOM_FLOAT(0.1, 0.4); // spread think times.
if ( !FStringNull(pev->targetname) )// wait until triggered
{
SetState( MONSTERSTATE_IDLE );
@ -2158,7 +2133,6 @@ void CBaseMonster :: StartMonster ( void )
}
}
void CBaseMonster :: MovementComplete( void )
{
switch( m_iTaskStatus )
@ -2167,22 +2141,18 @@ void CBaseMonster :: MovementComplete( void )
case TASKSTATUS_RUNNING:
m_iTaskStatus = TASKSTATUS_RUNNING_TASK;
break;
case TASKSTATUS_RUNNING_MOVEMENT:
TaskComplete();
break;
case TASKSTATUS_RUNNING_TASK:
ALERT( at_error, "Movement completed twice!\n" );
break;
case TASKSTATUS_COMPLETE:
break;
}
m_movementGoal = MOVEGOAL_NONE;
}
int CBaseMonster::TaskIsRunning( void )
{
if ( m_iTaskStatus != TASKSTATUS_COMPLETE &&
@ -2328,7 +2298,6 @@ BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float f
return FALSE;
}
//=========================================================
// BuildNearestRoute - tries to build a route as close to the target
// as possible, even if there isn't a path to the final point.
@ -2414,8 +2383,6 @@ BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset,
return FALSE;
}
//=========================================================
// BestVisibleEnemy - this functions searches the link
// list whose head is the caller's m_pLink field, and returns
@ -2473,7 +2440,6 @@ CBaseEntity *CBaseMonster :: BestVisibleEnemy ( void )
return pReturn;
}
//=========================================================
// MakeIdealYaw - gets a yaw value for the caller that would
// face the supplied vector. Value is stuffed into the monster's
@ -2482,7 +2448,7 @@ CBaseEntity *CBaseMonster :: BestVisibleEnemy ( void )
void CBaseMonster :: MakeIdealYaw( Vector vecTarget )
{
Vector vecProjection;
// strafing monster needs to face 90 degrees away from its goal
if ( m_movementActivity == ACT_STRAFE_LEFT )
{
@ -2521,11 +2487,9 @@ float CBaseMonster::FlYawDiff ( void )
return 0;
}
return UTIL_AngleDiff( pev->ideal_yaw, flCurrentYaw );
}
//=========================================================
// Changeyaw - turns a monster towards its ideal_yaw
//=========================================================
@ -2552,16 +2516,18 @@ float CBaseMonster::ChangeYaw ( int yawSpeed )
}
if (move > 0)
{// turning to the monster's left
{
// turning to the monster's left
if (move > speed)
move = speed;
}
else
{// turning to the monster's right
{
// turning to the monster's right
if (move < -speed)
move = -speed;
}
pev->angles.y = UTIL_AngleMod (current + move);
// turn head in desired direction only if they have a turnable head
@ -2592,7 +2558,6 @@ float CBaseMonster::VecToYaw ( Vector vecDir )
return UTIL_VecToYaw( vecDir );
}
//=========================================================
// SetEyePosition
//
@ -2638,19 +2603,17 @@ void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
if ( m_MonsterState == MONSTERSTATE_SCRIPT )
{
pev->deadflag = DEAD_NO;
// This is for life/death sequences where the player can determine whether a character is dead or alive after the script
pev->health = pev->max_health;
}
break;
case SCRIPT_EVENT_SOUND: // Play a named wave file
EMIT_SOUND( edict(), CHAN_BODY, pEvent->options, 1.0, ATTN_IDLE );
break;
case SCRIPT_EVENT_SOUND_VOICE:
EMIT_SOUND( edict(), CHAN_VOICE, pEvent->options, 1.0, ATTN_IDLE );
break;
case SCRIPT_EVENT_SENTENCE_RND1: // Play a named sentence group 33% of the time
if (RANDOM_LONG(0,2) == 0)
break;
@ -2658,27 +2621,22 @@ void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
case SCRIPT_EVENT_SENTENCE: // Play a named sentence group
SENTENCEG_PlayRndSz( edict(), pEvent->options, 1.0, ATTN_IDLE, 0, 100 );
break;
case SCRIPT_EVENT_FIREEVENT: // Fire a trigger
FireTargets( pEvent->options, this, this, USE_TOGGLE, 0 );
break;
case SCRIPT_EVENT_NOINTERRUPT: // Can't be interrupted from now on
if ( m_pCine )
m_pCine->AllowInterrupt( FALSE );
break;
case SCRIPT_EVENT_CANINTERRUPT: // OK to interrupt now
if ( m_pCine )
m_pCine->AllowInterrupt( TRUE );
break;
#if 0
case SCRIPT_EVENT_INAIR: // Don't DROP_TO_FLOOR()
case SCRIPT_EVENT_ENDANIMATION: // Set ending animation sequence to
break;
#endif
case MONSTER_EVENT_BODYDROP_HEAVY:
if ( pev->flags & FL_ONGROUND )
{
@ -2692,7 +2650,6 @@ void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
case MONSTER_EVENT_BODYDROP_LIGHT:
if ( pev->flags & FL_ONGROUND )
{
@ -2706,24 +2663,19 @@ void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
break;
case MONSTER_EVENT_SWISHSOUND:
{
// NO MONSTER may use this anim event unless that monster's precache precaches this sound!!!
EMIT_SOUND( ENT(pev), CHAN_BODY, "zombie/claw_miss2.wav", 1, ATTN_NORM );
break;
}
default:
ALERT( at_aiconsole, "Unhandled animation event %d for %s\n", pEvent->event, STRING(pev->classname) );
break;
}
}
// Combat
Vector CBaseMonster :: GetGunPosition( )
{
UTIL_MakeVectors(pev->angles);
@ -2739,18 +2691,10 @@ Vector CBaseMonster :: GetGunPosition( )
return vecSrc;
}
//=========================================================
// NODE GRAPH
//=========================================================
//=========================================================
// FGetNodeRoute - tries to build an entire node path from
// the callers origin to the passed vector. If this is
@ -2773,13 +2717,13 @@ BOOL CBaseMonster :: FGetNodeRoute ( Vector vecDest )
if ( iSrcNode == -1 )
{
// no node nearest self
// ALERT ( at_aiconsole, "FGetNodeRoute: No valid node near self!\n" );
//ALERT ( at_aiconsole, "FGetNodeRoute: No valid node near self!\n" );
return FALSE;
}
else if ( iDestNode == -1 )
{
// no node nearest target
// ALERT ( at_aiconsole, "FGetNodeRoute: No valid node near target!\n" );
//ALERT ( at_aiconsole, "FGetNodeRoute: No valid node near target!\n" );
return FALSE;
}
@ -2823,13 +2767,13 @@ BOOL CBaseMonster :: FGetNodeRoute ( Vector vecDest )
{
iNumToCopy = ROUTE_SIZE;
}
for ( i = 0 ; i < iNumToCopy; i++ )
{
m_Route[ i ].vecLocation = WorldGraph.m_pNodes[ iPath[ i ] ].m_vecOrigin;
m_Route[ i ].iType = bits_MF_TO_NODE;
}
if ( iNumToCopy < ROUTE_SIZE )
{
m_Route[ iNumToCopy ].vecLocation = vecDest;
@ -2885,8 +2829,7 @@ int CBaseMonster :: FindHintNode ( void )
WorldGraph.m_iLastActiveIdleSearch = 0;// start at the top of the list for the next search.
return NO_NODE;
}
}
void CBaseMonster::ReportAIState( void )
{
@ -3122,7 +3065,6 @@ int CBaseMonster :: CanPlaySequence( BOOL fDisregardMonsterState, int interruptL
return FALSE;
}
//=========================================================
// FindLateralCover - attempts to locate a spot in the world
// directly to the left or right of the caller that will
@ -3144,7 +3086,7 @@ BOOL CBaseMonster :: FindLateralCover ( const Vector &vecThreat, const Vector &v
UTIL_MakeVectors ( pev->angles );
vecStepRight = gpGlobals->v_right * COVER_DELTA;
vecStepRight.z = 0;
vecLeftTest = vecRightTest = pev->origin;
for ( i = 0 ; i < COVER_CHECKS ; i++ )
@ -3184,7 +3126,6 @@ BOOL CBaseMonster :: FindLateralCover ( const Vector &vecThreat, const Vector &v
return FALSE;
}
Vector CBaseMonster :: ShootAtEnemy( const Vector &shootOrigin )
{
CBaseEntity *pEnemy = m_hEnemy;
@ -3197,8 +3138,6 @@ Vector CBaseMonster :: ShootAtEnemy( const Vector &shootOrigin )
return gpGlobals->v_forward;
}
//=========================================================
// FacingIdeal - tells us if a monster is facing its ideal
// yaw. Created this function because many spots in the
@ -3230,7 +3169,6 @@ BOOL CBaseMonster :: FCanActiveIdle ( void )
return FALSE;
}
void CBaseMonster::PlaySentence( const char *pszSentence, float duration, float volume, float attenuation )
{
if ( pszSentence && IsAlive() )
@ -3242,19 +3180,16 @@ void CBaseMonster::PlaySentence( const char *pszSentence, float duration, float
}
}
void CBaseMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener )
{
{
PlaySentence( pszSentence, duration, volume, attenuation );
}
void CBaseMonster::SentenceStop( void )
{
EMIT_SOUND( edict(), CHAN_VOICE, "common/null.wav", 1.0, ATTN_IDLE );
}
void CBaseMonster::CorpseFallThink( void )
{
if ( pev->flags & FL_ONGROUND )
@ -3279,11 +3214,11 @@ void CBaseMonster :: MonsterInitDead( void )
pev->frame = 0;
ResetSequenceInfo( );
pev->framerate = 0;
// Copy health
pev->max_health = pev->health;
pev->deadflag = DEAD_DEAD;
UTIL_SetSize(pev, g_vecZero, g_vecZero );
UTIL_SetOrigin( pev, pev->origin );
@ -3408,7 +3343,6 @@ BOOL CBaseMonster :: GetEnemy ( void )
return FALSE;// monster has no enemy
}
//=========================================================
// DropItem - dead monster drops named item
//=========================================================
@ -3437,7 +3371,6 @@ CBaseEntity* CBaseMonster :: DropItem ( char *pszItemName, const Vector &vecPos,
}
BOOL CBaseMonster :: ShouldFadeOnDeath( void )
{
// if flagged to fade out or I have an owner (I came from a monster spawner)

View File

@ -39,7 +39,6 @@
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
// 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
@ -58,13 +57,10 @@
#define SF_MONSTER_TURRET_STARTINACTIVE 64
#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.
// 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
@ -92,7 +88,6 @@ BOOL FBoxVisible ( entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTarget
#define R_HT 2// (HATE)will attack this character instead of any visible DISLIKEd characters
#define R_NM 3// (NEMESIS) A monster Will ALWAYS attack its nemsis, no matter what
// these bits represent the monster's memory
#define MEMORY_CLEAR 0
#define bits_MEMORY_PROVOKED ( 1 << 0 )// right now only used for houndeyes.
@ -123,7 +118,7 @@ enum
AITRIGGER_HEARPLAYER,
AITRIGGER_HEARCOMBAT,
AITRIGGER_SEEPLAYER_UNCONDITIONAL,
AITRIGGER_SEEPLAYER_NOT_IN_COMBAT,
AITRIGGER_SEEPLAYER_NOT_IN_COMBAT
};
/*
0 : "No Trigger"
@ -161,7 +156,6 @@ public:
float m_lifeTime;
};
#define CUSTOM_SCHEDULES\
virtual Schedule_t *ScheduleFromName( const char *pName );\
static Schedule_t *m_scheduleList[];
@ -178,6 +172,4 @@ public:
return pSchedule;\
}
#endif //MONSTERS_H

View File

@ -37,13 +37,11 @@ void CBaseMonster :: SetState ( MONSTERSTATE State )
ALERT ( at_aiconsole, "State Changed to %d\n", State );
}
*/
switch( State )
{
// Drop enemy pointers when going to idle
case MONSTERSTATE_IDLE:
if ( m_hEnemy != NULL )
{
m_hEnemy = NULL;// not allowed to have an enemy anymore.
@ -128,7 +126,6 @@ MONSTERSTATE CBaseMonster :: GetIdealState ( void )
switch ( m_MonsterState )
{
case MONSTERSTATE_IDLE:
/*
IDLE goes to ALERT upon hearing a sound
-IDLE goes to ALERT upon being injured
@ -225,7 +222,6 @@ MONSTERSTATE CBaseMonster :: GetIdealState ( void )
ExitScriptedSequence(); // This will set the ideal state
}
break;
case MONSTERSTATE_DEAD:
m_IdealMonsterState = MONSTERSTATE_DEAD;
break;
@ -235,4 +231,3 @@ MONSTERSTATE CBaseMonster :: GetIdealState ( void )
return m_IdealMonsterState;
}

View File

@ -53,9 +53,9 @@ public:
int m_fControl;
};
LINK_ENTITY_TO_CLASS( func_mortar_field, CFuncMortarField );
LINK_ENTITY_TO_CLASS( func_mortar_field, CFuncMortarField )
TYPEDESCRIPTION CFuncMortarField::m_SaveData[] =
TYPEDESCRIPTION CFuncMortarField::m_SaveData[] =
{
DEFINE_FIELD( CFuncMortarField, m_iszXController, FIELD_STRING ),
DEFINE_FIELD( CFuncMortarField, m_iszYController, FIELD_STRING ),
@ -65,8 +65,7 @@ TYPEDESCRIPTION CFuncMortarField::m_SaveData[] =
DEFINE_FIELD( CFuncMortarField, m_fControl, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CFuncMortarField, CBaseToggle );
IMPLEMENT_SAVERESTORE( CFuncMortarField, CBaseToggle )
void CFuncMortarField :: KeyValue( KeyValueData *pkvd )
{
@ -97,7 +96,6 @@ void CFuncMortarField :: KeyValue( KeyValueData *pkvd )
}
}
// Drop bombs from above
void CFuncMortarField :: Spawn( void )
{
@ -109,7 +107,6 @@ void CFuncMortarField :: Spawn( void )
Precache();
}
void CFuncMortarField :: Precache( void )
{
PRECACHE_SOUND ("weapons/mortar.wav");
@ -117,7 +114,6 @@ void CFuncMortarField :: Precache( void )
PRECACHE_MODEL( "sprites/lgtning.spr" );
}
// If connected to a table, then use the table controllers, else hit where the trigger is.
void CFuncMortarField :: FieldUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
@ -188,7 +184,6 @@ void CFuncMortarField :: FieldUse( CBaseEntity *pActivator, CBaseEntity *pCaller
}
}
class CMortar : public CGrenade
{
public:
@ -200,7 +195,7 @@ public:
int m_spriteTexture;
};
LINK_ENTITY_TO_CLASS( monster_mortar, CMortar );
LINK_ENTITY_TO_CLASS( monster_mortar, CMortar )
void CMortar::Spawn( )
{
@ -213,11 +208,8 @@ void CMortar::Spawn( )
pev->nextthink = 0;
Precache( );
}
void CMortar::Precache( )
{
m_spriteTexture = PRECACHE_MODEL( "sprites/lgtning.spr" );
@ -278,7 +270,6 @@ void CMortar::MortarExplode( void )
Explode( &tr, DMG_BLAST | DMG_MORTAR );
UTIL_ScreenShake( tr.vecEndPos, 25.0, 150.0, 1.0, 750 );
#if 0
int pitch = RANDOM_LONG(95,124);
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "weapons/mortarhit.wav", 1.0, 0.55, 0, pitch);
@ -303,10 +294,8 @@ void CMortar::MortarExplode( void )
SetThink( &SUB_Remove );
pev->nextthink = gpGlobals->time + 0.1;
#endif
}
#if 0
void CMortar::ShootTimed( EVARS *pevOwner, Vector vecStart, float time )
{

View File

@ -32,14 +32,11 @@ enum mp5_e
MP5_DEPLOY,
MP5_FIRE1,
MP5_FIRE2,
MP5_FIRE3,
MP5_FIRE3
};
LINK_ENTITY_TO_CLASS( weapon_mp5, CMP5 );
LINK_ENTITY_TO_CLASS( weapon_9mmAR, CMP5 );
LINK_ENTITY_TO_CLASS( weapon_mp5, CMP5 )
LINK_ENTITY_TO_CLASS( weapon_9mmAR, CMP5 )
//=========================================================
//=========================================================
@ -60,7 +57,6 @@ void CMP5::Spawn( )
FallInit();// get ready to fall down.
}
void CMP5::Precache( void )
{
PRECACHE_MODEL("models/v_9mmAR.mdl");
@ -124,7 +120,6 @@ BOOL CMP5::Deploy( )
return DefaultDeploy( "models/v_9mmAR.mdl", "models/p_9mmAR.mdl", MP5_DEPLOY, "mp5" );
}
void CMP5::PrimaryAttack()
{
// don't fire underwater
@ -147,7 +142,6 @@ void CMP5::PrimaryAttack()
m_iClip--;
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
// player "shoot" animation
@ -156,7 +150,6 @@ void CMP5::PrimaryAttack()
Vector vecSrc = m_pPlayer->GetGunPosition( );
Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
Vector vecDir;
#ifdef CLIENT_DLL
if ( !bIsMultiplayer() )
#else
@ -172,13 +165,12 @@ void CMP5::PrimaryAttack()
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_MP5, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed );
}
int flags;
int flags;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
#else
flags = 0;
#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)
@ -193,8 +185,6 @@ void CMP5::PrimaryAttack()
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
void CMP5::SecondaryAttack( void )
{
// don't fire underwater
@ -235,7 +225,6 @@ void CMP5::SecondaryAttack( void )
#else
flags = 0;
#endif
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1;
@ -255,7 +244,6 @@ void CMP5::Reload( void )
DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5 );
}
void CMP5::WeaponIdle( void )
{
ResetEmptySound( );
@ -283,8 +271,6 @@ void CMP5::WeaponIdle( void )
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
}
class CMP5AmmoClip : public CBasePlayerAmmo
{
void Spawn( void )
@ -308,10 +294,9 @@ class CMP5AmmoClip : public CBasePlayerAmmo
return bResult;
}
};
LINK_ENTITY_TO_CLASS( ammo_mp5clip, CMP5AmmoClip );
LINK_ENTITY_TO_CLASS( ammo_9mmAR, CMP5AmmoClip );
LINK_ENTITY_TO_CLASS( ammo_mp5clip, CMP5AmmoClip )
LINK_ENTITY_TO_CLASS( ammo_9mmAR, CMP5AmmoClip )
class CMP5Chainammo : public CBasePlayerAmmo
{
@ -336,8 +321,8 @@ class CMP5Chainammo : public CBasePlayerAmmo
return bResult;
}
};
LINK_ENTITY_TO_CLASS( ammo_9mmbox, CMP5Chainammo );
LINK_ENTITY_TO_CLASS( ammo_9mmbox, CMP5Chainammo )
class CMP5AmmoGrenade : public CBasePlayerAmmo
{
@ -363,23 +348,6 @@ class CMP5AmmoGrenade : public CBasePlayerAmmo
return bResult;
}
};
LINK_ENTITY_TO_CLASS( ammo_mp5grenades, CMP5AmmoGrenade );
LINK_ENTITY_TO_CLASS( ammo_ARgrenades, CMP5AmmoGrenade );
LINK_ENTITY_TO_CLASS( ammo_mp5grenades, CMP5AmmoGrenade )
LINK_ENTITY_TO_CLASS( ammo_ARgrenades, CMP5AmmoGrenade )

View File

@ -13,7 +13,6 @@
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -22,12 +21,10 @@
#include "nodes.h"
#include "talkmonster.h"
float CTalkMonster::g_talkWaitTime = 0; // time delay until it's ok to speak: used so that two NPCs don't talk at once
/*********************************************************/
CGraph WorldGraph;
void CGraph :: InitGraph( void ) { }
int CGraph :: FLoadGraph ( char *szMapName ) { return FALSE; }
@ -37,15 +34,12 @@ int CGraph :: FSetGraphPointers ( void ) { return 0; }
void CGraph :: ShowNodeConnections ( int iNode ) { }
int CGraph :: FindNearestNode ( const Vector &vecOrigin, int afNodeTypes ) { return 0; }
/*********************************************************/
void CBaseMonster :: ReportAIState( void ) { }
float CBaseMonster :: ChangeYaw ( int speed ) { return 0; }
void CBaseMonster :: MakeIdealYaw( Vector vecTarget ) { }
void CBaseMonster::CorpseFallThink( void )
{
if ( pev->flags & FL_ONGROUND )
@ -58,6 +52,7 @@ void CBaseMonster::CorpseFallThink( void )
else
pev->nextthink = gpGlobals->time + 0.1;
}
// Call after animation/pose is set up
void CBaseMonster :: MonsterInitDead( void )
{
@ -83,7 +78,6 @@ void CBaseMonster :: MonsterInitDead( void )
pev->nextthink = gpGlobals->time + 0.5;
}
BOOL CBaseMonster :: ShouldFadeOnDeath( void )
{
return FALSE;
@ -122,7 +116,6 @@ int CBaseMonster::IRelationship ( CBaseEntity *pTarget )
return iEnemy[ Classify() ][ pTarget->Classify() ];
}
//=========================================================
// Look - Base class monster function to find enemies or
// food by sight. iDistance is distance ( in units ) that the
@ -205,7 +198,6 @@ void CBaseMonster :: Look ( int iDistance )
SetConditions( iSighted );
}
//=========================================================
// BestVisibleEnemy - this functions searches the link
// list whose head is the caller's m_pLink field, and returns

View File

@ -15,6 +15,7 @@
//
// teamplay_gamerules.cpp
//
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -63,8 +64,8 @@ public:
return true;
}
};
static CMultiplayGameMgrHelper g_GameMgrHelper;
static CMultiplayGameMgrHelper g_GameMgrHelper;
//*********************************************************
// Rules for the half-life multiplayer game.
@ -125,7 +126,6 @@ BOOL CHalfLifeMultiplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd))
return TRUE;
#endif
return CGameRules::ClientCommand(pPlayer, pcmd);
}
@ -133,10 +133,10 @@ BOOL CHalfLifeMultiplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
//=========================================================
void CHalfLifeMultiplay::RefreshSkillData( void )
{
// load all default values
// load all default values
CGameRules::RefreshSkillData();
// override some values for multiplay.
// override some values for multiplay.
// suitcharger
gSkillData.suitchargerCapacity = 30;
@ -283,7 +283,6 @@ void CHalfLifeMultiplay :: Think ( void )
last_time = time_remaining;
}
//=========================================================
//=========================================================
BOOL CHalfLifeMultiplay::IsMultiplayer( void )
@ -616,7 +615,6 @@ int CHalfLifeMultiplay :: IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *p
return 1;
}
//=========================================================
// PlayerKilled - someone/something killed this player
//=========================================================
@ -626,7 +624,6 @@ void CHalfLifeMultiplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKille
pVictim->m_iDeaths += 1;
FireTargets( "game_playerdie", pVictim, pVictim, USE_TOGGLE, 0 );
CBasePlayer *peKiller = NULL;
CBaseEntity *ktmp = CBaseEntity::Instance( pKiller );
@ -634,7 +631,8 @@ void CHalfLifeMultiplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKille
peKiller = (CBasePlayer*)ktmp;
if ( pVictim->pev == pKiller )
{ // killed self
{
// killed self
pKiller->frags -= 1;
}
else if ( ktmp && ktmp->IsPlayer() )
@ -645,7 +643,8 @@ void CHalfLifeMultiplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKille
FireTargets( "game_playerkill", ktmp, ktmp, USE_TOGGLE, 0 );
}
else
{ // killed by the world
{
// killed by the world
pKiller->frags -= 1;
}
@ -1014,7 +1013,6 @@ int CHalfLifeMultiplay::ItemShouldRespawn( CItem *pItem )
return GR_ITEM_RESPAWN_YES;
}
//=========================================================
// At what time in the future may this Item respawn?
//=========================================================
@ -1081,7 +1079,6 @@ float CHalfLifeMultiplay::FlHealthChargerRechargeTime( void )
return 60;
}
float CHalfLifeMultiplay::FlHEVChargerRechargeTime( void )
{
return 30;
@ -1112,7 +1109,6 @@ edict_t *CHalfLifeMultiplay::GetPlayerSpawnSpot( CBasePlayer *pPlayer )
return pentSpawnSpot;
}
//=========================================================
//=========================================================
int CHalfLifeMultiplay::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
@ -1228,13 +1224,13 @@ char *COM_Parse (char *data)
{
int c;
int len;
len = 0;
com_token[0] = 0;
if (!data)
return NULL;
// skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
@ -1243,17 +1239,16 @@ skipwhite:
return NULL; // end of file;
data++;
}
// skip // comments
// skip // comments
if (c=='/' && data[1] == '/')
{
while (*data && *data != '\n')
data++;
goto skipwhite;
}
// handle quoted strings specially
// handle quoted strings specially
if (c == '\"')
{
data++;
@ -1270,7 +1265,7 @@ skipwhite:
}
}
// parse single characters
// parse single characters
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c == ',' )
{
com_token[len] = c;
@ -1279,7 +1274,7 @@ skipwhite:
return data+1;
}
// parse a regular word
// parse a regular word
do
{
com_token[len] = c;
@ -1289,7 +1284,7 @@ skipwhite:
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c == ',' )
break;
} while (c>32);
com_token[len] = 0;
return data;
}
@ -1317,8 +1312,6 @@ int COM_TokenWaiting( char *buffer )
return 0;
}
/*
==============
ReloadMapCycleFile
@ -1440,7 +1433,7 @@ int ReloadMapCycleFile( char *filename, mapcycle_t *cycle )
item = item->next;
}
item->next = cycle->items;
cycle->next_item = item->next;
return 1;
@ -1483,7 +1476,7 @@ void ExtractCommandString( char *s, char *szCommand )
// Now make rules happen
char pkey[512];
char value[512]; // use two buffers so compares
// work without stomping on each other
// work without stomping on each other
char *o;
if ( *s == '\\' )
@ -1680,7 +1673,7 @@ void CHalfLifeMultiplay :: SendMOTDToClient( edict_t *client )
while ( pFileList && *pFileList && char_count < MAX_MOTD_LENGTH )
{
char chunk[MAX_MOTD_CHUNK+1];
if ( strlen( pFileList ) < MAX_MOTD_CHUNK )
{
strcpy( chunk, pFileList );
@ -1705,5 +1698,3 @@ void CHalfLifeMultiplay :: SendMOTDToClient( edict_t *client )
FREE_FILE( aFileList );
}

View File

@ -80,7 +80,7 @@ public:
static const char *pLaughSounds[]; // vocalization: play sometimes when hit and still has lots of health
static const char *pPainSounds[]; // vocalization: play sometimes when hit and has much less health and no more chargers
static const char *pDeathSounds[]; // vocalization: play as he dies
// x_teleattack1.wav the looping sound of the teleport attack ball.
float m_flForce;
@ -131,9 +131,9 @@ public:
EHANDLE m_hFriend[3];
};
LINK_ENTITY_TO_CLASS( monster_nihilanth, CNihilanth );
LINK_ENTITY_TO_CLASS( monster_nihilanth, CNihilanth )
TYPEDESCRIPTION CNihilanth::m_SaveData[] =
TYPEDESCRIPTION CNihilanth::m_SaveData[] =
{
DEFINE_FIELD( CNihilanth, m_flForce, FIELD_FLOAT ),
DEFINE_FIELD( CNihilanth, m_flNextPainSound, FIELD_TIME ),
@ -167,7 +167,7 @@ TYPEDESCRIPTION CNihilanth::m_SaveData[] =
DEFINE_ARRAY( CNihilanth, m_hFriend, FIELD_EHANDLE, 3 ),
};
IMPLEMENT_SAVERESTORE( CNihilanth, CBaseMonster );
IMPLEMENT_SAVERESTORE( CNihilanth, CBaseMonster )
class CNihilanthHVR : public CBaseMonster
{
@ -214,10 +214,9 @@ public:
int m_nFrames;
};
LINK_ENTITY_TO_CLASS( nihilanth_energy_ball, CNihilanthHVR );
LINK_ENTITY_TO_CLASS( nihilanth_energy_ball, CNihilanthHVR )
TYPEDESCRIPTION CNihilanthHVR::m_SaveData[] =
TYPEDESCRIPTION CNihilanthHVR::m_SaveData[] =
{
DEFINE_FIELD( CNihilanthHVR, m_flIdealVel, FIELD_FLOAT ),
DEFINE_FIELD( CNihilanthHVR, m_vecIdeal, FIELD_VECTOR ),
@ -226,9 +225,7 @@ TYPEDESCRIPTION CNihilanthHVR::m_SaveData[] =
DEFINE_FIELD( CNihilanthHVR, m_nFrames, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CNihilanthHVR, CBaseMonster );
IMPLEMENT_SAVERESTORE( CNihilanthHVR, CBaseMonster )
//=========================================================
// Nihilanth, final Boss monster
@ -275,7 +272,6 @@ const char *CNihilanth::pDeathSounds[] =
"X/x_die1.wav",
};
void CNihilanth :: Spawn( void )
{
Precache( );
@ -325,7 +321,6 @@ void CNihilanth :: Spawn( void )
*/
}
void CNihilanth::Precache( void )
{
PRECACHE_MODEL("models/nihilanth.mdl");
@ -344,8 +339,6 @@ void CNihilanth::Precache( void )
PRECACHE_SOUND("debris/beamstart7.wav");
}
void CNihilanth :: PainSound( void )
{
if (m_flNextPainSound > gpGlobals->time)
@ -368,14 +361,12 @@ void CNihilanth :: DeathSound( void )
EMIT_SOUND( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pDeathSounds ), 1.0, 0.1 );
}
void CNihilanth::NullThink( void )
{
StudioFrameAdvance( );
pev->nextthink = gpGlobals->time + 0.5;
}
void CNihilanth::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
SetThink( &CNihilanth::HuntThink );
@ -383,7 +374,6 @@ void CNihilanth::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
SetUse( &CNihilanth::CommandUse );
}
void CNihilanth::StartupThink( void )
{
m_irritation = 0;
@ -415,7 +405,6 @@ void CNihilanth::StartupThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
void CNihilanth :: Killed( entvars_t *pevAttacker, int iGib )
{
CBaseMonster::Killed( pevAttacker, iGib );
@ -537,8 +526,6 @@ void CNihilanth :: DyingThink( void )
return;
}
void CNihilanth::CrashTouch( CBaseEntity *pOther )
{
// only crash if we hit something solid
@ -549,15 +536,11 @@ void CNihilanth::CrashTouch( CBaseEntity *pOther )
}
}
void CNihilanth :: GibMonster( void )
{
// EMIT_SOUND_DYN(edict(), CHAN_VOICE, "common/bodysplat.wav", 0.75, ATTN_NORM, 0, 200);
}
void CNihilanth :: FloatSequence( void )
{
if (m_irritation >= 2)
@ -586,13 +569,12 @@ void CNihilanth :: FloatSequence( void )
}
}
void CNihilanth :: ShootBalls( void )
{
if (m_flShootEnd > gpGlobals->time)
{
Vector vecHand, vecAngle;
while (m_flShootTime < m_flShootEnd && m_flShootTime < gpGlobals->time)
{
if (m_hEnemy != NULL)
@ -623,7 +605,6 @@ void CNihilanth :: ShootBalls( void )
}
}
void CNihilanth :: MakeFriend( Vector vecStart )
{
int i;
@ -673,7 +654,6 @@ void CNihilanth :: MakeFriend( Vector vecStart )
}
}
void CNihilanth :: NextActivity( )
{
UTIL_MakeAimVectors( pev->angles );
@ -730,7 +710,7 @@ void CNihilanth :: NextActivity( )
pRecharger = pEnt;
}
}
if (pRecharger)
{
m_hRecharger = pRecharger;
@ -899,8 +879,6 @@ void CNihilanth :: HuntThink( void )
Flight( );
}
void CNihilanth :: Flight( void )
{
// estimate where I'll be facing in one seconds
@ -935,7 +913,6 @@ void CNihilanth :: Flight( void )
m_velocity.y += gpGlobals->v_up.y * m_flForce;
m_velocity.z += gpGlobals->v_up.z * m_flForce;
float flSpeed = m_velocity.Length();
float flDir = DotProduct( Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, 0 ), Vector( m_velocity.x, m_velocity.y, 0 ) );
if (flDir < 0)
@ -950,7 +927,7 @@ void CNihilanth :: Flight( void )
// general drag
m_velocity = m_velocity * 0.995;
// apply power to stay correct height
if (m_flForce < 100 && vecEst.z < m_posDesired.z)
{
@ -968,7 +945,6 @@ void CNihilanth :: Flight( void )
// ALERT( at_console, "%5.0f %5.0f : %4.0f : %3.0f : %2.0f\n", m_posDesired.z, pev->origin.z, m_velocity.z, m_avelocity.y, m_flForce );
}
BOOL CNihilanth :: AbsorbSphere( void )
{
for (int i = 0; i < N_SPHERES; i++)
@ -985,7 +961,6 @@ BOOL CNihilanth :: AbsorbSphere( void )
return FALSE;
}
BOOL CNihilanth :: EmitSphere( void )
{
m_iActiveSpheres = 0;
@ -1015,8 +990,7 @@ BOOL CNihilanth :: EmitSphere( void )
return TRUE;
}
void CNihilanth :: TargetSphere( USE_TYPE useType, float value )
void CNihilanth :: TargetSphere( USE_TYPE useType, float value )
{
int i;
CBaseMonster *pSphere;
@ -1041,8 +1015,6 @@ void CNihilanth :: TargetSphere( USE_TYPE useType, float value )
pSphere->pev->velocity = m_vecDesired * RANDOM_FLOAT( 50, 100 ) + Vector( RANDOM_FLOAT( -50, 50 ), RANDOM_FLOAT( -50, 50 ), RANDOM_FLOAT( -50, 50 ) );
}
void CNihilanth :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
@ -1084,7 +1056,7 @@ void CNihilanth :: HandleAnimEvent( MonsterEvent_t *pEvent )
WRITE_BYTE( 10 ); // life * 10
WRITE_COORD( 128 ); // decay
MESSAGE_END();
m_flShootTime = gpGlobals->time;
m_flShootEnd = gpGlobals->time + 1.0;
}
@ -1189,8 +1161,6 @@ void CNihilanth :: HandleAnimEvent( MonsterEvent_t *pEvent )
}
}
void CNihilanth::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
switch (useType)
@ -1215,7 +1185,6 @@ void CNihilanth::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
}
}
int CNihilanth :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType )
{
if (pevInflictor->owner == edict())
@ -1227,15 +1196,13 @@ int CNihilanth :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, f
if (m_irritation != 3)
return 0;
}
PainSound( );
pev->health -= flDamage;
return 0;
}
void CNihilanth::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if (m_irritation == 3)
@ -1255,8 +1222,6 @@ void CNihilanth::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
}
CBaseEntity *CNihilanth::RandomTargetname( const char *szName )
{
int total = 0;
@ -1272,20 +1237,10 @@ CBaseEntity *CNihilanth::RandomTargetname( const char *szName )
return pEntity;
}
//=========================================================
// Controller bouncy ball attack
//=========================================================
void CNihilanthHVR :: Spawn( void )
{
Precache( );
@ -1295,7 +1250,6 @@ void CNihilanthHVR :: Spawn( void )
pev->scale = 3.0;
}
void CNihilanthHVR :: Precache( void )
{
PRECACHE_MODEL("sprites/flare6.spr");
@ -1310,8 +1264,6 @@ void CNihilanthHVR :: Precache( void )
PRECACHE_SOUND("x/x_teleattack1.wav");
}
void CNihilanthHVR :: CircleInit( CBaseEntity *pTarget )
{
pev->movetype = MOVETYPE_NOCLIP;
@ -1338,7 +1290,6 @@ void CNihilanthHVR :: CircleInit( CBaseEntity *pTarget )
m_hTargetEnt = pTarget;
}
CBaseEntity *CNihilanthHVR::RandomClassname( const char *szName )
{
int total = 0;
@ -1416,9 +1367,6 @@ void CNihilanthHVR :: HoverThink( void )
pev->frame = ((int)pev->frame + 1) % m_nFrames;
}
void CNihilanthHVR :: ZapInit( CBaseEntity *pEnemy )
{
pev->movetype = MOVETYPE_FLY;
@ -1458,7 +1406,6 @@ void CNihilanthHVR :: ZapThink( void )
pev->velocity = pev->velocity * 1.2;
}
// MovetoTarget( m_hEnemy->Center( ) );
if ((m_hEnemy->Center() - pev->origin).Length() < 256)
@ -1521,7 +1468,6 @@ void CNihilanthHVR :: ZapThink( void )
// Crawl( );
}
void CNihilanthHVR::ZapTouch( CBaseEntity *pOther )
{
UTIL_EmitAmbientSound( edict(), pev->origin, "weapons/electro4.wav", 1.0, ATTN_NORM, 0, RANDOM_LONG( 90, 95 ) );
@ -1541,8 +1487,6 @@ void CNihilanthHVR::ZapTouch( CBaseEntity *pOther )
pev->nextthink = gpGlobals->time + 0.2;
}
void CNihilanthHVR :: TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBaseEntity *pTarget, CBaseEntity *pTouch )
{
pev->movetype = MOVETYPE_FLY;
@ -1567,7 +1511,6 @@ void CNihilanthHVR :: TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBa
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "x/x_teleattack1.wav", 1, 0.2, 0, 100 );
}
void CNihilanthHVR :: GreenBallInit( )
{
pev->movetype = MOVETYPE_FLY;
@ -1583,7 +1526,6 @@ void CNihilanthHVR :: GreenBallInit( )
SetTouch( &CNihilanthHVR::RemoveTouch );
}
void CNihilanthHVR :: TeleportThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -1629,7 +1571,6 @@ void CNihilanthHVR :: TeleportThink( void )
pev->frame = (int)(pev->frame + 1) % 20;
}
void CNihilanthHVR :: AbsorbInit( void )
{
SetThink( &CNihilanthHVR::DissipateThink );
@ -1675,7 +1616,6 @@ void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther )
UTIL_Remove( this );
}
void CNihilanthHVR :: DissipateThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
@ -1710,7 +1650,6 @@ void CNihilanthHVR :: DissipateThink( void )
MESSAGE_END();
}
BOOL CNihilanthHVR :: CircleTarget( Vector vecTarget )
{
BOOL fClose = FALSE;
@ -1765,7 +1704,6 @@ BOOL CNihilanthHVR :: CircleTarget( Vector vecTarget )
return fClose;
}
void CNihilanthHVR :: MovetoTarget( Vector vecTarget )
{
if (m_vecIdeal == Vector( 0, 0, 0 ))
@ -1783,12 +1721,8 @@ void CNihilanthHVR :: MovetoTarget( Vector vecTarget )
pev->velocity = m_vecIdeal;
}
void CNihilanthHVR :: 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.2 + vecAim * 128;
@ -1812,7 +1746,6 @@ void CNihilanthHVR :: Crawl( void )
MESSAGE_END();
}
void CNihilanthHVR::RemoveTouch( CBaseEntity *pOther )
{
STOP_SOUND(edict(), CHAN_WEAPON, "x/x_teleattack1.wav" );
@ -1831,7 +1764,4 @@ void CNihilanthHVR::BounceTouch( CBaseEntity *pOther )
m_vecIdeal = vecDir * m_vecIdeal.Length();
}
#endif

View File

@ -38,8 +38,8 @@ Vector VecBModelOrigin( entvars_t* pevBModel );
CGraph WorldGraph;
LINK_ENTITY_TO_CLASS( info_node, CNodeEnt );
LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt );
LINK_ENTITY_TO_CLASS( info_node, CNodeEnt )
LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt )
#if defined _LINUX && !defined _WIN32
#include <unistd.h>
#include <sys/stat.h>
@ -52,7 +52,6 @@ LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt );
//=========================================================
void CGraph :: InitGraph( void)
{
// Make the graph unavailable
//
m_fGraphPresent = FALSE;
@ -112,10 +111,10 @@ void CGraph :: InitGraph( void)
//=========================================================
int CGraph :: AllocNodes ( void )
{
// malloc all of the nodes
// malloc all of the nodes
WorldGraph.m_pNodes = (CNode *)calloc ( sizeof ( CNode ), MAX_NODES );
// could not malloc space for all the nodes!
// could not malloc space for all the nodes!
if ( !WorldGraph.m_pNodes )
{
ALERT ( at_aiconsole, "**ERROR**\nCouldn't malloc %d nodes!\n", WorldGraph.m_cNodes );
@ -145,21 +144,21 @@ entvars_t* CGraph :: LinkEntForLink ( CLink *pLink, CNode *pNode )
entvars_t *pevTrigger;
entvars_t *pevLinkEnt;
TraceResult tr;
pevLinkEnt = pLink->m_pLinkEnt;
if ( !pevLinkEnt )
return NULL;
pentSearch = NULL;// start search at the top of the ent list.
if ( FClassnameIs ( pevLinkEnt, "func_door" ) || FClassnameIs ( pevLinkEnt, "func_door_rotating" ) )
{
///!!!UNDONE - check for TOGGLE or STAY open doors here. If a door is in the way, and is
// TOGGLE or STAY OPEN, even monsters that can't open doors can go that way.
if ( ( pevLinkEnt->spawnflags & SF_DOOR_USE_ONLY ) )
{// door is use only, so the door is all the monster has to worry about
{
// door is use only, so the door is all the monster has to worry about
return pevLinkEnt;
}
@ -168,7 +167,8 @@ entvars_t* CGraph :: LinkEntForLink ( CLink *pLink, CNode *pNode )
pentTrigger = FIND_ENTITY_BY_TARGET ( pentSearch, STRING( pevLinkEnt->targetname ) );// find the button or trigger
if ( FNullEnt( pentTrigger ) )
{// no trigger found
{
// no trigger found
// right now this is a problem among auto-open doors, or any door that opens through the use
// of a trigger brush. Trigger brushes have no models, and don't show up in searches. Just allow
@ -180,7 +180,8 @@ entvars_t* CGraph :: LinkEntForLink ( CLink *pLink, CNode *pNode )
pevTrigger = VARS( pentTrigger );
if ( FClassnameIs(pevTrigger, "func_button") || FClassnameIs(pevTrigger, "func_rot_button" ) )
{// only buttons are handled right now.
{
// only buttons are handled right now.
// trace from the node to the trigger, make sure it's one we can see from the node.
// !!!HACKHACK Use bodyqueue here cause there are no ents we really wish to ignore!
@ -188,7 +189,8 @@ entvars_t* CGraph :: LinkEntForLink ( CLink *pLink, CNode *pNode )
if ( VARS(tr.pHit) == pevTrigger )
{// good to go!
{
// good to go!
return VARS( tr.pHit );
}
}
@ -214,7 +216,8 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
TraceResult tr;
if ( !m_fGraphPresent || !m_fGraphPointersSet )
{// protect us in the case that the node graph isn't available
{
// protect us in the case that the node graph isn't available
ALERT ( at_aiconsole, "Graph not ready!\n" );
return FALSE;
}
@ -226,17 +229,18 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
}
pentWorld = NULL;
// func_door
// func_door
if ( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) )
{// ent is a door.
{
// ent is a door.
pDoor = ( CBaseEntity::Instance( pevLinkEnt ) );
if ( ( pevLinkEnt->spawnflags & SF_DOOR_USE_ONLY ) )
{// door is use only.
{
// door is use only.
if ( ( afCapMask & bits_CAP_OPEN_DOORS ) )
{// let monster right through if he can open doors
{
// let monster right through if he can open doors
return TRUE;
}
else
@ -251,7 +255,8 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
}
}
else
{// door must be opened with a button or trigger field.
{
// door must be opened with a button or trigger field.
// monster should try for it if the door is open and looks as if it will stay that way
if ( pDoor->GetToggleState() == TS_AT_TOP && ( pevLinkEnt->spawnflags & SF_DOOR_NO_AUTO_RETURN ) )
@ -267,7 +272,7 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
return FALSE;
}
}
// func_breakable
// func_breakable
else if ( FClassnameIs( pevLinkEnt, "func_breakable" ) && queryType == NODEGRAPH_STATIC )
{
return TRUE;
@ -313,8 +318,8 @@ int CGraph :: FindNearestLink ( const Vector &vecTestPoint, int *piNearestLink,
flMinDist = 9999;// anything will be closer than this
// go through all of the nodes, and each node's connections
int cSkip = 0;// how many links proper pairing allowed us to skip
// go through all of the nodes, and each node's connections
int cSkip = 0;// how many links proper pairing allowed us to skip
int cChecked = 0;// how many links were checked
for ( i = 0 ; i < m_cNodes ; i++ )
@ -322,7 +327,8 @@ int CGraph :: FindNearestLink ( const Vector &vecTestPoint, int *piNearestLink,
vecSpot1 = m_pNodes[ i ].m_vecOrigin;
if ( m_pNodes[ i ].m_cNumLinks <= 0 )
{// this shouldn't happen!
{
// this shouldn't happen!
ALERT ( at_aiconsole, "**Node %d has no links\n", i );
continue;
}
@ -358,48 +364,51 @@ int CGraph :: FindNearestLink ( const Vector &vecTestPoint, int *piNearestLink,
// now we have two endpoints for a line segment that we've not already checked.
// since all lines that make it this far are within -/+ 32 units of the test point's
// Z Plane, we can get away with doing the point->line check in 2d.
cChecked++;
vec2Spot1 = vecSpot1.Make2D();
vec2Spot2 = vecSpot2.Make2D();
vec2TestPoint = vecTestPoint.Make2D();
// get the line normal.
vec2Line = ( vec2Spot1 - vec2Spot2 ).Normalize();
vec2Normal.x = -vec2Line.y;
vec2Normal.y = vec2Line.x;
if ( DotProduct ( vec2Line, ( vec2TestPoint - vec2Spot1 ) ) > 0 )
{// point outside of line
{
// point outside of line
flDistToLine = ( vec2TestPoint - vec2Spot1 ).Length();
fCurrentAlongLine = FALSE;
}
else if ( DotProduct ( vec2Line, ( vec2TestPoint - vec2Spot2 ) ) < 0 )
{// point outside of line
{
// point outside of line
flDistToLine = ( vec2TestPoint - vec2Spot2 ).Length();
fCurrentAlongLine = FALSE;
}
else
{// point inside line
{
// point inside line
flDistToLine = fabs( DotProduct ( vec2TestPoint - vec2Spot2, vec2Normal ) );
fCurrentAlongLine = TRUE;
}
if ( flDistToLine < flMinDist )
{// just found a line nearer than any other so far
{
// just found a line nearer than any other so far
UTIL_TraceLine ( vecTestPoint, SourceNode( i, j ).m_vecOrigin, ignore_monsters, g_pBodyQueueHead, &tr );
if ( tr.flFraction != 1.0 )
{// crap. can't see the first node of this link, try to see the other
{
// crap. can't see the first node of this link, try to see the other
UTIL_TraceLine ( vecTestPoint, DestNode( i, j ).m_vecOrigin, ignore_monsters, g_pBodyQueueHead, &tr );
if ( tr.flFraction != 1.0 )
{// can't use this link, cause can't see either node!
{
// can't use this link, cause can't see either node!
continue;
}
}
fSuccess = TRUE;// we know there will be something to return.
@ -410,7 +419,6 @@ int CGraph :: FindNearestLink ( const Vector &vecTestPoint, int *piNearestLink,
}
}
}
/*
if ( fSuccess )
{
@ -426,11 +434,9 @@ int CGraph :: FindNearestLink ( const Vector &vecTestPoint, int *piNearestLink,
WRITE_COORD(MSG_BROADCAST, m_pNodes[ m_pLinkPool[ iNearestLink ].m_iDestNode ].m_vecOrigin.z + NODE_HEIGHT);
}
*/
ALERT ( at_aiconsole, "%d Checked\n", cChecked );
return fSuccess;
}
#endif
int CGraph::HullIndex( const CBaseEntity *pEntity )
@ -445,12 +451,11 @@ int CGraph::HullIndex( const CBaseEntity *pEntity )
else if ( pEntity->pev->mins == Vector ( -32, -32, 0 ) )
return NODE_LARGE_HULL;
// ALERT ( at_aiconsole, "Unknown Hull Mins!\n" );
//ALERT ( at_aiconsole, "Unknown Hull Mins!\n" );
return NODE_HUMAN_HULL;
}
int CGraph::NodeType( const CBaseEntity *pEntity )
int CGraph::NodeType( const CBaseEntity *pEntity )
{
if ( pEntity->pev->movetype == MOVETYPE_FLY)
{
@ -466,7 +471,6 @@ int CGraph::NodeType( const CBaseEntity *pEntity )
return bits_NODE_LAND;
}
// Sum up graph weights on the path from iStart to iDest to determine path length
float CGraph::PathLength( int iStart, int iDest, int iHull, int afCapMask )
{
@ -509,7 +513,6 @@ float CGraph::PathLength( int iStart, int iDest, int iHull, int afCapMask )
return distance;
}
// Parse the routing table at iCurrentNode for the next node on the shortest path to iDest
int CGraph::NextNodeInRoute( int iCurrentNode, int iDest, int iHull, int iCap )
{
@ -566,7 +569,6 @@ int CGraph::NextNodeInRoute( int iCurrentNode, int iDest, int iHull, int iCap )
return iNext;
}
//=========================================================
// CGraph - FindShortestPath
//
@ -582,13 +584,15 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
int iHullMask;
if ( !m_fGraphPresent || !m_fGraphPointersSet )
{// protect us in the case that the node graph isn't available or built
{
// protect us in the case that the node graph isn't available or built
ALERT ( at_aiconsole, "Graph not ready!\n" );
return FALSE;
}
if ( iStart < 0 || iStart > m_cNodes )
{// The start node is bad?
{
// The start node is bad?
ALERT ( at_aiconsole, "Can't build a path, iStart is %d!\n", iStart );
return FALSE;
}
@ -678,22 +682,24 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
if (iCurrentNode == iDest) break;
CNode *pCurrentNode = &m_pNodes[ iCurrentNode ];
for ( i = 0 ; i < pCurrentNode->m_cNumLinks ; i++ )
{// run through all of this node's neighbors
{
// run through all of this node's neighbors
iVisitNode = INodeLink ( iCurrentNode, i );
if ( ( m_pLinkPool[ m_pNodes[ iCurrentNode ].m_iFirstLink + i ].m_afLinkInfo & iHullMask ) != iHullMask )
{// monster is too large to walk this connection
{
// monster is too large to walk this connection
//ALERT ( at_aiconsole, "fat ass %d/%d\n",m_pLinkPool[ m_pNodes[ iCurrentNode ].m_iFirstLink + i ].m_afLinkInfo, iMonsterHull );
continue;
}
// check the connection from the current node to the node we're about to mark visited and push into the queue
if ( m_pLinkPool[ m_pNodes[ iCurrentNode ].m_iFirstLink + i ].m_pLinkEnt != NULL )
{// there's a brush ent in the way! Don't mark this node or put it into the queue unless the monster can negotiate it
{
// there's a brush ent in the way! Don't mark this node or put it into the queue unless the monster can negotiate it
if ( !HandleLinkEnt ( iCurrentNode, m_pLinkPool[ m_pNodes[ iCurrentNode ].m_iFirstLink + i ].m_pLinkEnt, afCapMask, NODEGRAPH_STATIC ) )
{// monster should not try to go this way.
{
// monster should not try to go this way.
continue;
}
}
@ -709,16 +715,16 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
}
}
if ( m_pNodes[iDest].m_flClosestSoFar < -0.5 )
{// Destination is unreachable, no path found.
{
// Destination is unreachable, no path found.
return 0;
}
// the queue is not empty
// the queue is not empty
// now we must walk backwards through the m_iPreviousNode field, and count how many connections there are in the path
iCurrentNode = iDest;
iNumPathNodes = 1;// count the dest
while ( iCurrentNode != iStart )
{
iNumPathNodes++;
@ -732,13 +738,10 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
iCurrentNode = m_pNodes [ iCurrentNode ].m_iPreviousNode;
}
}
#if 0
if (m_fRoutingComplete)
{
// This will draw the entire path that was generated for the monster.
for ( int i = 0 ; i < iNumPathNodes - 1 ; i++ )
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
@ -754,7 +757,6 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
MESSAGE_END();
}
}
#endif
#if 0 // MAZE map
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
@ -769,73 +771,73 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
WRITE_COORD( m_pNodes[ 9 ].m_vecOrigin.z + NODE_HEIGHT );
MESSAGE_END();
#endif
return iNumPathNodes;
}
inline ULONG Hash(void *p, int len)
inline ULONG Hash( void *p, int len )
{
CRC32_t ulCrc;
CRC32_INIT(&ulCrc);
CRC32_PROCESS_BUFFER(&ulCrc, p, len);
return CRC32_FINAL(ulCrc);
CRC32_INIT( &ulCrc );
CRC32_PROCESS_BUFFER( &ulCrc, p, len );
return CRC32_FINAL( ulCrc );
}
void inline CalcBounds(int &Lower, int &Upper, int Goal, int Best)
void inline CalcBounds( int &Lower, int &Upper, int Goal, int Best )
{
int Temp = 2*Goal - Best;
if (Best > Goal)
{
Lower = max(0, Temp);
Upper = Best;
}
else
{
Upper = min(255, Temp);
Lower = Best;
}
int Temp = 2 * Goal - Best;
if ( Best > Goal )
{
Lower = max( 0, Temp );
Upper = Best;
}
else
{
Upper = min( 255, Temp );
Lower = Best;
}
}
// Convert from [-8192,8192] to [0, 255]
//
inline int CALC_RANGE(int x, int lower, int upper)
inline int CALC_RANGE( int x, int lower, int upper )
{
return NUM_RANGES*(x-lower)/((upper-lower+1));
return NUM_RANGES * ( x - lower ) / ( ( upper - lower + 1 ) );
}
void inline UpdateRange(int &minValue, int &maxValue, int Goal, int Best)
{
int Lower, Upper;
CalcBounds(Lower, Upper, Goal, Best);
if (Upper < maxValue) maxValue = Upper;
if (minValue < Lower) minValue = Lower;
int Lower, Upper;
CalcBounds( Lower, Upper, Goal, Best );
if( Upper < maxValue ) maxValue = Upper;
if( minValue < Lower ) minValue = Lower;
}
void CGraph :: CheckNode(Vector vecOrigin, int iNode)
void CGraph::CheckNode( Vector vecOrigin, int iNode )
{
// Have we already seen this point before?.
//
if (m_di[iNode].m_CheckedEvent == m_CheckedCounter) return;
m_di[iNode].m_CheckedEvent = m_CheckedCounter;
// Have we already seen this point before?.
//
if( m_di[iNode].m_CheckedEvent == m_CheckedCounter )
return;
float flDist = ( vecOrigin - m_pNodes[ iNode ].m_vecOriginPeek ).Length();
m_di[iNode].m_CheckedEvent = m_CheckedCounter;
if ( flDist < m_flShortest )
float flDist = ( vecOrigin - m_pNodes[iNode].m_vecOriginPeek ).Length();
if( flDist < m_flShortest )
{
TraceResult tr;
// make sure that vecOrigin can trace to this node!
UTIL_TraceLine ( vecOrigin, m_pNodes[ iNode ].m_vecOriginPeek, ignore_monsters, 0, &tr );
UTIL_TraceLine ( vecOrigin, m_pNodes[iNode].m_vecOriginPeek, ignore_monsters, 0, &tr );
if ( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0 )
{
m_iNearest = iNode;
m_flShortest = flDist;
UpdateRange(m_minX, m_maxX, CALC_RANGE(vecOrigin.x, m_RegionMin[0], m_RegionMax[0]), m_pNodes[iNode].m_Region[0]);
UpdateRange(m_minY, m_maxY, CALC_RANGE(vecOrigin.y, m_RegionMin[1], m_RegionMax[1]), m_pNodes[iNode].m_Region[1]);
UpdateRange(m_minZ, m_maxZ, CALC_RANGE(vecOrigin.z, m_RegionMin[2], m_RegionMax[2]), m_pNodes[iNode].m_Region[2]);
UpdateRange( m_minX, m_maxX, CALC_RANGE( vecOrigin.x, m_RegionMin[0], m_RegionMax[0] ), m_pNodes[iNode].m_Region[0] );
UpdateRange( m_minY, m_maxY, CALC_RANGE( vecOrigin.y, m_RegionMin[1], m_RegionMax[1] ), m_pNodes[iNode].m_Region[1] );
UpdateRange( m_minZ, m_maxZ, CALC_RANGE( vecOrigin.z, m_RegionMin[2], m_RegionMax[2] ), m_pNodes[iNode].m_Region[2] );
// From maxCircle, calculate maximum bounds box. All points must be
// simultaneously inside all bounds of the box.
@ -855,18 +857,19 @@ void CGraph :: CheckNode(Vector vecOrigin, int iNode)
// the given vector -1 is failure (couldn't find a valid
// near node )
//=========================================================
int CGraph :: FindNearestNode ( const Vector &vecOrigin, CBaseEntity *pEntity )
int CGraph::FindNearestNode ( const Vector &vecOrigin, CBaseEntity *pEntity )
{
return FindNearestNode( vecOrigin, NodeType( pEntity ) );
}
int CGraph :: FindNearestNode ( const Vector &vecOrigin, int afNodeTypes )
int CGraph::FindNearestNode ( const Vector &vecOrigin, int afNodeTypes )
{
int i;
TraceResult tr;
if ( !m_fGraphPresent || !m_fGraphPointersSet )
{// protect us in the case that the node graph isn't available
if( !m_fGraphPresent || !m_fGraphPointersSet )
{
// protect us in the case that the node graph isn't available
ALERT ( at_aiconsole, "Graph not ready!\n" );
return -1;
}
@ -874,20 +877,20 @@ int CGraph :: FindNearestNode ( const Vector &vecOrigin, int afNodeTypes )
// Check with the cache
//
ULONG iHash = (CACHE_SIZE-1) & Hash((void *)(const float *)vecOrigin, sizeof(vecOrigin));
if (m_Cache[iHash].v == vecOrigin)
if(m_Cache[iHash].v == vecOrigin)
{
//ALERT(at_aiconsole, "Cache Hit.\n");
return m_Cache[iHash].n;
}
else
/* else
{
//ALERT(at_aiconsole, "Cache Miss.\n");
}
*/
// Mark all points as unchecked.
//
m_CheckedCounter++;
if (m_CheckedCounter == 0)
if( m_CheckedCounter == 0 )
{
for ( i = 0; i < m_cNodes; i++ )
{
@ -916,65 +919,90 @@ int CGraph :: FindNearestNode ( const Vector &vecOrigin, int afNodeTypes )
m_maxBoxY = CALC_RANGE(vecOrigin.y + flDist, m_RegionMin[1], m_RegionMax[1]);
m_minBoxZ = CALC_RANGE(vecOrigin.z - flDist, m_RegionMin[2], m_RegionMax[2]);
m_maxBoxZ = CALC_RANGE(vecOrigin.z + flDist, m_RegionMin[2], m_RegionMax[2])
CalcBounds(m_minX, m_maxX, CALC_RANGE(vecOrigin.x, m_RegionMin[0], m_RegionMax[0]), m_pNodes[m_iNearest].m_Region[0]);
CalcBounds(m_minY, m_maxY, CALC_RANGE(vecOrigin.y, m_RegionMin[1], m_RegionMax[1]), m_pNodes[m_iNearest].m_Region[1]);
CalcBounds(m_minZ, m_maxZ, CALC_RANGE(vecOrigin.z, m_RegionMin[2], m_RegionMax[2]), m_pNodes[m_iNearest].m_Region[2]);
CalcBounds(m_minX, m_maxX, CALC_RANGE(vecOrigin.x, m_RegionMin[0], m_RegionMax[0]), m_pNodes[m_iNearest].m_Region[0]);
CalcBounds(m_minY, m_maxY, CALC_RANGE(vecOrigin.y, m_RegionMin[1], m_RegionMax[1]), m_pNodes[m_iNearest].m_Region[1]);
CalcBounds(m_minZ, m_maxZ, CALC_RANGE(vecOrigin.z, m_RegionMin[2], m_RegionMax[2]), m_pNodes[m_iNearest].m_Region[2]);
#endif
int halfX = ( m_minX+m_maxX ) / 2;
int halfY = ( m_minY+m_maxY ) / 2;
int halfZ = ( m_minZ+m_maxZ ) / 2;
int halfX = (m_minX+m_maxX)/2;
int halfY = (m_minY+m_maxY)/2;
int halfZ = (m_minZ+m_maxZ)/2;
int j;
int j;
for (i = halfX; i >= m_minX; i--)
{
for (j = m_RangeStart[0][i]; j <= m_RangeEnd[0][i]; j++)
{
if (!(m_pNodes[m_di[j].m_SortedBy[0]].m_afNodeInfo & afNodeTypes)) continue;
for( i = halfX; i >= m_minX; i-- )
{
for( j = m_RangeStart[0][i]; j <= m_RangeEnd[0][i]; j++ )
{
if ( !( m_pNodes[m_di[j].m_SortedBy[0]].m_afNodeInfo & afNodeTypes ) )
continue;
int rgY = m_pNodes[m_di[j].m_SortedBy[0]].m_Region[1];
if (rgY > m_maxBoxY) break;
if (rgY < m_minBoxY) continue;
if( rgY > m_maxBoxY )
break;
if( rgY < m_minBoxY )
continue;
int rgZ = m_pNodes[m_di[j].m_SortedBy[0]].m_Region[2];
if (rgZ < m_minBoxZ) continue;
if (rgZ > m_maxBoxZ) continue;
CheckNode(vecOrigin, m_di[j].m_SortedBy[0]);
}
}
if( rgZ < m_minBoxZ )
continue;
for (i = max(m_minY,halfY+1); i <= m_maxY; i++)
{
for (j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++)
{
if (!(m_pNodes[m_di[j].m_SortedBy[1]].m_afNodeInfo & afNodeTypes)) continue;
if( rgZ > m_maxBoxZ )
continue;
CheckNode( vecOrigin, m_di[j].m_SortedBy[0] );
}
}
for( i = max( m_minY, halfY + 1 ); i <= m_maxY; i++ )
{
for( j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++ )
{
if( !( m_pNodes[m_di[j].m_SortedBy[1]].m_afNodeInfo & afNodeTypes ) )
continue;
int rgZ = m_pNodes[m_di[j].m_SortedBy[1]].m_Region[2];
if (rgZ > m_maxBoxZ) break;
if (rgZ < m_minBoxZ) continue;
int rgX = m_pNodes[m_di[j].m_SortedBy[1]].m_Region[0];
if (rgX < m_minBoxX) continue;
if (rgX > m_maxBoxX) continue;
CheckNode(vecOrigin, m_di[j].m_SortedBy[1]);
}
}
if( rgZ > m_maxBoxZ )
break;
for (i = min(m_maxZ,halfZ); i >= m_minZ; i--)
{
for (j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++)
{
if (!(m_pNodes[m_di[j].m_SortedBy[2]].m_afNodeInfo & afNodeTypes)) continue;
if( rgZ < m_minBoxZ )
continue;
int rgX = m_pNodes[m_di[j].m_SortedBy[1]].m_Region[0];
if( rgX < m_minBoxX )
continue;
if( rgX > m_maxBoxX )
continue;
CheckNode(vecOrigin, m_di[j].m_SortedBy[1]);
}
}
for( i = min( m_maxZ, halfZ ); i >= m_minZ; i-- )
{
for (j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++)
{
if( !( m_pNodes[m_di[j].m_SortedBy[2]].m_afNodeInfo & afNodeTypes ) )
continue;
int rgX = m_pNodes[m_di[j].m_SortedBy[2]].m_Region[0];
if (rgX > m_maxBoxX) break;
if (rgX < m_minBoxX) continue;
if( rgX > m_maxBoxX )
break;
if( rgX < m_minBoxX )
continue;
int rgY = m_pNodes[m_di[j].m_SortedBy[2]].m_Region[1];
if (rgY < m_minBoxY) continue;
if (rgY > m_maxBoxY) continue;
CheckNode(vecOrigin, m_di[j].m_SortedBy[2]);
}
}
if( rgY < m_minBoxY )
continue;
if( rgY > m_maxBoxY )
continue;
CheckNode(vecOrigin, m_di[j].m_SortedBy[2]);
}
}
for (i = max(m_minX,halfX+1); i <= m_maxX; i++)
{
@ -1430,7 +1458,6 @@ int CGraph :: RejectInlineLinks ( CLink *pLinkPool, FILE *file )
//=========================================================
class CTestHull : public CBaseMonster
{
public:
void Spawn( entvars_t *pevMasterNode );
virtual int ObjectCaps( void ) { return CBaseMonster :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
@ -1443,7 +1470,7 @@ public:
Vector vecBadNodeOrigin;
};
LINK_ENTITY_TO_CLASS( testhull, CTestHull );
LINK_ENTITY_TO_CLASS( testhull, CTestHull )
//=========================================================
// CTestHull::Spawn
@ -1576,6 +1603,7 @@ void CTestHull :: ShowBadNode( void )
}
extern BOOL gTouchDisabled;
void CTestHull::CallBuildNodeGraph( void )
{
// TOUCH HACK -- Don't allow this entity to call anyone's "touch" function
@ -1637,7 +1665,7 @@ void CTestHull :: BuildNodeGraph( void )
SetThink( &CBaseEntity::SUB_Remove );// no matter what happens, the hull gets rid of itself.
pev->nextthink = gpGlobals->time;
// malloc a swollen temporary connection pool that we trim down after we know exactly how many connections there are.
//malloc a swollen temporary connection pool that we trim down after we know exactly how many connections there are.
pTempPool = (CLink *)calloc ( sizeof ( CLink ) , ( WorldGraph.m_cNodes * MAX_NODE_INITIAL_LINKS ) );
if ( !pTempPool )
{
@ -1763,8 +1791,8 @@ void CTestHull :: BuildNodeGraph( void )
return;
}
// send the walkhull to all of this node's connections now. We'll do this here since
// so much of it relies on being able to control the test hull.
// send the walkhull to all of this node's connections now. We'll do this here since
// so much of it relies on being able to control the test hull.
fprintf ( file, "----------------------------------------------------------------------------\n" );
fprintf ( file, "Walk Rejection:\n");
@ -1931,7 +1959,7 @@ void CTestHull :: BuildNodeGraph( void )
cPoolLinks -= WorldGraph.RejectInlineLinks ( pTempPool, file );
// now malloc a pool just large enough to hold the links that are actually used
// now malloc a pool just large enough to hold the links that are actually used
WorldGraph.m_pLinkPool = (CLink *) calloc ( sizeof ( CLink ), cPoolLinks );
if ( !WorldGraph.m_pLinkPool )
@ -1950,7 +1978,7 @@ void CTestHull :: BuildNodeGraph( void )
}
WorldGraph.m_cLinks = cPoolLinks;
//copy only the used portions of the TempPool into the graph's link pool
//copy only the used portions of the TempPool into the graph's link pool
int iFinalPoolIndex = 0;
int iOldFirstLink;
@ -1980,9 +2008,9 @@ void CTestHull :: BuildNodeGraph( void )
fprintf ( file, "\n\n-------------------------------------------------------------------------------\n");
fprintf ( file, "Link Pairings:\n");
// link integrity check. The idea here is that if Node A links to Node B, node B should
// link to node A. If not, we have a situation that prevents us from using a basic
// optimization in the FindNearestLink function.
// link integrity check. The idea here is that if Node A links to Node B, node B should
// link to node A. If not, we have a situation that prevents us from using a basic
// optimization in the FindNearestLink function.
for ( i = 0 ; i < WorldGraph.m_cNodes ; i++ )
{
for ( j = 0 ; j < WorldGraph.m_pNodes[ i ].m_cNumLinks ; j++ )
@ -2050,12 +2078,11 @@ void CTestHull :: BuildNodeGraph( void )
//
WorldGraph.ComputeStaticRoutingTables();
// save the node graph for this level
// save the node graph for this level
WorldGraph.FSaveGraph( (char *)STRING( gpGlobals->mapname ) );
ALERT( at_console, "Done.\n");
}
//=========================================================
// returns a hardcoded path.
//=========================================================
@ -2106,7 +2133,6 @@ void CTestHull :: PathFind ( void )
}
//=========================================================
// CStack Constructor
//=========================================================
@ -2265,7 +2291,7 @@ void CQueuePriority::Heap_SiftDown(int iSubRoot)
struct tag_HEAP_NODE Ref = m_heap[ parent ];
while (child < m_cSize)
while (child < m_cSize)
{
int rightchild = HEAP_RIGHT_CHILD(parent);
if (rightchild < m_cSize)
@ -2367,7 +2393,6 @@ int CGraph :: FLoadGraph ( char *szMapName )
m_pRouteInfo = NULL;
m_pHashLinks = NULL;
// Malloc for the nodes
//
m_pNodes = ( CNode * )calloc ( sizeof ( CNode ), m_cNodes );
@ -2786,6 +2811,7 @@ void CGraph::HashChoosePrimes(int TableSize)
// Renumber nodes so that nodes that link together are together.
//
#define UNNUMBERED_NODE -1
void CGraph::SortNodes(void)
{
// We are using m_iPreviousNode to be the new node number.
@ -3327,7 +3353,6 @@ void CGraph :: ComputeStaticRoutingTables( void )
BestNextNodes = 0;
pRoute = 0;
pMyPath = 0;
#if 0
TestRoutingTables();
#endif
@ -3453,21 +3478,12 @@ void CGraph :: TestRoutingTables( void )
}
EnoughSaid:
if (pMyPath) delete[] pMyPath;
if (pMyPath2) delete[] pMyPath2;
pMyPath = 0;
pMyPath2 = 0;
}
//=========================================================
// CNodeViewer - Draws a graph of the shorted path from all nodes
// to current location (typically the player). It then draws
@ -3490,12 +3506,12 @@ public:
void FindNodeConnections( int iNode );
void AddNode( int iFrom, int iTo );
void EXPORT DrawThink( void );
};
LINK_ENTITY_TO_CLASS( node_viewer, CNodeViewer );
LINK_ENTITY_TO_CLASS( node_viewer_human, CNodeViewer );
LINK_ENTITY_TO_CLASS( node_viewer_fly, CNodeViewer );
LINK_ENTITY_TO_CLASS( node_viewer_large, CNodeViewer );
LINK_ENTITY_TO_CLASS( node_viewer, CNodeViewer )
LINK_ENTITY_TO_CLASS( node_viewer_human, CNodeViewer )
LINK_ENTITY_TO_CLASS( node_viewer_fly, CNodeViewer )
LINK_ENTITY_TO_CLASS( node_viewer_large, CNodeViewer )
void CNodeViewer::Spawn( )
{
@ -3571,7 +3587,6 @@ void CNodeViewer::Spawn( )
pev->nextthink = gpGlobals->time;
}
void CNodeViewer :: FindNodeConnections ( int iNode )
{
AddNode( iNode, WorldGraph.NextNodeInRoute( iNode, m_iBaseNode, m_iHull, 0 ));
@ -3645,5 +3660,3 @@ void CNodeViewer :: DrawThink( void )
m_iDraw++;
}
}

View File

@ -88,7 +88,6 @@ public:
float m_flWeight;// length of the link line segment
};
typedef struct
{
int m_SortedBy[3];
@ -105,6 +104,7 @@ typedef struct
// CGraph
//=========================================================
#define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files.
class CGraph
{
public:
@ -269,7 +269,6 @@ class CNodeEnt : public CBaseEntity
short m_sHintActivity;
};
//=========================================================
// CStack - last in, first out.
//=========================================================
@ -289,7 +288,6 @@ private:
int m_level;
};
//=========================================================
// CQueue - first in, first out.
//=========================================================
@ -368,7 +366,7 @@ enum
HINT_TACTICAL_AMBUSH,
HINT_STUKA_PERCH = 300,
HINT_STUKA_LANDING,
HINT_STUKA_LANDING
};
extern CGraph WorldGraph;

View File

@ -12,6 +12,7 @@
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -30,11 +31,8 @@ typedef struct
Vector vecAngles;
} t_ospreygrunt;
#define SF_WAITFORTRIGGER 0x40
#define MAX_CARRY 24
class COsprey : public CBaseMonster
@ -105,9 +103,9 @@ public:
int m_iDoRightSmokePuff;
};
LINK_ENTITY_TO_CLASS( monster_osprey, COsprey );
LINK_ENTITY_TO_CLASS( monster_osprey, COsprey )
TYPEDESCRIPTION COsprey::m_SaveData[] =
TYPEDESCRIPTION COsprey::m_SaveData[] =
{
DEFINE_FIELD( COsprey, m_pGoalEnt, FIELD_CLASSPTR ),
DEFINE_FIELD( COsprey, m_vel1, FIELD_VECTOR ),
@ -139,8 +137,8 @@ TYPEDESCRIPTION COsprey::m_SaveData[] =
DEFINE_FIELD( COsprey, m_iDoLeftSmokePuff, FIELD_INTEGER ),
DEFINE_FIELD( COsprey, m_iDoRightSmokePuff, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( COsprey, CBaseMonster );
IMPLEMENT_SAVERESTORE( COsprey, CBaseMonster )
void COsprey :: Spawn( void )
{
@ -180,7 +178,6 @@ void COsprey :: Spawn( void )
m_vel2 = pev->velocity;
}
void COsprey::Precache( void )
{
UTIL_PrecacheOther( "monster_human_grunt" );
@ -230,7 +227,6 @@ void COsprey :: FindAllThink( void )
m_startTime = gpGlobals->time;
}
void COsprey :: DeployThink( void )
{
UTIL_MakeAimVectors( pev->angles );
@ -261,8 +257,6 @@ void COsprey :: DeployThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
BOOL COsprey :: HasDead( )
{
for (int i = 0; i < m_iUnits; i++)
@ -279,7 +273,6 @@ BOOL COsprey :: HasDead( )
return FALSE;
}
CBaseMonster *COsprey :: MakeGrunt( Vector vecSrc )
{
CBaseEntity *pEntity;
@ -321,7 +314,6 @@ CBaseMonster *COsprey :: MakeGrunt( Vector vecSrc )
return NULL;
}
void COsprey :: HoverThink( void )
{
int i;
@ -344,7 +336,6 @@ void COsprey :: HoverThink( void )
ShowDamage( );
}
void COsprey::UpdateGoal( )
{
if (m_pGoalEnt)
@ -380,7 +371,6 @@ void COsprey::UpdateGoal( )
}
}
void COsprey::FlyThink( void )
{
StudioFrameAdvance( );
@ -408,7 +398,6 @@ void COsprey::FlyThink( void )
ShowDamage( );
}
void COsprey::Flight( )
{
float t = (gpGlobals->time - m_startTime);
@ -484,13 +473,11 @@ void COsprey::Flight( )
}
void COsprey::HitTouch( CBaseEntity *pOther )
{
pev->nextthink = gpGlobals->time + 2.0;
}
/*
int COsprey::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
@ -507,8 +494,6 @@ int COsprey::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
}
*/
void COsprey :: Killed( entvars_t *pevAttacker, int iGib )
{
pev->movetype = MOVETYPE_TOSS;
@ -539,7 +524,6 @@ void COsprey::CrashTouch( CBaseEntity *pOther )
}
}
void COsprey :: DyingThink( void )
{
StudioFrameAdvance( );
@ -728,7 +712,6 @@ void COsprey :: DyingThink( void )
}
}
void COsprey :: ShowDamage( void )
{
if (m_iDoLeftSmokePuff > 0 || RANDOM_LONG(0,99) > m_flLeftHealth)
@ -763,7 +746,6 @@ void COsprey :: ShowDamage( void )
}
}
void COsprey::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
// ALERT( at_console, "%d %.0f\n", ptr->iHitgroup, flDamage );
@ -798,8 +780,3 @@ void COsprey::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
UTIL_Sparks( ptr->vecEndPos );
}
}

View File

@ -38,15 +38,15 @@ private:
float m_flWait;
};
LINK_ENTITY_TO_CLASS( path_corner, CPathCorner );
LINK_ENTITY_TO_CLASS( path_corner, CPathCorner )
// Global Savedata for Delay
TYPEDESCRIPTION CPathCorner::m_SaveData[] =
TYPEDESCRIPTION CPathCorner::m_SaveData[] =
{
DEFINE_FIELD( CPathCorner, m_flWait, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CPathCorner, CPointEntity );
IMPLEMENT_SAVERESTORE( CPathCorner, CPointEntity )
//
// Cache user-entity-field values until spawn is called.
@ -62,7 +62,6 @@ void CPathCorner :: KeyValue( KeyValueData *pkvd )
CPointEntity::KeyValue( pkvd );
}
void CPathCorner :: Spawn( )
{
ASSERTSZ(!FStringNull(pev->targetname), "path_corner without a targetname");
@ -116,9 +115,7 @@ void CPathCorner :: Touch( CBaseEntity *pOther )
}
#endif
TYPEDESCRIPTION CPathTrack::m_SaveData[] =
TYPEDESCRIPTION CPathTrack::m_SaveData[] =
{
DEFINE_FIELD( CPathTrack, m_length, FIELD_FLOAT ),
DEFINE_FIELD( CPathTrack, m_pnext, FIELD_CLASSPTR ),
@ -127,8 +124,8 @@ TYPEDESCRIPTION CPathTrack::m_SaveData[] =
DEFINE_FIELD( CPathTrack, m_altName, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CPathTrack, CBaseEntity );
LINK_ENTITY_TO_CLASS( path_track, CPathTrack );
IMPLEMENT_SAVERESTORE( CPathTrack, CBaseEntity )
LINK_ENTITY_TO_CLASS( path_track, CPathTrack )
//
// Cache user-entity-field values until spawn is called.
@ -174,7 +171,6 @@ void CPathTrack :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
}
}
void CPathTrack :: Link( void )
{
edict_t *pentTarget;
@ -211,7 +207,6 @@ void CPathTrack :: Link( void )
}
}
void CPathTrack :: Spawn( void )
{
pev->solid = SOLID_TRIGGER;
@ -226,7 +221,6 @@ void CPathTrack :: Spawn( void )
#endif
}
void CPathTrack::Activate( void )
{
if ( !FStringNull( pev->targetname ) ) // Link to next, and back-link
@ -244,7 +238,6 @@ CPathTrack *CPathTrack :: ValidPath( CPathTrack *ppath, int testFlag )
return ppath;
}
void CPathTrack :: Project( CPathTrack *pstart, CPathTrack *pend, Vector *origin, float dist )
{
if ( pstart && pend )
@ -273,8 +266,6 @@ CPathTrack *CPathTrack::GetPrevious( void )
return m_pprevious;
}
void CPathTrack::SetPrevious( CPathTrack *pprev )
{
// Only set previous if this isn't my alternate path
@ -282,7 +273,6 @@ void CPathTrack::SetPrevious( CPathTrack *pprev )
m_pprevious = pprev;
}
// Assumes this is ALWAYS enabled
CPathTrack *CPathTrack :: LookAhead( Vector *origin, float dist, int move )
{
@ -364,7 +354,6 @@ CPathTrack *CPathTrack :: LookAhead( Vector *origin, float dist, int move )
return pcurrent;
}
// Assumes this is ALWAYS enabled
CPathTrack *CPathTrack :: Nearest( Vector origin )
@ -404,7 +393,6 @@ CPathTrack *CPathTrack :: Nearest( Vector origin )
return pnearest;
}
CPathTrack *CPathTrack::Instance( edict_t *pent )
{
if ( FClassnameIs( pent, "path_track" ) )
@ -412,8 +400,7 @@ CPathTrack *CPathTrack::Instance( edict_t *pent )
return NULL;
}
// DEBUGGING CODE
// DEBUGGING CODE
#if PATH_SPARKLE_DEBUG
void CPathTrack :: Sparkle( void )
{
@ -425,4 +412,3 @@ void CPathTrack :: Sparkle( void )
UTIL_ParticleEffect(pev->origin, Vector(0,0,100), 84, 10);
}
#endif

View File

@ -30,4 +30,4 @@ extern server_physics_api_t g_physfuncs;
#define GET_SERVER_STATE (*g_physfuncs.pfnServerState)
#define HOST_ERROR (*g_physfuncs.pfnHost_Error)
#endif //PHYSCALLBACK_H
#endif //PHYSCALLBACK_H

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "extdll.h"
#include "plane.h"
@ -34,7 +35,6 @@ void CPlane :: InitializePlane ( const Vector &vecNormal, const Vector &vecPoint
m_fInitialized = TRUE;
}
//=========================================================
// PointInFront - determines whether the given vector is
// in front of the plane.
@ -57,4 +57,3 @@ BOOL CPlane :: PointInFront ( const Vector &vecPoint )
return FALSE;
}

View File

@ -49,14 +49,14 @@ public:
float m_volume; // Sound volume
};
TYPEDESCRIPTION CBasePlatTrain::m_SaveData[] =
TYPEDESCRIPTION CBasePlatTrain::m_SaveData[] =
{
DEFINE_FIELD( CBasePlatTrain, m_bMoveSnd, FIELD_CHARACTER ),
DEFINE_FIELD( CBasePlatTrain, m_bStopSnd, FIELD_CHARACTER ),
DEFINE_FIELD( CBasePlatTrain, m_volume, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CBasePlatTrain, CBaseToggle );
IMPLEMENT_SAVERESTORE( CBasePlatTrain, CBaseToggle )
void CBasePlatTrain :: KeyValue( KeyValueData *pkvd )
{
@ -104,7 +104,7 @@ void CBasePlatTrain :: KeyValue( KeyValueData *pkvd )
void CBasePlatTrain::Precache( void )
{
// set the plat's "in-motion" sound
// set the plat's "in-motion" sound
switch (m_bMoveSnd)
{
case 0:
@ -167,7 +167,7 @@ void CBasePlatTrain::Precache( void )
break;
}
// set the plat's 'reached destination' stop sound
// set the plat's 'reached destination' stop sound
switch (m_bStopSnd)
{
case 0:
@ -216,7 +216,6 @@ void CBasePlatTrain::Precache( void )
//====================== PLAT code ====================================================
//
#define noiseMovement noise
#define noiseStopMoving noise1
@ -229,7 +228,6 @@ public:
virtual void Blocked( CBaseEntity *pOther );
void EXPORT PlatUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT CallGoDown( void ) { GoDown(); }
@ -241,8 +239,8 @@ public:
virtual void HitTop( void );
virtual void HitBottom( void );
};
LINK_ENTITY_TO_CLASS( func_plat, CFuncPlat );
LINK_ENTITY_TO_CLASS( func_plat, CFuncPlat )
// UNDONE: Need to save this!!! It needs class & linkage
class CPlatTrigger : public CBaseEntity
@ -254,8 +252,6 @@ public:
CFuncPlat *m_pPlatform;
};
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
speed default 150
@ -305,7 +301,6 @@ void CFuncPlat :: Setup( void )
m_volume = 0.85;
}
void CFuncPlat :: Precache( )
{
CBasePlatTrain::Precache();
@ -315,7 +310,6 @@ void CFuncPlat :: Precache( )
PlatSpawnInsideTrigger( pev ); // the "start moving" trigger
}
void CFuncPlat :: Spawn( )
{
Setup();
@ -337,14 +331,11 @@ void CFuncPlat :: Spawn( )
}
}
static void PlatSpawnInsideTrigger(entvars_t* pevPlatform)
{
GetClassPtr( (CPlatTrigger *)NULL)->SpawnInsideTrigger( GetClassPtr( (CFuncPlat *)pevPlatform ) );
}
//
// Create a trigger entity for a platform.
//
@ -373,7 +364,6 @@ void CPlatTrigger :: SpawnInsideTrigger( CFuncPlat *pPlatform )
UTIL_SetSize ( pev, vecTMin, vecTMax );
}
//
// When the platform's trigger field is touched, the platform ???
//
@ -395,7 +385,6 @@ void CPlatTrigger :: Touch( CBaseEntity *pOther )
m_pPlatform->pev->nextthink = m_pPlatform->pev->ltime + 1;// delay going down
}
//
// Used by SUB_UseTargets, when a platform is the target of a button.
// Start bringing platform down.
@ -424,7 +413,6 @@ void CFuncPlat :: PlatUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
}
//
// Platform is at top, now starts moving down.
//
@ -439,7 +427,6 @@ void CFuncPlat :: GoDown( void )
LinearMove(m_vecPosition2, pev->speed);
}
//
// Platform has hit bottom. Stops and waits forever.
//
@ -455,7 +442,6 @@ void CFuncPlat :: HitBottom( void )
m_toggle_state = TS_AT_BOTTOM;
}
//
// Platform is at bottom, now starts moving up
//
@ -470,7 +456,6 @@ void CFuncPlat :: GoUp( void )
LinearMove(m_vecPosition1, pev->speed);
}
//
// Platform has hit top. Pauses, then starts back down again.
//
@ -493,7 +478,6 @@ void CFuncPlat :: HitTop( void )
}
}
void CFuncPlat :: Blocked( CBaseEntity *pOther )
{
ALERT( at_aiconsole, "%s Blocked by %s\n", STRING(pev->classname), STRING(pOther->pev->classname) );
@ -511,7 +495,6 @@ void CFuncPlat :: Blocked( CBaseEntity *pOther )
GoUp ();
}
class CFuncPlatRot : public CFuncPlat
{
public:
@ -530,15 +513,15 @@ public:
Vector m_end, m_start;
};
LINK_ENTITY_TO_CLASS( func_platrot, CFuncPlatRot );
TYPEDESCRIPTION CFuncPlatRot::m_SaveData[] =
LINK_ENTITY_TO_CLASS( func_platrot, CFuncPlatRot )
TYPEDESCRIPTION CFuncPlatRot::m_SaveData[] =
{
DEFINE_FIELD( CFuncPlatRot, m_end, FIELD_VECTOR ),
DEFINE_FIELD( CFuncPlatRot, m_start, FIELD_VECTOR ),
};
IMPLEMENT_SAVERESTORE( CFuncPlatRot, CFuncPlat );
IMPLEMENT_SAVERESTORE( CFuncPlatRot, CFuncPlat )
void CFuncPlatRot :: SetupRotation( void )
{
@ -559,7 +542,6 @@ void CFuncPlatRot :: SetupRotation( void )
}
}
void CFuncPlatRot :: Spawn( void )
{
CFuncPlat :: Spawn();
@ -572,7 +554,6 @@ void CFuncPlatRot :: GoDown( void )
RotMove( m_start, pev->nextthink - pev->ltime );
}
//
// Platform has hit bottom. Stops and waits forever.
//
@ -583,7 +564,6 @@ void CFuncPlatRot :: HitBottom( void )
pev->angles = m_start;
}
//
// Platform is at bottom, now starts moving up
//
@ -593,7 +573,6 @@ void CFuncPlatRot :: GoUp( void )
RotMove( m_end, pev->nextthink - pev->ltime );
}
//
// Platform has hit top. Pauses, then starts back down again.
//
@ -604,7 +583,6 @@ void CFuncPlatRot :: HitTop( void )
pev->angles = m_end;
}
void CFuncPlatRot :: RotMove( Vector &destAngle, float time )
{
// set destdelta to the vector needed to move
@ -620,7 +598,6 @@ void CFuncPlatRot :: RotMove( Vector &destAngle, float time )
}
}
//
//====================== TRAIN code ==================================================
//
@ -649,16 +626,16 @@ public:
BOOL m_activated;
};
LINK_ENTITY_TO_CLASS( func_train, CFuncTrain );
TYPEDESCRIPTION CFuncTrain::m_SaveData[] =
LINK_ENTITY_TO_CLASS( func_train, CFuncTrain )
TYPEDESCRIPTION CFuncTrain::m_SaveData[] =
{
DEFINE_FIELD( CFuncTrain, m_sounds, FIELD_INTEGER ),
DEFINE_FIELD( CFuncTrain, m_pevCurrentTarget, FIELD_EVARS ),
DEFINE_FIELD( CFuncTrain, m_activated, FIELD_BOOLEAN ),
};
IMPLEMENT_SAVERESTORE( CFuncTrain, CBasePlatTrain );
IMPLEMENT_SAVERESTORE( CFuncTrain, CBasePlatTrain )
void CFuncTrain :: KeyValue( KeyValueData *pkvd )
{
@ -671,9 +648,7 @@ void CFuncTrain :: KeyValue( KeyValueData *pkvd )
CBasePlatTrain::KeyValue( pkvd );
}
void CFuncTrain :: Blocked( CBaseEntity *pOther )
{
if ( gpGlobals->time < m_flActivateFinished)
return;
@ -683,7 +658,6 @@ void CFuncTrain :: Blocked( CBaseEntity *pOther )
pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH);
}
void CFuncTrain :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( pev->spawnflags & SF_TRAIN_WAIT_RETRIGGER )
@ -705,7 +679,6 @@ void CFuncTrain :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
}
}
void CFuncTrain :: Wait( void )
{
// Fire the pass target if there is one
@ -718,21 +691,23 @@ void CFuncTrain :: Wait( void )
// need pointer to LAST target.
if ( FBitSet (m_pevCurrentTarget->spawnflags , SF_TRAIN_WAIT_RETRIGGER ) || ( pev->spawnflags & SF_TRAIN_WAIT_RETRIGGER ) )
{
{
pev->spawnflags |= SF_TRAIN_WAIT_RETRIGGER;
// clear the sound channel.
// clear the sound channel.
if ( pev->noiseMovement )
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING(pev->noiseMovement) );
if ( pev->noiseStopMoving )
EMIT_SOUND (ENT(pev), CHAN_VOICE, (char*)STRING(pev->noiseStopMoving), m_volume, ATTN_NORM);
pev->nextthink = 0;
return;
}
// ALERT ( at_console, "%f\n", m_flWait );
return;
}
// ALERT ( at_console, "%f\n", m_flWait );
if (m_flWait != 0)
{// -1 wait will wait forever!
{
// -1 wait will wait forever!
pev->nextthink = pev->ltime + m_flWait;
if ( pev->noiseMovement )
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING(pev->noiseMovement) );
@ -746,7 +721,6 @@ void CFuncTrain :: Wait( void )
}
}
//
// Train next - path corner needs to change to next target
//
@ -758,7 +732,7 @@ void CFuncTrain :: Next( void )
// now find our next target
pTarg = GetNextTarget();
if ( !pTarg )
if( !pTarg )
{
if ( pev->noiseMovement )
STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING(pev->noiseMovement) );
@ -775,13 +749,14 @@ void CFuncTrain :: Next( void )
m_flWait = pTarg->GetDelay();
if ( m_pevCurrentTarget && m_pevCurrentTarget->speed != 0 )
{// don't copy speed from target if it is 0 (uninitialized)
pev->speed = m_pevCurrentTarget->speed;
{
// don't copy speed from target if it is 0 (uninitialized)
pev->speed = m_pevCurrentTarget->speed;
ALERT( at_aiconsole, "Train %s speed to %4.2f\n", STRING(pev->targetname), pev->speed );
}
m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us.
pev->enemy = pTarg->edict();//hack
pev->enemy = pTarg->edict();//hack
if(FBitSet(m_pevCurrentTarget->spawnflags, SF_CORNER_TELEPORT))
{
@ -807,7 +782,6 @@ void CFuncTrain :: Next( void )
}
}
void CFuncTrain :: Activate( void )
{
// Not yet active, so teleport to first target
@ -815,10 +789,10 @@ void CFuncTrain :: Activate( void )
{
m_activated = TRUE;
entvars_t *pevTarg = VARS( FIND_ENTITY_BY_TARGETNAME (NULL, STRING(pev->target) ) );
pev->target = pevTarg->target;
m_pevCurrentTarget = pevTarg;// keep track of this since path corners change our target for us.
UTIL_SetOrigin (pev, pevTarg->origin - (pev->mins + pev->maxs) * 0.5 );
if ( FStringNull(pev->targetname) )
@ -847,15 +821,15 @@ void CFuncTrain :: Spawn( void )
Precache();
if (pev->speed == 0)
pev->speed = 100;
if ( FStringNull(pev->target) )
ALERT(at_console, "FuncTrain with no target");
if (pev->dmg == 0)
pev->dmg = 2;
pev->movetype = MOVETYPE_PUSH;
if ( FBitSet (pev->spawnflags, SF_TRACKTRAIN_PASSABLE) )
pev->solid = SOLID_NOT;
else
@ -871,11 +845,9 @@ void CFuncTrain :: Spawn( void )
m_volume = 0.85;
}
void CFuncTrain::Precache( void )
{
CBasePlatTrain::Precache();
#if 0 // obsolete
// otherwise use preset sound
switch (m_sounds)
@ -884,14 +856,12 @@ void CFuncTrain::Precache( void )
pev->noise = 0;
pev->noise1 = 0;
break;
case 1:
PRECACHE_SOUND ("plats/train2.wav");
PRECACHE_SOUND ("plats/train1.wav");
pev->noise = MAKE_STRING("plats/train2.wav");
pev->noise1 = MAKE_STRING("plats/train1.wav");
break;
case 2:
PRECACHE_SOUND ("plats/platmove1.wav");
PRECACHE_SOUND ("plats/platstop1.wav");
@ -902,7 +872,6 @@ void CFuncTrain::Precache( void )
#endif
}
void CFuncTrain::OverrideReset( void )
{
CBaseEntity *pTarg;
@ -926,9 +895,6 @@ void CFuncTrain::OverrideReset( void )
}
}
// ---------------------------------------------------------------------
//
// Track Train
@ -951,8 +917,8 @@ TYPEDESCRIPTION CFuncTrackTrain::m_SaveData[] =
DEFINE_FIELD( CFuncTrackTrain, m_oldSpeed, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CFuncTrackTrain, CBaseEntity );
LINK_ENTITY_TO_CLASS( func_tracktrain, CFuncTrackTrain );
IMPLEMENT_SAVERESTORE( CFuncTrackTrain, CBaseEntity )
LINK_ENTITY_TO_CLASS( func_tracktrain, CFuncTrackTrain )
void CFuncTrackTrain :: KeyValue( KeyValueData *pkvd )
{
@ -991,7 +957,6 @@ void CFuncTrackTrain :: KeyValue( KeyValueData *pkvd )
CBaseEntity::KeyValue( pkvd );
}
void CFuncTrackTrain :: NextThink( float thinkTime, BOOL alwaysThink )
{
if ( alwaysThink )
@ -1002,7 +967,6 @@ void CFuncTrackTrain :: NextThink( float thinkTime, BOOL alwaysThink )
pev->nextthink = thinkTime;
}
void CFuncTrackTrain :: Blocked( CBaseEntity *pOther )
{
entvars_t *pevOther = pOther->pev;
@ -1027,7 +991,6 @@ void CFuncTrackTrain :: Blocked( CBaseEntity *pOther )
pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH);
}
void CFuncTrackTrain :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( useType != USE_SET )
@ -1038,7 +1001,7 @@ void CFuncTrackTrain :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
if ( pev->speed == 0 )
{
pev->speed = m_speed * m_dir;
Next();
}
else
@ -1070,7 +1033,6 @@ void CFuncTrackTrain :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
}
}
static float Fix( float angle )
{
while ( angle < 0 )
@ -1081,7 +1043,6 @@ static float Fix( float angle )
return angle;
}
static void FixupAngles( Vector &v )
{
v.x = Fix( v.x );
@ -1122,7 +1083,7 @@ void CFuncTrackTrain :: StopSound( void )
void CFuncTrackTrain :: UpdateSound( void )
{
float flpitch;
if (!pev->noise)
return;
@ -1158,7 +1119,6 @@ void CFuncTrackTrain :: UpdateSound( void )
}
}
void CFuncTrackTrain :: Next( void )
{
float time = 0.5;
@ -1228,7 +1188,7 @@ void CFuncTrackTrain :: Next( void )
else
pev->avelocity.z = UTIL_AngleDistance( UTIL_ApproachAngle( 0, pev->angles.z, m_flBank*4 ), pev->angles.z) * 4;
}
if ( pnext )
{
if ( pnext != m_ppath )
@ -1250,12 +1210,13 @@ void CFuncTrackTrain :: Next( void )
if ( pFire->pev->spawnflags & SF_PATH_DISABLE_TRAIN )
pev->spawnflags |= SF_TRACKTRAIN_NOCONTROL;
// Don't override speed if under user control
if ( pev->spawnflags & SF_TRACKTRAIN_NOCONTROL )
{
if ( pFire->pev->speed != 0 )
{// don't copy speed from target if it is 0 (uninitialized)
{
// don't copy speed from target if it is 0 (uninitialized)
pev->speed = pFire->pev->speed;
ALERT( at_aiconsole, "TrackTrain %s speed to %4.2f\n", STRING(pev->targetname), pev->speed );
}
@ -1265,7 +1226,7 @@ void CFuncTrackTrain :: Next( void )
SetThink( &CFuncTrackTrain::Next );
NextThink( pev->ltime + time, TRUE );
}
else // end of path, stop
else // end of path, stop
{
StopSound();
pev->velocity = (nextPos - pev->origin);
@ -1273,11 +1234,10 @@ void CFuncTrackTrain :: Next( void )
float distance = pev->velocity.Length();
m_oldSpeed = pev->speed;
pev->speed = 0;
// Move to the dead end
// Are we there yet?
if ( distance > 0 )
{
@ -1294,7 +1254,6 @@ void CFuncTrackTrain :: Next( void )
}
}
void CFuncTrackTrain::DeadEnd( void )
{
// Fire the dead-end target if there is one
@ -1340,7 +1299,6 @@ void CFuncTrackTrain::DeadEnd( void )
ALERT( at_aiconsole, "\n" );
}
void CFuncTrackTrain :: SetControls( entvars_t *pevControls )
{
Vector offset = pevControls->origin - pev->oldorigin;
@ -1349,7 +1307,6 @@ void CFuncTrackTrain :: SetControls( entvars_t *pevControls )
m_controlMaxs = pevControls->maxs + offset;
}
BOOL CFuncTrackTrain :: OnControls( entvars_t *pevTest )
{
Vector offset = pevTest->origin - pev->origin;
@ -1371,7 +1328,6 @@ BOOL CFuncTrackTrain :: OnControls( entvars_t *pevTest )
return FALSE;
}
void CFuncTrackTrain :: Find( void )
{
m_ppath = CPathTrack::Instance(FIND_ENTITY_BY_TARGETNAME( NULL, STRING(pev->target) ));
@ -1400,7 +1356,7 @@ void CFuncTrackTrain :: Find( void )
if ( pev->spawnflags & SF_TRACKTRAIN_NOPITCH )
pev->angles.x = 0;
UTIL_SetOrigin( pev, nextPos );
UTIL_SetOrigin( pev, nextPos );
NextThink( pev->ltime + 0.1, FALSE );
SetThink( &CFuncTrackTrain::Next );
pev->speed = m_startSpeed;
@ -1408,7 +1364,6 @@ void CFuncTrackTrain :: Find( void )
UpdateSound();
}
void CFuncTrackTrain :: NearestPath( void )
{
CBaseEntity *pTrack = NULL;
@ -1456,14 +1411,12 @@ void CFuncTrackTrain :: NearestPath( void )
}
}
void CFuncTrackTrain::OverrideReset( void )
{
NextThink( pev->ltime + 0.1, FALSE );
SetThink( &CFuncTrackTrain::NearestPath );
}
CFuncTrackTrain *CFuncTrackTrain::Instance( edict_t *pent )
{
if ( FClassnameIs( pent, "func_tracktrain" ) )
@ -1488,7 +1441,7 @@ void CFuncTrackTrain :: Spawn( void )
m_speed = 100;
else
m_speed = pev->speed;
pev->speed = 0;
pev->velocity = g_vecZero;
pev->avelocity = g_vecZero;
@ -1504,7 +1457,7 @@ void CFuncTrackTrain :: Spawn( void )
else
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
SET_MODEL( ENT(pev), STRING(pev->model) );
UTIL_SetSize( pev, pev->mins, pev->maxs );
@ -1516,8 +1469,9 @@ void CFuncTrackTrain :: Spawn( void )
m_controlMins = pev->mins;
m_controlMaxs = pev->maxs;
m_controlMaxs.z += 72;
// start trains on the next frame, to make sure their targets have had
// a chance to spawn/activate
// start trains on the next frame, to make sure their targets have had
// a chance to spawn/activate
NextThink( pev->ltime + 0.1, FALSE );
SetThink( &CFuncTrackTrain::Find );
Precache();
@ -1556,8 +1510,8 @@ public:
void Spawn( void );
void EXPORT Find( void );
};
LINK_ENTITY_TO_CLASS( func_traincontrols, CFuncTrainControls );
LINK_ENTITY_TO_CLASS( func_traincontrols, CFuncTrainControls )
void CFuncTrainControls :: Find( void )
{
@ -1579,7 +1533,6 @@ void CFuncTrainControls :: Find( void )
UTIL_Remove( this );
}
void CFuncTrainControls :: Spawn( void )
{
pev->solid = SOLID_NOT;
@ -1588,13 +1541,11 @@ void CFuncTrainControls :: Spawn( void )
UTIL_SetSize( pev, pev->mins, pev->maxs );
UTIL_SetOrigin( pev, pev->origin );
SetThink( &CFuncTrainControls::Find );
pev->nextthink = gpGlobals->time;
}
// ----------------------------------------------------------------------------
//
// Track changer / Train elevator
@ -1621,7 +1572,7 @@ public:
void Spawn( void );
void Precache( void );
// virtual void Blocked( void );
//virtual void Blocked( void );
virtual void EXPORT GoUp( void );
virtual void EXPORT GoDown( void );
@ -1646,7 +1597,6 @@ public:
virtual void OverrideReset( void );
CPathTrack *m_trackTop;
CPathTrack *m_trackBottom;
@ -1659,9 +1609,10 @@ public:
int m_targetState;
int m_use;
};
LINK_ENTITY_TO_CLASS( func_trackchange, CFuncTrackChange );
TYPEDESCRIPTION CFuncTrackChange::m_SaveData[] =
LINK_ENTITY_TO_CLASS( func_trackchange, CFuncTrackChange )
TYPEDESCRIPTION CFuncTrackChange::m_SaveData[] =
{
DEFINE_GLOBAL_FIELD( CFuncTrackChange, m_trackTop, FIELD_CLASSPTR ),
DEFINE_GLOBAL_FIELD( CFuncTrackChange, m_trackBottom, FIELD_CLASSPTR ),
@ -1674,7 +1625,7 @@ TYPEDESCRIPTION CFuncTrackChange::m_SaveData[] =
DEFINE_FIELD( CFuncTrackChange, m_use, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CFuncTrackChange, CFuncPlatRot );
IMPLEMENT_SAVERESTORE( CFuncTrackChange, CFuncPlatRot )
void CFuncTrackChange :: Spawn( void )
{
@ -1709,11 +1660,10 @@ void CFuncTrackChange :: Precache( void )
{
// Can't trigger sound
PRECACHE_SOUND( "buttons/button11.wav" );
CFuncPlatRot::Precache();
}
// UNDONE: Filter touches before re-evaluating the train.
void CFuncTrackChange :: Touch( CBaseEntity *pOther )
{
@ -1723,8 +1673,6 @@ void CFuncTrackChange :: Touch( CBaseEntity *pOther )
#endif
}
void CFuncTrackChange :: KeyValue( KeyValueData *pkvd )
{
if ( FStrEq(pkvd->szKeyName, "train") )
@ -1748,7 +1696,6 @@ void CFuncTrackChange :: KeyValue( KeyValueData *pkvd )
}
}
void CFuncTrackChange::OverrideReset( void )
{
pev->nextthink = pev->ltime + 1.0;
@ -1797,8 +1744,6 @@ void CFuncTrackChange :: Find( void )
ALERT( at_error, "Can't find top track for track change! %s\n", STRING(m_trackTopName) );
}
TRAIN_CODE CFuncTrackChange :: EvaluateTrain( CPathTrack *pcurrent )
{
// Go ahead and work, we don't have anything to switch, so just be an elevator
@ -1820,11 +1765,10 @@ TRAIN_CODE CFuncTrackChange :: EvaluateTrain( CPathTrack *pcurrent )
return TRAIN_BLOCKING;
}
return TRAIN_SAFE;
}
void CFuncTrackChange :: UpdateTrain( Vector &dest )
{
float time = (pev->nextthink - pev->ltime);
@ -1882,7 +1826,6 @@ void CFuncTrackChange :: GoDown( void )
}
}
//
// Platform is at bottom, now starts moving up
//
@ -1908,7 +1851,7 @@ void CFuncTrackChange :: GoUp( void )
SetMoveDone( &CFuncPlat::CallHitTop );
RotMove( m_end, pev->nextthink - pev->ltime );
}
// Otherwise, move first, rotate second
// If the train is moving with the platform, update it
@ -1919,7 +1862,6 @@ void CFuncTrackChange :: GoUp( void )
}
}
// Normal track change
void CFuncTrackChange :: UpdateAutoTargets( int toggleState )
{
@ -1937,7 +1879,6 @@ void CFuncTrackChange :: UpdateAutoTargets( int toggleState )
SetBits( m_trackBottom->pev->spawnflags, SF_PATH_DISABLED );
}
void CFuncTrackChange :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( m_toggle_state != TS_AT_TOP && m_toggle_state != TS_AT_BOTTOM )
@ -1968,7 +1909,6 @@ void CFuncTrackChange :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE
GoUp();
}
//
// Platform has hit bottom. Stops and waits forever.
//
@ -1977,7 +1917,7 @@ void CFuncTrackChange :: HitBottom( void )
CFuncPlatRot :: HitBottom();
if ( m_code == TRAIN_FOLLOWING )
{
// UpdateTrain();
//UpdateTrain();
m_train->SetTrack( m_trackBottom );
}
SetThink( NULL );
@ -1988,7 +1928,6 @@ void CFuncTrackChange :: HitBottom( void )
EnableUse();
}
//
// Platform has hit bottom. Stops and waits forever.
//
@ -1997,10 +1936,10 @@ void CFuncTrackChange :: HitTop( void )
CFuncPlatRot :: HitTop();
if ( m_code == TRAIN_FOLLOWING )
{
// UpdateTrain();
//UpdateTrain();
m_train->SetTrack( m_trackTop );
}
// Don't let the plat go back down
SetThink( NULL );
pev->nextthink = -1;
@ -2008,16 +1947,14 @@ void CFuncTrackChange :: HitTop( void )
EnableUse();
}
class CFuncTrackAuto : public CFuncTrackChange
{
public:
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
virtual void UpdateAutoTargets( int toggleState );
};
LINK_ENTITY_TO_CLASS( func_trackautochange, CFuncTrackAuto );
LINK_ENTITY_TO_CLASS( func_trackautochange, CFuncTrackAuto )
// Auto track change
void CFuncTrackAuto :: UpdateAutoTargets( int toggleState )
@ -2046,10 +1983,8 @@ void CFuncTrackAuto :: UpdateAutoTargets( int toggleState )
if ( pNextTarget )
SetBits( pNextTarget->pev->spawnflags, SF_PATH_DISABLED );
}
void CFuncTrackAuto :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
CPathTrack *pTarget;
@ -2067,6 +2002,7 @@ void CFuncTrackAuto :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
if ( FClassnameIs( pActivator->pev, "func_tracktrain" ) )
{
m_code = EvaluateTrain( pTarget );
// Safe to fire?
if ( m_code == TRAIN_FOLLOWING && m_toggle_state != m_targetState )
{
@ -2093,7 +2029,6 @@ void CFuncTrackAuto :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
}
}
// ----------------------------------------------------------
//
//
@ -2129,16 +2064,14 @@ private:
BOOL m_on;
};
LINK_ENTITY_TO_CLASS( func_guntarget, CGunTarget );
LINK_ENTITY_TO_CLASS( func_guntarget, CGunTarget )
TYPEDESCRIPTION CGunTarget::m_SaveData[] =
{
DEFINE_FIELD( CGunTarget, m_on, FIELD_BOOLEAN ),
};
IMPLEMENT_SAVERESTORE( CGunTarget, CBaseMonster );
IMPLEMENT_SAVERESTORE( CGunTarget, CBaseMonster )
void CGunTarget::Spawn( void )
{
@ -2165,7 +2098,6 @@ void CGunTarget::Spawn( void )
}
}
void CGunTarget::Activate( void )
{
CBaseEntity *pTarg;
@ -2179,20 +2111,18 @@ void CGunTarget::Activate( void )
}
}
void CGunTarget::Start( void )
{
Use( this, this, USE_ON, 0 );
}
void CGunTarget::Next( void )
{
SetThink( NULL );
m_hTargetEnt = GetNextTarget();
CBaseEntity *pTarget = m_hTargetEnt;
if ( !pTarget )
{
Stop();
@ -2202,11 +2132,10 @@ void CGunTarget::Next( void )
LinearMove( pTarget->pev->origin - (pev->mins + pev->maxs) * 0.5, pev->speed );
}
void CGunTarget::Wait( void )
{
CBaseEntity *pTarget = m_hTargetEnt;
if ( !pTarget )
{
Stop();
@ -2220,13 +2149,14 @@ void CGunTarget::Wait( void )
if ( FBitSet( pTarget->pev->spawnflags, SF_CORNER_FIREONCE ) )
pTarget->pev->message = 0;
}
m_flWait = pTarget->GetDelay();
pev->target = pTarget->pev->target;
SetThink( &CGunTarget::Next );
if (m_flWait != 0)
{// -1 wait will wait forever!
{
// -1 wait will wait forever!
pev->nextthink = pev->ltime + m_flWait;
}
else
@ -2235,7 +2165,6 @@ void CGunTarget::Wait( void )
}
}
void CGunTarget::Stop( void )
{
pev->velocity = g_vecZero;
@ -2244,7 +2173,7 @@ void CGunTarget::Stop( void )
}
int CGunTarget::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
int CGunTarget::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
if ( pev->health > 0 )
{
@ -2260,7 +2189,6 @@ int CGunTarget::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
return 0;
}
void CGunTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( !ShouldToggle( useType, m_on ) )
@ -2280,6 +2208,3 @@ void CGunTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
Next();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -15,10 +15,8 @@
#ifndef PLAYER_H
#define PLAYER_H
#include "pm_materials.h"
#define PLAYER_FATAL_FALL_SPEED 1024// approx 60 feet
#define PLAYER_MAX_SAFE_FALL_SPEED 580// approx 20 feet
#define DAMAGE_FOR_FALL_SPEED (float) 100 / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED )// damage per unit per second.
@ -28,13 +26,13 @@
//
// Player PHYSICS FLAGS bits
//
#define PFLAG_ONLADDER ( 1<<0 )
#define PFLAG_ONSWING ( 1<<0 )
#define PFLAG_ONTRAIN ( 1<<1 )
#define PFLAG_ONBARNACLE ( 1<<2 )
#define PFLAG_DUCKING ( 1<<3 ) // In the process of ducking, but totally squatted yet
#define PFLAG_USING ( 1<<4 ) // Using a continuous entity
#define PFLAG_OBSERVER ( 1<<5 ) // player is locked in stationary cam mode. Spectators can move, observers can't.
#define PFLAG_ONLADDER ( 1<<0 )
#define PFLAG_ONSWING ( 1<<0 )
#define PFLAG_ONTRAIN ( 1<<1 )
#define PFLAG_ONBARNACLE ( 1<<2 )
#define PFLAG_DUCKING ( 1<<3 ) // In the process of ducking, but totally squatted yet
#define PFLAG_USING ( 1<<4 ) // Using a continuous entity
#define PFLAG_OBSERVER ( 1<<5 ) // player is locked in stationary cam mode. Spectators can move, observers can't.
//
// generic player
@ -69,7 +67,7 @@ typedef enum
PLAYER_JUMP,
PLAYER_SUPERJUMP,
PLAYER_DIE,
PLAYER_ATTACK1,
PLAYER_ATTACK1
} PLAYER_ANIM;
#define MAX_ID_RANGE 2048
@ -80,7 +78,7 @@ enum sbar_data
SBAR_ID_TARGETNAME = 1,
SBAR_ID_TARGETHEALTH,
SBAR_ID_TARGETARMOR,
SBAR_END,
SBAR_END
};
#define CHAT_INTERVAL 1.0f
@ -96,20 +94,20 @@ public:
int m_iExtraSoundTypes;// additional classification for this weapon's sound
int m_iWeaponFlash;// brightness of the weapon flash
float m_flStopExtraSoundTime;
float m_flFlashLightTime; // Time until next battery draw/Recharge
int m_iFlashBattery; // Flashlight Battery Draw
int m_afButtonLast;
int m_afButtonPressed;
int m_afButtonReleased;
edict_t *m_pentSndLast; // last sound entity to modify player room type
float m_flSndRoomtype; // last roomtype set by sound entity
float m_flSndRange; // dist from player to sound entity
float m_flFallVelocity;
int m_rgItems[MAX_ITEMS];
int m_fKnownItem; // True when a new item needs to be added
int m_fNewAmmo; // True when a new item has been added
@ -117,8 +115,7 @@ public:
unsigned int m_afPhysicsFlags; // physics flags - set when 'normal' physics should be revisited or overriden
float m_fNextSuicideTime; // the time after which the player can next use the suicide command
// these are time-sensitive things that we keep track of
// these are time-sensitive things that we keep track of
float m_flTimeStepSound; // when the last stepping sound was made
float m_flTimeWeaponIdle; // when to play another weapon idle animation.
float m_flSwimTime; // how long player has been underwater
@ -144,7 +141,7 @@ public:
int m_idrownrestored; // track drowning damage restored
int m_bitsHUDDamage; // Damage bits for the current fame. These get sent to
// the hude via the DAMAGE message
// the hude via the DAMAGE message
BOOL m_fInitHUD; // True when deferred HUD restart msg needs to be sent
BOOL m_fGameHUDInitialized;
int m_iTrain; // Train control position
@ -164,11 +161,13 @@ public:
int m_iClientHideHUD;
int m_iFOV; // field of view
int m_iClientFOV; // client's known FOV
// usable player items
CBasePlayerItem *m_rgpPlayerItems[MAX_ITEM_TYPES];
CBasePlayerItem *m_pActiveItem;
CBasePlayerItem *m_pClientActiveItem; // client version of the active item
CBasePlayerItem *m_pLastItem;
// shared ammo slots
int m_rgAmmo[MAX_AMMO_SLOTS];
int m_rgAmmoLast[MAX_AMMO_SLOTS];
@ -188,7 +187,7 @@ public:
virtual void Spawn( void );
void Pain( void );
// virtual void Think( void );
//virtual void Think( void );
virtual void Jump( void );
virtual void Duck( void );
virtual void PreThink( void );
@ -229,7 +228,7 @@ public:
BOOL FlashlightIsOn( void );
void FlashlightTurnOn( void );
void FlashlightTurnOff( void );
void UpdatePlayerSound ( void );
void DeathSound ( void );
@ -298,7 +297,7 @@ public:
float m_flAmmoStartCharge;
float m_flPlayAftershock;
float m_flNextAmmoBurn;// while charging, when to absorb another unit of player's ammo?
//Player ID
void InitStatusBar( void );
void UpdateStatusBar( void );
@ -307,9 +306,8 @@ public:
float m_flStatusBarDisappearDelay;
char m_SbarString0[ SBAR_STRING_SIZE ];
char m_SbarString1[ SBAR_STRING_SIZE ];
float m_flNextChatTime;
};
#define AUTOAIM_2DEGREES 0.0348994967025
@ -317,7 +315,6 @@ public:
#define AUTOAIM_8DEGREES 0.1391731009601
#define AUTOAIM_10DEGREES 0.1736481776669
extern int gmsgHudText;
extern BOOL gInitHUD;

View File

@ -8,6 +8,7 @@
//=========================================================
// playermonster - for scripted sequence use.
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -31,13 +32,14 @@ public:
void HandleAnimEvent( MonsterEvent_t *pEvent );
int ISoundMask ( void );
};
LINK_ENTITY_TO_CLASS( monster_player, CPlayerMonster );
LINK_ENTITY_TO_CLASS( monster_player, CPlayerMonster )
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int CPlayerMonster :: Classify ( void )
int CPlayerMonster :: Classify ( void )
{
return CLASS_PLAYER_ALLY;
}
@ -100,7 +102,6 @@ void CPlayerMonster :: Spawn()
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
MonsterInit();
if ( pev->spawnflags & SF_MONSTERPLAYER_NOTSOLID )
{

View File

@ -142,7 +142,8 @@ public:
int m_iaCustomAnglesX[10];
int m_iaCustomAnglesZ[10];
};
LINK_ENTITY_TO_CLASS(prop, CProp);
LINK_ENTITY_TO_CLASS(prop, CProp)
const char *CProp::pSoundsWood[] =
{
@ -175,7 +176,6 @@ const char *CProp::pSoundsConcrete[] =
"debris/concrete3.wav",
};
const char *CProp::pSoundsGlass[] =
{
"debris/glass1.wav",
@ -208,14 +208,11 @@ const char **CProp::MaterialSoundList( Materials precacheMaterial, int &soundCou
pSoundList = pSoundsMetal;
soundCount = ARRAYSIZE(pSoundsMetal);
break;
case matCinderBlock:
case matRocks:
pSoundList = pSoundsConcrete;
soundCount = ARRAYSIZE(pSoundsConcrete);
break;
case matCeilingTile:
case matNone:
default:
@ -279,7 +276,6 @@ void CProp::Precache( void )
PRECACHE_SOUND("debris/bustmetal1.wav");
PRECACHE_SOUND("debris/bustmetal2.wav");
break;
case matUnbreakableGlass:
case matGlass:
pGibName = "models/glassgibs.mdl";
@ -327,8 +323,8 @@ void CProp::DamageSound( void )
int i;
int material = m_Material;
// if (RANDOM_LONG(0,1))
// return;
//if (RANDOM_LONG(0,1))
// return;
if (RANDOM_LONG(0,2))
pitch = PITCH_NORM;
@ -350,21 +346,18 @@ void CProp::DamageSound( void )
rgpsz[2] = "debris/glass3.wav";
i = 3;
break;
case matWood:
rgpsz[0] = "debris/wood1.wav";
rgpsz[1] = "debris/wood2.wav";
rgpsz[2] = "debris/wood3.wav";
i = 3;
break;
case matMetal:
rgpsz[0] = "debris/metal1.wav";
rgpsz[1] = "debris/metal3.wav";
rgpsz[2] = "debris/metal2.wav";
i = 2;
break;
case matFlesh:
rgpsz[0] = "debris/flesh1.wav";
rgpsz[1] = "debris/flesh2.wav";
@ -374,7 +367,6 @@ void CProp::DamageSound( void )
rgpsz[5] = "debris/flesh7.wav";
i = 6;
break;
case matRocks:
case matCinderBlock:
rgpsz[0] = "debris/concrete1.wav";
@ -382,7 +374,6 @@ void CProp::DamageSound( void )
rgpsz[2] = "debris/concrete3.wav";
i = 3;
break;
case matCeilingTile:
// UNDONE: no ceiling tile shard sound yet
i = 0;
@ -414,7 +405,6 @@ void CProp::Die( void )
if (fvol > 1.0)
fvol = 1.0;
switch (m_Material)
{
case matGlass:
@ -427,7 +417,6 @@ void CProp::Die( void )
}
cFlag = BREAK_GLASS;
break;
case matWood:
switch ( RANDOM_LONG(0,1) )
{
@ -438,7 +427,6 @@ void CProp::Die( void )
}
cFlag = BREAK_WOOD;
break;
case matComputer:
case matMetal:
switch ( RANDOM_LONG(0,1) )
@ -450,7 +438,6 @@ void CProp::Die( void )
}
cFlag = BREAK_METAL;
break;
case matFlesh:
switch ( RANDOM_LONG(0,1) )
{
@ -461,7 +448,6 @@ void CProp::Die( void )
}
cFlag = BREAK_FLESH;
break;
case matRocks:
case matCinderBlock:
switch ( RANDOM_LONG(0,1) )
@ -473,13 +459,11 @@ void CProp::Die( void )
}
cFlag = BREAK_CONCRETE;
break;
case matCeilingTile:
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustceiling.wav", fvol, ATTN_NORM, 0, pitch);
break;
}
if (m_Explosion == expDirected)
vecVelocity = g_vecAttackDir * 200;
else
@ -553,6 +537,7 @@ void CProp::Die( void )
pev->targetname = 0;
pev->solid = SOLID_NOT;
// Fire targets on break
SUB_UseTargets( NULL, USE_TOGGLE, 0 );
@ -599,7 +584,6 @@ void CProp::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType,
{
CBasePlayerWeapon *weapon = (CBasePlayerWeapon *) m_pHolstered->m_pActiveItem->GetWeaponPtr();
//m_Holstered->m_pActiveItem->Holster(); // strange bug here. ValveWHY?
// HACK: prevent attack
@ -795,7 +779,6 @@ void CProp::BounceTouch(CBaseEntity *pOther)
CheckRotate();
if (m_shape == SHAPE_CYL_H)
{
pev->velocity.x *= fabs(dp) * 0.8 + 0.2;
pev->velocity.y *= fabs(dp) * 0.8 + 0.2;
pev->velocity.z -= 20;
@ -831,7 +814,6 @@ void CProp::BounceTouch(CBaseEntity *pOther)
pev->velocity.y *= m_flFloorFriction;
pev->velocity.z -= 10;
}
}
else
{
@ -874,7 +856,6 @@ void CProp::BounceSound(void)
void CProp::Spawn(void)
{
Precache();
if( minsH == g_vecZero )
@ -933,8 +914,6 @@ void CProp::RespawnThink()
PropRespawn();
}
void CProp::AngleThink()
{
pev->nextthink = gpGlobals->time + m_flRespawnTime;
@ -1059,7 +1038,6 @@ int CProp::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flD
ALERT(at_console, "Takedmg: %s %s %f %f\n", STRING(pevInflictor->classname), STRING(pevAttacker->classname), flDamage, pev->health );
// now some func_breakable code
if ( !(pev->spawnflags & SF_PROP_BREAKABLE ) )
return 0;
if ( pev->health <= 0 )
@ -1085,10 +1063,10 @@ int CProp::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flD
// Make a shard noise each time func breakable is hit.
// Don't play shard noise if cbreakable actually died.
DamageSound();
return 1;
}
void CProp::KeyValue( KeyValueData* pkvd )
{
ALERT( at_console, "%s %s\n", pkvd->szKeyName, pkvd->szValue);

View File

@ -34,8 +34,8 @@ enum python_e {
PYTHON_IDLE3
};
LINK_ENTITY_TO_CLASS( weapon_python, CPython );
LINK_ENTITY_TO_CLASS( weapon_357, CPython );
LINK_ENTITY_TO_CLASS( weapon_python, CPython )
LINK_ENTITY_TO_CLASS( weapon_357, CPython )
int CPython::GetItemInfo(ItemInfo *p)
{
@ -78,7 +78,6 @@ void CPython::Spawn( )
FallInit();// get ready to fall down.
}
void CPython::Precache( void )
{
PRECACHE_MODEL("models/v_357.mdl");
@ -115,7 +114,6 @@ BOOL CPython::Deploy( )
return DefaultDeploy( "models/v_357.mdl", "models/p_357.mdl", PYTHON_DRAW, "python", UseDecrement(), pev->body );
}
void CPython::Holster( int skiplocal /* = 0 */ )
{
m_fInReload = FALSE;// cancel any reload in progress.
@ -188,7 +186,6 @@ void CPython::PrimaryAttack()
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle );
Vector vecSrc = m_pPlayer->GetGunPosition( );
@ -197,13 +194,12 @@ void CPython::PrimaryAttack()
Vector vecDir;
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
int flags;
int flags;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usFirePython, 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)
@ -214,7 +210,6 @@ void CPython::PrimaryAttack()
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
void CPython::Reload( void )
{
if ( m_pPlayer->ammo_357 <= 0 )
@ -239,7 +234,6 @@ void CPython::Reload( void )
}
}
void CPython::WeaponIdle( void )
{
ResetEmptySound( );
@ -289,8 +283,6 @@ void CPython::WeaponIdle( void )
SendWeaponAnim( iAnim, UseDecrement() ? 1 : 0, bUseScope );
}
class CPythonAmmo : public CBasePlayerAmmo
{
void Spawn( void )
@ -314,7 +306,6 @@ class CPythonAmmo : public CBasePlayerAmmo
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( ammo_357, CPythonAmmo );
#endif
LINK_ENTITY_TO_CLASS( ammo_357, CPythonAmmo )
#endif

View File

@ -34,13 +34,14 @@ public:
void SetYawSpeed( void );
int Classify ( void );
};
LINK_ENTITY_TO_CLASS( monster_rat, CRat );
LINK_ENTITY_TO_CLASS( monster_rat, CRat )
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int CRat :: Classify ( void )
int CRat :: Classify ( void )
{
return CLASS_INSECT;
}

View File

@ -36,14 +36,14 @@ 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
};
LINK_ENTITY_TO_CLASS( weapon_rpg, CRpg );
LINK_ENTITY_TO_CLASS( weapon_rpg, CRpg )
#ifndef CLIENT_DLL
LINK_ENTITY_TO_CLASS( laser_spot, CLaserSpot );
LINK_ENTITY_TO_CLASS( laser_spot, CLaserSpot )
//=========================================================
//=========================================================
@ -99,7 +99,7 @@ void CLaserSpot::Precache( void )
PRECACHE_MODEL("sprites/laserdot.spr");
};
LINK_ENTITY_TO_CLASS( rpg_rocket, CRpgRocket );
LINK_ENTITY_TO_CLASS( rpg_rocket, CRpgRocket )
//=========================================================
//=========================================================
@ -204,7 +204,6 @@ void CRpgRocket :: IgniteThink( void )
pev->nextthink = gpGlobals->time + 0.1;
}
void CRpgRocket :: FollowThink( void )
{
CBaseEntity *pOther = NULL;
@ -280,8 +279,6 @@ void CRpgRocket :: FollowThink( void )
}
#endif
void CRpg::Reload( void )
{
int iResult = 0;
@ -355,7 +352,6 @@ void CRpg::Spawn( )
FallInit();// get ready to fall down.
}
void CRpg::Precache( void )
{
PRECACHE_MODEL("models/w_rpg.mdl");
@ -413,7 +409,6 @@ BOOL CRpg::Deploy( )
return DefaultDeploy( "models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW1, "rpg" );
}
BOOL CRpg::CanHolster( void )
{
if ( m_fSpotActive && m_cActiveRockets )
@ -440,11 +435,8 @@ void CRpg::Holster( int skiplocal /* = 0 */ )
m_pSpot = NULL;
}
#endif
}
void CRpg::PrimaryAttack()
{
if ( m_iClip )
@ -490,7 +482,6 @@ void CRpg::PrimaryAttack()
UpdateSpot( );
}
void CRpg::SecondaryAttack()
{
m_fSpotActive = ! m_fSpotActive;
@ -502,11 +493,9 @@ void CRpg::SecondaryAttack()
m_pSpot = NULL;
}
#endif
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2;
}
void CRpg::WeaponIdle( void )
{
UpdateSpot( );
@ -547,11 +536,8 @@ void CRpg::WeaponIdle( void )
}
}
void CRpg::UpdateSpot( void )
{
#ifndef CLIENT_DLL
if (m_fSpotActive)
{
@ -570,10 +556,8 @@ void CRpg::UpdateSpot( void )
UTIL_SetOrigin( m_pSpot->pev, tr.vecEndPos );
}
#endif
}
class CRpgAmmo : public CBasePlayerAmmo
{
void Spawn( void )
@ -613,6 +597,6 @@ class CRpgAmmo : public CBasePlayerAmmo
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( ammo_rpgclip, CRpgAmmo );
LINK_ENTITY_TO_CLASS( ammo_rpgclip, CRpgAmmo )
#endif

View File

@ -38,8 +38,6 @@ enum satchel_radio_e {
SATCHEL_RADIO_HOLSTER
};
class CSatchelCharge : public CGrenade
{
void Spawn( void );
@ -52,7 +50,8 @@ class CSatchelCharge : public CGrenade
public:
void Deactivate( void );
};
LINK_ENTITY_TO_CLASS( monster_satchel, CSatchelCharge );
LINK_ENTITY_TO_CLASS( monster_satchel, CSatchelCharge )
//=========================================================
// Deactivate - do whatever it is we do to an orphaned
@ -64,7 +63,6 @@ void CSatchelCharge::Deactivate( void )
UTIL_Remove( this );
}
void CSatchelCharge :: Spawn( void )
{
Precache( );
@ -90,7 +88,6 @@ void CSatchelCharge :: Spawn( void )
pev->sequence = 1;
}
void CSatchelCharge::SatchelSlide( CBaseEntity *pOther )
{
entvars_t *pevOther = pOther->pev;
@ -120,7 +117,6 @@ void CSatchelCharge::SatchelSlide( CBaseEntity *pOther )
StudioFrameAdvance( );
}
void CSatchelCharge :: SatchelThink( void )
{
StudioFrameAdvance( );
@ -167,9 +163,7 @@ void CSatchelCharge :: BounceSound( void )
}
}
LINK_ENTITY_TO_CLASS( weapon_satchel, CSatchel );
LINK_ENTITY_TO_CLASS( weapon_satchel, CSatchel )
//=========================================================
// CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal
@ -223,7 +217,6 @@ void CSatchel::Spawn( )
FallInit();// get ready to fall down.
}
void CSatchel::Precache( void )
{
PRECACHE_MODEL("models/v_satchel.mdl");
@ -235,7 +228,6 @@ void CSatchel::Precache( void )
UTIL_PrecacheOther( "monster_satchel" );
}
int CSatchel::GetItemInfo(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
@ -304,7 +296,6 @@ BOOL CSatchel::Deploy( )
return TRUE;
}
void CSatchel::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
@ -327,8 +318,6 @@ void CSatchel::Holster( int skiplocal /* = 0 */ )
}
}
void CSatchel::PrimaryAttack()
{
switch (m_chargeReady)
@ -364,7 +353,6 @@ void CSatchel::PrimaryAttack()
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
break;
}
case 2:
// we're reloading, don't allow fire
{
@ -373,7 +361,6 @@ void CSatchel::PrimaryAttack()
}
}
void CSatchel::SecondaryAttack( void )
{
if ( m_chargeReady != 2 )
@ -382,7 +369,6 @@ void CSatchel::SecondaryAttack( void )
}
}
void CSatchel::Throw( void )
{
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
@ -416,7 +402,6 @@ void CSatchel::Throw( void )
}
}
void CSatchel::WeaponIdle( void )
{
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
@ -448,7 +433,6 @@ void CSatchel::WeaponIdle( void )
#else
LoadVModel ( "models/v_satchel.mdl", m_pPlayer );
#endif
SendWeaponAnim( SATCHEL_DRAW );
// use tripmine animations
@ -490,5 +474,4 @@ void DeactivateSatchels( CBasePlayer *pOwner )
pFind = FIND_ENTITY_BY_CLASSNAME( pFind, "monster_satchel" );
}
}
#endif

View File

@ -43,7 +43,6 @@ protected:
unsigned int HashString( const char *pszToken );
};
class CSave : public CSaveRestoreBuffer
{
public:
@ -125,7 +124,6 @@ private:
return restore.ReadFields( #derivedClass, this, m_SaveData, ARRAYSIZE(m_SaveData) );\
}
typedef enum { GLOBAL_OFF = 0, GLOBAL_ON = 1, GLOBAL_DEAD = 2 } GLOBALESTATE;
typedef struct globalentity_s globalentity_t;
@ -166,4 +164,4 @@ private:
extern CGlobalState gGlobalState;
#endif //SAVERESTORE_H
#endif //SAVERESTORE_H

View File

@ -16,6 +16,7 @@
// schedule.cpp - functions and data pertaining to the
// monsters' AI scheduling system.
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -60,7 +61,7 @@ void CBaseMonster :: ClearSchedule( void )
BOOL CBaseMonster :: FScheduleDone ( void )
{
ASSERT( m_pSchedule != NULL );
if ( m_iScheduleIndex == m_pSchedule->cTasks )
{
return TRUE;
@ -106,7 +107,7 @@ void CBaseMonster :: ChangeSchedule ( Schedule_t *pNewSchedule )
if ( FClassnameIs( pev, "monster_human_grunt" ) )
{
Task_t *pTask = GetTask();
if ( pTask )
{
const char *pName = NULL;
@ -119,7 +120,7 @@ void CBaseMonster :: ChangeSchedule ( Schedule_t *pNewSchedule )
{
pName = "No Schedule";
}
if ( !pName )
{
pName = "Unknown";
@ -129,7 +130,6 @@ void CBaseMonster :: ChangeSchedule ( Schedule_t *pNewSchedule )
}
}
#endif// 0
}
//=========================================================
@ -161,7 +161,7 @@ int CBaseMonster :: IScheduleFlags ( void )
{
return 0;
}
// strip off all bits excepts the ones capable of breaking this schedule.
return m_afConditions & m_pSchedule->iInterruptMask;
}
@ -192,7 +192,6 @@ BOOL CBaseMonster :: FScheduleValid ( void )
UTIL_Sparks( tmp );
}
#endif // DEBUG
// some condition has interrupted the schedule, or the schedule is done
return FALSE;
}
@ -218,7 +217,7 @@ void CBaseMonster :: MaintainSchedule ( void )
NextScheduledTask();
}
// validate existing schedule
// validate existing schedule
if ( !FScheduleValid() || m_MonsterState != m_IdealMonsterState )
{
// if we come into this block of code, the schedule is going to have to be changed.
@ -250,6 +249,7 @@ void CBaseMonster :: MaintainSchedule ( void )
pNewSchedule = GetScheduleOfType( m_failSchedule );
else
pNewSchedule = GetScheduleOfType( SCHED_FAIL );
// schedule was invalid because the current task failed to start or complete
ALERT ( at_aiconsole, "Schedule Failed at %d!\n", m_iScheduleIndex );
ChangeSchedule( pNewSchedule );
@ -278,7 +278,7 @@ void CBaseMonster :: MaintainSchedule ( void )
{
SetActivity ( m_IdealActivity );
}
if ( !TaskIsComplete() && m_iTaskStatus != TASKSTATUS_NEW )
break;
}
@ -317,7 +317,6 @@ void CBaseMonster :: RunTask ( Task_t *pTask )
}
break;
}
case TASK_PLAY_SEQUENCE_FACE_ENEMY:
case TASK_PLAY_SEQUENCE_FACE_TARGET:
{
@ -336,7 +335,6 @@ void CBaseMonster :: RunTask ( Task_t *pTask )
TaskComplete();
}
break;
case TASK_PLAY_SEQUENCE:
case TASK_PLAY_ACTIVE_IDLE:
{
@ -346,8 +344,6 @@ void CBaseMonster :: RunTask ( Task_t *pTask )
}
break;
}
case TASK_FACE_ENEMY:
{
MakeIdealYaw( m_vecEnemyLKP );
@ -416,6 +412,7 @@ void CBaseMonster :: RunTask ( Task_t *pTask )
else
{
distance = ( m_vecMoveGoal - pev->origin ).Length2D();
// Re-evaluate when you think your finished, or the target has moved too far
if ( (distance < pTask->flData) || (m_vecMoveGoal - m_hTargetEnt->pev->origin).Length() > pTask->flData * 0.5 )
{
@ -436,7 +433,6 @@ void CBaseMonster :: RunTask ( Task_t *pTask )
else if ( distance >= 270 && m_movementActivity != ACT_RUN )
m_movementActivity = ACT_RUN;
}
break;
}
case TASK_WAIT_FOR_MOVEMENT:
@ -453,7 +449,7 @@ void CBaseMonster :: RunTask ( Task_t *pTask )
if ( m_fSequenceFinished && pev->frame >= 255 )
{
pev->deadflag = DEAD_DEAD;
SetThink( NULL );
StopAnimation();
@ -461,7 +457,7 @@ void CBaseMonster :: RunTask ( Task_t *pTask )
{
// a bit of a hack. If a corpses' bbox is positioned such that being left solid so that it can be attacked will
// block the player on a slope or stairs, the corpse is made nonsolid.
// pev->solid = SOLID_NOT;
//pev->solid = SOLID_NOT;
UTIL_SetSize ( pev, Vector ( -4, -4, 0 ), Vector ( 4, 4, 1 ) );
}
else // !!!HACKHACK - put monster in a thin, wide bounding box until we fix the solid type/bounding volume problem
@ -554,11 +550,13 @@ void CBaseMonster :: SetTurnActivity ( void )
flYD = FlYawDiff();
if ( flYD <= -45 && LookupActivity ( ACT_TURN_RIGHT ) != ACTIVITY_NOT_AVAILABLE )
{// big right turn
{
// big right turn
m_IdealActivity = ACT_TURN_RIGHT;
}
else if ( flYD > 45 && LookupActivity ( ACT_TURN_LEFT ) != ACTIVITY_NOT_AVAILABLE )
{// big left turn
{
// big left turn
m_IdealActivity = ACT_TURN_LEFT;
}
}
@ -575,7 +573,7 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
case TASK_TURN_RIGHT:
{
float flCurrentYaw;
flCurrentYaw = UTIL_AngleMod( pev->angles.y );
pev->ideal_yaw = UTIL_AngleMod( flCurrentYaw - pTask->flData );
SetTurnActivity();
@ -584,7 +582,7 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
case TASK_TURN_LEFT:
{
float flCurrentYaw;
flCurrentYaw = UTIL_AngleMod( pev->angles.y );
pev->ideal_yaw = UTIL_AngleMod( flCurrentYaw + pTask->flData );
SetTurnActivity();
@ -673,7 +671,6 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
{
TaskFail();
}
break;
}
case TASK_FIND_NEAR_NODE_COVER_FROM_ENEMY:
@ -744,8 +741,8 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
{
// Find cover from self if no enemy available
pevCover = pev;
// TaskFail();
// return;
//TaskFail();
//return;
}
else
pevCover = m_hEnemy->pev;
@ -819,12 +816,10 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
SetTurnActivity();
break;
}
case TASK_FACE_LASTPOSITION:
MakeIdealYaw ( m_vecLastPosition );
SetTurnActivity();
break;
case TASK_FACE_TARGET:
if ( m_hTargetEnt != NULL )
{
@ -867,12 +862,14 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
}
case TASK_WAIT:
case TASK_WAIT_FACE_ENEMY:
{// set a future time that tells us when the wait is over.
{
// set a future time that tells us when the wait is over.
m_flWaitFinished = gpGlobals->time + pTask->flData;
break;
}
case TASK_WAIT_RANDOM:
{// set a future time that tells us when the wait is over.
{
// set a future time that tells us when the wait is over.
m_flWaitFinished = gpGlobals->time + RANDOM_FLOAT( 0.1, pTask->flData );
break;
}
@ -901,6 +898,7 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
newActivity = ACT_WALK;
else
newActivity = ACT_RUN;
// This monster can't do this!
if ( LookupActivity( newActivity ) == ACTIVITY_NOT_AVAILABLE )
TaskComplete();
@ -1042,7 +1040,6 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
}
break;
}
case TASK_GET_PATH_TO_TARGET:
{
RouteClear();
@ -1106,7 +1103,7 @@ void CBaseMonster :: StartTask ( Task_t *pTask )
}
break;
}
case TASK_GET_PATH_TO_BESTSCENT:
case TASK_GET_PATH_TO_BESTSCENT:
{
CSound *pScent;
@ -1120,7 +1117,7 @@ case TASK_GET_PATH_TO_BESTSCENT:
{
// no way to get there =(
ALERT ( at_aiconsole, "GetPathToBestScent failed!!\n" );
TaskFail();
}
break;
@ -1180,8 +1177,6 @@ case TASK_GET_PATH_TO_BESTSCENT:
TaskComplete();
break;
}
case TASK_WAIT_FOR_MOVEMENT:
{
if (FRouteClear())
@ -1190,7 +1185,6 @@ case TASK_GET_PATH_TO_BESTSCENT:
}
break;
}
case TASK_EAT:
{
Eat( pTask->flData );
@ -1205,7 +1199,7 @@ case TASK_GET_PATH_TO_BESTSCENT:
case TASK_DIE:
{
RouteClear();
m_IdealActivity = GetDeathActivity();
pev->deadflag = DEAD_DYING;
@ -1260,7 +1254,6 @@ case TASK_GET_PATH_TO_BESTSCENT:
}
else
m_IdealActivity = ACT_IDLE;
break;
}
case TASK_PLAY_SCRIPT:
@ -1298,24 +1291,20 @@ case TASK_GET_PATH_TO_BESTSCENT:
RouteClear();
break;
}
case TASK_SUGGEST_STATE:
{
m_IdealMonsterState = (MONSTERSTATE)(int)pTask->flData;
TaskComplete();
break;
}
case TASK_SET_FAIL_SCHEDULE:
m_failSchedule = (int)pTask->flData;
TaskComplete();
break;
case TASK_CLEAR_FAIL_SCHEDULE:
m_failSchedule = SCHED_NONE;
TaskComplete();
break;
default:
{
ALERT ( at_aiconsole, "No StartTask entry for %d\n", (SHARED_TASKS)pTask->iTask );
@ -1397,7 +1386,6 @@ Schedule_t *CBaseMonster :: GetSchedule ( void )
return GetScheduleOfType( SCHED_ALERT_SMALL_FLINCH );
}
}
else if ( HasConditions ( bits_COND_HEAR_SOUND ) )
{
return GetScheduleOfType( SCHED_ALERT_FACE );

View File

@ -25,7 +25,6 @@
#define TASKSTATUS_RUNNING_TASK 3 // Just running task
#define TASKSTATUS_COMPLETE 4 // Completed, get next task
//=========================================================
// These are the schedule types
//=========================================================
@ -172,7 +171,7 @@ typedef enum
TASK_REMEMBER,
TASK_FORGET,
TASK_WAIT_FOR_MOVEMENT, // wait until MovementIsComplete()
LAST_COMMON_TASK, // LEAVE THIS AT THE BOTTOM!! (sjb)
LAST_COMMON_TASK // LEAVE THIS AT THE BOTTOM!! (sjb)
} SHARED_TASKS;
@ -180,7 +179,7 @@ typedef enum
enum
{
TARGET_MOVE_NORMAL = 0,
TARGET_MOVE_SCRIPTED = 1,
TARGET_MOVE_SCRIPTED = 1
};
@ -194,7 +193,7 @@ enum
GOAL_MOVE,
GOAL_TAKE_COVER,
GOAL_MOVE_TARGET,
GOAL_EAT,
GOAL_EAT
};
// an array of tasks is a task list
@ -208,11 +207,10 @@ struct Task_t
struct Schedule_t
{
Task_t *pTasklist;
int cTasks;
int iInterruptMask;// a bit mask of conditions that can interrupt this schedule
// a more specific mask that indicates which TYPES of sounds will interrupt the schedule in the
// event that the schedule is broken by COND_HEAR_SOUND
int iSoundMask;
@ -282,7 +280,6 @@ struct WayPoint_t
#define bits_COND_TASK_FAILED ( 1 << 30)
#define bits_COND_SCHEDULE_DONE ( 1 << 31)
#define bits_COND_ALL_SPECIAL (bits_COND_SPECIAL1 | bits_COND_SPECIAL2)
#define bits_COND_CAN_ATTACK (bits_COND_CAN_RANGE_ATTACK1 | bits_COND_CAN_MELEE_ATTACK1 | bits_COND_CAN_RANGE_ATTACK2 | bits_COND_CAN_MELEE_ATTACK2)

View File

@ -27,7 +27,6 @@
#include "animation.h"
#include "soundent.h"
#define NUM_SCIENTIST_HEADS 4 // four heads available for scientist model
enum { HEAD_GLASSES = 0, HEAD_EINSTEIN = 1, HEAD_LUTHER = 2, HEAD_SLICK = 3 };
@ -38,7 +37,7 @@ enum
SCHED_PANIC,
SCHED_STARTLE,
SCHED_TARGET_CHASE_SCARED,
SCHED_TARGET_FACE_SCARED,
SCHED_TARGET_FACE_SCARED
};
enum
@ -49,7 +48,7 @@ enum
TASK_RUN_PATH_SCARED,
TASK_SCREAM,
TASK_RANDOM_SCREAM,
TASK_MOVE_TO_TARGET_RANGE_SCARED,
TASK_MOVE_TO_TARGET_RANGE_SCARED
};
//=========================================================
@ -96,7 +95,7 @@ public:
void DeathSound( void );
void PainSound( void );
void TalkInit( void );
void Killed( entvars_t *pevAttacker, int iGib );
@ -105,7 +104,7 @@ public:
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
CUSTOM_SCHEDULES;
CUSTOM_SCHEDULES
private:
float m_painTime;
@ -113,16 +112,16 @@ private:
float m_fearTime;
};
LINK_ENTITY_TO_CLASS( monster_scientist, CScientist );
LINK_ENTITY_TO_CLASS( monster_scientist, CScientist )
TYPEDESCRIPTION CScientist::m_SaveData[] =
TYPEDESCRIPTION CScientist::m_SaveData[] =
{
DEFINE_FIELD( CScientist, m_painTime, FIELD_TIME ),
DEFINE_FIELD( CScientist, m_healTime, FIELD_TIME ),
DEFINE_FIELD( CScientist, m_fearTime, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CScientist, CTalkMonster );
IMPLEMENT_SAVERESTORE( CScientist, CTalkMonster )
//=========================================================
// AI Schedules Specific to this monster
@ -205,7 +204,6 @@ Schedule_t slStopFollowing[] =
},
};
Task_t tlHeal[] =
{
{ TASK_MOVE_TO_TARGET_RANGE,(float)50 }, // Move within 60 of target ent (client)
@ -228,7 +226,6 @@ Schedule_t slHeal[] =
},
};
Task_t tlFaceTarget[] =
{
{ TASK_STOP_MOVING, (float)0 },
@ -251,7 +248,6 @@ Schedule_t slFaceTarget[] =
},
};
Task_t tlSciPanic[] =
{
{ TASK_STOP_MOVING, (float)0 },
@ -272,7 +268,6 @@ Schedule_t slSciPanic[] =
},
};
Task_t tlIdleSciStand[] =
{
{ TASK_STOP_MOVING, 0 },
@ -306,7 +301,6 @@ Schedule_t slIdleSciStand[] =
},
};
Task_t tlScientistCover[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_PANIC }, // If you fail, just panic!
@ -328,8 +322,6 @@ Schedule_t slScientistCover[] =
},
};
Task_t tlScientistHide[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_PANIC }, // If you fail, just panic!
@ -355,7 +347,6 @@ Schedule_t slScientistHide[] =
},
};
Task_t tlScientistStartle[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_PANIC }, // If you fail, just panic!
@ -382,8 +373,6 @@ Schedule_t slScientistStartle[] =
},
};
Task_t tlFear[] =
{
{ TASK_STOP_MOVING, (float)0 },
@ -403,7 +392,6 @@ Schedule_t slFear[] =
},
};
DEFINE_CUSTOM_SCHEDULES( CScientist )
{
slFollow,
@ -420,9 +408,7 @@ DEFINE_CUSTOM_SCHEDULES( CScientist )
slFaceTargetScared,
};
IMPLEMENT_CUSTOM_SCHEDULES( CScientist, CTalkMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CScientist, CTalkMonster )
void CScientist::DeclineFollowing( void )
{
@ -431,7 +417,6 @@ void CScientist::DeclineFollowing( void )
PlaySentence( "SC_POK", 2, VOL_NORM, ATTN_NORM );
}
void CScientist :: Scream( void )
{
if ( FOkToSpeak() )
@ -442,7 +427,6 @@ void CScientist :: Scream( void )
}
}
Activity CScientist::GetStoppedActivity( void )
{
if ( m_hEnemy != NULL )
@ -450,7 +434,6 @@ Activity CScientist::GetStoppedActivity( void )
return CTalkMonster::GetStoppedActivity();
}
void CScientist :: StartTask( Task_t *pTask )
{
switch( pTask->iTask )
@ -463,18 +446,15 @@ void CScientist :: StartTask( Task_t *pTask )
TaskComplete();
break;
case TASK_SCREAM:
Scream();
TaskComplete();
break;
case TASK_RANDOM_SCREAM:
if ( RANDOM_FLOAT( 0, 1 ) < pTask->flData )
Scream();
TaskComplete();
break;
case TASK_SAY_FEAR:
if ( FOkToSpeak() )
{
@ -487,15 +467,12 @@ void CScientist :: StartTask( Task_t *pTask )
}
TaskComplete();
break;
case TASK_HEAL:
m_IdealActivity = ACT_MELEE_ATTACK1;
break;
case TASK_RUN_PATH_SCARED:
m_movementActivity = ACT_RUN_SCARED;
break;
case TASK_MOVE_TO_TARGET_RANGE_SCARED:
{
if ( (m_hTargetEnt->pev->origin - pev->origin).Length() < 1 )
@ -508,7 +485,6 @@ void CScientist :: StartTask( Task_t *pTask )
}
}
break;
default:
CTalkMonster::StartTask( pTask );
break;
@ -525,7 +501,6 @@ void CScientist :: RunTask( Task_t *pTask )
if ( RANDOM_LONG(0,31) < 8 )
Scream();
break;
case TASK_MOVE_TO_TARGET_RANGE_SCARED:
{
if ( RANDOM_LONG(0,63)< 8 )
@ -562,7 +537,6 @@ void CScientist :: RunTask( Task_t *pTask )
}
}
break;
case TASK_HEAL:
if ( m_fSequenceFinished )
{
@ -591,7 +565,6 @@ int CScientist :: Classify ( void )
return CLASS_HUMAN_PASSIVE;
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
@ -647,7 +620,6 @@ void CScientist :: HandleAnimEvent( MonsterEvent_t *pEvent )
pev->body = (oldBody % NUM_SCIENTIST_HEADS) + NUM_SCIENTIST_HEADS * 0;
}
break;
default:
CTalkMonster::HandleAnimEvent( pEvent );
}
@ -671,7 +643,7 @@ void CScientist :: Spawn( void )
m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so scientists will notice player and say hello
m_MonsterState = MONSTERSTATE_NONE;
// m_flDistTooFar = 256.0;
//m_flDistTooFar = 256.0;
m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_OPEN_DOORS | bits_CAP_AUTO_DOORS | bits_CAP_USE;
@ -679,14 +651,15 @@ void CScientist :: Spawn( void )
pev->skin = 0;
if ( pev->body == -1 )
{// -1 chooses a random head
{
// -1 chooses a random head
pev->body = RANDOM_LONG(0, NUM_SCIENTIST_HEADS-1);// pick a head, any head
}
// Luther is black, make his hands black
if ( pev->body == HEAD_LUTHER )
pev->skin = 1;
MonsterInit();
SetUse( &CTalkMonster::FollowerUse );
}
@ -713,7 +686,6 @@ void CScientist :: Precache( void )
// Init talk data
void CScientist :: TalkInit()
{
CTalkMonster::TalkInit();
// scientist will try to talk to friends in this order:
@ -742,7 +714,7 @@ void CScientist :: TalkInit()
m_szGrp[TLK_PIDLE] = "SC_PIDLE";
m_szGrp[TLK_PQUESTION] = "SC_PQUEST";
m_szGrp[TLK_SMELL] = "SC_SMELL";
m_szGrp[TLK_WOUND] = "SC_WOUND";
m_szGrp[TLK_MORTAL] = "SC_MORTAL";
@ -759,7 +731,6 @@ void CScientist :: TalkInit()
int CScientist :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
if ( pevInflictor && pevInflictor->flags & FL_CLIENT )
{
Remember( bits_MEMORY_PROVOKED );
@ -770,7 +741,6 @@ int CScientist :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, f
return CTalkMonster::TakeDamage(pevInflictor, pevAttacker, flDamage, bitsDamageType);
}
//=========================================================
// ISoundMask - returns a bit mask indicating which types
// of sounds this monster regards. In the base class implementation,
@ -783,7 +753,7 @@ int CScientist :: ISoundMask ( void )
bits_SOUND_DANGER |
bits_SOUND_PLAYER;
}
//=========================================================
// PainSound
//=========================================================
@ -791,7 +761,7 @@ void CScientist :: PainSound ( void )
{
if (gpGlobals->time < m_painTime )
return;
m_painTime = gpGlobals->time + RANDOM_FLOAT(0.5, 0.75);
switch (RANDOM_LONG(0,4))
@ -812,14 +782,12 @@ void CScientist :: DeathSound ( void )
PainSound();
}
void CScientist::Killed( entvars_t *pevAttacker, int iGib )
{
SetUse( NULL );
CTalkMonster::Killed( pevAttacker, iGib );
}
void CScientist :: SetActivity ( Activity newActivity )
{
int iSequence;
@ -832,7 +800,6 @@ void CScientist :: SetActivity ( Activity newActivity )
CTalkMonster::SetActivity( newActivity );
}
Schedule_t* CScientist :: GetScheduleOfType ( int Type )
{
Schedule_t *psched;
@ -849,22 +816,16 @@ Schedule_t* CScientist :: GetScheduleOfType ( int Type )
return slFaceTarget; // override this for different target face behavior
else
return psched;
case SCHED_TARGET_CHASE:
return slFollow;
case SCHED_CANT_FOLLOW:
return slStopFollowing;
case SCHED_PANIC:
return slSciPanic;
case SCHED_TARGET_CHASE_SCARED:
return slFollowScared;
case SCHED_TARGET_FACE_SCARED:
return slFaceTargetScared;
case SCHED_IDLE_STAND:
// call base class default so that scientist will talk
// when standing during idle
@ -874,13 +835,10 @@ Schedule_t* CScientist :: GetScheduleOfType ( int Type )
return slIdleSciStand;
else
return psched;
case SCHED_HIDE:
return slScientistHide;
case SCHED_STARTLE:
return slScientistStartle;
case SCHED_FEAR:
return slFear;
}
@ -905,7 +863,7 @@ Schedule_t *CScientist :: GetSchedule ( void )
switch( m_MonsterState )
{
case MONSTERSTATE_ALERT:
case MONSTERSTATE_ALERT:
case MONSTERSTATE_IDLE:
if ( pEnemy )
{
@ -1032,7 +990,6 @@ MONSTERSTATE CScientist :: GetIdealState ( void )
StopFollowing( TRUE );
}
break;
case MONSTERSTATE_COMBAT:
{
CBaseEntity *pEnemy = m_hEnemy;
@ -1045,6 +1002,7 @@ MONSTERSTATE CScientist :: GetIdealState ( void )
m_hEnemy = NULL;
return m_IdealMonsterState;
}
// Follow if only scared a little
if ( m_hTargetEnt != NULL )
{
@ -1058,7 +1016,6 @@ MONSTERSTATE CScientist :: GetIdealState ( void )
m_IdealMonsterState = MONSTERSTATE_COMBAT;
return m_IdealMonsterState;
}
}
}
break;
@ -1069,7 +1026,6 @@ MONSTERSTATE CScientist :: GetIdealState ( void )
return CTalkMonster::GetIdealState();
}
BOOL CScientist::CanHeal( void )
{
if ( (m_healTime > gpGlobals->time) || (m_hTargetEnt == NULL) || (m_hTargetEnt->pev->health > (m_hTargetEnt->pev->max_health * 0.5)) )
@ -1126,7 +1082,7 @@ void CDeadScientist::KeyValue( KeyValueData *pkvd )
else
CBaseMonster::KeyValue( pkvd );
}
LINK_ENTITY_TO_CLASS( monster_scientist_dead, CDeadScientist );
LINK_ENTITY_TO_CLASS( monster_scientist_dead, CDeadScientist )
//
// ********** DeadScientist SPAWN **********
@ -1138,15 +1094,18 @@ void CDeadScientist :: Spawn( )
pev->effects = 0;
pev->sequence = 0;
// Corpses have less health
pev->health = 8;//gSkillData.scientistHealth;
m_bloodColor = BLOOD_COLOR_RED;
if ( pev->body == -1 )
{// -1 chooses a random head
{
// -1 chooses a random head
pev->body = RANDOM_LONG(0, NUM_SCIENTIST_HEADS-1);// pick a head, any head
}
// Luther is black, make his hands black
if ( pev->body == HEAD_LUTHER )
pev->skin = 1;
@ -1163,7 +1122,6 @@ void CDeadScientist :: Spawn( )
MonsterInitDead();
}
//=========================================================
// Sitting Scientist PROP
//=========================================================
@ -1189,15 +1147,15 @@ public:
float m_flResponseDelay;
};
LINK_ENTITY_TO_CLASS( monster_sitting_scientist, CSittingScientist );
TYPEDESCRIPTION CSittingScientist::m_SaveData[] =
LINK_ENTITY_TO_CLASS( monster_sitting_scientist, CSittingScientist )
TYPEDESCRIPTION CSittingScientist::m_SaveData[] =
{
// Don't need to save/restore m_baseSequence (recalced)
DEFINE_FIELD( CSittingScientist, m_headTurn, FIELD_INTEGER ),
DEFINE_FIELD( CSittingScientist, m_flResponseDelay, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CSittingScientist, CScientist );
IMPLEMENT_SAVERESTORE( CSittingScientist, CScientist )
// animation sequence aliases
typedef enum
@ -1209,7 +1167,6 @@ SITTING_ANIM_sitting2,
SITTING_ANIM_sitting3
} SITTING_ANIM;
//
// ********** Scientist SPAWN **********
//
@ -1235,9 +1192,11 @@ void CSittingScientist :: Spawn( )
SetBits(pev->spawnflags, SF_MONSTER_PREDISASTER); // predisaster only!
if ( pev->body == -1 )
{// -1 chooses a random head
{
// -1 chooses a random head
pev->body = RANDOM_LONG(0, NUM_SCIENTIST_HEADS-1);// pick a head, any head
}
// Luther is black, make his hands black
if ( pev->body == HEAD_LUTHER )
pev->skin = 1;
@ -1266,7 +1225,6 @@ int CSittingScientist :: Classify ( void )
return CLASS_HUMAN_PASSIVE;
}
int CSittingScientist::FriendNumber( int arrayNumber )
{
static int array[3] = { 2, 1, 0 };
@ -1275,8 +1233,6 @@ int CSittingScientist::FriendNumber( int arrayNumber )
return arrayNumber;
}
//=========================================================
// sit, do stuff
//=========================================================
@ -1384,7 +1340,6 @@ void CSittingScientist :: SetAnswerQuestion( CTalkMonster *pSpeaker )
m_hTalkTarget = (CBaseMonster *)pSpeaker;
}
//=========================================================
// FIdleSpeak
// ask question of nearby friend, or make statement

View File

@ -36,8 +36,6 @@
#include "scripted.h"
#include "defaultai.h"
/*
classname "scripted_sequence"
targetname "me" - there can be more than one with the same name, and they act in concert
@ -50,7 +48,6 @@ range # - only search this far to find the target
spawnflags - (stop if blocked, stop if player seen)
*/
//
// Cache user-entity-field values until spawn is called.
//
@ -98,7 +95,7 @@ void CCineMonster :: KeyValue( KeyValueData *pkvd )
}
}
TYPEDESCRIPTION CCineMonster::m_SaveData[] =
TYPEDESCRIPTION CCineMonster::m_SaveData[] =
{
DEFINE_FIELD( CCineMonster, m_iszIdle, FIELD_STRING ),
DEFINE_FIELD( CCineMonster, m_iszPlay, FIELD_STRING ),
@ -117,14 +114,13 @@ TYPEDESCRIPTION CCineMonster::m_SaveData[] =
DEFINE_FIELD( CCineMonster, m_interruptable, FIELD_BOOLEAN ),
};
IMPLEMENT_SAVERESTORE( CCineMonster, CBaseMonster )
IMPLEMENT_SAVERESTORE( CCineMonster, CBaseMonster );
LINK_ENTITY_TO_CLASS( scripted_sequence, CCineMonster )
LINK_ENTITY_TO_CLASS( scripted_sequence, CCineMonster );
#define CLASSNAME "scripted_sequence"
LINK_ENTITY_TO_CLASS( aiscripted_sequence, CCineAI );
LINK_ENTITY_TO_CLASS( aiscripted_sequence, CCineAI )
void CCineMonster :: Spawn( void )
{
@ -132,13 +128,11 @@ void CCineMonster :: Spawn( void )
// UTIL_SetSize(pev, Vector(-8, -8, -8), Vector(8, 8, 8));
pev->solid = SOLID_NOT;
// REMOVE: The old side-effect
#if 0
if ( m_iszIdle )
m_fMoveTo = 4;
#endif
// if no targetname, start now
if ( FStringNull(pev->targetname) || !FStringNull( m_iszIdle ) )
{
@ -174,7 +168,6 @@ BOOL CCineAI :: FCanOverrideState( void )
return TRUE;
}
//
// CineStart
//
@ -203,7 +196,6 @@ void CCineMonster :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
}
}
// This doesn't really make sense since only MOVETYPE_PUSH get 'Blocked' events
void CCineMonster :: Blocked( CBaseEntity *pOther )
{
@ -222,19 +214,20 @@ void CCineMonster :: Touch( CBaseEntity *pOther )
*/
}
/*
entvars_t *pevOther = VARS( gpGlobals->other );
if ( !FBitSet ( pevOther->flags , FL_MONSTER ) )
{// touched by a non-monster.
{
// touched by a non-monster.
return;
}
pevOther->origin.z += 1;
if ( FBitSet ( pevOther->flags, FL_ONGROUND ) )
{// clear the onground so physics don't bitch
{
// clear the onground so physics don't bitch
pevOther->flags -= FL_ONGROUND;
}
@ -242,7 +235,6 @@ void CCineMonster :: Touch( CBaseEntity *pOther )
pevOther->velocity = pev->movedir * pev->speed;
pevOther->velocity.z += m_flHeight;
pev->solid = SOLID_NOT;// kill the trigger for now !!!UNDONE
}
*/
@ -292,7 +284,7 @@ int CCineMonster :: FindEntity( void )
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
pTarget = NULL;
}
if ( !pTarget )
{
CBaseEntity *pEntity = NULL;
@ -336,7 +328,6 @@ void CCineMonster :: PossessEntity( void )
return;
}
#endif
pTarget->m_pGoalEnt = this;
pTarget->m_pCine = this;
pTarget->m_hTargetEnt = this;
@ -351,17 +342,14 @@ void CCineMonster :: PossessEntity( void )
case 0:
pTarget->m_scriptState = SCRIPT_WAIT;
break;
case 1:
pTarget->m_scriptState = SCRIPT_WALK_TO_MARK;
DelayStart( 1 );
break;
case 2:
pTarget->m_scriptState = SCRIPT_RUN_TO_MARK;
DelayStart( 1 );
break;
case 4:
UTIL_SetOrigin( pTarget->pev, pev->origin );
pTarget->pev->ideal_yaw = pev->angles.y;
@ -375,7 +363,7 @@ void CCineMonster :: PossessEntity( void )
// pTarget->pev->flags &= ~FL_ONGROUND;
break;
}
// ALERT( at_aiconsole, "\"%s\" found and used (INT: %s)\n", STRING( pTarget->pev->targetname ), FBitSet(pev->spawnflags, SF_SCRIPT_NOINTERRUPT)?"No":"Yes" );
//ALERT( at_aiconsole, "\"%s\" found and used (INT: %s)\n", STRING( pTarget->pev->targetname ), FBitSet(pev->spawnflags, SF_SCRIPT_NOINTERRUPT)?"No":"Yes" );
pTarget->m_IdealMonsterState = MONSTERSTATE_SCRIPT;
if (m_iszIdle)
@ -423,15 +411,12 @@ void CCineAI :: PossessEntity( void )
case 5:
pTarget->m_scriptState = SCRIPT_WAIT;
break;
case 1:
pTarget->m_scriptState = SCRIPT_WALK_TO_MARK;
break;
case 2:
pTarget->m_scriptState = SCRIPT_RUN_TO_MARK;
break;
case 4:
// zap the monster instantly to the site of the script entity.
UTIL_SetOrigin( pTarget->pev, pev->origin );
@ -449,11 +434,10 @@ void CCineAI :: PossessEntity( void )
ALERT ( at_aiconsole, "aiscript: invalid Move To Position value!" );
break;
}
ALERT( at_aiconsole, "\"%s\" found and used\n", STRING( pTarget->pev->targetname ) );
pTarget->m_IdealMonsterState = MONSTERSTATE_SCRIPT;
/*
if (m_iszIdle)
{
@ -488,7 +472,6 @@ void CCineMonster :: CineThink( void )
}
}
// lookup a sequence name and setup the target monster to play it
BOOL CCineMonster :: StartSequence( CBaseMonster *pTarget, int iszSeq, BOOL completeOnEmpty )
{
@ -505,7 +488,6 @@ BOOL CCineMonster :: StartSequence( CBaseMonster *pTarget, int iszSeq, BOOL comp
pTarget->pev->sequence = 0;
// return FALSE;
}
#if 0
char *s;
if ( pev->spawnflags & SF_SCRIPT_NOINTERRUPT )
@ -515,7 +497,6 @@ BOOL CCineMonster :: StartSequence( CBaseMonster *pTarget, int iszSeq, BOOL comp
ALERT( at_console, "%s (%s): started \"%s\":INT:%s\n", STRING( pTarget->pev->targetname ), STRING( pTarget->pev->classname ), STRING( iszSeq), s );
#endif
pTarget->pev->frame = 0;
pTarget->ResetSequenceInfo( );
return TRUE;
@ -567,13 +548,13 @@ void CCineMonster :: SequenceDone ( CBaseMonster *pMonster )
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 0.1;
}
// This is done so that another sequence can take over the monster when triggered by the first
pMonster->CineCleanup();
FixScriptMonsterSchedule( pMonster );
// This may cause a sequence to attempt to grab this guy NOW, so we have to clear him out
// of the existing sequence
SUB_UseTargets( NULL, USE_TOGGLE, 0 );
@ -642,7 +623,6 @@ BOOL CBaseMonster :: ExitScriptedSequence( )
return TRUE;
}
void CCineMonster::AllowInterrupt( BOOL fAllow )
{
if ( pev->spawnflags & SF_SCRIPT_NOINTERRUPT )
@ -650,7 +630,6 @@ void CCineMonster::AllowInterrupt( BOOL fAllow )
m_interruptable = fAllow;
}
BOOL CCineMonster::CanInterrupt( void )
{
if ( !m_interruptable )
@ -664,27 +643,26 @@ BOOL CCineMonster::CanInterrupt( void )
return FALSE;
}
int CCineMonster::IgnoreConditions( void )
int CCineMonster::IgnoreConditions( void )
{
if ( CanInterrupt() )
return 0;
return SCRIPT_BREAK_CONDITIONS;
}
void ScriptEntityCancel( edict_t *pentCine )
{
// make sure they are a scripted_sequence
if (FClassnameIs( pentCine, CLASSNAME ))
{
CCineMonster *pCineTarget = GetClassPtr((CCineMonster *)VARS(pentCine));
// make sure they have a monster in mind for the script
CBaseEntity *pEntity = pCineTarget->m_hTargetEnt;
CBaseMonster *pTarget = NULL;
if ( pEntity )
pTarget = pEntity->MyMonsterPointer();
if (pTarget)
{
// make sure their monster is actually playing a script
@ -699,12 +677,11 @@ void ScriptEntityCancel( edict_t *pentCine )
}
}
// find all the cinematic entities with my targetname and stop them from playing
void CCineMonster :: CancelScript( void )
{
ALERT( at_aiconsole, "Cancelling script: %s\n", STRING(m_iszPlay) );
if ( !pev->targetname )
{
ScriptEntityCancel( edict() );
@ -720,7 +697,6 @@ void CCineMonster :: CancelScript( void )
}
}
// find all the cinematic entities with my targetname and tell them to wait before starting
void CCineMonster :: DelayStart( int state )
{
@ -746,8 +722,6 @@ void CCineMonster :: DelayStart( int state )
}
}
// Find an entity that I'm interested in and precache the sounds he'll need in the sequence.
void CCineMonster :: Activate( void )
{
@ -767,7 +741,7 @@ void CCineMonster :: Activate( void )
}
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
}
// If no entity with that targetname, check the classname
if ( !pTarget )
{
@ -778,6 +752,7 @@ void CCineMonster :: Activate( void )
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
}
}
// Found a compatible entity
if ( pTarget )
{
@ -792,7 +767,6 @@ void CCineMonster :: Activate( void )
}
}
BOOL CBaseMonster :: CineCleanup( )
{
CCineMonster *pOldCine = m_pCine;
@ -873,7 +847,7 @@ BOOL CBaseMonster :: CineCleanup( )
pev->flags |= FL_ONGROUND;
int drop = DROP_TO_FLOOR( ENT(pev) );
// Origin in solid? Set to org at the end of the sequence
if ( drop < 0 )
pev->origin = oldOrigin;
@ -909,16 +883,12 @@ BOOL CBaseMonster :: CineCleanup( )
pev->deadflag = DEAD_NO;
}
// SetAnimation( m_MonsterState );
ClearBits(pev->spawnflags, SF_MONSTER_WAIT_FOR_SCRIPT );
return TRUE;
}
class CScriptedSentence : public CBaseToggle
{
public:
@ -938,7 +908,6 @@ public:
BOOL AcceptableSpeaker( CBaseMonster *pMonster );
BOOL StartSentence( CBaseMonster *pTarget );
private:
int m_iszSentence; // string index for idle animation
int m_iszEntity; // entity that is wanted for this sentence
@ -956,7 +925,7 @@ private:
#define SF_SENTENCE_INTERRUPT 0x0004 // force talking except when dead
#define SF_SENTENCE_CONCURRENT 0x0008 // allow other people to keep talking
TYPEDESCRIPTION CScriptedSentence::m_SaveData[] =
TYPEDESCRIPTION CScriptedSentence::m_SaveData[] =
{
DEFINE_FIELD( CScriptedSentence, m_iszSentence, FIELD_STRING ),
DEFINE_FIELD( CScriptedSentence, m_iszEntity, FIELD_STRING ),
@ -969,10 +938,9 @@ TYPEDESCRIPTION CScriptedSentence::m_SaveData[] =
DEFINE_FIELD( CScriptedSentence, m_iszListener, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CScriptedSentence, CBaseToggle )
IMPLEMENT_SAVERESTORE( CScriptedSentence, CBaseToggle );
LINK_ENTITY_TO_CLASS( scripted_sentence, CScriptedSentence );
LINK_ENTITY_TO_CLASS( scripted_sentence, CScriptedSentence )
void CScriptedSentence :: KeyValue( KeyValueData *pkvd )
{
@ -1020,21 +988,19 @@ void CScriptedSentence :: KeyValue( KeyValueData *pkvd )
CBaseToggle::KeyValue( pkvd );
}
void CScriptedSentence :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( !m_active )
return;
// ALERT( at_console, "Firing sentence: %s\n", STRING(m_iszSentence) );
//ALERT( at_console, "Firing sentence: %s\n", STRING(m_iszSentence) );
SetThink( &CScriptedSentence::FindThink );
pev->nextthink = gpGlobals->time;
}
void CScriptedSentence :: Spawn( void )
{
pev->solid = SOLID_NOT;
m_active = TRUE;
// if no targetname, start now
if ( !pev->targetname )
@ -1048,15 +1014,12 @@ void CScriptedSentence :: Spawn( void )
case 1: // Medium radius
m_flAttenuation = ATTN_STATIC;
break;
case 2: // Large radius
m_flAttenuation = ATTN_NORM;
break;
case 3: //EVERYWHERE
m_flAttenuation = ATTN_NONE;
break;
default:
case 0: // Small radius
m_flAttenuation = ATTN_IDLE;
@ -1069,7 +1032,6 @@ void CScriptedSentence :: Spawn( void )
m_flVolume = 1.0;
}
void CScriptedSentence :: FindThink( void )
{
CBaseMonster *pMonster = FindEntity();
@ -1081,16 +1043,15 @@ void CScriptedSentence :: FindThink( void )
SetThink( &CScriptedSentence::DelayThink );
pev->nextthink = gpGlobals->time + m_flDuration + m_flRepeat;
m_active = FALSE;
// ALERT( at_console, "%s: found monster %s\n", STRING(m_iszSentence), STRING(m_iszEntity) );
//ALERT( at_console, "%s: found monster %s\n", STRING(m_iszSentence), STRING(m_iszEntity) );
}
else
{
// ALERT( at_console, "%s: can't find monster %s\n", STRING(m_iszSentence), STRING(m_iszEntity) );
//ALERT( at_console, "%s: can't find monster %s\n", STRING(m_iszSentence), STRING(m_iszEntity) );
pev->nextthink = gpGlobals->time + m_flRepeat + 0.5;
}
}
void CScriptedSentence :: DelayThink( void )
{
m_active = TRUE;
@ -1099,7 +1060,6 @@ void CScriptedSentence :: DelayThink( void )
SetThink( &CScriptedSentence::FindThink );
}
BOOL CScriptedSentence :: AcceptableSpeaker( CBaseMonster *pMonster )
{
if ( pMonster )
@ -1120,13 +1080,11 @@ BOOL CScriptedSentence :: AcceptableSpeaker( CBaseMonster *pMonster )
return FALSE;
}
CBaseMonster *CScriptedSentence :: FindEntity( void )
{
edict_t *pentTarget;
CBaseMonster *pMonster;
pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszEntity));
pMonster = NULL;
@ -1137,7 +1095,7 @@ CBaseMonster *CScriptedSentence :: FindEntity( void )
{
if ( AcceptableSpeaker( pMonster ) )
return pMonster;
// ALERT( at_console, "%s (%s), not acceptable\n", STRING(pMonster->pev->classname), STRING(pMonster->pev->targetname) );
//ALERT( at_console, "%s (%s), not acceptable\n", STRING(pMonster->pev->classname), STRING(pMonster->pev->targetname) );
}
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
}
@ -1159,7 +1117,6 @@ CBaseMonster *CScriptedSentence :: FindEntity( void )
return NULL;
}
BOOL CScriptedSentence :: StartSentence( CBaseMonster *pTarget )
{
if ( !pTarget )
@ -1189,15 +1146,6 @@ BOOL CScriptedSentence :: StartSentence( CBaseMonster *pTarget )
return TRUE;
}
/*
*/
//=========================================================
// Furniture - this is the cool comment I cut-and-pasted
//=========================================================
@ -1210,9 +1158,7 @@ public:
virtual int ObjectCaps( void ) { return (CBaseMonster :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION); }
};
LINK_ENTITY_TO_CLASS( monster_furniture, CFurniture );
LINK_ENTITY_TO_CLASS( monster_furniture, CFurniture )
//=========================================================
// Furniture is killed
@ -1241,8 +1187,8 @@ void CFurniture :: Spawn( )
pev->sequence = 0;
pev->frame = 0;
// pev->nextthink += 1.0;
// SetThink( &WalkMonsterDelay);
//pev->nextthink += 1.0;
//SetThink( &WalkMonsterDelay);
ResetSequenceInfo( );
pev->frame = 0;
@ -1256,5 +1202,3 @@ int CFurniture::Classify ( void )
{
return CLASS_NONE;
}

View File

@ -34,7 +34,7 @@ enum SS_INTERRUPT
{
SS_INTERRUPT_IDLE = 0,
SS_INTERRUPT_BY_NAME,
SS_INTERRUPT_AI,
SS_INTERRUPT_AI
};
// when a monster finishes an AI scripted sequence, we can choose
@ -91,7 +91,7 @@ public:
int m_saved_movetype;
int m_saved_solid;
int m_saved_effects;
// Vector m_vecOrigOrigin;
//Vector m_vecOrigOrigin;
BOOL m_interruptable;
};
@ -102,6 +102,4 @@ class CCineAI : public CCineMonster
BOOL FCanOverrideState ( void );
virtual void FixScriptMonsterSchedule( CBaseMonster *pMonster );
};
#endif //SCRIPTED_H
#endif //SCRIPTED_H

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