doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AI_events.cpp
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #include "../../idlib/precompiled.h"
30 #pragma hdrstop
31 
32 #include "../Game_local.h"
33 
34 /***********************************************************************
35 
36  AI Events
37 
38 ***********************************************************************/
39 
40 const idEventDef AI_FindEnemy( "findEnemy", "d", 'e' );
41 const idEventDef AI_FindEnemyAI( "findEnemyAI", "d", 'e' );
42 const idEventDef AI_FindEnemyInCombatNodes( "findEnemyInCombatNodes", NULL, 'e' );
43 const idEventDef AI_ClosestReachableEnemyOfEntity( "closestReachableEnemyOfEntity", "E", 'e' );
44 const idEventDef AI_HeardSound( "heardSound", "d", 'e' );
45 const idEventDef AI_SetEnemy( "setEnemy", "E" );
46 const idEventDef AI_ClearEnemy( "clearEnemy" );
47 const idEventDef AI_MuzzleFlash( "muzzleFlash", "s" );
48 const idEventDef AI_CreateMissile( "createMissile", "s", 'e' );
49 const idEventDef AI_AttackMissile( "attackMissile", "s", 'e' );
50 const idEventDef AI_FireMissileAtTarget( "fireMissileAtTarget", "ss", 'e' );
51 const idEventDef AI_LaunchMissile( "launchMissile", "vv", 'e' );
52 #ifdef _D3XP
53 const idEventDef AI_LaunchProjectile( "launchProjectile", "s" );
54 #endif
55 const idEventDef AI_AttackMelee( "attackMelee", "s", 'd' );
56 const idEventDef AI_DirectDamage( "directDamage", "es" );
57 const idEventDef AI_RadiusDamageFromJoint( "radiusDamageFromJoint", "ss" );
58 const idEventDef AI_BeginAttack( "attackBegin", "s" );
59 const idEventDef AI_EndAttack( "attackEnd" );
60 const idEventDef AI_MeleeAttackToJoint( "meleeAttackToJoint", "ss", 'd' );
61 const idEventDef AI_RandomPath( "randomPath", NULL, 'e' );
62 const idEventDef AI_CanBecomeSolid( "canBecomeSolid", NULL, 'f' );
63 const idEventDef AI_BecomeSolid( "becomeSolid" );
64 const idEventDef AI_BecomeRagdoll( "becomeRagdoll", NULL, 'd' );
65 const idEventDef AI_StopRagdoll( "stopRagdoll" );
66 const idEventDef AI_SetHealth( "setHealth", "f" );
67 const idEventDef AI_GetHealth( "getHealth", NULL, 'f' );
68 const idEventDef AI_AllowDamage( "allowDamage" );
69 const idEventDef AI_IgnoreDamage( "ignoreDamage" );
70 const idEventDef AI_GetCurrentYaw( "getCurrentYaw", NULL, 'f' );
71 const idEventDef AI_TurnTo( "turnTo", "f" );
72 const idEventDef AI_TurnToPos( "turnToPos", "v" );
73 const idEventDef AI_TurnToEntity( "turnToEntity", "E" );
74 const idEventDef AI_MoveStatus( "moveStatus", NULL, 'd' );
75 const idEventDef AI_StopMove( "stopMove" );
76 const idEventDef AI_MoveToCover( "moveToCover" );
77 const idEventDef AI_MoveToEnemy( "moveToEnemy" );
78 const idEventDef AI_MoveToEnemyHeight( "moveToEnemyHeight" );
79 const idEventDef AI_MoveOutOfRange( "moveOutOfRange", "ef" );
80 const idEventDef AI_MoveToAttackPosition( "moveToAttackPosition", "es" );
81 const idEventDef AI_Wander( "wander" );
82 const idEventDef AI_MoveToEntity( "moveToEntity", "e" );
83 const idEventDef AI_MoveToPosition( "moveToPosition", "v" );
84 const idEventDef AI_SlideTo( "slideTo", "vf" );
85 const idEventDef AI_FacingIdeal( "facingIdeal", NULL, 'd' );
86 const idEventDef AI_FaceEnemy( "faceEnemy" );
87 const idEventDef AI_FaceEntity( "faceEntity", "E" );
88 const idEventDef AI_GetCombatNode( "getCombatNode", NULL, 'e' );
89 const idEventDef AI_EnemyInCombatCone( "enemyInCombatCone", "Ed", 'd' );
90 const idEventDef AI_WaitMove( "waitMove" );
91 const idEventDef AI_GetJumpVelocity( "getJumpVelocity", "vff", 'v' );
92 const idEventDef AI_EntityInAttackCone( "entityInAttackCone", "E", 'd' );
93 const idEventDef AI_CanSeeEntity( "canSee", "E", 'd' );
94 const idEventDef AI_SetTalkTarget( "setTalkTarget", "E" );
95 const idEventDef AI_GetTalkTarget( "getTalkTarget", NULL, 'e' );
96 const idEventDef AI_SetTalkState( "setTalkState", "d" );
97 const idEventDef AI_EnemyRange( "enemyRange", NULL, 'f' );
98 const idEventDef AI_EnemyRange2D( "enemyRange2D", NULL, 'f' );
99 const idEventDef AI_GetEnemy( "getEnemy", NULL, 'e' );
100 const idEventDef AI_GetEnemyPos( "getEnemyPos", NULL, 'v' );
101 const idEventDef AI_GetEnemyEyePos( "getEnemyEyePos", NULL, 'v' );
102 const idEventDef AI_PredictEnemyPos( "predictEnemyPos", "f", 'v' );
103 const idEventDef AI_CanHitEnemy( "canHitEnemy", NULL, 'd' );
104 const idEventDef AI_CanHitEnemyFromAnim( "canHitEnemyFromAnim", "s", 'd' );
105 const idEventDef AI_CanHitEnemyFromJoint( "canHitEnemyFromJoint", "s", 'd' );
106 const idEventDef AI_EnemyPositionValid( "enemyPositionValid", NULL, 'd' );
107 const idEventDef AI_ChargeAttack( "chargeAttack", "s" );
108 const idEventDef AI_TestChargeAttack( "testChargeAttack", NULL, 'f' );
109 const idEventDef AI_TestMoveToPosition( "testMoveToPosition", "v", 'd' );
110 const idEventDef AI_TestAnimMoveTowardEnemy( "testAnimMoveTowardEnemy", "s", 'd' );
111 const idEventDef AI_TestAnimMove( "testAnimMove", "s", 'd' );
112 const idEventDef AI_TestMeleeAttack( "testMeleeAttack", NULL, 'd' );
113 const idEventDef AI_TestAnimAttack( "testAnimAttack", "s", 'd' );
114 const idEventDef AI_Shrivel( "shrivel", "f" );
115 const idEventDef AI_Burn( "burn" );
116 const idEventDef AI_ClearBurn( "clearBurn" );
117 const idEventDef AI_PreBurn( "preBurn" );
118 const idEventDef AI_SetSmokeVisibility( "setSmokeVisibility", "dd" );
119 const idEventDef AI_NumSmokeEmitters( "numSmokeEmitters", NULL, 'd' );
120 const idEventDef AI_WaitAction( "waitAction", "s" );
121 const idEventDef AI_StopThinking( "stopThinking" );
122 const idEventDef AI_GetTurnDelta( "getTurnDelta", NULL, 'f' );
123 const idEventDef AI_GetMoveType( "getMoveType", NULL, 'd' );
124 const idEventDef AI_SetMoveType( "setMoveType", "d" );
125 const idEventDef AI_SaveMove( "saveMove" );
126 const idEventDef AI_RestoreMove( "restoreMove" );
127 const idEventDef AI_AllowMovement( "allowMovement", "f" );
128 const idEventDef AI_JumpFrame( "<jumpframe>" );
129 const idEventDef AI_EnableClip( "enableClip" );
130 const idEventDef AI_DisableClip( "disableClip" );
131 const idEventDef AI_EnableGravity( "enableGravity" );
132 const idEventDef AI_DisableGravity( "disableGravity" );
133 const idEventDef AI_EnableAFPush( "enableAFPush" );
134 const idEventDef AI_DisableAFPush( "disableAFPush" );
135 const idEventDef AI_SetFlySpeed( "setFlySpeed", "f" );
136 const idEventDef AI_SetFlyOffset( "setFlyOffset", "d" );
137 const idEventDef AI_ClearFlyOffset( "clearFlyOffset" );
138 const idEventDef AI_GetClosestHiddenTarget( "getClosestHiddenTarget", "s", 'e' );
139 const idEventDef AI_GetRandomTarget( "getRandomTarget", "s", 'e' );
140 const idEventDef AI_TravelDistanceToPoint( "travelDistanceToPoint", "v", 'f' );
141 const idEventDef AI_TravelDistanceToEntity( "travelDistanceToEntity", "e", 'f' );
142 const idEventDef AI_TravelDistanceBetweenPoints( "travelDistanceBetweenPoints", "vv", 'f' );
143 const idEventDef AI_TravelDistanceBetweenEntities( "travelDistanceBetweenEntities", "ee", 'f' );
144 const idEventDef AI_LookAtEntity( "lookAt", "Ef" );
145 const idEventDef AI_LookAtEnemy( "lookAtEnemy", "f" );
146 const idEventDef AI_SetJointMod( "setBoneMod", "d" );
147 const idEventDef AI_ThrowMoveable( "throwMoveable" );
148 const idEventDef AI_ThrowAF( "throwAF" );
149 const idEventDef AI_RealKill( "<kill>" );
150 const idEventDef AI_Kill( "kill" );
151 const idEventDef AI_WakeOnFlashlight( "wakeOnFlashlight", "d" );
152 const idEventDef AI_LocateEnemy( "locateEnemy" );
153 const idEventDef AI_KickObstacles( "kickObstacles", "Ef" );
154 const idEventDef AI_GetObstacle( "getObstacle", NULL, 'e' );
155 const idEventDef AI_PushPointIntoAAS( "pushPointIntoAAS", "v", 'v' );
156 const idEventDef AI_GetTurnRate( "getTurnRate", NULL, 'f' );
157 const idEventDef AI_SetTurnRate( "setTurnRate", "f" );
158 const idEventDef AI_AnimTurn( "animTurn", "f" );
159 const idEventDef AI_AllowHiddenMovement( "allowHiddenMovement", "d" );
160 const idEventDef AI_TriggerParticles( "triggerParticles", "s" );
161 const idEventDef AI_FindActorsInBounds( "findActorsInBounds", "vv", 'e' );
162 const idEventDef AI_CanReachPosition( "canReachPosition", "v", 'd' );
163 const idEventDef AI_CanReachEntity( "canReachEntity", "E", 'd' );
164 const idEventDef AI_CanReachEnemy( "canReachEnemy", NULL, 'd' );
165 const idEventDef AI_GetReachableEntityPosition( "getReachableEntityPosition", "e", 'v' );
166 #ifdef _D3XP
167 const idEventDef AI_MoveToPositionDirect( "moveToPositionDirect", "v" );
168 const idEventDef AI_AvoidObstacles( "avoidObstacles", "d" );
169 const idEventDef AI_TriggerFX( "triggerFX", "ss" );
170 const idEventDef AI_StartEmitter( "startEmitter", "sss", 'e' );
171 const idEventDef AI_GetEmitter( "getEmitter", "s", 'e' );
172 const idEventDef AI_StopEmitter( "stopEmitter", "s" );
173 
174 
175 #endif
176 
178  EVENT( EV_Activate, idAI::Event_Activate )
179  EVENT( EV_Touch, idAI::Event_Touch )
180  EVENT( AI_FindEnemy, idAI::Event_FindEnemy )
181  EVENT( AI_FindEnemyAI, idAI::Event_FindEnemyAI )
182  EVENT( AI_FindEnemyInCombatNodes, idAI::Event_FindEnemyInCombatNodes )
183  EVENT( AI_ClosestReachableEnemyOfEntity, idAI::Event_ClosestReachableEnemyOfEntity )
184  EVENT( AI_HeardSound, idAI::Event_HeardSound )
185  EVENT( AI_SetEnemy, idAI::Event_SetEnemy )
186  EVENT( AI_ClearEnemy, idAI::Event_ClearEnemy )
187  EVENT( AI_MuzzleFlash, idAI::Event_MuzzleFlash )
188  EVENT( AI_CreateMissile, idAI::Event_CreateMissile )
189  EVENT( AI_AttackMissile, idAI::Event_AttackMissile )
190  EVENT( AI_FireMissileAtTarget, idAI::Event_FireMissileAtTarget )
191  EVENT( AI_LaunchMissile, idAI::Event_LaunchMissile )
192 #ifdef _D3XP
193  EVENT( AI_LaunchProjectile, idAI::Event_LaunchProjectile )
194 #endif
196  EVENT( AI_DirectDamage, idAI::Event_DirectDamage )
197  EVENT( AI_RadiusDamageFromJoint, idAI::Event_RadiusDamageFromJoint )
198  EVENT( AI_BeginAttack, idAI::Event_BeginAttack )
199  EVENT( AI_EndAttack, idAI::Event_EndAttack )
200  EVENT( AI_MeleeAttackToJoint, idAI::Event_MeleeAttackToJoint )
201  EVENT( AI_RandomPath, idAI::Event_RandomPath )
202  EVENT( AI_CanBecomeSolid, idAI::Event_CanBecomeSolid )
203  EVENT( AI_BecomeSolid, idAI::Event_BecomeSolid )
204  EVENT( EV_BecomeNonSolid, idAI::Event_BecomeNonSolid )
205  EVENT( AI_BecomeRagdoll, idAI::Event_BecomeRagdoll )
206  EVENT( AI_StopRagdoll, idAI::Event_StopRagdoll )
207  EVENT( AI_SetHealth, idAI::Event_SetHealth )
208  EVENT( AI_GetHealth, idAI::Event_GetHealth )
209  EVENT( AI_AllowDamage, idAI::Event_AllowDamage )
210  EVENT( AI_IgnoreDamage, idAI::Event_IgnoreDamage )
211  EVENT( AI_GetCurrentYaw, idAI::Event_GetCurrentYaw )
212  EVENT( AI_TurnTo, idAI::Event_TurnTo )
213  EVENT( AI_TurnToPos, idAI::Event_TurnToPos )
214  EVENT( AI_TurnToEntity, idAI::Event_TurnToEntity )
215  EVENT( AI_MoveStatus, idAI::Event_MoveStatus )
216  EVENT( AI_StopMove, idAI::Event_StopMove )
217  EVENT( AI_MoveToCover, idAI::Event_MoveToCover )
218  EVENT( AI_MoveToEnemy, idAI::Event_MoveToEnemy )
219  EVENT( AI_MoveToEnemyHeight, idAI::Event_MoveToEnemyHeight )
220  EVENT( AI_MoveOutOfRange, idAI::Event_MoveOutOfRange )
221  EVENT( AI_MoveToAttackPosition, idAI::Event_MoveToAttackPosition )
222  EVENT( AI_Wander, idAI::Event_Wander )
223  EVENT( AI_MoveToEntity, idAI::Event_MoveToEntity )
224  EVENT( AI_MoveToPosition, idAI::Event_MoveToPosition )
225  EVENT( AI_SlideTo, idAI::Event_SlideTo )
226  EVENT( AI_FacingIdeal, idAI::Event_FacingIdeal )
227  EVENT( AI_FaceEnemy, idAI::Event_FaceEnemy )
228  EVENT( AI_FaceEntity, idAI::Event_FaceEntity )
229  EVENT( AI_WaitAction, idAI::Event_WaitAction )
230  EVENT( AI_GetCombatNode, idAI::Event_GetCombatNode )
231  EVENT( AI_EnemyInCombatCone, idAI::Event_EnemyInCombatCone )
232  EVENT( AI_WaitMove, idAI::Event_WaitMove )
233  EVENT( AI_GetJumpVelocity, idAI::Event_GetJumpVelocity )
234  EVENT( AI_EntityInAttackCone, idAI::Event_EntityInAttackCone )
235  EVENT( AI_CanSeeEntity, idAI::Event_CanSeeEntity )
236  EVENT( AI_SetTalkTarget, idAI::Event_SetTalkTarget )
237  EVENT( AI_GetTalkTarget, idAI::Event_GetTalkTarget )
238  EVENT( AI_SetTalkState, idAI::Event_SetTalkState )
239  EVENT( AI_EnemyRange, idAI::Event_EnemyRange )
240  EVENT( AI_EnemyRange2D, idAI::Event_EnemyRange2D )
241  EVENT( AI_GetEnemy, idAI::Event_GetEnemy )
242  EVENT( AI_GetEnemyPos, idAI::Event_GetEnemyPos )
243  EVENT( AI_GetEnemyEyePos, idAI::Event_GetEnemyEyePos )
244  EVENT( AI_PredictEnemyPos, idAI::Event_PredictEnemyPos )
245  EVENT( AI_CanHitEnemy, idAI::Event_CanHitEnemy )
246  EVENT( AI_CanHitEnemyFromAnim, idAI::Event_CanHitEnemyFromAnim )
247  EVENT( AI_CanHitEnemyFromJoint, idAI::Event_CanHitEnemyFromJoint )
248  EVENT( AI_EnemyPositionValid, idAI::Event_EnemyPositionValid )
249  EVENT( AI_ChargeAttack, idAI::Event_ChargeAttack )
250  EVENT( AI_TestChargeAttack, idAI::Event_TestChargeAttack )
251  EVENT( AI_TestAnimMoveTowardEnemy, idAI::Event_TestAnimMoveTowardEnemy )
252  EVENT( AI_TestAnimMove, idAI::Event_TestAnimMove )
253  EVENT( AI_TestMoveToPosition, idAI::Event_TestMoveToPosition )
254  EVENT( AI_TestMeleeAttack, idAI::Event_TestMeleeAttack )
255  EVENT( AI_TestAnimAttack, idAI::Event_TestAnimAttack )
256  EVENT( AI_Shrivel, idAI::Event_Shrivel )
257  EVENT( AI_Burn, idAI::Event_Burn )
258  EVENT( AI_PreBurn, idAI::Event_PreBurn )
259  EVENT( AI_SetSmokeVisibility, idAI::Event_SetSmokeVisibility )
260  EVENT( AI_NumSmokeEmitters, idAI::Event_NumSmokeEmitters )
261  EVENT( AI_ClearBurn, idAI::Event_ClearBurn )
262  EVENT( AI_StopThinking, idAI::Event_StopThinking )
263  EVENT( AI_GetTurnDelta, idAI::Event_GetTurnDelta )
264  EVENT( AI_GetMoveType, idAI::Event_GetMoveType )
265  EVENT( AI_SetMoveType, idAI::Event_SetMoveType )
266  EVENT( AI_SaveMove, idAI::Event_SaveMove )
267  EVENT( AI_RestoreMove, idAI::Event_RestoreMove )
268  EVENT( AI_AllowMovement, idAI::Event_AllowMovement )
269  EVENT( AI_JumpFrame, idAI::Event_JumpFrame )
270  EVENT( AI_EnableClip, idAI::Event_EnableClip )
271  EVENT( AI_DisableClip, idAI::Event_DisableClip )
272  EVENT( AI_EnableGravity, idAI::Event_EnableGravity )
273  EVENT( AI_DisableGravity, idAI::Event_DisableGravity )
274  EVENT( AI_EnableAFPush, idAI::Event_EnableAFPush )
275  EVENT( AI_DisableAFPush, idAI::Event_DisableAFPush )
276  EVENT( AI_SetFlySpeed, idAI::Event_SetFlySpeed )
277  EVENT( AI_SetFlyOffset, idAI::Event_SetFlyOffset )
278  EVENT( AI_ClearFlyOffset, idAI::Event_ClearFlyOffset )
279  EVENT( AI_GetClosestHiddenTarget, idAI::Event_GetClosestHiddenTarget )
280  EVENT( AI_GetRandomTarget, idAI::Event_GetRandomTarget )
281  EVENT( AI_TravelDistanceToPoint, idAI::Event_TravelDistanceToPoint )
282  EVENT( AI_TravelDistanceToEntity, idAI::Event_TravelDistanceToEntity )
283  EVENT( AI_TravelDistanceBetweenPoints, idAI::Event_TravelDistanceBetweenPoints )
284  EVENT( AI_TravelDistanceBetweenEntities, idAI::Event_TravelDistanceBetweenEntities )
285  EVENT( AI_LookAtEntity, idAI::Event_LookAtEntity )
286  EVENT( AI_LookAtEnemy, idAI::Event_LookAtEnemy )
287  EVENT( AI_SetJointMod, idAI::Event_SetJointMod )
288  EVENT( AI_ThrowMoveable, idAI::Event_ThrowMoveable )
289  EVENT( AI_ThrowAF, idAI::Event_ThrowAF )
290  EVENT( EV_GetAngles, idAI::Event_GetAngles )
291  EVENT( EV_SetAngles, idAI::Event_SetAngles )
292  EVENT( AI_RealKill, idAI::Event_RealKill )
293  EVENT( AI_Kill, idAI::Event_Kill )
294  EVENT( AI_WakeOnFlashlight, idAI::Event_WakeOnFlashlight )
295  EVENT( AI_LocateEnemy, idAI::Event_LocateEnemy )
296  EVENT( AI_KickObstacles, idAI::Event_KickObstacles )
297  EVENT( AI_GetObstacle, idAI::Event_GetObstacle )
298  EVENT( AI_PushPointIntoAAS, idAI::Event_PushPointIntoAAS )
299  EVENT( AI_GetTurnRate, idAI::Event_GetTurnRate )
300  EVENT( AI_SetTurnRate, idAI::Event_SetTurnRate )
301  EVENT( AI_AnimTurn, idAI::Event_AnimTurn )
302  EVENT( AI_AllowHiddenMovement, idAI::Event_AllowHiddenMovement )
303  EVENT( AI_TriggerParticles, idAI::Event_TriggerParticles )
304  EVENT( AI_FindActorsInBounds, idAI::Event_FindActorsInBounds )
305  EVENT( AI_CanReachPosition, idAI::Event_CanReachPosition )
306  EVENT( AI_CanReachEntity, idAI::Event_CanReachEntity )
307  EVENT( AI_CanReachEnemy, idAI::Event_CanReachEnemy )
308  EVENT( AI_GetReachableEntityPosition, idAI::Event_GetReachableEntityPosition )
309 #ifdef _D3XP
310  EVENT( AI_MoveToPositionDirect, idAI::Event_MoveToPositionDirect )
311  EVENT( AI_AvoidObstacles, idAI::Event_AvoidObstacles )
312  EVENT( AI_TriggerFX, idAI::Event_TriggerFX )
313  EVENT( AI_StartEmitter, idAI::Event_StartEmitter )
314  EVENT( AI_GetEmitter, idAI::Event_GetEmitter )
315  EVENT( AI_StopEmitter, idAI::Event_StopEmitter )
316 #endif
317 END_CLASS
318 
319 /*
320 =====================
321 idAI::Event_Activate
322 =====================
323 */
324 void idAI::Event_Activate( idEntity *activator ) {
325  Activate( activator );
326 }
327 
328 /*
329 =====================
330 idAI::Event_Touch
331 =====================
332 */
333 void idAI::Event_Touch( idEntity *other, trace_t *trace ) {
334  if ( !enemy.GetEntity() && !other->fl.notarget && ( ReactionTo( other ) & ATTACK_ON_ACTIVATE ) ) {
335  Activate( other );
336  }
337  AI_PUSHED = true;
338 }
339 
340 /*
341 =====================
342 idAI::Event_FindEnemy
343 =====================
344 */
345 void idAI::Event_FindEnemy( int useFOV ) {
346  int i;
347  idEntity *ent;
348  idActor *actor;
349 
350  if ( gameLocal.InPlayerPVS( this ) ) {
351  for ( i = 0; i < gameLocal.numClients ; i++ ) {
352  ent = gameLocal.entities[ i ];
353 
354  if ( !ent || !ent->IsType( idActor::Type ) ) {
355  continue;
356  }
357 
358  actor = static_cast<idActor *>( ent );
359  if ( ( actor->health <= 0 ) || !( ReactionTo( actor ) & ATTACK_ON_SIGHT ) ) {
360  continue;
361  }
362 
363  if ( CanSee( actor, useFOV != 0 ) ) {
364  idThread::ReturnEntity( actor );
365  return;
366  }
367  }
368  }
369 
371 }
372 
373 /*
374 =====================
375 idAI::Event_FindEnemyAI
376 =====================
377 */
378 void idAI::Event_FindEnemyAI( int useFOV ) {
379  idEntity *ent;
380  idActor *actor;
381  idActor *bestEnemy;
382  float bestDist;
383  float dist;
384  idVec3 delta;
385  pvsHandle_t pvs;
386 
388 
389  bestDist = idMath::INFINITY;
390  bestEnemy = NULL;
391  for ( ent = gameLocal.activeEntities.Next(); ent != NULL; ent = ent->activeNode.Next() ) {
392  if ( ent->fl.hidden || ent->fl.isDormant || !ent->IsType( idActor::Type ) ) {
393  continue;
394  }
395 
396  actor = static_cast<idActor *>( ent );
397  if ( ( actor->health <= 0 ) || !( ReactionTo( actor ) & ATTACK_ON_SIGHT ) ) {
398  continue;
399  }
400 
401  if ( !gameLocal.pvs.InCurrentPVS( pvs, actor->GetPVSAreas(), actor->GetNumPVSAreas() ) ) {
402  continue;
403  }
404 
405  delta = physicsObj.GetOrigin() - actor->GetPhysics()->GetOrigin();
406  dist = delta.LengthSqr();
407  if ( ( dist < bestDist ) && CanSee( actor, useFOV != 0 ) ) {
408  bestDist = dist;
409  bestEnemy = actor;
410  }
411  }
412 
414  idThread::ReturnEntity( bestEnemy );
415 }
416 
417 /*
418 =====================
419 idAI::Event_FindEnemyInCombatNodes
420 =====================
421 */
423  int i, j;
424  idCombatNode *node;
425  idEntity *ent;
426  idEntity *targetEnt;
427  idActor *actor;
428 
429  if ( !gameLocal.InPlayerPVS( this ) ) {
430  // don't locate the player when we're not in his PVS
432  return;
433  }
434 
435  for ( i = 0; i < gameLocal.numClients ; i++ ) {
436  ent = gameLocal.entities[ i ];
437 
438  if ( !ent || !ent->IsType( idActor::Type ) ) {
439  continue;
440  }
441 
442  actor = static_cast<idActor *>( ent );
443  if ( ( actor->health <= 0 ) || !( ReactionTo( actor ) & ATTACK_ON_SIGHT ) ) {
444  continue;
445  }
446 
447  for( j = 0; j < targets.Num(); j++ ) {
448  targetEnt = targets[ j ].GetEntity();
449  if ( !targetEnt || !targetEnt->IsType( idCombatNode::Type ) ) {
450  continue;
451  }
452 
453  node = static_cast<idCombatNode *>( targetEnt );
454  if ( !node->IsDisabled() && node->EntityInView( actor, actor->GetPhysics()->GetOrigin() ) ) {
455  idThread::ReturnEntity( actor );
456  return;
457  }
458  }
459  }
460 
462 }
463 
464 /*
465 =====================
466 idAI::Event_ClosestReachableEnemyOfEntity
467 =====================
468 */
470  idActor *actor;
471  idActor *ent;
472  idActor *bestEnt;
473  float bestDistSquared;
474  float distSquared;
475  idVec3 delta;
476  int areaNum;
477  int enemyAreaNum;
478  aasPath_t path;
479 
480  if ( !team_mate->IsType( idActor::Type ) ) {
481  gameLocal.Error( "Entity '%s' is not an AI character or player", team_mate->GetName() );
482  }
483 
484  actor = static_cast<idActor *>( team_mate );
485 
486  const idVec3 &origin = physicsObj.GetOrigin();
487  areaNum = PointReachableAreaNum( origin );
488 
489  bestDistSquared = idMath::INFINITY;
490  bestEnt = NULL;
491  for( ent = actor->enemyList.Next(); ent != NULL; ent = ent->enemyNode.Next() ) {
492  if ( ent->fl.hidden ) {
493  continue;
494  }
495  delta = ent->GetPhysics()->GetOrigin() - origin;
496  distSquared = delta.LengthSqr();
497  if ( distSquared < bestDistSquared ) {
498  const idVec3 &enemyPos = ent->GetPhysics()->GetOrigin();
499  enemyAreaNum = PointReachableAreaNum( enemyPos );
500  if ( ( areaNum != 0 ) && PathToGoal( path, areaNum, origin, enemyAreaNum, enemyPos ) ) {
501  bestEnt = ent;
502  bestDistSquared = distSquared;
503  }
504  }
505  }
506 
507  idThread::ReturnEntity( bestEnt );
508 }
509 
510 /*
511 =====================
512 idAI::Event_HeardSound
513 =====================
514 */
515 void idAI::Event_HeardSound( int ignore_team ) {
516  // check if we heard any sounds in the last frame
517  idActor *actor = gameLocal.GetAlertEntity();
518  if ( actor && ( !ignore_team || ( ReactionTo( actor ) & ATTACK_ON_SIGHT ) ) && gameLocal.InPlayerPVS( this ) ) {
519  idVec3 pos = actor->GetPhysics()->GetOrigin();
520  idVec3 org = physicsObj.GetOrigin();
521  float dist = ( pos - org ).LengthSqr();
522  if ( dist < Square( AI_HEARING_RANGE ) ) {
523  idThread::ReturnEntity( actor );
524  return;
525  }
526  }
527 
529 }
530 
531 /*
532 =====================
533 idAI::Event_SetEnemy
534 =====================
535 */
537  if ( !ent ) {
538  ClearEnemy();
539  } else if ( !ent->IsType( idActor::Type ) ) {
540  gameLocal.Error( "'%s' is not an idActor (player or ai controlled character)", ent->name.c_str() );
541  } else {
542  SetEnemy( static_cast<idActor *>( ent ) );
543  }
544 }
545 
546 /*
547 =====================
548 idAI::Event_ClearEnemy
549 =====================
550 */
552  ClearEnemy();
553 }
554 
555 /*
556 =====================
557 idAI::Event_MuzzleFlash
558 =====================
559 */
560 void idAI::Event_MuzzleFlash( const char *jointname ) {
561  idVec3 muzzle;
562  idMat3 axis;
563 
564  GetMuzzle( jointname, muzzle, axis );
565  TriggerWeaponEffects( muzzle );
566 }
567 
568 /*
569 =====================
570 idAI::Event_CreateMissile
571 =====================
572 */
573 void idAI::Event_CreateMissile( const char *jointname ) {
574  idVec3 muzzle;
575  idMat3 axis;
576 
577  if ( !projectileDef ) {
578  gameLocal.Warning( "%s (%s) doesn't have a projectile specified", name.c_str(), GetEntityDefName() );
579  return idThread::ReturnEntity( NULL );
580  }
581 
582  GetMuzzle( jointname, muzzle, axis );
584  if ( projectile.GetEntity() ) {
585  if ( !jointname || !jointname[ 0 ] ) {
586  projectile.GetEntity()->Bind( this, true );
587  } else {
588  projectile.GetEntity()->BindToJoint( this, jointname, true );
589  }
590  }
592 }
593 
594 /*
595 =====================
596 idAI::Event_AttackMissile
597 =====================
598 */
599 void idAI::Event_AttackMissile( const char *jointname ) {
600  idProjectile *proj;
601 
602  proj = LaunchProjectile( jointname, enemy.GetEntity(), true );
603  idThread::ReturnEntity( proj );
604 }
605 
606 /*
607 =====================
608 idAI::Event_FireMissileAtTarget
609 =====================
610 */
611 void idAI::Event_FireMissileAtTarget( const char *jointname, const char *targetname ) {
612  idEntity *aent;
613  idProjectile *proj;
614 
615  aent = gameLocal.FindEntity( targetname );
616  if ( !aent ) {
617  gameLocal.Warning( "Entity '%s' not found for 'fireMissileAtTarget'", targetname );
618  }
619 
620  proj = LaunchProjectile( jointname, aent, false );
621  idThread::ReturnEntity( proj );
622 }
623 
624 /*
625 =====================
626 idAI::Event_LaunchMissile
627 =====================
628 */
629 void idAI::Event_LaunchMissile( const idVec3 &org, const idAngles &ang ) {
630  idVec3 start;
631  trace_t tr;
632  idBounds projBounds;
633  const idClipModel *projClip;
634  idMat3 axis;
635  float distance;
636 
637  if ( !projectileDef ) {
638  gameLocal.Warning( "%s (%s) doesn't have a projectile specified", name.c_str(), GetEntityDefName() );
640  return;
641  }
642 
643  axis = ang.ToMat3();
644  if ( !projectile.GetEntity() ) {
645  CreateProjectile( org, axis[ 0 ] );
646  }
647 
648  // make sure the projectile starts inside the monster bounding box
649  const idBounds &ownerBounds = physicsObj.GetAbsBounds();
650  projClip = projectile.GetEntity()->GetPhysics()->GetClipModel();
651  projBounds = projClip->GetBounds().Rotate( projClip->GetAxis() );
652 
653  // check if the owner bounds is bigger than the projectile bounds
654  if ( ( ( ownerBounds[1][0] - ownerBounds[0][0] ) > ( projBounds[1][0] - projBounds[0][0] ) ) &&
655  ( ( ownerBounds[1][1] - ownerBounds[0][1] ) > ( projBounds[1][1] - projBounds[0][1] ) ) &&
656  ( ( ownerBounds[1][2] - ownerBounds[0][2] ) > ( projBounds[1][2] - projBounds[0][2] ) ) ) {
657  if ( (ownerBounds - projBounds).RayIntersection( org, viewAxis[ 0 ], distance ) ) {
658  start = org + distance * viewAxis[ 0 ];
659  } else {
660  start = ownerBounds.GetCenter();
661  }
662  } else {
663  // projectile bounds bigger than the owner bounds, so just start it from the center
664  start = ownerBounds.GetCenter();
665  }
666 
667  gameLocal.clip.Translation( tr, start, org, projClip, projClip->GetAxis(), MASK_SHOT_RENDERMODEL, this );
668 
669  // launch the projectile
671  projectile.GetEntity()->Launch( tr.endpos, axis[ 0 ], vec3_origin );
672  projectile = NULL;
673 
675 
677 }
678 
679 
680 #ifdef _D3XP
681 /*
682 =====================
683 idAI::Event_LaunchProjectile
684 =====================
685 */
686 void idAI::Event_LaunchProjectile( const char *entityDefName ) {
687  idVec3 muzzle, start, dir;
688  const idDict *projDef;
689  idMat3 axis;
690  const idClipModel *projClip;
691  idBounds projBounds;
692  trace_t tr;
693  idEntity *ent;
694  const char *clsname;
695  float distance;
696  idProjectile *proj = NULL;
697 
698  projDef = gameLocal.FindEntityDefDict( entityDefName );
699 
700  gameLocal.SpawnEntityDef( *projDef, &ent, false );
701  if ( !ent ) {
702  clsname = projectileDef->GetString( "classname" );
703  gameLocal.Error( "Could not spawn entityDef '%s'", clsname );
704  }
705 
706  if ( !ent->IsType( idProjectile::Type ) ) {
707  clsname = ent->GetClassname();
708  gameLocal.Error( "'%s' is not an idProjectile", clsname );
709  }
710  proj = ( idProjectile * )ent;
711 
712  GetMuzzle( "pistol", muzzle, axis );
713  proj->Create( this, muzzle, axis[0] );
714 
715  // make sure the projectile starts inside the monster bounding box
716  const idBounds &ownerBounds = physicsObj.GetAbsBounds();
717  projClip = proj->GetPhysics()->GetClipModel();
718  projBounds = projClip->GetBounds().Rotate( projClip->GetAxis() );
719  if ( (ownerBounds - projBounds).RayIntersection( muzzle, viewAxis[ 0 ], distance ) ) {
720  start = muzzle + distance * viewAxis[ 0 ];
721  } else {
722  start = ownerBounds.GetCenter();
723  }
724  gameLocal.clip.Translation( tr, start, muzzle, projClip, projClip->GetAxis(), MASK_SHOT_RENDERMODEL, this );
725  muzzle = tr.endpos;
726 
727  GetAimDir( muzzle, enemy.GetEntity(), this, dir );
728 
729  proj->Launch( muzzle, dir, vec3_origin );
730 
731  TriggerWeaponEffects( muzzle );
732 }
733 
734 #endif
735 
736 
737 /*
738 =====================
739 idAI::Event_AttackMelee
740 =====================
741 */
742 void idAI::Event_AttackMelee( const char *meleeDefName ) {
743  bool hit;
744 
745  hit = AttackMelee( meleeDefName );
746  idThread::ReturnInt( hit );
747 }
748 
749 /*
750 =====================
751 idAI::Event_DirectDamage
752 =====================
753 */
754 void idAI::Event_DirectDamage( idEntity *damageTarget, const char *damageDefName ) {
755  DirectDamage( damageDefName, damageTarget );
756 }
757 
758 /*
759 =====================
760 idAI::Event_RadiusDamageFromJoint
761 =====================
762 */
763 void idAI::Event_RadiusDamageFromJoint( const char *jointname, const char *damageDefName ) {
764  jointHandle_t joint;
765  idVec3 org;
766  idMat3 axis;
767 
768  if ( !jointname || !jointname[ 0 ] ) {
769  org = physicsObj.GetOrigin();
770  } else {
771  joint = animator.GetJointHandle( jointname );
772  if ( joint == INVALID_JOINT ) {
773  gameLocal.Error( "Unknown joint '%s' on %s", jointname, GetEntityDefName() );
774  }
775  GetJointWorldTransform( joint, gameLocal.time, org, axis );
776  }
777 
778  gameLocal.RadiusDamage( org, this, this, this, this, damageDefName );
779 }
780 
781 /*
782 =====================
783 idAI::Event_RandomPath
784 =====================
785 */
788 
789  path = idPathCorner::RandomPath( this, NULL );
790  idThread::ReturnEntity( path );
791 }
792 
793 /*
794 =====================
795 idAI::Event_BeginAttack
796 =====================
797 */
798 void idAI::Event_BeginAttack( const char *name ) {
799  BeginAttack( name );
800 }
801 
802 /*
803 =====================
804 idAI::Event_EndAttack
805 =====================
806 */
807 void idAI::Event_EndAttack( void ) {
808  EndAttack();
809 }
810 
811 /*
812 =====================
813 idAI::Event_MeleeAttackToJoint
814 =====================
815 */
816 void idAI::Event_MeleeAttackToJoint( const char *jointname, const char *meleeDefName ) {
817  jointHandle_t joint;
818  idVec3 start;
819  idVec3 end;
820  idMat3 axis;
821  trace_t trace;
822  idEntity *hitEnt;
823 
824  joint = animator.GetJointHandle( jointname );
825  if ( joint == INVALID_JOINT ) {
826  gameLocal.Error( "Unknown joint '%s' on %s", jointname, GetEntityDefName() );
827  }
828  animator.GetJointTransform( joint, gameLocal.time, end, axis );
830  start = GetEyePosition();
831 
832  if ( ai_debugMove.GetBool() ) {
834  }
835 
837  if ( trace.fraction < 1.0f ) {
838  hitEnt = gameLocal.GetTraceEntity( trace );
839  if ( hitEnt && hitEnt->IsType( idActor::Type ) ) {
840  DirectDamage( meleeDefName, hitEnt );
841  idThread::ReturnInt( true );
842  return;
843  }
844  }
845 
846  idThread::ReturnInt( false );
847 }
848 
849 /*
850 =====================
851 idAI::Event_CanBecomeSolid
852 =====================
853 */
855  int i;
856  int num;
857 #ifdef _D3XP
858  bool returnValue = true;
859 #endif
860  idEntity * hit;
861  idClipModel *cm;
862  idClipModel *clipModels[ MAX_GENTITIES ];
863 
865  for ( i = 0; i < num; i++ ) {
866  cm = clipModels[ i ];
867 
868  // don't check render entities
869  if ( cm->IsRenderModel() ) {
870  continue;
871  }
872 
873  hit = cm->GetEntity();
874  if ( ( hit == this ) || !hit->fl.takedamage ) {
875  continue;
876  }
877 
878 #ifdef _D3XP
879  if ( spawnClearMoveables && ( hit->IsType( idMoveable::Type ) || hit->IsType( idBarrel::Type ) || hit->IsType( idExplodingBarrel::Type ) ) ) {
880  idVec3 push;
881  push = hit->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
882  push.z = 30.f;
883  push.NormalizeFast();
884  if ( (idMath::Fabs(push.x) < 0.15f) && (idMath::Fabs(push.y) < 0.15f) ) {
885  push.x = 10.f; push.y = 10.f; push.z = 15.f;
886  push.NormalizeFast();
887  }
888  push *= 300.f;
889  hit->GetPhysics()->SetLinearVelocity( push );
890  }
891 #endif
892 
893  if ( physicsObj.ClipContents( cm ) ) {
894 #ifdef _D3XP
895  returnValue = false;
896 #else
897  idThread::ReturnFloat( false );
898  return;
899 #endif
900  }
901  }
902 
903 #ifdef _D3XP
904  idThread::ReturnFloat( returnValue );
905 #else
906  idThread::ReturnFloat( true );
907 #endif
908 }
909 
910 /*
911 =====================
912 idAI::Event_BecomeSolid
913 =====================
914 */
917  if ( spawnArgs.GetBool( "big_monster" ) ) {
918  physicsObj.SetContents( 0 );
919  } else if ( use_combat_bbox ) {
921  } else {
923  }
925  fl.takedamage = !spawnArgs.GetBool( "noDamage" );
926 }
927 
928 /*
929 =====================
930 idAI::Event_BecomeNonSolid
931 =====================
932 */
934  fl.takedamage = false;
935  physicsObj.SetContents( 0 );
937 }
938 
939 /*
940 =====================
941 idAI::Event_BecomeRagdoll
942 =====================
943 */
945  bool result;
946 
947  result = StartRagdoll();
948  idThread::ReturnInt( result );
949 }
950 
951 /*
952 =====================
953 idAI::Event_StopRagdoll
954 =====================
955 */
957  StopRagdoll();
958 
959  // set back the monster physics
961 }
962 
963 /*
964 =====================
965 idAI::Event_SetHealth
966 =====================
967 */
968 void idAI::Event_SetHealth( float newHealth ) {
969  health = newHealth;
970  fl.takedamage = true;
971  if ( health > 0 ) {
972  AI_DEAD = false;
973  } else {
974  AI_DEAD = true;
975  }
976 }
977 
978 /*
979 =====================
980 idAI::Event_GetHealth
981 =====================
982 */
983 void idAI::Event_GetHealth( void ) {
985 }
986 
987 /*
988 =====================
989 idAI::Event_AllowDamage
990 =====================
991 */
993  fl.takedamage = true;
994 }
995 
996 /*
997 =====================
998 idAI::Event_IgnoreDamage
999 =====================
1000 */
1002  fl.takedamage = false;
1003 }
1004 
1005 /*
1006 =====================
1007 idAI::Event_GetCurrentYaw
1008 =====================
1009 */
1012 }
1013 
1014 /*
1015 =====================
1016 idAI::Event_TurnTo
1017 =====================
1018 */
1019 void idAI::Event_TurnTo( float angle ) {
1020  TurnToward( angle );
1021 }
1022 
1023 /*
1024 =====================
1025 idAI::Event_TurnToPos
1026 =====================
1027 */
1028 void idAI::Event_TurnToPos( const idVec3 &pos ) {
1029  TurnToward( pos );
1030 }
1031 
1032 /*
1033 =====================
1034 idAI::Event_TurnToEntity
1035 =====================
1036 */
1038  if ( ent ) {
1039  TurnToward( ent->GetPhysics()->GetOrigin() );
1040  }
1041 }
1042 
1043 /*
1044 =====================
1045 idAI::Event_MoveStatus
1046 =====================
1047 */
1050 }
1051 
1052 /*
1053 =====================
1054 idAI::Event_StopMove
1055 =====================
1056 */
1057 void idAI::Event_StopMove( void ) {
1059 }
1060 
1061 /*
1062 =====================
1063 idAI::Event_MoveToCover
1064 =====================
1065 */
1067  idActor *enemyEnt = enemy.GetEntity();
1068 
1070  if ( !enemyEnt || !MoveToCover( enemyEnt, lastVisibleEnemyPos ) ) {
1071  return;
1072  }
1073 }
1074 
1075 /*
1076 =====================
1077 idAI::Event_MoveToEnemy
1078 =====================
1079 */
1082  if ( !enemy.GetEntity() || !MoveToEnemy() ) {
1083  return;
1084  }
1085 }
1086 
1087 /*
1088 =====================
1089 idAI::Event_MoveToEnemyHeight
1090 =====================
1091 */
1095 }
1096 
1097 /*
1098 =====================
1099 idAI::Event_MoveOutOfRange
1100 =====================
1101 */
1104  MoveOutOfRange( entity, range );
1105 }
1106 
1107 /*
1108 =====================
1109 idAI::Event_MoveToAttackPosition
1110 =====================
1111 */
1112 void idAI::Event_MoveToAttackPosition( idEntity *entity, const char *attack_anim ) {
1113  int anim;
1114 
1116 
1117  anim = GetAnim( ANIMCHANNEL_LEGS, attack_anim );
1118  if ( !anim ) {
1119  gameLocal.Error( "Unknown anim '%s'", attack_anim );
1120  }
1121 
1122  MoveToAttackPosition( entity, anim );
1123 }
1124 
1125 /*
1126 =====================
1127 idAI::Event_MoveToEntity
1128 =====================
1129 */
1132  if ( ent ) {
1133  MoveToEntity( ent );
1134  }
1135 }
1136 
1137 /*
1138 =====================
1139 idAI::Event_MoveToPosition
1140 =====================
1141 */
1144  MoveToPosition( pos );
1145 }
1146 
1147 /*
1148 =====================
1149 idAI::Event_SlideTo
1150 =====================
1151 */
1152 void idAI::Event_SlideTo( const idVec3 &pos, float time ) {
1153  SlideToPosition( pos, time );
1154 }
1155 /*
1156 =====================
1157 idAI::Event_Wander
1158 =====================
1159 */
1160 void idAI::Event_Wander( void ) {
1161  WanderAround();
1162 }
1163 
1164 /*
1165 =====================
1166 idAI::Event_FacingIdeal
1167 =====================
1168 */
1170  bool facing = FacingIdeal();
1171  idThread::ReturnInt( facing );
1172 }
1173 
1174 /*
1175 =====================
1176 idAI::Event_FaceEnemy
1177 =====================
1178 */
1180  FaceEnemy();
1181 }
1182 
1183 /*
1184 =====================
1185 idAI::Event_FaceEntity
1186 =====================
1187 */
1189  FaceEntity( ent );
1190 }
1191 
1192 /*
1193 =====================
1194 idAI::Event_WaitAction
1195 =====================
1196 */
1197 void idAI::Event_WaitAction( const char *waitForState ) {
1198  if ( idThread::BeginMultiFrameEvent( this, &AI_WaitAction ) ) {
1199  SetWaitState( waitForState );
1200  }
1201 
1202  if ( !WaitState() ) {
1203  idThread::EndMultiFrameEvent( this, &AI_WaitAction );
1204  }
1205 }
1206 
1207 /*
1208 =====================
1209 idAI::Event_GetCombatNode
1210 =====================
1211 */
1213  int i;
1214  float dist;
1215  idEntity *targetEnt;
1216  idCombatNode *node;
1217  float bestDist;
1218  idCombatNode *bestNode;
1219  idActor *enemyEnt = enemy.GetEntity();
1220 
1221  if ( !targets.Num() ) {
1222  // no combat nodes
1224  return;
1225  }
1226 
1227  if ( !enemyEnt || !EnemyPositionValid() ) {
1228  // don't return a combat node if we don't have an enemy or
1229  // if we can see he's not in the last place we saw him
1230 
1231 #ifdef _D3XP
1232  if ( team == 0 ) {
1233  // find the closest attack node to the player
1234  bestNode = NULL;
1235  const idVec3 &myPos = physicsObj.GetOrigin();
1236  const idVec3 &playerPos = gameLocal.GetLocalPlayer()->GetPhysics()->GetOrigin();
1237 
1238  bestDist = ( myPos - playerPos ).LengthSqr();
1239 
1240  for( i = 0; i < targets.Num(); i++ ) {
1241  targetEnt = targets[ i ].GetEntity();
1242  if ( !targetEnt || !targetEnt->IsType( idCombatNode::Type ) ) {
1243  continue;
1244  }
1245 
1246  node = static_cast<idCombatNode *>( targetEnt );
1247  if ( !node->IsDisabled() ) {
1248  idVec3 org = node->GetPhysics()->GetOrigin();
1249  dist = ( playerPos - org ).LengthSqr();
1250  if ( dist < bestDist ) {
1251  bestNode = node;
1252  bestDist = dist;
1253  }
1254  }
1255  }
1256 
1257  idThread::ReturnEntity( bestNode );
1258  return;
1259  }
1260 #endif
1261 
1263  return;
1264  }
1265 
1266  // find the closest attack node that can see our enemy and is closer than our enemy
1267  bestNode = NULL;
1268  const idVec3 &myPos = physicsObj.GetOrigin();
1269  bestDist = ( myPos - lastVisibleEnemyPos ).LengthSqr();
1270  for( i = 0; i < targets.Num(); i++ ) {
1271  targetEnt = targets[ i ].GetEntity();
1272  if ( !targetEnt || !targetEnt->IsType( idCombatNode::Type ) ) {
1273  continue;
1274  }
1275 
1276  node = static_cast<idCombatNode *>( targetEnt );
1277  if ( !node->IsDisabled() && node->EntityInView( enemyEnt, lastVisibleEnemyPos ) ) {
1278  idVec3 org = node->GetPhysics()->GetOrigin();
1279  dist = ( myPos - org ).LengthSqr();
1280  if ( dist < bestDist ) {
1281  bestNode = node;
1282  bestDist = dist;
1283  }
1284  }
1285  }
1286 
1287  idThread::ReturnEntity( bestNode );
1288 }
1289 
1290 /*
1291 =====================
1292 idAI::Event_EnemyInCombatCone
1293 =====================
1294 */
1295 void idAI::Event_EnemyInCombatCone( idEntity *ent, int use_current_enemy_location ) {
1296  idCombatNode *node;
1297  bool result;
1298  idActor *enemyEnt = enemy.GetEntity();
1299 
1300  if ( !targets.Num() ) {
1301  // no combat nodes
1302  idThread::ReturnInt( false );
1303  return;
1304  }
1305 
1306  if ( !enemyEnt ) {
1307  // have to have an enemy
1308  idThread::ReturnInt( false );
1309  return;
1310  }
1311 
1312  if ( !ent || !ent->IsType( idCombatNode::Type ) ) {
1313  // not a combat node
1314  idThread::ReturnInt( false );
1315  return;
1316  }
1317 
1318 #ifdef _D3XP
1319  //Allow the level designers define attack nodes that the enemy should never leave.
1320  //This is different that the turrent type combat nodes because they can play an animation
1321  if(ent->spawnArgs.GetBool("neverLeave", "0")) {
1322  idThread::ReturnInt( true );
1323  return;
1324  }
1325 #endif
1326 
1327  node = static_cast<idCombatNode *>( ent );
1328  if ( use_current_enemy_location ) {
1329  const idVec3 &pos = enemyEnt->GetPhysics()->GetOrigin();
1330  result = node->EntityInView( enemyEnt, pos );
1331  } else {
1332  result = node->EntityInView( enemyEnt, lastVisibleEnemyPos );
1333  }
1334 
1335  idThread::ReturnInt( result );
1336 }
1337 
1338 /*
1339 =====================
1340 idAI::Event_WaitMove
1341 =====================
1342 */
1343 void idAI::Event_WaitMove( void ) {
1344  idThread::BeginMultiFrameEvent( this, &AI_WaitMove );
1345 
1346  if ( MoveDone() ) {
1347  idThread::EndMultiFrameEvent( this, &AI_WaitMove );
1348  }
1349 }
1350 
1351 /*
1352 =====================
1353 idAI::Event_GetJumpVelocity
1354 =====================
1355 */
1356 void idAI::Event_GetJumpVelocity( const idVec3 &pos, float speed, float max_height ) {
1357  idVec3 start;
1358  idVec3 end;
1359  idVec3 dir;
1360  float dist;
1361  bool result;
1362  idEntity *enemyEnt = enemy.GetEntity();
1363 
1364  if ( !enemyEnt ) {
1366  return;
1367  }
1368 
1369  if ( speed <= 0.0f ) {
1370  gameLocal.Error( "Invalid speed. speed must be > 0." );
1371  }
1372 
1373  start = physicsObj.GetOrigin();
1374  end = pos;
1375  dir = end - start;
1376  dist = dir.Normalize();
1377  if ( dist > 16.0f ) {
1378  dist -= 16.0f;
1379  end -= dir * 16.0f;
1380  }
1381 
1382  result = PredictTrajectory( start, end, speed, physicsObj.GetGravity(), physicsObj.GetClipModel(), MASK_MONSTERSOLID, max_height, this, enemyEnt, ai_debugMove.GetBool() ? 4000 : 0, dir );
1383  if ( result ) {
1384  idThread::ReturnVector( dir * speed );
1385  } else {
1387  }
1388 }
1389 
1390 /*
1391 =====================
1392 idAI::Event_EntityInAttackCone
1393 =====================
1394 */
1396  float attack_cone;
1397  idVec3 delta;
1398  float yaw;
1399  float relYaw;
1400 
1401  if ( !ent ) {
1402  idThread::ReturnInt( false );
1403  return;
1404  }
1405 
1406  delta = ent->GetPhysics()->GetOrigin() - GetEyePosition();
1407 
1408  // get our gravity normal
1409  const idVec3 &gravityDir = GetPhysics()->GetGravityNormal();
1410 
1411  // infinite vertical vision, so project it onto our orientation plane
1412  delta -= gravityDir * ( gravityDir * delta );
1413 
1414  delta.Normalize();
1415  yaw = delta.ToYaw();
1416 
1417  attack_cone = spawnArgs.GetFloat( "attack_cone", "70" );
1418  relYaw = idMath::AngleNormalize180( ideal_yaw - yaw );
1419  if ( idMath::Fabs( relYaw ) < ( attack_cone * 0.5f ) ) {
1420  idThread::ReturnInt( true );
1421  } else {
1422  idThread::ReturnInt( false );
1423  }
1424 }
1425 
1426 /*
1427 =====================
1428 idAI::Event_CanSeeEntity
1429 =====================
1430 */
1432  if ( !ent ) {
1433  idThread::ReturnInt( false );
1434  return;
1435  }
1436 
1437  bool cansee = CanSee( ent, false );
1438  idThread::ReturnInt( cansee );
1439 }
1440 
1441 /*
1442 =====================
1443 idAI::Event_SetTalkTarget
1444 =====================
1445 */
1447  if ( target && !target->IsType( idActor::Type ) ) {
1448  gameLocal.Error( "Cannot set talk target to '%s'. Not a character or player.", target->GetName() );
1449  }
1450  talkTarget = static_cast<idActor *>( target );
1451  if ( target ) {
1452  AI_TALK = true;
1453  } else {
1454  AI_TALK = false;
1455  }
1456 }
1457 
1458 /*
1459 =====================
1460 idAI::Event_GetTalkTarget
1461 =====================
1462 */
1465 }
1466 
1467 /*
1468 ================
1469 idAI::Event_SetTalkState
1470 ================
1471 */
1472 void idAI::Event_SetTalkState( int state ) {
1473  if ( ( state < 0 ) || ( state >= NUM_TALK_STATES ) ) {
1474  gameLocal.Error( "Invalid talk state (%d)", state );
1475  }
1476 
1477  talk_state = static_cast<talkState_t>( state );
1478 }
1479 
1480 /*
1481 =====================
1482 idAI::Event_EnemyRange
1483 =====================
1484 */
1486  float dist;
1487  idActor *enemyEnt = enemy.GetEntity();
1488 
1489  if ( enemyEnt ) {
1490  dist = ( enemyEnt->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin() ).Length();
1491  } else {
1492  // Just some really high number
1493  dist = idMath::INFINITY;
1494  }
1495 
1496  idThread::ReturnFloat( dist );
1497 }
1498 
1499 /*
1500 =====================
1501 idAI::Event_EnemyRange2D
1502 =====================
1503 */
1505  float dist;
1506  idActor *enemyEnt = enemy.GetEntity();
1507 
1508  if ( enemyEnt ) {
1509  dist = ( enemyEnt->GetPhysics()->GetOrigin().ToVec2() - GetPhysics()->GetOrigin().ToVec2() ).Length();
1510  } else {
1511  // Just some really high number
1512  dist = idMath::INFINITY;
1513  }
1514 
1515  idThread::ReturnFloat( dist );
1516 }
1517 
1518 /*
1519 =====================
1520 idAI::Event_GetEnemy
1521 =====================
1522 */
1523 void idAI::Event_GetEnemy( void ) {
1525 }
1526 
1527 /*
1528 =====================
1529 idAI::Event_GetEnemyPos
1530 =====================
1531 */
1534 }
1535 
1536 /*
1537 =====================
1538 idAI::Event_GetEnemyEyePos
1539 =====================
1540 */
1543 }
1544 
1545 /*
1546 =====================
1547 idAI::Event_PredictEnemyPos
1548 =====================
1549 */
1550 void idAI::Event_PredictEnemyPos( float time ) {
1552  idActor *enemyEnt = enemy.GetEntity();
1553 
1554  // if no enemy set
1555  if ( !enemyEnt ) {
1557  return;
1558  }
1559 
1560  // predict the enemy movement
1562 
1564 }
1565 
1566 /*
1567 =====================
1568 idAI::Event_CanHitEnemy
1569 =====================
1570 */
1572  trace_t tr;
1573  idEntity *hit;
1574 
1575  idActor *enemyEnt = enemy.GetEntity();
1576  if ( !AI_ENEMY_VISIBLE || !enemyEnt ) {
1577  idThread::ReturnInt( false );
1578  return;
1579  }
1580 
1581  // don't check twice per frame
1582  if ( gameLocal.time == lastHitCheckTime ) {
1584  return;
1585  }
1586 
1588 
1589  idVec3 toPos = enemyEnt->GetEyePosition();
1590  idVec3 eye = GetEyePosition();
1591  idVec3 dir;
1592 
1593  // expand the ray out as far as possible so we can detect anything behind the enemy
1594  dir = toPos - eye;
1595  dir.Normalize();
1596  toPos = eye + dir * MAX_WORLD_SIZE;
1597  gameLocal.clip.TracePoint( tr, eye, toPos, MASK_SHOT_BOUNDINGBOX, this );
1598  hit = gameLocal.GetTraceEntity( tr );
1599  if ( tr.fraction >= 1.0f || ( hit == enemyEnt ) ) {
1600  lastHitCheckResult = true;
1601  } else if ( ( tr.fraction < 1.0f ) && ( hit->IsType( idAI::Type ) ) &&
1602  ( static_cast<idAI *>( hit )->team != team ) ) {
1603  lastHitCheckResult = true;
1604  } else {
1605  lastHitCheckResult = false;
1606  }
1607 
1609 }
1610 
1611 /*
1612 =====================
1613 idAI::Event_CanHitEnemyFromAnim
1614 =====================
1615 */
1616 void idAI::Event_CanHitEnemyFromAnim( const char *animname ) {
1617  int anim;
1618  idVec3 dir;
1619  idVec3 local_dir;
1620  idVec3 fromPos;
1621  idMat3 axis;
1622  idVec3 start;
1623  trace_t tr;
1624  float distance;
1625 
1626  idActor *enemyEnt = enemy.GetEntity();
1627  if ( !AI_ENEMY_VISIBLE || !enemyEnt ) {
1628  idThread::ReturnInt( false );
1629  return;
1630  }
1631 
1632  anim = GetAnim( ANIMCHANNEL_LEGS, animname );
1633  if ( !anim ) {
1634  idThread::ReturnInt( false );
1635  return;
1636  }
1637 
1638  // just do a ray test if close enough
1639  if ( enemyEnt->GetPhysics()->GetAbsBounds().IntersectsBounds( physicsObj.GetAbsBounds().Expand( 16.0f ) ) ) {
1641  return;
1642  }
1643 
1644  // calculate the world transform of the launch position
1645  const idVec3 &org = physicsObj.GetOrigin();
1646  dir = lastVisibleEnemyPos - org;
1647  physicsObj.GetGravityAxis().ProjectVector( dir, local_dir );
1648  local_dir.z = 0.0f;
1649  local_dir.ToVec2().Normalize();
1650  axis = local_dir.ToMat3();
1651  fromPos = physicsObj.GetOrigin() + missileLaunchOffset[ anim ] * axis;
1652 
1653  if ( projectileClipModel == NULL ) {
1655  }
1656 
1657  // check if the owner bounds is bigger than the projectile bounds
1658  const idBounds &ownerBounds = physicsObj.GetAbsBounds();
1659  const idBounds &projBounds = projectileClipModel->GetBounds();
1660  if ( ( ( ownerBounds[1][0] - ownerBounds[0][0] ) > ( projBounds[1][0] - projBounds[0][0] ) ) &&
1661  ( ( ownerBounds[1][1] - ownerBounds[0][1] ) > ( projBounds[1][1] - projBounds[0][1] ) ) &&
1662  ( ( ownerBounds[1][2] - ownerBounds[0][2] ) > ( projBounds[1][2] - projBounds[0][2] ) ) ) {
1663  if ( (ownerBounds - projBounds).RayIntersection( org, viewAxis[ 0 ], distance ) ) {
1664  start = org + distance * viewAxis[ 0 ];
1665  } else {
1666  start = ownerBounds.GetCenter();
1667  }
1668  } else {
1669  // projectile bounds bigger than the owner bounds, so just start it from the center
1670  start = ownerBounds.GetCenter();
1671  }
1672 
1674  fromPos = tr.endpos;
1675 
1676  if ( GetAimDir( fromPos, enemy.GetEntity(), this, dir ) ) {
1677  idThread::ReturnInt( true );
1678  } else {
1679  idThread::ReturnInt( false );
1680  }
1681 }
1682 
1683 /*
1684 =====================
1685 idAI::Event_CanHitEnemyFromJoint
1686 =====================
1687 */
1688 void idAI::Event_CanHitEnemyFromJoint( const char *jointname ) {
1689  trace_t tr;
1690  idVec3 muzzle;
1691  idMat3 axis;
1692  idVec3 start;
1693  float distance;
1694 
1695  idActor *enemyEnt = enemy.GetEntity();
1696  if ( !AI_ENEMY_VISIBLE || !enemyEnt ) {
1697  idThread::ReturnInt( false );
1698  return;
1699  }
1700 
1701  // don't check twice per frame
1702  if ( gameLocal.time == lastHitCheckTime ) {
1704  return;
1705  }
1706 
1708 
1709  const idVec3 &org = physicsObj.GetOrigin();
1710  idVec3 toPos = enemyEnt->GetEyePosition();
1711  jointHandle_t joint = animator.GetJointHandle( jointname );
1712  if ( joint == INVALID_JOINT ) {
1713  gameLocal.Error( "Unknown joint '%s' on %s", jointname, GetEntityDefName() );
1714  }
1715  animator.GetJointTransform( joint, gameLocal.time, muzzle, axis );
1716  muzzle = org + ( muzzle + modelOffset ) * viewAxis * physicsObj.GetGravityAxis();
1717 
1718  if ( projectileClipModel == NULL ) {
1720  }
1721 
1722  // check if the owner bounds is bigger than the projectile bounds
1723  const idBounds &ownerBounds = physicsObj.GetAbsBounds();
1724  const idBounds &projBounds = projectileClipModel->GetBounds();
1725  if ( ( ( ownerBounds[1][0] - ownerBounds[0][0] ) > ( projBounds[1][0] - projBounds[0][0] ) ) &&
1726  ( ( ownerBounds[1][1] - ownerBounds[0][1] ) > ( projBounds[1][1] - projBounds[0][1] ) ) &&
1727  ( ( ownerBounds[1][2] - ownerBounds[0][2] ) > ( projBounds[1][2] - projBounds[0][2] ) ) ) {
1728  if ( (ownerBounds - projBounds).RayIntersection( org, viewAxis[ 0 ], distance ) ) {
1729  start = org + distance * viewAxis[ 0 ];
1730  } else {
1731  start = ownerBounds.GetCenter();
1732  }
1733  } else {
1734  // projectile bounds bigger than the owner bounds, so just start it from the center
1735  start = ownerBounds.GetCenter();
1736  }
1737 
1739  muzzle = tr.endpos;
1740 
1742  if ( tr.fraction >= 1.0f || ( gameLocal.GetTraceEntity( tr ) == enemyEnt ) ) {
1743  lastHitCheckResult = true;
1744  } else {
1745  lastHitCheckResult = false;
1746  }
1747 
1749 }
1750 
1751 /*
1752 =====================
1753 idAI::Event_EnemyPositionValid
1754 =====================
1755 */
1757  bool result;
1758 
1759  result = EnemyPositionValid();
1760  idThread::ReturnInt( result );
1761 }
1762 
1763 /*
1764 =====================
1765 idAI::Event_ChargeAttack
1766 =====================
1767 */
1768 void idAI::Event_ChargeAttack( const char *damageDef ) {
1769  idActor *enemyEnt = enemy.GetEntity();
1770 
1772  if ( enemyEnt ) {
1773  idVec3 enemyOrg;
1774 
1775  if ( move.moveType == MOVETYPE_FLY ) {
1776  // position destination so that we're in the enemy's view
1777  enemyOrg = enemyEnt->GetEyePosition();
1778  enemyOrg -= enemyEnt->GetPhysics()->GetGravityNormal() * fly_offset;
1779  } else {
1780  enemyOrg = enemyEnt->GetPhysics()->GetOrigin();
1781  }
1782 
1783  BeginAttack( damageDef );
1784  DirectMoveToPosition( enemyOrg );
1785  TurnToward( enemyOrg );
1786  }
1787 }
1788 
1789 /*
1790 =====================
1791 idAI::Event_TestChargeAttack
1792 =====================
1793 */
1795  trace_t trace;
1796  idActor *enemyEnt = enemy.GetEntity();
1798  idVec3 end;
1799 
1800  if ( !enemyEnt ) {
1801  idThread::ReturnFloat( 0.0f );
1802  return;
1803  }
1804 
1805  if ( move.moveType == MOVETYPE_FLY ) {
1806  // position destination so that we're in the enemy's view
1807  end = enemyEnt->GetEyePosition();
1808  end -= enemyEnt->GetPhysics()->GetGravityNormal() * fly_offset;
1809  } else {
1810  end = enemyEnt->GetPhysics()->GetOrigin();
1811  }
1812 
1814 
1815  if ( ai_debugMove.GetBool() ) {
1818  }
1819 
1820  if ( ( path.endEvent == 0 ) || ( path.blockingEntity == enemyEnt ) ) {
1821  idVec3 delta = end - physicsObj.GetOrigin();
1822  float time = delta.LengthFast();
1823  idThread::ReturnFloat( time );
1824  } else {
1825  idThread::ReturnFloat( 0.0f );
1826  }
1827 }
1828 
1829 /*
1830 =====================
1831 idAI::Event_TestAnimMoveTowardEnemy
1832 =====================
1833 */
1834 void idAI::Event_TestAnimMoveTowardEnemy( const char *animname ) {
1835  int anim;
1837  idVec3 moveVec;
1838  float yaw;
1839  idVec3 delta;
1840  idActor *enemyEnt;
1841 
1842  enemyEnt = enemy.GetEntity();
1843  if ( !enemyEnt ) {
1844  idThread::ReturnInt( false );
1845  return;
1846  }
1847 
1848  anim = GetAnim( ANIMCHANNEL_LEGS, animname );
1849  if ( !anim ) {
1850  gameLocal.DWarning( "missing '%s' animation on '%s' (%s)", animname, name.c_str(), GetEntityDefName() );
1851  idThread::ReturnInt( false );
1852  return;
1853  }
1854 
1855  delta = enemyEnt->GetPhysics()->GetOrigin() - physicsObj.GetOrigin();
1856  yaw = delta.ToYaw();
1857 
1858  moveVec = animator.TotalMovementDelta( anim ) * idAngles( 0.0f, yaw, 0.0f ).ToMat3() * physicsObj.GetGravityAxis();
1860 
1861  if ( ai_debugMove.GetBool() ) {
1864  }
1865 
1866  idThread::ReturnInt( path.endEvent == 0 );
1867 }
1868 
1869 /*
1870 =====================
1871 idAI::Event_TestAnimMove
1872 =====================
1873 */
1874 void idAI::Event_TestAnimMove( const char *animname ) {
1875  int anim;
1877  idVec3 moveVec;
1878 
1879  anim = GetAnim( ANIMCHANNEL_LEGS, animname );
1880  if ( !anim ) {
1881  gameLocal.DWarning( "missing '%s' animation on '%s' (%s)", animname, name.c_str(), GetEntityDefName() );
1882  idThread::ReturnInt( false );
1883  return;
1884  }
1885 
1886  moveVec = animator.TotalMovementDelta( anim ) * idAngles( 0.0f, ideal_yaw, 0.0f ).ToMat3() * physicsObj.GetGravityAxis();
1888 
1889  if ( ai_debugMove.GetBool() ) {
1892  }
1893 
1894  idThread::ReturnInt( path.endEvent == 0 );
1895 }
1896 
1897 /*
1898 =====================
1899 idAI::Event_TestMoveToPosition
1900 =====================
1901 */
1902 void idAI::Event_TestMoveToPosition( const idVec3 &position ) {
1904 
1906 
1907  if ( ai_debugMove.GetBool() ) {
1910  if ( path.endEvent ) {
1912  }
1913  }
1914 
1915  idThread::ReturnInt( path.endEvent == 0 );
1916 }
1917 
1918 /*
1919 =====================
1920 idAI::Event_TestMeleeAttack
1921 =====================
1922 */
1924  bool result = TestMelee();
1925  idThread::ReturnInt( result );
1926 }
1927 
1928 /*
1929 =====================
1930 idAI::Event_TestAnimAttack
1931 =====================
1932 */
1933 void idAI::Event_TestAnimAttack( const char *animname ) {
1934  int anim;
1936 
1937  anim = GetAnim( ANIMCHANNEL_LEGS, animname );
1938  if ( !anim ) {
1939  gameLocal.DWarning( "missing '%s' animation on '%s' (%s)", animname, name.c_str(), GetEntityDefName() );
1940  idThread::ReturnInt( false );
1941  return;
1942  }
1943 
1945 
1947 }
1948 
1949 /*
1950 =====================
1951 idAI::Event_Shrivel
1952 =====================
1953 */
1954 void idAI::Event_Shrivel( float shrivel_time ) {
1955  float t;
1956 
1957  if ( idThread::BeginMultiFrameEvent( this, &AI_Shrivel ) ) {
1958  if ( shrivel_time <= 0.0f ) {
1959  idThread::EndMultiFrameEvent( this, &AI_Shrivel );
1960  return;
1961  }
1962 
1963  shrivel_rate = 0.001f / shrivel_time;
1965  }
1966 
1968  if ( t > 0.25f ) {
1969  renderEntity.noShadow = true;
1970  }
1971  if ( t > 1.0f ) {
1972  t = 1.0f;
1973  idThread::EndMultiFrameEvent( this, &AI_Shrivel );
1974  }
1975 
1976  renderEntity.shaderParms[ SHADERPARM_MD5_SKINSCALE ] = 1.0f - t * 0.5f;
1977  UpdateVisuals();
1978 }
1979 
1980 /*
1981 =====================
1982 idAI::Event_PreBurn
1983 =====================
1984 */
1985 void idAI::Event_PreBurn( void ) {
1986 #ifdef _D3XP
1987  // No grabbing after the burn has started!
1988  noGrab = true;
1989 #endif
1990 
1991  // for now this just turns shadows off
1992  renderEntity.noShadow = true;
1993 }
1994 
1995 /*
1996 =====================
1997 idAI::Event_Burn
1998 =====================
1999 */
2000 void idAI::Event_Burn( void ) {
2002  SpawnParticles( "smoke_burnParticleSystem" );
2003  UpdateVisuals();
2004 }
2005 
2006 /*
2007 =====================
2008 idAI::Event_ClearBurn
2009 =====================
2010 */
2012  renderEntity.noShadow = spawnArgs.GetBool( "noshadows" );
2014  UpdateVisuals();
2015 }
2016 
2017 /*
2018 =====================
2019 idAI::Event_SetSmokeVisibility
2020 =====================
2021 */
2023  int i;
2024  int time;
2025 
2026  if ( num >= particles.Num() ) {
2027  gameLocal.Warning( "Particle #%d out of range (%d particles) on entity '%s'", num, particles.Num(), name.c_str() );
2028  return;
2029  }
2030 
2031  if ( on != 0 ) {
2032  time = gameLocal.time;
2034  } else {
2035  time = 0;
2036  }
2037 
2038  if ( num >= 0 ) {
2039  particles[ num ].time = time;
2040  } else {
2041  for ( i = 0; i < particles.Num(); i++ ) {
2042  particles[ i ].time = time;
2043  }
2044  }
2045 
2046  UpdateVisuals();
2047 }
2048 
2049 /*
2050 =====================
2051 idAI::Event_NumSmokeEmitters
2052 =====================
2053 */
2055  idThread::ReturnInt( particles.Num() );
2056 }
2057 
2058 /*
2059 =====================
2060 idAI::Event_StopThinking
2061 =====================
2062 */
2065  idThread *thread = idThread::CurrentThread();
2066  if ( thread ) {
2067  thread->DoneProcessing();
2068  }
2069 }
2070 
2071 /*
2072 =====================
2073 idAI::Event_GetTurnDelta
2074 =====================
2075 */
2077  float amount;
2078 
2079  if ( turnRate ) {
2081  idThread::ReturnFloat( amount );
2082  } else {
2083  idThread::ReturnFloat( 0.0f );
2084  }
2085 }
2086 
2087 /*
2088 =====================
2089 idAI::Event_GetMoveType
2090 =====================
2091 */
2094 }
2095 
2096 /*
2097 =====================
2098 idAI::Event_SetMoveTypes
2099 =====================
2100 */
2101 void idAI::Event_SetMoveType( int moveType ) {
2102  if ( ( moveType < 0 ) || ( moveType >= NUM_MOVETYPES ) ) {
2103  gameLocal.Error( "Invalid movetype %d", moveType );
2104  }
2105 
2106  move.moveType = static_cast<moveType_t>( moveType );
2107  if ( move.moveType == MOVETYPE_FLY ) {
2109  } else {
2111  }
2112 }
2113 
2114 /*
2115 =====================
2116 idAI::Event_SaveMove
2117 =====================
2118 */
2119 void idAI::Event_SaveMove( void ) {
2120  savedMove = move;
2121 }
2122 
2123 /*
2124 =====================
2125 idAI::Event_RestoreMove
2126 =====================
2127 */
2129  idVec3 goalPos;
2130  idVec3 dest;
2131 
2132  switch( savedMove.moveCommand ) {
2133  case MOVE_NONE :
2135  break;
2136 
2137  case MOVE_FACE_ENEMY :
2138  FaceEnemy();
2139  break;
2140 
2141  case MOVE_FACE_ENTITY :
2143  break;
2144 
2145  case MOVE_TO_ENEMY :
2146  MoveToEnemy();
2147  break;
2148 
2149  case MOVE_TO_ENEMYHEIGHT :
2151  break;
2152 
2153  case MOVE_TO_ENTITY :
2155  break;
2156 
2157  case MOVE_OUT_OF_RANGE :
2159  break;
2160 
2163  break;
2164 
2165  case MOVE_TO_COVER :
2167  break;
2168 
2169  case MOVE_TO_POSITION :
2171  break;
2172 
2175  break;
2176 
2177  case MOVE_SLIDE_TO_POSITION :
2179  break;
2180 
2181  case MOVE_WANDER :
2182  WanderAround();
2183  break;
2184  }
2185 
2186  if ( GetMovePos( goalPos ) ) {
2187  CheckObstacleAvoidance( goalPos, dest );
2188  }
2189 }
2190 
2191 /*
2192 =====================
2193 idAI::Event_AllowMovement
2194 =====================
2195 */
2196 void idAI::Event_AllowMovement( float flag ) {
2197  allowMove = ( flag != 0.0f );
2198 }
2199 
2200 /*
2201 =====================
2202 idAI::Event_JumpFrame
2203 =====================
2204 */
2206  AI_JUMP = true;
2207 }
2208 
2209 /*
2210 =====================
2211 idAI::Event_EnableClip
2212 =====================
2213 */
2216  disableGravity = false;
2217 }
2218 
2219 /*
2220 =====================
2221 idAI::Event_DisableClip
2222 =====================
2223 */
2225  physicsObj.SetClipMask( 0 );
2226  disableGravity = true;
2227 }
2228 
2229 /*
2230 =====================
2231 idAI::Event_EnableGravity
2232 =====================
2233 */
2235  disableGravity = false;
2236 }
2237 
2238 /*
2239 =====================
2240 idAI::Event_DisableGravity
2241 =====================
2242 */
2244  disableGravity = true;
2245 }
2246 
2247 /*
2248 =====================
2249 idAI::Event_EnableAFPush
2250 =====================
2251 */
2253  af_push_moveables = true;
2254 }
2255 
2256 /*
2257 =====================
2258 idAI::Event_DisableAFPush
2259 =====================
2260 */
2262  af_push_moveables = false;
2263 }
2264 
2265 /*
2266 =====================
2267 idAI::Event_SetFlySpeed
2268 =====================
2269 */
2270 void idAI::Event_SetFlySpeed( float speed ) {
2271  if ( move.speed == fly_speed ) {
2272  move.speed = speed;
2273  }
2274  fly_speed = speed;
2275 }
2276 
2277 /*
2278 ================
2279 idAI::Event_SetFlyOffset
2280 ================
2281 */
2283  fly_offset = offset;
2284 }
2285 
2286 /*
2287 ================
2288 idAI::Event_ClearFlyOffset
2289 ================
2290 */
2292  spawnArgs.GetInt( "fly_offset", "0", fly_offset );
2293 }
2294 
2295 /*
2296 =====================
2297 idAI::Event_GetClosestHiddenTarget
2298 =====================
2299 */
2301  int i;
2302  idEntity *ent;
2303  idEntity *bestEnt;
2304  float time;
2305  float bestTime;
2306  const idVec3 &org = physicsObj.GetOrigin();
2307  idActor *enemyEnt = enemy.GetEntity();
2308 
2309  if ( !enemyEnt ) {
2310  // no enemy to hide from
2312  return;
2313  }
2314 
2315  if ( targets.Num() == 1 ) {
2316  ent = targets[ 0 ].GetEntity();
2317  if ( ent && idStr::Cmp( ent->GetEntityDefName(), type ) == 0 ) {
2318  if ( !EntityCanSeePos( enemyEnt, lastVisibleEnemyPos, ent->GetPhysics()->GetOrigin() ) ) {
2319  idThread::ReturnEntity( ent );
2320  return;
2321  }
2322  }
2324  return;
2325  }
2326 
2327  bestEnt = NULL;
2328  bestTime = idMath::INFINITY;
2329  for( i = 0; i < targets.Num(); i++ ) {
2330  ent = targets[ i ].GetEntity();
2331  if ( ent && idStr::Cmp( ent->GetEntityDefName(), type ) == 0 ) {
2332  const idVec3 &destOrg = ent->GetPhysics()->GetOrigin();
2333  time = TravelDistance( org, destOrg );
2334  if ( ( time >= 0.0f ) && ( time < bestTime ) ) {
2335  if ( !EntityCanSeePos( enemyEnt, lastVisibleEnemyPos, destOrg ) ) {
2336  bestEnt = ent;
2337  bestTime = time;
2338  }
2339  }
2340  }
2341  }
2342  idThread::ReturnEntity( bestEnt );
2343 }
2344 
2345 /*
2346 =====================
2347 idAI::Event_GetRandomTarget
2348 =====================
2349 */
2350 void idAI::Event_GetRandomTarget( const char *type ) {
2351  int i;
2352  int num;
2353  int which;
2354  idEntity *ent;
2355  idEntity *ents[ MAX_GENTITIES ];
2356 
2357  num = 0;
2358  for( i = 0; i < targets.Num(); i++ ) {
2359  ent = targets[ i ].GetEntity();
2360  if ( ent && idStr::Cmp( ent->GetEntityDefName(), type ) == 0 ) {
2361  ents[ num++ ] = ent;
2362  if ( num >= MAX_GENTITIES ) {
2363  break;
2364  }
2365  }
2366  }
2367 
2368  if ( !num ) {
2370  return;
2371  }
2372 
2373  which = gameLocal.random.RandomInt( num );
2374  idThread::ReturnEntity( ents[ which ] );
2375 }
2376 
2377 /*
2378 ================
2379 idAI::Event_TravelDistanceToPoint
2380 ================
2381 */
2383  float time;
2384 
2385  time = TravelDistance( physicsObj.GetOrigin(), pos );
2386  idThread::ReturnFloat( time );
2387 }
2388 
2389 /*
2390 ================
2391 idAI::Event_TravelDistanceToEntity
2392 ================
2393 */
2395  float time;
2396 
2397  time = TravelDistance( physicsObj.GetOrigin(), ent->GetPhysics()->GetOrigin() );
2398  idThread::ReturnFloat( time );
2399 }
2400 
2401 /*
2402 ================
2403 idAI::Event_TravelDistanceBetweenPoints
2404 ================
2405 */
2407  float time;
2408 
2409  time = TravelDistance( source, dest );
2410  idThread::ReturnFloat( time );
2411 }
2412 
2413 /*
2414 ================
2415 idAI::Event_TravelDistanceBetweenEntities
2416 ================
2417 */
2419  float time;
2420 
2421  assert( source );
2422  assert( dest );
2423  time = TravelDistance( source->GetPhysics()->GetOrigin(), dest->GetPhysics()->GetOrigin() );
2424  idThread::ReturnFloat( time );
2425 }
2426 
2427 /*
2428 =====================
2429 idAI::Event_LookAtEntity
2430 =====================
2431 */
2432 void idAI::Event_LookAtEntity( idEntity *ent, float duration ) {
2433  if ( ent == this ) {
2434  ent = NULL;
2435  }
2436 
2437  if ( ( ent != focusEntity.GetEntity() ) || ( focusTime < gameLocal.time ) ) {
2438  focusEntity = ent;
2441  blink_time = 0;
2442  }
2443 
2444  focusTime = gameLocal.time + SEC2MS( duration );
2445 }
2446 
2447 /*
2448 =====================
2449 idAI::Event_LookAtEnemy
2450 =====================
2451 */
2452 void idAI::Event_LookAtEnemy( float duration ) {
2453  idActor *enemyEnt;
2454 
2455  enemyEnt = enemy.GetEntity();
2456  if ( ( enemyEnt != focusEntity.GetEntity() ) || ( focusTime < gameLocal.time ) ) {
2457  focusEntity = enemyEnt;
2460  blink_time = 0;
2461  }
2462 
2463  focusTime = gameLocal.time + SEC2MS( duration );
2464 }
2465 
2466 /*
2467 ===============
2468 idAI::Event_SetJointMod
2469 ===============
2470 */
2471 void idAI::Event_SetJointMod( int allow ) {
2472  allowJointMod = ( allow != 0 );
2473 }
2474 
2475 /*
2476 ================
2477 idAI::Event_ThrowMoveable
2478 ================
2479 */
2481  idEntity *ent;
2482  idEntity *moveable = NULL;
2483 
2484  for ( ent = GetNextTeamEntity(); ent != NULL; ent = ent->GetNextTeamEntity() ) {
2485  if ( ent->GetBindMaster() == this && ent->IsType( idMoveable::Type ) ) {
2486  moveable = ent;
2487  break;
2488  }
2489  }
2490  if ( moveable ) {
2491  moveable->Unbind();
2492  moveable->PostEventMS( &EV_SetOwner, 200, 0 );
2493  }
2494 }
2495 
2496 /*
2497 ================
2498 idAI::Event_ThrowAF
2499 ================
2500 */
2501 void idAI::Event_ThrowAF( void ) {
2502  idEntity *ent;
2503  idEntity *af = NULL;
2504 
2505  for ( ent = GetNextTeamEntity(); ent != NULL; ent = ent->GetNextTeamEntity() ) {
2506  if ( ent->GetBindMaster() == this && ent->IsType( idAFEntity_Base::Type ) ) {
2507  af = ent;
2508  break;
2509  }
2510  }
2511  if ( af ) {
2512  af->Unbind();
2513  af->PostEventMS( &EV_SetOwner, 200, 0 );
2514  }
2515 }
2516 
2517 /*
2518 ================
2519 idAI::Event_SetAngles
2520 ================
2521 */
2522 void idAI::Event_SetAngles( idAngles const &ang ) {
2523  current_yaw = ang.yaw;
2524  viewAxis = idAngles( 0, current_yaw, 0 ).ToMat3();
2525 }
2526 
2527 /*
2528 ================
2529 idAI::Event_GetAngles
2530 ================
2531 */
2534 }
2535 
2536 /*
2537 ================
2538 idAI::Event_RealKill
2539 ================
2540 */
2541 void idAI::Event_RealKill( void ) {
2542  health = 0;
2543 
2544  if ( af.IsLoaded() ) {
2545  // clear impacts
2546  af.Rest();
2547 
2548  // physics is turned off by calling af.Rest()
2550  }
2551 
2552  Killed( this, this, 0, vec3_zero, INVALID_JOINT );
2553 }
2554 
2555 /*
2556 ================
2557 idAI::Event_Kill
2558 ================
2559 */
2560 void idAI::Event_Kill( void ) {
2561  PostEventMS( &AI_RealKill, 0 );
2562 }
2563 
2564 /*
2565 ================
2566 idAI::Event_WakeOnFlashlight
2567 ================
2568 */
2569 void idAI::Event_WakeOnFlashlight( int enable ) {
2570  wakeOnFlashlight = ( enable != 0 );
2571 }
2572 
2573 /*
2574 ================
2575 idAI::Event_LocateEnemy
2576 ================
2577 */
2579  idActor *enemyEnt;
2580  int areaNum;
2581 
2582  enemyEnt = enemy.GetEntity();
2583  if ( !enemyEnt ) {
2584  return;
2585  }
2586 
2587  enemyEnt->GetAASLocation( aas, lastReachableEnemyPos, areaNum );
2588  SetEnemyPosition();
2590 }
2591 
2592 /*
2593 ================
2594 idAI::Event_KickObstacles
2595 ================
2596 */
2597 void idAI::Event_KickObstacles( idEntity *kickEnt, float force ) {
2598  idVec3 dir;
2599  idEntity *obEnt;
2600 
2601  if ( kickEnt ) {
2602  obEnt = kickEnt;
2603  } else {
2604  obEnt = move.obstacle.GetEntity();
2605  }
2606 
2607  if ( obEnt ) {
2608  dir = obEnt->GetPhysics()->GetOrigin() - physicsObj.GetOrigin();
2609  dir.Normalize();
2610  } else {
2611  dir = viewAxis[ 0 ];
2612  }
2613  KickObstacles( dir, force, obEnt );
2614 }
2615 
2616 /*
2617 ================
2618 idAI::Event_GetObstacle
2619 ================
2620 */
2623 }
2624 
2625 /*
2626 ================
2627 idAI::Event_PushPointIntoAAS
2628 ================
2629 */
2631  int areaNum;
2632  idVec3 newPos;
2633 
2634  areaNum = PointReachableAreaNum( pos );
2635  if ( areaNum ) {
2636  newPos = pos;
2637  aas->PushPointIntoAreaNum( areaNum, newPos );
2638  idThread::ReturnVector( newPos );
2639  } else {
2640  idThread::ReturnVector( pos );
2641  }
2642 }
2643 
2644 
2645 /*
2646 ================
2647 idAI::Event_GetTurnRate
2648 ================
2649 */
2652 }
2653 
2654 /*
2655 ================
2656 idAI::Event_SetTurnRate
2657 ================
2658 */
2659 void idAI::Event_SetTurnRate( float rate ) {
2660  turnRate = rate;
2661 }
2662 
2663 /*
2664 ================
2665 idAI::Event_AnimTurn
2666 ================
2667 */
2668 void idAI::Event_AnimTurn( float angles ) {
2669  turnVel = 0.0f;
2670  anim_turn_angles = angles;
2671  if ( angles ) {
2676  }
2677  } else {
2678  anim_turn_amount = 0.0f;
2683  }
2684 }
2685 
2686 /*
2687 ================
2688 idAI::Event_AllowHiddenMovement
2689 ================
2690 */
2692  allowHiddenMovement = ( enable != 0 );
2693 }
2694 
2695 /*
2696 ================
2697 idAI::Event_TriggerParticles
2698 ================
2699 */
2700 void idAI::Event_TriggerParticles( const char *jointName ) {
2701  TriggerParticles( jointName );
2702 }
2703 
2704 /*
2705 =====================
2706 idAI::Event_FindActorsInBounds
2707 =====================
2708 */
2709 void idAI::Event_FindActorsInBounds( const idVec3 &mins, const idVec3 &maxs ) {
2710  idEntity * ent;
2711  idEntity * entityList[ MAX_GENTITIES ];
2712  int numListedEntities;
2713  int i;
2714 
2715  numListedEntities = gameLocal.clip.EntitiesTouchingBounds( idBounds( mins, maxs ), CONTENTS_BODY, entityList, MAX_GENTITIES );
2716  for( i = 0; i < numListedEntities; i++ ) {
2717  ent = entityList[ i ];
2718  if ( ent != this && !ent->IsHidden() && ( ent->health > 0 ) && ent->IsType( idActor::Type ) ) {
2719  idThread::ReturnEntity( ent );
2720  return;
2721  }
2722  }
2723 
2725 }
2726 
2727 /*
2728 ================
2729 idAI::Event_CanReachPosition
2730 ================
2731 */
2733  aasPath_t path;
2734  int toAreaNum;
2735  int areaNum;
2736 
2737  toAreaNum = PointReachableAreaNum( pos );
2739  if ( !toAreaNum || !PathToGoal( path, areaNum, physicsObj.GetOrigin(), toAreaNum, pos ) ) {
2740  idThread::ReturnInt( false );
2741  } else {
2742  idThread::ReturnInt( true );
2743  }
2744 }
2745 
2746 /*
2747 ================
2748 idAI::Event_CanReachEntity
2749 ================
2750 */
2752  aasPath_t path;
2753  int toAreaNum;
2754  int areaNum;
2755  idVec3 pos;
2756 
2757  if ( !ent ) {
2758  idThread::ReturnInt( false );
2759  return;
2760  }
2761 
2762  if ( move.moveType != MOVETYPE_FLY ) {
2763  if ( !ent->GetFloorPos( 64.0f, pos ) ) {
2764  idThread::ReturnInt( false );
2765  return;
2766  }
2767  if ( ent->IsType( idActor::Type ) && static_cast<idActor *>( ent )->OnLadder() ) {
2768  idThread::ReturnInt( false );
2769  return;
2770  }
2771  } else {
2772  pos = ent->GetPhysics()->GetOrigin();
2773  }
2774 
2775  toAreaNum = PointReachableAreaNum( pos );
2776  if ( !toAreaNum ) {
2777  idThread::ReturnInt( false );
2778  return;
2779  }
2780 
2781  const idVec3 &org = physicsObj.GetOrigin();
2782  areaNum = PointReachableAreaNum( org );
2783  if ( !toAreaNum || !PathToGoal( path, areaNum, org, toAreaNum, pos ) ) {
2784  idThread::ReturnInt( false );
2785  } else {
2786  idThread::ReturnInt( true );
2787  }
2788 }
2789 
2790 /*
2791 ================
2792 idAI::Event_CanReachEnemy
2793 ================
2794 */
2796  aasPath_t path;
2797  int toAreaNum;
2798  int areaNum;
2799  idVec3 pos;
2800  idActor *enemyEnt;
2801 
2802  enemyEnt = enemy.GetEntity();
2803  if ( !enemyEnt ) {
2804  idThread::ReturnInt( false );
2805  return;
2806  }
2807 
2808  if ( move.moveType != MOVETYPE_FLY ) {
2809  if ( enemyEnt->OnLadder() ) {
2810  idThread::ReturnInt( false );
2811  return;
2812  }
2813  enemyEnt->GetAASLocation( aas, pos, toAreaNum );
2814  } else {
2815  pos = enemyEnt->GetPhysics()->GetOrigin();
2816  toAreaNum = PointReachableAreaNum( pos );
2817  }
2818 
2819  if ( !toAreaNum ) {
2820  idThread::ReturnInt( false );
2821  return;
2822  }
2823 
2824  const idVec3 &org = physicsObj.GetOrigin();
2825  areaNum = PointReachableAreaNum( org );
2826  if ( !PathToGoal( path, areaNum, org, toAreaNum, pos ) ) {
2827  idThread::ReturnInt( false );
2828  } else {
2829  idThread::ReturnInt( true );
2830  }
2831 }
2832 
2833 /*
2834 ================
2835 idAI::Event_GetReachableEntityPosition
2836 ================
2837 */
2839  int toAreaNum;
2840  idVec3 pos;
2841 
2842  if ( move.moveType != MOVETYPE_FLY ) {
2843  if ( !ent->GetFloorPos( 64.0f, pos ) ) {
2844  // NOTE: not a good way to return 'false'
2846  }
2847  if ( ent->IsType( idActor::Type ) && static_cast<idActor *>( ent )->OnLadder() ) {
2848  // NOTE: not a good way to return 'false'
2850  }
2851  } else {
2852  pos = ent->GetPhysics()->GetOrigin();
2853  }
2854 
2855  if ( aas ) {
2856  toAreaNum = PointReachableAreaNum( pos );
2857  aas->PushPointIntoAreaNum( toAreaNum, pos );
2858  }
2859 
2860  idThread::ReturnVector( pos );
2861 }
2862 
2863 #ifdef _D3XP
2864 /*
2865 ================
2866 idAI::Event_MoveToPositionDirect
2867 ================
2868 */
2869 void idAI::Event_MoveToPositionDirect( const idVec3 &pos ) {
2871  DirectMoveToPosition( pos );
2872 }
2873 
2874 /*
2875 ================
2876 idAI::Event_AvoidObstacles
2877 ================
2878 */
2879 void idAI::Event_AvoidObstacles( int ignore) {
2880  ignore_obstacles = (ignore == 1) ? false : true;
2881 }
2882 
2883 /*
2884 ================
2885 idAI::Event_TriggerFX
2886 ================
2887 */
2888 void idAI::Event_TriggerFX( const char* joint, const char* fx ) {
2889  TriggerFX(joint, fx);
2890 }
2891 
2892 void idAI::Event_StartEmitter( const char* name, const char* joint, const char* particle ) {
2893  idEntity *ent = StartEmitter(name, joint, particle);
2895 }
2896 
2897 void idAI::Event_GetEmitter( const char* name ) {
2898  idThread::ReturnEntity(GetEmitter(name));
2899 }
2900 
2901 void idAI::Event_StopEmitter( const char* name ) {
2902  StopEmitter(name);
2903 }
2904 
2905 #endif
2906 
const idEventDef AI_MoveOutOfRange("moveOutOfRange","ef")
static bool BeginMultiFrameEvent(idEntity *ent, const idEventDef *event)
virtual const idVec3 & GetOrigin(int id=0) const =0
bool GetAimDir(const idVec3 &firePos, idEntity *aimAtEnt, const idEntity *ignore, idVec3 &aimDir) const
Definition: AI.cpp:4095
jointHandle_t
Definition: Model.h:156
idPlayer * GetLocalPlayer() const
const idEventDef AI_WaitMove("waitMove")
int ClipModelsTouchingBounds(const idBounds &bounds, int contentMask, idClipModel **clipModelList, int maxCount) const
Definition: Clip.cpp:804
const idVec3 & GetGravity(void) const
const idEventDef AI_SetFlySpeed("setFlySpeed","f")
idEntity * GetEntity(void) const
Definition: Clip.h:178
idAAS * aas
Definition: AI.h:293
void ClearEnemy(void)
Definition: AI.cpp:3732
renderEntity_t renderEntity
Definition: Entity.h:371
bool TracePoint(trace_t &results, const idVec3 &start, const idVec3 &end, int contentMask, const idEntity *passEntity)
Definition: Clip.h:333
void Event_CreateMissile(const char *jointname)
Definition: AI_events.cpp:573
bool TurnToward(float yaw)
Definition: AI.cpp:2541
void Event_GetMoveType(void)
Definition: AI_events.cpp:2092
void Event_FacingIdeal(void)
Definition: AI_events.cpp:1169
float GetFloat(const char *key, const char *defaultString="0") const
Definition: Dict.h:248
const idEventDef AI_EnableClip("enableClip")
void Event_StopThinking(void)
Definition: AI_events.cpp:2063
static const float INFINITY
Definition: Math.h:218
idMat3 ToMat3(void) const
Definition: Vector.cpp:195
const idEventDef AI_MoveToEnemyHeight("moveToEnemyHeight")
bool GetJointTransform(jointHandle_t jointHandle, int currenttime, idVec3 &offset, idMat3 &axis)
virtual void GetAASLocation(idAAS *aas, idVec3 &pos, int &areaNum) const
Definition: Actor.cpp:1905
void EndAttack(void)
Definition: AI.cpp:4159
const idEventDef AI_RandomPath("randomPath", NULL, 'e')
bool allowHiddenMovement
Definition: AI.h:333
const idEventDef EV_SetOwner("setOwner","e")
float Normalize(void)
Definition: Vector.h:646
void Event_GetClosestHiddenTarget(const char *type)
Definition: AI_events.cpp:2300
idVec4 colorGreen
Definition: Lib.cpp:118
const idEventDef AI_AttackMelee("attackMelee","s", 'd')
int GetInt(const char *key, const char *defaultString="0") const
Definition: Dict.h:252
void void static idThread * CurrentThread(void)
assert(prefInfo.fullscreenBtn)
const idEventDef AI_GetJumpVelocity("getJumpVelocity","vff", 'v')
const idDict * FindEntityDefDict(const char *name, bool makeDefault=true) const
void Event_GetHealth(void)
Definition: AI_events.cpp:983
virtual const idVec3 & GetGravityNormal(void) const =0
void Link(idClip &clp)
Definition: Clip.cpp:545
idLinkList< idEntity > activeEntities
Definition: Game_local.h:282
int Cmp(const char *text) const
Definition: Str.h:652
idClipModel * projectileClipModel
Definition: AI.h:346
void Event_GetCombatNode(void)
Definition: AI_events.cpp:1212
bool MoveToAttackPosition(idEntity *ent, int attack_anim)
Definition: AI.cpp:1913
idMat3 mat3_identity(idVec3(1, 0, 0), idVec3(0, 1, 0), idVec3(0, 0, 1))
bool EntityInView(idActor *actor, const idVec3 &pos)
Definition: AI.cpp:5304
const idEventDef AI_FindActorsInBounds("findActorsInBounds","vv", 'e')
idLinkList< idActor > enemyNode
Definition: Actor.h:119
const idEventDef AI_GetEnemyPos("getEnemyPos", NULL, 'v')
idVec3 GetCenter(void) const
Definition: Bounds.h:211
const idEventDef AI_FindEnemyInCombatNodes("findEnemyInCombatNodes", NULL, 'e')
bool GetFloorPos(float max_dist, idVec3 &floorpos) const
Definition: Entity.cpp:2821
idClip clip
Definition: Game_local.h:296
void Event_SetFlySpeed(float speed)
Definition: AI_events.cpp:2270
bool MoveToEntity(idEntity *ent)
Definition: AI.cpp:1785
void CheckObstacleAvoidance(const idVec3 &goalPos, idVec3 &newPos)
Definition: AI.cpp:2618
void Event_SlideTo(const idVec3 &pos, float time)
Definition: AI_events.cpp:1152
void Event_AllowHiddenMovement(int enable)
Definition: AI_events.cpp:2691
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)
Definition: Projectile.cpp:306
const idEventDef AI_ClosestReachableEnemyOfEntity("closestReachableEnemyOfEntity","E", 'e')
const idEventDef AI_GetEnemy("getEnemy", NULL, 'e')
void Event_Activate(idEntity *activator)
Definition: AI_events.cpp:324
void Event_PushPointIntoAAS(const idVec3 &pos)
Definition: AI_events.cpp:2630
idEntityPtr< idActor > talkTarget
Definition: AI.h:360
struct idEntity::entityFlags_s fl
void BindToJoint(idEntity *master, const char *jointname, bool orientated)
Definition: Entity.cpp:1921
void FreeCurrentPVS(pvsHandle_t handle) const
Definition: Pvs.cpp:1127
#define MAX_GENTITIES
Definition: Game_local.h:83
void Event_AllowDamage(void)
Definition: AI_events.cpp:992
void Bind(idEntity *master, bool orientated)
Definition: Entity.cpp:1896
type * GetEntity(void) const
Definition: Game_local.h:695
idEntityPtr< idEntity > focusEntity
Definition: AI.h:367
const float AI_HEARING_RANGE
Definition: AI.h:45
static void EndMultiFrameEvent(idEntity *ent, const idEventDef *event)
const idEventDef AI_AllowMovement("allowMovement","f")
const idEventDef AI_SlideTo("slideTo","vf")
bool disableGravity
Definition: AI.h:334
idScriptBool AI_DEAD
Definition: AI.h:426
#define MAX_WORLD_SIZE
Definition: Lib.h:100
bool SetSyncedAnimWeight(int num, float weight)
void Event_MoveToEntity(idEntity *ent)
Definition: AI_events.cpp:1130
bool FacingIdeal(void)
Definition: AI.cpp:2519
const idEventDef EV_Activate("activate","e")
const idEventDef AI_MuzzleFlash("muzzleFlash","s")
void Event_DisableAFPush(void)
Definition: AI_events.cpp:2261
idEntity * GetBindMaster(void) const
Definition: Entity.cpp:2153
float anim_turn_angles
Definition: AI.h:312
#define ATTACK_ON_SIGHT
Definition: AI.h:51
void SetEnemy(idActor *newEnemy)
Definition: AI.cpp:3945
const idEventDef AI_EnemyRange2D("enemyRange2D", NULL, 'f')
void StopRagdoll(void)
Definition: Actor.cpp:1708
idRandom random
Definition: Game_local.h:291
idVec3 modelOffset
Definition: Actor.h:221
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
Definition: Game_local.cpp:783
void Event_TurnTo(float angle)
Definition: AI_events.cpp:1019
moveStatus_t moveStatus
Definition: AI.h:193
bool IsType(const idTypeInfo &c) const
Definition: Class.h:337
void Event_EnemyPositionValid(void)
Definition: AI_events.cpp:1756
const idEventDef AI_StopRagdoll("stopRagdoll")
idScriptBool AI_JUMP
Definition: AI.h:434
void Event_ChargeAttack(const char *damageDef)
Definition: AI_events.cpp:1768
void CreateProjectileClipModel(void) const
Definition: AI.cpp:4082
const idEventDef AI_CanReachEnemy("canReachEnemy", NULL, 'd')
idEntityPtr< idActor > enemy
Definition: AI.h:406
int lastHitCheckTime
Definition: AI.h:339
void Event_Wander(void)
Definition: AI_events.cpp:1160
static idPathCorner * RandomPath(const idEntity *source, const idEntity *ignore)
Definition: Misc.cpp:380
const idMat3 & GetAxis(void) const
Definition: Clip.h:210
idEntity * FindEntity(const char *name) const
idList< idEntityPtr< idEntity > > targets
Definition: Entity.h:132
const idEventDef AI_Wander("wander")
void DirectDamage(const char *meleeDefName, idEntity *ent)
Definition: AI.cpp:4371
idLinkList< idActor > enemyList
Definition: Actor.h:120
bool WanderAround(void)
Definition: AI.cpp:2091
float z
Definition: Vector.h:320
const idEventDef AI_SetMoveType("setMoveType","d")
const idEventDef AI_SetEnemy("setEnemy","E")
void Event_ClearFlyOffset(void)
Definition: AI_events.cpp:2291
const idEventDef AI_CanBecomeSolid("canBecomeSolid", NULL, 'f')
int forceAlignHeadTime
Definition: AI.h:371
int endEvent
Definition: AI.h:134
void UpdateEnemyPosition(void)
Definition: AI.cpp:3872
void Event_AttackMissile(const char *jointname)
Definition: AI_events.cpp:599
void SetEnemyPosition(void)
Definition: AI.cpp:3778
const idEventDef AI_MeleeAttackToJoint("meleeAttackToJoint","ss", 'd')
void RadiusDamage(const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignoreDamage, idEntity *ignorePush, const char *damageDefName, float dmgPower=1.0f)
void Event_TestMeleeAttack(void)
Definition: AI_events.cpp:1923
void Event_KickObstacles(idEntity *kickEnt, float force)
Definition: AI_events.cpp:2597
jointHandle_t GetJointHandle(const char *name) const
moveCommand_t moveCommand
Definition: AI.h:192
void Event_EnableClip(void)
Definition: AI_events.cpp:2214
float anim_turn_amount
Definition: AI.h:311
void Event_TravelDistanceToPoint(const idVec3 &pos)
Definition: AI_events.cpp:2382
void void void void DWarning(const char *fmt,...) const id_attribute((format(printf
Definition: Game_local.cpp:757
const idEventDef AI_NumSmokeEmitters("numSmokeEmitters", NULL, 'd')
void Event_RealKill(void)
Definition: AI_events.cpp:2541
Definition: Vector.h:316
void Event_TravelDistanceToEntity(idEntity *ent)
Definition: AI_events.cpp:2394
void Event_TestAnimMoveTowardEnemy(const char *animname)
Definition: AI_events.cpp:1834
void Event_LaunchMissile(const idVec3 &muzzle, const idAngles &ang)
Definition: AI_events.cpp:629
virtual const idVec3 & GetLinearVelocity(int id=0) const =0
void Event_PredictEnemyPos(float time)
Definition: AI_events.cpp:1550
void Activate(idEntity *activator)
Definition: AI.cpp:3604
const idEventDef AI_TravelDistanceToPoint("travelDistanceToPoint","v", 'f')
void Event_SetEnemy(idEntity *ent)
Definition: AI_events.cpp:536
const idEventDef AI_LookAtEntity("lookAt","Ef")
ID_INLINE T Square(T x)
Definition: Math.h:104
bool SlideToPosition(const idVec3 &pos, float time)
Definition: AI.cpp:2062
const idEventDef AI_CanHitEnemyFromJoint("canHitEnemyFromJoint","s", 'd')
const idEventDef AI_SetTurnRate("setTurnRate","f")
bool wakeOnFlashlight
Definition: AI.h:411
int team
Definition: Actor.h:115
void Event_TestAnimMove(const char *animname)
Definition: AI_events.cpp:1874
const idEventDef AI_TravelDistanceBetweenEntities("travelDistanceBetweenEntities","ee", 'f')
static bool PredictPath(const idEntity *ent, const idAAS *aas, const idVec3 &start, const idVec3 &velocity, int totalTime, int frameTime, int stopEvent, predictedPath_t &path)
int blink_time
Definition: Actor.h:252
virtual void SetLinearVelocity(const idVec3 &newLinearVelocity, int id=0)=0
void Event_ThrowMoveable(void)
Definition: AI_events.cpp:2480
const idEventDef AI_CanReachEntity("canReachEntity","E", 'd')
GLuint GLuint GLsizei GLenum type
Definition: glext.h:2845
static void ReturnVector(idVec3 const &vec)
idVec3 lastVisibleEnemyPos
Definition: AI.h:407
void Event_CanReachEntity(idEntity *ent)
Definition: AI_events.cpp:2751
const idEventDef AI_PredictEnemyPos("predictEnemyPos","f", 'v')
const idEventDef AI_SetHealth("setHealth","f")
void Create(idEntity *owner, const idVec3 &start, const idVec3 &dir)
Definition: Projectile.cpp:218
void Event_SetHealth(float newHealth)
Definition: AI_events.cpp:968
bool IsDisabled(void) const
Definition: AI.cpp:5241
void Event_EnableGravity(void)
Definition: AI_events.cpp:2234
const idEventDef AI_SetJointMod("setBoneMod","d")
float fly_speed
Definition: AI.h:319
idProjectile * CreateProjectile(const idVec3 &pos, const idVec3 &dir)
Definition: AI.cpp:4168
const idDict * projectileDef
Definition: AI.h:345
const char * GetClassname(void) const
Definition: Class.cpp:593
moveType_t
Definition: AI.h:54
const idEventDef AI_GetObstacle("getObstacle", NULL, 'e')
void Event_Burn(void)
Definition: AI_events.cpp:2000
const idEventDef AI_ChargeAttack("chargeAttack","s")
void Event_SetTalkTarget(idEntity *target)
Definition: AI_events.cpp:1446
float x
Definition: Vector.h:318
idActor * GetAlertEntity(void)
void Event_CanHitEnemyFromAnim(const char *animname)
Definition: AI_events.cpp:1616
idDict spawnArgs
Definition: Entity.h:122
const idEventDef AI_GetRandomTarget("getRandomTarget","s", 'e')
bool PathToGoal(aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin) const
Definition: AI.cpp:1474
float current_yaw
Definition: AI.h:307
int i
Definition: process.py:33
const idVec3 & TotalMovementDelta(int animnum) const
bool MoveToPosition(const idVec3 &pos)
Definition: AI.cpp:1965
#define MASK_MONSTERSOLID
Definition: Game_local.h:736
idVec3 lastReachableEnemyPos
Definition: AI.h:410
GLintptr offset
Definition: glext.h:3113
bool EntityCanSeePos(idActor *actor, const idVec3 &actorOrigin, const idVec3 &pos)
Definition: AI.cpp:2376
const idEventDef AI_BecomeRagdoll("becomeRagdoll", NULL, 'd')
const idEventDef AI_MoveStatus("moveStatus", NULL, 'd')
const idEventDef AI_LookAtEnemy("lookAtEnemy","f")
const idEventDef AI_BeginAttack("attackBegin","s")
GLuint GLuint num
Definition: glext.h:5390
Boolean result
const int SHADERPARM_MD5_SKINSCALE
Definition: RenderWorld.h:57
Definition: AI.h:122
const idVec3 & GetOrigin(int id=0) const
idScriptBool AI_ENEMY_VISIBLE
Definition: AI.h:427
void Event_MoveToCover(void)
Definition: AI_events.cpp:1066
bool EnemyPositionValid(void) const
Definition: AI.cpp:3751
const idEventDef AI_EnemyRange("enemyRange", NULL, 'f')
const idEventDef AI_EnableAFPush("enableAFPush")
GLsizei range
Definition: glext.h:4368
const idVec2 & ToVec2(void) const
Definition: Vector.h:711
#define EVENT(event, function)
Definition: Class.h:53
idMat3 viewAxis
Definition: Actor.h:117
void SetContents(int contents, int id=-1)
void Event_EnemyInCombatCone(idEntity *ent, int use_current_enemy_location)
Definition: AI_events.cpp:1295
void Event_ClosestReachableEnemyOfEntity(idEntity *team_mate)
Definition: AI_events.cpp:469
void Event_FindEnemy(int useFOV)
Definition: AI_events.cpp:345
int EntitiesTouchingBounds(const idBounds &bounds, int contentMask, idEntity **entityList, int maxCount) const
Definition: Clip.cpp:833
float fraction
void Event_GetEnemyPos(void)
Definition: AI_events.cpp:1532
idVec3 endpos
const idEventDef AI_TestAnimAttack("testAnimAttack","s", 'd')
const idEventDef AI_ClearBurn("clearBurn")
const idEventDef AI_FindEnemy("findEnemy","d", 'e')
idVec4 colorRed
Definition: Lib.cpp:117
virtual void Killed(idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location)
Definition: AI.cpp:3398
idAnimator animator
Definition: Entity.h:534
const idEventDef AI_RadiusDamageFromJoint("radiusDamageFromJoint","ss")
bool IsHidden(void) const
Definition: Entity.cpp:1217
void Event_SetFlyOffset(int offset)
Definition: AI_events.cpp:2282
void KickObstacles(const idVec3 &dir, float force, idEntity *alwaysKick)
Definition: AI.cpp:1296
void Event_CanBecomeSolid(void)
Definition: AI_events.cpp:854
void Event_MoveToEnemy(void)
Definition: AI_events.cpp:1080
void void void Warning(const char *fmt,...) const id_attribute((format(printf
Definition: Game_local.cpp:735
bool CanSee(idEntity *ent, bool useFOV) const
Definition: Actor.cpp:1500
const idEventDef AI_DirectDamage("directDamage","es")
pvsHandle_t SetupCurrentPVS(const idVec3 &source, const pvsType_t type=PVS_NORMAL) const
Definition: Pvs.cpp:948
Definition: AAS.h:47
GLsizei GLsizei GLcharARB * source
Definition: glext.h:3633
idClipModel * GetClipModel(int id=0) const
void Event_GetEnemy(void)
Definition: AI_events.cpp:1523
void Event_EndAttack(void)
Definition: AI_events.cpp:807
virtual bool OnLadder(void) const
Definition: Actor.cpp:1896
const idEventDef AI_TravelDistanceToEntity("travelDistanceToEntity","e", 'f')
void Event_SetMoveType(int moveType)
Definition: AI_events.cpp:2101
void Event_BecomeSolid(void)
Definition: AI_events.cpp:915
int RandomInt(void)
Definition: Random.h:70
void Event_TestChargeAttack(void)
Definition: AI_events.cpp:1794
void TriggerWeaponEffects(const idVec3 &muzzle)
Definition: AI.cpp:4617
#define TFL_FLY
Definition: AASFile.h:55
idVec3 GetEyePosition(void) const
Definition: Actor.cpp:1454
void Event_RestoreMove(void)
Definition: AI_events.cpp:2128
const idEventDef AI_StopThinking("stopThinking")
bool MoveToCover(idEntity *entity, const idVec3 &pos)
Definition: AI.cpp:2013
idVec4 colorYellow
Definition: Lib.cpp:120
float TravelDistance(const idVec3 &start, const idVec3 &end) const
Definition: AI.cpp:1511
void Event_GetJumpVelocity(const idVec3 &pos, float speed, float max_height)
Definition: AI_events.cpp:1356
void Rest(void)
Definition: AF.cpp:1053
bool allowJointMod
Definition: AI.h:366
const idEventDef AI_GetTalkTarget("getTalkTarget", NULL, 'e')
void Event_IgnoreDamage(void)
Definition: AI_events.cpp:1001
const idEventDef AI_GetEnemyEyePos("getEnemyEyePos", NULL, 'v')
void Event_WakeOnFlashlight(int enable)
Definition: AI_events.cpp:2569
int GetAnim(int channel, const char *name)
Definition: Actor.cpp:2069
idPhysics * GetPhysics(void) const
Definition: Entity.cpp:2607
virtual void DebugLine(const idVec4 &color, const idVec3 &start, const idVec3 &end, const int lifetime=0, const bool depthTest=false)=0
const idEventDef AI_GetTurnRate("getTurnRate", NULL, 'f')
const idEventDef AI_TestMoveToPosition("testMoveToPosition","v", 'd')
idProjectile * LaunchProjectile(const char *jointname, idEntity *target, bool clampToAttackCone)
Definition: AI.cpp:4208
const char * GetString(const char *key, const char *defaultString="") const
Definition: Dict.h:240
bool SpawnEntityDef(const idDict &args, idEntity **ent=NULL, bool setDefaults=true)
bool InCurrentPVS(const pvsHandle_t handle, const idVec3 &target) const
Definition: Pvs.cpp:1139
float ToYaw(void) const
Definition: Vector.cpp:84
const idEventDef AI_RestoreMove("restoreMove")
void Event_FindActorsInBounds(const idVec3 &mins, const idVec3 &maxs)
Definition: AI_events.cpp:2709
const idEventDef AI_EnableGravity("enableGravity")
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
void Event_EnemyRange(void)
Definition: AI_events.cpp:1485
int PointReachableAreaNum(const idVec3 &pos, const float boundsScale=2.0f) const
Definition: AI.cpp:1446
const idEventDef AI_DisableAFPush("disableAFPush")
#define vec3_zero
Definition: Vector.h:390
void DoneProcessing(void)
void SetPhysics(idPhysics *phys)
Definition: Entity.cpp:2574
void Unbind(void)
Definition: Entity.cpp:2011
idEntityPtr< idEntity > obstacle
Definition: AI.h:206
void Event_LookAtEntity(idEntity *ent, float duration)
Definition: AI_events.cpp:2432
GLuint GLuint end
Definition: glext.h:2845
const idEventDef AI_SaveMove("saveMove")
const function_t * state
Definition: Actor.h:237
bool TestMelee(void) const
Definition: AI.cpp:4413
void Event_EnemyRange2D(void)
Definition: AI_events.cpp:1504
void Event_MoveStatus(void)
Definition: AI_events.cpp:1048
static float Fabs(float f)
Definition: Math.h:779
const idEventDef AI_JumpFrame("<jumpframe>")
const idEventDef AI_CreateMissile("createMissile","s", 'e')
const idEventDef AI_CanReachPosition("canReachPosition","v", 'd')
void Event_SetTalkState(int state)
Definition: AI_events.cpp:1472
const idEventDef AI_EndAttack("attackEnd")
void Event_TestAnimAttack(const char *animname)
Definition: AI_events.cpp:1933
const idEventDef AI_RealKill("<kill>")
bool GetBool(const char *key, const char *defaultString="0") const
Definition: Dict.h:256
Definition: Dict.h:65
void Event_TestMoveToPosition(const idVec3 &position)
Definition: AI_events.cpp:1902
#define NULL
Definition: Lib.h:88
const idBounds & GetBounds(void) const
Definition: Clip.h:198
idAnimBlend * CurrentAnim(int channelNum)
void Event_BeginAttack(const char *name)
Definition: AI_events.cpp:798
float y
Definition: Vector.h:319
void Event_LocateEnemy(void)
Definition: AI_events.cpp:2578
int ReactionTo(const idEntity *ent)
Definition: AI.cpp:3256
void Event_GetReachableEntityPosition(idEntity *ent)
Definition: AI_events.cpp:2838
const idEventDef AI_StopMove("stopMove")
idMoveState move
Definition: AI.h:296
void Event_AnimTurn(float angles)
Definition: AI_events.cpp:2668
bool GetMovePos(idVec3 &seekPos)
Definition: AI.cpp:2278
const int SHADERPARM_TIME_OF_DEATH
Definition: RenderWorld.h:54
idEntity * GetNextTeamEntity(void) const
Definition: Entity.cpp:2189
#define TFL_WALK
Definition: AASFile.h:45
float speed
Definition: AI.h:201
void Event_WaitAction(const char *waitForState)
Definition: AI_events.cpp:1197
void Event_FaceEnemy(void)
Definition: AI_events.cpp:1179
void Event_EntityInAttackCone(idEntity *ent)
Definition: AI_events.cpp:1395
const idEventDef AI_TestAnimMoveTowardEnemy("testAnimMoveTowardEnemy","s", 'd')
static void ReturnFloat(float value)
void Event_Kill(void)
Definition: AI_events.cpp:2560
const idEntity * blockingEntity
Definition: AI.h:135
const idEventDef AI_AttackMissile("attackMissile","s", 'e')
void Event_GetEnemyEyePos(void)
Definition: AI_events.cpp:1541
const idEventDef AI_TurnToEntity("turnToEntity","E")
void Event_SetAngles(idAngles const &ang)
Definition: AI_events.cpp:2522
const idEventDef AI_TurnTo("turnTo","f")
bool use_combat_bbox
Definition: Actor.h:232
void Event_CanReachEnemy(void)
Definition: AI_events.cpp:2795
void Event_DirectDamage(idEntity *damageTarget, const char *damageDefName)
Definition: AI_events.cpp:754
const char * path
Definition: sws.c:117
const char * WaitState(void) const
Definition: Actor.cpp:2036
int GetNumPVSAreas(void)
Definition: Entity.cpp:1363
void Event_DisableGravity(void)
Definition: AI_events.cpp:2243
void BeginAttack(const char *name)
Definition: AI.cpp:4149
const idEventDef AI_FaceEnemy("faceEnemy")
void Event_SetJointMod(int allowJointMod)
Definition: AI_events.cpp:2471
const idEventDef AI_AllowHiddenMovement("allowHiddenMovement","d")
const idEventDef AI_ThrowAF("throwAF")
float NormalizeFast(void)
Definition: Vector.h:524
bool MoveOutOfRange(idEntity *entity, float range)
Definition: AI.cpp:1856
int focusTime
Definition: AI.h:369
void Event_MuzzleFlash(const char *jointname)
Definition: AI_events.cpp:560
idBounds Rotate(const idMat3 &rotation) const
Definition: Bounds.h:342
#define MASK_SHOT_RENDERMODEL
Definition: Game_local.h:741
bool FaceEntity(idEntity *ent)
Definition: AI.cpp:1630
const idEventDef AI_ThrowMoveable("throwMoveable")
void Event_SaveMove(void)
Definition: AI_events.cpp:2119
idGameLocal gameLocal
Definition: Game_local.cpp:64
float LengthSqr(void) const
Definition: Vector.h:635
const idEventDef AI_FireMissileAtTarget("fireMissileAtTarget","ss", 'e')
#define END_CLASS
Definition: Class.h:54
bool DirectMoveToPosition(const idVec3 &pos)
Definition: AI.cpp:1656
const idBounds & GetAbsBounds(int id=-1) const
void Event_HeardSound(int ignore_team)
Definition: AI_events.cpp:515
void Event_NumSmokeEmitters(void)
Definition: AI_events.cpp:2054
const idEventDef AI_GetCombatNode("getCombatNode", NULL, 'e')
idBounds Expand(const float d) const
Definition: Bounds.h:317
const idEventDef AI_FaceEntity("faceEntity","E")
bool MoveToEnemy(void)
Definition: AI.cpp:1713
bool InPlayerPVS(idEntity *ent) const
void Event_Shrivel(float shirvel_time)
Definition: AI_events.cpp:1954
const idEventDef AI_EnemyInCombatCone("enemyInCombatCone","Ed", 'd')
void Event_MoveOutOfRange(idEntity *entity, float range)
Definition: AI_events.cpp:1102
void Event_MoveToEnemyHeight(void)
Definition: AI_events.cpp:1092
const idEventDef AI_CanHitEnemy("canHitEnemy", NULL, 'd')
void Event_MeleeAttackToJoint(const char *jointname, const char *meleeDefName)
Definition: AI_events.cpp:816
void Event_DisableClip(void)
Definition: AI_events.cpp:2224
virtual idClipModel * GetClipModel(int id=0) const =0
void Event_CanHitEnemyFromJoint(const char *jointname)
Definition: AI_events.cpp:1688
int numClients
Definition: Game_local.h:271
void ProjectVector(const idVec3 &src, idVec3 &dst) const
Definition: Matrix.h:628
void Event_TravelDistanceBetweenEntities(idEntity *source, idEntity *dest)
Definition: AI_events.cpp:2418
void Event_GetAngles(void)
Definition: AI_events.cpp:2532
int duration
Definition: AI.h:200
void Event_GetTalkTarget(void)
Definition: AI_events.cpp:1463
Definition: AI.h:80
#define SEC2MS(t)
Definition: Math.h:59
const idEventDef AI_Shrivel("shrivel","f")
const idEventDef AI_MoveToEnemy("moveToEnemy")
const idEventDef AI_SetFlyOffset("setFlyOffset","d")
const idEventDef AI_HeardSound("heardSound","d", 'e')
int ClipContents(const idClipModel *model) const
void Event_TurnToPos(const idVec3 &pos)
Definition: AI_events.cpp:1028
idEntity * entities[MAX_GENTITIES]
Definition: Game_local.h:275
bool IsLoaded(void) const
Definition: AF.h:65
int lastAttackTime
Definition: AI.h:340
void Event_Touch(idEntity *other, trace_t *trace)
Definition: AI_events.cpp:333
talkState_t talk_state
Definition: AI.h:359
const idEventDef AI_WakeOnFlashlight("wakeOnFlashlight","d")
void Event_FaceEntity(idEntity *ent)
Definition: AI_events.cpp:1188
void Event_EnableAFPush(void)
Definition: AI_events.cpp:2252
void Event_GetTurnRate(void)
Definition: AI_events.cpp:2650
const idEventDef AI_GetReachableEntityPosition("getReachableEntityPosition","e", 'v')
int health
Definition: Entity.h:134
idEntity * GetTraceEntity(const trace_t &trace) const
void Event_TurnToEntity(idEntity *ent)
Definition: AI_events.cpp:1037
const idEventDef AI_KickObstacles("kickObstacles","Ef")
void GetMuzzle(const char *jointname, idVec3 &muzzle, idMat3 &axis)
Definition: AI.cpp:4597
float ideal_yaw
Definition: AI.h:306
Definition: Matrix.h:333
const idEventDef AI_TriggerParticles("triggerParticles","s")
void SetClipMask(int mask, int id=-1)
float yaw
Definition: Angles.h:54
idVec3 lastVisibleEnemyEyeOffset
Definition: AI.h:408
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 Event_TriggerParticles(const char *jointName)
Definition: AI_events.cpp:2700
void UpdateVisuals(void)
Definition: Entity.cpp:1310
const idEventDef AI_MoveToCover("moveToCover")
idPhysics_Monster physicsObj
Definition: AI.h:315
void Event_JumpFrame(void)
Definition: AI_events.cpp:2205
bool GetBool(void) const
Definition: CVarSystem.h:142
void Event_GetCurrentYaw(void)
Definition: AI_events.cpp:1010
void Event_SetTurnRate(float rate)
Definition: AI_events.cpp:2659
tuple f
Definition: idal.py:89
void SetWaitState(const char *_waitstate)
Definition: Actor.cpp:2049
const idEventDef AI_GetMoveType("getMoveType", NULL, 'd')
bool af_push_moveables
Definition: AI.h:335
void Event_BecomeRagdoll(void)
Definition: AI_events.cpp:944
Definition: Actor.h:111
const idEventDef AI_FacingIdeal("facingIdeal", NULL, 'd')
int Num(void) const
Definition: List.h:265
bool MoveDone(void) const
Definition: AI.cpp:2116
int fly_offset
Definition: AI.h:323
#define ATTACK_ON_ACTIVATE
Definition: AI.h:50
idMat3 ToMat3(void) const
Definition: Angles.cpp:199
void Event_FindEnemyInCombatNodes(void)
Definition: AI_events.cpp:422
const idEventDef AI_TestMeleeAttack("testMeleeAttack", NULL, 'd')
const idEventDef AI_IgnoreDamage("ignoreDamage")
bool IntersectsBounds(const idBounds &a) const
Definition: Bounds.h:361
virtual const idBounds & GetAbsBounds(int id=-1) const =0
const idEventDef AI_GetHealth("getHealth", NULL, 'f')
idCVar ai_debugMove("ai_debugMove","0", CVAR_GAME|CVAR_BOOL,"draws movement information for monsters")
#define TFL_AIR
Definition: AASFile.h:58
void Event_AttackMelee(const char *meleeDefName)
Definition: AI_events.cpp:742
idScriptBool AI_TALK
Definition: AI.h:422
const GLcharARB * name
Definition: glext.h:3629
float turnVel
Definition: AI.h:309
const idEventDef AI_SetSmokeVisibility("setSmokeVisibility","dd")
const idEventDef AI_Burn("burn")
void Event_RandomPath(void)
Definition: AI_events.cpp:786
static float AngleNormalize180(float angle)
Definition: Math.h:910
bool GetJointWorldTransform(jointHandle_t jointHandle, int currentTime, idVec3 &offset, idMat3 &axis)
Definition: Entity.cpp:5248
const idEventDef AI_TurnToPos("turnToPos","v")
void SpawnParticles(const char *keyName)
Definition: AI.cpp:3332
#define CLASS_DECLARATION(nameofsuperclass, nameofclass)
Definition: Class.h:110
void Event_CanSeeEntity(idEntity *ent)
Definition: AI_events.cpp:1431
float anim_turn_yaw
Definition: AI.h:310
const char * GetName(void) const
Definition: Entity.cpp:875
float Normalize(void)
Definition: Vector.h:170
void Event_SetSmokeVisibility(int num, int on)
Definition: AI_events.cpp:2022
void Event_GetObstacle(void)
Definition: AI_events.cpp:2621
static void ReturnEntity(idEntity *ent)
float LengthFast(void) const
Definition: Vector.h:639
const char * c_str(void) const
Definition: Str.h:487
const idEventDef AI_AnimTurn("animTurn","f")
void Event_FireMissileAtTarget(const char *jointname, const char *targetname)
Definition: AI_events.cpp:611
void Event_ClearEnemy(void)
Definition: AI_events.cpp:551
void Event_ThrowAF(void)
Definition: AI_events.cpp:2501
idVec3 endPos
Definition: AI.h:130
int shrivel_start
Definition: AI.h:387
const idEventDef AI_CanHitEnemyFromAnim("canHitEnemyFromAnim","s", 'd')
bool MoveToEnemyHeight(void)
Definition: AI.cpp:1687
const idEventDef AI_CanSeeEntity("canSee","E", 'd')
void Event_WaitMove(void)
Definition: AI_events.cpp:1343
void BecomeActive(int flags)
Definition: Entity.cpp:995
idRenderSystemLocal tr
bool ignore_obstacles
Definition: AI.h:300
void Event_StopMove(void)
Definition: AI_events.cpp:1057
void TranslationEntities(trace_t &results, const idVec3 &start, const idVec3 &end, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
Definition: Clip.cpp:995
const int ANIMCHANNEL_TORSO
Definition: Anim.h:42
void Event_PreBurn(void)
Definition: AI_events.cpp:1985
int anim
Definition: AI.h:209
void Event_CanHitEnemy(void)
Definition: AI_events.cpp:1571
const int * GetPVSAreas(void)
Definition: Entity.cpp:1375
#define MASK_SHOT_BOUNDINGBOX
Definition: Game_local.h:742
void Event_BecomeNonSolid(void)
Definition: AI_events.cpp:933
const idEventDef AI_TravelDistanceBetweenPoints("travelDistanceBetweenPoints","vv", 'f')
bool lastHitCheckResult
Definition: AI.h:338
idEntityPtr< idProjectile > projectile
Definition: AI.h:351
const idEventDef AI_EnemyPositionValid("enemyPositionValid", NULL, 'd')
float range
Definition: AI.h:202
const idEventDef AI_DisableGravity("disableGravity")
const idMat3 & GetGravityAxis(void) const
const idEventDef AI_LocateEnemy("locateEnemy")
const int ANIMCHANNEL_LEGS
Definition: Anim.h:43
bool FaceEnemy(void)
Definition: AI.cpp:1602
GLint j
Definition: qgl.h:264
bool AttackMelee(const char *meleeDefName)
Definition: AI.cpp:4470
virtual void PushPointIntoAreaNum(int areaNum, idVec3 &origin) const =0
const idEventDef AI_SetTalkTarget("setTalkTarget","E")
virtual void DebugBounds(const idVec4 &color, const idBounds &bounds, const idVec3 &org=vec3_origin, const int lifetime=0)=0
const idEventDef AI_BecomeSolid("becomeSolid")
Definition: AI.h:64
idList< idVec3 > missileLaunchOffset
Definition: AI.h:343
const char * GetEntityDefName(void) const
Definition: Entity.cpp:842
void Event_GetTurnDelta(void)
Definition: AI_events.cpp:2076
idRenderWorld * gameRenderWorld
Definition: Game_local.cpp:55
void Event_LookAtEnemy(float duration)
Definition: AI_events.cpp:2452
void Event_AllowMovement(float flag)
Definition: AI_events.cpp:2196
idVec3 moveDest
Definition: AI.h:194
void StopMove(moveStatus_t status)
Definition: AI.cpp:1574
bool Translation(trace_t &results, const idVec3 &start, const idVec3 &end, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
Definition: Clip.cpp:1056
void Event_CanReachPosition(const idVec3 &pos)
Definition: AI_events.cpp:2732
const idEventDef AI_AllowDamage("allowDamage")
bool PostEventMS(const idEventDef *ev, int time)
Definition: Class.cpp:666
void Event_GetRandomTarget(const char *type)
Definition: AI_events.cpp:2350
const idEventDef AI_GetTurnDelta("getTurnDelta", NULL, 'f')
moveType_t moveType
Definition: AI.h:191
idScriptBool AI_PUSHED
Definition: AI.h:440
const idEventDef AI_SetTalkState("setTalkState","d")
const idEventDef AI_DisableClip("disableClip")
idStr name
Definition: Entity.h:121
const idEventDef AI_Kill("kill")
void Event_MoveToAttackPosition(idEntity *entity, const char *attack_anim)
Definition: AI_events.cpp:1112
void Unlink(void)
Definition: Clip.cpp:491
const idEventDef EV_SetAngles("setAngles","v")
talkState_t
Definition: AI.h:84
const idEventDef AI_PushPointIntoAAS("pushPointIntoAAS","v", 'v')
const idEventDef EV_Touch("<touch>","et")
idList< particleEmitter_t > particles
Definition: AI.h:391
void Event_MoveToPosition(const idVec3 &pos)
Definition: AI_events.cpp:1142
void Event_StopRagdoll(void)
Definition: AI_events.cpp:956
const idEventDef AI_GetCurrentYaw("getCurrentYaw", NULL, 'f')
const idEventDef AI_LaunchMissile("launchMissile","vv", 'e')
float shaderParms[MAX_ENTITY_SHADER_PARMS]
Definition: RenderWorld.h:127
const idEventDef AI_MoveToPosition("moveToPosition","v")
const idBounds & GetBounds(int id=-1) const
idEntityPtr< idEntity > goalEntity
Definition: AI.h:196
void BecomeInactive(int flags)
Definition: Entity.cpp:1025
const idEventDef AI_ClearEnemy("clearEnemy")
static void ReturnInt(int value)
int travelFlags
Definition: AI.h:294
float turnRate
Definition: AI.h:308
const idEventDef AI_TestAnimMove("testAnimMove","s", 'd')
void Event_FindEnemyAI(int useFOV)
Definition: AI_events.cpp:378
const idEventDef AI_GetClosestHiddenTarget("getClosestHiddenTarget","s", 'e')
void TriggerParticles(const char *jointName)
Definition: AI.cpp:4830
const idEventDef AI_WaitAction("waitAction","s")
idLinkList< idEntity > activeNode
Definition: Entity.h:115
const idEventDef AI_EntityInAttackCone("entityInAttackCone","E", 'd')
const idEventDef AI_TestChargeAttack("testChargeAttack", NULL, 'f')
const idEventDef AI_MoveToAttackPosition("moveToAttackPosition","es")
const idEventDef EV_GetAngles("getAngles", NULL, 'v')
bool IsRenderModel(void) const
Definition: Clip.h:214
const idEventDef AI_FindEnemyAI("findEnemyAI","d", 'e')
GLuint start
Definition: glext.h:2845
const idEventDef AI_ClearFlyOffset("clearFlyOffset")
Definition: AI.h:253
bool StartRagdoll(void)
Definition: Actor.cpp:1651
void Event_ClearBurn(void)
Definition: AI_events.cpp:2011
void Event_TravelDistanceBetweenPoints(const idVec3 &source, const idVec3 &dest)
Definition: AI_events.cpp:2406
int alignHeadTime
Definition: AI.h:370
idMoveState savedMove
Definition: AI.h:297
const idEventDef EV_BecomeNonSolid("becomeNonSolid")
void EnableClip(void)
void Event_RadiusDamageFromJoint(const char *jointname, const char *damageDefName)
Definition: AI_events.cpp:763
const idEventDef AI_MoveToEntity("moveToEntity","e")
GLdouble GLdouble t
Definition: glext.h:2943
const idEventDef AI_PreBurn("preBurn")
bool allowMove
Definition: AI.h:332
float shrivel_rate
Definition: AI.h:386