UFO: Alien Invasion
|
cgame team management. More...
#include "../client.h"
#include "cl_game.h"
#include "cl_game_team.h"
#include "../cl_inventory.h"
#include "../../shared/parse.h"
#include "../cl_team.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "../ui/node/ui_node_container.h"
#include "save_team.h"
#include "save_character.h"
#include "save_inventory.h"
Go to the source code of this file.
Data Structures | |
struct | teamSaveFileHeader_s |
Macros | |
#define | TEAM_SAVE_FILE_VERSION 4 |
Typedefs | |
typedef struct teamSaveFileHeader_s | teamSaveFileHeader_t |
Functions | |
static void | GAME_UpdateActiveTeamList (void) |
void | GAME_AutoTeam (const char *equipmentDefinitionID, int teamMembers) |
void | GAME_AutoTeam_f (void) |
void | GAME_ToggleActorForTeam_f (void) |
This will activate/deactivate the actor for the team. More... | |
void | GAME_SaveTeamState_f (void) |
Will remove those actors that should not be used in the team. More... | |
void | GAME_TeamDelete_f (void) |
Removes a user created team. More... | |
void | GAME_TeamSlotComments_f (void) |
Reads the comments from team files. More... | |
static void | GAME_SaveTeamInfo (xmlNode_t *p) |
Stores the wholeTeam into a xml structure. More... | |
static void | GAME_LoadTeamInfo (xmlNode_t *p) |
Loads the wholeTeam from the xml file. More... | |
static bool | GAME_SaveTeam (const char *filename, const char *name) |
Saves a team in xml format. More... | |
bool | GAME_TeamGetFreeFilename (char *filename, size_t size) |
Searches a free team filename. More... | |
void | GAME_SaveTeam_f (void) |
Stores a team in a specified teamslot. More... | |
static bool | GAME_LoadTeam (const char *filename) |
Load a team from an xml file. More... | |
bool | GAME_GetTeamFileName (unsigned int index, char *filename, size_t filenameLength) |
Get the filename for the xth team in the file system. More... | |
bool | GAME_LoadDefaultTeam (bool force) |
void | GAME_LoadTeam_f (void) |
Loads the selected teamslot. More... | |
static void | GAME_UpdateInventory (Inventory *inv, const equipDef_t *ed) |
static void | GAME_GetEquipment (void) |
Get the equipment definition (from script files) for the current selected team and updates the equipment inventory containers. More... | |
void | GAME_UpdateTeamMenuParameters_f (void) |
Displays actor info and equipment and unused items in proper (filter) category. More... | |
void | GAME_ActorSelect_f (void) |
static void | GAME_SaveItem (xmlNode_t *p, const Item *item, containerIndex_t container, int x, int y) |
Save one item. More... | |
static void | GAME_SaveInventory (xmlNode_t *p, const Inventory *inv) |
Save callback for savegames in XML Format. More... | |
static bool | GAME_LoadItem (xmlNode_t *n, Item *item, containerIndex_t *container, int *x, int *y) |
Load one item. More... | |
static void | GAME_LoadInventory (xmlNode_t *p, Inventory *inv, int maxLoad) |
Load callback for savegames in XML Format. More... | |
bool | GAME_SaveCharacter (xmlNode_t *p, const character_t *chr) |
saves a character to a given xml node More... | |
bool | GAME_LoadCharacter (xmlNode_t *p, character_t *chr) |
Loads a character from a given xml node. More... | |
Variables | |
static Inventory | game_inventory |
static bool | characterActive [MAX_ACTIVETEAM] |
cgame team management.
Definition in file cl_game_team.cpp.
#define TEAM_SAVE_FILE_VERSION 4 |
< ui_inventory
Definition at line 39 of file cl_game_team.cpp.
Referenced by GAME_LoadTeam(), GAME_SaveTeam(), and GAME_TeamSlotComments_f().
typedef struct teamSaveFileHeader_s teamSaveFileHeader_t |
Definition at line 531 of file cl_game_team.cpp.
References chrDisplayList, CID_EQUIP, CL_UpdateCharacterValues(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), Inventory::getEquipContainer(), character_s::inv, LIST_Foreach, Inventory::resetContainer(), Inventory::setContainer(), and ui_inventory.
Referenced by GAME_InitStartup().
Definition at line 59 of file cl_game_team.cpp.
References cls, GAME_GenerateTeam(), GAME_GetTeamDef(), INV_GetEquipmentDefinitionByID(), NO_TEAM_SLOT_LOADED, and client_static_s::teamSaveSlotIndex.
Referenced by GAME_AutoTeam_f(), and GAME_GetImportData().
Definition at line 68 of file cl_game_team.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_AutoTeam(), GAME_GetCharacterArraySize(), and GAME_UpdateActiveTeamList().
Referenced by GAME_InitStartup().
Get the equipment definition (from script files) for the current selected team and updates the equipment inventory containers.
Definition at line 497 of file cl_game_team.cpp.
References Cvar_GetString(), GAME_GetEquipmentDefinition(), GAME_UpdateInventory(), Inventory::init(), and INV_GetEquipmentDefinitionByID().
Referenced by GAME_UpdateTeamMenuParameters_f().
bool GAME_GetTeamFileName | ( | unsigned int | index, |
char * | filename, | ||
size_t | filenameLength | ||
) |
Get the filename for the xth team in the file system.
[in] | index | The index of the team we are looking for in the filesystem |
[out] | filename | The filename of the team. This value is only set or valid if this function returned true . |
[in] | filenameLength | The length of the filename buffer. |
true
if the filename for the given index was found, false
otherwise (e.g. invalid index) Definition at line 413 of file cl_game_team.cpp.
References Com_DPrintf(), Com_sprintf(), DEBUG_CLIENT, FS_BuildFileList(), FS_NextFileFromFileList(), GAME_GetRelativeSavePath(), and MAX_OSPATH.
Referenced by GAME_LoadDefaultTeam(), and GAME_LoadTeam_f().
bool GAME_LoadCharacter | ( | xmlNode_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 character we should load. |
Definition at line 785 of file cl_game_team.cpp.
References chrScoreGlobal_s::assignedMissions, character_s::body, character_s::bodySkin, teamDef_s::bodyTemplate, CHRSH_CharGetBody(), CHRSH_CharGetHead(), CL_GetActorSkinCount(), cls, Com_GetCharacterModel(), Com_GetConstIntFromNamespace(), Com_GetTeamDefinitionByID(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), implant_s::def, InventoryInterface::destroyInventory(), chrScoreGlobal_s::experience, character_s::fieldSize, GAME_GetChrMaxLoad(), GAME_LoadInventory(), character_s::gender, character_s::head, character_s::headSkin, character_s::HP, client_static_s::i, BodyData::id(), character_s::implants, chrScoreGlobal_s::initialSkills, implant_s::installedTime, character_s::inv, INVSH_GetImplantByID(), chrScoreGlobal_s::kills, character_s::maxHP, character_s::morale, character_s::name, NONE, BodyData::numBodyParts(), character_s::path, Q_streq, Q_strncpyz(), R_ModelExists(), chrScoreGlobal_s::rank, implant_s::removedTime, SAVE_CHARACTER_BDOY_SKIN, SAVE_CHARACTER_BODY, SAVE_CHARACTER_EXPERIENCE, SAVE_CHARACTER_FIELDSIZE, SAVE_CHARACTER_GENDER, SAVE_CHARACTER_HEAD, SAVE_CHARACTER_HEAD_SKIN, SAVE_CHARACTER_HP, SAVE_CHARACTER_IMPLANT, SAVE_CHARACTER_IMPLANT_IMPLANT, SAVE_CHARACTER_IMPLANT_INSTALLEDTIME, SAVE_CHARACTER_IMPLANT_REMOVETIME, SAVE_CHARACTER_IMPLANTS, SAVE_CHARACTER_INITSKILL, SAVE_CHARACTER_INJURIES, 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_STATE, SAVE_CHARACTER_STUN, SAVE_CHARACTER_STUNNED, SAVE_CHARACTER_TEAMDEF, SAVE_CHARACTER_UCN, SAVE_CHARACTER_WOUND, SAVE_CHARACTER_WOUNDEDPART, SAVE_CHARACTER_WOUNDSEVERITY, SAVE_CHARACTER_WOUNDTYPE, SAVE_INVENTORY_INVENTORY, saveCharacterConstants, character_s::score, SKILL_NUM_TYPES, chrScoreGlobal_s::skills, character_s::state, character_s::STUN, chrScoreGlobal_s::stuns, character_s::teamDef, woundInfo_s::treatmentLevel, type, character_s::ucn, character_s::wounds, XML_GetInt(), XML_GetNextNode(), XML_GetNode(), XML_GetString(), and xmlNode_t.
Referenced by GAME_GetImportData(), and GAME_LoadTeamInfo().
bool GAME_LoadDefaultTeam | ( | bool | force | ) |
Definition at line 439 of file cl_game_team.cpp.
References cls, GAME_GetTeamFileName(), GAME_IsTeamEmpty(), GAME_LoadTeam(), MAX_OSPATH, NO_TEAM_SLOT_LOADED, and client_static_s::teamSaveSlotIndex.
Referenced by GAME_GetImportData().
Load callback for savegames in XML Format.
[in] | p | XML Node structure, where we load the information from |
[in,out] | inv | Pointer to the inventory |
[in] | maxLoad | The max load for this inventory. |
Definition at line 666 of file cl_game_team.cpp.
References InventoryInterface::addToInventory(), Inventory::canHoldItemWeight(), CID_EQUIP, cls, Com_Error(), Com_Printf(), Item::def(), ERR_DROP, GAME_LoadItem(), client_static_s::i, objDef_s::id, INVDEF, SAVE_INVENTORY_ITEM, XML_GetNextNode(), XML_GetNode(), and xmlNode_t.
Referenced by GAME_LoadCharacter().
|
static |
Load one item.
[in] | n | 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 614 of file cl_game_team.cpp.
References Item::ammoDef(), CID_MAX, Com_Printf(), csi, Item::def(), Item::getAmmoLeft(), i, csi_s::ids, INVSH_GetItemByID(), Item::isReloadable(), invDef_s::name, NONE_AMMO, OBJZERO, Q_streq, Item::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, Item::setAmmoDef(), Item::setAmmoLeft(), Item::setAmount(), Item::setDef(), XML_GetInt(), and XML_GetString().
Referenced by GAME_LoadInventory().
|
static |
Load a team from an xml file.
Definition at line 325 of file cl_game_team.cpp.
References cl_genericPool, Com_Printf(), f, FILE_READ, FS_FileLength(), FS_OpenFile(), FS_Read(), GAME_GetEquipmentDefinition(), GAME_LoadTeamInfo(), objDef_s::idx, INVSH_GetItemByID(), LittleLong, Mem_Free, Mem_PoolAllocTypeN, equipDef_s::numItems, equipDef_s::numItemsLoose, SAVE_TEAM_EQUIPMENT, SAVE_TEAM_ID, SAVE_TEAM_ITEM, SAVE_TEAM_NODE, SAVE_TEAM_NUM, SAVE_TEAM_NUMLOOSE, SAVE_TEAM_ROOTNODE, TEAM_SAVE_FILE_VERSION, teamSaveFileHeader_s::version, XML_GetInt(), XML_GetNextNode(), XML_GetNode(), XML_GetString(), XML_Parse(), xmlNode_t, and teamSaveFileHeader_s::xmlSize.
Referenced by GAME_LoadDefaultTeam(), and GAME_LoadTeam_f().
Loads the selected teamslot.
Definition at line 461 of file cl_game_team.cpp.
References cls, Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_GetTeamFileName(), GAME_IsTeamEmpty(), GAME_LoadTeam(), index, MAX_OSPATH, NO_TEAM_SLOT_LOADED, and client_static_s::teamSaveSlotIndex.
Referenced by GAME_InitStartup().
Loads the wholeTeam from the xml file.
Definition at line 199 of file cl_game_team.cpp.
References characterActive, chrDisplayList, GAME_GetCharacter(), GAME_GetCharacterArraySize(), GAME_LoadCharacter(), GAME_ResetCharacters(), GAME_UpdateActiveTeamList(), character_s::head, character_s::headSkin, i, LIST_AddPointer(), character_s::name, OBJZERO, SAVE_TEAM_CHARACTER, UI_ExecuteConfunc(), XML_GetNextNode(), XML_GetNode(), and xmlNode_t.
Referenced by GAME_LoadTeam().
bool GAME_SaveCharacter | ( | xmlNode_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 character we should save |
Definition at line 694 of file cl_game_team.cpp.
References chrScoreGlobal_s::assignedMissions, character_s::body, character_s::bodySkin, teamDef_s::bodyTemplate, Com_GetConstVariable(), Com_RegisterConstList(), Com_UnregisterConstList(), implant_s::def, chrScoreGlobal_s::experience, character_s::fieldSize, GAME_SaveInventory(), character_s::gender, character_s::head, character_s::headSkin, character_s::HP, i, implantDef_s::id, BodyData::id(), teamDef_s::id, character_s::implants, chrScoreGlobal_s::initialSkills, implant_s::installedTime, character_s::inv, KILLED_NUM_TYPES, chrScoreGlobal_s::kills, lengthof, character_s::maxHP, character_s::morale, character_s::name, BodyData::numBodyParts(), character_s::path, chrScoreGlobal_s::rank, implant_s::removedTime, SAVE_CHARACTER_BDOY_SKIN, SAVE_CHARACTER_BODY, SAVE_CHARACTER_EXPERIENCE, SAVE_CHARACTER_FIELDSIZE, SAVE_CHARACTER_GENDER, SAVE_CHARACTER_HEAD, SAVE_CHARACTER_HEAD_SKIN, SAVE_CHARACTER_HP, SAVE_CHARACTER_IMPLANT, SAVE_CHARACTER_IMPLANT_IMPLANT, SAVE_CHARACTER_IMPLANT_INSTALLEDTIME, SAVE_CHARACTER_IMPLANT_REMOVETIME, SAVE_CHARACTER_IMPLANTS, SAVE_CHARACTER_INITSKILL, SAVE_CHARACTER_INJURIES, 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_STATE, SAVE_CHARACTER_STUN, SAVE_CHARACTER_STUNNED, SAVE_CHARACTER_TEAMDEF, SAVE_CHARACTER_UCN, SAVE_CHARACTER_WOUND, SAVE_CHARACTER_WOUNDEDPART, SAVE_CHARACTER_WOUNDSEVERITY, SAVE_INVENTORY_INVENTORY, saveCharacterConstants, character_s::score, SKILL_NUM_TYPES, chrScoreGlobal_s::skills, character_s::state, character_s::STUN, chrScoreGlobal_s::stuns, character_s::teamDef, woundInfo_s::treatmentLevel, character_s::ucn, character_s::wounds, XML_AddInt(), XML_AddIntValue(), XML_AddNode(), XML_AddString(), and xmlNode_t.
Referenced by GAME_GetImportData(), and GAME_SaveTeamInfo().
Save callback for savegames in XML Format.
[out] | p | XML Node structure, where we write the information to |
[in] | inv | Pointer to the inventory to save |
Definition at line 593 of file cl_game_team.cpp.
References GAME_SaveItem(), Inventory::getNextCont(), Container::getNextItem(), Item::getX(), Item::getY(), Container::id, SAVE_INVENTORY_ITEM, XML_AddNode(), and xmlNode_t.
Referenced by GAME_SaveCharacter().
|
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,y | Coordinates of the item in the container |
Definition at line 569 of file cl_game_team.cpp.
References Item::ammoDef(), Item::def(), Item::getAmmoLeft(), Item::getAmount(), objDef_s::id, INVDEF, name, NONE_AMMO, Item::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, XML_AddInt(), XML_AddIntValue(), and XML_AddString().
Referenced by GAME_SaveInventory().
|
static |
Saves a team in xml format.
Definition at line 221 of file cl_game_team.cpp.
References chrDisplayList, cl_genericPool, Com_Printf(), csi, FS_WriteFile(), GAME_GetEquipmentDefinition(), GAME_SaveTeamInfo(), i, objDef_s::id, objDef_s::idx, INVSH_GetItemByIDX(), LIST_Count(), LittleLong, Mem_Free, Mem_PoolAllocTypeN, teamSaveFileHeader_s::name, equipDef_s::numItems, equipDef_s::numItemsLoose, csi_s::numODs, OBJZERO, Q_strncpyz(), SAVE_TEAM_EQUIPMENT, SAVE_TEAM_ID, SAVE_TEAM_ITEM, SAVE_TEAM_NODE, SAVE_TEAM_NUM, SAVE_TEAM_NUMLOOSE, SAVE_TEAM_ROOTNODE, teamSaveFileHeader_s::soldiercount, TEAM_SAVE_FILE_VERSION, teamSaveFileHeader_s::version, XML_AddIntValue(), XML_AddNode(), XML_AddString(), xmlNode_t, and teamSaveFileHeader_s::xmlSize.
Referenced by GAME_SaveTeam_f().
Stores a team in a specified teamslot.
Definition at line 296 of file cl_game_team.cpp.
References _, chrDisplayList, Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_SaveTeam(), GAME_TeamGetFreeFilename(), LIST_IsEmpty(), MAX_OSPATH, name, Q_strnull(), and UI_Popup().
Referenced by GAME_InitStartup().
Stores the wholeTeam into a xml structure.
Definition at line 186 of file cl_game_team.cpp.
References chrDisplayList, GAME_SaveCharacter(), LIST_Foreach, SAVE_TEAM_CHARACTER, XML_AddNode(), and xmlNode_t.
Referenced by GAME_SaveTeam().
Will remove those actors that should not be used in the team.
Definition at line 112 of file cl_game_team.cpp.
References characterActive, chrDisplayList, i, LIST_Foreach, and LIST_Remove().
Referenced by GAME_InitStartup().
Removes a user created team.
Definition at line 124 of file cl_game_team.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), FS_RemoveFile(), GAME_GetAbsoluteSavePath(), MAX_OSPATH, and Q_strcat().
Referenced by GAME_InitStartup().
bool GAME_TeamGetFreeFilename | ( | char * | filename, |
size_t | size | ||
) |
Searches a free team filename.
[out] | filename | The team filename that can be used. |
[in] | size | The size of the filename buffer. |
true
if a valid team name was found, false
otherwise. In the latter case, don't use anything from the filename
buffer Definition at line 279 of file cl_game_team.cpp.
References Com_sprintf(), FS_CheckFile(), GAME_GetRelativeSavePath(), and MAX_OSPATH.
Referenced by GAME_SaveTeam_f().
Reads the comments from team files.
Definition at line 141 of file cl_game_team.cpp.
References Com_Printf(), f, FILE_READ, FS_BuildFileList(), FS_FileExists(), FS_NextFileFromFileList(), FS_OpenFile(), FS_Read(), GAME_GetAbsoluteSavePath(), GAME_GetRelativeSavePath(), i, LittleLong, MAX_OSPATH, teamSaveFileHeader_s::name, Q_strcat(), Q_strncpyz(), teamSaveFileHeader_s::soldiercount, TEAM_SAVE_FILE_VERSION, UI_ExecuteConfunc(), va(), and teamSaveFileHeader_s::version.
Referenced by GAME_InitStartup().
This will activate/deactivate the actor for the team.
Definition at line 83 of file cl_game_team.cpp.
References characterActive, chrDisplayList, Cmd_Argc(), Cmd_Argv(), Com_Printf(), i, and LIST_Foreach.
Referenced by GAME_InitStartup().
Definition at line 51 of file cl_game_team.cpp.
References characterActive, chrDisplayList, i, LIST_Count(), and OBJZERO.
Referenced by GAME_AutoTeam_f(), and GAME_LoadTeamInfo().
|
static |
Definition at line 482 of file cl_game_team.cpp.
References chrDisplayList, linkedList_t::data, LIST_IsEmpty(), UI_ContainerNodeUpdateEquipment(), and ui_inventory.
Referenced by GAME_GetEquipment().
Displays actor info and equipment and unused items in proper (filter) category.
Definition at line 514 of file cl_game_team.cpp.
References characterActive, chrDisplayList, Cvar_Set(), GAME_GetEquipment(), i, LIST_Foreach, TEXT_STANDARD, UI_ExecuteConfunc(), and UI_ResetData().
Referenced by GAME_InitStartup().
|
static |
Definition at line 42 of file cl_game_team.cpp.
Referenced by GAME_LoadTeamInfo(), GAME_SaveTeamState_f(), GAME_ToggleActorForTeam_f(), GAME_UpdateActiveTeamList(), and GAME_UpdateTeamMenuParameters_f().
|
static |
Definition at line 41 of file cl_game_team.cpp.