66 const int random = rand() %
numSounds[soundType][gender];
68 for (
int j = 0; j < random; j++) {
75 return (
const char*)list->
data;
145 if (def ==
nullptr || def->
item ==
nullptr)
160 implant.
def =
nullptr;
164 if (e ==
nullptr || e->
period <= 0)
197 if (implant.
def !=
nullptr)
227 templateId =
"soldier_mp";
232 Sys_Error(
"CHRSH_CharGenAbilitySkills: Character template not found (%s) in %s", templateId, teamDef->
id);
235 float sumRate = 0.0f;
238 sumRate += chrTemplate->
rate;
240 if (sumRate > 0.0
f) {
241 const float soldierRoll =
frand();
242 float curRate = 0.0f;
244 curRate += chrTemplate->
rate;
245 if (curRate && soldierRoll <= (curRate / sumRate))
257 Sys_Error(
"CHRSH_CharGenAbilitySkills: No character template for team %s!", teamDef->
id);
261 const int (*skillsTemplate)[2] = chrTemplate->
skills;
265 const int abilityWindow = skillsTemplate[
i][1] - skillsTemplate[
i][0];
267 const int temp = (
frand() * abilityWindow) + skillsTemplate[
i][0];
274 const int temp = (
frand() * abilityWindow) + skillsTemplate[SKILL_NUM_TYPES][0];
298 static char returnModel[
MAX_VAR];
305 Sys_Error(
"CHRSH_CharGetBody: Item is no armour");
320 static char returnModel[
MAX_VAR];
327 Sys_Error(
"CHRSH_CharGetBody: Item is no armour");
336 _totalBodyArea(0.0
f), _numBodyParts(0)
343 float currentArea = 0.0f;
347 currentArea +=
getArea(bodyPart);
348 if (rnd <= currentArea)
351 if (bodyPart >= _numBodyParts) {
406 const float rnd =
frand();
413 if (height <= shape[3] || height > shape[2] + shape[3])
415 curRand += (direction < 2 ? shape[0] : (direction < 4 ? shape[1] : (shape[0] + shape[1]) * 0.5
f));
419 if (bodyPart >= _numBodyParts) {
bool Q_strnull(const char *string)
short getHitBodyPart(const byte direction, const float height) const
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
BodyPartData _bodyParts[BODYPART_MAXTYPE]
const teamDef_t * teamDef
int experience[SKILL_NUM_TYPES+1]
void set(const actorHands_t hand, const fireDefIndex_t fmIdx, const objDef_t *weapon)
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const implant_t * CHRSH_ApplyImplant(character_t &chr, const implantDef_t &def)
Add a new implant to a character.
const objDef_t * def(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 char * CHRSH_CharGetBody(const character_t *const chr)
Returns the body model for the soldiers for armoured and non armoured soldiers.
Defines all attributes of objects used in the inventory.
chrScoreMission_t * scoreMission
const chrTemplate_t * characterTemplates[MAX_TEMPLATES_PER_TEAM]
float getArea(const short bodyPart) const
float bleedingFactor(const short bodyPart) const
void CHRSH_UpdateImplants(character_t &chr)
Updates the characters permanent implants. Called every day.
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.
int numSounds[SND_MAX][NAME_LAST]
int skills[SKILL_NUM_TYPES+1][2]
int initialSkills[SKILL_NUM_TYPES+1]
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.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
implant_t implants[MAX_CHARACTER_IMPLANTS]
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 woundThreshold(const short bodyPart) const
Structure of all stats collected for an actor over time.
linkedList_t * sounds[SND_MAX][NAME_LAST]
short numBodyParts(void) const
const char * name(const short bodyPart) const
float frand(void)
Return random values between 0 and 1.
itemEffect_t * strengthenEffect
const char * getActorSound(int gender, actorSound_t soundType) const
Returns the actor sounds for a given category.
float penalty(const short bodyPart, const modifier_types_t type) const
const char * id(void) const
actorSound_t
Types of actor sounds being issued by CL_ActorPlaySound().
void setId(const char *id)
short getRandomBodyPart(void) const
const struct objDef_s * item
#define ACTOR_SIZE_INVALID
actorSizeEnum_t fieldSize
int skills[SKILL_NUM_TYPES]
#define Vector4Copy(src, dest)
bool CHRSH_IsArmourUseableForTeam(const objDef_t *od, const teamDef_t *teamDef)
chrReservations_t reservedTus
Describes a character with all its attributes.