/** * @todo: replace this cvar hell with confuncs */ static void CL_CharacterSkillAndScoreCvars (const character_t* chr) { const chrScoreGlobal_t* score = &chr->score; Cvar_ForceSet("mn_name", chr->name); Cvar_ForceSet("mn_body", CHRSH_CharGetBody(chr)); Cvar_ForceSet("mn_head", CHRSH_CharGetHead(chr)); Cvar_ForceSet("mn_body_skin", va("%i", chr->bodySkin)); Cvar_ForceSet("mn_head_skin", va("%i", chr->headSkin)); Cvar_SetValue("mn_vpwr", score->skills[ABILITY_POWER]); Cvar_SetValue("mn_vspd", score->skills[ABILITY_SPEED]); Cvar_SetValue("mn_vacc", score->skills[ABILITY_ACCURACY]); Cvar_SetValue("mn_vmnd", score->skills[ABILITY_MIND]); Cvar_SetValue("mn_vcls", score->skills[SKILL_CLOSE]); Cvar_SetValue("mn_vhvy", score->skills[SKILL_HEAVY]); Cvar_SetValue("mn_vass", score->skills[SKILL_ASSAULT]); Cvar_SetValue("mn_vsnp", score->skills[SKILL_SNIPER]); Cvar_SetValue("mn_vexp", score->skills[SKILL_EXPLOSIVE]); Cvar_SetValue("mn_vpil", score->skills[SKILL_PILOTING]); Cvar_SetValue("mn_vtar", score->skills[SKILL_TARGETING]); Cvar_SetValue("mn_vevad", score->skills[SKILL_EVADING]); Cvar_SetValue("mn_vpwri", score->initialSkills[ABILITY_POWER]); Cvar_SetValue("mn_vspdi", score->initialSkills[ABILITY_SPEED]); Cvar_SetValue("mn_vacci", score->initialSkills[ABILITY_ACCURACY]); Cvar_SetValue("mn_vmndi", score->initialSkills[ABILITY_MIND]); Cvar_SetValue("mn_vclsi", score->initialSkills[SKILL_CLOSE]); Cvar_SetValue("mn_vhvyi", score->initialSkills[SKILL_HEAVY]); Cvar_SetValue("mn_vassi", score->initialSkills[SKILL_ASSAULT]); Cvar_SetValue("mn_vsnpi", score->initialSkills[SKILL_SNIPER]); Cvar_SetValue("mn_vexpi", score->initialSkills[SKILL_EXPLOSIVE]); Cvar_SetValue("mn_vpili", score->initialSkills[SKILL_PILOTING]); Cvar_SetValue("mn_vtari", score->initialSkills[SKILL_TARGETING]); Cvar_SetValue("mn_vevadi", score->initialSkills[SKILL_EVADING]); Cvar_SetValue("mn_vhp", chr->HP); Cvar_SetValue("mn_vhpmax", chr->maxHP); Cvar_Set("mn_tpwr", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_POWER]), score->skills[ABILITY_POWER]); Cvar_Set("mn_tspd", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_SPEED]), score->skills[ABILITY_SPEED]); Cvar_Set("mn_tacc", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_ACCURACY]), score->skills[ABILITY_ACCURACY]); Cvar_Set("mn_tmnd", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_MIND]), score->skills[ABILITY_MIND]); Cvar_Set("mn_tcls", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_CLOSE]), score->skills[SKILL_CLOSE]); Cvar_Set("mn_thvy", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_HEAVY]), score->skills[SKILL_HEAVY]); Cvar_Set("mn_tass", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_ASSAULT]), score->skills[SKILL_ASSAULT]); Cvar_Set("mn_tsnp", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_SNIPER]), score->skills[SKILL_SNIPER]); Cvar_Set("mn_texp", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_EXPLOSIVE]), score->skills[SKILL_EXPLOSIVE]); Cvar_Set("mn_tpil", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_PILOTING]), score->skills[SKILL_PILOTING]); Cvar_Set("mn_ttar", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_TARGETING]), score->skills[SKILL_TARGETING]); Cvar_Set("mn_tevad", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_EVADING]), score->skills[SKILL_EVADING]); Cvar_Set("mn_thp", "%i (%i)", chr->HP, chr->maxHP); }
/** * @brief Used after spawning an actor to set some default values that are not read from the * network event. * @param ent The actor edict to set the values for. */ static void G_ClientAssignDefaultActorValues (edict_t *ent) { /* Mission Scores */ OBJZERO(scoreMission[scoreMissionNum]); ent->chr.scoreMission = &scoreMission[scoreMissionNum]; scoreMissionNum++; /* set initial vital statistics */ ent->HP = ent->chr.HP; ent->morale = ent->chr.morale; /** @todo for now, heal fully upon entering mission */ ent->morale = GET_MORALE(ent->chr.score.skills[ABILITY_MIND]); /* set models */ ent->body = gi.ModelIndex(CHRSH_CharGetBody(&ent->chr)); ent->head = gi.ModelIndex(CHRSH_CharGetHead(&ent->chr)); }
static void CL_CharacterSkillAndScoreCvars (const character_t *chr, const char* cvarPrefix) { const chrScoreGlobal_t *score = &chr->score; Cvar_ForceSet(va("%s%s", cvarPrefix, "name"), chr->name); Cvar_ForceSet(va("%s%s", cvarPrefix, "body"), CHRSH_CharGetBody(chr)); Cvar_ForceSet(va("%s%s", cvarPrefix, "head"), CHRSH_CharGetHead(chr)); Cvar_ForceSet(va("%s%s", cvarPrefix, "skin"), va("%i", chr->bodySkin)); Cvar_ForceSet(va("%s%s", cvarPrefix, "skinname"), CL_GetTeamSkinName(chr->bodySkin)); Cvar_Set(va("%s%s", cvarPrefix, "vpwr"), va("%i", score->skills[ABILITY_POWER])); Cvar_Set(va("%s%s", cvarPrefix, "vspd"), va("%i", score->skills[ABILITY_SPEED])); Cvar_Set(va("%s%s", cvarPrefix, "vacc"), va("%i", score->skills[ABILITY_ACCURACY])); Cvar_Set(va("%s%s", cvarPrefix, "vmnd"), va("%i", score->skills[ABILITY_MIND])); Cvar_Set(va("%s%s", cvarPrefix, "vcls"), va("%i", score->skills[SKILL_CLOSE])); Cvar_Set(va("%s%s", cvarPrefix, "vhvy"), va("%i", score->skills[SKILL_HEAVY])); Cvar_Set(va("%s%s", cvarPrefix, "vass"), va("%i", score->skills[SKILL_ASSAULT])); Cvar_Set(va("%s%s", cvarPrefix, "vsnp"), va("%i", score->skills[SKILL_SNIPER])); Cvar_Set(va("%s%s", cvarPrefix, "vexp"), va("%i", score->skills[SKILL_EXPLOSIVE])); Cvar_Set(va("%s%s", cvarPrefix, "vpwri"), va("%i", score->initialSkills[ABILITY_POWER])); Cvar_Set(va("%s%s", cvarPrefix, "vspdi"), va("%i", score->initialSkills[ABILITY_SPEED])); Cvar_Set(va("%s%s", cvarPrefix, "vacci"), va("%i", score->initialSkills[ABILITY_ACCURACY])); Cvar_Set(va("%s%s", cvarPrefix, "vmndi"), va("%i", score->initialSkills[ABILITY_MIND])); Cvar_Set(va("%s%s", cvarPrefix, "vclsi"), va("%i", score->initialSkills[SKILL_CLOSE])); Cvar_Set(va("%s%s", cvarPrefix, "vhvyi"), va("%i", score->initialSkills[SKILL_HEAVY])); Cvar_Set(va("%s%s", cvarPrefix, "vassi"), va("%i", score->initialSkills[SKILL_ASSAULT])); Cvar_Set(va("%s%s", cvarPrefix, "vsnpi"), va("%i", score->initialSkills[SKILL_SNIPER])); Cvar_Set(va("%s%s", cvarPrefix, "vexpi"), va("%i", score->initialSkills[SKILL_EXPLOSIVE])); Cvar_Set(va("%s%s", cvarPrefix, "vhp"), va("%i", chr->HP)); Cvar_Set(va("%s%s", cvarPrefix, "vhpmax"), va("%i", chr->maxHP)); Cvar_Set(va("%s%s", cvarPrefix, "tpwr"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_POWER]), score->skills[ABILITY_POWER])); Cvar_Set(va("%s%s", cvarPrefix, "tspd"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_SPEED]), score->skills[ABILITY_SPEED])); Cvar_Set(va("%s%s", cvarPrefix, "tacc"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_ACCURACY]), score->skills[ABILITY_ACCURACY])); Cvar_Set(va("%s%s", cvarPrefix, "tmnd"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_MIND]), score->skills[ABILITY_MIND])); Cvar_Set(va("%s%s", cvarPrefix, "tcls"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_CLOSE]), score->skills[SKILL_CLOSE])); Cvar_Set(va("%s%s", cvarPrefix, "thvy"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_HEAVY]), score->skills[SKILL_HEAVY])); Cvar_Set(va("%s%s", cvarPrefix, "tass"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_ASSAULT]), score->skills[SKILL_ASSAULT])); Cvar_Set(va("%s%s", cvarPrefix, "tsnp"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_SNIPER]), score->skills[SKILL_SNIPER])); Cvar_Set(va("%s%s", cvarPrefix, "texp"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_EXPLOSIVE]), score->skills[SKILL_EXPLOSIVE])); Cvar_Set(va("%s%s", cvarPrefix, "thp"), va("%i (%i)", chr->HP, chr->maxHP)); }