53#include "simpleentity.h"
54#include "../qcommon/delegate.h"
75 AI_EVENT_WEAPON_IMPACT,
77 AI_EVENT_AMERICAN_VOICE,
78 AI_EVENT_GERMAN_VOICE,
79 AI_EVENT_AMERICAN_URGENT,
80 AI_EVENT_GERMAN_URGENT,
93#define DEAD_RESPAWNABLE 3
96extern Event EV_SoundDone;
97extern Event EV_Classname;
98extern Event EV_Activate;
99extern Event EV_ForceActivate;
101extern Event EV_FadeNoRemove;
102extern Event EV_FadeOut;
103extern Event EV_FadeIn;
105extern Event EV_Killed;
106extern Event EV_GotKill;
108extern Event EV_Damage;
112extern Event EV_DeathSinkStart;
113extern Event EV_Entity_AddImmunity;
114extern Event EV_Entity_RemoveImmunity;
117extern Event EV_MoveDone;
118extern Event EV_Touch;
119extern Event EV_Blocked;
120extern Event EV_Attach;
121extern Event EV_AttachModel;
122extern Event EV_RemoveAttachedModel;
123extern Event EV_Detach;
124extern Event EV_DetachAllChildren;
125extern Event EV_UseBoundingBox;
126extern Event EV_IsTouching;
129extern Event EV_NewAnim;
130extern Event EV_LastFrame;
131extern Event EV_TakeDamage;
132extern Event EV_NoDamage;
135extern Event EV_Model;
136extern Event EV_GetModel;
139extern Event EV_BecomeSolid;
140extern Event EV_BecomeNonSolid;
141extern Event EV_Sound;
142extern Event EV_StopSound;
144extern Event EV_Unbind;
146extern Event EV_Unglue;
147extern Event EV_JoinTeam;
148extern Event EV_QuitTeam;
149extern Event EV_SetHealth;
150extern Event EV_SetHealth2;
151extern Event EV_Entity_GetHealth;
152extern Event EV_SetSize;
153extern Event EV_SetAlpha;
154extern Event EV_SetTargetName;
155extern Event EV_SetTarget;
156extern Event EV_SetKillTarget;
157extern Event EV_StartAnimating;
158extern Event EV_SurfaceModelEvent;
160extern Event EV_StopLoopSound;
161extern Event EV_SetControllerAngles;
162extern Event EV_CanSee;
174extern Event EV_BroadcastAIEvent;
193#define MAX_MODEL_CHILDREN 16
194#define MAX_GLUE_CHILDREN 8
196#define GL_USEANGLES 1
202class Entity :
public SimpleEntity
205 CLASS_PROTOTYPE(Entity);
230 float orientation[3][3];
231 gentity_t *groundentity;
232 cplane_t groundplane;
237 int children[MAX_MODEL_CHILDREN];
244 class Entity *teamchain;
245 class Entity *teammaster;
248 class Entity *bindmaster;
249 qboolean bind_use_my_angles;
270 float damage_debounce_time;
275 EntityPtr m_pGlues[MAX_GLUE_CHILDREN];
276 int m_pGluesFlags[MAX_GLUE_CHILDREN];
277 class Entity *m_pGlueMaster;
279 bool m_bGlueDuckable;
280 qboolean detach_at_death;
283 float stealthMovementScale;
285 int m_iNumBlockedPaths;
295 bool m_bHintRequiresLookAt;
309 void EventGetNormalHealth(
Event *ev);
310 void EventNormalDamage(
Event *ev);
311 void ClassnameEvent(
Event *ev);
312 void SpawnFlagsEvent(
Event *ev);
313 void EventRevive(
Event *ev);
315 virtual void ShowInfo(
float fDot,
float fDist);
317 qboolean DistanceTo(
Vector pos)
const;
318 qboolean DistanceTo(Entity *ent)
const;
319 qboolean WithinDistance(
Vector pos,
float dist)
const;
320 qboolean WithinDistance(Entity *ent,
float dist)
const;
322 Vector GetControllerAngles(
int num);
323 void SetControllerAngles(
int num, vec3_t angles);
324 void SetControllerAngles(
Event *ev);
325 void GetControllerAngles(
Event *ev);
326 void SetControllerTag(
int num,
int tag_num);
327 int GetControllerTag(
int num)
const;
329 void GetTagPositionAndOrientation(
int tagnum,
orientation_t *new_or);
330 void GetTagPosition(
Event *ev);
331 void GetTagAngles(
Event *ev);
333 void EventTrace(
Event *ev);
334 void EventSightTrace(
Event *ev);
335 void EventInPVS(
Event *ev);
336 void IsTouching(
Event *ev);
337 void IsInside(
Event *ev);
338 void CanSeeInternal(
Event *ev,
bool bNoEnts);
339 void CanSee(
Event *ev);
340 void CanSeeNoEnts(
Event *ev);
342 void SetKillTarget(
const char *killtarget);
343 const char *KillTarget(
void);
345 void AlwaysDraw(
Event *ev);
346 void NormalDraw(
Event *ev);
347 void NeverDraw(
Event *ev);
349 const char *getModel()
const;
350 void GetModelEvent(
Event *ev);
351 void GetBrushModelEvent(
Event *ev);
352 virtual qboolean setModel(
void);
354 void setModel(
const str &mdl);
355 void SetModelEvent(
Event *ev);
357 void SetTeamEvent(
Event *ev);
358 virtual void TriggerEvent(
Event *ev);
359 void hideModel(
void);
360 void EventHideModel(
Event *ev);
361 virtual void showModel(
void);
362 void EventShowModel(
Event *ev);
363 qboolean hidden(
void);
364 void ProcessInitCommands(
void);
366 void setAlpha(
float alpha);
369 void setMoveType(
int type);
370 int getMoveType(
void);
372 void setSolidType(solid_t type);
373 int getSolidType(
void);
375 virtual void setContentsSolid(
void);
381 virtual void updateOrigin(
void);
382 virtual void setLocalOrigin(
Vector org);
383 void setOrigin(
Vector org)
override;
384 void setOriginEvent(
Vector org)
override;
385 virtual void setOrigin(
void);
386 virtual void addOrigin(
Vector org);
389 qboolean GetRawTag(
const char *tagname,
orientation_t *orient);
396 virtual int CurrentAnim(
int slot = 0)
const;
397 virtual float CurrentTime(
int slot = 0)
const;
398 void ClearAnimSlot(
int slot);
399 void StartAnimSlot(
int slot,
int index,
float weight);
400 void RestartAnimSlot(
int slot);
402 void setAngles(
Vector ang)
override;
403 virtual void setAngles(
void);
408 void setContents(
int type);
409 int getContents(
void);
410 void setScale(
float scale);
412 qboolean droptofloor(
float maxfall);
413 qboolean isClient(
void);
415 virtual void SetDeltaAngles(
void);
416 virtual void DamageEvent(
Event *event);
430 void DamageType(
Event *ev);
431 qboolean IsTouching(Entity *e1);
432 qboolean IsInside(Entity *e1);
433 qboolean FovCheck(
float *delta,
float fovdot);
435 virtual bool CanSee(Entity *ent,
float fov,
float vision_distance,
bool bNoEnts =
false);
436 virtual bool CanSee(
const Vector& org,
float fov,
float vision_distance,
bool bNoEnts =
false);
437 bool AreasConnected(
const Entity *other);
438 void FadeNoRemove(
Event *ev);
439 void FadeOut(
Event *ev);
440 void FadeIn(
Event *ev);
441 void Fade(
Event *ev);
442 void Sink(
Event *ev);
444 virtual void CheckGround(
void);
445 virtual qboolean HitSky(
trace_t *trace);
446 virtual qboolean HitSky(
void);
448 void SafeSolid(
Event *ev);
449 void BecomeSolid(
Event *ev);
450 void BecomeNonSolid(
Event *ev);
451 void SetSize(
Event *ev);
452 void SetMins(
Event *ev);
453 void SetMaxs(
Event *ev);
456 void GetMins(
Event *ev);
457 void GetMaxs(
Event *ev);
459 void SetScale(
Event *ev);
460 void GetScale(
Event *ev);
461 void SetAlpha(
Event *ev);
462 void SetKillTarget(
Event *ev);
463 void TouchTriggersEvent(
Event *ev);
465 str GetRandomAlias(
str name, AliasListNode_t **ret);
466 void SetWaterType(
void);
470 attach(
int parent_entity_num,
int tag_num, qboolean use_angles = qtrue,
Vector attach_offset =
Vector(
"0 0 0"));
476 void ProcessSoundEvent(
Event *ev, qboolean checkSubtitle);
477 void Sound(
Event *ev);
480 int channel = CHAN_BODY,
482 float min_dist = -1.0,
487 int checkSubtitle = 1,
488 float max_dist = -1.0f
490 void StopSound(
int channel);
491 void StopSound(
Event *ev);
492 void LoopSound(
Event *ev);
494 LoopSound(
str sound_name,
float volume = -1.0,
float min_dist = -1.0,
float max_dist = -1.0,
float pitch = -1.0);
495 void StopLoopSound(
Event *ev);
496 void StopLoopSound(
void);
497 void StopAllSounds();
499 void SetLight(
Event *ev);
500 void LightOn(
Event *ev);
501 void LightOff(
Event *ev);
502 void LightRed(
Event *ev);
503 void LightGreen(
Event *ev);
504 void LightBlue(
Event *ev);
505 void LightRadius(
Event *ev);
506 void LightStyle(
Event *ev);
507 void Flags(
Event *ev);
508 void Effects(
Event *ev);
509 void RenderEffects(
Event *ev);
510 void SVFlags(
Event *ev);
512 void BroadcastAIEvent(
int iType = AI_EVENT_MISC,
float rad = SOUND_RADIUS);
513 void BroadcastAIEvent(
Event *ev);
514 void Kill(
Event *ev);
515 virtual void Killed(
Event *ev);
516 void SurfaceModelEvent(
Event *ev);
517 void SurfaceCommand(
const char *surf_name,
const char *token);
518 virtual void Postthink(
void);
519 virtual void Think(
void);
521 void DamageSkin(
trace_t *trace,
float damage);
523 void AttachEvent(
Event *ev);
524 void AttachModelEvent(
Event *ev);
525 void RemoveAttachedModelEvent(
Event *ev);
526 void AttachedModelAnimEvent(
Event *ev);
527 void DetachEvent(
Event *ev);
528 void TakeDamageEvent(
Event *ev);
529 void NoDamageEvent(
Event *ev);
530 void Gravity(
Event *ev);
531 void GiveOxygen(
float time);
532 void UseBoundingBoxEvent(
Event *ev);
533 void HurtEvent(
Event *ev);
534 void HealEvent(
Event *ev);
535 void SetMassEvent(
Event *ev);
536 void Censor(
Event *ev);
537 void Ghost(
Event *ev);
539 void StationaryEvent(
Event *ev);
540 void TossEvent(
Event *ev);
541 void Explosion(
Event *ev);
543 void Shader(
Event *ev);
545 void KillAttach(
Event *ev);
546 void SetBloodModel(
Event *ev);
548 void DropToFloorEvent(
Event *ev);
551 void joinTeam(Entity *teammember);
553 qboolean isBoundTo(Entity *master);
554 virtual void bind(Entity *master, qboolean use_my_angles = qfalse);
555 virtual void unbind(
void);
556 virtual void glue(Entity *master, qboolean use_my_angles = qtrue, qboolean can_duck = qfalse);
557 virtual void unglue(
void);
558 void GlueEvent(
Event *ev);
559 void DuckableGlueEvent(
Event *ev);
560 void MakeClayPidgeon(
Event *ev);
561 void EventUnglue(
Event *ev);
563 void JoinTeam(
Event *ev);
564 void EventQuitTeam(
Event *ev);
565 void BindEvent(
Event *ev);
566 void EventUnbind(
Event *ev);
567 void AddToSoundManager(
Event *ev);
568 void NoLerpThisFrame(
void);
570 virtual void addAngles(
Vector add);
572 void DeathSinkStart(
Event *ev);
573 void DeathSink(
Event *ev);
575 void DetachAllChildren(
Event *ev);
576 void SetMovementStealth(
float fStealthScale);
577 void EventMovementStealth(
Event *ev);
579 virtual void VelocityModified(
void);
581 qboolean CheckEventFlags(
Event *event);
582 void PusherEvent(
Event *ev);
583 void SetShaderData(
Event *ev);
585 void GetVelocity(
Event *ev);
586 void SetVelocity(
Event *ev);
587 void GetAVelocity(
Event *ev);
588 void DoForceActivate(
void);
589 void ForceActivate(
Event *ev);
591 void ConnectPaths(
void);
592 void DisconnectPaths(
void);
594 void EventConnectPaths(
Event *ev);
595 void EventDisconnectPaths(
Event *ev);
596 virtual void Delete(
void);
597 void Remove(
Event *ev);
598 void EventSoundDone(
Event *ev);
600 void VolumeDamage(
float damage);
601 void EventVolumeDamage(
Event *ev);
603 virtual qboolean IsDead()
const;
604 virtual void AddImmunity(
Event *ev);
605 virtual void RemoveImmunity(
Event *ev);
606 qboolean Immune(
int meansofdeath);
608 virtual void ClientThink(
void);
610 virtual void EndFrame(
void);
611 virtual void CalcBlend(
void);
612 void Archive(
Archiver &arc)
override;
613 virtual bool AutoArchiveModel(
void);
614 virtual void PathnodeClaimRevoked(
class PathNode *node);
615 virtual qboolean BlocksAIMovement()
const;
616 virtual qboolean AIDontFace(
void)
const;
617 void SetHealth(
Event *ev);
618 void GetHealth(
Event *ev);
619 void EventSetMaxHealth(
Event *ev);
620 void EventGetMaxHealth(
Event *ev);
621 void EventSetHealthOnly(
Event *ev);
622 void GetYaw(
Event *ev);
624 virtual void PreAnimate(
void);
625 virtual void PostAnimate(
void);
626 virtual bool HasVehicle(
void)
const;
627 void EventGetEntnum(
Event *ev);
628 void EventGetClassname(
Event *ev);
629 void EventSetRadnum(
Event *ev);
630 void EventGetRadnum(
Event *ev);
631 void EventSetRotatedBbox(
Event *ev);
632 void EventGetRotatedBbox(
Event *ev);
633 void MPrintf(
const char *msg, ...);
634 void DrawBoundingBox(
int showbboxes);
636 void EventSinglePlayerCommand(
Event *ev);
637 void EventMultiPlayerCommand(
Event *ev);
638 void EventRealismModeCommand(
Event *ev);
639 void EventSPRealismModeCommand(
Event *ev);
640 void EventDMRealismModeCommand(
Event *ev);
641 void GetLocalYawFromVector(
Event *ev);
642 void EventShootableOnly(
Event *ev);
643 void SetShaderTime(
Event *ev);
644 void NoTarget(
Event *ev);
649 void ProcessHint(gentity_t *client,
bool bShow);
650 void GetZone(
Event *ev);
651 void IsInZone(
Event *ev);
652 void SetDepthHack(
Event *ev);
654 void SetHintRequireLookAt(
Event *ev);
655 void SetHintString(
Event *ev);
656 void SetShader(
Event* ev);
658 void PlayNonPvsSound(
const str& soundName,
float volume = 1);
661inline void Entity::PreAnimate(
void) {}
663inline void Entity::PostAnimate(
void) {}
665inline bool Entity::HasVehicle(
void)
const
670inline int Entity::getSolidType(
void)
676inline qboolean Entity::DistanceTo(
Vector pos)
const
681 delta = origin - pos;
682 return delta.length() != 0 ? qtrue : qfalse;
685inline qboolean Entity::DistanceTo(
Entity *ent)
const
696 delta = origin - ent->origin;
697 return delta.length() != 0 ? qtrue : qfalse;
700inline qboolean Entity::WithinDistance(
Vector pos,
float dist)
const
704 delta = origin - pos;
707 return ((delta * delta) < (dist * dist)) ? qtrue : qfalse;
710inline qboolean Entity::WithinDistance(
Entity *ent,
float dist)
const
721 delta = origin - ent->origin;
724 return ((delta * delta) < (dist * dist));
727inline const char *Entity::KillTarget(
void)
730 return killtarget.c_str();
733inline qboolean Entity::hidden(
void)
735 if (edict->s.renderfx & RF_DONTDRAW) {
741inline void Entity::GetBrushModelEvent(
Event *ev)
743 ev->AddString(model);
746inline void Entity::GetModelEvent(
Event *ev)
753 const char *name = gi.TIKI_NameForNum(edict->tiki);
757 ev->AddString(model);
767inline void Entity::hideModel(
void)
769 edict->s.renderfx |= RF_DONTDRAW;
770 if (getSolidType() <= SOLID_TRIGGER) {
771 edict->r.svFlags |= SVF_NOCLIENT;
775inline void Entity::showModel(
void)
777 edict->s.renderfx &= ~RF_DONTDRAW;
778 edict->r.svFlags &= ~SVF_NOCLIENT;
781inline float Entity::alpha(
void)
784 return edict->s.alpha;
787inline void Entity::setMoveType(
int type)
793inline int Entity::getMoveType(
void)
799inline void Entity::unlink(
void)
802 gi.unlinkentity(edict);
805inline void Entity::setContents(
int type)
808 edict->r.contents = type;
811inline int Entity::getContents(
void)
813 return edict->r.contents;
816inline qboolean Entity::isClient(
void)
824inline void Entity::SetDeltaAngles(
void)
830 for (i = 0; i < 3; i++) {
831 client->ps.delta_angles[i] = ANGLE2SHORT(client->ps.viewangles[i]);
836inline str Entity::GetRandomAlias(
str name, AliasListNode_t **ret)
842 s = gi.Alias_FindRandom(edict->tiki, name.c_str(), ret);
850 s = gi.GlobalAlias_FindRandom(name.c_str(), ret);
859inline bool Entity::AreasConnected(
const Entity *other)
861 return gi.AreasConnected(edict->r.areanum, other->edict->r.areanum) != 0;
864#include "worldspawn.h"
Definition container.h:85
Definition listener.h:246
Definition navigate.h:153
Definition scriptmaster.h:42
Definition q_shared.h:1524
Definition q_shared.h:1452