UFO: Alien Invasion
Loading...
Searching...
No Matches
g_events.cpp
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, 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
40void 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
62void 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
77void G_EventActorTurn (const Edict& ent)
78{
80 gi.WriteByte(ent.dir);
81 G_EventEnd();
82}
83
89void 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
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
131void 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
147void 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
158void G_EventPerish (const Edict& ent)
159{
161}
162
167void G_EventDestroyEdict (const Edict& ent)
168{
169 assert(ent.inuse);
171 G_EventEnd();
172}
173
181void 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
203void 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
217void G_EventEndShoot (const Edict &ent, teammask_t teamMask)
218{
220 G_EventEnd();
221}
222
232void G_EventShootHidden (teammask_t teamMask, const fireDef_t* fd, bool firstShoot, const vec3_t impact, int flags, const Edict* targetEdict)
233{
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
260void 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
295void 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
303void 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
310void 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
318void 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
334void 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
345void 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
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
383void 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
399void 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
415{
417 gi.WriteByte(level.activeTeam);
418 G_EventEnd();
419}
420
421void 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
440void 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
457void 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
466void 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
479void G_EventCenterView (const Edict& ent)
480{
482}
483
489void 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
501void 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
511void 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
529void 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
543void 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
563void 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
571void 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
624void 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
632void 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
639void 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
654void G_EventEndRoundAnnounce (const Player& player)
655{
657 gi.WriteByte(player.getNum());
658 gi.WriteByte(player.getTeam());
659 G_EventEnd();
660}
661
662void G_EventStart (const Player& player, bool teamplay)
663{
665 gi.WriteByte(teamplay);
666 G_EventEnd();
667}
668
669void G_EventReset (const Player& player, int activeTeam)
670{
672 gi.WriteByte(player.getTeam());
673 gi.WriteByte(activeTeam);
674 G_EventEnd();
675}
676
677void G_EventDoorOpen (const Edict& door)
678{
680 G_EventEnd();
681}
682
683void G_EventDoorClose (const Edict& door)
684{
686 G_EventEnd();
687}
688
689void G_EventModelExplodeTriggered (const Edict& ent, const char* sound)
690{
691 assert(ent.inuse);
693 gi.WriteString(sound);
694 G_EventEnd();
695}
696
697void G_EventModelExplode (const Edict& ent, const char* sound)
698{
699 assert(ent.inuse);
701 gi.WriteString(sound);
702 G_EventEnd();
703}
704
705void G_EventAdd (playermask_t playerMask, int eType, int entnum)
706{
707 G_EventEnd();
708 gi.AddEvent(playerMask, eType, entnum);
709}
710
711void 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}
@ ABILITY_MIND
Definition chr_shared.h:40
vec3_t maxs
Definition aabb.h:258
vec3_t mins
Definition aabb.h:257
void getCenter(vec3_t center) const
Calculates the center of the bounding box.
Definition aabb.h:155
An Edict of type Actor.
Definition g_edict.h:348
unsigned int getHead() const
Definition g_edict.h:390
unsigned int getBody() const
Definition g_edict.h:384
int getPlayerNum() const
Definition g_edict.h:234
teammask_t visflags
Definition g_edict.h:82
int TU
Definition g_edict.h:88
character_t chr
Definition g_edict.h:116
int flags
Definition g_edict.h:169
camera_edict_data_t camera
Definition g_edict.h:134
int getIdNum() const
Definition g_edict.h:231
Item * getRightHandItem() const
Definition g_edict.h:249
vec3_t origin
Definition g_edict.h:53
const char * particle
Definition g_edict.h:128
pos3_t pos
Definition g_edict.h:55
moveinfo_t moveinfo
Definition g_edict.h:160
float angle
Definition g_edict.h:120
actorSizeEnum_t fieldSize
Definition g_edict.h:141
int HP
Definition g_edict.h:89
byte dir
Definition g_edict.h:86
Item * getLeftHandItem() const
Definition g_edict.h:252
vec3_t angles
Definition g_edict.h:54
Edict * clientAction
Definition g_edict.h:113
bool inuse
Definition g_edict.h:47
int getTeam() const
Definition g_edict.h:269
AABB entBox
Definition g_edict.h:60
int modelindex
Definition g_edict.h:66
Player & getPlayer() const
Definition g_edict.h:265
AABB absBox
Definition g_edict.h:61
int spawnflags
Definition g_edict.h:118
solid_t solid
Definition g_edict.h:58
entity_type_t type
Definition g_edict.h:81
int speed
Definition g_edict.h:124
int getStun() const
Definition g_edict.h:308
int morale
Definition g_edict.h:91
int state
Definition g_edict.h:93
actorHands_t getHand() const
Definition chr_shared.h:165
const objDef_t * getWeapon() const
Definition chr_shared.h:161
int getFmIdx() const
Definition chr_shared.h:157
item instance data, with linked list capability
Definition inv_shared.h:402
const objDef_t * ammoDef(void) const
Definition inv_shared.h:460
int getX() const
Definition inv_shared.h:454
const objDef_t * def(void) const
Definition inv_shared.h:469
int getY() const
Definition inv_shared.h:457
#define NONE
Definition defines.h:68
#define DIRECTION_FALL
Definition defines.h:335
int G_ActorCalculateMaxTU(const Edict *ent)
Definition g_actor.cpp:247
playermask_t G_TeamToPM(int team)
Generates the player bit mask for a given team.
Definition g_client.cpp:144
playermask_t G_VisToPM(teammask_t teamMask)
Converts vis mask to player mask.
Definition g_client.cpp:186
Interface for g_client.cpp.
Edict * G_EdictsGetByNum(const int num)
Get an entity by it's number.
Definition g_edicts.cpp:83
functions to handle the storage and lifecycle of all edicts in the game module.
void G_EventEnd(void)
Definition g_events.cpp:711
void G_EventSendParticle(playermask_t playerMask, const Edict &ent)
Definition g_events.cpp:529
void G_EventSendEdict(const Edict &ent)
Send the bounding box info to the client.
Definition g_events.cpp:457
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_EventReactionFireChange(const Edict &ent)
Definition g_events.cpp:282
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_EventEndRoundAnnounce(const Player &player)
Definition g_events.cpp:654
void G_EventSpawnFootstepSound(const Edict &ent, const char *sound)
Definition g_events.cpp:62
void G_EventDoorOpen(const Edict &door)
Definition g_events.cpp:677
void G_EventActorStats(const Edict &ent, playermask_t playerMask)
Definition g_events.cpp:383
void G_EventAdd(playermask_t playerMask, int eType, int entnum)
Definition g_events.cpp:705
void G_EventActorTurn(const Edict &ent)
Send the turn event for the given entity.
Definition g_events.cpp:77
void G_EventDestroyEdict(const Edict &ent)
Unregister an edict at the client.
Definition g_events.cpp:167
void G_EventActorAppear(playermask_t playerMask, const Actor &check, const Edict *ent)
Definition g_events.cpp:571
void G_EventSetClientAction(const Edict &ent)
Informs the client that an interaction with the world is possible.
Definition g_events.cpp:360
void G_EventReactionFireRemoveTarget(const Edict &shooter, const Edict &target, int step)
Definition g_events.cpp:303
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_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
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
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
void G_EventEndShoot(const Edict &ent, teammask_t teamMask)
Ends the shooting event.
Definition g_events.cpp:217
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
void G_EventAddBrushModel(playermask_t playerMask, const Edict &ent)
Definition g_events.cpp:639
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_EventInventoryAdd(const Edict &ent, playermask_t playerMask, int itemAmount)
Tell the client to add the item from the container.
Definition g_events.cpp:147
void G_EventStart(const Player &player, bool teamplay)
Definition g_events.cpp:662
void G_EventCameraAppear(playermask_t playerMask, const Edict &ent)
Send an appear event to the client.
Definition g_events.cpp:543
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
void G_EventActorFall(const Edict &ent)
Definition g_events.cpp:345
void G_EventEdictPerish(playermask_t playerMask, const Edict &ent)
Send disappear event.
Definition g_events.cpp:624
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
void G_EventEndRound(void)
End of turn event for the current active team.
Definition g_events.cpp:414
void G_EventActorSendReservations(const Edict &ent)
Will inform the player about the real TU reservation.
Definition g_events.cpp:113
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
void G_EventReset(const Player &player, int activeTeam)
Definition g_events.cpp:669
void G_EventSendState(playermask_t playerMask, const Edict &ent)
Definition g_events.cpp:466
void G_EventActorRevitalise(const Edict &ent)
Announce the actor revitalize event for the clients that are seeing the actor.
Definition g_events.cpp:102
void G_EventDoorClose(const Edict &door)
Definition g_events.cpp:683
void G_EventActorWound(const Edict &ent, const int bodyPart)
Send info about an actor's wounds to the client.
Definition g_events.cpp:399
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_EventReactionFireTargetUpdate(const Edict &shooter, const Edict &target, int tus, int step)
Definition g_events.cpp:310
void G_EventResetClientAction(const Edict &ent)
Reset the client actions for the given entity.
Definition g_events.cpp:376
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
void G_EventActorStateChange(playermask_t playerMask, const Edict &ent)
Definition g_events.cpp:632
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
void G_EventActorAdd(playermask_t playerMask, const Edict &ent, const bool instant)
Definition g_events.cpp:511
void G_EventReactionFireAbortShot(const Edict &shooter, const Edict &target, int step)
Definition g_events.cpp:318
void G_EventReactionFireAddTarget(const Edict &shooter, const Edict &target, int tus, int step)
Definition g_events.cpp:295
void G_EventEdictAppear(playermask_t playerMask, const Edict &ent)
Send an appear event to the client.
Definition g_events.cpp:563
void G_EventModelExplode(const Edict &ent, const char *sound)
Definition g_events.cpp:697
void G_EventModelExplodeTriggered(const Edict &ent, const char *sound)
Definition g_events.cpp:689
#define PM_ALL
Definition g_events.h:36
#define G_PlayerToPM(player)
Definition g_events.h:37
unsigned int playermask_t
Definition g_events.h:34
void G_SendInventory(playermask_t playerMask, const Edict &ent)
Sends whole inventory through the network buffer.
Local definitions for game module.
level_locals_t level
Definition g_main.cpp:38
#define G_IsBreakable(ent)
Definition g_local.h:137
game_import_t gi
Definition g_main.cpp:39
#define FL_CLIENTACTION
Edict flag to indicate, that the edict can be used in the context of a client action.
Definition g_local.h:298
unsigned int teammask_t
Definition g_vis.h:30
@ SOLID_BSP
Definition game.h:157
int32_t containerIndex_t
Definition inv_shared.h:46
#define CID_LEFT
Definition inv_shared.h:48
#define CID_RIGHT
Definition inv_shared.h:47
voidpf uLong int origin
Definition ioapi.h:45
const vec3_t vec3_origin
Definition mathlib.cpp:35
#define makeDV(dir, z)
Definition mathlib.h:247
#define SKIP_LOCAL_ENTITY
Definition q_shared.h:255
@ EV_ACTOR_REACTIONFIRECHANGE
Definition q_shared.h:101
@ EV_ACTOR_SHOOT
Definition q_shared.h:108
@ EV_INV_AMMO
Definition q_shared.h:122
@ EV_DOOR_CLOSE
Definition q_shared.h:136
@ EV_ACTOR_REACTIONFIRETARGETUPDATE
Definition q_shared.h:104
@ EV_ACTOR_REACTIONFIREABORTSHOT
Definition q_shared.h:105
@ EV_ENDROUND
Definition q_shared.h:83
@ EV_ACTOR_WOUND
Definition q_shared.h:118
@ EV_MODEL_EXPLODE_TRIGGERED
Definition q_shared.h:128
@ EV_ACTOR_STATECHANGE
Definition q_shared.h:116
@ EV_ADD_EDICT
Definition q_shared.h:95
@ EV_ACTOR_STATS
Definition q_shared.h:115
@ EV_ENDROUNDANNOUNCE
Definition q_shared.h:84
@ EV_MODEL_EXPLODE
Definition q_shared.h:127
@ EV_CAMERA_APPEAR
Definition q_shared.h:140
@ EV_INV_RELOAD
Definition q_shared.h:123
@ EV_ADD_BRUSH_MODEL
Definition q_shared.h:94
@ EV_START
Definition q_shared.h:82
@ EV_ENT_PERISH
Definition q_shared.h:91
@ EV_CENTERVIEW
Definition q_shared.h:87
@ EV_INV_DEL
Definition q_shared.h:121
@ EV_ACTOR_REACTIONFIREADDTARGET
Definition q_shared.h:102
@ EV_PARTICLE_APPEAR
Definition q_shared.h:130
@ EV_ENT_DESTROY
Definition q_shared.h:93
@ EV_ACTOR_END_SHOOT
Definition q_shared.h:111
@ EV_DOOR_OPEN
Definition q_shared.h:135
@ EV_CLIENT_ACTION
Definition q_shared.h:137
@ EV_MOVECAMERA
Definition q_shared.h:88
@ EV_ACTOR_THROW
Definition q_shared.h:110
@ EV_ACTOR_APPEAR
Definition q_shared.h:97
@ EV_ACTOR_MOVE
Definition q_shared.h:100
@ EV_ACTOR_REVITALISED
Definition q_shared.h:114
@ EV_RESET
Definition q_shared.h:81
@ EV_ACTOR_START_SHOOT
Definition q_shared.h:107
@ EV_ACTOR_SHOOT_HIDDEN
Definition q_shared.h:109
@ EV_ACTOR_TURN
Definition q_shared.h:99
@ EV_ACTOR_RESERVATIONCHANGE
Definition q_shared.h:117
@ EV_PARTICLE_SPAWN
Definition q_shared.h:131
@ EV_RESET_CLIENT_ACTION
Definition q_shared.h:138
@ EV_ENT_APPEAR
Definition q_shared.h:90
@ EV_ACTOR_ADD
Definition q_shared.h:98
@ EV_SOUND
Definition q_shared.h:133
@ EV_ACTOR_DIE
Definition q_shared.h:113
@ EV_INV_ADD
Definition q_shared.h:120
@ EV_ACTOR_REACTIONFIREREMOVETARGET
Definition q_shared.h:103
#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
#define EVENT_INSTANTLY
Definition q_shared.h:73
#define GRAVITY
Definition q_shared.h:276
#define STATE_PUBLIC
Definition q_shared.h:261
#define GET_MORALE(ab)
Definition q_shared.h:290
int32_t shoot_types_t
Available shoot types - also see the ST_ constants.
Definition q_shared.h:206
#define MAX_SKILL
Definition q_shared.h:278
QGL_EXTERN int GLboolean GLfloat * v
Definition r_gl.h:120
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
camera_type_t cameraType
Definition g_local.h:317
chrReservations_t reservedTus
Definition chr_shared.h:415
const teamDef_t * teamDef
Definition chr_shared.h:413
chrScoreGlobal_t score
Definition chr_shared.h:406
FiremodeSettings RFmode
Definition chr_shared.h:416
woundInfo_t wounds
Definition chr_shared.h:402
How many TUs (and of what type) did a player reserve for a unit?
Definition chr_shared.h:186
int skills[SKILL_NUM_TYPES]
Definition chr_shared.h:122
this is a fire definition for our weapons/ammo
Definition inv_shared.h:110
fireDefIndex_t fdIdx
Definition inv_shared.h:130
const struct objDef_s * obj
Definition inv_shared.h:125
weaponFireDefIndex_t weapFdsIdx
Definition inv_shared.h:126
inventory definition for our menus
Definition inv_shared.h:371
containerIndex_t id
Definition inv_shared.h:373
byte steps
Definition g_local.h:278
Defines all attributes of objects used in the inventory.
Definition inv_shared.h:264
uint32_t contentFlags
Definition tracing.h:63
TR_PLANE_TYPE plane
Definition tracing.h:60
int entNum
Definition tracing.h:67
Info on a wound.
Definition chr_shared.h:361
int woundLevel[BODYPART_MAXTYPE]
Definition chr_shared.h:362
int treatmentLevel[BODYPART_MAXTYPE]
Definition chr_shared.h:363
pos_t pos3_t[3]
Definition ufotypes.h:58
vec_t vec3_t[3]
Definition ufotypes.h:39
#define VectorAdd(a, b, dest)
Definition vector.h:47