本文整理汇总了C++中G_EventAdd函数的典型用法代码示例。如果您正苦于以下问题:C++ G_EventAdd函数的具体用法?C++ G_EventAdd怎么用?C++ G_EventAdd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_EventAdd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: G_EventActorWound
/**
* @brief Actor has been wounded/treated
* @param[in] ent The actor whose wound status has changed
* @note This event is sent to the player this actor belongs to
*/
void G_EventActorWound (const edict_t *ent, const int bodyPart)
{
const int mask = G_PlayerToPM(G_PLAYER_FROM_ENT(ent));
G_EventAdd(mask, EV_ACTOR_WOUND, ent->number);
gi.WriteByte(bodyPart);
gi.WriteByte(ent->chr.wounds.woundLevel[bodyPart]);
gi.WriteByte(ent->chr.wounds.treatmentLevel[bodyPart]);
G_EventEnd();
}
示例2: G_EventActorStats
void G_EventActorStats (const edict_t* ent, int playerMask)
{
G_EventAdd(playerMask, EV_ACTOR_STATS, ent->number);
gi.WriteByte(ent->TU);
gi.WriteShort(ent->HP);
gi.WriteByte(ent->STUN);
gi.WriteByte(ent->morale);
G_EventEnd();
}
示例3: G_EventShootHidden
/**
* @brief Start the shooting event for hidden actors
* @param visMask the vis mask to determine the clients from this event is send to
* @param fd The firedefinition to use for the shoot
* @param firstShoot Is this the first shoot
*/
void G_EventShootHidden (vismask_t visMask, const fireDef_t* fd, bool firstShoot)
{
G_EventAdd(~G_VisToPM(visMask), EV_ACTOR_SHOOT_HIDDEN, -1);
gi.WriteByte(firstShoot);
gi.WriteShort(fd->obj->idx);
gi.WriteByte(fd->weapFdsIdx);
gi.WriteByte(fd->fdIdx);
G_EventEnd();
}
示例4: G_EventActorWound
/**
* @brief Send info about an actor's wounds to the client.
* @param[in] ent The actor whose wound status we are sending.
* @param[in] bodyPart The body part index we are sending wound info about.
* @note This event is sent to the player this actor belongs to
*/
void G_EventActorWound (const Edict& ent, const int bodyPart)
{
const int mask = G_PlayerToPM(ent.getPlayer());
G_EventAdd(mask, EV_ACTOR_WOUND, ent.number);
gi.WriteByte(bodyPart);
const woundInfo_t& wounds = ent.chr.wounds;
gi.WriteByte(wounds.woundLevel[bodyPart]);
gi.WriteByte(wounds.treatmentLevel[bodyPart]);
G_EventEnd();
}
示例5: G_EventParticleSpawn
/**
* @brief Spawn a new particle for the client
* @param[in] playerMask A bit mask. One bit for each affected player
* @param[in] name The id of the particle (see ptl_*.ufo script files in base/ufos)
* @param[in] levelFlags Show at which levels
* @param[in] s starting/location vector
* @param[in] v velocity vector
* @param[in] a acceleration vector
*/
void G_EventParticleSpawn (playermask_t playerMask, const char* name, int levelFlags, const vec3_t s, const vec3_t v, const vec3_t a)
{
G_EventAdd(playerMask, EV_PARTICLE_SPAWN, -1);
gi.WriteByte(levelFlags);
gi.WritePos(s);
gi.WritePos(v);
gi.WritePos(a);
gi.WriteString(name);
G_EventEnd();
}
示例6: G_EventInventoryReload
void G_EventInventoryReload (const Edict& ent, playermask_t playerMask, const Item* item, const invDef_t* invDef, const Item* ic)
{
G_EventAdd(playerMask, EV_INV_RELOAD, ent.number);
gi.WriteByte(item->def()->ammo);
gi.WriteByte(item->ammoDef()->idx);
gi.WriteByte(invDef->id);
gi.WriteByte(ic->getX());
gi.WriteByte(ic->getY());
G_EventEnd();
}
示例7: G_EventSetClientAction
/**
* @brief Informs the client that an interaction with the world is possible
* @note It's assumed that the clientAction is already set
* @param[in] ent The edict that can execute the action (an actor)
*/
void G_EventSetClientAction (const Edict& ent)
{
assert(ent.clientAction);
assert(ent.clientAction->flags & FL_CLIENTACTION);
/* tell the hud to show the door buttons */
G_EventAdd(G_TeamToPM(ent.team), EV_CLIENT_ACTION, ent.number);
gi.WriteShort(ent.clientAction->number);
G_EventEnd();
}
示例8: G_EventActorSendReservations
/**
* @brief Will inform the player about the real TU reservation
* @param ent The actors edict.
*/
void G_EventActorSendReservations (const Edict& ent)
{
G_EventAdd(G_PlayerToPM(ent.getPlayer()), EV_ACTOR_RESERVATIONCHANGE, ent.number);
const chrReservations_t& reservedTUs = ent.chr.reservedTus;
gi.WriteShort(reservedTUs.reaction);
gi.WriteShort(reservedTUs.shot);
gi.WriteShort(reservedTUs.crouch);
G_EventEnd();
}
示例9: G_EventInventoryReload
void G_EventInventoryReload (const edict_t* ent, int playerMask, const item_t* item, const invDef_t* invDef, const invList_t* ic)
{
G_EventAdd(playerMask, EV_INV_RELOAD, ent->number);
gi.WriteByte(item->item->ammo);
gi.WriteByte(item->ammo->idx);
gi.WriteByte(invDef->id);
gi.WriteByte(ic->x);
gi.WriteByte(ic->y);
G_EventEnd();
}
示例10: G_EventReactionFireChange
void G_EventReactionFireChange (const edict_t* ent)
{
const objDef_t *od = ent->chr.RFmode.weapon;
G_EventAdd(G_PlayerToPM(G_PLAYER_FROM_ENT(ent)), EV_ACTOR_REACTIONFIRECHANGE, ent->number);
gi.WriteByte(ent->chr.RFmode.fmIdx);
gi.WriteByte(ent->chr.RFmode.getHand());
gi.WriteShort(od ? od->idx : NONE);
G_EventEnd();
}
示例11: G_EventCameraAppear
/**
* @brief Send an appear event to the client.
* @param playerMask The players to send the event to
* @param ent The camera that should appear to the players included in the given mask.
*/
void G_EventCameraAppear (unsigned int playerMask, const edict_t *ent)
{
G_EventAdd(playerMask, EV_CAMERA_APPEAR, ent->number);
gi.WritePos(ent->origin);
gi.WriteByte(ent->team);
gi.WriteByte(ent->dir);
gi.WriteByte(ent->camera.cameraType);
/* strip the higher bits - only send levelflags */
gi.WriteByte(ent->spawnflags & 0xFF);
gi.WriteByte(ent->camera.rotate);
G_EventEnd();
}
示例12: G_EventActorFall
void G_EventActorFall (const Edict& ent)
{
G_EventAdd(G_VisToPM(ent.visflags), EV_ACTOR_MOVE, ent.number);
gi.WriteByte(1);
gi.WriteByte(ent.pos[0]);
gi.WriteByte(ent.pos[1]);
gi.WriteByte(ent.pos[2]);
gi.WriteByte(makeDV(DIRECTION_FALL, ent.pos[2]));
gi.WriteShort(GRAVITY);
gi.WriteShort(0);
G_EventEnd();
}
示例13: G_EventCameraAppear
/**
* @brief Send an appear event to the client.
* @param playerMask The players to send the event to
* @param ent The camera that should appear to the players included in the given mask.
*/
void G_EventCameraAppear (playermask_t playerMask, const Edict& ent)
{
G_EventAdd(playerMask, EV_CAMERA_APPEAR, ent.number);
gi.WritePos(ent.origin);
gi.WriteByte(ent.team);
gi.WriteByte(ent.dir);
gi.WriteByte(ent.camera.cameraType);
/* strip the higher bits - only send levelflags */
gi.WriteByte(ent.spawnflags & 0xFF);
gi.WriteByte(ent.camera.rotate);
G_EventEnd();
}
示例14: G_EventReactionFireChange
void G_EventReactionFireChange (const Edict& ent)
{
const FiremodeSettings& fireMode = ent.chr.RFmode;
const objDef_t* od = fireMode.getWeapon();
G_EventAdd(G_PlayerToPM(ent.getPlayer()), EV_ACTOR_REACTIONFIRECHANGE, ent.number);
gi.WriteByte(fireMode.getFmIdx());
gi.WriteByte(fireMode.getHand());
gi.WriteShort(od ? od->idx : NONE);
G_EventEnd();
}
示例15: G_EventThrow
/**
* @param[in] teamMask the vis mask to determine the clients from this event is send to
* @param[in] fd The firedefinition to use
* @param[in] dt Delta time
* @param[in] flags bitmask of the following values: @c SF_BODY, @c SF_IMPACT, @c SF_BOUNCING and @c SF_BOUNCED
* @param[in] position The current position
* @param[in] velocity The velocity of the throw
*/
void G_EventThrow (teammask_t teamMask, const fireDef_t* fd, float dt, byte flags, const vec3_t position, const vec3_t velocity)
{
G_EventAdd(G_VisToPM(teamMask), EV_ACTOR_THROW, -1);
gi.WriteShort(dt * 1000);
gi.WriteShort(fd->obj->idx);
gi.WriteByte(fd->weapFdsIdx);
gi.WriteByte(fd->fdIdx);
gi.WriteByte(flags);
gi.WritePos(position);
gi.WritePos(velocity);
G_EventEnd();
}