UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
chr_shared.cpp File Reference
#include "q_shared.h"
#include "chr_shared.h"

Go to the source code of this file.

Functions

bool CHRSH_IsTeamDefAlien (const teamDef_t *const td)
 Check if a team definition is alien. More...
 
bool CHRSH_IsArmourUseableForTeam (const objDef_t *od, const teamDef_t *teamDef)
 
bool CHRSH_IsTeamDefRobot (const teamDef_t *const td)
 Check if a team definition is a robot. More...
 
const chrTemplate_tCHRSH_GetTemplateByID (const teamDef_t *teamDef, const char *templateId)
 
static void CHRSH_UpdateCharacterWithEffect (character_t &chr, const itemEffect_t &e)
 Assign the effect values to the character. More...
 
void CHRSH_UpdateImplants (character_t &chr)
 Updates the characters permanent implants. Called every day. More...
 
const implant_tCHRSH_ApplyImplant (character_t &chr, const implantDef_t &def)
 Add a new implant to a character. More...
 
void CHRSH_CharGenAbilitySkills (character_t *chr, bool multiplayer, const char *templateId)
 Generates a skill and ability set for any character. More...
 
const char * CHRSH_CharGetBody (const character_t *const chr)
 Returns the body model for the soldiers for armoured and non armoured soldiers. More...
 
const char * CHRSH_CharGetHead (const character_t *const chr)
 Returns the head model for the soldiers for armoured and non armoured soldiers. More...
 

Detailed Description

Note
Shared character generating functions prefix: CHRSH_

Definition in file chr_shared.cpp.

Function Documentation

void CHRSH_CharGenAbilitySkills ( character_t chr,
bool  multiplayer,
const char *  templateId 
)

Generates a skill and ability set for any character.

Parameters
[in]chrPointer to the character, for which we generate stats.
[in]multiplayerIf this is true we use the skill values from soldier_mp
[in]templateIdSpecifies the template to be used for non-MP
Note
mulitplayer is a special case here
Todo:
Add modifiers for difficulty setting here!

Definition at line 220 of file chr_shared.cpp.

References ABILITY_MIND, teamDef_s::characterTemplates, CHRSH_GetTemplateByID(), chrScoreGlobal_s::experience, f, frand(), GET_MORALE, character_s::HP, i, chrTemplate_s::id, teamDef_s::id, chrScoreGlobal_s::initialSkills, int(), MAX_SKILL, character_s::maxHP, character_s::morale, teamDef_s::numTemplates, Q_strnull(), chrTemplate_s::rate, character_s::score, SKILL_NUM_TYPES, chrTemplate_s::skills, chrScoreGlobal_s::skills, Sys_Error(), teamDef_s::team, TEAM_PHALANX, and character_s::teamDef.

Referenced by AI_SetStats(), and CL_GenerateCharacter().

const char* CHRSH_CharGetBody ( const character_t *const  chr)

Returns the body model for the soldiers for armoured and non armoured soldiers.

Parameters
[in]chrPointer to character struct
See also
CHRSH_CharGetBody
Returns
the character body model (from a static buffer)

Definition at line 296 of file chr_shared.cpp.

References objDef_s::armourPath, character_s::body, CHRSH_IsTeamDefRobot(), Com_sprintf(), Item::def(), Inventory::getArmour(), character_s::inv, objDef_s::isArmour(), MAX_VAR, character_s::path, Sys_Error(), and character_s::teamDef.

Referenced by AI_InitPlayer(), CL_CharacterSkillAndScoreCvars(), CP_UpdateActorAircraftVar(), G_ClientAssignDefaultActorValues(), and GAME_LoadCharacter().

const char* CHRSH_CharGetHead ( const character_t *const  chr)
const chrTemplate_t* CHRSH_GetTemplateByID ( const teamDef_t teamDef,
const char *  templateId 
)
bool CHRSH_IsArmourUseableForTeam ( const objDef_t od,
const teamDef_t teamDef 
)

Definition at line 87 of file chr_shared.cpp.

References teamDef_s::armour, objDef_s::isArmour(), teamDef_s::team, and objDef_s::useable.

Referenced by GAME_ItemIsUseable(), and TEST_F().

bool CHRSH_IsTeamDefAlien ( const teamDef_t *const  td)

Check if a team definition is alien.

Parameters
[in]tdPointer to the team definition to check.

Definition at line 82 of file chr_shared.cpp.

References teamDef_s::team, and TEAM_ALIEN.

Referenced by AI_SetStats(), CP_ParseCampaignData(), G_TreatActor(), GAME_CP_TeamIsKnown(), GAME_SK_SetMissionParameters(), and AlienContainment::isLifeSupported().

bool CHRSH_IsTeamDefRobot ( const teamDef_t *const  td)

Check if a team definition is a robot.

Parameters
[in]tdPointer to the team definition to check.

Definition at line 102 of file chr_shared.cpp.

References teamDef_s::robot.

Referenced by AI_FindBestFiredef(), AI_SetStats(), CHRSH_CharGetBody(), G_ActorSetMaxs(), G_BleedWounds(), G_Damage(), G_MoraleBehaviour(), HOS_EntryWoundData(), HUD_ActorWoundData_f(), and AlienContainment::isLifeSupported().

static void CHRSH_UpdateCharacterWithEffect ( character_t chr,
const itemEffect_t e 
)
static