diff --git a/reaction/cgame/cg_event.c b/reaction/cgame/cg_event.c index e981c229..2fe86892 100644 --- a/reaction/cgame/cg_event.c +++ b/reaction/cgame/cg_event.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // 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 - CG_Printf( "%s died.\n", targetName ); + CG_Printf( "%s died and the mod is %i. Tell this to JB\n", targetName, mod ); } diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index 0b76fc58..2d4976e3 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // Adding radio :) // @@ -1430,7 +1433,8 @@ void ClientSpawn(gentity_t *ent) { // client->areabits = savedAreaBits; client->accuracy_hits = accuracy_hits; 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++ ) { client->ps.persistant[i] = persistant[i]; diff --git a/reaction/game/g_cmds.c b/reaction/game/g_cmds.c index 57e005f5..d828c1fa 100644 --- a/reaction/game/g_cmds.c +++ b/reaction/game/g_cmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // Adding radio :) // @@ -1169,10 +1172,10 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) case SAY_ALL: 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 ); - G_LogPrintf( "[DEAD] %s: %s\n", ent->client->pers.netname, chatText ); +// G_LogPrintf( "[DEAD] %s: %s\n", ent->client->pers.netname, chatText ); } else { 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; 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": ", 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 { if (Team_GetLocationMsg(ent, location, sizeof(location))) 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 Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC")"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_CYAN; break; @@ -1212,6 +1215,11 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) break; } +// JBravo: Parsing % vars here + if (ent->client->sess.sessionTeam != TEAM_SPECTATOR) { + ParseSayText (ent, (char *)chatText); + } + Q_strncpyz( text, chatText, sizeof(text) ); if (target) { @@ -1432,7 +1440,9 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) { } // 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 if (!(ent->enemy->r.svFlags & SVF_BOT)) { G_Voice( ent, ent->enemy, SAY_TELL, VOICECHAT_DEATHINSULT, qfalse ); @@ -1444,8 +1454,11 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) { return; } // insult someone you just killed - if (ent->client->lastkilled_client >= 0 && ent->client->lastkilled_client != ent->s.number) { - who = g_entities + ent->client->lastkilled_client; +// if (ent->client->lastkilled_client >= 0 && ent->client->lastkilled_client != ent->s.number) { +// 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) { // who is the person I just killed 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 ); } } - ent->client->lastkilled_client = -1; +// ent->client->lastkilled_client = -1; +// JBravo: adding the multiple killed system. + ent->client->lastkilled_client[0] = NULL; return; } } diff --git a/reaction/game/g_combat.c b/reaction/game/g_combat.c index cc92d2b8..1360fc2c 100644 --- a/reaction/game/g_combat.c +++ b/reaction/game/g_combat.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // 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) { - 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. if (attacker == self || OnSameTeam (self, attacker)) { if (level.team_round_going) { diff --git a/reaction/game/g_local.h b/reaction/game/g_local.h index 1c1260b4..d2713a44 100644 --- a/reaction/game/g_local.h +++ b/reaction/game/g_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // Adding radio :) // @@ -464,7 +467,9 @@ struct gclient_s { 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_mod; // type of damage the client did diff --git a/reaction/game/g_teamplay.c b/reaction/game/g_teamplay.c index ef7d5f04..b1efc95e 100644 --- a/reaction/game/g_teamplay.c +++ b/reaction/game/g_teamplay.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // Adding radio :) // @@ -117,6 +120,7 @@ gitem_t *BG_FindItemForHoldable( holdable_t pw ); char *ConcatArgs( int start ); int touch[MAX_GENTITIES]; +void ResetKills(gentity_t *ent); void CheckTeamRules() { @@ -273,7 +277,6 @@ void ContinueLCA() else if (level.lights_camera_action == 1) { trap_SendServerCommand( -1, "action"); trap_Cvar_Set("RQ3_lca", "0"); - level.team_round_going = 1; level.current_round_length = 0; } @@ -940,7 +943,7 @@ void RQ3_Cmd_Radio_f(gentity_t *ent) char msg[MAX_TOKEN_CHARS]; radio_msg_t *radio_msgs; gentity_t *player; - int i, x; + int i, x, kills; if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) return; @@ -961,6 +964,20 @@ void RQ3_Cmd_Radio_f(gentity_t *ent) while (Q_stricmp(radio_msgs[x].msg, "END")) { 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++) { player = &g_entities[i]; 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; +} + diff --git a/reaction/game/g_teamplay.h b/reaction/game/g_teamplay.h index a615e260..dbca0f5b 100644 --- a/reaction/game/g_teamplay.h +++ b/reaction/game/g_teamplay.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $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 // Adding radio :) // @@ -50,3 +53,4 @@ qboolean OKtoFollow( int clientnum ); void RQ3_Cmd_Radio_f ( gentity_t *ent ); void RQ3_Cmd_Radio_power_f ( gentity_t *ent ); void RQ3_Cmd_Radiogender_f ( gentity_t *ent ); +void ParseSayText (gentity_t * ent, char *text);