UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_team.cpp File Reference

Team management, name generation and parsing. More...

#include "client.h"
#include "cl_team.h"
#include "cl_inventory.h"
#include "cgame/cl_game.h"
#include "battlescape/cl_localentity.h"
#include "battlescape/cl_actor.h"
#include "battlescape/events/e_parse.h"
#include "battlescape/events/e_main.h"
#include "ui/ui_data.h"
#include "ui/ui_nodes.h"
Include dependency graph for cl_team.cpp:

Go to the source code of this file.

Functions

actorSkin_tCL_AllocateActorSkin (const char *name)
 Allocate a skin from the cls structure.
unsigned int CL_GetActorSkinCount (void)
 Get number of registered actorskins.
static const actorSkin_tCL_GetActorSkinByIDS (unsigned int idx)
 Get a actorskin from idx.
static void CL_CharacterSkillAndScoreCvars (const character_t *chr)
static void CL_ActorCvars (const character_t *chr)
 Updates the character cvars for the given character.
const char * CL_ActorGetSkillString (const int skill)
 Return the skill string for the given skill level.
static void CL_UGVCvars (const character_t *chr)
 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.
void CL_UpdateCharacterValues (const character_t *chr)
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_FixActorSkinIDX (int idx)
 Fix actorskin idx according 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

linkedList_tchrDisplayList
 List of currently displayed or equipable characters.

Detailed Description

Team management, name generation and parsing.

Definition in file cl_team.cpp.

Function Documentation

◆ CL_ActorCvars()

void CL_ActorCvars ( const character_t * chr)
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.

Parameters
[in]chrPointer to character_t (may not be null)
See also
CL_UGVCvars
CL_ActorSelect

Definition at line 143 of file cl_team.cpp.

References Cvar_Set(), Item::def(), Inventory::getLeftHandContainer(), Inventory::getRightHandContainer(), character_t::inv, and objDef_t::model.

Referenced by CL_UpdateCharacterValues().

◆ CL_ActorGetSkillString()

const char * CL_ActorGetSkillString ( const int skill)

Return the skill string for the given skill level.

Returns
skill string
Parameters
[in]skilla skill value between 0 and MAX_SKILL

Definition at line 165 of file cl_team.cpp.

References _, Com_Printf(), and MAX_SKILL.

Referenced by CL_CharacterSkillAndScoreCvars(), CL_UGVCvars(), and GAME_GetImportData().

◆ CL_AllocateActorSkin()

actorSkin_t * CL_AllocateActorSkin ( const char * name)

Allocate a skin from the cls structure.

Returns
A actorskin structure

Definition at line 44 of file cl_team.cpp.

References cls, com_genericPool, actorSkin_t::id, actorSkin_t::idx, index, lengthof, Mem_PoolStrDup, name, OBJZERO, R_ModAllocateActorSkin(), and Sys_Error().

Referenced by CL_ParseActorSkin().

◆ CL_ChangeSkin_f()

void CL_ChangeSkin_f ( void )
static

Change the skin of the selected actor.

Todo
Get the skin id from the model by using the actorskin id
Todo
Or remove skins from models and convert character_t->skin to string

Definition at line 309 of file cl_team.cpp.

References character_t::bodySkin, chrDisplayList, CL_FixActorSkinIDX(), cl_selected, Cvar_GetInteger(), Cvar_SetValue(), and LIST_GetByIdx().

Referenced by TEAM_InitStartup().

◆ CL_ChangeSkinForWholeTeam_f()

void CL_ChangeSkinForWholeTeam_f ( void )
static

Use current skin for all team members onboard.

Todo
What happens if a model of a team member does not have the selected skin?
Todo
Get the skin id from the model by using the actorskin id
Todo
Or remove skins from models and convert character_t->skin to string

Definition at line 326 of file cl_team.cpp.

References chrDisplayList, CL_FixActorSkinIDX(), Cvar_GetInteger(), and LIST_Foreach.

Referenced by TEAM_InitStartup().

◆ CL_CharacterSkillAndScoreCvars()

◆ CL_FixActorSkinIDX()

int CL_FixActorSkinIDX ( int idx)
static

Fix actorskin idx according to game mode.

Todo
we should check somewhere there is at least 1 skin

Definition at line 290 of file cl_team.cpp.

References CL_GetActorSkinByIDS(), GAME_IsMultiplayer(), GAME_IsSingleplayer, actorSkin_t::multiplayer, and actorSkin_t::singleplayer.

Referenced by CL_ChangeSkin_f(), and CL_ChangeSkinForWholeTeam_f().

◆ CL_GenerateCharacter()

void CL_GenerateCharacter ( character_t * chr,
const char * teamDefName )

Generates the skills and inventory for a character and for a 2x2 unit.

Parameters
[in]chrThe employee to create character data for.
[in]teamDefNameWhich team to use for creation.

Definition at line 235 of file cl_team.cpp.

References ACTOR_HAND_NOT_SET, CHRSH_CharGenAbilitySkills(), cls, Com_GetCharacterValues(), GAME_IsMultiplayer(), character_t::init(), character_t::inv, character_t::reservedTus, character_t::RFmode, FiremodeSettings::set(), chrReservations_t::shotSettings, character_t::state, STATE_REACTION, and character_t::ucn.

Referenced by GAME_AppendTeamMember(), GAME_GetImportData(), and GetCharacter().

◆ CL_GetActorSkinByIDS()

const actorSkin_t * CL_GetActorSkinByIDS ( unsigned int idx)
static

Get a actorskin from idx.

Returns
A actorskin, else nullptr

Definition at line 72 of file cl_team.cpp.

References cls.

Referenced by CL_FixActorSkinIDX(), and CL_InitSkin_f().

◆ CL_GetActorSkinCount()

unsigned int CL_GetActorSkinCount ( void )

Get number of registered actorskins.

Returns
Number of registered actorskins

Definition at line 63 of file cl_team.cpp.

References cls.

Referenced by CL_ParseActorSkin(), and GAME_LoadCharacter().

◆ CL_InitSkin_f()

◆ CL_UGVCvars()

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.

Parameters
[in]chrPointer to character_t (may not be null)
See also
CL_ActorCvars
CL_ActorSelect

Definition at line 210 of file cl_team.cpp.

References ABILITY_MIND, CL_ActorGetSkillString(), Cvar_Set(), character_t::score, and chrScoreGlobal_t::skills.

Referenced by CL_UpdateCharacterValues().

◆ CL_UpdateCharacterValues()

◆ TEAM_InitStartup()

void TEAM_InitStartup ( void )

Definition at line 339 of file cl_team.cpp.

References CL_ChangeSkin_f(), CL_ChangeSkinForWholeTeam_f(), CL_InitSkin_f(), and Cmd_AddCommand().

Referenced by CL_InitLocal().

Variable Documentation

◆ chrDisplayList