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

Go to the source code of this file.

Data Structures

struct  chrTemplate_s
 
struct  chrScoreMission_s
 Structure of all stats collected in a mission. More...
 
struct  chrScoreGlobal_s
 Structure of all stats collected for an actor over time. More...
 
class  FiremodeSettings
 
struct  chrReservations_s
 How many TUs (and of what type) did a player reserve for a unit? More...
 
struct  ugv_s
 Defines a type of UGV/Robot. More...
 
class  BodyPartData
 
class  BodyData
 
struct  teamNames_s
 
struct  teamDef_s
 
struct  teamDef_s::model_t
 
struct  woundInfo_s
 Info on a wound. More...
 
struct  implant_s
 
struct  character_s
 Describes a character with all its attributes. More...
 

Macros

#define ABILITY_NUM_TYPES   SKILL_CLOSE
 
#define MAX_UGV   8
 
#define MAX_TEAMDEFS   64
 
#define MAX_CHARACTER_TEMPLATES   24
 
#define MAX_TEMPLATES_PER_TEAM   16
 
#define BODYPART_MAXTYPE   4
 
#define MAX_CHARACTER_IMPLANTS   4
 

Typedefs

typedef struct chrTemplate_s chrTemplate_t
 
typedef struct chrScoreMission_s chrScoreMission_t
 Structure of all stats collected in a mission. More...
 
typedef struct chrScoreGlobal_s chrScoreGlobal_t
 Structure of all stats collected for an actor over time. More...
 
typedef struct chrReservations_s chrReservations_t
 How many TUs (and of what type) did a player reserve for a unit? More...
 
typedef struct ugv_s ugv_t
 Defines a type of UGV/Robot. More...
 
typedef struct teamNames_s teamNames_t
 
typedef struct teamDef_s teamDef_t
 
typedef struct woundInfo_s woundInfo_t
 Info on a wound. More...
 
typedef struct implant_s implant_t
 
typedef struct character_s character_t
 Describes a character with all its attributes. More...
 

Enumerations

enum  killtypes_t { KILLED_ENEMIES, KILLED_CIVILIANS, KILLED_TEAM, KILLED_NUM_TYPES }
 
enum  abilityskills_t {
  ABILITY_POWER, ABILITY_SPEED, ABILITY_ACCURACY, ABILITY_MIND,
  SKILL_CLOSE, SKILL_HEAVY, SKILL_ASSAULT, SKILL_SNIPER,
  SKILL_EXPLOSIVE, SKILL_PILOTING, SKILL_TARGETING, SKILL_EVADING,
  SKILL_NUM_TYPES
}
 
enum  reservation_types_t {
  RES_REACTION, RES_CROUCH, RES_SHOT, RES_ALL,
  RES_ALL_ACTIVE, RES_TYPES
}
 
enum  actorSound_t { SND_DEATH, SND_HURT, SND_MAX }
 Types of actor sounds being issued by CL_ActorPlaySound(). More...
 
enum  nametypes_t {
  NAME_NEUTRAL, NAME_FEMALE, NAME_MALE, NAME_LAST,
  NAME_FEMALE_LAST, NAME_MALE_LAST, NAME_NUM_TYPES
}
 
enum  modifier_types_t {
  MODIFIER_ACCURACY, MODIFIER_SHOOTING, MODIFIER_MOVEMENT, MODIFIER_SIGHT,
  MODIFIER_REACTION, MODIFIER_TU, MODIFIER_MAX
}
 

Functions

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

Macro Definition Documentation

#define ABILITY_NUM_TYPES   SKILL_CLOSE
#define BODYPART_MAXTYPE   4

Definition at line 255 of file chr_shared.h.

Referenced by AI_SetStats(), CHAR_ParseData(), Com_ParseBodyPart(), and G_SendCharacterData().

#define MAX_CHARACTER_IMPLANTS   4

Definition at line 360 of file chr_shared.h.

#define MAX_CHARACTER_TEMPLATES   24

Definition at line 218 of file chr_shared.h.

Referenced by Com_ParseCharacterTemplate().

