UFO: Alien Invasion
Loading...
Searching...
No Matches
chr_shared.cpp File Reference
#include "q_shared.h"
#include "chr_shared.h"
Include dependency graph for chr_shared.cpp:

Go to the source code of this file.

Functions

bool CHRSH_IsTeamDefAlien (const teamDef_t *const td)
 Check if a team definition is alien.
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.
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.
void CHRSH_UpdateImplants (character_t &chr)
 Updates the characters permanent implants. Called every day.
const implant_tCHRSH_ApplyImplant (character_t &chr, const implantDef_t &def)
 Add a new implant to a character.
void CHRSH_CharGenAbilitySkills (character_t *chr, bool multiplayer, const char *templateId)
 Generates a skill and ability set for any character.
const char * CHRSH_CharGetBody (const character_t *const chr)
 Returns the body model for the soldiers for armoured and non armoured soldiers.
const char * CHRSH_CharGetHead (const character_t *const chr)
 Returns the head model for the soldiers for armoured and non armoured soldiers.

Detailed Description

Note
Shared character generating functions prefix: CHRSH_

Definition in file chr_shared.cpp.

Function Documentation

◆ CHRSH_ApplyImplant()

◆ CHRSH_CharGenAbilitySkills()

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 221 of file chr_shared.cpp.

References ABILITY_MIND, teamDef_t::characterTemplates, CHRSH_GetTemplateByID(), chrScoreGlobal_t::experience, frand(), GET_MORALE, character_t::HP, i, chrTemplate_t::id, teamDef_t::id, chrScoreGlobal_t::initialSkills, int(), MAX_SKILL, character_t::maxHP, character_t::morale, teamDef_t::numTemplates, Q_strnull(), chrTemplate_t::rate, character_t::score, SKILL_NUM_TYPES, chrScoreGlobal_t::skills, chrTemplate_t::skills, Sys_Error(), teamDef_t::team, TEAM_PHALANX, and character_t::teamDef.

Referenced by AI_SetStats(), and CL_GenerateCharacter().

◆ CHRSH_CharGetBody()

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 297 of file chr_shared.cpp.

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

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

◆ CHRSH_CharGetHead()

const char * CHRSH_CharGetHead ( const character_t *const chr)

◆ CHRSH_GetTemplateByID()

const chrTemplate_t * CHRSH_GetTemplateByID ( const teamDef_t * teamDef,
const char * templateId )

◆ CHRSH_IsArmourUseableForTeam()

bool CHRSH_IsArmourUseableForTeam ( const objDef_t * od,
const teamDef_t * teamDef )

Definition at line 88 of file chr_shared.cpp.

References teamDef_t::armour, objDef_t::isArmour(), teamDef_t::team, and objDef_t::useable.

Referenced by GAME_ItemIsUseable(), and TEST_F().

◆ CHRSH_IsTeamDefAlien()

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 83 of file chr_shared.cpp.

References teamDef_t::team, and TEAM_ALIEN.

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

◆ CHRSH_IsTeamDefRobot()

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 103 of file chr_shared.cpp.

References teamDef_t::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().

◆ CHRSH_UpdateCharacterWithEffect()

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

◆ CHRSH_UpdateImplants()