g_client.c File Reference

Main part of the game logic. More...

#include "g_local.h"
Include dependency graph for g_client.c:

Go to the source code of this file.

Functions

unsigned int G_TeamToPM (int team)
 Generates the player bit mask for a given team.
unsigned int G_VisToPM (unsigned int vis_mask)
 Converts vis mask to player mask.
void G_ClientPrintf (const player_t *player, int printLevel, const char *fmt,...)
void G_GiveTimeUnits (int team)
 Network function to update the time units (TUs) for each team-member.
void G_SendState (unsigned int playerMask, const edict_t *ent)
static void G_SendParticle (unsigned int playerMask, const edict_t *ent)
static void G_EdictAppear (unsigned int playerMask, const edict_t *ent)
 Send an appear event to the client.
void G_AppearPerishEvent (unsigned int playerMask, qboolean appear, edict_t *check, const edict_t *ent)
 Send the appear or perish event to the affected clients.
void G_CenterView (const edict_t *ent)
 Centers the view for all clients that are seeing the given edict on the world position of the edict.
void G_SendInvisible (player_t *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.
int G_GetActiveTeam (void)
 Returns the current active team to the server.
static qboolean G_ActionCheck (const player_t *player, edict_t *ent, int TU)
 Checks whether the requested action is possible.
qboolean G_ActionCheckForCurrentTeam (const player_t *player, edict_t *ent, int TU)
 Checks whether the requested action is possible for the current active team.
qboolean G_ActionCheckWithoutTeam (const player_t *player, edict_t *ent, int TU)
 Checks whether the requested action is possible.
static void G_ClientTurn (player_t *player, edict_t *ent, byte dv)
 Sends the actual actor turn event over the netchannel.
static void G_ClientStateChangeUpdate (edict_t *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.
void G_ClientStateChange (const player_t *player, edict_t *ent, int reqState, qboolean checkaction)
 Changes the state of a player/soldier.
qboolean G_ClientCanReload (edict_t *ent, containerIndex_t containerID)
 Returns true if actor can reload weapon.
void G_ClientGetWeaponFromInventory (edict_t *ent)
 Retrieve or collect weapon from any linked container for the actor.
qboolean G_ClientUseEdict (const player_t *player, edict_t *actor, edict_t *edict)
 This function 'uses' the edict. E.g. it opens the door when the player wants it to open.
int G_ClientAction (player_t *player)
 The client sent us a message that he did something. We now execute the related fucntion(s) adn notify him if neccessary.
static void G_GetTeam (player_t *player)
 Sets the teamnum var for this match.
void G_SetTeamForPlayer (player_t *player, const int team)
int G_ClientGetTeamNum (const player_t *player)
 Returns the assigned team number of the player.
int G_ClientGetTeamNumPref (const player_t *player)
 Returns the preferred team number for the player.
qboolean G_ClientIsReady (const player_t *player)
static void G_GetStartingTeam (const player_t *player)
 Chose a team that should start the match.
static edict_tG_ClientGetFreeSpawnPoint (const player_t *player, int spawnType)
 Find valid actor spawn fields for this player.
static qboolean G_ActorSpawnIsAllowed (const int num, const int team)
 Checks whether the spawn of an actor is allowed for the current running match.
static void G_ThinkActorDieAfterSpawn (edict_t *ent)
 Think function for actors that spawn dead.
static void G_ThinkActorGoCrouch (edict_t *ent)
 Think function for actors that spawn crouched.
edict_tG_ClientGetFreeSpawnPointForActorSize (const player_t *player, const actorSizeEnum_t actorSize)
 Searches a free spawning point for a given actor size.
static void G_ClientReadInventory (edict_t *ent)
 Read the inventory from the clients team data.
static void G_ClientReadCharacter (edict_t *ent)
 Reads the character data from the netchannel that is needed to spawn an actor.
static void G_ClientSkipActorInfo (void)
 Call this if you want to skip some actor netchannel data.
static void G_ClientAssignDefaultActorValues (edict_t *ent)
 Used after spawning an actor to set some default values that are not read from the network event.
void G_ClientInitActorStates (const player_t *player)
 This is called after the actors are spawned and will set actor states without consuming TUs.
void G_ClientTeamInfo (const player_t *player)
 The client lets the server spawn the actors for a given player by sending their information (models, inventory, etc..) over the network.
static void G_ClientSendEdictsAndBrushModels (const player_t *player)
 Send brush models for entities like func_breakable and func_door and triggers with their mins and maxs 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.
qboolean G_ClientBegin (player_t *player)
 This functions starts the client.
void G_ClientSpawn (player_t *player)
 Sets the team, init the TU and sends the player stats.
void G_ClientUserinfoChanged (player_t *player, char *userinfo)
 called whenever the player updates a userinfo variable.
qboolean G_ClientConnect (player_t *player, char *userinfo, size_t userinfoSize)
 Checks whether the connection is valid or invalid and set some user info keys.
void G_ClientDisconnect (player_t *player)
void G_ResetClientData (void)
 Called after every player has joined.

Variables

static chrScoreMission_t scoreMission [MAX_EDICTS]
static int scoreMissionNum = 0

Detailed Description

Main part of the game logic.

Definition in file g_client.c.


Function Documentation

static qboolean G_ActionCheck ( const player_t player,
edict_t ent,
int  TU 
) [static]

Checks whether the requested action is possible.

Parameters:
[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 301 of file g_client.c.

References _, ET_ACTOR, ET_ACTOR2x2, G_ActorUsableTUs(), G_ClientPrintf(), G_IsDead, G_IsStunned, edict_s::inuse, player_s::num, player_s::pers, edict_s::pnum, PRINT_HUD, qfalse, qtrue, client_persistant_t::team, edict_s::team, and edict_s::type.

Referenced by G_ActionCheckForCurrentTeam(), and G_ActionCheckWithoutTeam().

qboolean G_ActionCheckForCurrentTeam ( const player_t player,
edict_t ent,
int  TU 
)

Checks whether the requested action is possible for the current active team.

Parameters:
[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 352 of file g_client.c.

References _, level_locals_t::activeTeam, G_ActionCheck(), G_ClientPrintf(), level, player_s::pers, PRINT_HUD, qfalse, qtrue, and client_persistant_t::team.

Referenced by G_ActorInvMove(), G_ClientMove(), G_ClientShoot(), G_ClientStateChange(), G_ClientTurn(), and G_ClientUseEdict().

qboolean G_ActionCheckWithoutTeam ( const player_t player,
edict_t ent,
int  TU 
)

Checks whether the requested action is possible.

Parameters:
[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
See also:
G_ActionCheck

Definition at line 375 of file g_client.c.

References G_ActionCheck().

Referenced by G_ClientShoot().

static qboolean G_ActorSpawnIsAllowed ( const int  num,
const int  team 
) [inline, static]

Checks whether the spawn of an actor is allowed for the current running match.

Note:
Don't allow spawning of soldiers for multiplayer if: + the sv_maxsoldiersperplayer limit is hit (e.g. the assembled team is bigger than the allowed number of soldiers) + the team already hit the max allowed amount of soldiers
Parameters:
num The nth actor the player want to spawn in the game.
team The team the player is part of.
Returns:
true if spawn is allowed, false otherwise.

Definition at line 940 of file g_client.c.

References cvar_s::integer, level, level_locals_t::num_spawned, qtrue, sv_maxclients, and sv_maxsoldiersperteam.

Referenced by G_ClientTeamInfo().

void G_AppearPerishEvent ( unsigned int  playerMask,
qboolean  appear,
edict_t check,
const edict_t ent 
)

Send the appear or perish event to the affected clients.

Parameters:
[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 NULL.
See also:
CL_ActorAppear

Definition at line 159 of file g_client.c.

References ABILITY_MIND, ABILITY_SPEED, edict_s::body, edict_s::chr, edict_s::dir, ET_ACTOR, ET_ACTOR2x2, ET_ITEM, ET_PARTICLE, EV_ACTOR_APPEAR, EV_ACTOR_STATECHANGE, EV_ENT_PERISH, edict_s::fieldSize, G_EdictAppear(), G_IsVisibleOnBattlefield, G_SendInventory(), G_SendParticle(), G_TeamToPM(), character_s::gender, GET_MORALE, GET_TU, gi, edict_s::head, teamDef_s::idx, LEFT, MAX_SKILL, character_s::maxHP, NONE, edict_s::number, edict_s::pnum, edict_s::pos, RIGHT, character_s::score, chrScoreGlobal_s::skills, character_s::skin, SKIP_LOCAL_ENTITY, edict_s::state, STATE_PUBLIC, edict_s::team, character_s::teamDef, edict_s::type, and edict_s::visflags.

Referenced by G_DoTestVis(), G_MatchSendResults(), G_MissionThink(), and G_SplashDamage().

void G_CenterView ( const edict_t ent  ) 

Centers the view for all clients that are seeing the given edict on the world position of the edict.

Parameters:
ent The edict to use the position from

Definition at line 239 of file g_client.c.

References EV_CENTERVIEW, G_VisToPM(), gi, edict_s::pos, and edict_s::visflags.

Referenced by G_MoralePanic().

int G_ClientAction ( player_t player  ) 

The client sent us a message that he did something. We now execute the related fucntion(s) adn notify him if neccessary.

Parameters:
[in] player The player to execute the action for (the actor belongs to this player)
Note:
a client action will also send the server side edict number to determine the actor

Definition at line 610 of file g_client.c.

References byte, edict_s::chr, edict_s::clientAction, game_import_t::csi, FL_GROUPSLAVE, edict_s::flags, format, G_ActorInvMove(), G_ActorReserveTUs(), G_ActorUseDoor(), G_ClientMove(), G_ClientShoot(), G_ClientStateChange(), G_ClientTurn(), G_EdictsGetByNum(), G_ReactionFireUpdate(), gi, edict_s::groupMaster, character_s::i, i, INVDEF, INVSH_GetItemByIDX(), INVSH_SearchInInventory(), edict_s::number, csi_s::numIDs, pa_format, PA_INVMOVE, PA_MOVE, PA_NULL, PA_REACT_SELECT, PA_RESERVE_STATE, PA_SHOOT, PA_STATE, PA_TURN, PA_USE_DOOR, player_s::pers, pos, qtrue, chrReservations_s::reaction, character_s::reservedTus, client_persistant_t::team, and edict_s::type.

Referenced by GetGameAPI().

static void G_ClientAssignDefaultActorValues ( edict_t ent  )  [static]

Used after spawning an actor to set some default values that are not read from the network event.

Parameters:
ent The actor edict to set the values for.

Todo:
for now, heal fully upon entering mission

Definition at line 1110 of file g_client.c.

References ABILITY_MIND, edict_s::body, edict_s::chr, CHRSH_CharGetBody(), CHRSH_CharGetHead(), GET_MORALE, gi, edict_s::head, character_s::HP, edict_s::HP, character_s::morale, edict_s::morale, character_s::score, character_s::scoreMission, scoreMissionNum, and chrScoreGlobal_s::skills.

Referenced by G_ClientTeamInfo().

qboolean G_ClientBegin ( player_t player  ) 
qboolean G_ClientCanReload ( edict_t ent,
containerIndex_t  containerID 
)

Returns true if actor can reload weapon.

See also:
AI_ActorThink

Definition at line 502 of file g_client.c.

References CONTAINER, game_import_t::csi, gi, csi_s::idLeft, csi_s::idRight, INVSH_LoadableInWeapon(), invList_s::item, invList_s::next, csi_s::numIDs, qfalse, qtrue, RIGHT, and item_s::t.

Referenced by AI_TryToReloadWeapon(), and AIL_canreload().

qboolean G_ClientConnect ( player_t player,
char *  userinfo,
size_t  userinfoSize 
)

Checks whether the connection is valid or invalid and set some user info keys.

Parameters:
[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
See also:
G_ClientDisconnect
CL_ConnectionlessPacket
Todo:
Check if the teamnum preference has already reached maxsoldiers and reject connection if so
Returns:
false if the connection is refused, true otherwise

Definition at line 1359 of file g_client.c.

References Com_Printf(), G_ClientDisconnect(), G_ClientUserinfoChanged(), G_PlayerToPM, gi, Info_SetValueForKey(), Info_ValueForKey(), player_s::inuse, client_persistant_t::netname, password, player_s::pers, PRINT_CONSOLE, qfalse, qtrue, REJ_BANNED, REJ_PASSWORD_REQUIRED_OR_INCORRECT, cvar_s::string, and SV_FilterPacket().

Referenced by GetGameAPI().

void G_ClientDisconnect ( player_t player  ) 
static edict_t* G_ClientGetFreeSpawnPoint ( const player_t player,
int  spawnType 
) [static]

Find valid actor spawn fields for this player.

Note:
Already used spawn-point are not found because ent->type is changed in G_ClientTeamInfo.
Parameters:
[in] player The player to spawn the actors for.
[in] spawnType The type of spawn-point so search for (ET_ACTORSPAWN or ET_ACTOR2x2SPAWN)
Returns:
A pointer to a found spawn point or NULL if nothing was found or on error.

Definition at line 906 of file g_client.c.

References count, ET_ACTOR2x2SPAWN, ET_ACTORSPAWN, G_EdictsGetNext(), level, MAX_EDICTS, player_s::pers, level_locals_t::randomSpawn, edict_s::team, client_persistant_t::team, and edict_s::type.

Referenced by G_ClientGetFreeSpawnPointForActorSize().

edict_t* G_ClientGetFreeSpawnPointForActorSize ( const player_t player,
const actorSizeEnum_t  actorSize 
)

Searches a free spawning point for a given actor size.

Parameters:
[in] player The player to get the free spawn points for
[in] actorSize The actor size to get a spawning point for
Returns:
An actor edict or NULL if no free spawning point was found

Definition at line 974 of file g_client.c.

References ACTOR_SIZE_2x2, ACTOR_SIZE_NORMAL, edict_s::chr, ET_ACTOR, ET_ACTOR2x2, ET_ACTOR2x2SPAWN, ET_ACTORSPAWN, edict_s::fieldSize, character_s::fieldSize, FL_DESTROYABLE, edict_s::flags, G_ClientGetFreeSpawnPoint(), G_ThinkActorDieAfterSpawn(), G_ThinkActorGoCrouch(), G_TouchTriggers(), gi, edict_s::HP, level, edict_s::morale, edict_s::nextthink, player_s::num, level_locals_t::num_alive, level_locals_t::num_spawned, edict_s::pnum, edict_s::spawnflags, STATE_CROUCHED, STATE_DEAD, STATE_STUN, edict_s::team, edict_s::think, and edict_s::type.

Referenced by G_ClientTeamInfo(), and G_SpawnAIPlayer().

int G_ClientGetTeamNum ( const player_t player  ) 

Returns the assigned team number of the player.

Definition at line 831 of file g_client.c.

References player_s::pers, and client_persistant_t::team.

Referenced by GetGameAPI().

int G_ClientGetTeamNumPref ( const player_t player  ) 

Returns the preferred team number for the player.

Definition at line 840 of file g_client.c.

References Info_ValueForKey(), player_s::pers, and client_persistant_t::userinfo.

Referenced by G_GetTeam(), and GetGameAPI().

void G_ClientGetWeaponFromInventory ( edict_t ent  ) 

Retrieve or collect weapon from any linked container for the actor.

Note:
This function will also collect items from floor containers when the actor is standing on a given point.
See also:
AI_ActorThink

Definition at line 533 of file g_client.c.

References item_s::a, edict_s::chr, CONTAINER, game_import_t::csi, G_ActorInvMove(), gi, csi_s::idRight, INVDEF, invList_s::item, invList_s::next, csi_s::numIDs, invDef_s::out, qtrue, objDef_s::reload, item_s::t, character_s::teamDef, objDef_s::weapon, and teamDef_s::weapons.

Referenced by AI_ActorThink().

void G_ClientInitActorStates ( const player_t player  ) 

This is called after the actors are spawned and will set actor states without consuming TUs.

Parameters:
player The player to perform the action for

Definition at line 1133 of file g_client.c.

References G_ActorGetByUCN(), G_ActorSetTU(), G_ClientStateChange(), G_ClientStateChangeUpdate(), gi, i, player_s::pers, qfalse, client_persistant_t::team, and edict_s::TU.

Referenced by GetGameAPI().

qboolean G_ClientIsReady ( const player_t player  ) 
Returns:
true if the player is for starting the multiplayer match

Definition at line 849 of file g_client.c.

References player_s::isReady.

Referenced by GetGameAPI().

void G_ClientPrintf ( const player_t player,
int  printLevel,
const char *  fmt,
  ... 
)

Send messages to human players

Parameters:
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 80 of file g_client.c.

References G_IsAIPlayer, and gi.

Referenced by G_ActionCheck(), G_ActionCheckForCurrentTeam(), G_ActorInvMove(), G_ActorSetInRescueZone(), G_CheckFlood(), G_ClientShoot(), G_ClientStateChange(), G_Damage(), G_MoraleBehaviour(), G_MoralePanic(), G_Players_f(), G_ReactionFireCanBeEnabled(), G_Say_f(), G_ShootGrenade(), Message_Use(), and StringToFilter().

static void G_ClientReadCharacter ( edict_t ent  )  [static]
static void G_ClientReadInventory ( edict_t ent  )  [static]

Read the inventory from the clients team data.

Parameters:
ent The actor's entity that should receive the items.

Definition at line 1029 of file g_client.c.

References inventoryInterface_s::AddToInventory, edict_s::chr, G_ReadItem(), game, gi, character_s::i, game_locals_t::i, invDef_s::id, objDef_s::id, INV_INVENTORY_BYTES, and item_s::t.

Referenced by G_ClientTeamInfo().

static void G_ClientSendEdictsAndBrushModels ( const player_t player  )  [static]

Send brush models for entities like func_breakable and func_door and triggers with their mins and maxs 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.

See also:
CL_AddBrushModel
EV_ADD_BRUSH_MODEL
Parameters:
[in] player The player the edicts are send to

Definition at line 1199 of file g_client.c.

References edict_s::angle, edict_s::angles, ET_NULL, EV_ADD_BRUSH_MODEL, G_EdictsGetFirst(), G_EdictsGetNextInUse(), G_PlayerToPM, gi, edict_s::modelindex, edict_s::number, edict_s::origin, edict_s::solid, SOLID_BSP, edict_s::spawnflags, edict_s::speed, edict_s::type, and edict_s::visflags.

Referenced by G_ClientBegin().

static void G_ClientSkipActorInfo ( void   )  [static]

Call this if you want to skip some actor netchannel data.

Note:
The fieldsize is not skipped
See also:
G_ClientTeamInfo

Definition at line 1092 of file g_client.c.

References G_ClientReadCharacter(), and gi.

Referenced by G_ClientTeamInfo().

void G_ClientSpawn ( player_t player  ) 
void G_ClientStateChange ( const player_t player,
edict_t ent,
int  reqState,
qboolean  checkaction 
)

Changes the state of a player/soldier.

Parameters:
[in,out] player The player who controlls the actor
[in] ent the edict to perform the state change for
[in] reqState The bit-map of the requested state change
[in] checkaction only activate the events - network stuff is handled in the calling function don't even use the G_ActionCheckForCurrentTeam function
Note:
Use checkaction true only for e.g. spawning values

Definition at line 442 of file g_client.c.

References _, edict_s::chr, chrReservations_s::crouch, G_ActionCheckForCurrentTeam(), G_ActorGetTUForReactionFire(), G_ActorReserveTUs(), G_ActorSetMaxs(), G_ActorUseTU(), G_ClientPrintf(), G_ClientStateChangeUpdate(), G_IsReaction, G_IsShaken, G_ReactionFireCanBeEnabled(), G_ReactionFireSetDefault(), G_RemoveReaction, G_SetState, G_ToggleCrouched, gi, PRINT_HUD, character_s::reservedTus, chrReservations_s::shot, STATE_CROUCHED, STATE_REACTION, STATE_REACTION_MANY, STATE_REACTION_ONCE, and TU_CROUCH.

Referenced by AI_ActorThink(), AI_InitPlayer(), AI_PrepBestAction(), AIL_crouch(), AIL_reactionfire(), G_ClientAction(), G_ClientInitActorStates(), G_ClientMove(), G_ReactionFireUpdate(), and G_ThinkActorGoCrouch().

static void G_ClientStateChangeUpdate ( edict_t ent  )  [static]

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.

Parameters:
ent The actor edict

Definition at line 415 of file g_client.c.

References G_CheckVis(), G_CheckVisTeamAll(), G_SendState(), G_SendStats(), G_VisToPM(), gi, qfalse, qtrue, edict_s::team, and edict_s::visflags.

Referenced by G_ClientInitActorStates(), and G_ClientStateChange().

void G_ClientTeamInfo ( const player_t player  ) 

The client lets the server spawn the actors for a given player by sending their information (models, inventory, etc..) over the network.

Parameters:
[in] player The player to spawn the actors for.
See also:
GAME_SendCurrentTeamSpawningInfo
clc_teaminfo

Definition at line 1159 of file g_client.c.

References Com_DPrintf(), Com_Printf(), DEBUG_GAME, edict_s::fieldSize, G_ActorSpawnIsAllowed(), G_ClientAssignDefaultActorValues(), G_ClientGetFreeSpawnPointForActorSize(), G_ClientReadCharacter(), G_ClientReadInventory(), G_ClientSkipActorInfo(), game, inventoryInterface_s::GetUsedSlots, gi, game_locals_t::i, i, client_persistant_t::netname, player_s::num, player_s::pers, edict_s::team, client_persistant_t::team, and TEAM_NO_ACTIVE.

Referenced by GetGameAPI().

static void G_ClientTurn ( player_t player,
edict_t ent,
byte  dv 
) [static]

Sends the actual actor turn event over the netchannel.

Definition at line 383 of file g_client.c.

References edict_s::dir, G_ActionCheckForCurrentTeam(), G_ActorDoTurn(), G_ActorUseTU(), G_EventActorTurn(), G_SendStats(), getDVdir, gi, and TU_TURN.

Referenced by G_ClientAction().

qboolean G_ClientUseEdict ( const player_t player,
edict_t actor,
edict_t edict 
)

This function 'uses' the edict. E.g. it opens the door when the player wants it to open.

See also:
PA_USE_DOOR
Parameters:
[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
Todo:
Do we have to change the trigger position here, too? I don't think this is really needed.
See also:
CL_ActorUseDoor
G_UseEdict

Definition at line 586 of file g_client.c.

References G_ActionCheckForCurrentTeam(), G_ActorUseTU(), G_SendStats(), G_UseEdict(), gi, qfalse, qtrue, and edict_s::TU.

Referenced by G_ActorUseDoor().

void G_ClientUserinfoChanged ( player_t player,
char *  userinfo 
)

called whenever the player updates a userinfo variable.

Note:
The game can override any of the settings in place (forcing skins or names, etc) before copying it off.

Definition at line 1307 of file g_client.c.

References player_s::autostand, Com_DPrintf(), CS_PLAYERNAMES, DEBUG_GAME, G_GetTeam(), G_MatchIsRunning(), gi, Info_Validate(), Info_ValueForKey(), player_s::isReady, client_persistant_t::netname, player_s::num, player_s::pers, Q_strncpyz(), player_s::reactionLeftover, client_persistant_t::team, TEAM_NO_ACTIVE, and client_persistant_t::userinfo.

Referenced by G_ClientConnect(), and GetGameAPI().

static void G_EdictAppear ( unsigned int  playerMask,
const edict_t ent 
) [static]

Send an appear event to the client.

Parameters:
playerMask The players to send the event to
ent The edict that should appear to the players included in the given mask.
Note:
Each following event that is relying on the fact that this edict must already be known in the client, must also adopt the client side parsing of the event times.

Definition at line 140 of file g_client.c.

References EV_ENT_APPEAR, gi, edict_s::number, edict_s::pos, and edict_s::type.

Referenced by G_AppearPerishEvent().

int G_GetActiveTeam ( void   ) 

Returns the current active team to the server.

If this has the value TEAM_NO_ACTIVE there is either no
living actor for any player left, or the round wasn't started yet.

Definition at line 288 of file g_client.c.

References level_locals_t::activeTeam, and level.

Referenced by G_GetNextActiveTeam(), and GetGameAPI().

static void G_GetStartingTeam ( const player_t player  )  [static]

Chose a team that should start the match.

Parameters:
[in] player In singleplayer mode the team of this player will get the first round
See also:
SVCmd_StartGame_f

Definition at line 860 of file g_client.c.

References level_locals_t::activeTeam, frand(), G_MatchIsRunning(), G_PrintStats(), game, i, int(), cvar_s::integer, player_s::inuse, level, level_locals_t::mapname, MAX_TEAMS, player_s::pers, game_locals_t::players, qtrue, player_s::roundDone, sv_maxclients, game_locals_t::sv_maxplayersperteam, client_persistant_t::team, and va().

Referenced by G_ClientSpawn().

static void G_GetTeam ( player_t player  )  [static]
void G_GiveTimeUnits ( int  team  ) 

Network function to update the time units (TUs) for each team-member.

Parameters:
[in] team The index of the team to update the values for.
See also:
G_SendStats

Definition at line 99 of file g_client.c.

References G_ActorGiveTimeUnits(), G_EdictsGetNextLivingActorOfTeam(), and G_SendStats().

Referenced by G_ClientEndRound(), and G_ClientSpawn().

void G_ResetClientData ( void   ) 

Called after every player has joined.

Definition at line 1438 of file g_client.c.

References scoreMissionNum.

Referenced by G_SpawnEntities().

void G_SendInvisible ( player_t 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.

Note:
Call this for the first G_CheckVis call for every new actor or player
See also:
G_CheckVis
CL_ActorAdd

Definition at line 255 of file g_client.c.

References edict_s::chr, EV_ACTOR_ADD, edict_s::fieldSize, G_EdictsGetNextActor(), G_IsVisibleForTeam, G_PlayerToPM, character_s::gender, gi, teamDef_s::idx, level, NONE, level_locals_t::num_alive, edict_s::number, player_s::pers, edict_s::pnum, edict_s::pos, edict_s::state, STATE_PUBLIC, edict_s::team, client_persistant_t::team, TEAM_NO_ACTIVE, and character_s::teamDef.

Referenced by G_ClientSpawn().

static void G_SendParticle ( unsigned int  playerMask,
const edict_t ent 
) [static]

Send a particle spawn event to the client

Parameters:
[in] playerMask The clients that should see the particle
[in] ent The particle to spawn

Definition at line 125 of file g_client.c.

References EV_PARTICLE_APPEAR, gi, edict_s::number, edict_s::particle, and edict_s::spawnflags.

Referenced by G_AppearPerishEvent().

void G_SendState ( unsigned int  playerMask,
const edict_t ent 
)
void G_SetTeamForPlayer ( player_t player,
const int  team 
)
unsigned int G_TeamToPM ( int  team  ) 

Generates the player bit mask for a given team.

Parameters:
[in] team The team to create the player bit mask for
Note:
E.g. multiplayer team play can have more than one human player on the same team.

Definition at line 37 of file g_client.c.

References game, i, player_s::inuse, player_s::pers, game_locals_t::players, game_locals_t::sv_maxplayersperteam, and client_persistant_t::team.

Referenced by G_ActorInvMove(), G_AppearPerishEvent(), G_CheckVisTeam(), G_EventActorStats(), G_EventSetClientAction(), G_MatchSendResults(), G_ReactionFireReset(), and G_SendState().

static void G_ThinkActorDieAfterSpawn ( edict_t ent  )  [static]

Think function for actors that spawn dead.

Parameters:
ent The actor

Definition at line 952 of file g_client.c.

References G_ActorDieOrStun(), and edict_s::think.

Referenced by G_ClientGetFreeSpawnPointForActorSize().

static void G_ThinkActorGoCrouch ( edict_t ent  )  [static]

Think function for actors that spawn crouched.

Parameters:
ent The actor

Definition at line 962 of file g_client.c.

References G_ClientStateChange(), G_PLAYER_FROM_ENT, qtrue, STATE_CROUCHED, and edict_s::think.

Referenced by G_ClientGetFreeSpawnPointForActorSize().

unsigned int G_VisToPM ( unsigned int  vis_mask  ) 

Converts vis mask to player mask.

Parameters:
[in] vis_mask The visibility bit mask (contains the team numbers) that is converted to a player mask
Returns:
Returns a playermask for all the teams of the connected players that are marked in the given vis_mask.

Definition at line 59 of file g_client.c.

References G_TeamToVisMask, game, i, player_s::inuse, player_s::pers, game_locals_t::players, game_locals_t::sv_maxplayersperteam, and client_persistant_t::team.

Referenced by G_ActorInvMove(), G_CenterView(), G_ClientMove(), G_ClientShoot(), G_ClientStateChangeUpdate(), G_EventActorDie(), G_EventActorFall(), G_EventActorRevitalise(), G_EventActorTurn(), G_EventInventoryAmmo(), G_EventPerish(), G_EventShoot(), G_EventShootHidden(), G_EventStartShoot(), G_EventThrow(), G_InventoryRemoveItemByID(), G_MatchSendResults(), G_MissionThink(), G_MoraleBehaviour(), G_MoralePanic(), G_MoraleRage(), G_MoraleStopRage(), G_PhysicsStep(), and G_SplashDamage().


Variable Documentation

chrScoreMission_t scoreMission[MAX_EDICTS] [static]

Definition at line 28 of file g_client.c.

Referenced by G_UpdateCharacterBodycount().

int scoreMissionNum = 0 [static]

Definition at line 29 of file g_client.c.

Referenced by G_ClientAssignDefaultActorValues(), and G_ResetClientData().


Generated by  doxygen 1.6.2