g_match.c File Reference

Match related functions. More...

#include "g_local.h"
#include "g_ai.h"
Include dependency graph for g_match.c:

Go to the source code of this file.

Functions

static int G_GetEarnedExperience (abilityskills_t skill, character_t *chr)
 Determines the amount of XP earned by a given soldier for a given skill, based on the soldier's performance in the last mission.
static int G_CharacterGetMaxExperiencePerMission (const abilityskills_t skill)
 Determines the maximum amount of XP per skill that can be gained from any one mission.
static void G_UpdateCharacterSkills (character_t *chr)
 Updates character skills after a mission.
void G_MatchEndTrigger (int team, int timeGap)
 Triggers the end of the game. Will be executed in the next server (or game) frame.
static void G_SendCharacterData (const edict_t *ent)
 Sends character stats like assigned missions and kills back to client.
static void G_MatchSendResults (int team)
 Handles the end of a match.
qboolean G_MatchDoEnd (void)
 Checks whether a match is over.
void G_MatchEndCheck (void)
 Checks whether there are still actors to fight with left. If non are the match end will be triggered.
qboolean G_MatchIsRunning (void)
 Checks whether the game is running (active team and no intermission time).

Detailed Description

Match related functions.

Definition in file g_match.c.


Function Documentation

static int G_CharacterGetMaxExperiencePerMission ( const abilityskills_t  skill  )  [static]

Determines the maximum amount of XP per skill that can be gained from any one mission.

Parameters:
[in] skill The skill for which to fetch the maximum amount of XP.
See also:
G_UpdateCharacterSkills
G_GetEarnedExperience
Note:
Explanation of the values here: There is a maximum speed at which skills may rise over the course of 100 missions (the predicted career length of a veteran soldier). For example, POWER will, at best, rise 10 points over 100 missions. If the soldier gets max XP every time. Because the increase is given as experience^0.6, that means that the maximum XP cap x per mission is given as log 10 / log x = 0.6 log x = log 10 / 0.6 x = 10 ^ (log 10 / 0.6) x = 46 The division by 100 happens in G_UpdateCharacterSkills

Definition at line 96 of file g_match.c.

References ABILITY_ACCURACY, ABILITY_MIND, ABILITY_POWER, ABILITY_SPEED, gi, SKILL_ASSAULT, SKILL_CLOSE, SKILL_EXPLOSIVE, SKILL_HEAVY, SKILL_NUM_TYPES, and SKILL_SNIPER.

Referenced by G_UpdateCharacterSkills().

static int G_GetEarnedExperience ( abilityskills_t  skill,
character_t chr 
) [static]

Determines the amount of XP earned by a given soldier for a given skill, based on the soldier's performance in the last mission.

Parameters:
[in] skill The skill for which to fetch the maximum amount of XP.
[in] chr Pointer to the character you want to get the earned experience for
See also:
G_UpdateCharacterSkills
G_GetMaxExperiencePerMission

Todo:
Make a formula for this once strength is used in combat.

Definition at line 36 of file g_match.c.

References ABILITY_ACCURACY, ABILITY_MIND, ABILITY_POWER, ABILITY_SPEED, chrScoreMission_s::firedSplashTUs, chrScoreMission_s::firedTUs, chrScoreMission_s::hits, chrScoreMission_s::hitsSplash, i, KILLED_ENEMIES, chrScoreMission_s::kills, chrScoreMission_s::movedCrouched, chrScoreMission_s::movedNormal, character_s::scoreMission, SKILL_ASSAULT, SKILL_CLOSE, SKILL_EXPLOSIVE, SKILL_HEAVY, SKILL_NUM_TYPES, and SKILL_SNIPER.

Referenced by G_UpdateCharacterSkills().

qboolean G_MatchDoEnd ( void   ) 

Checks whether a match is over.

Returns:
true if this match is over, false otherwise

Definition at line 306 of file g_match.c.

