29 character_s::character_s ()
34 void 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;
55 const 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.0
f) {
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");
337 _totalBodyArea(0.0
f), _numBodyParts(0)
344 float currentArea = 0.0f;
348 currentArea +=
getArea(bodyPart);
349 if (rnd <= currentArea)
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.5
f));
bool Q_strnull(const char *string)
static void CHRSH_UpdateCharacterWithEffect(character_t &chr, const itemEffect_t &e)
Assign the effect values to the character.
void Sys_Error(const char *error,...)
QGL_EXTERN GLint GLenum type
Defines all attributes of objects used in the inventory.
int experience[SKILL_NUM_TYPES+1]
int skills[SKILL_NUM_TYPES]
implant_t implants[MAX_CHARACTER_IMPLANTS]
BodyPartData _bodyParts[BODYPART_MAXTYPE]
static chrScoreMission_t scoreMission[MAX_EDICTS]
short numBodyParts(void) const
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 implant_t * CHRSH_ApplyImplant(character_t &chr, const implantDef_t &def)
Add a new implant to a character.
short getRandomBodyPart(void) const
bool CHRSH_IsTeamDefAlien(const teamDef_t *const td)
Check if a team definition is alien.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
void Com_Printf(const char *const fmt,...)
const teamDef_t * teamDef
const char * CHRSH_CharGetBody(const character_t *const chr)
Returns the body model for the soldiers for armoured and non armoured soldiers.
float bleedingFactor(const short bodyPart) const
int skills[SKILL_NUM_TYPES+1][2]
itemEffect_t * strengthenEffect
void CHRSH_UpdateImplants(character_t &chr)
Updates the characters permanent implants. Called every day.
const struct objDef_s * item
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
int penalties[MODIFIER_MAX]
void CHRSH_CharGenAbilitySkills(character_t *chr, bool multiplayer, const char *templateId)
Generates a skill and ability set for any character.
Structure of all stats collected for an actor over time.
short getHitBodyPart(const byte direction, const float height) const
float woundThreshold(const short bodyPart) const
float penalty(const short bodyPart, const modifier_types_t type) const
const chrTemplate_t * CHRSH_GetTemplateByID(const teamDef_t *teamDef, const char *templateId)
bool CHRSH_IsTeamDefRobot(const teamDef_t *const td)
Check if a team definition is a robot.
#define MAX_CHARACTER_IMPLANTS
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
void addBodyPart(const BodyPartData &bodyPart)
const char * CHRSH_CharGetHead(const character_t *const chr)
Returns the head model for the soldiers for armoured and non armoured soldiers.
float getArea(const short bodyPart) const
const char * id(void) const
int initialSkills[SKILL_NUM_TYPES+1]
How many TUs (and of what type) did a player reserve for a unit?
float frand(void)
Return random values between 0 and 1.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
actorSound_t
Types of actor sounds being issued by CL_ActorPlaySound().
void setId(const char *id)
const objDef_t * def(void) const
const char * name(const short bodyPart) const
#define ACTOR_SIZE_INVALID
#define Vector4Copy(src, dest)
bool CHRSH_IsArmourUseableForTeam(const objDef_t *od, const teamDef_t *teamDef)
const chrTemplate_t * characterTemplates[MAX_TEMPLATES_PER_TEAM]