UFO: Alien Invasion
|
Interface for g_client.cpp. More...
#include "g_local.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,...) __attribute__((format(__printf__ |
void void | G_GiveTimeUnits (int team) |
Network function to update the time units (TUs) for each team-member. More... | |
void | G_AppearPerishEvent (playermask_t player_mask, 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... | |
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_ActionCheckForCurrentTeam2 (const Player &player, Edict *ent, int TU) |
bool | G_ActionCheckForReaction (const Player &player, Actor *actor, int TU) |
Checks whether the requested action is possible. 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 *door) |
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... | |
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) |
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... | |
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... | |
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... | |
Interface for g_client.cpp.
Definition in file g_client.h.
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().
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().
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().
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().
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().
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().
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().
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().
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().