References G_MatchSendResults(), G_PrintStats(), level_locals_t::intermissionTime, level, qfalse, qtrue, level_locals_t::time, va(), and level_locals_t::winningTeam.

Referenced by G_RunFrame().

void G_MatchEndCheck ( void   ) 

Checks whether there are still actors to fight with left. If non are the match end will be triggered.

See also:
G_MatchEndTrigger

Todo:
count from 0 to get the civilians for objectives
Todo:
< 2 does not work when we count civilians

Definition at line 325 of file g_match.c.

References level_locals_t::activeTeam, G_EdictsGetNextLivingActorOfTeam(), G_IsStunned, G_MatchEndTrigger(), i, level_locals_t::intermissionTime, level, MAX_TEAMS, level_locals_t::numplayers, and TEAM_ALIEN.

Referenced by G_ClientDisconnect(), and G_ClientShoot().

void G_MatchEndTrigger ( int  team,
int  timeGap 
)

Triggers the end of the game. Will be executed in the next server (or game) frame.

Parameters:
[in] team The winning team
[in] timeGap Second to wait before really ending the game. Useful if you want to allow a last view on the scene

Definition at line 169 of file g_match.c.

References level_locals_t::intermissionTime, level, level_locals_t::time, and level_locals_t::winningTeam.

Referenced by G_MatchEndCheck(), G_MissionThink(), and SVCmd_Win_f().

qboolean G_MatchIsRunning ( void   ) 

Checks whether the game is running (active team and no intermission time).

Returns:
true if there is an active team for the current round and the end of the game was not yet triggered
See also:
G_MatchEndTrigger

Definition at line 366 of file g_match.c.

References level_locals_t::activeTeam, level_locals_t::intermissionTime, level, qfalse, and TEAM_NO_ACTIVE.

Referenced by Door_Use(), G_ClientEndRound(), G_ClientUserinfoChanged(), G_GetStartingTeam(), G_MissionThink(), G_PhysicsRun(), G_ReactionFireCanBeEnabled(), and G_RunFrame().

static void G_MatchSendResults ( int  team  )  [static]
static void G_SendCharacterData ( const edict_t ent  )  [static]

Sends character stats like assigned missions and kills back to client.

Parameters:
[in] ent The edict to send the data for
Note:
first short is the ucn to allow the client to identify the character
parsed in GAME_CP_Results
See also:
GAME_SendCurrentTeamSpawningInfo
Note:
you also have to update the pascal string size in G_MatchSendResults if you change the buffer here

Scores

See also:
inv_shared.h:chrScoreGlobal_t

Definition at line 184 of file g_match.c.

References chrScoreGlobal_s::assignedMissions, edict_s::chr, chrScoreGlobal_s::experience, gi, edict_s::HP, KILLED_NUM_TYPES, chrScoreGlobal_s::kills, edict_s::morale, character_s::score, SKILL_NUM_TYPES, chrScoreGlobal_s::skills, edict_s::STUN, chrScoreGlobal_s::stuns, and character_s::ucn.

Referenced by G_MatchSendResults().

static void G_UpdateCharacterSkills ( character_t chr  )  [static]

Updates character skills after a mission.

Parameters:
[in,out] chr Pointer to the character that should get the skills updated
See also:
CL_UpdateCharacterStats
G_UpdateCharacterScore
G_UpdateHitScore

< We need to get sure that index for health-experience is correct.

Definition at line 131 of file g_match.c.

References chrScoreGlobal_s::experience, G_CharacterGetMaxExperiencePerMission(), G_GetEarnedExperience(), G_PrintStats(), i, chrScoreGlobal_s::initialSkills, int(), character_s::maxHP, character_s::name, teamDef_s::race, RACE_ROBOT, character_s::score, SKILL_NUM_TYPES, chrScoreGlobal_s::skills, character_s::teamDef, and va().

Referenced by G_MatchSendResults().


Generated by  doxygen 1.6.2