#define MAX_TEAMDEFS   64

Definition at line 217 of file chr_shared.h.

Referenced by Com_ParseTeam(), and G_ClientReadCharacter().

#define MAX_TEMPLATES_PER_TEAM   16

Definition at line 219 of file chr_shared.h.

#define MAX_UGV   8

Definition at line 216 of file chr_shared.h.

Referenced by Com_ParseUGVs().

Typedef Documentation

typedef struct character_s character_t

Describes a character with all its attributes.

How many TUs (and of what type) did a player reserve for a unit?

See also
CL_ActorUsableTUs
CL_ActorReservedTUs
CL_ActorReserveTUs

Structure of all stats collected for an actor over time.

Note
More general Info: http://ufoai.org/wiki/index.php/Proposals/Attribute_Increase
This information is stored in savegames (in contract to chrScoreMission_t).
WARNING: if you change something here you'll have to make sure all the network and savegame stuff is updated as well! Additionally you have to check the size of the network-transfer in G_SendCharacterData and GAME_CP_Results

Structure of all stats collected in a mission.

Note
More general Info: http://ufoai.org/wiki/index.php/Proposals/Attribute_Increase
Mostly collected in g_client.c and not used anywhere else (at least that's the plan ;)). The result is parsed into chrScoreGlobal_t which is stored in savegames.
BTAxis about "hit" count: "But yeah, what we want is a counter per skill. This counter should start at 0 every battle, and then be increased by 1 everytime:
  • a direct fire weapon hits (or deals damage, same thing) the actor the weapon was fired at. If it wasn't fired at an actor, nothing should happen.
  • a splash weapon deals damage to any enemy actor. If multiple actors are hit, increase the counter multiple times."
typedef struct chrTemplate_s chrTemplate_t
typedef struct implant_s implant_t
typedef struct teamDef_s teamDef_t
typedef struct teamNames_s teamNames_t
typedef struct ugv_s ugv_t

Defines a type of UGV/Robot.

typedef struct woundInfo_s woundInfo_t

Info on a wound.

Enumeration Type Documentation

Note
Changing order/entries also changes network-transmission and savegames!
Enumerator
ABILITY_POWER 
ABILITY_SPEED 
ABILITY_ACCURACY 
ABILITY_MIND 
SKILL_CLOSE 
SKILL_HEAVY 
SKILL_ASSAULT 
SKILL_SNIPER 
SKILL_EXPLOSIVE 
SKILL_PILOTING 
SKILL_TARGETING 
SKILL_EVADING 
SKILL_NUM_TYPES 

Definition at line 36 of file chr_shared.h.

Types of actor sounds being issued by CL_ActorPlaySound().

Enumerator
SND_DEATH 

Sound being played on actor death.

SND_HURT 

Sound being played when an actor is being hit.

SND_MAX 

Definition at line 207 of file chr_shared.h.

Enumerator
KILLED_ENEMIES 

Killed enemies

KILLED_CIVILIANS 

Civilians, animals

KILLED_TEAM 

Friendly fire, own team, partner-teams.

KILLED_NUM_TYPES 

Definition at line 27 of file chr_shared.h.

Enumerator
MODIFIER_ACCURACY 

Modifier to accuracy

MODIFIER_SHOOTING 

Modifier to shooting

MODIFIER_MOVEMENT 

Modifier to movement

MODIFIER_SIGHT 

Modifier to LoS range

MODIFIER_REACTION 

Modifier to reactions

MODIFIER_TU 

Modifier to TUs

MODIFIER_MAX 

Definition at line 244 of file chr_shared.h.

Enumerator
NAME_NEUTRAL 
NAME_FEMALE 
NAME_MALE 
NAME_LAST 
NAME_FEMALE_LAST 
NAME_MALE_LAST 
NAME_NUM_TYPES 

Definition at line 221 of file chr_shared.h.

Enumerator
RES_REACTION 
RES_CROUCH 
RES_SHOT 
RES_ALL 
RES_ALL_ACTIVE 
RES_TYPES 

Max.

Definition at line 197 of file chr_shared.h.

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().