2001-12-31 16:16:59 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// $Log$
|
2005-02-15 16:33:39 +00:00
|
|
|
// Revision 1.7 2005/02/15 16:33:39 makro
|
|
|
|
// Tons of updates (entity tree attachment system, UI vectors)
|
|
|
|
//
|
2002-07-22 06:35:03 +00:00
|
|
|
// Revision 1.6 2002/07/22 06:32:43 niceass
|
|
|
|
// cleaned up the powerup code
|
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
// Revision 1.5 2002/06/16 20:06:14 jbravo
|
|
|
|
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
|
|
|
|
//
|
2002-01-11 19:48:33 +00:00
|
|
|
// Revision 1.4 2002/01/11 19:48:30 jbravo
|
|
|
|
// Formatted the source in non DOS format.
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// Revision 1.3 2001/12/31 16:28:42 jbravo
|
|
|
|
// I made a Booboo with the Log tag.
|
|
|
|
//
|
2001-12-31 16:16:59 +00:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2001-05-06 20:50:27 +00:00
|
|
|
// g_rankings.c -- reports for global rankings system
|
|
|
|
|
|
|
|
#include "g_local.h"
|
|
|
|
#include "g_rankings.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankRunFrame
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void G_RankRunFrame()
|
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
gentity_t *ent;
|
|
|
|
gentity_t *ent2;
|
|
|
|
grank_status_t old_status;
|
|
|
|
grank_status_t status;
|
|
|
|
int time;
|
|
|
|
int i;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
if (!trap_RankCheckInit()) {
|
|
|
|
trap_RankBegin(GR_GAMEKEY);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trap_RankPoll();
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
if (trap_RankActive()) {
|
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
2001-05-06 20:50:27 +00:00
|
|
|
ent = &(g_entities[i]);
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!ent->inuse)
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent->client == NULL)
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent->r.svFlags & SVF_BOT) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no bots in ranked games
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendConsoleCommand(EXEC_INSERT, va("kick %s\n", ent->client->pers.netname));
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
old_status = ent->client->client_status;
|
2002-06-16 20:06:15 +00:00
|
|
|
status = trap_RankUserStatus(i);
|
|
|
|
|
|
|
|
if (ent->client->client_status != status) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// inform client of current status
|
|
|
|
// not needed for client side log in
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(i, va("rank_status %i\n", status));
|
|
|
|
if (i == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
int j = 0;
|
|
|
|
}
|
|
|
|
ent->client->client_status = status;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
switch (status) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case QGR_STATUS_NEW:
|
|
|
|
case QGR_STATUS_SPECTATOR:
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent->client->sess.sessionTeam != TEAM_SPECTATOR) {
|
2001-05-06 20:50:27 +00:00
|
|
|
ent->client->sess.sessionTeam = TEAM_SPECTATOR;
|
|
|
|
ent->client->sess.spectatorState = SPECTATOR_FREE;
|
2002-06-16 20:06:15 +00:00
|
|
|
ClientSpawn(ent);
|
2001-05-06 20:50:27 +00:00
|
|
|
// make sure by now CS_GRAND rankingsGameID is ready
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(i, va("rank_status %i\n", status));
|
|
|
|
trap_SendServerCommand(i, "rank_menu\n");
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case QGR_STATUS_NO_USER:
|
|
|
|
case QGR_STATUS_BAD_PASSWORD:
|
|
|
|
case QGR_STATUS_TIMEOUT:
|
|
|
|
case QGR_STATUS_NO_MEMBERSHIP:
|
|
|
|
case QGR_STATUS_INVALIDUSER:
|
|
|
|
case QGR_STATUS_ERROR:
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((ent->r.svFlags & SVF_BOT) == 0) {
|
|
|
|
trap_RankUserReset(ent->s.clientNum);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case QGR_STATUS_ACTIVE:
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((ent->client->sess.sessionTeam == TEAM_SPECTATOR) && (g_gametype.integer < GT_TEAM)) {
|
|
|
|
SetTeam(ent, "free");
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (old_status != QGR_STATUS_ACTIVE) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// player has just become active
|
2002-06-16 20:06:15 +00:00
|
|
|
for (j = 0; j < level.maxclients; j++) {
|
2001-05-06 20:50:27 +00:00
|
|
|
ent2 = &(g_entities[j]);
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!ent2->inuse)
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent2->client == NULL)
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent2->r.svFlags & SVF_BOT)
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((i != j) && (trap_RankUserStatus(j) == QGR_STATUS_ACTIVE)) {
|
|
|
|
trap_RankReportInt(i, j, QGR_KEY_PLAYED_WITH, 1, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// send current scores so the player's rank will show
|
|
|
|
// up under the crosshair immediately
|
2002-06-16 20:06:15 +00:00
|
|
|
DeathmatchScoreboardMessage(ent2);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// don't let ranked games last forever
|
2002-06-16 20:06:15 +00:00
|
|
|
if (((g_fraglimit.integer == 0) || (g_fraglimit.integer > 100)) &&
|
|
|
|
((g_timelimit.integer == 0) || (g_timelimit.integer > 1000))) {
|
|
|
|
trap_Cvar_Set("timelimit", "1000");
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// tell time to clients so they can show current match rating
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.intermissiontime == 0) {
|
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
2001-05-06 20:50:27 +00:00
|
|
|
ent = &(g_entities[i]);
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent->client == NULL) {
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
time = (level.time - ent->client->pers.enterTime) / 1000;
|
|
|
|
ent->client->ps.persistant[PERS_MATCH_TIME] = time;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankFireWeapon
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankFireWeapon(int self, int weapon)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
if (weapon == WP_GAUNTLET) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// the gauntlet only "fires" when it actually hits something
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED, 1, 1);
|
|
|
|
|
|
|
|
switch (weapon) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case WP_MACHINEGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_MACHINEGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_SHOTGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_SHOTGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_GRENADE_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_GRENADE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_ROCKET_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_ROCKET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_LIGHTNING:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_LIGHTNING, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_RAILGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_RAILGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_PLASMAGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_PLASMA, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_BFG:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_BFG, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_GRAPPLING_HOOK:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SHOT_FIRED_GRAPPLE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankDamage
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankDamage(int self, int attacker, int damage, int means_of_death)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
|
|
|
// state information to avoid counting each shotgun pellet as a hit
|
2002-06-16 20:06:15 +00:00
|
|
|
static int last_framenum = -1;
|
|
|
|
static int last_self = -1;
|
|
|
|
static int last_attacker = -1;
|
|
|
|
static int last_means_of_death = MOD_UNKNOWN;
|
|
|
|
|
|
|
|
qboolean new_hit;
|
|
|
|
int splash;
|
|
|
|
int key_hit;
|
|
|
|
int key_damage;
|
|
|
|
int key_splash;
|
|
|
|
|
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
new_hit = (level.framenum != last_framenum) ||
|
|
|
|
(self != last_self) || (attacker != last_attacker) || (means_of_death != last_means_of_death);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// update state information
|
|
|
|
last_framenum = level.framenum;
|
|
|
|
last_self = self;
|
|
|
|
last_attacker = attacker;
|
|
|
|
last_means_of_death = means_of_death;
|
|
|
|
|
|
|
|
// the gauntlet only "fires" when it actually hits something
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((attacker != ENTITYNUM_WORLD) && (attacker != self) &&
|
|
|
|
(means_of_death == MOD_GAUNTLET) && (g_entities[attacker].client)) {
|
|
|
|
trap_RankReportInt(attacker, -1, QGR_KEY_SHOT_FIRED_GAUNTLET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// don't track hazard damage, just deaths
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (means_of_death) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case MOD_WATER:
|
|
|
|
case MOD_SLIME:
|
|
|
|
case MOD_LAVA:
|
|
|
|
case MOD_CRUSH:
|
|
|
|
case MOD_TELEFRAG:
|
|
|
|
case MOD_FALLING:
|
|
|
|
case MOD_SUICIDE:
|
|
|
|
case MOD_TRIGGER_HURT:
|
|
|
|
return;
|
|
|
|
default:
|
2005-02-15 16:33:39 +00:00
|
|
|
//Makro - custom death message implies a trigger_hurt
|
|
|
|
if (means_of_death >= MOD_CUSTOM)
|
|
|
|
return;
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get splash damage
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (means_of_death) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case MOD_GRENADE_SPLASH:
|
|
|
|
case MOD_ROCKET_SPLASH:
|
|
|
|
case MOD_PLASMA_SPLASH:
|
|
|
|
case MOD_BFG_SPLASH:
|
|
|
|
splash = damage;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
splash = 0;
|
|
|
|
key_splash = -1;
|
|
|
|
break;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
// hit, damage, and splash taken
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (means_of_death) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case MOD_GAUNTLET:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_GAUNTLET;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_GAUNTLET;
|
|
|
|
break;
|
|
|
|
case MOD_MACHINEGUN:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_MACHINEGUN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_MACHINEGUN;
|
|
|
|
break;
|
|
|
|
case MOD_SHOTGUN:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_SHOTGUN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_SHOTGUN;
|
|
|
|
break;
|
|
|
|
case MOD_GRENADE:
|
|
|
|
case MOD_GRENADE_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_GRENADE;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_GRENADE;
|
|
|
|
key_splash = QGR_KEY_SPLASH_TAKEN_GRENADE;
|
|
|
|
break;
|
|
|
|
case MOD_ROCKET:
|
|
|
|
case MOD_ROCKET_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_ROCKET;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_ROCKET;
|
|
|
|
key_splash = QGR_KEY_SPLASH_TAKEN_ROCKET;
|
|
|
|
break;
|
|
|
|
case MOD_PLASMA:
|
|
|
|
case MOD_PLASMA_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_PLASMA;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_PLASMA;
|
|
|
|
key_splash = QGR_KEY_SPLASH_TAKEN_PLASMA;
|
|
|
|
break;
|
|
|
|
case MOD_RAILGUN:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_RAILGUN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_RAILGUN;
|
|
|
|
break;
|
|
|
|
case MOD_LIGHTNING:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_LIGHTNING;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_LIGHTNING;
|
|
|
|
break;
|
|
|
|
case MOD_BFG:
|
|
|
|
case MOD_BFG_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_BFG;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_BFG;
|
|
|
|
key_splash = QGR_KEY_SPLASH_TAKEN_BFG;
|
|
|
|
break;
|
|
|
|
case MOD_GRAPPLE:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_GRAPPLE;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_GRAPPLE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
key_hit = QGR_KEY_HIT_TAKEN_UNKNOWN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_TAKEN_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// report general and specific hit taken
|
2002-06-16 20:06:15 +00:00
|
|
|
if (new_hit) {
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_HIT_TAKEN, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, key_hit, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// report general and specific damage taken
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_DAMAGE_TAKEN, damage, 1);
|
|
|
|
trap_RankReportInt(self, -1, key_damage, damage, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// report general and specific splash taken
|
2002-06-16 20:06:15 +00:00
|
|
|
if (splash != 0) {
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_SPLASH_TAKEN, splash, 1);
|
|
|
|
trap_RankReportInt(self, -1, key_splash, splash, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// hit, damage, and splash given
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((attacker != ENTITYNUM_WORLD) && (attacker != self)) {
|
|
|
|
switch (means_of_death) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case MOD_GAUNTLET:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_GAUNTLET;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_GAUNTLET;
|
|
|
|
break;
|
|
|
|
case MOD_MACHINEGUN:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_MACHINEGUN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_MACHINEGUN;
|
|
|
|
break;
|
|
|
|
case MOD_SHOTGUN:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_SHOTGUN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_SHOTGUN;
|
|
|
|
break;
|
|
|
|
case MOD_GRENADE:
|
|
|
|
case MOD_GRENADE_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_GRENADE;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_GRENADE;
|
|
|
|
key_splash = QGR_KEY_SPLASH_GIVEN_GRENADE;
|
|
|
|
break;
|
|
|
|
case MOD_ROCKET:
|
|
|
|
case MOD_ROCKET_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_ROCKET;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_ROCKET;
|
|
|
|
key_splash = QGR_KEY_SPLASH_GIVEN_ROCKET;
|
|
|
|
break;
|
|
|
|
case MOD_PLASMA:
|
|
|
|
case MOD_PLASMA_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_PLASMA;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_PLASMA;
|
|
|
|
key_splash = QGR_KEY_SPLASH_GIVEN_PLASMA;
|
|
|
|
break;
|
|
|
|
case MOD_RAILGUN:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_RAILGUN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_RAILGUN;
|
|
|
|
break;
|
|
|
|
case MOD_LIGHTNING:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_LIGHTNING;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_LIGHTNING;
|
|
|
|
break;
|
|
|
|
case MOD_BFG:
|
|
|
|
case MOD_BFG_SPLASH:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_BFG;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_BFG;
|
|
|
|
key_splash = QGR_KEY_SPLASH_GIVEN_BFG;
|
|
|
|
break;
|
|
|
|
case MOD_GRAPPLE:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_GRAPPLE;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_GRAPPLE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
key_hit = QGR_KEY_HIT_GIVEN_UNKNOWN;
|
|
|
|
key_damage = QGR_KEY_DAMAGE_GIVEN_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
// report general and specific hit given
|
|
|
|
// jwu 8/26/00
|
|
|
|
// had a case where attacker is 245 which is grnadeshooter attacker is
|
|
|
|
// g_entities index not necessarilly clientnum
|
|
|
|
if (g_entities[attacker].client) {
|
2002-06-16 20:06:15 +00:00
|
|
|
if (new_hit) {
|
|
|
|
trap_RankReportInt(attacker, -1, QGR_KEY_HIT_GIVEN, 1, 1);
|
|
|
|
trap_RankReportInt(attacker, -1, key_hit, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// report general and specific damage given
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(attacker, -1, QGR_KEY_DAMAGE_GIVEN, damage, 1);
|
|
|
|
trap_RankReportInt(attacker, -1, key_damage, damage, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// report general and specific splash given
|
2002-06-16 20:06:15 +00:00
|
|
|
if (splash != 0) {
|
|
|
|
trap_RankReportInt(attacker, -1, QGR_KEY_SPLASH_GIVEN, splash, 1);
|
|
|
|
trap_RankReportInt(attacker, -1, key_splash, splash, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// friendly fire
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((attacker != self) &&
|
|
|
|
OnSameTeam(&(g_entities[self]), &(g_entities[attacker])) && (g_entities[attacker].client)) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// report teammate hit
|
2002-06-16 20:06:15 +00:00
|
|
|
if (new_hit) {
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TEAMMATE_HIT_TAKEN, 1, 1);
|
|
|
|
trap_RankReportInt(attacker, -1, QGR_KEY_TEAMMATE_HIT_GIVEN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
// report teammate damage
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TEAMMATE_DAMAGE_TAKEN, damage, 1);
|
|
|
|
trap_RankReportInt(attacker, -1, QGR_KEY_TEAMMATE_DAMAGE_GIVEN, damage, 1);
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
// report teammate splash
|
2002-06-16 20:06:15 +00:00
|
|
|
if (splash != 0) {
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TEAMMATE_SPLASH_TAKEN, splash, 1);
|
|
|
|
trap_RankReportInt(attacker, -1, QGR_KEY_TEAMMATE_SPLASH_GIVEN, splash, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankPlayerDie
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankPlayerDie(int self, int attacker, int means_of_death)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
int p1;
|
|
|
|
int p2;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
if (attacker == ENTITYNUM_WORLD) {
|
2001-05-06 20:50:27 +00:00
|
|
|
p1 = self;
|
|
|
|
p2 = -1;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_HAZARD_DEATH, 1, 1);
|
|
|
|
|
|
|
|
switch (means_of_death) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case MOD_WATER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_WATER, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_SLIME:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SLIME, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_LAVA:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_LAVA, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_CRUSH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_CRUSH, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_TELEFRAG:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_TELEFRAG, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_FALLING:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FALLING, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_SUICIDE:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_CMD, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_TRIGGER_HURT:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_TRIGGER_HURT, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-02-15 16:33:39 +00:00
|
|
|
//Makro - custom msg implies a trigger_hurt
|
|
|
|
if (means_of_death >= MOD_CUSTOM)
|
|
|
|
{
|
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_TRIGGER_HURT, 1, 1);
|
|
|
|
} else {
|
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_HAZARD_MISC, 1, 1);
|
|
|
|
}
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (attacker == self) {
|
2001-05-06 20:50:27 +00:00
|
|
|
p1 = self;
|
|
|
|
p2 = -1;
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE, 1, 1);
|
|
|
|
|
|
|
|
switch (means_of_death) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case MOD_GAUNTLET:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_GAUNTLET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_MACHINEGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_MACHINEGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_SHOTGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_SHOTGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_GRENADE:
|
|
|
|
case MOD_GRENADE_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_GRENADE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_ROCKET:
|
|
|
|
case MOD_ROCKET_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_ROCKET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_PLASMA:
|
|
|
|
case MOD_PLASMA_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_PLASMA, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_RAILGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_RAILGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_LIGHTNING:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_LIGHTNING, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_BFG:
|
|
|
|
case MOD_BFG_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_BFG, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_GRAPPLE:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_GRAPPLE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_SUICIDE_UNKNOWN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
} else {
|
2001-05-06 20:50:27 +00:00
|
|
|
p1 = attacker;
|
|
|
|
p2 = self;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG, 1, 1);
|
|
|
|
|
|
|
|
switch (means_of_death) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case MOD_GAUNTLET:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_GAUNTLET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_MACHINEGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_MACHINEGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_SHOTGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_SHOTGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_GRENADE:
|
|
|
|
case MOD_GRENADE_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_GRENADE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_ROCKET:
|
|
|
|
case MOD_ROCKET_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_ROCKET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_PLASMA:
|
|
|
|
case MOD_PLASMA_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_PLASMA, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_RAILGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_RAILGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_LIGHTNING:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_LIGHTNING, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_BFG:
|
|
|
|
case MOD_BFG_SPLASH:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_BFG, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case MOD_GRAPPLE:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_GRAPPLE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(p1, p2, QGR_KEY_FRAG_UNKNOWN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankWeaponTime
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankWeaponTime(int self, int weapon)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
gclient_t *client;
|
|
|
|
int time;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
client = g_entities[self].client;
|
|
|
|
time = (level.time - client->weapon_change_time) / 1000;
|
|
|
|
client->weapon_change_time = level.time;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (time <= 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME, time, 1);
|
|
|
|
|
|
|
|
switch (weapon) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case WP_GAUNTLET:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_GAUNTLET, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_MACHINEGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_MACHINEGUN, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_SHOTGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_SHOTGUN, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_GRENADE_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_GRENADE, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_ROCKET_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_ROCKET, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_LIGHTNING:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_LIGHTNING, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_RAILGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_RAILGUN, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_PLASMAGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_PLASMA, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_BFG:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_BFG, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_GRAPPLING_HOOK:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TIME_GRAPPLE, time, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankPickupWeapon
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankPickupWeapon(int self, int weapon)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_WEAPON, 1, 1);
|
|
|
|
switch (weapon) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case WP_GAUNTLET:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_GAUNTLET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_MACHINEGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_MACHINEGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_SHOTGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_SHOTGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_GRENADE_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_GRENADE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_ROCKET_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_ROCKET, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_LIGHTNING:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_LIGHTNING, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_RAILGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_RAILGUN, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_PLASMAGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_PLASMA, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_BFG:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_BFG, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_GRAPPLING_HOOK:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_PICKUP_GRAPPLE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankPickupAmmo
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankPickupAmmo(int self, int weapon, int quantity)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS, quantity, 1);
|
|
|
|
|
|
|
|
switch (weapon) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case WP_MACHINEGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_BULLETS, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_BULLETS, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_SHOTGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_SHELLS, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_SHELLS, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_GRENADE_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_GRENADES, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_GRENADES, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_ROCKET_LAUNCHER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_ROCKETS, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_ROCKETS, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_LIGHTNING:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_LG_AMMO, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_LG_AMMO, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_RAILGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_SLUGS, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_SLUGS, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_PLASMAGUN:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_CELLS, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_CELLS, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case WP_BFG:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_BOXES_BFG_AMMO, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ROUNDS_BFG_AMMO, quantity, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankPickupHealth
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankPickupHealth(int self, int quantity)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_HEALTH, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_HEALTH_TOTAL, quantity, 1);
|
|
|
|
|
|
|
|
switch (quantity) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case 5:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_HEALTH_5, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case 25:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_HEALTH_25, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case 50:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_HEALTH_50, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case 100:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_HEALTH_MEGA, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankPickupArmor
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankPickupArmor(int self, int quantity)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ARMOR, 1, 1);
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ARMOR_TOTAL, quantity, 1);
|
|
|
|
|
|
|
|
switch (quantity) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case 5:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ARMOR_SHARD, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case 50:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ARMOR_YELLOW, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case 100:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_ARMOR_RED, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankPickupPowerup
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankPickupPowerup(int self, int powerup)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// ctf flags are treated as powerups
|
2002-06-16 20:06:15 +00:00
|
|
|
if ((powerup == PW_REDFLAG) || (powerup == PW_BLUEFLAG)) {
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_FLAG_PICKUP, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_POWERUP, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankPickupHoldable
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankPickupHoldable(int self, int holdable)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
switch (holdable) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case HI_MEDKIT:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_MEDKIT, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case HI_TELEPORTER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TELEPORTER, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankUseHoldable
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankUseHoldable(int self, int holdable)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
switch (holdable) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case HI_MEDKIT:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_MEDKIT_USE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case HI_TELEPORTER:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_TELEPORTER_USE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankReward
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankReward(int self, int award)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
switch (award) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case EF_AWARD_IMPRESSIVE:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_IMPRESSIVE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
case EF_AWARD_EXCELLENT:
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_EXCELLENT, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankCapture
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankCapture(int self)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_FLAG_CAPTURE, 1, 1);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankUserTeamName
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankUserTeamName(int self, char *team_name)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
trap_RankReportStr(self, -1, QGR_KEY_TEAM_NAME, team_name);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankClientDisconnect
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankClientDisconnect(int self)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
gclient_t *client;
|
|
|
|
int time;
|
|
|
|
int match_rating;
|
|
|
|
|
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// match rating
|
|
|
|
client = g_entities[self].client;
|
|
|
|
time = (level.time - client->pers.enterTime) / 1000;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (time < 60) {
|
2001-05-06 20:50:27 +00:00
|
|
|
match_rating = 0;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else {
|
2001-05-06 20:50:27 +00:00
|
|
|
match_rating = client->ps.persistant[PERS_MATCH_RATING] / time;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(self, -1, QGR_KEY_MATCH_RATING, match_rating, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
G_RankGameOver
|
|
|
|
================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_RankGameOver(void)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
int i;
|
|
|
|
char str[MAX_INFO_VALUE];
|
|
|
|
int num;
|
|
|
|
|
|
|
|
if (level.warmupTime != 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
// no reports during warmup period
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
|
|
|
if (trap_RankUserStatus(i) == QGR_STATUS_ACTIVE) {
|
|
|
|
G_RankClientDisconnect(i);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
// hostname
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Cvar_VariableStringBuffer("sv_hostname", str, sizeof(str));
|
|
|
|
trap_RankReportStr(-1, -1, QGR_KEY_HOSTNAME, str);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// map
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Cvar_VariableStringBuffer("mapname", str, sizeof(str));
|
|
|
|
trap_RankReportStr(-1, -1, QGR_KEY_MAP, str);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// mod
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Cvar_VariableStringBuffer("fs_game", str, sizeof(str));
|
|
|
|
trap_RankReportStr(-1, -1, QGR_KEY_MOD, str);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// gametype
|
|
|
|
num = trap_Cvar_VariableIntegerValue("g_gametype");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_GAMETYPE, num, 0);
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
// fraglimit
|
|
|
|
num = trap_Cvar_VariableIntegerValue("fraglimit");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_FRAGLIMIT, num, 0);
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
// timelimit
|
|
|
|
num = trap_Cvar_VariableIntegerValue("timelimit");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_TIMELIMIT, num, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// maxclients
|
|
|
|
num = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_MAXCLIENTS, num, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// maxrate
|
|
|
|
num = trap_Cvar_VariableIntegerValue("sv_maxRate");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_MAXRATE, num, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// minping
|
|
|
|
num = trap_Cvar_VariableIntegerValue("sv_minPing");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_MINPING, num, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// maxping
|
|
|
|
num = trap_Cvar_VariableIntegerValue("sv_maxPing");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_MAXPING, num, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// dedicated
|
|
|
|
num = trap_Cvar_VariableIntegerValue("dedicated");
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_RankReportInt(-1, -1, QGR_KEY_DEDICATED, num, 0);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// version
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Cvar_VariableStringBuffer("version", str, sizeof(str));
|
|
|
|
trap_RankReportStr(-1, -1, QGR_KEY_VERSION, str);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|