29character_s::character_s ()
34void character_s::init ()
36 name[0] = path[0] = body[0] = head[0] =
'\0';
37 ucn = bodySkin = headSkin = HP = minHP = maxHP = STUN = morale = state = gender = 0;
55const char* teamDef_s::getActorSound (
int gender,
actorSound_t soundType)
const
61 if (numSounds[soundType][gender] <= 0) {
67 const int random = rand() % numSounds[soundType][gender];
69 for (
int j = 0; j < random; j++) {
76 return (
const char*)list->
data;
146 if (def ==
nullptr || def->
item ==
nullptr)
161 implant.
def =
nullptr;
165 if (e ==
nullptr || e->
period <= 0)
198 if (implant.
def !=
nullptr)
228 templateId =
"soldier_mp";
233 Sys_Error(
"CHRSH_CharGenAbilitySkills: Character template not found (%s) in %s", templateId, teamDef->
id);
236 float sumRate = 0.0f;
239 sumRate += chrTemplate->
rate;
241 if (sumRate > 0.0f) {
242 const float soldierRoll =
frand();
243 float curRate = 0.0f;
245 curRate += chrTemplate->
rate;
246 if (curRate && soldierRoll <= (curRate / sumRate))
258 Sys_Error(
"CHRSH_CharGenAbilitySkills: No character template for team %s!", teamDef->
id);
262 const int (*skillsTemplate)[2] = chrTemplate->
skills;
266 const int abilityWindow = skillsTemplate[
i][1] - skillsTemplate[
i][0];
268 const int temp = (
frand() * abilityWindow) + skillsTemplate[
i][0];
299 static char returnModel[
MAX_VAR];
306 Sys_Error(
"CHRSH_CharGetBody: Item is no armour");
321 static char returnModel[
MAX_VAR];
328 Sys_Error(
"CHRSH_CharGetBody: Item is no armour");
344 float currentArea = 0.0f;
348 currentArea +=
getArea(bodyPart);
349 if (rnd <= currentArea)
381 return _bodyParts[bodyPart].bleedingFactor * 0.01f;
386 return _bodyParts[bodyPart].woundThreshold * 0.01f;
407 const float rnd =
frand();
414 if (height <= shape[3] || height > shape[2] + shape[3])
416 curRand += (direction < 2 ? shape[0] : (direction < 4 ? shape[1] : (shape[0] + shape[1]) * 0.5f));
const implant_t * CHRSH_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.
bool CHRSH_IsTeamDefRobot(const teamDef_t *const td)
Check if a team definition is a robot.
bool CHRSH_IsTeamDefAlien(const teamDef_t *const td)
Check if a team definition is alien.
const char * CHRSH_CharGetBody(const character_t *const chr)
Returns the body model for the soldiers for armoured and non armoured soldiers.
void CHRSH_UpdateImplants(character_t &chr)
Updates the characters permanent implants. Called every day.
bool CHRSH_IsArmourUseableForTeam(const objDef_t *od, const teamDef_t *teamDef)
const char * CHRSH_CharGetHead(const character_t *const chr)
Returns the head model for the soldiers for armoured and non armoured soldiers.
const chrTemplate_t * CHRSH_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.
#define MAX_CHARACTER_IMPLANTS
actorSound_t
Types of actor sounds being issued by CL_ActorPlaySound().
float getArea(const short bodyPart) const
void setId(const char *id)
void addBodyPart(const BodyPartData &bodyPart)
BodyPartData _bodyParts[BODYPART_MAXTYPE]
float woundThreshold(const short bodyPart) const
const char * name(const short bodyPart) const
short getHitBodyPart(const byte direction, const float height) const
short numBodyParts(void) const
float penalty(const short bodyPart, const modifier_types_t type) const
const char * id(void) const
float bleedingFactor(const short bodyPart) const
short getRandomBodyPart(void) const
const objDef_t * def(void) const
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
void Com_Printf(const char *const fmt,...)
#define ACTOR_SIZE_INVALID
static chrScoreMission_t scoreMission[MAX_EDICTS]
void Sys_Error(const char *error,...)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
float frand(void)
Return random values between 0 and 1.
QGL_EXTERN GLint GLenum type
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
bool Q_strnull(const char *string)
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
Describes a character with all its attributes.
const teamDef_t * teamDef
implant_t implants[MAX_CHARACTER_IMPLANTS]
How many TUs (and of what type) did a player reserve for a unit?
Structure of all stats collected for an actor over time.
int initialSkills[SKILL_NUM_TYPES+1]
int skills[SKILL_NUM_TYPES]
int experience[SKILL_NUM_TYPES+1]
int skills[SKILL_NUM_TYPES+1][2]
const struct objDef_s * item
Defines all attributes of objects used in the inventory.
itemEffect_t * strengthenEffect
const chrTemplate_t * characterTemplates[MAX_TEMPLATES_PER_TEAM]
#define Vector4Copy(src, dest)