Cleaning up player_die and possibly fixing the scores

This commit is contained in:
Richard Allen 2002-02-05 10:45:31 +00:00
parent 166f379675
commit 4ed445fd36

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.38 2002/02/05 10:45:31 jbravo
// Cleaning up player_die and possibly fixing the scores
//
// Revision 1.37 2002/01/31 01:53:30 jbravo
// FF/no-FF fixes. g_friendlyFire 0 = no FF, 1 = FF, 2 = no FF + knockback
//
@ -560,10 +563,7 @@ player_die
void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) {
gentity_t *ent;
gentity_t *DMReward;
int anim;
int contents;
int killer;
int i;
int anim, contents, killer, i;
char *killerName, *obit;
//Blaze: Stop bleeding when dead
@ -575,7 +575,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
FireWeapon(self);
}
// Hawkins put spread back and zoom out
//Elder: remove zoom bits
Cmd_Unzoom(self);
self->client->bleeding = 0;
@ -604,9 +603,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
CheckAlmostScored( self, attacker );
}
//Blaze: No Hook
// if (self->client && self->client->hook)
// Weapon_HookFree(self->client->hook);
#ifdef MISSIONPACK
if ((self->client->ps.eFlags & EF_TICKING) && self->activator) {
self->client->ps.eFlags &= ~EF_TICKING;
@ -748,15 +744,17 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
attacker->client->pers.records[REC_KICKKILLS]++;
self->client->pers.records[REC_KICKDEATHS]++;
break;
// JBravo: adding a default here to catch potential bugs
default:
G_Printf("Unknown Means of Death!\n");
break;
}
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;
self->client->ps.persistant[PERS_KILLED]++;
if (attacker && attacker->client) {
@ -767,74 +765,68 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
} else {
// Increase number of kills this life for attacker
// JBravo: unless we are in teamplay
if ( g_gametype.integer != GT_TEAMPLAY ) {
if (g_gametype.integer == GT_TEAMPLAY) {
attacker->client->killStreak = 0;
AddScore(attacker, self->r.currentOrigin, 1);
} else {
attacker->client->killStreak++;
}
// DM reward scoring, should add an if statement to get around this when
// we add teamplay.
// Done ;)
// JBravo: Done ;)
if (g_gametype.integer != GT_TEAMPLAY) {
if (attacker->client->killStreak < 4)
AddScore(attacker, self->r.currentOrigin, 1);
else if (attacker->client->killStreak < 8)
{ AddScore( attacker, self->r.currentOrigin, 2 );
else if (attacker->client->killStreak < 8) {
AddScore(attacker, self->r.currentOrigin, 2);
DMReward = G_TempEntity(self->r.currentOrigin, EV_DMREWARD);
DMReward->s.otherEntityNum2 = killer;
DMReward->s.eventParm = attacker->client->killStreak;
DMReward->r.svFlags = SVF_BROADCAST;
}
else if (attacker->client->killStreak < 16)
{ AddScore( attacker, self->r.currentOrigin, 4 );
else if (attacker->client->killStreak < 16) {
AddScore(attacker, self->r.currentOrigin, 4);
DMReward = G_TempEntity(self->r.currentOrigin, EV_DMREWARD);
DMReward->s.otherEntityNum2 = killer;
DMReward->s.eventParm = attacker->client->killStreak;
DMReward->r.svFlags = SVF_BROADCAST;
}
else if (attacker->client->killStreak < 32)
{ AddScore( attacker, self->r.currentOrigin, 8 );
else if (attacker->client->killStreak < 32) {
AddScore(attacker, self->r.currentOrigin, 8);
DMReward = G_TempEntity(self->r.currentOrigin, EV_DMREWARD);
DMReward->s.otherEntityNum2 = killer;
DMReward->s.eventParm = attacker->client->killStreak;
DMReward->r.svFlags = SVF_BROADCAST;
}
else
{ AddScore( attacker, self->r.currentOrigin, 16 );
{
AddScore(attacker, self->r.currentOrigin, 16);
DMReward = G_TempEntity(self->r.currentOrigin, EV_DMREWARD);
DMReward->s.otherEntityNum2 = killer;
DMReward->s.eventParm = attacker->client->killStreak;
DMReward->r.svFlags = SVF_BROADCAST;
}
//if( meansOfDeath == MOD_GAUNTLET ) {
}
//Elder: changed to knife slash heh
if(meansOfDeath == MOD_KNIFE) {
// play humiliation on player
//Blaze: Removed because it uses the persistant stats stuff
//attacker->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++;
// add the sprite over the player's head
attacker->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );
attacker->client->ps.eFlags |= EF_AWARD_GAUNTLET;
attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
// also play humiliation on target
self->client->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_GAUNTLETREWARD;
}
// check for two kills in a short amount of time
// if this is close enough to the last kill, give a reward sound
if ( level.time - attacker->client->lastKillTime < CARNAGE_REWARD_TIME ) {
// play excellent on player
//Blaze: Removed because it uses the persistant stats stuff
//attacker->client->ps.persistant[PERS_EXCELLENT_COUNT]++;
// add the sprite over the player's head
attacker->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );
attacker->client->ps.eFlags |= EF_AWARD_EXCELLENT;
attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
}
attacker->client->lastKillTime = level.time;
}
} else {
AddScore( self, self->r.currentOrigin, -1 );
@ -871,8 +863,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
contents = trap_PointContents( self->r.currentOrigin, -1 );
if ( !(contents & CONTENTS_NODROP)) {
TossClientItems(self);
}
else {
} else {
if (g_gametype.integer != GT_TEAMPLAY) {
if ( self->client->ps.powerups[PW_NEUTRALFLAG] ) { // only happens in One Flag CTF
Team_ReturnFlag( TEAM_FREE );
@ -884,12 +875,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
Team_ReturnFlag(TEAM_BLUE);
}
}
// Elder: include immediate item and weapon return here -- but handled in G_RunItem?
//if ( self->client->ps.stats[STAT_HOLDABLE_ITEM] )
//{
//RQ3_ResetItem(bg_itemlist[self->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag);
//self->client->ps.stats[STAT_HOLDABLE_ITEM] = 0;
//}
}
#ifdef MISSIONPACK
TossClientPersistantPowerups( self );
@ -917,30 +902,22 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
}
self->takedamage = qtrue; // can still be gibbed
self->s.weapon = WP_NONE;
self->s.powerups = 0;
// Elder: HC smoke
//G_Printf("player_die: damage_knockback: %i\n", self->client->damage_knockback);
if (meansOfDeath == MOD_HANDCANNON && self->client->damage_knockback > RQ3_HANDCANNON_KICK * 4) //self->client->ps.stats[STAT_HEALTH] < -50)
{
//G_Printf("Smoked\n");
if (meansOfDeath == MOD_HANDCANNON && self->client->damage_knockback > RQ3_HANDCANNON_KICK * 4) {
self->client->ps.eFlags |= EF_HANDCANNON_SMOKED;
}
self->r.contents = CONTENTS_CORPSE;
self->s.angles[0] = 0;
self->s.angles[2] = 0;
LookAtKiller (self, inflictor, attacker);
LookAtKiller (self, inflictor, attacker);
VectorCopy(self->s.angles, self->client->ps.viewangles);
self->s.loopSound = 0;
self->r.maxs[2] = -8;
// don't allow respawn until the death anim is done
@ -986,10 +963,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
((self->client->ps.torsoAnim & ANIM_TOGGLEBIT) ^ ANIM_TOGGLEBIT) | anim;
// Elder: only do death sounds if not hit in the head
//G_Printf("Shot Diff: %i\n", level.time - self->client->headShotTime);
//if ((self->client->lasthurt_location & LOCATION_HEAD) != LOCATION_HEAD &&
//(self->client->lasthurt_location & LOCATION_FACE) != LOCATION_FACE &&
if (level.time - self->client->headShotTime > 400)
G_AddEvent( self, EV_DEATH1 + i, killer );
@ -1017,10 +990,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
self->client->sess.sessionTeam = TEAM_SPECTATOR;
ClientSpawn(self);
}
}
/*
================
CheckArmor