/** * @brief Tell the client to add the item from the container * @param[in] ent Pointer to entity having given inventory. * @param[in] playerMask The player mask to determine which clients should receive the event (e.g. @c G_VisToPM(ent->visflags)) * @param[in] itemAmount How many items to add. * @note This event must be followed by a @c G_WriteItem call */ void G_EventInventoryAdd (const Edict& ent, playermask_t playerMask, int itemAmount) { G_EventAdd(playerMask, EV_INV_ADD, ent.getIdNum()); gi.WriteShort(itemAmount); /* do not end the pending events here - this is just a header, the items are following */ }
/** * @brief Unregister an edict at the client * @param ent The edict to unregister */ void G_EventDestroyEdict (const Edict& ent) { assert(ent.inuse); G_EventAdd(PM_ALL, EV_ENT_DESTROY, ent.getIdNum()); G_EventEnd(); }
/** * @brief Send the turn event for the given entity * @param ent The entity to send the turn event for * @note Every player that can see this ent will reveive the turn event data * @note Make sure that the direction to turn into is already set */ void G_EventActorTurn (const Edict& ent) { G_EventAdd(G_VisToPM(ent.visflags), EV_ACTOR_TURN, ent.getIdNum()); gi.WriteByte(ent.dir); G_EventEnd(); }
/** * @brief Announce the actor revitalize event for the clients that are seeing the actor * @param[in] ent The actor that was healed and woke up again */ void G_EventActorRevitalise (const Edict& ent) { G_EventAdd(G_VisToPM(ent.visflags), EV_ACTOR_REVITALISED, ent.getIdNum()); gi.WriteShort(ent.state); G_EventEnd(); }
void G_EventDoorOpen (const Edict& door) { G_EventAdd(PM_ALL, EV_DOOR_OPEN, door.getIdNum()); G_EventEnd(); }
void G_EventDoorClose (const Edict& door) { G_EventAdd(PM_ALL, EV_DOOR_CLOSE, door.getIdNum()); G_EventEnd(); }
void G_EventActorStateChange (playermask_t playerMask, const Edict& ent) { G_EventAdd(playerMask, EV_ACTOR_STATECHANGE, ent.getIdNum()); gi.WriteShort(ent.state); G_EventEnd(); }
/** * @brief Reset the client actions for the given entity * @param[in] ent The entity to reset the client action for * @note This event is send to the player this edict belongs to */ void G_EventResetClientAction (const Edict& ent) { const int playerMask = G_PlayerToPM(ent.getPlayer()); G_EventAdd(playerMask, EV_RESET_CLIENT_ACTION, ent.getIdNum()); G_EventEnd(); }
void G_EventReactionFireAbortShot (const Edict& shooter, const Edict& target, int step) { gi.QueueEvent(G_PlayerToPM(shooter.getPlayer()), EV_ACTOR_REACTIONFIREABORTSHOT, shooter.getIdNum()); gi.QueueWriteShort(target.getIdNum()); gi.QueueWriteByte(step); }
void G_EventReactionFireRemoveTarget (const Edict& shooter, const Edict& target, int step) { gi.QueueEvent(G_PlayerToPM(shooter.getPlayer()), EV_ACTOR_REACTIONFIREREMOVETARGET, shooter.getIdNum()); gi.QueueWriteShort(target.getIdNum()); gi.QueueWriteByte(step); }
/** * @brief Start the shooting event * @param ent The entity that starts the shooting * @param teamMask the vis mask of the teams to determine the clients from this event is send to */ void G_EventEndShoot (const Edict &ent, teammask_t teamMask) { G_EventAdd(G_VisToPM(teamMask), EV_ACTOR_END_SHOOT, ent.getIdNum()); G_EventEnd(); }