mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-11 15:52:30 +00:00
Added a variable system from AQ. Works the same except it uses $ for %
This commit is contained in:
parent
8167883b53
commit
fcada2358f
7 changed files with 352 additions and 15 deletions
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.40 2002/03/14 23:54:12 jbravo
|
||||||
|
// Added a variable system from AQ. Works the same except it uses $ for %
|
||||||
|
//
|
||||||
// Revision 1.39 2002/03/03 22:02:15 jbravo
|
// Revision 1.39 2002/03/03 22:02:15 jbravo
|
||||||
// Further attempts to stop "you fragged XXX" messages for spectators
|
// Further attempts to stop "you fragged XXX" messages for spectators
|
||||||
//
|
//
|
||||||
|
@ -672,7 +675,7 @@ static void CG_Obituary_Head( entityState_t *ent ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't know what it was
|
// we don't know what it was
|
||||||
CG_Printf( "%s died.\n", targetName );
|
CG_Printf( "%s died and the mod is %i. Tell this to JB\n", targetName, mod );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.49 2002/03/14 23:54:12 jbravo
|
||||||
|
// Added a variable system from AQ. Works the same except it uses $ for %
|
||||||
|
//
|
||||||
// Revision 1.48 2002/03/14 02:24:39 jbravo
|
// Revision 1.48 2002/03/14 02:24:39 jbravo
|
||||||
// Adding radio :)
|
// Adding radio :)
|
||||||
//
|
//
|
||||||
|
@ -1430,7 +1433,8 @@ void ClientSpawn(gentity_t *ent) {
|
||||||
// client->areabits = savedAreaBits;
|
// client->areabits = savedAreaBits;
|
||||||
client->accuracy_hits = accuracy_hits;
|
client->accuracy_hits = accuracy_hits;
|
||||||
client->accuracy_shots = accuracy_shots;
|
client->accuracy_shots = accuracy_shots;
|
||||||
client->lastkilled_client = -1;
|
// client->lastkilled_client = -1;
|
||||||
|
client->lastkilled_client[0] = NULL;
|
||||||
|
|
||||||
for ( i = 0 ; i < MAX_PERSISTANT ; i++ ) {
|
for ( i = 0 ; i < MAX_PERSISTANT ; i++ ) {
|
||||||
client->ps.persistant[i] = persistant[i];
|
client->ps.persistant[i] = persistant[i];
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.71 2002/03/14 23:54:12 jbravo
|
||||||
|
// Added a variable system from AQ. Works the same except it uses $ for %
|
||||||
|
//
|
||||||
// Revision 1.70 2002/03/14 02:24:39 jbravo
|
// Revision 1.70 2002/03/14 02:24:39 jbravo
|
||||||
// Adding radio :)
|
// Adding radio :)
|
||||||
//
|
//
|
||||||
|
@ -1169,10 +1172,10 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
|
||||||
case SAY_ALL:
|
case SAY_ALL:
|
||||||
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {
|
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {
|
||||||
Com_sprintf (name, sizeof(name), "[DEAD] %s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
Com_sprintf (name, sizeof(name), "[DEAD] %s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
||||||
G_LogPrintf( "[DEAD] %s: %s\n", ent->client->pers.netname, chatText );
|
// G_LogPrintf( "[DEAD] %s: %s\n", ent->client->pers.netname, chatText );
|
||||||
} else {
|
} else {
|
||||||
Com_sprintf (name, sizeof(name), "%s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
Com_sprintf (name, sizeof(name), "%s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
||||||
G_LogPrintf( "%s: %s\n", ent->client->pers.netname, chatText );
|
// G_LogPrintf( "%s: %s\n", ent->client->pers.netname, chatText );
|
||||||
}
|
}
|
||||||
color = COLOR_GREEN;
|
color = COLOR_GREEN;
|
||||||
break;
|
break;
|
||||||
|
@ -1185,7 +1188,7 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
|
||||||
Com_sprintf (name, sizeof(name), EC"[DEAD] (%s%c%c"EC")"EC": ",
|
Com_sprintf (name, sizeof(name), EC"[DEAD] (%s%c%c"EC")"EC": ",
|
||||||
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
||||||
}
|
}
|
||||||
G_LogPrintf( "[DEAD] (%s): %s\n", ent->client->pers.netname, chatText );
|
// G_LogPrintf( "[DEAD] (%s): %s\n", ent->client->pers.netname, chatText );
|
||||||
} else {
|
} else {
|
||||||
if (Team_GetLocationMsg(ent, location, sizeof(location)))
|
if (Team_GetLocationMsg(ent, location, sizeof(location)))
|
||||||
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC") (%s)"EC": ",
|
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC") (%s)"EC": ",
|
||||||
|
@ -1193,7 +1196,7 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
|
||||||
else
|
else
|
||||||
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC")"EC": ",
|
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC")"EC": ",
|
||||||
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
|
||||||
G_LogPrintf( "(%s): %s\n", ent->client->pers.netname, chatText );
|
// G_LogPrintf( "(%s): %s\n", ent->client->pers.netname, chatText );
|
||||||
}
|
}
|
||||||
color = COLOR_CYAN;
|
color = COLOR_CYAN;
|
||||||
break;
|
break;
|
||||||
|
@ -1212,6 +1215,11 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JBravo: Parsing % vars here
|
||||||
|
if (ent->client->sess.sessionTeam != TEAM_SPECTATOR) {
|
||||||
|
ParseSayText (ent, (char *)chatText);
|
||||||
|
}
|
||||||
|
|
||||||
Q_strncpyz( text, chatText, sizeof(text) );
|
Q_strncpyz( text, chatText, sizeof(text) );
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
|
@ -1432,7 +1440,9 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// insult someone who just killed you
|
// insult someone who just killed you
|
||||||
if (ent->enemy && ent->enemy->client && ent->enemy->client->lastkilled_client == ent->s.number) {
|
// if (ent->enemy && ent->enemy->client && ent->enemy->client->lastkilled_client == ent->s.number) {
|
||||||
|
// JBravo: adding the multiple killed system.
|
||||||
|
if (ent->enemy && ent->enemy->client && ent->enemy->client->lastkilled_client[0] == ent) {
|
||||||
// i am a dead corpse
|
// i am a dead corpse
|
||||||
if (!(ent->enemy->r.svFlags & SVF_BOT)) {
|
if (!(ent->enemy->r.svFlags & SVF_BOT)) {
|
||||||
G_Voice( ent, ent->enemy, SAY_TELL, VOICECHAT_DEATHINSULT, qfalse );
|
G_Voice( ent, ent->enemy, SAY_TELL, VOICECHAT_DEATHINSULT, qfalse );
|
||||||
|
@ -1444,8 +1454,11 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// insult someone you just killed
|
// insult someone you just killed
|
||||||
if (ent->client->lastkilled_client >= 0 && ent->client->lastkilled_client != ent->s.number) {
|
// if (ent->client->lastkilled_client >= 0 && ent->client->lastkilled_client != ent->s.number) {
|
||||||
who = g_entities + ent->client->lastkilled_client;
|
// JBravo: adding the multiple killed system.
|
||||||
|
if (ent->client->lastkilled_client[0]->s.number >= 0 && ent->client->lastkilled_client[0]->s.number != ent->s.number) {
|
||||||
|
// who = g_entities + ent->client->lastkilled_client;
|
||||||
|
who = ent->client->lastkilled_client[0];
|
||||||
if (who->client) {
|
if (who->client) {
|
||||||
// who is the person I just killed
|
// who is the person I just killed
|
||||||
if (who->client->lasthurt_mod == MOD_GAUNTLET) {
|
if (who->client->lasthurt_mod == MOD_GAUNTLET) {
|
||||||
|
@ -1463,7 +1476,9 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
|
||||||
G_Voice( ent, ent, SAY_TELL, VOICECHAT_KILLINSULT, qfalse );
|
G_Voice( ent, ent, SAY_TELL, VOICECHAT_KILLINSULT, qfalse );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ent->client->lastkilled_client = -1;
|
// ent->client->lastkilled_client = -1;
|
||||||
|
// JBravo: adding the multiple killed system.
|
||||||
|
ent->client->lastkilled_client[0] = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.50 2002/03/14 23:54:12 jbravo
|
||||||
|
// Added a variable system from AQ. Works the same except it uses $ for %
|
||||||
|
//
|
||||||
// Revision 1.49 2002/03/12 04:55:31 blaze
|
// Revision 1.49 2002/03/12 04:55:31 blaze
|
||||||
// stats should only be recored when the round is in progress
|
// stats should only be recored when the round is in progress
|
||||||
//
|
//
|
||||||
|
@ -816,8 +819,10 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker && attacker->client) {
|
if (attacker && attacker->client) {
|
||||||
attacker->client->lastkilled_client = self->s.number;
|
// attacker->client->lastkilled_client = self->s.number;
|
||||||
|
// JBravo: Add multiple last killed system.
|
||||||
|
AddKilledPlayer(attacker, self);
|
||||||
|
ResetKills(self);
|
||||||
// JBravo: make it OK to frag teammates after rounds are over.
|
// JBravo: make it OK to frag teammates after rounds are over.
|
||||||
if (attacker == self || OnSameTeam (self, attacker)) {
|
if (attacker == self || OnSameTeam (self, attacker)) {
|
||||||
if (level.team_round_going) {
|
if (level.team_round_going) {
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.52 2002/03/14 23:54:12 jbravo
|
||||||
|
// Added a variable system from AQ. Works the same except it uses $ for %
|
||||||
|
//
|
||||||
// Revision 1.51 2002/03/14 02:24:39 jbravo
|
// Revision 1.51 2002/03/14 02:24:39 jbravo
|
||||||
// Adding radio :)
|
// Adding radio :)
|
||||||
//
|
//
|
||||||
|
@ -464,7 +467,9 @@ struct gclient_s {
|
||||||
int grenHits;
|
int grenHits;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int lastkilled_client; // last client that this client killed
|
// int lastkilled_client; // last client that this client killed
|
||||||
|
gentity_t *lastkilled_client[5]; // JBravo: last 5 clients that this client killed
|
||||||
|
int num_kills; // JBravo: Number of killed players in TP.
|
||||||
int lasthurt_client; // last client that damaged this client
|
int lasthurt_client; // last client that damaged this client
|
||||||
int lasthurt_mod; // type of damage the client did
|
int lasthurt_mod; // type of damage the client did
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.33 2002/03/14 23:54:12 jbravo
|
||||||
|
// Added a variable system from AQ. Works the same except it uses $ for %
|
||||||
|
//
|
||||||
// Revision 1.32 2002/03/14 02:24:39 jbravo
|
// Revision 1.32 2002/03/14 02:24:39 jbravo
|
||||||
// Adding radio :)
|
// Adding radio :)
|
||||||
//
|
//
|
||||||
|
@ -117,6 +120,7 @@
|
||||||
gitem_t *BG_FindItemForHoldable( holdable_t pw );
|
gitem_t *BG_FindItemForHoldable( holdable_t pw );
|
||||||
char *ConcatArgs( int start );
|
char *ConcatArgs( int start );
|
||||||
int touch[MAX_GENTITIES];
|
int touch[MAX_GENTITIES];
|
||||||
|
void ResetKills(gentity_t *ent);
|
||||||
|
|
||||||
void CheckTeamRules()
|
void CheckTeamRules()
|
||||||
{
|
{
|
||||||
|
@ -273,7 +277,6 @@ void ContinueLCA()
|
||||||
else if (level.lights_camera_action == 1) {
|
else if (level.lights_camera_action == 1) {
|
||||||
trap_SendServerCommand( -1, "action");
|
trap_SendServerCommand( -1, "action");
|
||||||
trap_Cvar_Set("RQ3_lca", "0");
|
trap_Cvar_Set("RQ3_lca", "0");
|
||||||
|
|
||||||
level.team_round_going = 1;
|
level.team_round_going = 1;
|
||||||
level.current_round_length = 0;
|
level.current_round_length = 0;
|
||||||
}
|
}
|
||||||
|
@ -940,7 +943,7 @@ void RQ3_Cmd_Radio_f(gentity_t *ent)
|
||||||
char msg[MAX_TOKEN_CHARS];
|
char msg[MAX_TOKEN_CHARS];
|
||||||
radio_msg_t *radio_msgs;
|
radio_msg_t *radio_msgs;
|
||||||
gentity_t *player;
|
gentity_t *player;
|
||||||
int i, x;
|
int i, x, kills;
|
||||||
|
|
||||||
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR)
|
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR)
|
||||||
return;
|
return;
|
||||||
|
@ -961,6 +964,20 @@ void RQ3_Cmd_Radio_f(gentity_t *ent)
|
||||||
|
|
||||||
while (Q_stricmp(radio_msgs[x].msg, "END")) {
|
while (Q_stricmp(radio_msgs[x].msg, "END")) {
|
||||||
if (!Q_stricmp(radio_msgs[x].msg, msg)) {
|
if (!Q_stricmp(radio_msgs[x].msg, msg)) {
|
||||||
|
if (!Q_stricmp(radio_msgs[x].msg, "enemyd")) {
|
||||||
|
kills = ReadKilledPlayers (ent);
|
||||||
|
ResetKills (ent);
|
||||||
|
if (kills >=1 && kills <10) {
|
||||||
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
|
player = &g_entities[i];
|
||||||
|
if (!player->inuse)
|
||||||
|
continue;
|
||||||
|
if (player->client->sess.savedTeam == ent->client->sess.savedTeam)
|
||||||
|
trap_SendServerCommand(player-g_entities, va("playradiosound %i %i\n\"",
|
||||||
|
kills, ent->client->radioGender));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (i = 0; i < level.maxclients; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
player = &g_entities[i];
|
player = &g_entities[i];
|
||||||
if (!player->inuse)
|
if (!player->inuse)
|
||||||
|
@ -974,3 +991,287 @@ void RQ3_Cmd_Radio_f(gentity_t *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *SeekBufEnd (char *buf)
|
||||||
|
{
|
||||||
|
while (*buf != 0)
|
||||||
|
buf++;
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetWeaponName (gentity_t * ent, char *buf)
|
||||||
|
{
|
||||||
|
if (ent->client->ps.weapon == WP_AKIMBO) {
|
||||||
|
strcpy (buf, RQ3_AKIMBO_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_PISTOL) {
|
||||||
|
strcpy (buf, RQ3_PISTOL_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_MP5) {
|
||||||
|
strcpy (buf, RQ3_MP5_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_M4) {
|
||||||
|
strcpy (buf, RQ3_M4_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_M3) {
|
||||||
|
strcpy (buf, RQ3_M3_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_HANDCANNON) {
|
||||||
|
strcpy (buf, RQ3_HANDCANNON_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_SSG3000) {
|
||||||
|
strcpy (buf, RQ3_SSG3000_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_KNIFE) {
|
||||||
|
strcpy (buf, RQ3_KNIFE_NAME);
|
||||||
|
return;
|
||||||
|
} else if (ent->client->ps.weapon == WP_GRENADE) {
|
||||||
|
strcpy (buf, RQ3_GRENADE_NAME);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
strcpy (buf, "No Weapon");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetItemName (gentity_t * ent, char *buf)
|
||||||
|
{
|
||||||
|
if (bg_itemlist[ent->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_KEVLAR) {
|
||||||
|
strcpy (buf, RQ3_KEVLAR_NAME);
|
||||||
|
return;
|
||||||
|
} else if (bg_itemlist[ent->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_SILENCER) {
|
||||||
|
strcpy (buf, RQ3_SILENCER_NAME);
|
||||||
|
return;
|
||||||
|
} else if (bg_itemlist[ent->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_SLIPPERS) {
|
||||||
|
strcpy (buf, RQ3_SLIPPERS_NAME);
|
||||||
|
return;
|
||||||
|
} else if (bg_itemlist[ent->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_BANDOLIER) {
|
||||||
|
strcpy (buf, RQ3_BANDOLIER_NAME);
|
||||||
|
return;
|
||||||
|
} else if (bg_itemlist[ent->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_LASER) {
|
||||||
|
strcpy (buf, RQ3_LASER_NAME);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
strcpy (buf, "No Item");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetAmmo (gentity_t * ent, char *buf)
|
||||||
|
{
|
||||||
|
int ammo;
|
||||||
|
char temp[1024];
|
||||||
|
|
||||||
|
switch (ent->client->ps.weapon) {
|
||||||
|
case WP_PISTOL:
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d rounds (%d extra clips)",
|
||||||
|
ent->client->ps.ammo[WP_PISTOL],
|
||||||
|
ent->client->numClips[WP_PISTOL]);
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_SSG3000:
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d rounds (%d extra rounds)",
|
||||||
|
ent->client->ps.ammo[WP_SSG3000],
|
||||||
|
ent->client->numClips[WP_SSG3000]);
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_MP5:
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%i rounds (%i extra clips)",
|
||||||
|
ent->client->ps.ammo[WP_MP5],
|
||||||
|
ent->client->numClips[WP_MP5]);
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_M4:
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d rounds (%d extra clips)",
|
||||||
|
ent->client->ps.ammo[WP_M4],
|
||||||
|
ent->client->numClips[WP_M4]);
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_M3:
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d rounds (%d extra shells)",
|
||||||
|
ent->client->ps.ammo[WP_M3],
|
||||||
|
ent->client->numClips[WP_M3]);
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_HANDCANNON:
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d rounds (%d extra shells)",
|
||||||
|
ent->client->ps.ammo[WP_HANDCANNON],
|
||||||
|
ent->client->numClips[WP_HANDCANNON]);
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_AKIMBO:
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d rounds (%d extra clips)",
|
||||||
|
ent->client->ps.ammo[WP_AKIMBO],
|
||||||
|
ent->client->numClips[WP_AKIMBO]);
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_KNIFE:
|
||||||
|
ammo = ent->client->ps.ammo[WP_KNIFE];
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d kni%s", ammo, (ammo == 1) ? "fe" : "ves");
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
case WP_GRENADE:
|
||||||
|
ammo = ent->client->ps.ammo[WP_GRENADE];
|
||||||
|
Com_sprintf (temp, sizeof(temp), "%d grenade%s", ammo, (ammo == 1) ? "" : "s");
|
||||||
|
strcpy (buf, temp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetKills (gentity_t * ent)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
ent->client->lastkilled_client[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ReadKilledPlayers (gentity_t * ent)
|
||||||
|
{
|
||||||
|
int results, i;
|
||||||
|
|
||||||
|
results = -1;
|
||||||
|
if (ent->client->lastkilled_client[0]) {
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
if (ent->client->lastkilled_client[i]) {
|
||||||
|
results++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
} else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddKilledPlayer (gentity_t * self, gentity_t * ent)
|
||||||
|
{
|
||||||
|
int kills;
|
||||||
|
|
||||||
|
kills = ReadKilledPlayers (self);
|
||||||
|
if (kills == 5 || kills == -1) {
|
||||||
|
self->client->lastkilled_client[0] = ent;
|
||||||
|
} else {
|
||||||
|
self->client->lastkilled_client[kills + 1] = ent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetLastKilledTarget (gentity_t * self, char * buf)
|
||||||
|
{
|
||||||
|
int kills, i;
|
||||||
|
|
||||||
|
kills = ReadKilledPlayers (self);
|
||||||
|
|
||||||
|
if (kills >= 0) {
|
||||||
|
strcpy (buf, self->client->lastkilled_client[0]->client->pers.netname);
|
||||||
|
if (kills > 0) {
|
||||||
|
for (i = 1; i < kills + 1; i++) {
|
||||||
|
if (i == kills) {
|
||||||
|
strcat (buf, " and ");
|
||||||
|
strcat (buf, self->client->lastkilled_client[i]->client->pers.netname);
|
||||||
|
} else {
|
||||||
|
strcat (buf, ", ");
|
||||||
|
strcat (buf, self->client->lastkilled_client[i]->client->pers.netname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ResetKills (self);
|
||||||
|
} else {
|
||||||
|
strcpy (buf, "nobody");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetLastDamagedPart (gentity_t * self, char * buf)
|
||||||
|
{
|
||||||
|
switch (self->client->lasthurt_location &
|
||||||
|
~(LOCATION_BACK | LOCATION_LEFT | LOCATION_RIGHT | LOCATION_FRONT)) {
|
||||||
|
case LOCATION_HEAD:
|
||||||
|
case LOCATION_FACE:
|
||||||
|
strcpy (buf, "head");
|
||||||
|
self->client->lasthurt_location = 0;
|
||||||
|
return;
|
||||||
|
case LOCATION_SHOULDER:
|
||||||
|
case LOCATION_CHEST:
|
||||||
|
strcpy (buf, "chest");
|
||||||
|
self->client->lasthurt_location = 0;
|
||||||
|
return;
|
||||||
|
case LOCATION_STOMACH:
|
||||||
|
case LOCATION_GROIN:
|
||||||
|
strcpy (buf, "stomach");
|
||||||
|
self->client->lasthurt_location = 0;
|
||||||
|
return;
|
||||||
|
case LOCATION_LEG:
|
||||||
|
case LOCATION_FOOT:
|
||||||
|
strcpy (buf, "legs");
|
||||||
|
self->client->lasthurt_location = 0;
|
||||||
|
return;
|
||||||
|
case LOCATION_NONE:
|
||||||
|
default:
|
||||||
|
strcpy (buf, "nothing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParseSayText (gentity_t * ent, char *text)
|
||||||
|
{
|
||||||
|
static char buf[1024], infobuf[1024];
|
||||||
|
char *p, *pbuf;
|
||||||
|
|
||||||
|
p = text;
|
||||||
|
pbuf = buf;
|
||||||
|
*pbuf = 0;
|
||||||
|
|
||||||
|
while (*p != 0) {
|
||||||
|
if ((pbuf - buf) > 225) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*p == '$') {
|
||||||
|
switch (*(p + 1)) {
|
||||||
|
case 'H':
|
||||||
|
Com_sprintf (infobuf, sizeof(infobuf), "%d", ent->health);
|
||||||
|
strcpy (pbuf, infobuf);
|
||||||
|
pbuf = SeekBufEnd (pbuf);
|
||||||
|
p += 2;
|
||||||
|
continue;
|
||||||
|
case 'A':
|
||||||
|
GetAmmo (ent, infobuf);
|
||||||
|
strcpy (pbuf, infobuf);
|
||||||
|
pbuf = SeekBufEnd (pbuf);
|
||||||
|
p += 2;
|
||||||
|
continue;
|
||||||
|
case 'W':
|
||||||
|
GetWeaponName (ent, infobuf);
|
||||||
|
strcpy (pbuf, infobuf);
|
||||||
|
pbuf = SeekBufEnd (pbuf);
|
||||||
|
p += 2;
|
||||||
|
continue;
|
||||||
|
case 'I':
|
||||||
|
GetItemName (ent, infobuf);
|
||||||
|
strcpy (pbuf, infobuf);
|
||||||
|
pbuf = SeekBufEnd (pbuf);
|
||||||
|
p += 2;
|
||||||
|
continue;
|
||||||
|
case 'K':
|
||||||
|
GetLastKilledTarget (ent, infobuf);
|
||||||
|
strcpy (pbuf, infobuf);
|
||||||
|
pbuf = SeekBufEnd (pbuf);
|
||||||
|
p += 2;
|
||||||
|
continue;
|
||||||
|
case 'D':
|
||||||
|
GetLastDamagedPart (ent, infobuf);
|
||||||
|
strcpy (pbuf, infobuf);
|
||||||
|
pbuf = SeekBufEnd (pbuf);
|
||||||
|
p += 2;
|
||||||
|
continue;
|
||||||
|
/* case 'P':
|
||||||
|
GetLastDamagedPlayers (ent, infobuf);
|
||||||
|
strcpy (pbuf, infobuf);
|
||||||
|
pbuf = SeekBufEnd (pbuf);
|
||||||
|
p += 2;
|
||||||
|
continue; */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*pbuf++ = *p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pbuf = 0;
|
||||||
|
|
||||||
|
strncpy (text, buf, 225);
|
||||||
|
text[225] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.6 2002/03/14 23:54:12 jbravo
|
||||||
|
// Added a variable system from AQ. Works the same except it uses $ for %
|
||||||
|
//
|
||||||
// Revision 1.5 2002/03/14 02:24:39 jbravo
|
// Revision 1.5 2002/03/14 02:24:39 jbravo
|
||||||
// Adding radio :)
|
// Adding radio :)
|
||||||
//
|
//
|
||||||
|
@ -50,3 +53,4 @@ qboolean OKtoFollow( int clientnum );
|
||||||
void RQ3_Cmd_Radio_f ( gentity_t *ent );
|
void RQ3_Cmd_Radio_f ( gentity_t *ent );
|
||||||
void RQ3_Cmd_Radio_power_f ( gentity_t *ent );
|
void RQ3_Cmd_Radio_power_f ( gentity_t *ent );
|
||||||
void RQ3_Cmd_Radiogender_f ( gentity_t *ent );
|
void RQ3_Cmd_Radiogender_f ( gentity_t *ent );
|
||||||
|
void ParseSayText (gentity_t * ent, char *text);
|
||||||
|
|
Loading…
Reference in a new issue