UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g_events.cpp
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #include "g_local.h" /* also includes g_event.h */
26 #include "g_actor.h"
27 #include "g_client.h"
28 #include "g_edicts.h"
29 #include "g_inventory.h"
30 
40 void G_EventSpawnSound (playermask_t playerMask, const Edict& ent, const vec3_t origin, const char* sound)
41 {
42  G_EventAdd(playerMask, EV_SOUND, ent.getIdNum());
43 
44  /* use the entity origin unless it is a bmodel or explicitly specified */
45  if (!origin) {
46  if (ent.solid == SOLID_BSP) {
47  vec3_t origin_v;
48  ent.entBox.getCenter(origin_v);
49  VectorAdd(ent.origin, origin_v, origin_v);
50  gi.WritePos(origin);
51  } else {
52  gi.WritePos(vec3_origin);
53  }
54  } else {
55  gi.WritePos(origin);
56  }
57  gi.WriteByte(0xFF);
58  gi.WriteString(sound);
59  G_EventEnd();
60 }
61 
62 void G_EventSpawnFootstepSound (const Edict& ent, const char* sound)
63 {
64  const playermask_t playerMask = ~G_VisToPM(ent.visflags);
65  gi.QueueEvent(playerMask, EV_SOUND, ent.getIdNum());
66  gi.QueueWritePos(ent.origin);
67  gi.QueueWriteByte(ent.moveinfo.steps);
68  gi.QueueWriteString(sound);
69 }
70 
77 void G_EventActorTurn (const Edict& ent)
78 {
80  gi.WriteByte(ent.dir);
81  G_EventEnd();
82 }
83 
89 void G_EventActorDie (const Edict& ent, bool attacker)
90 {
92  gi.WriteShort(ent.state);
93  gi.WriteByte(ent.getPlayerNum());
94  gi.WriteByte(attacker);
95  G_EventEnd();
96 }
97 
102 void G_EventActorRevitalise (const Edict& ent)
103 {
105  gi.WriteShort(ent.state);
106  G_EventEnd();
107 }
108 
114 {
116  const chrReservations_t& reservedTUs = ent.chr.reservedTus;
117  gi.WriteShort(reservedTUs.reaction);
118  gi.WriteShort(reservedTUs.shot);
119  gi.WriteShort(reservedTUs.crouch);
120 
121  G_EventEnd();
122 }
123 
131 void G_EventInventoryDelete (const Edict& ent, playermask_t playerMask, const containerIndex_t containerId, int x, int y)
132 {
133  G_EventAdd(playerMask, EV_INV_DEL, ent.getIdNum());
134  gi.WriteByte(containerId);
135  gi.WriteByte(x);
136  gi.WriteByte(y);
137  G_EventEnd();
138 }
139 
147 void G_EventInventoryAdd (const Edict& ent, playermask_t playerMask, int itemAmount)
148 {
149  G_EventAdd(playerMask, EV_INV_ADD, ent.getIdNum());
150  gi.WriteShort(itemAmount);
151  /* do not end the pending events here - this is just a header, the items are following */
152 }
153 
158 void G_EventPerish (const Edict& ent)
159 {
161 }
162 
167 void G_EventDestroyEdict (const Edict& ent)
168 {
169  assert(ent.inuse);
171  G_EventEnd();
172 }
173 
181 void G_EventInventoryAmmo (const Edict& ent, const objDef_t* ammo, int amount, shoot_types_t shootType)
182 {
184  gi.WriteByte(amount);
185  gi.WriteByte(ammo->idx);
186  if (IS_SHOT_RIGHT(shootType))
187  gi.WriteByte(CID_RIGHT);
188  else
189  gi.WriteByte(CID_LEFT);
190  /* x and y value */
191  gi.WriteByte(0);
192  gi.WriteByte(0);
193  G_EventEnd();
194 }
195 
203 void G_EventStartShoot (const Edict& ent, teammask_t teamMask, shoot_types_t shootType, const pos3_t at)
204 {
206  gi.WriteByte(shootType);
207  gi.WriteGPos(ent.pos);
208  gi.WriteGPos(at);
209  G_EventEnd();
210 }
211 
217 void G_EventEndShoot (const Edict &ent, teammask_t teamMask)
218 {
219  G_EventAdd(G_VisToPM(teamMask), EV_ACTOR_END_SHOOT, ent.getIdNum());
220  G_EventEnd();
221 }
222 
232 void G_EventShootHidden (teammask_t teamMask, const fireDef_t* fd, bool firstShoot, const vec3_t impact, int flags, const Edict* targetEdict)
233 {
234  G_EventAdd(~G_VisToPM(teamMask), EV_ACTOR_SHOOT_HIDDEN, -1);
235  if (targetEdict && G_IsBreakable(targetEdict))
236  gi.WriteShort(targetEdict->getIdNum());
237  else
238  gi.WriteShort(SKIP_LOCAL_ENTITY);
239  gi.WriteByte(firstShoot);
240  gi.WriteShort(fd->obj->idx);
241  gi.WriteByte(fd->weapFdsIdx);
242  gi.WriteByte(fd->fdIdx);
243  gi.WritePos(impact);
244  gi.WriteByte(flags);
245  G_EventEnd();
246 }
247 
260 void G_EventShoot (const Edict& ent, teammask_t teamMask, const fireDef_t* fd, bool firstShoot, shoot_types_t shootType, int flags, const trace_t* trace, const vec3_t from, const vec3_t impact)
261 {
262  const Edict* targetEdict = G_EdictsGetByNum(trace->entNum); /* the ent possibly hit by the trace */
263 
264  G_EventAdd(G_VisToPM(teamMask), EV_ACTOR_SHOOT, ent.getIdNum());
265  if (targetEdict && G_IsBreakable(targetEdict))
266  gi.WriteShort(targetEdict->getIdNum());
267  else
268  gi.WriteShort(SKIP_LOCAL_ENTITY);
269  gi.WriteByte(firstShoot ? 1 : 0);
270  gi.WriteShort(fd->obj->idx);
271  gi.WriteByte(fd->weapFdsIdx);
272  gi.WriteByte(fd->fdIdx);
273  gi.WriteByte(shootType);
274  gi.WriteByte(flags);
275  gi.WriteByte(trace->contentFlags);
276  gi.WritePos(from);
277  gi.WritePos(impact);
278  gi.WriteDir(trace->plane.normal);
279  G_EventEnd();
280 }
281 
283 {
284  const FiremodeSettings& fireMode = ent.chr.RFmode;
285  const objDef_t* od = fireMode.getWeapon();
286 
288  gi.WriteByte(fireMode.getFmIdx());
289  gi.WriteByte(fireMode.getHand());
290  gi.WriteShort(od ? od->idx : NONE);
291 
292  G_EventEnd();
293 }
294 
295 void G_EventReactionFireAddTarget (const Edict& shooter, const Edict& target, int tus, int step)
296 {
297  gi.QueueEvent(G_PlayerToPM(shooter.getPlayer()), EV_ACTOR_REACTIONFIREADDTARGET, shooter.getIdNum());
298  gi.QueueWriteShort(target.getIdNum());
299  gi.QueueWriteByte(tus);
300  gi.QueueWriteByte(step);
301 }
302 
303 void G_EventReactionFireRemoveTarget (const Edict& shooter, const Edict& target, int step)
304 {
305  gi.QueueEvent(G_PlayerToPM(shooter.getPlayer()), EV_ACTOR_REACTIONFIREREMOVETARGET, shooter.getIdNum());
306  gi.QueueWriteShort(target.getIdNum());
307  gi.QueueWriteByte(step);
308 }
309 
310 void G_EventReactionFireTargetUpdate (const Edict& shooter, const Edict& target, int tus, int step)
311 {
312  gi.QueueEvent(G_PlayerToPM(shooter.getPlayer()), EV_ACTOR_REACTIONFIRETARGETUPDATE, shooter.getIdNum());
313  gi.QueueWriteShort(target.getIdNum());
314  gi.QueueWriteByte(tus);
315  gi.QueueWriteByte(step);
316 }
317 
318 void G_EventReactionFireAbortShot (const Edict& shooter, const Edict& target, int step)
319 {
320  gi.QueueEvent(G_PlayerToPM(shooter.getPlayer()), EV_ACTOR_REACTIONFIREABORTSHOT, shooter.getIdNum());
321  gi.QueueWriteShort(target.getIdNum());
322  gi.QueueWriteByte(step);
323 }
324 
334 void G_EventParticleSpawn (playermask_t playerMask, const char* name, int levelFlags, const vec3_t s, const vec3_t v, const vec3_t a)
335 {
336  G_EventAdd(playerMask, EV_PARTICLE_SPAWN, -1);
337  gi.WriteByte(levelFlags);
338  gi.WritePos(s);
339  gi.WritePos(v);
340  gi.WritePos(a);
341  gi.WriteString(name);
342  G_EventEnd();
343 }
344 
345 void G_EventActorFall (const Edict& ent)
346 {
348  gi.WriteByte(0);
349  gi.WriteShort(makeDV(DIRECTION_FALL, ent.pos[2]));
350  gi.WriteShort(GRAVITY);
351  gi.WriteShort(0);
352  G_EventEnd();
353 }
354 
360 void G_EventSetClientAction (const Edict& ent)
361 {
362  assert(ent.clientAction);
363  assert(ent.clientAction->flags & FL_CLIENTACTION);
364 
365  /* tell the hud to show the door buttons */
367  gi.WriteShort(ent.clientAction->getIdNum());
368  G_EventEnd();
369 }
370 
377 {
378  const int playerMask = G_PlayerToPM(ent.getPlayer());
379  G_EventAdd(playerMask, EV_RESET_CLIENT_ACTION, ent.getIdNum());
380  G_EventEnd();
381 }
382 
383 void G_EventActorStats (const Edict& ent, playermask_t playerMask)
384 {
385  G_EventAdd(playerMask, EV_ACTOR_STATS, ent.getIdNum());
386  gi.WriteByte(ent.TU);
387  gi.WriteShort(ent.HP);
388  gi.WriteByte(ent.getStun());
389  gi.WriteByte(ent.morale);
390  G_EventEnd();
391 }
392 
399 void G_EventActorWound (const Edict& ent, const int bodyPart)
400 {
401  const int mask = G_PlayerToPM(ent.getPlayer());
402  G_EventAdd(mask, EV_ACTOR_WOUND, ent.getIdNum());
403  gi.WriteByte(bodyPart);
404  const woundInfo_t& wounds = ent.chr.wounds;
405  gi.WriteByte(wounds.woundLevel[bodyPart]);
406  gi.WriteByte(wounds.treatmentLevel[bodyPart]);
407  G_EventEnd();
408 }
409 
414 void G_EventEndRound (void)
415 {
417  gi.WriteByte(level.activeTeam);
418  G_EventEnd();
419 }
420 
421 void G_EventInventoryReload (const Edict& ent, playermask_t playerMask, const Item* item, const invDef_t* invDef, const Item* ic)
422 {
423  G_EventAdd(playerMask, EV_INV_RELOAD, ent.getIdNum());
424  gi.WriteByte(item->def()->ammo);
425  gi.WriteByte(item->ammoDef()->idx);
426  gi.WriteByte(invDef->id);
427  gi.WriteByte(ic->getX());
428  gi.WriteByte(ic->getY());
429  G_EventEnd();
430 }
431 
440 void G_EventThrow (teammask_t teamMask, const fireDef_t* fd, float dt, byte flags, const vec3_t position, const vec3_t velocity)
441 {
442  G_EventAdd(G_VisToPM(teamMask), EV_ACTOR_THROW, -1);
443  gi.WriteShort(dt * 1000);
444  gi.WriteShort(fd->obj->idx);
445  gi.WriteByte(fd->weapFdsIdx);
446  gi.WriteByte(fd->fdIdx);
447  gi.WriteByte(flags);
448  gi.WritePos(position);
449  gi.WritePos(velocity);
450  G_EventEnd();
451 }
452 
457 void G_EventSendEdict (const Edict& ent)
458 {
460  gi.WriteByte(ent.type);
461  gi.WritePos(ent.absBox.mins);
462  gi.WritePos(ent.absBox.maxs);
463  G_EventEnd();
464 }
465 
466 void G_EventSendState (playermask_t playerMask, const Edict& ent)
467 {
468  G_EventActorStateChange(playerMask & G_TeamToPM(ent.getTeam()), ent);
469 
470  G_EventAdd(playerMask & ~G_TeamToPM(ent.getTeam()), EV_ACTOR_STATECHANGE, ent.getIdNum());
471  gi.WriteShort(ent.state & STATE_PUBLIC);
472  G_EventEnd();
473 }
474 
479 void G_EventCenterView (const Edict& ent)
480 {
482 }
483 
489 void G_EventCenterViewAt (playermask_t playerMask, const pos3_t pos)
490 {
491  G_EventAdd(playerMask, EV_CENTERVIEW, -1);
492  gi.WriteGPos(pos);
493  G_EventEnd();
494 }
495 
501 void G_EventMoveCameraTo (playermask_t playerMask, const pos3_t pos)
502 {
503  G_EventAdd(playerMask, EV_MOVECAMERA, -1);
504  gi.WriteGPos(pos);
505  G_EventEnd();
506 }
507 
511 void G_EventActorAdd (playermask_t playerMask, const Edict& ent, const bool instant)
512 {
513  G_EventAdd(playerMask, EV_ACTOR_ADD | (instant ? EVENT_INSTANTLY : 0), ent.getIdNum());
514  gi.WriteByte(ent.getTeam());
515  gi.WriteByte(ent.chr.teamDef ? ent.chr.teamDef->idx : NONE);
516  gi.WriteByte(ent.chr.gender);
517  gi.WriteByte(ent.getPlayerNum());
518  gi.WriteGPos(ent.pos);
519  gi.WriteShort(ent.state & STATE_PUBLIC);
520  gi.WriteByte(ent.fieldSize);
521  G_EventEnd();
522 }
523 
529 void G_EventSendParticle (playermask_t playerMask, const Edict& ent)
530 {
531  G_EventAdd(playerMask, EV_PARTICLE_APPEAR, ent.getIdNum());
532  gi.WriteShort(ent.spawnflags);
533  gi.WritePos(ent.origin);
534  gi.WriteString(ent.particle);
535  G_EventEnd();
536 }
537 
543 void G_EventCameraAppear (playermask_t playerMask, const Edict& ent)
544 {
545  G_EventAdd(playerMask, EV_CAMERA_APPEAR, ent.getIdNum());
546  gi.WritePos(ent.origin);
547  gi.WriteByte(ent.getTeam());
548  gi.WriteByte(ent.dir);
549  gi.WriteByte(ent.camera.cameraType);
550  /* strip the higher bits - only send levelflags */
551  gi.WriteByte(ent.spawnflags & 0xFF);
552  gi.WriteByte(ent.camera.rotate);
553  G_EventEnd();
554 }
555 
563 void G_EventEdictAppear (playermask_t playerMask, const Edict& ent)
564 {
565  G_EventAdd(playerMask, EV_ENT_APPEAR, ent.getIdNum());
566  gi.WriteByte(ent.type);
567  gi.WriteGPos(ent.pos);
568  G_EventEnd();
569 }
570 
571 void G_EventActorAppear (playermask_t playerMask, const Actor& check, const Edict* ent)
572 {
573  const int mask = G_TeamToPM(check.getTeam()) & playerMask;
574 
575  /* parsed in CL_ActorAppear */
576  G_EventAdd(playerMask, EV_ACTOR_APPEAR, check.getIdNum());
577  gi.WriteShort(ent && ent->getIdNum() > 0 ? ent->getIdNum() : SKIP_LOCAL_ENTITY);
578  gi.WriteByte(check.getTeam());
579  gi.WriteByte(check.chr.teamDef ? check.chr.teamDef->idx : NONE);
580  gi.WriteByte(check.chr.gender);
581  gi.WriteShort(check.chr.ucn);
582  gi.WriteByte(check.getPlayerNum());
583  gi.WriteGPos(check.pos);
584  gi.WriteByte(check.dir);
585  if (check.getRightHandItem()) {
586  gi.WriteShort(check.getRightHandItem()->def()->idx);
587  } else {
588  gi.WriteShort(NONE);
589  }
590 
591  if (check.getLeftHandItem()) {
592  gi.WriteShort(check.getLeftHandItem()->def()->idx);
593  } else {
594  gi.WriteShort(NONE);
595  }
596 
597  if (check.getBody() == 0 || check.getHead() == 0) {
598  gi.Error("invalid body and/or head model indices");
599  }
600  gi.WriteShort(check.getBody());
601  gi.WriteShort(check.getHead());
602  gi.WriteByte(check.chr.bodySkin);
603  gi.WriteByte(check.chr.headSkin);
604  /* strip the server private states */
605  gi.WriteShort(check.state & STATE_PUBLIC);
606  gi.WriteByte(check.fieldSize);
607  /* get the max values for TU and morale */
608  gi.WriteByte(G_ActorCalculateMaxTU(&check));
609  gi.WriteByte(std::min(MAX_SKILL, GET_MORALE(check.chr.score.skills[ABILITY_MIND])));
610  gi.WriteShort(check.chr.maxHP);
611  G_EventEnd();
612 
613  if (mask) {
614  G_EventActorStateChange(mask, check);
615  G_SendInventory(mask, check);
616  }
617 }
618 
624 void G_EventEdictPerish (playermask_t playerMask, const Edict& ent)
625 {
626  assert(ent.inuse);
627  G_EventAdd(playerMask, EV_ENT_PERISH, ent.getIdNum());
628  gi.WriteByte(ent.type);
629  G_EventEnd();
630 }
631 
632 void G_EventActorStateChange (playermask_t playerMask, const Edict& ent)
633 {
634  G_EventAdd(playerMask, EV_ACTOR_STATECHANGE, ent.getIdNum());
635  gi.WriteShort(ent.state);
636  G_EventEnd();
637 }
638 
639 void G_EventAddBrushModel (playermask_t playerMask, const Edict& ent)
640 {
641  G_EventAdd(playerMask, EV_ADD_BRUSH_MODEL, ent.getIdNum());
642  gi.WriteByte(ent.type);
643  gi.WriteShort(ent.modelindex);
644  /* strip the higher bits - only send levelflags */
645  gi.WriteByte(ent.spawnflags & 0xFF);
646  gi.WritePos(ent.origin);
647  gi.WritePos(ent.angles);
648  gi.WriteShort(ent.speed);
649  gi.WriteByte(ent.angle);
650  gi.WriteByte(ent.dir);
651  G_EventEnd();
652 }
653 
654 void G_EventEndRoundAnnounce (const Player& player)
655 {
657  gi.WriteByte(player.getNum());
658  gi.WriteByte(player.getTeam());
659  G_EventEnd();
660 }
661 
662 void G_EventStart (const Player& player, bool teamplay)
663 {
665  gi.WriteByte(teamplay);
666  G_EventEnd();
667 }
668 
669 void G_EventReset (const Player& player, int activeTeam)
670 {
672  gi.WriteByte(player.getTeam());
673  gi.WriteByte(activeTeam);
674  G_EventEnd();
675 }
676 
677 void G_EventDoorOpen (const Edict& door)
678 {
680  G_EventEnd();
681 }
682 
683 void G_EventDoorClose (const Edict& door)
684 {
686  G_EventEnd();
687 }
688 
689 void G_EventModelExplodeTriggered (const Edict& ent, const char* sound)
690 {
691  assert(ent.inuse);
693  gi.WriteString(sound);
694  G_EventEnd();
695 }
696 
697 void G_EventModelExplode (const Edict& ent, const char* sound)
698 {
699  assert(ent.inuse);
701  gi.WriteString(sound);
702  G_EventEnd();
703 }
704 
705 void G_EventAdd (playermask_t playerMask, int eType, int entnum)
706 {
707  G_EventEnd();
708  gi.AddEvent(playerMask, eType, entnum);
709 }
710 
711 void G_EventEnd (void)
712 {
713  if (gi.GetEvent() == EV_ACTOR_MOVE) {
714  /* mark the end of the steps */
715  gi.WriteLong(0);
716  const Edict* ent = gi.GetEventEdict();
717  assert(ent);
718  gi.WriteGPos(ent->pos);
719  }
720  gi.EndEvents();
721 }
void G_EventCenterView(const Edict &ent)
Centers the view for all clients that are seeing the given edict on the world position of the edict...
Definition: g_events.cpp:479
void G_EventEnd(void)
Definition: g_events.cpp:711
void G_EventActorFall(const Edict &ent)
Definition: g_events.cpp:345
int getIdNum() const
Definition: g_edict.h:231
const objDef_t * getWeapon() const
Definition: chr_shared.h:154
solid_t solid
Definition: g_edict.h:58
chrScoreGlobal_t score
Definition: chr_shared.h:387
void G_EventActorStateChange(playermask_t playerMask, const Edict &ent)
Definition: g_events.cpp:632
void G_EventInventoryAmmo(const Edict &ent, const objDef_t *ammo, int amount, shoot_types_t shootType)
Change the amount of available ammo for the given entity.
Definition: g_events.cpp:181
void G_EventReactionFireAbortShot(const Edict &shooter, const Edict &target, int step)
Definition: g_events.cpp:318
int getStun() const
Definition: g_edict.h:308
void G_EventReset(const Player &player, int activeTeam)
Definition: g_events.cpp:669
this is a fire definition for our weapons/ammo
Definition: inv_shared.h:110
void G_EventInventoryReload(const Edict &ent, playermask_t playerMask, const Item *item, const invDef_t *invDef, const Item *ic)
Definition: g_events.cpp:421
void G_EventActorTurn(const Edict &ent)
Send the turn event for the given entity.
Definition: g_events.cpp:77
const teamDef_t * teamDef
Definition: chr_shared.h:394
#define makeDV(dir, z)
Definition: mathlib.h:247
void G_EventEdictAppear(playermask_t playerMask, const Edict &ent)
Send an appear event to the client.
Definition: g_events.cpp:563
weaponFireDefIndex_t weapFdsIdx
Definition: inv_shared.h:126
void G_EventSendEdict(const Edict &ent)
Send the bounding box info to the client.
Definition: g_events.cpp:457
#define FL_CLIENTACTION
Edict flag to indicate, that the edict can be used in the context of a client action.
Definition: g_local.h:296
voidpf uLong int origin
Definition: ioapi.h:45
vec3_t angles
Definition: g_edict.h:54
unsigned int playermask_t
Definition: g_events.h:34
int activeTeam
Definition: g_local.h:101
character_t chr
Definition: g_edict.h:116
const vec3_t vec3_origin
Definition: mathlib.cpp:35
void G_EventDestroyEdict(const Edict &ent)
Unregister an edict at the client.
Definition: g_events.cpp:167
TR_PLANE_TYPE plane
Definition: tracing.h:60
bool inuse
Definition: g_edict.h:47
AABB entBox
Definition: g_edict.h:60
AABB absBox
Definition: g_edict.h:61
const objDef_t * def(void) const
Definition: inv_shared.h:469
void G_SendInventory(playermask_t playerMask, const Edict &ent)
Sends whole inventory through the network buffer.
void G_EventEndRound(void)
End of turn event for the current active team.
Definition: g_events.cpp:414
#define PM_ALL
Definition: g_events.h:36
void G_EventCameraAppear(playermask_t playerMask, const Edict &ent)
Send an appear event to the client.
Definition: g_events.cpp:543
int getFmIdx() const
Definition: chr_shared.h:150
moveinfo_t moveinfo
Definition: g_edict.h:160
vec3_t maxs
Definition: aabb.h:258
byte dir
Definition: g_edict.h:86
Defines all attributes of objects used in the inventory.
Definition: inv_shared.h:264
Player & getPlayer() const
Definition: g_edict.h:265
camera_edict_data_t camera
Definition: g_edict.h:134
int speed
Definition: g_edict.h:124
const struct objDef_s * obj
Definition: inv_shared.h:125
int spawnflags
Definition: g_edict.h:118
Item * getRightHandItem() const
Definition: g_edict.h:249
#define SKIP_LOCAL_ENTITY
Definition: q_shared.h:255
void G_EventSendState(playermask_t playerMask, const Edict &ent)
Definition: g_events.cpp:466
#define IS_SHOT_RIGHT(x)
Determine whether the selected shoot type is for the item in the right hand, either shooting or react...
Definition: q_shared.h:243
unsigned int getBody() const
Definition: g_edict.h:384
int getTeam() const
Definition: g_edict.h:269
#define CID_LEFT
Definition: inv_shared.h:48
void G_EventResetClientAction(const Edict &ent)
Reset the client actions for the given entity.
Definition: g_events.cpp:376
void G_EventMoveCameraTo(playermask_t playerMask, const pos3_t pos)
Centers the view for all clients that are seeing the given edict on the world position of the edict...
Definition: g_events.cpp:501
item instance data, with linked list capability
Definition: inv_shared.h:402
void G_EventEndRoundAnnounce(const Player &player)
Definition: g_events.cpp:654
int treatmentLevel[BODYPART_MAXTYPE]
Definition: chr_shared.h:352
int modelindex
Definition: g_edict.h:66
#define CID_RIGHT
Definition: inv_shared.h:47
unsigned int getHead() const
Definition: g_edict.h:390
game_import_t gi
Definition: g_main.cpp:39
void G_EventStart(const Player &player, bool teamplay)
Definition: g_events.cpp:662
void G_EventActorAppear(playermask_t playerMask, const Actor &check, const Edict *ent)
Definition: g_events.cpp:571
int32_t shoot_types_t
Available shoot types - also see the ST_ constants.
Definition: q_shared.h:206
void G_EventReactionFireChange(const Edict &ent)
Definition: g_events.cpp:282
int TU
Definition: g_edict.h:88
void G_EventDoorClose(const Edict &door)
Definition: g_events.cpp:683
teammask_t visflags
Definition: g_edict.h:82
#define G_PlayerToPM(player)
Definition: g_events.h:37
void G_EventEdictPerish(playermask_t playerMask, const Edict &ent)
Send disappear event.
Definition: g_events.cpp:624
pos3_t pos
Definition: g_edict.h:55
fireDefIndex_t fdIdx
Definition: inv_shared.h:130
void G_EventSendParticle(playermask_t playerMask, const Edict &ent)
Definition: g_events.cpp:529
float angle
Definition: g_edict.h:120
void G_EventActorStats(const Edict &ent, playermask_t playerMask)
Definition: g_events.cpp:383
void G_EventShootHidden(teammask_t teamMask, const fireDef_t *fd, bool firstShoot, const vec3_t impact, int flags, const Edict *targetEdict)
Start the shooting event for hidden actors.
Definition: g_events.cpp:232
#define EVENT_INSTANTLY
Definition: q_shared.h:73
int woundLevel[BODYPART_MAXTYPE]
Definition: chr_shared.h:351
An Edict of type Actor.
Definition: g_edict.h:348
void G_EventModelExplodeTriggered(const Edict &ent, const char *sound)
Definition: g_events.cpp:689
void G_EventActorRevitalise(const Edict &ent)
Announce the actor revitalize event for the clients that are seeing the actor.
Definition: g_events.cpp:102
playermask_t G_VisToPM(teammask_t teamMask)
Converts vis mask to player mask.
Definition: g_client.cpp:186
#define GRAVITY
Definition: q_shared.h:276
Edict * clientAction
Definition: g_edict.h:113
Info on a wound.
Definition: chr_shared.h:350
void G_EventAdd(playermask_t playerMask, int eType, int entnum)
Definition: g_events.cpp:705
pos_t pos3_t[3]
Definition: ufotypes.h:58
void getCenter(vec3_t center) const
Calculates the center of the bounding box.
Definition: aabb.h:155
int state
Definition: g_edict.h:93
void G_EventCenterViewAt(playermask_t playerMask, const pos3_t pos)
Centers the view for all clients that are seeing the given edict on the world position of the edict...
Definition: g_events.cpp:489
int flags
Definition: g_edict.h:169
actorSizeEnum_t fieldSize
Definition: g_edict.h:141
#define DIRECTION_FALL
Definition: defines.h:335
woundInfo_t wounds
Definition: chr_shared.h:383
void G_EventDoorOpen(const Edict &door)
Definition: g_events.cpp:677
void G_EventAddBrushModel(playermask_t playerMask, const Edict &ent)
Definition: g_events.cpp:639
int32_t containerIndex_t
Definition: inv_shared.h:46
void G_EventSpawnSound(playermask_t playerMask, const Edict &ent, const vec3_t origin, const char *sound)
Spawns a sound (that will be spatialized on the client side)
Definition: g_events.cpp:40
#define VectorAdd(a, b, dest)
Definition: vector.h:47
void G_EventModelExplode(const Edict &ent, const char *sound)
Definition: g_events.cpp:697
FiremodeSettings RFmode
Definition: chr_shared.h:397
void G_EventActorSendReservations(const Edict &ent)
Will inform the player about the real TU reservation.
Definition: g_events.cpp:113
int getPlayerNum() const
Definition: g_edict.h:234
void G_EventInventoryDelete(const Edict &ent, playermask_t playerMask, const containerIndex_t containerId, int x, int y)
Tell the client to remove the item from the container.
Definition: g_events.cpp:131
void G_EventActorWound(const Edict &ent, const int bodyPart)
Send info about an actor's wounds to the client.
Definition: g_events.cpp:399
Local definitions for game module.
void G_EventSetClientAction(const Edict &ent)
Informs the client that an interaction with the world is possible.
Definition: g_events.cpp:360
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
entity_type_t type
Definition: g_edict.h:81
void G_EventShoot(const Edict &ent, teammask_t teamMask, const fireDef_t *fd, bool firstShoot, shoot_types_t shootType, int flags, const trace_t *trace, const vec3_t from, const vec3_t impact)
Do the shooting.
Definition: g_events.cpp:260
#define MAX_SKILL
Definition: q_shared.h:278
int ammo
Definition: inv_shared.h:293
void G_EventPerish(const Edict &ent)
Send an event to all clients that are seeing the given edict, that it just has disappeared.
Definition: g_events.cpp:158
functions to handle the storage and lifecycle of all edicts in the game module.
edict_t *IMPORT * GetEventEdict(void)
vec3_t origin
Definition: g_edict.h:53
void G_EventInventoryAdd(const Edict &ent, playermask_t playerMask, int itemAmount)
Tell the client to add the item from the container.
Definition: g_events.cpp:147
byte steps
Definition: g_local.h:278
void G_EventSpawnFootstepSound(const Edict &ent, const char *sound)
Definition: g_events.cpp:62
const objDef_t * ammoDef(void) const
Definition: inv_shared.h:460
vec_t vec3_t[3]
Definition: ufotypes.h:39
inventory definition for our menus
Definition: inv_shared.h:371
void G_EventActorAdd(playermask_t playerMask, const Edict &ent, const bool instant)
Definition: g_events.cpp:511
void G_EventReactionFireAddTarget(const Edict &shooter, const Edict &target, int tus, int step)
Definition: g_events.cpp:295
void G_EventActorDie(const Edict &ent, bool attacker)
Announce the actor die event for the clients that are seeing the actor.
Definition: g_events.cpp:89
unsigned int teammask_t
Definition: g_vis.h:30
int getX() const
Definition: inv_shared.h:454
uint32_t contentFlags
Definition: tracing.h:63
containerIndex_t id
Definition: inv_shared.h:373
int morale
Definition: g_edict.h:91
void G_EventReactionFireTargetUpdate(const Edict &shooter, const Edict &target, int tus, int step)
Definition: g_events.cpp:310
vec3_t mins
Definition: aabb.h:257
void G_EventThrow(teammask_t teamMask, const fireDef_t *fd, float dt, byte flags, const vec3_t position, const vec3_t velocity)
Definition: g_events.cpp:440
#define GET_MORALE(ab)
Definition: q_shared.h:290
Edict * G_EdictsGetByNum(const int num)
Get an entity by it's number.
Definition: g_edicts.cpp:83
#define NONE
Definition: defines.h:68
actorHands_t getHand() const
Definition: chr_shared.h:158
How many TUs (and of what type) did a player reserve for a unit?
Definition: chr_shared.h:179
Definition: g_edict.h:45
void G_EventStartShoot(const Edict &ent, teammask_t teamMask, shoot_types_t shootType, const pos3_t at)
Start the shooting event.
Definition: g_events.cpp:203
void G_EventEndShoot(const Edict &ent, teammask_t teamMask)
Ends the shooting event.
Definition: g_events.cpp:217
Item * getLeftHandItem() const
Definition: g_edict.h:252
uint8_t byte
Definition: ufotypes.h:34
QGL_EXTERN int GLboolean GLfloat * v
Definition: r_gl.h:120
camera_type_t cameraType
Definition: g_local.h:309
int G_ActorCalculateMaxTU(const Edict *ent)
Definition: g_actor.cpp:247
int skills[SKILL_NUM_TYPES]
Definition: chr_shared.h:122
const char * particle
Definition: g_edict.h:128
Interface for g_client.cpp.
int getY() const
Definition: inv_shared.h:457
playermask_t G_TeamToPM(int team)
Generates the player bit mask for a given team.
Definition: g_client.cpp:144
int entNum
Definition: tracing.h:67
void G_EventReactionFireRemoveTarget(const Edict &shooter, const Edict &target, int step)
Definition: g_events.cpp:303
#define G_IsBreakable(ent)
Definition: g_local.h:137
level_locals_t level
Definition: g_main.cpp:38
int HP
Definition: g_edict.h:89
void G_EventParticleSpawn(playermask_t playerMask, const char *name, int levelFlags, const vec3_t s, const vec3_t v, const vec3_t a)
Spawn a new particle for the client.
Definition: g_events.cpp:334
chrReservations_t reservedTus
Definition: chr_shared.h:396
#define STATE_PUBLIC
Definition: q_shared.h:261