Live players dont get fraglines, except their own. Cleanups and some

hacks to get bots to stop using knives only.
This commit is contained in:
Richard Allen 2002-03-18 12:25:10 +00:00
parent 9441a6f1a0
commit 47112a4cca
5 changed files with 138 additions and 145 deletions

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.43 2002/03/18 12:25:10 jbravo
// Live players dont get fraglines, except their own. Cleanups and some
// hacks to get bots to stop using knives only.
//
// Revision 1.42 2002/03/17 01:44:39 jbravo
// Fixed the "xxx died" fraglines, did some code cleanups andalmost fixed
// DM. Only DM problem I can see is that bots are invisible.
@ -107,15 +111,12 @@ CG_Obituary
=============
*/
static void CG_Obituary( entityState_t *ent ) {
int mod;
int n; //Elder: for random messages
int target, attacker;
char *message;
char *message2;
int mod, target, attacker;
int n; //Elder: for random messages
char *message, *message2;
const char *targetInfo;
const char *attackerInfo;
char targetName[32];
char attackerName[32];
char targetName[32], attackerName[32];
gender_t gender;
clientInfo_t *ci;
@ -123,12 +124,12 @@ static void CG_Obituary( entityState_t *ent ) {
attacker = ent->otherEntityNum2;
mod = ent->eventParm;
if ( target < 0 || target >= MAX_CLIENTS ) {
CG_Error( "CG_Obituary: target out of range" );
if (target < 0 || target >= MAX_CLIENTS) {
CG_Error("CG_Obituary: target out of range");
}
ci = &cgs.clientinfo[target];
if ( attacker < 0 || attacker >= MAX_CLIENTS ) {
if (attacker < 0 || attacker >= MAX_CLIENTS) {
attacker = ENTITYNUM_WORLD;
attackerInfo = NULL;
} else {
@ -202,15 +203,6 @@ static void CG_Obituary( entityState_t *ent ) {
else
message = "didn't throw his grenade far enough";
break;
/*
if ( gender == GENDER_FEMALE )
message = "tripped on her own grenade";
else if ( gender == GENDER_NEUTER )
message = "tripped on its own grenade";
else
message = "tripped on his own grenade";
break;
*/
case MOD_ROCKET_SPLASH:
if ( gender == GENDER_FEMALE )
message = "blew herself up";
@ -253,9 +245,9 @@ static void CG_Obituary( entityState_t *ent ) {
}
//Blaze: This allows for the falling damage message to pass through if someone attacked them
if (!(attacker == ENTITYNUM_WORLD || attacker ==target)) message = NULL;
if (!(attacker == ENTITYNUM_WORLD || attacker == target)) message = NULL;
if (message) {
CG_Printf( "%s %s.\n", targetName, message);
CG_Printf("%s %s.\n", targetName, message);
return;
}
@ -370,7 +362,7 @@ static void CG_Obituary( entityState_t *ent ) {
break;
case MOD_PISTOL:
message = "was shot by";
message2 = "'s Mark 23 Pistol";
message2 = "'s Mark 23 Pistol";
break;
case MOD_M4:
message = "was shot by";
@ -386,26 +378,20 @@ static void CG_Obituary( entityState_t *ent ) {
break;
case MOD_M3:
n = rand() % 2 + 1;
if (n == 1)
{
if (n == 1) {
message = "accepts";
message2 = "'s M3 Super 90 Assault Shotgun in hole-y matrimony";
}
else
{
} else {
message = "is full of buckshot from";
message2 = "'s M3 Super 90 Assault Shotgun";
}
break;
case MOD_HANDCANNON:
n = rand() % 2 + 1;
if (n == 1)
{
if (n == 1) {
message = "ate";
message2 = "'s sawed-off 12 gauge";
}
else
{
} else {
message = "is full of buckshot from";
message2 = "'s sawed off shotgun";
}
@ -415,17 +401,14 @@ static void CG_Obituary( entityState_t *ent ) {
break;
case MOD_KICK:
n = rand() % 3 + 1;
if (n == 1)
{
if (n == 1) {
if (gender == GENDER_NEUTER)
message = "got its ass kicked by";
message = "got its ass kicked by";
else if (gender == GENDER_FEMALE)
message = "got her ass kicked by";
else
message = "got his ass kicked by";
}
else if (n == 2)
{
} else if (n == 2) {
message = "couldn't remove";
if (gender == GENDER_NEUTER)
message2 = "'s boot from its ass";
@ -433,9 +416,7 @@ static void CG_Obituary( entityState_t *ent ) {
message2 = "'s boot from her ass";
else
message2 = "'s boot from his ass";
}
else
{
} else {
if (gender == GENDER_NEUTER)
message = "had a Bruce Lee put on it by";
else if (gender == GENDER_FEMALE)
@ -462,9 +443,12 @@ static void CG_Obituary( entityState_t *ent ) {
break;
}
// JBravo: live players dont get fraglines.
if (message) {
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
if (target != attacker && (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ||
cg.snap->ps.clientNum == attacker))
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
return;
}
}
@ -482,14 +466,10 @@ CG_Obituary_Head
=============
*/
static void CG_Obituary_Head( entityState_t *ent ) {
int mod;
int target, attacker;
char *message;
char *message2;
const char *targetInfo;
const char *attackerInfo;
char targetName[32];
char attackerName[32];
int mod, target, attacker;
char *message, *message2;
const char *targetInfo, *attackerInfo;
char targetName[32], attackerName[32];
gender_t gender;
clientInfo_t *ci;
@ -497,30 +477,30 @@ static void CG_Obituary_Head( entityState_t *ent ) {
attacker = ent->otherEntityNum2;
mod = ent->eventParm;
if ( target < 0 || target >= MAX_CLIENTS ) {
CG_Error( "CG_Obituary: target out of range" );
if (target < 0 || target >= MAX_CLIENTS) {
CG_Error("CG_Obituary: target out of range");
}
ci = &cgs.clientinfo[target];
if ( attacker < 0 || attacker >= MAX_CLIENTS ) {
if (attacker < 0 || attacker >= MAX_CLIENTS) {
attacker = ENTITYNUM_WORLD;
attackerInfo = NULL;
} else {
attackerInfo = CG_ConfigString( CS_PLAYERS + attacker );
attackerInfo = CG_ConfigString(CS_PLAYERS + attacker);
}
targetInfo = CG_ConfigString( CS_PLAYERS + target );
if ( !targetInfo ) {
targetInfo = CG_ConfigString(CS_PLAYERS + target);
if (!targetInfo) {
return;
}
Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof(targetName) - 2);
strcat( targetName, S_COLOR_WHITE );
Q_strncpyz(targetName, Info_ValueForKey(targetInfo, "n"), sizeof(targetName) - 2);
strcat(targetName, S_COLOR_WHITE);
message2 = "";
// check for single client messages
switch( mod ) {
switch(mod) {
case MOD_SUICIDE:
message = "suicides";
break;
@ -564,17 +544,17 @@ static void CG_Obituary_Head( entityState_t *ent ) {
}
}
if (!(attacker == ENTITYNUM_WORLD || attacker ==target)) message = NULL;
if (!(attacker == ENTITYNUM_WORLD || attacker == target)) message = NULL;
if (message) {
CG_Printf( "%s %s.\n", targetName, message);
return;
}
// check for kill messages from the current clientNum
if ( attacker == cg.snap->ps.clientNum ) {
if (attacker == cg.snap->ps.clientNum) {
char *s;
if ( cgs.gametype < GT_TEAM ) {
if (cgs.gametype < GT_TEAM) {
s = va("You fragged %s\n%s place with %i", targetName,
CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ),
cg.snap->ps.persistant[PERS_SCORE] );
@ -587,7 +567,6 @@ static void CG_Obituary_Head( entityState_t *ent ) {
CG_CenterPrint( s, SCREEN_HEIGHT * 0.25, (BIGCHAR_WIDTH+SMALLCHAR_WIDTH)*.5 );
}
// check for double client messages
if ( !attackerInfo ) {
attacker = ENTITYNUM_WORLD;
@ -601,7 +580,7 @@ static void CG_Obituary_Head( entityState_t *ent ) {
}
}
if ( attacker != ENTITYNUM_WORLD ) {
if (attacker != ENTITYNUM_WORLD) {
switch (mod) {
case MOD_PISTOL:
if (gender == GENDER_FEMALE)
@ -625,17 +604,14 @@ static void CG_Obituary_Head( entityState_t *ent ) {
message2 = "'s akimbo Mark 23 pistols";
break;
case MOD_SNIPER:
if (cg.refdef.fov_x < 90)
{
if (cg.refdef.fov_x < 90) {
if (gender == GENDER_NEUTER)
message = "saw the sniper bullet go through its scope thanks to";
else if (gender == GENDER_FEMALE)
message = "saw the sniper bullet go through her scope thanks to";
else
message = "saw the sniper bullet go through his scope thanks to";
}
else
{
} else {
message = "caught a sniper bullet between the eyes from";
}
break;
@ -675,9 +651,12 @@ static void CG_Obituary_Head( entityState_t *ent ) {
break;
}
// JBravo: live players dont get fraglines.
if (message) {
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
if (target != attacker && (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ||
cg.snap->ps.clientNum == attacker))
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
return;
}
}
@ -696,14 +675,10 @@ CG_Obituary_Chest
=============
*/
static void CG_Obituary_Chest( entityState_t *ent ) {
int mod;
int target, attacker;
char *message;
char *message2;
const char *targetInfo;
const char *attackerInfo;
char targetName[32];
char attackerName[32];
int mod, target, attacker;
char *message, *message2;
const char *targetInfo, *attackerInfo;
char targetName[32], attackerName[32];
gender_t gender;
clientInfo_t *ci;
@ -859,9 +834,12 @@ static void CG_Obituary_Chest( entityState_t *ent ) {
break;
}
// JBravo: live players dont get fraglines.
if (message) {
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
if (target != attacker && (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ||
cg.snap->ps.clientNum == attacker))
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
return;
}
}
@ -879,14 +857,10 @@ CG_Obituary_Stomach
=============
*/
static void CG_Obituary_Stomach( entityState_t *ent ) {
int mod;
int target, attacker;
char *message;
char *message2;
const char *targetInfo;
const char *attackerInfo;
char targetName[32];
char attackerName[32];
int mod, target, attacker;
char *message, *message2;
const char *targetInfo, *attackerInfo;
char targetName[32], attackerName[32];
gender_t gender;
clientInfo_t *ci;
@ -1052,9 +1026,12 @@ static void CG_Obituary_Stomach( entityState_t *ent ) {
break;
}
// JBravo: live players dont get fraglines.
if (message) {
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
if (target != attacker && (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ||
cg.snap->ps.clientNum == attacker))
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
return;
}
}
@ -1245,9 +1222,12 @@ static void CG_Obituary_Legs( entityState_t *ent ) {
break;
}
// JBravo: live players dont get fraglines.
if (message) {
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
if (target != attacker && (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ||
cg.snap->ps.clientNum == attacker))
CG_Printf( "%s %s %s%s\n",
targetName, message, attackerName, message2);
return;
}
}

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.8 2002/03/18 12:25:10 jbravo
// Live players dont get fraglines, except their own. Cleanups and some
// hacks to get bots to stop using knives only.
//
// Revision 1.7 2002/01/11 20:20:58 jbravo
// Adding TP to main branch
//
@ -1577,7 +1581,9 @@ void BotChooseWeapon(bot_state_t *bs) {
else {
newweaponnum = trap_BotChooseBestFightWeapon(bs->ws, bs->inventory);
if (bs->weaponnum != newweaponnum) bs->weaponchange_time = FloatTime();
bs->weaponnum = newweaponnum;
// JBravo: test hack
// bs->weaponnum = newweaponnum;
bs->weaponnum = WP_PISTOL;
//BotAI_Print(PRT_MESSAGE, "bs->weaponnum = %d\n", bs->weaponnum);
trap_EA_SelectWeapon(bs->client, bs->weaponnum);
}
@ -1629,7 +1635,8 @@ void BotCheckItemPickup(bot_state_t *bs, int *oldinventory) {
#ifdef MISSIONPACK
int offence, leader;
if (gametype <= GT_TEAM)
// if (gametype <= GT_TEAM)
if (gametype <= GT_TEAMPLAY)
return;
offence = -1;

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.6 2002/03/18 12:25:10 jbravo
// Live players dont get fraglines, except their own. Cleanups and some
// hacks to get bots to stop using knives only.
//
// Revision 1.5 2002/01/11 19:48:29 jbravo
// Formatted the source in non DOS format.
//
@ -1978,6 +1982,8 @@ void BotTeamAI(bot_state_t *bs) {
//give orders
switch(gametype) {
case GT_TEAM:
// JBravo
case GT_TEAMPLAY:
{
if (bs->numteammates != numteammates || bs->forceorders) {
bs->teamgiveorders_time = FloatTime();

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.52 2002/03/18 12:25:10 jbravo
// Live players dont get fraglines, except their own. Cleanups and some
// hacks to get bots to stop using knives only.
//
// Revision 1.51 2002/03/17 03:35:29 jbravo
// More radio tewaks and cleanups.
//
@ -694,60 +698,49 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// broadcast the death event to everyone
// Elder: use appropriate obit event and update statistics tracking
if ((self->client->lasthurt_location & LOCATION_HEAD) == LOCATION_HEAD ||
(self->client->lasthurt_location & LOCATION_FACE) == LOCATION_FACE)
{
(self->client->lasthurt_location & LOCATION_FACE) == LOCATION_FACE) {
// head kill
if (level.team_round_going)
{
if (level.team_round_going) {
self->client->pers.records[REC_HEADDEATHS]++;
if (attacker && attacker->client) attacker->client->pers.records[REC_HEADKILLS]++;
}
}
ent = G_TempEntity(self->r.currentOrigin, EV_OBITUARY_HEAD);
}
else if ((self->client->lasthurt_location & LOCATION_CHEST) == LOCATION_CHEST ||
(self->client->lasthurt_location & LOCATION_SHOULDER) == LOCATION_SHOULDER)
{
(self->client->lasthurt_location & LOCATION_SHOULDER) == LOCATION_SHOULDER) {
// chest kill
if (level.team_round_going)
{
if (level.team_round_going) {
self->client->pers.records[REC_CHESTDEATHS]++;
if (attacker && attacker->client) attacker->client->pers.records[REC_CHESTKILLS]++;
}
}
ent = G_TempEntity(self->r.currentOrigin, EV_OBITUARY_CHEST);
}
else if ((self->client->lasthurt_location & LOCATION_STOMACH) == LOCATION_STOMACH ||
(self->client->lasthurt_location & LOCATION_GROIN) == LOCATION_GROIN)
{
(self->client->lasthurt_location & LOCATION_GROIN) == LOCATION_GROIN) {
// stomach kill
if (level.team_round_going)
{
self->client->pers.records[REC_STOMACHDEATHS]++;
if (level.team_round_going) {
self->client->pers.records[REC_STOMACHDEATHS]++;
if (attacker && attacker->client) attacker->client->pers.records[REC_STOMACHKILLS]++;
}
}
ent = G_TempEntity(self->r.currentOrigin, EV_OBITUARY_STOMACH);
}
else if ((self->client->lasthurt_location & LOCATION_LEG) == LOCATION_LEG ||
(self->client->lasthurt_location & LOCATION_FOOT) == LOCATION_FOOT)
{
(self->client->lasthurt_location & LOCATION_FOOT) == LOCATION_FOOT) {
// leg kill
if (level.team_round_going)
{
self->client->pers.records[REC_LEGDEATHS]++;
if (level.team_round_going) {
self->client->pers.records[REC_LEGDEATHS]++;
if (attacker && attacker->client) attacker->client->pers.records[REC_LEGKILLS]++;
}
}
ent = G_TempEntity(self->r.currentOrigin, EV_OBITUARY_LEGS);
}
else
{
} else {
// non-location/world kill
ent = G_TempEntity(self->r.currentOrigin, EV_OBITUARY);
}
// Elder: Statistics tracking
//Blaze: make sure the game is in progress before recording stats
if (level.team_round_going) {
switch (meansOfDeath)
{
//Blaze: make sure the game is in progress before recording stats
if (level.team_round_going) {
switch (meansOfDeath) {
case MOD_KNIFE:
if (attacker && attacker->client)
attacker->client->pers.records[REC_KNIFESLASHKILLS]++;
@ -807,22 +800,20 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// JBravo: adding a default here to catch potential bugs
default:
break;
}//SWITCH
}//IF
}
}
ent->s.eventParm = meansOfDeath;
ent->s.otherEntityNum = self->s.number;
ent->s.otherEntityNum2 = killer;
ent->r.svFlags = SVF_BROADCAST; // send to everyone
self->enemy = attacker;
if (level.team_round_going)
{
self->client->ps.persistant[PERS_KILLED]++;
//Blaze: Give the attacker 1 kill
attacker->client->pers.records[REC_KILLS]++;
}
if (level.team_round_going) {
self->client->ps.persistant[PERS_KILLED]++;
//Blaze: Give the attacker 1 kill
attacker->client->pers.records[REC_KILLS]++;
}
if (attacker && attacker->client) {
// attacker->client->lastkilled_client = self->s.number;
// JBravo: Add multiple last killed system.
AddKilledPlayer(attacker, self);
ResetKills(self);
@ -830,10 +821,10 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
if (attacker == self || OnSameTeam (self, attacker)) {
if (level.team_round_going) {
AddScore(attacker, self->r.currentOrigin, -1);
//If the kill was a TK, remove 1 from REC_KILLS to negate the one given earlyier
attacker->client->pers.records[REC_KILLS]--;
//Also, increment the TK's record
attacker->client->pers.records[REC_TEAMKILLS]++;
//If the kill was a TK, remove 1 from REC_KILLS to negate the one given earlyier
attacker->client->pers.records[REC_KILLS]--;
//Also, increment the TK's record
attacker->client->pers.records[REC_TEAMKILLS]++;
}
} else {
// Increase number of kills this life for attacker
@ -915,12 +906,11 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// Unless we are in teamplay
if (meansOfDeath == MOD_SUICIDE) {
// Elder: Statistics tracking
if (level.team_round_going)
{
self->client->pers.records[REC_SUICIDES]++;
self->client->pers.records[REC_KILLS]--;
}
AddScore(self, self->r.currentOrigin, -1);
if (level.team_round_going) {
self->client->pers.records[REC_SUICIDES]++;
self->client->pers.records[REC_KILLS]--;
}
AddScore(self, self->r.currentOrigin, -1);
if (g_gametype.integer != GT_TEAMPLAY) {
if ( self->client->ps.powerups[PW_NEUTRALFLAG] ) { // only happens in One Flag CTF
Team_ReturnFlag( TEAM_FREE );
@ -983,7 +973,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// JBravo: make clients that are following this one stop following.
if (client->sess.spectatorClient == self->s.number) {
if (g_gametype.integer == GT_TEAMPLAY) {
StopFollowing(follower);
// StopFollowing(follower);
Cmd_FollowCycle_f(follower, 1);
} else {
Cmd_Score_f(g_entities + i);
}

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.38 2002/03/18 12:25:10 jbravo
// Live players dont get fraglines, except their own. Cleanups and some
// hacks to get bots to stop using knives only.
//
// Revision 1.37 2002/03/17 16:38:57 jbravo
// Colored nicks fucked up the string in $K messages.
//
@ -780,6 +784,11 @@ void EquipPlayer (gentity_t *ent)
ent->client->ps.generic1 = ((ent->client->ps.generic1 & ANIM_TOGGLEBIT) ^
ANIM_TOGGLEBIT) | WP_ANIM_ACTIVATE;
}
if (ent->r.svFlags & SVF_BOT) {
ent->client->ps.stats[STAT_WEAPONS] = ( 1 << WP_PISTOL );
ent->client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_KNIFE );
ent->client->uniqueWeapons = 0;
}
ent->client->ps.weaponstate = WEAPON_RAISING;
ent->client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItemForHoldable( ent->client->teamplayItem ) - bg_itemlist;