29 #include "../../idlib/precompiled.h"
32 #include "../Game_local.h"
39 "MOVE_TO_ENEMYHEIGHT",
42 "MOVE_TO_ATTACK_POSITION",
45 "MOVE_TO_POSITION_DIRECT",
46 "MOVE_SLIDE_TO_POSITION",
165 areaCenter[ 2 ] += 1.0f;
256 areaCenter[ 2 ] += 1.0f;
273 axis = local_dir.
ToMat3();
276 return self->GetAimDir( fromPos,
target,
self, dir );
351 spawnClearMoveables =
false;
405 if ( harvestEnt.GetEntity() ) {
406 harvestEnt.GetEntity()->PostEventMS( &
EV_Remove, 0 );
467 idStr projectileName;
509 for ( i = 0; i <
particles.Num(); i++ ) {
543 savefile->
WriteInt(funcEmitters.Num());
544 for(
int i = 0; i < funcEmitters.Num(); i++) {
545 funcEmitter_t* emitter = funcEmitters.GetIndex(i);
551 harvestEnt.Save( savefile);
612 for( i = 0; i <
num; i++ ) {
616 idStr projectileName;
618 if ( projectileName.
Length() ) {
658 for( i = 0; i <
num; i++ ) {
668 for ( i = 0; i <
particles.Num(); i++ ) {
700 savefile->
ReadBool( restorePhysics );
717 if ( restorePhysics ) {
724 for(
int i = 0; i < funcEmitters.Num(); i++) {
725 funcEmitter_t* emitter = funcEmitters.GetIndex(i);
726 if(emitter->particle) {
728 emitter->particle->PostEventMS(&
EV_Remove, 0 );
731 funcEmitters.Clear();
734 savefile->
ReadInt( emitterCount );
735 for(
int i = 0; i < emitterCount; i++) {
736 funcEmitter_t newEmitter;
737 memset(&newEmitter, 0,
sizeof(newEmitter));
742 strcpy( newEmitter.name, name.
c_str() );
745 savefile->
ReadObject(reinterpret_cast<idClass *&>(newEmitter.particle));
747 funcEmitters.Set(newEmitter.name, newEmitter);
750 harvestEnt.Restore(savefile);
764 const char *jointname;
843 jointScale.
roll = 0.0f;
946 idStr projectileName;
1000 if(harvestEnt.GetEntity()) {
1002 harvestEnt.GetEntity()->Gib();
1047 const char *statename;
1052 gameLocal.
Printf(
"------------------------------------------------\n" );
1055 if ( !check || !check->
IsType( idAI::Type ) ) {
1059 if ( check->
state ) {
1062 statename =
"NULL state";
1132 if ( enemyEnt->
health <= 0 ) {
1229 if(ai_showHealth.GetBool()) {
1230 idVec3 aboveHead(0,0,20);
1297 int i, numListedClipModels;
1317 for ( i = 0; i < numListedClipModels; i++ ) {
1318 clipModel = clipModelList[
i];
1320 if ( obEnt == alwaysKick ) {
1332 perpendicular.
x = -delta.
y;
1333 perpendicular.
y = delta.
x;
1344 perpendicular.
x = -delta.
y;
1345 perpendicular.
y = delta.
x;
1361 for ( i = 0; i < 3; i++ ) {
1490 if ( !goalAreaNum ) {
1534 if ( !fromArea || !toArea ) {
1539 if ( fromArea == toArea ) {
1863 if ( !
aas || !ent ) {
1920 if ( !
aas || !ent ) {
2019 if ( !
aas || !entity ) {
2161 for( z = org.
z; z <= ceilingPos.
z + 64.0f; z += 64.0f ) {
2163 if ( z <= ceilingPos.
z ) {
2188 float deltax, deltay;
2190 float tdir, olddir, turnaround;
2198 deltax = dest.
x - org.
x;
2199 deltay = dest.
y - org.
y;
2200 if ( deltax > 10 ) {
2202 }
else if ( deltax < -10 ) {
2208 if ( deltay < -10 ) {
2210 }
else if ( deltay > 10 ) {
2218 if ( d[ 1 ] == 0 ) {
2219 tdir = d[ 2 ] == 90 ? 45 : 315;
2221 tdir = d[ 2 ] == 90 ? 135 : 215;
2251 for( tdir = 0; tdir <= 315; tdir += 45 ) {
2257 for ( tdir = 315; tdir >= 0; tdir -= 45 ) {
2404 point[2] += bounds[1][2] - bounds[0][2];
2489 if ( ( diff >= 0.0
f ) && ( turnAmount >= diff ) ) {
2492 }
else if ( ( diff <= 0.0
f ) && ( turnAmount <= diff ) ) {
2599 delta = axis * delta;
2607 delta += oldModelOrigin - modelOrigin;
2660 dir = goalPos - origin;
2662 dist = ( path.
seekPos - origin ) * dir;
2663 if ( dist < 1.0
f ) {
2674 dir = goalPos - origin;
2676 dist = ( path.
seekPos - origin ) * dir;
2677 if ( dist < 1.0
f ) {
2684 if ( obstacle->
IsType( idActor::Type ) ) {
2750 goalPos = oldorigin;
2753 goalPos = oldorigin;
2768 delta = goalPos - oldorigin;
2816 if ( oldorigin != org ) {
2839 predictedPos = org + vel * prediction;
2840 goalDelta = goal - predictedPos;
2904 goalDelta = goalPos - predictedPos;
2945 if ( oldorigin != org ) {
2971 if ( speed < 5.0
f ) {
3036 if ( origin.
z > goalPos.
z ) {
3038 dest.
z = origin.
z + 128.0f;
3096 if ( speed < 0.0
f ) {
3192 if ( oldorigin != org ) {
3263 if ( !ent->
IsType( idActor::Type ) ) {
3268 if ( actor->
IsType( idPlayer::Type ) &&
static_cast<const idPlayer *
>(actor)->noclip ) {
3307 if ( attacker !=
this ) {
3315 actor = (
idActor * )attacker;
3339 if ( particleName.
Length() ) {
3342 int dash = jointName.
Find(
'-');
3344 particleName = particleName.
Left( dash );
3345 jointName = jointName.
Right( jointName.
Length() - dash - 1 );
3365 if ( *particleName ==
'\0' ) {
3366 memset( &pe, 0,
sizeof( pe ) );
3400 const char *modelDeath;
3439 if ( attacker && attacker->
IsType( idActor::Type ) ) {
3494 if ( ( attacker && attacker->
IsType( idPlayer::Type ) ) && ( inflictor && !inflictor->
IsType( idSoulCubeMissile::Type ) ) ) {
3495 static_cast< idPlayer*
>( attacker )->AddAIKill();
3505 harvestEnt =
static_cast<idHarvestable *
>(temp);
3509 if(harvestEnt.GetEntity()) {
3511 harvestEnt.GetEntity()->Init(
this);
3512 harvestEnt.GetEntity()->BecomeActive(
TH_THINK );
3530 const char *animname;
3619 if ( !activator || !activator->
IsType( idPlayer::Type ) ) {
3622 player =
static_cast<idPlayer *
>( activator );
3782 int lastVisibleReachableEnemyAreaNum;
3823 if ( !enemyAreaNum ) {
3827 if ( !enemyAreaNum ) {
3835 if (
PathToGoal( path, areaNum, org, enemyAreaNum, pos ) ) {
3837 lastVisibleReachableEnemyAreaNum = enemyAreaNum;
3851 }
else if ( enemyAreaNum ) {
3905 if ( enemyAreaNum ) {
3907 if (
PathToGoal( path, areaNum, org, enemyAreaNum, enemyPos ) ) {
3917 if (
CanSee( enemyEnt,
false ) ) {
3959 if ( newEnemy->
health <= 0 ) {
3971 if (
aas && enemyAreaNum ) {
3984 int i, areaNum, targetAreaNum, curAreaNum, travelTime;
3995 if ( !areaNum || !targetAreaNum ) {
3999 if ( ( areaNum == targetAreaNum ) ||
PointVisible( origin ) ) {
4003 curAreaNum = areaNum;
4006 for( i = 0; i < 10; i++ ) {
4008 if ( !
aas->
RouteToGoalArea( curAreaNum, curOrigin, targetAreaNum, travelFlags, travelTime, &reach ) ) {
4017 curOrigin = reach->
end;
4059 for( i = 1; i <=
num; i++ ) {
4061 anim = modelDef->
GetAnim( i );
4114 }
else if ( aimAtEnt->
IsType( idActor::Type ) ) {
4118 targetPos2 = targetPos1;
4123 targetPos1.
z -= 28.f;
4124 targetPos2.
z -= 12.f;
4129 delta = firePos - targetPos1;
4131 result =
PredictTrajectory( firePos, targetPos1,
projectileSpeed,
projectileGravity,
projectileClipModel,
MASK_SHOT_RENDERMODEL, max_height, ignore, aimAtEnt,
ai_debugTrajectory.
GetBool() ? 1000 : 0, aimDir );
4132 if ( result || !aimAtEnt->
IsType( idActor::Type ) ) {
4137 delta = firePos - targetPos2;
4139 result =
PredictTrajectory( firePos, targetPos2,
projectileSpeed,
projectileGravity,
projectileClipModel,
MASK_SHOT_RENDERMODEL, max_height, ignore, aimAtEnt,
ai_debugTrajectory.
GetBool() ? 1000 : 0, aimDir );
4170 const char *clsname;
4179 if ( !ent->
IsType( idProjectile::Type ) ) {
4216 float attack_accuracy;
4218 float projectile_spread;
4223 int num_projectiles;
4254 if ( target !=
NULL ) {
4271 if ( !forceMuzzle ) {
4278 if ( ( ( ownerBounds[1][0] - ownerBounds[0][0] ) > ( projBounds[1][0] - projBounds[0][0] ) ) &&
4279 ( ( ownerBounds[1][1] - ownerBounds[0][1] ) > ( projBounds[1][1] - projBounds[0][1] ) ) &&
4280 ( ( ownerBounds[1][2] - ownerBounds[0][2] ) > ( projBounds[1][2] - projBounds[0][2] ) ) ) {
4281 if ( (ownerBounds - projBounds).RayIntersection( muzzle,
viewAxis[ 0 ], distance ) ) {
4282 start = muzzle + distance *
viewAxis[ 0 ];
4304 if ( clampToAttackCone ) {
4308 if ( diff > attack_cone ) {
4310 }
else if ( diff < -attack_cone ) {
4317 float spreadRad =
DEG2RAD( projectile_spread );
4318 for( i = 0; i < num_projectiles; i++ ) {
4322 dir = axis[ 0 ] + axis[ 2 ] * ( angle *
idMath::Sin( spin ) ) - axis[ 1 ] * ( angle *
idMath::Cos( spin ) );
4338 return lastProjectile;
4352 if ( ( victim ==
this ) && inflictor->
IsType( idProjectile::Type ) ) {
4354 damage = ( damage + 1 ) / 2;
4397 meleeDef->
GetVector(
"kickDir",
"0 0 0", kickDir );
4429 bounds[0][2] = myBounds[0][2] - 4.0f;
4432 bounds[1][2] = myBounds[1][2] + 4.0f;
4492 bool forceMiss =
false;
4498 if ( enemyEnt->
health <= damage ) {
4532 meleeDef->
GetVector(
"kickDir",
"0 0 0", kickDir );
4560 for( i = 0; i <
num; i++ ) {
4561 if ( touchList[ i ].touchedEnt->IsType( idProjectile::Type ) ) {
4567 for( j = 0; j < num_pushed; j++ ) {
4568 if ( pushed_ents[ j ] == touchList[ i ].touchedEnt ) {
4572 if ( j >= num_pushed ) {
4574 pushed_ents[num_pushed++] = ent;
4600 if ( !jointname || !jointname[ 0 ] ) {
4728 if ( snd && *snd ) {
4792 int particlesAlive = 0;
4796 SetTimeState ts(TIME_GROUP1);
4819 if ( particlesAlive == 0 ) {
4843 void idAI::TriggerFX(
const char* joint,
const char* fx ) {
4845 if( !
strcmp(joint,
"origin") ) {
4863 idEntity* idAI::StartEmitter(
const char*
name,
const char* joint,
const char* particle ) {
4865 idEntity* existing = GetEmitter(name);
4887 args = emitterDef->
dict;
4888 args.
Set(
"model", particle);
4890 args.
SetBool(
"start_off",
true);
4915 funcEmitter_t newEmitter;
4916 strcpy(newEmitter.name, name);
4918 newEmitter.joint = jointNum;
4919 funcEmitters.Set(newEmitter.name, newEmitter);
4922 newEmitter.particle->
BindToJoint(
this, jointNum,
true);
4923 newEmitter.particle->BecomeActive(
TH_THINK);
4924 newEmitter.particle->Show();
4925 newEmitter.particle->PostEventMS(&
EV_Activate, 0,
this);
4926 return newEmitter.particle;
4929 idEntity* idAI::GetEmitter(
const char* name ) {
4930 funcEmitter_t* emitter;
4931 funcEmitters.Get(name, &emitter);
4933 return emitter->particle;
4938 void idAI::StopEmitter(
const char* name ) {
4939 funcEmitter_t* emitter;
4940 funcEmitters.Get(name, &emitter);
4942 emitter->particle->Unbind();
4943 emitter->particle->PostEventMS( &
EV_Remove, 0 );
4944 funcEmitters.Remove(name);
4968 idVec3 orientationJointPos;
4974 idMat3 orientationJointAxis;
4980 float orientationJointYaw;
4992 orientationJointYaw = orientationJointAxis[ 2 ].ToYaw();
4993 orientationJointAxis =
idAngles( 0.0
f, orientationJointYaw, 0.0
f ).
ToMat3();
5025 focusPos =
GetEyePosition() + orientationJointAxis[ 0 ] * 512.0f;
5026 }
else if ( focusEnt ==
NULL ) {
5031 }
else if ( focusEnt->
IsType( idActor::Type ) ) {
5040 dir = focusPos - orientationJointPos;
5042 newLookAng.
roll = 0.0f;
5043 newLookAng.
pitch = 0.0f;
5052 dir = focusPos - eyepos;
5056 newLookAng.
roll = 0.0f;
5083 if ( ( diff.
pitch > 180.0f ) || ( diff.
pitch <= -180.0f ) ) {
5088 if ( diff.
yaw > 180.0f ) {
5090 }
else if ( diff.
yaw <= -180.0f ) {
5095 lookAng.Normalize180();
5097 jointAng.
roll = 0.0f;
5114 axis = eyeAxis * orientationJointAxis;
5126 axis = eyeAxis * orientationJointAxis;
5225 yaw = axis[ 0 ].ToYaw();
5227 idAngles leftang( 0.0
f, yaw + fov * 0.5
f - 90.0
f, 0.0
f );
5230 idAngles rightang( 0.0
f, yaw - fov * 0.5
f + 90.0
f, 0.0
f );
5258 if ( !ent->
IsType( idCombatNode::Type ) ) {
5281 float cone_dot = node->
cone_right * axis[ 1 ];
5305 if ( !actor || ( actor->
health <= 0 ) ) {
5317 float dist = dir * axis[ 0 ];
5324 if ( left_dot < 0.0
f ) {
5329 if ( right_dot < 0.0
f ) {
virtual idVec3 AreaCenter(int areaNum) const =0
virtual const idVec3 & GetOrigin(int id=0) const =0
bool GetAimDir(const idVec3 &firePos, idEntity *aimAtEnt, const idEntity *ignore, idVec3 &aimDir) const
virtual void DormantBegin(void)
idPlayer * GetLocalPlayer() const
idList< idAngles > lookJointAngles
void SetupPose(idEntity *ent, int time)
int ClipModelsTouchingBounds(const idBounds &bounds, int contentMask, idClipModel **clipModelList, int maxCount) const
void UseFlyMove(bool force)
void Restore(idRestoreGame *savefile)
idEntity * GetEntity(void) const
bool TouchTriggers(void) const
renderEntity_t renderEntity
bool TracePoint(trace_t &results, const idVec3 &start, const idVec3 &end, int contentMask, const idEntity *passEntity)
idBounds & TranslateSelf(const idVec3 &translation)
void SetClipModel(idClipModel *model, float density, int id=0, bool freeOld=true)
bool TurnToward(float yaw)
float GetFloat(const char *key, const char *defaultString="0") const
idMat3 ToMat3(void) const
void TouchedByFlashlight(idActor *flashlight_owner)
bool GetJointTransform(jointHandle_t jointHandle, int currenttime, idVec3 &offset, idMat3 &axis)
virtual void GetAASLocation(idAAS *aas, idVec3 &pos, int &areaNum) const
virtual bool TestArea(const idAAS *aas, int areaNum)
void WriteString(const char *string)
bool EmitSmoke(const idDeclParticle *smoke, const int startTime, const float diversity, const idVec3 &origin, const idMat3 &axis, int timeGroup)
bool PointVisible(const idVec3 &point) const
int GetInt(const char *key, const char *defaultString="0") const
const idEventDef EV_CombatNode_MarkUsed("markUsed")
void ReadSoundShader(const idSoundShader *&shader)
void SetMaxStepHeight(const float newMaxStepHeight)
const idSoundShader * chat_snd
virtual const idSoundShader * FindSound(const char *name, bool makeDefault=true)=0
const idDict * FindEntityDefDict(const char *name, bool makeDefault=true) const
void ReadParticle(const idDeclParticle *&particle)
virtual const idVec3 & GetGravityNormal(void) const =0
void Restore(idRestoreGame *savefile)
const int SHADERPARM_DIVERSITY
int Cmp(const char *text) const
idClipModel * projectileClipModel
virtual void FreeLightDef(qhandle_t lightHandle)=0
bool MoveToAttackPosition(idEntity *ent, int attack_anim)
void TalkTo(idActor *actor)
idMat3 mat3_identity(idVec3(1, 0, 0), idVec3(0, 1, 0), idVec3(0, 0, 1))
bool EntityInView(idActor *actor, const idVec3 &pos)
void LinkScriptVariables(void)
idLinkList< idActor > enemyNode
void WriteObject(const idClass *obj)
virtual void DebugArrow(const idVec4 &color, const idVec3 &start, const idVec3 &end, int size, const int lifetime=0)=0
idVec3 GetCenter(void) const
virtual bool TestArea(const idAAS *aas, int areaNum)
virtual void DeconstructScriptObject(void)
bool GetFloorPos(float max_dist, idVec3 &floorpos) const
bool MoveToEntity(idEntity *ent)
void CheckObstacleAvoidance(const idVec3 &goalPos, idVec3 &newPos)
virtual void Launch(const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire=0.0f, const float launchPower=1.0f, const float dmgPower=1.0f)
void Printf(const char *fmt,...) const id_attribute((format(printf
idEntityPtr< idActor > talkTarget
void Clamp(const idAngles &min, const idAngles &max)
struct idEntity::entityFlags_s fl
void BindToJoint(idEntity *master, const char *jointname, bool orientated)
void FreeCurrentPVS(pvsHandle_t handle) const
type * GetEntity(void) const
idEntityPtr< idEntity > focusEntity
const float AI_HEARING_RANGE
void ChangePose(idEntity *ent, int time)
idActor * GetEnemy(void) const
idSmokeParticles * smokeParticles
float GetFloat(void) const
const idStr & GetKey(void) const
void Restore(idRestoreGame *savefile)
void SetNum(int newnum, bool resize=true)
idScriptBool AI_ENEMY_IN_FOV
bool SetSyncedAnimWeight(int num, float weight)
idVec3 lastVisibleReachableEnemyPos
idScriptBool AI_HIT_ENEMY
void SetMass(float mass, int id=-1)
idEntity * startPosObstacle
const idEventDef EV_Activate("activate","e")
idCVar ai_showObstacleAvoidance("ai_showObstacleAvoidance","0", CVAR_GAME|CVAR_INTEGER,"draws obstacle avoidance information for monsters. if 2, draws obstacles for player, as well", 0, 2, idCmdSystem::ArgCompletion_Integer< 0, 2 >)
void SetEnemy(idActor *newEnemy)
idMat3 Transpose(void) const
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
idScriptObject scriptObject
idAngles GetAngles(const char *key, const char *defaultString=NULL) const
void Save(idSaveGame *savefile) const
bool IsType(const idTypeInfo &c) const
void SetCombatModel(void)
void Set(const float x, const float y, const float z)
void CreateProjectileClipModel(void) const
idEntityPtr< idActor > enemy
idCVar g_monsters("g_monsters","1", CVAR_GAME|CVAR_BOOL,"")
int PVSAreas[idEntity::MAX_PVS_AREAS]
void DirectDamage(const char *meleeDefName, idEntity *ent)
idLinkList< idActor > enemyList
void SetOrigin(const idVec3 &newOrigin, int id=-1)
const idKeyValue * MatchPrefix(const char *prefix, const idKeyValue *lastMatch=NULL) const
bool ProcessEvent(const idEventDef *ev)
void UpdateEnemyPosition(void)
void SetEnemyPosition(void)
void SetGranularity(int newgranularity)
idScriptFloat AI_SPECIAL_DAMAGE
int FindFrameForFrameCommand(frameCommandType_t framecommand, const frameCommand_t **command) const
static float AngleDelta(float angle1, float angle2)
jointHandle_t GetJointHandle(const char *name) const
moveCommand_t moveCommand
const char * GetName(void) const
idEntity * seekPosObstacle
void ReadJoint(jointHandle_t &value)
void ReadBool(bool &value)
idAngles ang_zero(0.0f, 0.0f, 0.0f)
void Activate(idEntity *activator)
void WriteStaticObject(const idClass &obj)
bool SlideToPosition(const idVec3 &pos, float time)
idPhysics_AF * GetPhysics(void)
int GetPVSAreas(const idBounds &bounds, int *areas, int maxAreas) const
static void List_f(const idCmdArgs &args)
idVec3 projectileVelocity
const int SHADERPARM_GREEN
const char * Left(int len, idStr &result) const
idVec3 Seek(idVec3 &vel, const idVec3 &org, const idVec3 &goal, float prediction)
void UseVelocityMove(bool force)
static bool FindPathAroundObstacles(const idPhysics *physics, const idAAS *aas, const idEntity *ignore, const idVec3 &startPos, const idVec3 &seekPos, obstaclePath_t &path)
static bool PredictPath(const idEntity *ent, const idAAS *aas, const idVec3 &start, const idVec3 &velocity, int totalTime, int frameTime, int stopEvent, predictedPath_t &path)
virtual bool FindNearestGoal(aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idAASCallback &callback) const =0
virtual void SetLinearVelocity(const idVec3 &newLinearVelocity, int id=0)=0
void FlySeekGoal(idVec3 &vel, idVec3 &goalPos)
void SetJointPos(jointHandle_t jointnum, jointModTransform_t transform_type, const idVec3 &pos)
idVec3 lastVisibleEnemyPos
void Create(idEntity *owner, const idVec3 &start, const idVec3 &dir)
bool IsDisabled(void) const
virtual qhandle_t AddLightDef(const renderLight_t *rlight)=0
virtual int PointReachableAreaNum(const idVec3 &origin, const idBounds &bounds, const int areaFlags) const =0
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
#define AREA_REACHABLE_FLY
virtual void LinkCombat(void)
idProjectile * CreateProjectile(const idVec3 &pos, const idVec3 &dir)
idCVar ai_debugTrajectory("ai_debugTrajectory","0", CVAR_GAME|CVAR_BOOL,"draws trajectory tests for monsters")
const idDict * projectileDef
const char * GetClassname(void) const
float GetRadius(void) const
void Set(const char *key, const char *value)
virtual void ApplyImpulse(idEntity *ent, int id, const idVec3 &point, const idVec3 &impulse)
void CopyJointsFromBodyToHead(void)
idScriptBool AI_ACTIVATED
void SetDelta(const idVec3 &d)
idActor * GetAlertEntity(void)
bool PathToGoal(aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin) const
idBounds boundingBoxes[MAX_AAS_BOUNDING_BOXES]
void DrawRoute(void) const
idAASFindAreaOutOfRange(const idVec3 &targetPos, float maxDist)
const char * Name(void) const
bool MoveToPosition(const idVec3 &pos)
#define MASK_MONSTERSOLID
idVec3 lastReachableEnemyPos
bool EntityCanSeePos(idActor *actor, const idVec3 &actorOrigin, const idVec3 &pos)
virtual void DormantEnd(void)
bool Compare(const idAngles &a) const
void WriteVec3(const idVec3 &vec)
virtual void ClearJointMods(void)
const idDeclParticle * SpawnParticlesOnJoint(particleEmitter_t &pe, const char *particleName, const char *jointName)
const idVec3 & GetOrigin(int id=0) const
virtual bool UpdateAnimationControllers(void)
idScriptBool AI_ENEMY_VISIBLE
static const int MAX_PVS_AREAS
bool EnemyPositionValid(void) const
const idVec2 & ToVec2(void) const
void WriteSoundShader(const idSoundShader *shader)
const int SHADERPARM_ALPHA
#define EVENT(event, function)
void SetContents(int contents, int id=-1)
void SetJointAxis(jointHandle_t jointnum, jointModTransform_t transform_type, const idMat3 &mat)
void WriteJoint(const jointHandle_t value)
void WriteBool(const bool value)
void UpdateParticles(void)
virtual void Killed(idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location)
float shaderParms[MAX_ENTITY_SHADER_PARMS]
bool ValidForBounds(const idAASSettings *settings, const idBounds &bounds)
idCVar g_skill("g_skill","1", CVAR_GAME|CVAR_INTEGER,"")
bool IsHidden(void) const
static float Sin16(float a)
void KickObstacles(const idVec3 &dir, float force, idEntity *alwaysKick)
const int SHADERPARM_TIMESCALE
void Event_MarkUsed(void)
bool AnimDone(int blendFrames) const
idScriptBool AI_MOVE_DONE
void void void Warning(const char *fmt,...) const id_attribute((format(printf
void AddFlyBob(idVec3 &vel)
bool CanSee(idEntity *ent, bool useFOV) const
float LengthFast(void) const
pvsHandle_t SetupCurrentPVS(const idVec3 &source, const pvsType_t type=PVS_NORMAL) const
idClipModel * GetClipModel(int id=0) const
virtual const idBounds & GetBounds(int id=-1) const =0
virtual bool OnLadder(void) const
idAASFindAttackPosition(const idAI *self, const idMat3 &gravityAxis, idEntity *target, const idVec3 &targetPos, const idVec3 &fireOffset)
bool StartSoundShader(const idSoundShader *shader, const s_channelType channel, int soundShaderFlags, bool broadcast, int *length)
const int SHADERPARM_BLUE
bool AddPoint(const idVec3 &v)
void TriggerWeaponEffects(const idVec3 &muzzle)
idVec3 & Truncate(float length)
void GetDelta(int fromtime, int totime, idVec3 &delta) const
idVec3 GetEyePosition(void) const
void CalcDamagePoints(idEntity *inflictor, idEntity *attacker, const idDict *damageDef, const float damageScale, const int location, int *health, int *armor)
void SetSelf(idEntity *e)
void Restore(idRestoreGame *savefile)
GLuint GLuint GLsizei count
bool MoveToCover(idEntity *entity, const idVec3 &pos)
bool ReachedPos(const idVec3 &pos, const moveCommand_t moveCommand) const
bool StepDirection(float dir)
float TravelDistance(const idVec3 &start, const idVec3 &end) const
float projectile_height_to_distance_ratio
idAAS * GetAAS(int num) const
void AdjustFlySpeed(idVec3 &vel)
void RemoveOriginOffset(bool remove)
idEntityPtr< idAFAttachment > head
idCVar g_debugCinematic("g_debugCinematic","0", CVAR_GAME|CVAR_BOOL,"")
void SetOwner(idEntity *newOwner)
idPhysics * GetPhysics(void) const
virtual void DebugLine(const idVec4 &color, const idVec3 &start, const idVec3 &end, const int lifetime=0, const bool depthTest=false)=0
idAngles ToAngles(void) const
idProjectile * LaunchProjectile(const char *jointname, idEntity *target, bool clampToAttackCone)
const char * GetString(const char *key, const char *defaultString="") const
bool SpawnEntityDef(const idDict &args, idEntity **ent=NULL, bool setDefaults=true)
void ReadFloat(float &value)
bool InCurrentPVS(const pvsHandle_t handle, const idVec3 &target) const
idVec3 ToForward(void) const
virtual void ShowWalkPath(const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin) const =0
bool StartSound(const char *soundName, const s_channelType channel, int soundShaderFlags, bool broadcast, int *length)
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
virtual bool RouteToGoalArea(int areaNum, const idVec3 origin, int goalAreaNum, int travelFlags, int &travelTime, idReachability **reach) const =0
int PointReachableAreaNum(const idVec3 &pos, const float boundsScale=2.0f) const
idCVar g_debugDamage("g_debugDamage","0", CVAR_GAME|CVAR_BOOL,"")
void SetPhysics(idPhysics *phys)
idEntityPtr< idEntity > obstacle
const int SAVING_THROW_TIME
int EntitiesTouchingAF(afTouch_t touchList[MAX_GENTITIES]) const
static float Sin(float a)
void WriteFloat(const float value)
bool TestMelee(void) const
static float Fabs(float f)
idCVar g_gravity("g_gravity", DEFAULT_GRAVITY_STRING, CVAR_GAME|CVAR_FLOAT,"")
const idVec3 & GetGravityNormal(void) const
virtual float GetMass(int id=-1) const =0
const int DEFAULT_FLY_OFFSET
void ClearAllAnims(int currentTime, int cleartime)
void UpdateMuzzleFlash(void)
bool GetBool(const char *key, const char *defaultString="0") const
jointHandle_t flashJointWorld
const float AI_TURN_SCALE
static float AngleNormalize360(float angle)
idCVar g_muzzleFlash("g_muzzleFlash","1", CVAR_GAME|CVAR_ARCHIVE|CVAR_BOOL,"show muzzle flashes")
const idBounds & GetBounds(void) const
idAnimBlend * CurrentAnim(int channelNum)
virtual const idDecl * FindType(declType_t type, const char *name, bool makeDefault=true)=0
void BlockedFailSafe(void)
int ReactionTo(const idEntity *ent)
int GetInteger(void) const
virtual bool TestArea(const idAAS *aas, int areaNum)
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
bool GetMovePos(idVec3 &seekPos)
const char * GetDamageGroup(int location)
virtual void SetOrigin(const idVec3 &newOrigin, int id=-1)=0
const idEventDef AI_PlayAnim("playAnim","ds", 'd')
idScriptBool AI_DEST_UNREACHABLE
virtual bool FlyPathToGoal(aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags) const =0
const idVec3 & GetGravity(void) const
bool IsTraceModel(void) const
const idEntity * blockingEntity
void BeginAttack(const char *name)
const idStr & GetValue(void) const
virtual const idMat3 & GetAxis(int id=0) const =0
virtual idAnimator * GetAnimator(void)
float NormalizeFast(void)
const char * Right(int len, idStr &result) const
bool MoveOutOfRange(idEntity *entity, float range)
void ServiceAnims(int fromtime, int totime)
const idDeclModelDef * ModelDef(void) const
virtual void DrawText(const char *text, const idVec3 &origin, float scale, const idVec4 &color, const idMat3 &viewAxis, const int align=1, const int lifetime=0, bool depthTest=false)=0
int Find(const char c, int start=0, int end=-1) const
idBounds Rotate(const idMat3 &rotation) const
#define MASK_SHOT_RENDERMODEL
bool FaceEntity(idEntity *ent)
idLinkList< idEntity > spawnNode
virtual bool WalkPathToGoal(aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags) const =0
~idAASFindAttackPosition()
float ToPitch(void) const
animFlags_t GetAnimFlags(void) const
void SetBool(const char *key, bool val)
float LengthSqr(void) const
int PVSAreas[idEntity::MAX_PVS_AREAS]
const int SHADERPARM_TIMEOFFSET
const float AI_SEEK_PREDICTION
void AdjustFlyHeight(idVec3 &vel, const idVec3 &goalPos)
void AlertAI(idEntity *ent)
virtual void Damage(idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location)
bool DirectMoveToPosition(const idVec3 &pos)
const idBounds & GetAbsBounds(int id=-1) const
virtual void UpdateLightDef(qhandle_t lightHandle, const renderLight_t *rlight)=0
idBounds Expand(const float d) const
void CalculateAttackOffsets(void)
void Event_Activate(idEntity *activator)
idLinkList< idEntity > spawnedEntities
idScriptBool AI_OBSTACLE_IN_PATH
virtual void ApplyImpulse(idEntity *ent, int id, const idVec3 &point, const idVec3 &impulse)
const float AI_FLY_DAMPENING
void Save(idSaveGame *savefile) const
virtual idClipModel * GetClipModel(int id=0) const =0
GLenum GLsizei GLsizei height
const char * ToString(int precision=2) const
void WriteInt(const int value)
virtual void Present(void)
void ProjectVector(const idVec3 &src, idVec3 &dst) const
renderLight_t worldMuzzleFlash
void RemoveAttachments(void)
idDeclManager * declManager
void Save(idSaveGame *savefile) const
virtual void DamageFeedback(idEntity *victim, idEntity *inflictor, int &damage)
void ForceDeltaMove(bool force)
bool GetDeltaRotation(int fromtime, int totime, idMat3 &delta) const
idEntity * entities[MAX_GENTITIES]
jointHandle_t orientationJoint
void AddToEnd(idLinkList &node)
void LinkTo(idScriptObject &obj, const char *name)
idEntity * GetTraceEntity(const trace_t &trace) const
void ReadStaticObject(idClass &obj)
int Append(const type &obj)
bool NewWanderDir(const idVec3 &dest)
float eyeHorizontalOffset
void GetMuzzle(const char *jointname, idVec3 &muzzle, idMat3 &axis)
virtual void ApplyImpulse(idEntity *ent, int id, const idVec3 &point, const idVec3 &impulse)
idVec3 FirstVisiblePointOnPath(const idVec3 origin, const idVec3 &target, int travelFlags) const
void UpdateAnimState(void)
void WriteAngles(const idAngles &angles)
void SetClipMask(int mask, int id=-1)
idVec3 lastVisibleEnemyEyeOffset
const idVec3 & GetWorldOrigin(void) const
static bool PredictTrajectory(const idVec3 &firePos, const idVec3 &target, float projectileSpeed, const idVec3 &projGravity, const idClipModel *clip, int clipmask, float max_height, const idEntity *ignore, const idEntity *targetEntity, int drawtime, idVec3 &aimDir)
void UpdateAIScript(void)
idPhysics_Monster physicsObj
virtual bool CanPlayChatterSounds(void) const
const idDeclParticle * particle
virtual bool IsPushable(void) const =0
void SetGravity(const idVec3 &newGravity)
void GetMoveDelta(const idMat3 &oldaxis, const idMat3 &axis, idVec3 &delta)
void SetWaitState(const char *_waitstate)
jointHandle_t leftEyeJoint
static idVec3 GetGravity(const idDict *projectile)
virtual void ShowFlyPath(const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin) const =0
int GetClipMask(int id=-1) const
#define AREA_REACHABLE_WALK
bool MoveDone(void) const
#define ATTACK_ON_ACTIVATE
idMat3 ToMat3(void) const
virtual bool Pain(idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location)
virtual const idAASSettings * GetSettings(void) const =0
bool IntersectsBounds(const idBounds &a) const
virtual const idBounds & GetAbsBounds(int id=-1) const =0
idCVar ai_debugMove("ai_debugMove","0", CVAR_GAME|CVAR_BOOL,"draws movement information for monsters")
virtual void GetAIAimTargets(const idVec3 &lastSightPos, idVec3 &headPos, idVec3 &chestPos)
static float AngleNormalize180(float angle)
bool GetJointWorldTransform(jointHandle_t jointHandle, int currentTime, idVec3 &offset, idMat3 &axis)
virtual bool UpdateAnimationControllers(void)
void SpawnParticles(const char *keyName)
virtual void Damage(idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location)
#define CLASS_DECLARATION(nameofsuperclass, nameofclass)
bool OnGround(void) const
const function_t * GetScriptFunction(const char *funcname)
void SetLinearVelocity(const idVec3 &newLinearVelocity, int id=0)
const char * GetName(void) const
void UpdateAnimation(void)
static int SnapTimeToPhysicsFrame(int t)
void Save(idSaveGame *savefile) const
void ReadVec3(idVec3 &vec)
static idVec3 GetVelocity(const idDict *projectile)
virtual bool Pain(idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location)
float LengthFast(void) const
const char * c_str(void) const
idList< jointHandle_t > lookJoints
const idAnim * GetAnim(int index) const
bool Disabled(void) const
bool MoveToEnemyHeight(void)
void ReadAngles(idAngles &angles)
void RestorePhysics(idPhysics *phys)
ID_INLINE int FRAME2MS(int framenum)
const char * GetJointName(jointHandle_t handle) const
void BecomeActive(int flags)
jointHandle_t flyTiltJoint
void InitMuzzleFlash(void)
const int ANIMCHANNEL_TORSO
const idEventDef EV_Remove("<immediateremove>", NULL)
idScriptBool AI_ENEMY_DEAD
int worldMuzzleFlashHandle
const int * GetPVSAreas(void)
virtual void Present(void)
#define MASK_SHOT_BOUNDINGBOX
bool GetJointTransformForAnim(jointHandle_t jointHandle, int animNum, int currentTime, idVec3 &offset, idMat3 &axis) const
idEntityPtr< idProjectile > projectile
idVec3 EyeOffset(void) const
monsterMoveResult_t GetMoveResult(void) const
bool CheckFOV(const idVec3 &pos) const
const idMat3 & GetGravityAxis(void) const
const int ANIMCHANNEL_LEGS
idBounds & ExpandSelf(const float d)
bool AttackMelee(const char *meleeDefName)
virtual void PushPointIntoAreaNum(int areaNum, idVec3 &origin) const =0
virtual void DebugBounds(const idVec4 &color, const idBounds &bounds, const idVec3 &org=vec3_origin, const int lifetime=0)=0
idList< idVec3 > missileLaunchOffset
idAASFindCover(const idVec3 &hideFromPos)
const char * GetEntityDefName(void) const
const idDeclEntityDef * FindEntityDef(const char *name, bool makeDefault=true) const
idRenderWorld * gameRenderWorld
idEntity * GetSlideMoveEntity(void) const
char * va(const char *fmt,...)
void StopMove(moveStatus_t status)
bool Translation(trace_t &results, const idVec3 &start, const idVec3 &end, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
static idEntityFx * StartFx(const char *fx, const idVec3 *useOrigin, const idMat3 *useAxis, idEntity *ent, bool bind)
const idVec3 & GetLinearVelocity(int id=0) const
bool PostEventMS(const idEventDef *ev, int time)
virtual void SetModel(const char *modelname)
const idMaterial * shader
idList< particleEmitter_t > particles
void AdjustFlyingAngles(void)
bool IsActive(void) const
void WriteParticle(const idDeclParticle *particle)
static void DrawDebugInfo(void)
bool ContainsPoint(const idVec3 &p) const
talkState_t GetTalkState(void) const
float shaderParms[MAX_ENTITY_SHADER_PARMS]
void ReadString(idStr &string)
idCVar ai_blockedFailSafe("ai_blockedFailSafe","1", CVAR_GAME|CVAR_BOOL,"enable blocked fail safe handling")
void UpdateDamageEffects(void)
const idBounds & GetBounds(int id=-1) const
idEntityPtr< idEntity > goalEntity
void BecomeInactive(int flags)
void TriggerParticles(const char *jointName)
jointHandle_t rightEyeJoint
void ActivateTargets(idEntity *activator) const
void StopSound(const s_channelType channel, bool broadcast)
virtual void Gib(const idVec3 &dir, const char *damageDefName)
float LengthSqr(void) const
void SetState(const function_t *newState)
void ClearJoint(jointHandle_t jointnum)
bool StripLeadingOnce(const char *string)
void ReadObject(idClass *&obj)
void RemoveProjectile(void)
virtual void DormantEnd(void)
virtual void SetAxis(const idMat3 &newAxis, int id=-1)=0
static float Cos(float a)
virtual void DormantBegin(void)