UFO: Alien Invasion
|
Main part of the game logic. More...
#include "g_client.h"
#include "g_actor.h"
#include "g_ai.h"
#include "g_combat.h"
#include "g_edicts.h"
#include "g_inventory.h"
#include "g_match.h"
#include "g_move.h"
#include "g_reaction.h"
#include "g_utils.h"
#include "g_vis.h"
Go to the source code of this file.
Functions | |
Player * | G_PlayerGetNextHuman (Player *lastPlayer) |
Iterate through the list of players. More... | |
Player * | G_PlayerGetNextAI (Player *lastPlayer) |
Iterate through the list of players. More... | |
Player * | G_PlayerGetNextActiveHuman (Player *lastPlayer) |
Iterate through the list of players. More... | |
Player * | G_PlayerGetNextActiveAI (Player *lastPlayer) |
Iterate through the list of players. More... | |
playermask_t | G_TeamToPM (int team) |
Generates the player bit mask for a given team. More... | |
teammask_t | G_PMToVis (playermask_t playerMask) |
Converts player mask to vis mask. More... | |
playermask_t | G_VisToPM (teammask_t teamMask) |
Converts vis mask to player mask. More... | |
void | G_ClientPrintf (const Player &player, int printLevel, const char *fmt,...) |
void | G_GiveTimeUnits (int team) |
Network function to update the time units (TUs) for each team-member. More... | |
void | G_AppearPerishEvent (playermask_t playerMask, bool appear, Edict &check, const Edict *ent) |
Send the appear or perish event to the affected clients. More... | |
void | G_SendInvisible (const Player &player) |
This function sends all the actors to the client that are not visible initially - this is needed because an actor can e.g. produce sounds that are send over the net. And the client can only handle them if he knows the le_t (local entity) already. More... | |
int | G_GetActiveTeam (void) |
Returns the current active team to the server. More... | |
static bool | G_ActionCheck (const Player &player, Edict *ent) |
Checks whether the requested action is possible. More... | |
bool | G_ActionCheckForCurrentTeam (const Player &player, Actor *ent, int TU) |
Checks whether the requested action is possible for the current active team. More... | |
bool | G_ActionCheckForReaction (const Player &player, Actor *actor, int TU) |
Checks whether the requested action is possible. More... | |
static void | G_ClientTurn (Player &player, Actor *actor, dvec_t dvec) |
Sends the actual actor turn event over the netchannel. More... | |
static void | G_ClientStateChangeUpdate (Edict &ent) |
After an actor changed his state, he might get visible for other players. Check the vis here and send the state change to the clients that are seeing him already. More... | |
void | G_ClientStateChange (const Player &player, Actor *actor, int reqState, bool checkaction) |
Changes the state of a player/soldier. More... | |
bool | G_ClientCanReload (Actor *actor, containerIndex_t containerID) |
Returns true if actor can reload weapon. More... | |
bool | G_ClientGetWeaponFromInventory (Actor *actor) |
Retrieve or collect a loaded weapon from any linked container for the actor's right hand. More... | |
bool | G_ClientUseEdict (const Player &player, Actor *actor, Edict *edict) |
This function 'uses' the edict. E.g. it opens the door when the player wants it to open. More... | |
int | G_ClientAction (Player &player) |
The client sent us a message that he did something. We now execute the related function(s) and notify him if necessary. More... | |
static void | G_GetTeam (Player &player) |
Sets the teamnum var for this match. More... | |
bool | G_SetTeamForPlayer (Player &player, const int team) |
Set the used team for the given player. More... | |
int | G_ClientGetTeamNum (const Player &player) |
Returns the assigned team number of the player. More... | |
int | G_ClientGetTeamNumPref (const Player &player) |
Returns the preferred team number for the player. More... | |
bool | G_ClientIsReady (const Player *player) |
static void | G_GetStartingTeam (const Player &player) |
Chose a team that should start the match. More... | |
static Edict * | G_ClientGetFreeSpawnPoint (const Player &player, int spawnType) |
Find valid actor spawn fields for this player. More... | |
static bool | G_ActorSpawnIsAllowed (const int num, const int team) |
Checks whether the spawn of an actor is allowed for the current running match. More... | |
static void | G_ThinkActorDieAfterSpawn (Edict *ent) |
Think function for actors that spawn dead. More... | |
static void | G_ThinkActorGoCrouch (Edict *ent) |
Think function for actors that spawn crouched. More... | |
Actor * | G_ClientGetFreeSpawnPointForActorSize (const Player &player, const actorSizeEnum_t actorSize) |
Searches a free spawning point for a given actor size and turns it into an actor. More... | |
static void | G_ClientReadInventory (Edict *ent) |
Read the inventory from the clients team data. More... | |
static void | G_ClientReadCharacter (Edict *ent) |
Reads the character data from the netchannel that is needed to spawn an actor. More... | |
static void | G_ClientSkipActorInfo (void) |
Call this if you want to skip some actor netchannel data. More... | |
static void | G_ClientAssignDefaultActorValues (Actor *actor) |
Used after spawning an actor to set some default values that are not read from the network event. More... | |
void | G_ClientInitActorStates (const Player &player) |
This is called after the actors are spawned and will set actor states without consuming TUs. More... | |
void | G_ClientTeamInfo (const Player &player) |
The client lets the server spawn the actors for a given player by sending their information (models, inventory, etc..) over the network. More... | |
static void | G_ClientSendEdictsAndBrushModels (const Player &player) |
Send brush models for entities like func_breakable and func_door and triggers with their bounding boxes to the client and let him know about them. There are also entities that are announced here, but fully handled clientside - like func_rotating. More... | |
bool | G_ClientBegin (Player &player) |
This functions starts the client. More... | |
void | G_ClientStartMatch (Player &player) |
Sets the team, init the TU and sends the player stats. More... | |
void | G_ClientUserinfoChanged (Player &player, const char *userinfo) |
called whenever the player updates a userinfo variable. More... | |
bool | G_ClientConnect (Player *player, char *userinfo, size_t userinfoSize) |
Checks whether the connection is valid or invalid and set some user info keys. More... | |
void | G_ClientDisconnect (Player &player) |
void | G_ResetClientData (void) |
Called after every player has joined. More... | |
Variables | |
static chrScoreMission_t | scoreMission [MAX_EDICTS] |
static int | scoreMissionNum = 0 |
Main part of the game logic.
In case the connection is established (G_ClientConnect
), the client state is cs_connected
. The client will send SV_STATE_NEW, SV_New_f
sets the state to cs_spawning
, and asks the client to precache the data after sending the configstrings. After the client is done with it, it will send "begin" to the server. SV_Begin_f
will now set the client state to cs_began
and calls G_ClientBegin
. The server will ask the client to execute "spawnsoldiers" now. The client is answering with clc_teaminfo
and the server will call G_ClientTeamInfo
. The client state is now cs_spawned
. Last but not least the server informs the client that the match can now get started by asking to execute "startmatch". The client answers with NET_STATE_STARTMATCH and G_ClientStartMatch
is executed.
Definition in file g_client.cpp.
|
static |
Checks whether the requested action is possible.
[in] | player | Which player (human player) is trying to do the action |
[in] | ent | Which of his units is trying to do the action. |
Definition at line 337 of file g_client.cpp.
References _, G_ClientPrintf(), G_IsActor, G_IsDead, G_IsStunned, Edict::getPlayerNum(), Edict::getTeam(), Edict::inuse, and PRINT_HUD.
Referenced by G_ActionCheckForCurrentTeam(), and G_ActionCheckForReaction().
Checks whether the requested action is possible for the current active team.
[in] | player | Which player (human player) is trying to do the action |
[in] | ent | Which of his units is trying to do the action. |
[in] | TU | The time units to check against the ones ent has. the action with |
Definition at line 380 of file g_client.cpp.
References _, level_locals_s::activeTeam, G_ActionCheck(), G_ActorUsableTUs(), G_ClientPrintf(), level, and PRINT_HUD.
Referenced by G_ActorInvMove(), G_ClientMove(), G_ClientShoot(), G_ClientStateChange(), G_ClientTurn(), and G_ClientUseEdict().
Checks whether the requested action is possible.
[in] | player | Which player (human player) is trying to do the action |
[in] | actor | Which of his units is trying to do the action. |
[in] | TU | The time units to check against the ones actor has. the action with |
Definition at line 403 of file g_client.cpp.
References G_ActionCheck(), and Edict::getTus().
Referenced by G_ClientShoot().
Checks whether the spawn of an actor is allowed for the current running match.
num | The nth actor the player want to spawn in the game. |
team | The team the player is part of. |
true
if spawn is allowed, false
otherwise. Definition at line 1002 of file g_client.cpp.
References G_IsSinglePlayer, cvar_s::integer, level, level_locals_s::num_spawned, sv_maxsoldiersperplayer, and sv_maxsoldiersperteam.
Referenced by G_ClientTeamInfo().
void G_AppearPerishEvent | ( | playermask_t | playerMask, |
bool | appear, | ||
Edict & | check, | ||
const Edict * | ent | ||
) |
Send the appear or perish event to the affected clients.
[in] | playerMask | These are the affected players or clients In case of e.g. teamplay there can be more than one client affected - thus this is a player mask |
[in] | appear | Is this event about an appearing actor (or a perishing one) |
[in] | check | The edict we are talking about (that appears or perishes) |
[in] | ent | The edict that was responsible for letting the check edict appear or perish. Might be nullptr . |
Definition at line 245 of file g_client.cpp.
References ET_ACTOR, ET_ACTOR2x2, ET_CAMERA, ET_ITEM, ET_PARTICLE, ET_TRIGGER_RESCUE, G_EventActorAppear(), G_EventAddBrushModel(), G_EventCameraAppear(), G_EventEdictAppear(), G_EventEdictPerish(), G_EventSendParticle(), G_IsVisibleOnBattlefield, G_PMToVis(), G_SendInventory(), G_VisFlagsSwap(), gi, makeActor(), and Edict::type.
Referenced by AI_CheckRespawn(), G_DoTestVis(), G_MissionThink(), G_SplashDamage(), and G_VisMakeEverythingVisible().
int G_ClientAction | ( | Player & | player | ) |
The client sent us a message that he did something. We now execute the related function(s) and notify him if necessary.
[in] | player | The player to execute the action for (the actor belongs to this player) |
Definition at line 638 of file g_client.cpp.
References Edict::chr, Edict::clientAction, format(), G_ActorInvMove(), G_ActorReserveTUs(), G_ActorUseDoor(), G_ClientMove(), G_ClientShoot(), G_ClientStateChange(), G_ClientTurn(), G_EdictsGetByNum(), G_IsDoor, G_ReactionFireSettingsUpdate(), Inventory::getItemAtPos(), gi, i, character_s::inv, INVDEF, INVSH_GetItemByIDX(), isValidContId(), makeActor(), pa_format, PA_INVMOVE, PA_MOVE, PA_NULL, PA_REACT_SELECT, PA_RESERVE_STATE, PA_SHOOT, PA_STATE, PA_TURN, PA_USE, chrReservations_s::reaction, and character_s::reservedTus.
Referenced by GetGameAPI().
Used after spawning an actor to set some default values that are not read from the network event.
actor | The actor edict to set the values for. |
Definition at line 1190 of file g_client.cpp.
References ABILITY_MIND, chrScoreMission_s::carriedWeight, Edict::chr, CHRSH_CharGetBody(), CHRSH_CharGetHead(), GET_MORALE, Inventory::getWeight(), gi, Edict::HP, character_s::HP, chrScoreMission_s::init(), character_s::inv, character_s::morale, character_s::score, character_s::scoreMission, scoreMissionNum, Actor::setBody(), Actor::setHead(), Edict::setMorale(), and chrScoreGlobal_s::skills.
Referenced by G_ClientTeamInfo().
bool G_ClientBegin | ( | Player & | player | ) |
This functions starts the client.
Definition at line 1323 of file g_client.cpp.
References CS_PLAYERCOUNT, CS_PLAYERNAMES, G_ClientSendEdictsAndBrushModels(), G_EventEnd(), G_EventStart(), G_GetTeam(), gi, cvar_s::integer, level, level_locals_s::numplayers, PRINT_CONSOLE, and sv_teamplay.
Referenced by GetGameAPI().
bool G_ClientCanReload | ( | Actor * | actor, |
containerIndex_t | containerID | ||
) |
Returns true if actor can reload weapon.
Definition at line 536 of file g_client.cpp.
References Edict::chr, CID_LEFT, Item::def(), Edict::getContainer(), Inventory::getNextCont(), Container::getNextItem(), Edict::getRightHandItem(), character_s::inv, Item::isHeldTwoHanded(), and objDef_s::isLoadableInWeapon().
Referenced by AI_TryToReloadWeapon(), and AIL_canreload().
bool G_ClientConnect | ( | Player * | player, |
char * | userinfo, | ||
size_t | userinfoSize | ||
) |
Checks whether the connection is valid or invalid and set some user info keys.
[in,out] | player | The player that is trying to connect to the game |
[in,out] | userinfo | The userinfo data that is checked and changed |
[in] | userinfoSize | The size of the userinfo buffer |
false
if the connection is refused, true
otherwise Definition at line 1436 of file g_client.cpp.
References Com_Printf(), G_ClientDisconnect(), G_ClientUserinfoChanged(), G_PlayerToPM, gi, Info_SetValueForKey(), Info_ValueForKey(), OBJZERO, password, PRINT_CONSOLE, Q_streq, REJ_BANNED, REJ_PASSWORD_REQUIRED_OR_INCORRECT, REJ_SERVER_FULL, cvar_s::string, and SV_FilterPacket().
Referenced by GetGameAPI().
void G_ClientDisconnect | ( | Player & | player | ) |
Definition at line 1476 of file g_client.cpp.
References level_locals_s::activeTeam, CS_PLAYERCOUNT, G_ActorDie(), G_ClientEndRound(), G_EdictsGetNextLivingActor(), G_MatchEndCheck(), gi, level, level_locals_s::numplayers, Edict::pnum, PRINT_CONSOLE, and STATE_DEAD.
Referenced by G_ClientConnect(), G_GetTeam(), and GetGameAPI().
Find valid actor spawn fields for this player.
[in] | player | The player to spawn the actors for. |
[in] | spawnType | The type of spawn-point so search for (ET_ACTORSPAWN or ET_ACTOR2x2SPAWN) |
Definition at line 963 of file g_client.cpp.
References count, ET_ACTOR2x2SPAWN, ET_ACTORSPAWN, G_EdictsGetLivingActorFromPos(), G_EdictsGetNextInUse(), Edict::getTeam(), level, MAX_EDICTS, level_locals_s::noRandomSpawn, Edict::pos, and Edict::type.
Referenced by G_ClientGetFreeSpawnPointForActorSize().
Actor* G_ClientGetFreeSpawnPointForActorSize | ( | const Player & | player, |
const actorSizeEnum_t | actorSize | ||
) |
Searches a free spawning point for a given actor size and turns it into an actor.
[in] | player | The player to get the free spawn points for |
[in] | actorSize | The actor size to get a spawning point for |
nullptr
if no free spawning point was found Definition at line 1039 of file g_client.cpp.
References ACTOR_SIZE_2x2, ACTOR_SIZE_NORMAL, Edict::chr, ET_ACTOR, ET_ACTOR2x2, ET_ACTOR2x2SPAWN, ET_ACTORSPAWN, Edict::fieldSize, character_s::fieldSize, FL_DESTROYABLE, Edict::flags, G_ActorModifyCounters(), G_ClientGetFreeSpawnPoint(), G_EdictDuplicate(), G_ReactionFireTargetsCreate(), G_ThinkActorDieAfterSpawn(), G_ThinkActorGoCrouch(), G_VisFlagsReset(), Edict::getTeam(), gi, Edict::HP, level, makeActor(), Edict::nextthink, level_locals_s::num_spawned, Edict::setMorale(), Edict::setPlayerNum(), Edict::spawnflags, STATE_CROUCHED, STATE_DEAD, STATE_STUN, Edict::think, and Edict::type.
Referenced by G_ClientTeamInfo(), and G_SpawnAIPlayer().
int G_ClientGetTeamNum | ( | const Player & | player | ) |
Returns the assigned team number of the player.
Definition at line 889 of file g_client.cpp.
Referenced by G_GetTeam(), and GetGameAPI().
int G_ClientGetTeamNumPref | ( | const Player & | player | ) |
Returns the preferred team number for the player.
Definition at line 897 of file g_client.cpp.
References Info_IntegerForKey().
Referenced by G_GetTeam().
bool G_ClientGetWeaponFromInventory | ( | Actor * | actor | ) |
Retrieve or collect a loaded weapon from any linked container for the actor's right hand.
Definition at line 568 of file g_client.cpp.
References Edict::chr, CID_RIGHT, Item::def(), Container::def(), G_ActorInvMove(), Inventory::getNextCont(), Container::getNextItem(), character_s::inv, INVDEF, Item::isWeapon(), Item::mustReload(), invDef_s::out, character_s::teamDef, and teamDef_s::weapons.
Referenced by AI_ActorThink(), and AIL_grabweapon().
void G_ClientInitActorStates | ( | const Player & | player | ) |
This is called after the actors are spawned and will set actor states without consuming TUs.
player | The player to perform the action for |
Definition at line 1215 of file g_client.cpp.
References G_ActorSetTU(), G_ClientStateChange(), G_ClientStateChangeUpdate(), G_EdictsGetActorByUCN(), G_ReactionFireSettingsReserveTUs(), G_ReactionFireSettingsUpdate(), Edict::getTus(), gi, i, INVSH_GetItemByIDX(), length, and NONE.
Referenced by GetGameAPI().
bool G_ClientIsReady | ( | const Player * | player | ) |
true
if the player is for starting the multiplayer match Definition at line 905 of file g_client.cpp.
Referenced by GetGameAPI().
Send messages to human players
player | A player (AI players are ignored here) |
printLevel | A numeric value to restrict and channel the printing (CONSOLE, HUD, CHAT...) |
fmt | A format string as in printf |
Definition at line 206 of file g_client.cpp.
References G_IsAIPlayer, and gi.
Referenced by G_ActionCheck(), G_ActionCheckForCurrentTeam(), G_ActorInvMove(), G_CheckFlood(), G_ClientShoot(), G_ClientStateChange(), G_Players_f(), G_ReactionFireCanBeEnabled(), G_Say_f(), G_ShootGrenade(), Message_Use(), and Touch_NextMapTrigger().
Reads the character data from the netchannel that is needed to spawn an actor.
ent | The actor entity to save the read data in. |
Definition at line 1125 of file g_client.cpp.
References chrScoreGlobal_s::assignedMissions, character_s::body, character_s::bodySkin, teamDef_s::bodyTemplate, Edict::chr, game_import_s::csi, chrScoreGlobal_s::experience, character_s::gender, gi, character_s::head, character_s::headSkin, character_s::HP, character_s::init(), KILLED_NUM_TYPES, chrScoreGlobal_s::kills, MAX_TEAMDEFS, character_s::maxHP, character_s::minHP, character_s::morale, character_s::name, BodyData::numBodyParts(), character_s::path, character_s::score, SKILL_NUM_TYPES, chrScoreGlobal_s::skills, character_s::STUN, chrScoreGlobal_s::stuns, character_s::teamDef, csi_s::teamDef, woundInfo_s::treatmentLevel, character_s::ucn, and character_s::wounds.
Referenced by G_ClientSkipActorInfo(), and G_ClientTeamInfo().
Read the inventory from the clients team data.
ent | The actor's entity that should receive the items. |
Definition at line 1102 of file g_client.cpp.
References ABILITY_POWER, InventoryInterface::addToInventory(), Inventory::canHoldItemWeight(), Edict::chr, CID_EQUIP, Com_Printf(), Item::def(), G_ReadItem(), game, Edict::getIdNum(), gi, objDef_s::id, invDef_s::id, character_s::inv, game_locals_s::invi, level, level_locals_s::noEquipment, character_s::score, chrScoreGlobal_s::skills, and invDef_s::temp.
Referenced by G_ClientTeamInfo().
|
static |
Send brush models for entities like func_breakable and func_door and triggers with their bounding boxes to the client and let him know about them. There are also entities that are announced here, but fully handled clientside - like func_rotating.
[in] | player | The player the edicts are send to |
Definition at line 1296 of file g_client.cpp.
References ET_NULL, G_EdictsGetFirst(), G_EdictsGetNextInUse(), G_EventAddBrushModel(), G_PlayerToPM, G_VisFlagsAdd(), Edict::solid, SOLID_BSP, Edict::type, and Edict::visflags.
Referenced by G_ClientBegin().
Call this if you want to skip some actor netchannel data.
Definition at line 1168 of file g_client.cpp.
References G_ClientReadCharacter(), G_ReadItem(), gi, and i.
Referenced by G_ClientTeamInfo().
void G_ClientStartMatch | ( | Player & | player | ) |
Sets the team, init the TU and sends the player stats.
Definition at line 1361 of file g_client.cpp.
References level_locals_s::activeTeam, G_CheckVisPlayer(), G_EventEnd(), G_EventReset(), G_GetStartingTeam(), G_IsMultiPlayer, G_SendInvisible(), G_SendPlayerStats(), G_VisFlagsClear(), gi, level, cvar_s::modified, PRINT_CONSOLE, and sv_roundtimelimit.
Referenced by GetGameAPI().
Changes the state of a player/soldier.
[in,out] | player | The player who controls the actor |
[in] | actor | the edict to perform the state change for |
[in] | reqState | The bit-map of the requested state change |
[in] | checkaction | if false only activate the events - network stuff is handled in the calling function don't even use the G_ActionCheckForCurrentTeam function |
Definition at line 473 of file g_client.cpp.
References _, Edict::chr, chrReservations_s::crouch, Edict::fieldSize, G_ActionCheckForCurrentTeam(), G_ActorReserveTUs(), G_ActorSetMaxs(), G_ActorUseTU(), G_ClientPrintf(), G_ClientStateChangeUpdate(), G_EventReactionFireChange(), G_IsAI, G_ReactionFireSettingsReserveTUs(), G_SetState, G_ToggleCrouched, gi, Actor::isCrouched(), Actor::isReaction(), Actor::isShaken(), Edict::pos, PRINT_HUD, Actor::removeReaction(), character_s::reservedTus, chrReservations_s::shot, STATE_CROUCHED, STATE_REACTION, and TU_CROUCH.
Referenced by AI_ActorThink(), AI_InitPlayer(), AIL_crouch(), AIL_reactionfire(), G_ActorDieOrStun(), G_ClientAction(), G_ClientInitActorStates(), G_ClientMove(), G_MoraleBehaviour(), G_MoralePanic(), G_MoraleRage(), G_ReactionFireSettingsUpdate(), and G_ThinkActorGoCrouch().
After an actor changed his state, he might get visible for other players. Check the vis here and send the state change to the clients that are seeing him already.
ent | The actor edict |
Definition at line 446 of file g_client.cpp.
References G_CheckVis(), G_CheckVisTeamAll(), G_EventEnd(), G_EventSendState(), G_SendStats(), G_VisToPM(), Edict::getTeam(), and Edict::visflags.
Referenced by G_ClientInitActorStates(), and G_ClientStateChange().
void G_ClientTeamInfo | ( | const Player & | player | ) |
The client lets the server spawn the actors for a given player by sending their information (models, inventory, etc..) over the network.
[in] | player | The player to spawn the actors for. |
Definition at line 1255 of file g_client.cpp.
References AIL_InitActor(), Com_DPrintf(), Com_Printf(), Edict::contentFlags, DEBUG_GAME, Edict::fieldSize, G_ActorGetContentFlags(), G_ActorGiveTimeUnits(), G_ActorSpawnIsAllowed(), G_ClientAssignDefaultActorValues(), G_ClientGetFreeSpawnPointForActorSize(), G_ClientReadCharacter(), G_ClientReadInventory(), G_ClientSkipActorInfo(), G_TouchTriggers(), game, Edict::getTeam(), InventoryInterface::GetUsedSlots(), gi, i, game_locals_s::invi, length, Edict::origin, and TEAM_NO_ACTIVE.
Referenced by GetGameAPI().
Sends the actual actor turn event over the netchannel.
Definition at line 415 of file g_client.cpp.
References Edict::dir, G_ActionCheckForCurrentTeam(), G_ActorDoTurn(), G_ActorUseTU(), G_EventActorTurn(), G_EventEnd(), G_SendStats(), getDVdir, and TU_TURN.
Referenced by G_ClientAction().
This function 'uses' the edict. E.g. it opens the door when the player wants it to open.
[in] | player | The player is trying to activate the door |
[in,out] | actor | The actor the player is using to activate the entity |
[in,out] | edict | The entity that is to be used |
Definition at line 614 of file g_client.cpp.
References G_ActionCheckForCurrentTeam(), G_ActorUseTU(), G_EventEnd(), G_SendStats(), G_UseEdict(), and Edict::TU.
Referenced by G_ActorUseDoor().
void G_ClientUserinfoChanged | ( | Player & | player, |
const char * | userinfo | ||
) |
called whenever the player updates a userinfo variable.
Definition at line 1393 of file g_client.cpp.
References Com_DPrintf(), CS_PLAYERNAMES, DEBUG_GAME, G_GetTeam(), G_MatchIsRunning(), gi, Info_IntegerForKey(), Info_Validate(), Info_ValueForKey(), Q_strncpyz(), and TEAM_NO_ACTIVE.
Referenced by G_ClientConnect(), and GetGameAPI().
Returns the current active team to the server.
TEAM_NO_ACTIVE
there is either noDefinition at line 327 of file g_client.cpp.
References level_locals_s::activeTeam, and level.
Referenced by G_ClientEndRound(), G_GetNextActiveTeam(), and GetGameAPI().
|
static |
Chose a team that should start the match.
[in] | player | In singleplayer mode the team of this player will get the first turn |
Definition at line 916 of file g_client.cpp.
References level_locals_s::activeTeam, frand(), G_IsSinglePlayer, G_MatchIsRunning(), G_PlayerGetNextActiveHuman(), G_PrintStats(), int(), level, level_locals_s::mapname, MAX_TEAMS, and level_locals_s::teamOfs.
Referenced by G_ClientStartMatch().
|
static |
Sets the teamnum var for this match.
[in] | player | Pointer to connected player |
Definition at line 740 of file g_client.cpp.
References Com_DPrintf(), DEBUG_GAME, G_ClientDisconnect(), G_ClientGetTeamNum(), G_ClientGetTeamNumPref(), G_IsMultiPlayer, G_IsSinglePlayer, G_PlayerGetNextActiveAI(), G_PlayerGetNextActiveHuman(), G_SetTeamForPlayer(), gi, i, cvar_s::integer, level, MAX_TEAMS, level_locals_s::num_spawnpoints, PRINT_CONSOLE, sv_maxteams, sv_teamplay, TEAM_CIVILIAN, TEAM_DEFAULT, TEAM_MAX_HUMAN, and TEAM_PHALANX.
Referenced by G_ClientBegin(), and G_ClientUserinfoChanged().
Network function to update the time units (TUs) for each team-member.
[in] | team | The index of the team to update the values for. |
Definition at line 224 of file g_client.cpp.
References G_ActorGiveTimeUnits(), G_EdictsGetNextLivingActorOfTeam(), and G_SendStats().
Referenced by G_ClientEndRound().
Player* G_PlayerGetNextActiveAI | ( | Player * | lastPlayer | ) |
Iterate through the list of players.
lastPlayer | The player found in the previous iteration; if nullptr, we start at the beginning |
Definition at line 126 of file g_client.cpp.
References G_PlayerGetNextAI().
Referenced by AI_Run(), G_ClientEndRound(), G_GetPlayerForTeam(), and G_GetTeam().
Player* G_PlayerGetNextActiveHuman | ( | Player * | lastPlayer | ) |
Iterate through the list of players.
lastPlayer | The player found in the previous iteration; if nullptr, we start at the beginning |
Definition at line 110 of file g_client.cpp.
References G_PlayerGetNextHuman().
Referenced by AI_Run(), G_CheckForceEndRound(), G_ClientEndRound(), G_GetPlayerForTeam(), G_GetStartingTeam(), G_GetTeam(), G_Players_f(), G_PMToVis(), G_Say_f(), and G_VisToPM().
Player* G_PlayerGetNextAI | ( | Player * | lastPlayer | ) |
Iterate through the list of players.
lastPlayer | The player found in the previous iteration; if nullptr, we start at the beginning |
Definition at line 84 of file g_client.cpp.
References game, game_locals_s::players, and game_locals_s::sv_maxplayersperteam.
Referenced by AI_CreatePlayer(), and G_PlayerGetNextActiveAI().
Player* G_PlayerGetNextHuman | ( | Player * | lastPlayer | ) |
Iterate through the list of players.
lastPlayer | The player found in the previous iteration; if nullptr, we start at the beginning |
Definition at line 58 of file g_client.cpp.
References game, game_locals_s::players, and game_locals_s::sv_maxplayersperteam.
Referenced by G_PlayerGetNextActiveHuman(), G_SetTeamForPlayer(), G_TeamToPM(), and TEST_F().
teammask_t G_PMToVis | ( | playermask_t | playerMask | ) |
Converts player mask to vis mask.
[in] | playerMask | The player bit mask (contains the player numbers) that is converted to a vis mask |
playerMask
. Definition at line 165 of file g_client.cpp.
References G_PlayerGetNextActiveHuman(), G_PlayerToPM, and G_TeamToVisMask.
Referenced by G_AppearPerishEvent(), and G_SplashDamage().
Called after every player has joined.
Definition at line 1510 of file g_client.cpp.
References OBJZERO, and scoreMissionNum.
Referenced by G_SpawnEntities().
void G_SendInvisible | ( | const Player & | player | ) |
This function sends all the actors to the client that are not visible initially - this is needed because an actor can e.g. produce sounds that are send over the net. And the client can only handle them if he knows the le_t
(local entity) already.
G_CheckVis
call for every new actor or player Definition at line 302 of file g_client.cpp.
References G_EdictsGetNextActor(), G_EventActorAdd(), G_IsVisibleForTeam, G_PlayerToPM, Edict::getTeam(), level, level_locals_s::num_alive, and TEAM_NO_ACTIVE.
Referenced by G_ClientStartMatch().
bool G_SetTeamForPlayer | ( | Player & | player, |
const int | team | ||
) |
Set the used team for the given player.
[out] | player | The player the team should be set for |
[in] | team | The team to set for the given player |
true
if the team was set successfully, false
otherwise. Definition at line 852 of file g_client.cpp.
References G_IsAIPlayer, g_nospawn, G_PlayerGetNextHuman(), gi, Info_SetValueForKeyAsInteger(), cvar_s::integer, level, MAX_TEAMS, level_locals_s::num_spawnpoints, sv_teamplay, TEAM_ALIEN, TEAM_CIVILIAN, and TEAM_NO_ACTIVE.
Referenced by AI_CreatePlayer(), and G_GetTeam().
playermask_t G_TeamToPM | ( | int | team | ) |
Generates the player bit mask for a given team.
[in] | team | The team to create the player bit mask for |
Definition at line 144 of file g_client.cpp.
References G_PlayerGetNextHuman(), and G_PlayerToPM.
Referenced by G_ActorInvMove(), G_CheckVisTeam(), G_EventActorAppear(), G_EventSendState(), G_EventSetClientAction(), G_GetClosePlayerMask(), G_SendStats(), G_SplashDamage(), and G_VisMakeEverythingVisible().
Think function for actors that spawn dead.
ent | The actor |
Definition at line 1014 of file g_client.cpp.
References G_ActorDieOrStun(), makeActor(), and Edict::think.
Referenced by G_ClientGetFreeSpawnPointForActorSize().
Think function for actors that spawn crouched.
ent | The actor |
Definition at line 1026 of file g_client.cpp.
References G_ClientStateChange(), Edict::getPlayer(), makeActor(), STATE_CROUCHED, and Edict::think.
Referenced by G_ClientGetFreeSpawnPointForActorSize().
playermask_t G_VisToPM | ( | teammask_t | teamMask | ) |
Converts vis mask to player mask.
[in] | teamMask | The visibility bit mask (contains the team numbers) that is converted to a player mask |
vis_mask
. Definition at line 186 of file g_client.cpp.
References G_PlayerGetNextActiveHuman(), G_PlayerToPM, and G_TeamToVisMask.
Referenced by AI_CheckRespawn(), G_ActorCheckRevitalise(), G_ActorDieOrStun(), G_ActorInvMove(), G_ClientMove(), G_ClientShoot(), G_ClientStateChangeUpdate(), G_Damage(), G_EventActorDie(), G_EventActorRevitalise(), G_EventActorTurn(), G_EventCenterView(), G_EventEndShoot(), G_EventInventoryAmmo(), G_EventPerish(), G_EventShoot(), G_EventShootHidden(), G_EventSpawnFootstepSound(), G_EventStartShoot(), G_EventThrow(), G_InventoryRemoveItemByID(), G_InventoryToFloor(), G_MissionThink(), G_MoraleBehaviour(), G_MoralePanic(), G_MoraleRage(), G_MoraleStopPanic(), G_MoraleStopRage(), G_ReactionFireSettingsUpdate(), G_SplashDamage(), G_VisMakeEverythingVisible(), and Think_SmokeAndFire().
|
static |
Definition at line 51 of file g_client.cpp.
Referenced by G_UpdateCharacterBodycount().
|
static |
Definition at line 52 of file g_client.cpp.
Referenced by G_ClientAssignDefaultActorValues(), and G_ResetClientData().