Fix the instant spectate on death and an attempt to fix the scores

This commit is contained in:
Richard Allen 2002-02-06 03:10:43 +00:00
parent e146dbb353
commit f3339180b6
6 changed files with 93 additions and 25 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.45 2002/02/06 03:10:43 jbravo
// Fix the instant spectate on death and an attempt to fix the scores
//
// Revision 1.44 2002/01/29 03:13:45 jbravo
// Further fixes to antistick
//
@ -26,6 +29,9 @@
//
#include "g_local.h"
// JBravo: need TP functions
#include "g_teamplay.h"
#ifdef __ZCAM__
#include "zcam.h"
#endif /* __ZCAM__ */
@ -473,6 +479,19 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) {
Cmd_FollowCycle_f( ent, 1 );
}
/* if (client->ps.pm_flags & PMF_JUMP_HELD) {
G_Printf("upmove is true!\n");
if (client->sess.spectatorState == SPECTATOR_FREE) {
client->sess.spectatorState = SPECTATOR_FOLLOW;
client->ps.pm_flags |= PMF_FOLLOW;
G_Printf("Setting specmode to follow!\n");
} else {
client->sess.spectatorState = SPECTATOR_FREE;
client->ps.pm_flags &= ~PMF_FOLLOW;
G_Printf("Setting specmode to free!\n");
}
} */
#ifdef __ZCAM__
if ( client->sess.spectatorState == SPECTATOR_CAMERA_FLIC &&
client->sess.spectatorState == SPECTATOR_CAMERA_SWING )
@ -1393,21 +1412,29 @@ void ClientThink_real( gentity_t *ent ) {
client->latched_buttons |= client->buttons & ~client->oldbuttons;
// check for respawning
// JBravo: we dont want to respawn players untill next round if teamplay.
if ( client->ps.stats[STAT_HEALTH] <= 0 && g_gametype.integer != GT_TEAMPLAY ) {
// JBravo: Lets make dead players into spectators.
if (client->ps.stats[STAT_HEALTH] <= 0) {
// wait for the attack button to be pressed
if ( level.time > client->respawnTime ) {
if (level.time > client->respawnTime) {
// forcerespawn is to prevent users from waiting out powerups
if ( g_forcerespawn.integer > 0 &&
( level.time - client->respawnTime ) > g_forcerespawn.integer * 1000 ) {
respawn( ent );
if (g_forcerespawn.integer > 0 &&
(level.time - client->respawnTime ) > g_forcerespawn.integer * 1000) {
if (g_gametype.integer == GT_TEAMPLAY) {
MakeSpectator(ent);
} else {
respawn( ent );
}
return;
}
// pressing attack or use is the normal respawn method
// JBravo: unless we are in Teamplay mode.
if ( (ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE)) && g_gametype.integer != GT_TEAMPLAY ) {
respawn( ent );
// JBravo: make'em spactate
if (ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE)) {
if (g_gametype.integer == GT_TEAMPLAY) {
MakeSpectator(ent);
} else {
respawn( ent );
}
}
}
return;
@ -1472,6 +1499,7 @@ SpectatorClientEndFrame
*/
void SpectatorClientEndFrame( gentity_t *ent ) {
gclient_t *cl;
int savedPing, savedScore;
// if we are doing a chase cam or a remote view, grab the latest info
if ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) {
@ -1489,7 +1517,13 @@ void SpectatorClientEndFrame( gentity_t *ent ) {
cl = &level.clients[ clientNum ];
if ( cl->pers.connected == CON_CONNECTED && cl->sess.sessionTeam != TEAM_SPECTATOR ) {
flags = (cl->ps.eFlags & ~(EF_VOTED | EF_TEAMVOTED)) | (ent->client->ps.eFlags & (EF_VOTED | EF_TEAMVOTED));
// JBravo: saving score and ping to fix the scoreboard
savedPing = ent->client->ps.ping;
savedScore = ent->client->ps.persistant[PERS_SCORE];
ent->client->ps = cl->ps;
ent->client->ps.ping = savedPing;
// ent->client->ps.persistant[PERS_SCORE] = savedScore;
// ent->client->ps.persistant[PERS_SCORE] = ent->client->savedpersistant[PERS_SCORE];
ent->client->ps.pm_flags |= PMF_FOLLOW;
ent->client->ps.eFlags = flags;
return;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.33 2002/02/06 03:10:43 jbravo
// Fix the instant spectate on death and an attempt to fix the scores
//
// Revision 1.32 2002/02/05 23:41:27 slicer
// More on matchmode..
//
@ -1181,7 +1184,6 @@ void ClientBegin( int clientNum ) {
if (!client->teamplayWeapon) client->teamplayWeapon = WP_MP5;
if (!client->teamplayItem) client->teamplayItem = HI_KEVLAR;
}
}
/*
@ -1200,7 +1202,7 @@ void ClientSpawn(gentity_t *ent) {
int i;
clientPersistant_t saved;
clientSession_t savedSess;
int persistant[MAX_PERSISTANT];
int persistant[MAX_PERSISTANT], savedpers[MAX_PERSISTANT];
gentity_t *spawnPoint;
int flags;
int savedPing;
@ -1308,18 +1310,17 @@ void ClientSpawn(gentity_t *ent) {
for ( i = 0 ; i < MAX_PERSISTANT ; i++ ) {
persistant[i] = client->ps.persistant[i];
savedpers[i] = client->savedpersistant[i];
}
eventSequence = client->ps.eventSequence;
// JBravo: save weapon/item info
savedWeapon = client->teamplayWeapon;
savedItem = client->teamplayItem;
// savedSolid = client->IsSolid;
memset (client, 0, sizeof(*client)); // bk FIXME: Com_Memset?
// JBravo: restore weapon/item info
// client->IsSolid = savedSolid;
client->teamplayWeapon = savedWeapon;
client->teamplayItem = savedItem;
@ -1333,6 +1334,7 @@ void ClientSpawn(gentity_t *ent) {
for ( i = 0 ; i < MAX_PERSISTANT ; i++ ) {
client->ps.persistant[i] = persistant[i];
client->savedpersistant[i] = savedpers[i];
}
client->ps.eventSequence = eventSequence;
// increment the spawncount so the client will detect the respawn

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.39 2002/02/06 03:10:43 jbravo
// Fix the instant spectate on death and an attempt to fix the scores
//
// Revision 1.38 2002/02/05 10:45:31 jbravo
// Cleaning up player_die and possibly fixing the scores
//
@ -603,6 +606,13 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
CheckAlmostScored( self, attacker );
}
// JBravo: save client->ps so spectating wont zap it.
if (g_gametype.integer == GT_TEAMPLAY) {
for (i = 0 ; i < MAX_PERSISTANT ; i++) {
self->client->savedpersistant[i] = self->client->ps.persistant[i];
}
}
#ifdef MISSIONPACK
if ((self->client->ps.eFlags & EF_TICKING) && self->activator) {
self->client->ps.eFlags &= ~EF_TICKING;
@ -923,7 +933,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// don't allow respawn until the death anim is done
// g_forcerespawn may force spawning at some later time
// JBravo: we dont want automatic respawning of players in teamplay
if (g_gametype.integer != GT_TEAMPLAY) {
if (g_gametype.integer == GT_TEAMPLAY) {
self->client->respawnTime = level.time + 400;
} else {
self->client->respawnTime = level.time + 1700;
}
@ -980,16 +992,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
}
trap_LinkEntity (self);
// JBravo: Save the dead players team status, and respawn his as a spectator.
if (g_gametype.integer == GT_TEAMPLAY) {
CopyToBodyQue (self);
self->client->weaponCount[self->client->ps.weapon] = 0;
self->client->ps.stats[STAT_WEAPONS] = 0;
self->client->sess.savedTeam = self->client->sess.sessionTeam;
self->client->sess.sessionTeam = TEAM_SPECTATOR;
ClientSpawn(self);
}
}
/*

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.44 2002/02/06 03:10:43 jbravo
// Fix the instant spectate on death and an attempt to fix the scores
//
// Revision 1.43 2002/02/05 23:41:27 slicer
// More on matchmode..
//
@ -519,6 +522,7 @@ struct gclient_s {
// JBravo adding TP stuff
int teamplayWeapon;
int teamplayItem;
int savedpersistant[MAX_PERSISTANT];
};

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.12 2002/02/06 03:10:43 jbravo
// Fix the instant spectate on death and an attempt to fix the scores
//
// Revision 1.11 2002/02/05 23:41:27 slicer
// More on matchmode..
//
@ -462,7 +465,7 @@ void SpawnPlayers()
{
gentity_t *player;
gclient_t *client;
int clientNum, i;
int clientNum, i, x;
level.spawnPointsLocated = qfalse;
for (i = 0; i < level.maxclients; i++) {
@ -477,6 +480,11 @@ void SpawnPlayers()
client = player->client;
clientNum = client - level.clients;
// for (x = 0 ; x < MAX_PERSISTANT ; x++) {
// client->ps.persistant[x] = client->savedpersistant[x];
// }
client->sess.teamSpawn = qtrue;
if (client->sess.savedTeam == TEAM_RED) {
client->sess.sessionTeam = TEAM_RED;
@ -662,3 +670,17 @@ void UnstickPlayer( gentity_t *ent )
ent->client->ps.stats[STAT_RQ3] |= RQ3_PLAYERSOLID;
}
}
void MakeSpectator( gentity_t *ent )
{
gclient_t *client;
client = ent->client;
CopyToBodyQue (ent);
client->weaponCount[ent->client->ps.weapon] = 0;
client->ps.stats[STAT_WEAPONS] = 0;
client->sess.savedTeam = client->sess.sessionTeam;
client->sess.sessionTeam = TEAM_SPECTATOR;
ClientSpawn(ent);
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.3 2002/02/06 03:10:43 jbravo
// Fix the instant spectate on death and an attempt to fix the scores
//
// Revision 1.2 2002/01/27 13:33:28 jbravo
// Teamplay antistick system.
//
@ -35,3 +38,4 @@ void EquipPlayer (gentity_t *ent);
void RQ3_Cmd_Choose_f(gentity_t *ent);
void RQ3_Cmd_Drop_f( gentity_t *ent );
void UnstickPlayer( gentity_t *ent );
void MakeSpectator( gentity_t *ent );