void G_EventSendState (playermask_t playerMask, const Edict& ent) { G_EventActorStateChange(playerMask & G_TeamToPM(ent.team), ent); G_EventAdd(playerMask & ~G_TeamToPM(ent.team), EV_ACTOR_STATECHANGE, ent.number); gi.WriteShort(ent.state & STATE_PUBLIC); G_EventEnd(); }
void G_EventSendState (unsigned int playerMask, const edict_t *ent) { G_EventActorStateChange(playerMask & G_TeamToPM(ent->team), ent); G_EventAdd(playerMask & ~G_TeamToPM(ent->team), EV_ACTOR_STATECHANGE, ent->number); gi.WriteShort(ent->state & STATE_PUBLIC); G_EventEnd(); }
/** * @brief Guess! Reset all "shaken" states on end of turn? * @note Normally called on end of turn. * @sa G_ClientStateChange * @param[in] team Index of team to loop through. */ void G_ReactionFireReset (int team) { edict_t *ent = NULL; while ((ent = G_EdictsGetNextLivingActorOfTeam(ent, team))) { /** @todo why do we send the state here and why do we change the "shaken" * state? - see G_MoraleBehaviour */ G_RemoveShaken(ent); G_EventActorStateChange(G_TeamToPM(ent->team), ent); } }
void G_EventActorAppear (playermask_t playerMask, const Edict& check, const Edict* ent) { const int mask = G_TeamToPM(check.team) & playerMask; /* parsed in CL_ActorAppear */ G_EventAdd(playerMask, EV_ACTOR_APPEAR, check.number); gi.WriteShort(ent && ent->number > 0 ? ent->number : SKIP_LOCAL_ENTITY); gi.WriteByte(check.team); gi.WriteByte(check.chr.teamDef ? check.chr.teamDef->idx : NONE); gi.WriteByte(check.chr.gender); gi.WriteShort(check.chr.ucn); gi.WriteByte(check.pnum); gi.WriteGPos(check.pos); gi.WriteByte(check.dir); if (check.getRightHandItem()) { gi.WriteShort(check.getRightHandItem()->def()->idx); } else { gi.WriteShort(NONE); } if (check.getLeftHandItem()) { gi.WriteShort(check.getLeftHandItem()->def()->idx); } else { gi.WriteShort(NONE); } if (check.body == 0 || check.head == 0) { gi.Error("invalid body and/or head model indices"); } gi.WriteShort(check.body); gi.WriteShort(check.head); gi.WriteByte(check.chr.bodySkin); gi.WriteByte(check.chr.headSkin); /* strip the server private states */ gi.WriteShort(check.state & STATE_PUBLIC); gi.WriteByte(check.fieldSize); /* get the max values for TU and morale */ gi.WriteByte(G_ActorCalculateMaxTU(&check)); gi.WriteByte(std::min(MAX_SKILL, GET_MORALE(check.chr.score.skills[ABILITY_MIND]))); gi.WriteShort(check.chr.maxHP); G_EventEnd(); if (mask) { G_EventActorStateChange(mask, check); G_SendInventory(mask, check); } }