00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "../../client.h"
00026 #include "../cl_localentity.h"
00027 #include "e_main.h"
00028 #include "event/actor/e_event_actorappear.h"
00029 #include "event/actor/e_event_actoradd.h"
00030 #include "event/actor/e_event_actormove.h"
00031 #include "event/actor/e_event_actorturn.h"
00032 #include "event/actor/e_event_actorstartshoot.h"
00033 #include "event/actor/e_event_actorshoot.h"
00034 #include "event/actor/e_event_actorshoothidden.h"
00035 #include "event/actor/e_event_actorthrow.h"
00036 #include "event/actor/e_event_actordie.h"
00037 #include "event/actor/e_event_actorstats.h"
00038 #include "event/actor/e_event_actorstatechange.h"
00039 #include "event/actor/e_event_actordooraction.h"
00040 #include "event/actor/e_event_actorreactionfirechange.h"
00041 #include "event/actor/e_event_actorresetclientaction.h"
00042 #include "event/actor/e_event_actorreservationchange.h"
00043 #include "event/actor/e_event_actorrevitalised.h"
00044 #include "event/inventory/e_event_invadd.h"
00045 #include "event/inventory/e_event_invdel.h"
00046 #include "event/inventory/e_event_invammo.h"
00047 #include "event/inventory/e_event_invreload.h"
00048 #include "event/player/e_event_reset.h"
00049 #include "event/player/e_event_startgame.h"
00050 #include "event/player/e_event_doendround.h"
00051 #include "event/player/e_event_endroundannounce.h"
00052 #include "event/player/e_event_results.h"
00053 #include "event/player/e_event_centerview.h"
00054 #include "event/world/e_event_entappear.h"
00055 #include "event/world/e_event_entperish.h"
00056 #include "event/world/e_event_entdestroy.h"
00057 #include "event/world/e_event_addbrushmodel.h"
00058 #include "event/world/e_event_addedict.h"
00059 #include "event/world/e_event_explode.h"
00060 #include "event/world/e_event_particleappear.h"
00061 #include "event/world/e_event_particlespawn.h"
00062 #include "event/world/e_event_dooropen.h"
00063 #include "event/world/e_event_doorclose.h"
00064
00071 static qboolean CL_CheckDefault (const eventRegister_t *self, const struct dbuffer *msg)
00072 {
00073 const int number = NET_PeekShort(msg);
00074 const qboolean result = LE_IsLocked(number);
00075 if (result)
00076 Com_DPrintf(DEBUG_EVENTSYS, "CL_CheckDefault: Delaying event on entnum %i.\n", number);
00077 return (!result);
00078 }
00079
00084 const eventRegister_t events[] = {
00085 #define E(x) x, STRINGIFY(x)
00086 {E(EV_NULL), "", NULL, NULL, NULL},
00087 {E(EV_RESET), "bb", CL_Reset, NULL, NULL},
00088 {E(EV_START), "b", CL_StartGame, NULL, NULL},
00089 {E(EV_ENDROUND), "b", CL_DoEndRound, NULL, NULL},
00090 {E(EV_ENDROUNDANNOUNCE), "bb", CL_EndRoundAnnounce, NULL, NULL},
00091
00092 {E(EV_RESULTS), "", CL_ParseResults, NULL, NULL},
00093 {E(EV_CENTERVIEW), "g", CL_CenterView, NULL, NULL},
00094
00095 {E(EV_ENT_APPEAR), "sbg", CL_EntAppear, NULL, NULL},
00096 {E(EV_ENT_PERISH), "s", CL_EntPerish, NULL, NULL},
00097 {E(EV_ENT_DESTROY), "s", CL_EntDestroy, NULL, NULL},
00098 {E(EV_ADD_BRUSH_MODEL), "bssbppsb", CL_AddBrushModel, NULL, NULL},
00099 {E(EV_ADD_EDICT), "bspp", CL_AddEdict, NULL, NULL},
00100
00101 {E(EV_ACTOR_APPEAR), "!s!sbbbbgbssssbsbbbs", CL_ActorAppear, CL_ActorAppearTime, CL_CheckDefault},
00102 {E(EV_ACTOR_ADD), "!sbbbbgsb", CL_ActorAdd, NULL, NULL},
00103 {E(EV_ACTOR_TURN), "sb", CL_ActorDoTurn, NULL, NULL},
00104 {E(EV_ACTOR_MOVE), "!sbbs", CL_ActorDoMove, CL_ActorDoMoveTime, CL_CheckDefault},
00105 {E(EV_ACTOR_REACTIONFIRECHANGE), "sbbs", CL_ActorReactionFireChange, NULL, NULL},
00106
00107 {E(EV_ACTOR_START_SHOOT), "sbgg", CL_ActorStartShoot, NULL, NULL},
00108 {E(EV_ACTOR_SHOOT), "ssbsbbbbbppb", CL_ActorDoShoot, CL_ActorDoShootTime, NULL},
00109 {E(EV_ACTOR_SHOOT_HIDDEN), "bsbb", CL_ActorShootHidden, CL_ActorShootHiddenTime, NULL},
00110 {E(EV_ACTOR_THROW), "ssbbbpp", CL_ActorDoThrow, CL_ActorDoThrowTime, NULL},
00111
00112 {E(EV_ACTOR_DIE), "ss", CL_ActorDie, NULL, CL_CheckDefault},
00113 {E(EV_ACTOR_REVITALISED), "ss", CL_ActorRevitalised, NULL, CL_CheckDefault},
00114 {E(EV_ACTOR_STATS), "!sbsbb", CL_ActorStats, NULL, NULL},
00115 {E(EV_ACTOR_STATECHANGE), "ss", CL_ActorStateChange, NULL, NULL},
00116 {E(EV_ACTOR_RESERVATIONCHANGE), "ssss", CL_ActorReservationChange, NULL, NULL},
00117
00118 {E(EV_INV_ADD), "s*", CL_InvAdd, NULL, NULL},
00119 {E(EV_INV_DEL), "sbbb", CL_InvDel, NULL, NULL},
00120 {E(EV_INV_AMMO), "sbbbbb", CL_InvAmmo, NULL, NULL},
00121 {E(EV_INV_RELOAD), "sbbbbb", CL_InvReload, NULL, NULL},
00122 {E(EV_INV_TRANSFER), "sbsbbbbs", NULL, NULL, NULL},
00123
00124 {E(EV_MODEL_EXPLODE), "s", CL_Explode, NULL, NULL},
00125 {E(EV_MODEL_EXPLODE_TRIGGERED), "s", CL_Explode, NULL, NULL},
00126
00127 {E(EV_PARTICLE_APPEAR), "ss&", CL_ParticleAppear, NULL, NULL},
00128 {E(EV_PARTICLE_SPAWN), "bppp&", CL_ParticleSpawnEvent, NULL, NULL},
00129
00130 {E(EV_DOOR_OPEN), "s", CL_DoorOpen, NULL, NULL},
00131 {E(EV_DOOR_CLOSE), "s", CL_DoorClose, NULL, NULL},
00132 {E(EV_DOOR_ACTION), "ss", CL_ActorDoorAction, NULL, NULL},
00133 {E(EV_RESET_CLIENT_ACTION), "s", CL_ActorResetClientAction, NULL, NULL},
00134 #undef E
00135 };
00136 CASSERT(lengthof(events) == EV_NUM_EVENTS);
00137
00138 const eventRegister_t *CL_GetEvent (const event_t eType)
00139 {
00140 event_t i;
00141
00142 for (i = EV_NULL; i < EV_NUM_EVENTS; i++) {
00143 if (events[i].type == eType)
00144 return &events[i];
00145 }
00146
00147 Com_Error(ERR_DROP, "Could not get format string for event type %i", eType);
00148 }
00149
00150