Team management, name generation and parsing. More...
#include "client.h"
#include "cl_game.h"
#include "cl_team.h"
#include "battlescape/cl_localentity.h"
#include "battlescape/cl_actor.h"
#include "cl_inventory.h"
#include "battlescape/events/e_parse.h"
#include "ui/ui_data.h"
#include "ui/ui_nodes.h"
#include "battlescape/events/e_main.h"
#include "campaign/save/save_character.h"
#include "campaign/save/save_inventory.h"
Go to the source code of this file.
Functions | |
customSkin_t * | Com_AllocateCustomSkin (void) |
Allocate a skin from the cls structure. | |
static customSkin_t * | Com_GetCustomSkinByIDS (int idx) |
Get a customskin from idx. | |
static const char * | CL_GetTeamSkinName (int id) |
Translate the skin id to skin name. | |
static void | CL_CharacterSkillAndScoreCvars (const character_t *chr, const char *cvarPrefix) |
static void | CL_ActorCvars (const character_t *chr, const char *cvarPrefix) |
Updates the character cvars for the given character. | |
static void | CL_UGVCvars (const character_t *chr) |
Updates the UGV cvars for the given "character". | |
void | CL_UpdateCharacterValues (const character_t *chr, const char *cvarPrefix) |
qboolean | CL_SaveCharacterXML (mxml_node_t *p, const character_t *chr) |
saves a character to a given xml node | |
qboolean | CL_LoadCharacterXML (mxml_node_t *p, character_t *chr) |
Loads a character from a given xml node. | |
static void | CL_SaveItemXML (mxml_node_t *p, item_t item, containerIndex_t container, int x, int y) |
Save one item. | |
void | CL_SaveInventoryXML (mxml_node_t *p, const inventory_t *i) |
Save callback for savegames in XML Format. | |
static void | CL_LoadItemXML (mxml_node_t *n, item_t *item, containerIndex_t *container, int *x, int *y) |
Load one item. | |
void | CL_LoadInventoryXML (mxml_node_t *p, inventory_t *i) |
Load callback for savegames in XML Format. | |
void | CL_GenerateCharacter (character_t *chr, const char *teamDefName) |
Generates the skills and inventory for a character and for a 2x2 unit. | |
static void | CL_InitSkin_f (void) |
Init skins into the GUI. | |
static int | CL_FixCustomSkinIDX (int idx) |
Fix customskin idx accoding to game mode. | |
static void | CL_ChangeSkin_f (void) |
Change the skin of the selected actor. | |
static void | CL_ChangeSkinForWholeTeam_f (void) |
Use current skin for all team members onboard. | |
void | TEAM_InitStartup (void) |
Variables | |
chrList_t | chrDisplayList |
List of currently displayed or equipeable characters. |
Team management, name generation and parsing.
Definition in file cl_team.c.
static void CL_ActorCvars | ( | const character_t * | chr, | |
const char * | cvarPrefix | |||
) | [static] |
Updates the character cvars for the given character.
The models and stats that are displayed in the menu are stored in cvars. These cvars are updated here when you select another character.
[in] | chr | Pointer to character_t (may not be null) |
[in] | cvarPrefix |
Definition at line 138 of file cl_team.c.
References Cvar_Set(), invList_s::item, LEFT, objDef_s::model, RIGHT, item_s::t, and va().
Referenced by CL_UpdateCharacterValues().
static void CL_ChangeSkin_f | ( | void | ) | [static] |
Change the skin of the selected actor.
Definition at line 545 of file cl_team.c.
References chr_list_s::chr, CL_FixCustomSkinIDX(), CL_GetTeamSkinName(), cl_selected, Cvar_GetInteger(), Cvar_Set(), Cvar_SetValue(), cvar_s::integer, chr_list_s::num, and character_s::skin.
Referenced by TEAM_InitStartup().
static void CL_ChangeSkinForWholeTeam_f | ( | void | ) | [static] |
Use current skin for all team members onboard.
Definition at line 567 of file cl_team.c.
References chr_list_s::chr, CL_FixCustomSkinIDX(), Cvar_GetInteger(), i, chr_list_s::num, and character_s::skin.
Referenced by TEAM_InitStartup().
static void CL_CharacterSkillAndScoreCvars | ( | const character_t * | chr, | |
const char * | cvarPrefix | |||
) | [static] |
Definition at line 86 of file cl_team.c.
References ABILITY_ACCURACY, ABILITY_MIND, ABILITY_POWER, ABILITY_SPEED, CHRSH_CharGetBody(), CHRSH_CharGetHead(), CL_ActorGetSkillString(), CL_GetTeamSkinName(), Cvar_ForceSet(), Cvar_Set(), character_s::HP, chrScoreGlobal_s::initialSkills, character_s::maxHP, character_s::name, character_s::score, SKILL_ASSAULT, SKILL_CLOSE, SKILL_EXPLOSIVE, SKILL_HEAVY, SKILL_SNIPER, chrScoreGlobal_s::skills, character_s::skin, and va().
Referenced by CL_UpdateCharacterValues().
static int CL_FixCustomSkinIDX | ( | int | idx | ) | [static] |
Fix customskin idx accoding to game mode.
TODO we should check somewhere there is at least 1 skin
Definition at line 526 of file cl_team.c.
References Com_GetCustomSkinByIDS(), GAME_IsMultiplayer, GAME_IsSingleplayer, customSkin_s::multiplayer, and customSkin_s::singleplayer.
Referenced by CL_ChangeSkin_f(), and CL_ChangeSkinForWholeTeam_f().
void CL_GenerateCharacter | ( | character_t * | chr, | |
const char * | teamDefName | |||
) |
Generates the skills and inventory for a character and for a 2x2 unit.
[in] | chr | The employee to create character data for. |
[in] | teamDefName | Which team to use for creation. |
Definition at line 474 of file cl_team.c.
References ACTOR_HAND_NOT_SET, CHRSH_CharGenAbilitySkills(), CL_ActorSetShotSettings(), cls, Com_GetCharacterValues(), inventoryInterface_s::DestroyInventory, GAME_IsMultiplayer, character_s::i, client_static_s::i, client_static_s::nextUniqueCharacterNumber, and character_s::ucn.
Referenced by E_CreateEmployeeAtIndex(), and GAME_AppendTeamMember().
static const char* CL_GetTeamSkinName | ( | int | id | ) | [static] |
Translate the skin id to skin name.
[in] | id | The id of the skin |
Definition at line 78 of file cl_team.c.
References Com_Error(), Com_GetCustomSkinByIDS(), ERR_DROP, and customSkin_s::name.
Referenced by CL_ChangeSkin_f(), and CL_CharacterSkillAndScoreCvars().
static void CL_InitSkin_f | ( | void | ) | [static] |
Init skins into the GUI.
Definition at line 494 of file cl_team.c.
References Com_GetCustomSkinByIDS(), customSkin_s::id, customSkin_s::idx, customSkin_s::multiplayer, customSkin_s::name, OPTION_MULTIPLAYER_SKINS, OPTION_SINGLEPLAYER_SKINS, customSkin_s::singleplayer, UI_AddOption(), UI_GetOption(), UI_RegisterOption(), and va().
Referenced by TEAM_InitStartup().
qboolean CL_LoadCharacterXML | ( | mxml_node_t * | p, | |
character_t * | chr | |||
) |
Loads a character from a given xml node.
[in] | p | The node from which we should load the character. |
[in] | chr | Pointer to the charcter we should load. |
Definition at line 264 of file cl_team.c.
References chrScoreGlobal_s::assignedMissions, character_s::body, CL_LoadInventoryXML(), cls, Com_GetConstIntFromNamespace(), Com_GetTeamDefinitionByID(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), inventoryInterface_s::DestroyInventory, chrScoreGlobal_s::experience, character_s::fieldSize, character_s::gender, character_s::head, character_s::HP, character_s::i, client_static_s::i, chrScoreGlobal_s::initialSkills, chrScoreGlobal_s::kills, character_s::maxHP, character_s::morale, mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), character_s::name, character_s::path, Q_strncpyz(), qfalse, qtrue, chrScoreGlobal_s::rank, SAVE_CHARACTER_BODY, SAVE_CHARACTER_EXPERIENCE, SAVE_CHARACTER_FIELDSIZE, SAVE_CHARACTER_GENDER, SAVE_CHARACTER_HEAD, SAVE_CHARACTER_HP, SAVE_CHARACTER_INITSKILL, SAVE_CHARACTER_KILLED, SAVE_CHARACTER_KILLS, SAVE_CHARACTER_KILLTYPE, SAVE_CHARACTER_KILLTYPE_NAMESPACE, SAVE_CHARACTER_MAXHP, SAVE_CHARACTER_MORALE, SAVE_CHARACTER_NAME, SAVE_CHARACTER_PATH, SAVE_CHARACTER_SCORE_ASSIGNEDMISSIONS, SAVE_CHARACTER_SCORE_RANK, SAVE_CHARACTER_SCORES, SAVE_CHARACTER_SKILLIMPROVE, SAVE_CHARACTER_SKILLS, SAVE_CHARACTER_SKILLTYPE, SAVE_CHARACTER_SKILLTYPE_NAMESPACE, SAVE_CHARACTER_SKIN, SAVE_CHARACTER_STATE, SAVE_CHARACTER_STUN, SAVE_CHARACTER_STUNNED, SAVE_CHARACTER_TEAMDEF, SAVE_CHARACTER_UCN, SAVE_INVENTORY_INVENTORY, saveCharacterConstants, character_s::score, SKILL_NUM_TYPES, chrScoreGlobal_s::skills, character_s::skin, character_s::state, character_s::STUN, chrScoreGlobal_s::stuns, character_s::teamDef, type, and character_s::ucn.
Referenced by E_LoadXML(), and MP_LoadTeamMultiplayerInfo().
void CL_LoadInventoryXML | ( | mxml_node_t * | p, | |
inventory_t * | i | |||
) |
Load callback for savegames in XML Format.
[in] | p | XML Node structure, where we load the information from |
[out] | i | Pointerto the inventory |
Definition at line 454 of file cl_team.c.
References inventoryInterface_s::AddToInventory, CL_LoadItemXML(), cls, Com_Printf(), client_static_s::i, objDef_s::id, INVDEF, mxml_GetNextNode(), mxml_GetNode(), SAVE_INVENTORY_ITEM, and item_s::t.
Referenced by CL_LoadCharacterXML().
static void CL_LoadItemXML | ( | mxml_node_t * | n, | |
item_t * | item, | |||
containerIndex_t * | container, | |||
int * | x, | |||
int * | y | |||
) | [static] |
Load one item.
[in] | p | XML Node structure, where we write the information to |
[out] | item | Pointer to the item |
[out] | container | Index of the container the item is in |
[out] | x | Horizontal coordinate of the item in the container |
[out] | y | Vertical coordinate of the item in the container |
Definition at line 412 of file cl_team.c.
References item_s::a, item_s::amount, Com_Printf(), csi, i, csi_s::ids, INVSH_GetItemByID(), item_s::m, mxml_GetInt(), mxml_GetString(), invDef_s::name, NONE_AMMO, csi_s::numIDs, item_s::rotated, SAVE_INVENTORY_AMMO, SAVE_INVENTORY_AMOUNT, SAVE_INVENTORY_CONTAINER, SAVE_INVENTORY_MUNITIONID, SAVE_INVENTORY_ROTATED, SAVE_INVENTORY_WEAPONID, SAVE_INVENTORY_X, SAVE_INVENTORY_Y, and item_s::t.
Referenced by CL_LoadInventoryXML().
qboolean CL_SaveCharacterXML | ( | mxml_node_t * | p, | |
const character_t * | chr | |||
) |
saves a character to a given xml node
[in] | p | The node to which we should save the character |
[in] | chr | The charcter we should save |
Definition at line 192 of file cl_team.c.
References chrScoreGlobal_s::assignedMissions, character_s::body, CL_SaveInventoryXML(), Com_GetConstVariable(), Com_RegisterConstList(), Com_UnregisterConstList(), chrScoreGlobal_s::experience, character_s::fieldSize, character_s::gender, character_s::head, character_s::HP, character_s::i, teamDef_s::id, chrScoreGlobal_s::initialSkills, KILLED_NUM_TYPES, chrScoreGlobal_s::kills, character_s::maxHP, character_s::morale, mxml_AddInt(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddString(), character_s::name, character_s::path, qtrue, chrScoreGlobal_s::rank, SAVE_CHARACTER_BODY, SAVE_CHARACTER_EXPERIENCE, SAVE_CHARACTER_FIELDSIZE, SAVE_CHARACTER_GENDER, SAVE_CHARACTER_HEAD, SAVE_CHARACTER_HP, SAVE_CHARACTER_INITSKILL, SAVE_CHARACTER_KILLED, SAVE_CHARACTER_KILLS, SAVE_CHARACTER_KILLTYPE, SAVE_CHARACTER_KILLTYPE_NAMESPACE, SAVE_CHARACTER_MAXHP, SAVE_CHARACTER_MORALE, SAVE_CHARACTER_NAME, SAVE_CHARACTER_PATH, SAVE_CHARACTER_SCORE_ASSIGNEDMISSIONS, SAVE_CHARACTER_SCORE_RANK, SAVE_CHARACTER_SCORES, SAVE_CHARACTER_SKILLIMPROVE, SAVE_CHARACTER_SKILLS, SAVE_CHARACTER_SKILLTYPE, SAVE_CHARACTER_SKILLTYPE_NAMESPACE, SAVE_CHARACTER_SKIN, SAVE_CHARACTER_STATE, SAVE_CHARACTER_STUN, SAVE_CHARACTER_STUNNED, SAVE_CHARACTER_TEAMDEF, SAVE_CHARACTER_UCN, SAVE_INVENTORY_INVENTORY, saveCharacterConstants, character_s::score, SKILL_NUM_TYPES, chrScoreGlobal_s::skills, character_s::skin, character_s::state, character_s::STUN, chrScoreGlobal_s::stuns, character_s::teamDef, and character_s::ucn.
Referenced by E_SaveXML(), and MP_SaveTeamMultiplayerInfo().
void CL_SaveInventoryXML | ( | mxml_node_t * | p, | |
const inventory_t * | i | |||
) |
Save callback for savegames in XML Format.
[out] | p | XML Node structure, where we write the information to |
[in] | i | Pointerto the inventory to save |
Definition at line 385 of file cl_team.c.
References inventory_s::c, CL_SaveItemXML(), csi, INVDEF, invList_s::item, mxml_AddNode(), invList_s::next, csi_s::numIDs, SAVE_INVENTORY_ITEM, invList_s::x, and invList_s::y.
Referenced by CL_SaveCharacterXML().
static void CL_SaveItemXML | ( | mxml_node_t * | p, | |
item_t | item, | |||
containerIndex_t | container, | |||
int | x, | |||
int | y | |||
) | [static] |
Save one item.
[out] | p | XML Node structure, where we write the information to |
[in] | item | Pointer to the item to save |
[in] | container | Index of the container the item is in |
[in] | x | Horizontal coordinate of the item in the container |
[in] | y | Vertical coordinate of the item in the container |
Definition at line 361 of file cl_team.c.
References item_s::a, item_s::amount, csi, objDef_s::id, csi_s::ids, item_s::m, mxml_AddInt(), mxml_AddIntValue(), mxml_AddString(), invDef_s::name, NONE_AMMO, item_s::rotated, SAVE_INVENTORY_AMMO, SAVE_INVENTORY_AMOUNT, SAVE_INVENTORY_CONTAINER, SAVE_INVENTORY_MUNITIONID, SAVE_INVENTORY_ROTATED, SAVE_INVENTORY_WEAPONID, SAVE_INVENTORY_X, SAVE_INVENTORY_Y, and item_s::t.
Referenced by CL_SaveInventoryXML().
static void CL_UGVCvars | ( | const character_t * | chr | ) | [static] |
Updates the UGV cvars for the given "character".
The models and stats that are displayed in the menu are stored in cvars. These cvars are updated here when you select another character.
[in] | chr | Pointer to character_t (may not be null) |
[in] | cvarPrefix |
Definition at line 167 of file cl_team.c.
References ABILITY_MIND, CL_ActorGetSkillString(), Cvar_Set(), character_s::score, chrScoreGlobal_s::skills, and va().
Referenced by CL_UpdateCharacterValues().
void CL_UpdateCharacterValues | ( | const character_t * | chr, | |
const char * | cvarPrefix | |||
) |
Definition at line 175 of file cl_team.c.
References CL_ActorCvars(), CL_CharacterSkillAndScoreCvars(), CL_UGVCvars(), GAME_CharacterCvars(), teamDef_s::race, RACE_ROBOT, and character_s::teamDef.
Referenced by CL_ActorEquipmentSelect_f(), CL_ActorPilotSelect_f(), CL_ActorSelect(), CL_ActorTeamSelect_f(), CL_ActorUpdate_f(), E_EmployeeSelect(), HOS_EmployeeInit_f(), and HUD_ActorGetCvarData_f().
customSkin_t* Com_AllocateCustomSkin | ( | void | ) |
Allocate a skin from the cls structure.
Definition at line 46 of file cl_team.c.
References cls, client_static_s::customSkins, customSkin_s::idx, lengthof, client_static_s::numCustomSkins, and Sys_Error().
Referenced by CL_ParseCustomSkin().
static customSkin_t* Com_GetCustomSkinByIDS | ( | int | idx | ) | [static] |
Get a customskin from idx.
Definition at line 66 of file cl_team.c.
References cls, client_static_s::customSkins, and client_static_s::numCustomSkins.
Referenced by CL_FixCustomSkinIDX(), CL_GetTeamSkinName(), and CL_InitSkin_f().
void TEAM_InitStartup | ( | void | ) |
Definition at line 585 of file cl_team.c.
References CL_ChangeSkin_f(), CL_ChangeSkinForWholeTeam_f(), CL_InitSkin_f(), and Cmd_AddCommand().
Referenced by CL_InitLocal().
List of currently displayed or equipeable characters.
Definition at line 40 of file cl_team.c.
Referenced by CL_ActorEquipmentSelect_f(), CL_ActorUpdate_f(), CL_Connect_f(), CL_UpdateActorAircraftVar(), CL_UpdateEquipmentMenuParameters_f(), GAME_AppendTeamMember(), GAME_MP_InitStartup(), GAME_MP_StartServer_f(), GAME_ResetCharacters(), GAME_Spawn(), MP_GetEquipment(), MP_LoadTeamMultiplayerInfo(), MP_SaveTeamMultiplayer(), MP_SaveTeamMultiplayer_f(), MP_SaveTeamMultiplayerInfo(), MP_SaveTeamState_f(), MP_TeamSelect_f(), MP_ToggleActorForTeam_f(), MP_UpdateActiveTeamList(), and MP_UpdateMenuParameters_f().