Added CTB respawn queue and fixed game <-> cgame synch problem in CTB

This commit is contained in:
Richard Allen 2002-08-21 07:00:07 +00:00
parent a6ebc0613b
commit b8c486753e
12 changed files with 199 additions and 27 deletions

View file

@ -37,7 +37,9 @@
* Hitboxes now 100% AQ style
* Removed cockingsounds from all weapons except the mk23, m4 and mp5
* Fixed the bot_minplayer system.
* Added spawnflag 8 to breakables to allow them to be unkickable
* Created a CTB respawn Queue.
* Added propper handling of players waiting for a respawn in CTB
# List fixes here for the 2.1 release
@ -111,4 +113,3 @@
* Shell ejections on spawn in TP should be fixed
* Added pirate and pikey radio sets. cg_RQ3_radiovoice 0, 1, 2 or 3
* Added CTB radio commands to all radio sets.
* Added spawnflag 8 to breakables to allow them to be unkickable

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.62 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.61 2002/08/07 04:46:20 niceass
// ctb changes
//
@ -639,7 +642,7 @@ static float CG_DrawScore(float y)
y += 4;
if (cgs.gametype == GT_TEAMPLAY)
if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF)
team = cg.snap->ps.persistant[PERS_SAVEDTEAM];
else
team = cg.snap->ps.persistant[PERS_TEAM];
@ -1929,7 +1932,7 @@ static void CG_DrawSpectator(void)
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f);
if (cgs.gametype == GT_TEAMPLAY) {
if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF) {
CG_TeamColor(cg.snap->ps.persistant[PERS_SAVEDTEAM], Color);
Color[0] *= 0.7f;
Color[1] *= 0.7f;
@ -1942,7 +1945,11 @@ static void CG_DrawSpectator(void)
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 1.0f);
CG_DrawCleanLine(0, 420, 640, 1, Color);
CG_DrawBigString(320 - 10 * 8, 425, "Spectating", 1.0F);
if (cgs.gametype == GT_CTF && (cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_RED ||
cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_BLUE))
CG_DrawBigString(320 - 26 * 8, 425, "Waiting for a Team Respawn", 1.0F);
else
CG_DrawBigString(320 - 10 * 8, 425, "Spectating", 1.0F);
if (cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_RED || cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_BLUE)
return;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.61 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.60 2002/08/07 03:35:57 jbravo
// Added dynamic radio and stopped all radio usage during lca
//
@ -1174,6 +1177,11 @@ void RemoveColorEscapeSequences(char *text)
text[l] = '\0';
}
void CG_CtbCountDown(int delay)
{
// NiceAss, do your magic here :)
}
/*
=================
CG_RQ3_Cmd by sLiCeR
@ -1332,6 +1340,10 @@ void CG_RQ3_Cmd()
case CVARSET:
CG_CvarSet();
break;
case CTBCOUNTDOWN:
i = atoi(CG_Argv(1));
CG_CtbCountDown(i);
break;
default:
break;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.93 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.92 2002/08/21 03:43:57 niceass
// allow clipvelocity outside of the bg_'s
//
@ -362,7 +365,8 @@ enum {
STOPDEMO,
SCREENSHOT,
OWNED,
CVARSET
CVARSET,
CTBCOUNTDOWN
};
//Elder: sound events for EV_RQ3_SOUND

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.87 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.86 2002/07/24 02:17:38 jbravo
// Added a respawn delay for CTB
//
@ -494,7 +497,11 @@ void SpectatorThink(gentity_t * ent, usercmd_t * ucmd)
}
if (client->sess.spectatorState == SPECTATOR_FREE) {
client->ps.pm_type = PM_SPECTATOR;
if (g_gametype.integer == GT_CTF && client->sess.spectatorState == SPECTATOR_FREE &&
(client->sess.savedTeam == TEAM_RED || client->sess.savedTeam == TEAM_BLUE))
client->ps.pm_type = PM_FREEZE;
else
client->ps.pm_type = PM_SPECTATOR;
client->ps.speed = 400; // faster than normal
// set up for pmove
@ -536,6 +543,10 @@ void SpectatorThink(gentity_t * ent, usercmd_t * ucmd)
client->oldbuttons = client->buttons;
client->buttons = ucmd->buttons;
if (g_gametype.integer == GT_CTF && client->sess.spectatorState == SPECTATOR_FREE &&
(client->sess.savedTeam == TEAM_RED || client->sess.savedTeam == TEAM_BLUE))
return;
// Attack Button cycles throught free view, follow or zcam
if ((ucmd->buttons & BUTTON_ATTACK) && !(client->oldbuttons & BUTTON_ATTACK)) {
if (g_gametype.integer == GT_TEAMPLAY && g_RQ3_limchasecam.integer != 0) {
@ -1189,16 +1200,16 @@ void ClientThink_real(gentity_t * ent)
respawn(ent);
return;
}
if (g_gametype.integer == GT_TEAMPLAY && level.time > client->respawnTime) {
if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) && level.time > client->respawnTime) {
MakeSpectator(ent);
}
if (g_gametype.integer == GT_CTF) {
/* if (g_gametype.integer == GT_CTF) {
if (level.time > client->time_of_death + (g_RQ3_ctb_respawndelay.integer * 1000)) {
respawn(ent);
} else {
return;
}
}
} */
// pressing attack or use is the normal respawn method
// JBravo: make'em spactate
if (ucmd->buttons & (BUTTON_ATTACK | BUTTON_USE_HOLDABLE)) {
@ -1320,7 +1331,7 @@ void SpectatorClientEndFrame(gentity_t * ent)
//This will make the spectator get the client's stuff
ent->client->ps = cl->ps;
//Reposting score and ping..
if (g_gametype.integer == GT_TEAMPLAY) {
if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) {
for (i = 0; i < MAX_PERSISTANT; i++)
ent->client->ps.persistant[i] = savedPers[i];

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.111 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.110 2002/08/07 03:35:57 jbravo
// Added dynamic radio and stopped all radio usage during lca
//
@ -1512,7 +1515,7 @@ void ClientBegin(int clientNum)
//}
//Slicer: Saving persistant and ping
if (g_gametype.integer == GT_TEAMPLAY) {
if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) {
savedPing = client->ps.ping;
for (i = 0; i < MAX_PERSISTANT; i++)
savedPers[i] = client->ps.persistant[i];
@ -1532,7 +1535,7 @@ void ClientBegin(int clientNum)
client->ps.eFlags = flags;
//Slicer: Repost score and ping
if (g_gametype.integer == GT_TEAMPLAY) {
if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) {
client->ps.ping = savedPing;
for (i = 0; i < MAX_PERSISTANT; i++)
client->ps.persistant[i] = savedPers[i];
@ -1647,6 +1650,7 @@ void ClientSpawn(gentity_t * ent)
int savedMaleSet, savedFemaleSet; // JBravo: for soundset saves.
camera_t savedCamera; // JBravo: to save camera stuff
char userinfo[MAX_INFO_STRING];
char *classname;
//Slicer : Laser FIX
@ -1661,8 +1665,26 @@ void ClientSpawn(gentity_t * ent)
// do it before setting health back up, so farthest
// ranging doesn't count this client
if (client->sess.sessionTeam == TEAM_SPECTATOR) {
if (g_gametype.integer == GT_CTF && (client->sess.savedTeam == TEAM_RED || client->sess.savedTeam == TEAM_BLUE)) {
spawnPoint = NULL;
if (client->sess.savedTeam == TEAM_RED)
classname = "team_CTF_redflag";
else if (client->sess.savedTeam == TEAM_BLUE)
classname = "team_CTF_blueflag";
else
G_Printf("Wtf ? What team are U on boy ?\n");
while ((spawnPoint = G_Find(spawnPoint, FOFS(classname), classname)) != NULL) {
if (!(spawnPoint->flags & FL_DROPPED_ITEM))
break;
}
if (spawnPoint) {
VectorCopy(spawnPoint->r.currentOrigin, spawn_origin);
VectorCopy(spawnPoint->s.angles, spawn_angles);
spawn_origin[2] += 30;
}
} else if (VectorLength(ent->client->ps.origin) == 0.0f) {
// Origin is not set yet? Use a spawn point
if (VectorLength(ent->client->ps.origin) == 0.0f) {
spawnPoint = SelectSpectatorSpawnPoint(spawn_origin, spawn_angles);
} // Have a set origin already? Use it. (where you died or changed to spectator)
else {
@ -1951,6 +1973,11 @@ void ClientSpawn(gentity_t * ent)
ClientEndFrame(ent);
ent->client->noHead = qfalse;
// JBravo: lock the player down
if (g_gametype.integer == GT_CTF && ent->client->sess.sessionTeam == TEAM_SPECTATOR &&
(ent->client->sess.savedTeam == TEAM_RED || ent->client->sess.savedTeam == TEAM_BLUE))
ent->client->ps.pm_type = PM_FREEZE;
// clear entity state values
BG_PlayerStateToEntityState(&client->ps, &ent->s, qtrue);
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.160 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.159 2002/08/17 01:56:31 jbravo
// % vars now only work in say_team mode.
//
@ -1142,6 +1145,12 @@ void SetTeam(gentity_t * ent, char *s)
client->radioGender = level.team2gender;
} else {
if (g_gametype.integer == GT_CTF) {
CheckForUnevenTeams(ent);
CalculateRanks();
ResetKills(ent);
client->last_damaged_players[0] = '\0';
}
ClientUserinfoChanged(clientNum);
ClientBegin(clientNum);
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.116 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.115 2002/08/21 03:36:04 niceass
// move of some vector functions outside of just game
//
@ -686,6 +689,8 @@ struct gclient_s {
int ff_warning;
int team_kills;
int idletime;
int savedPSweapon;
int savedSTAT;
qboolean gibbed;
//Slicer Flood protect:
@ -818,6 +823,9 @@ typedef struct {
vec3_t team2spawn_angles;
int fps;
int lights_delay;
// JBravo: for CTB
int team1respawn;
int team2respawn;
//Slicer:
int team1gender;
int team2gender;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.108 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.107 2002/08/13 16:59:16 makro
// Fixed per-client callvote limit; added a new cvar - g_RQ3_maxClientVotes
//
@ -552,7 +555,7 @@ static cvarTable_t gameCvarTable[] = {
{&g_RQ3_twbanrounds, "g_RQ3_twbanrounds", "2", CVAR_ARCHIVE, 0, qtrue},
{&g_RQ3_tkbanrounds, "g_RQ3_tkbanrounds", "2", CVAR_ARCHIVE, 0, qtrue},
{&g_RQ3_ppl_idletime, "g_RQ3_ppl_idletime", "0", CVAR_ARCHIVE, 0, qtrue},
{&g_RQ3_ctb_respawndelay, "g_RQ3_ctb_respawndelay", "5", CVAR_ARCHIVE, 0, qtrue},
{&g_RQ3_ctb_respawndelay, "g_RQ3_ctb_respawndelay", "20", CVAR_ARCHIVE, 0, qtrue},
{&g_RQ3_idleaction, "g_RQ3_idleaction", "0", CVAR_ARCHIVE, 0, qtrue},
//Blaze: let cvar.cfg be set by the server admins
{&g_RQ3_cvarfile, "g_RQ3_cvarfile", "cvar.cfg", CVAR_ARCHIVE, 0, qtrue},
@ -1060,6 +1063,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart)
level.fps = trap_Cvar_VariableIntegerValue("sv_fps");
level.num_potential_spawns[0] = 0;
level.num_potential_spawns[1] = 0;
level.team1respawn = level.team2respawn = 0;
}
// Slicer: reset matchmode vars
if (g_RQ3_matchmode.integer && g_gametype.integer == GT_TEAMPLAY) {
@ -2558,6 +2562,18 @@ void G_RunFrame(int levelTime)
// for tracking changes
CheckCvars();
// JBravo: check for CTB respawns
if (g_gametype.integer == GT_CTF) {
if (level.team1respawn && level.time > level.team1respawn) {
RQ3_Respawn_CTB_players(TEAM_RED);
level.team1respawn = 0;
}
if (level.team2respawn && level.time > level.team2respawn) {
RQ3_Respawn_CTB_players(TEAM_BLUE);
level.team2respawn = 0;
}
}
if (g_listEntity.integer) {
for (i = 0; i < MAX_GENTITIES; i++) {
G_Printf("%4i: %s\n", i, g_entities[i].classname);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.19 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.18 2002/07/20 05:06:01 niceass
// scoreboard remembering your team in CTB but lying is fixed
//
@ -187,6 +190,10 @@ void G_InitSessionData(gclient_t * client, char *userinfo)
if (g_gametype.integer == GT_TEAMPLAY) {
sess->savedTeam = PickTeam(-1);
client->ps.persistant[PERS_SAVEDTEAM] = sess->savedTeam;
} else if (g_gametype.integer == GT_CTF) {
sess->savedTeam = PickTeam(-1);
client->ps.persistant[PERS_SAVEDTEAM] = sess->savedTeam;
sess->sessionTeam = sess->savedTeam;
} else
sess->sessionTeam = PickTeam(-1);
BroadcastTeamChange(client, -1);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.129 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.128 2002/08/07 16:13:33 jbravo
// Case carrier glowing removed. Ignorenum bug fixed
//
@ -1255,6 +1258,43 @@ void UnstickPlayer(gentity_t * ent)
}
}
void RQ3_StartTimer (int team, int delay)
{
int i;
gentity_t *ent;
for (i = 0; i < level.maxclients; i++) {
ent = &g_entities[i];
if (!ent->inuse || !ent->client)
continue;
if (!ent->client->pers.connected != CON_CONNECTED)
continue;
if (ent->client->sess.savedTeam == team)
trap_SendServerCommand(ent - g_entities, va("rq3_cmd %i %i", CTBCOUNTDOWN, delay));
}
}
void RQ3_Respawn_CTB_players(int team)
{
int i;
gentity_t *ent;
for (i = 0; i < level.maxclients; i++) {
ent = &g_entities[i];
if (!ent->inuse || !ent->client)
continue;
if (ent->client->sess.savedTeam == team && ent->client->sess.spectatorState == SPECTATOR_FREE) {
ent->client->weaponCount[ent->client->ps.weapon] = ent->client->savedPSweapon;
ent->client->ps.stats[STAT_WEAPONS] = ent->client->savedSTAT;
ent->client->sess.sessionTeam = team;
ent->client->ps.persistant[PERS_TEAM] = team;
ent->client->sess.spectatorState = SPECTATOR_NOT;
ent->client->specMode = SPECTATOR_NOT;
respawn(ent);
}
}
}
void MakeSpectator(gentity_t * ent)
{
gclient_t *client;
@ -1265,23 +1305,49 @@ void MakeSpectator(gentity_t * ent)
if (!client->gibbed || ent->s.eType != ET_INVISIBLE)
CopyToBodyQue(ent);
for (i = 0; i < level.maxclients; i++) {
follower = &g_entities[i];
if (!follower->inuse || !follower->client)
continue;
if (follower->client->pers.connected != CON_CONNECTED)
continue;
if (follower->client->sess.sessionTeam != TEAM_SPECTATOR)
continue;
if (follower->client->sess.spectatorClient == ent->s.number &&
follower->client->sess.spectatorState == SPECTATOR_FOLLOW)
Cmd_FollowCycle_f(follower, 1);
if (g_gametype.integer == GT_TEAMPLAY) {
for (i = 0; i < level.maxclients; i++) {
follower = &g_entities[i];
if (!follower->inuse || !follower->client)
continue;
if (follower->client->pers.connected != CON_CONNECTED)
continue;
if (follower->client->sess.sessionTeam != TEAM_SPECTATOR)
continue;
if (follower->client->sess.spectatorClient == ent->s.number &&
follower->client->sess.spectatorState == SPECTATOR_FOLLOW)
Cmd_FollowCycle_f(follower, 1);
}
}
if (g_gametype.integer == GT_CTF) {
client->savedPSweapon = client->weaponCount[ent->client->ps.weapon];
client->savedSTAT = client->ps.stats[STAT_WEAPONS];
}
client->weaponCount[ent->client->ps.weapon] = 0;
client->ps.stats[STAT_WEAPONS] = 0;
client->sess.sessionTeam = TEAM_SPECTATOR;
client->ps.persistant[PERS_TEAM] = TEAM_SPECTATOR;
if (g_gametype.integer == GT_CTF) {
client->sess.spectatorState = SPECTATOR_FREE;
client->specMode = SPECTATOR_FREE;
client->ps.pm_flags &= ~PMF_FOLLOW;
client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM;
client->ps.pm_type = PM_FREEZE;
if (client->sess.savedTeam == TEAM_RED) {
if (level.team1respawn == 0) {
level.team1respawn = level.time + (g_RQ3_ctb_respawndelay.integer * 1000);
RQ3_StartTimer(TEAM_RED, g_RQ3_ctb_respawndelay.integer);
}
} else if (client->sess.savedTeam == TEAM_BLUE) {
if (level.team2respawn == 0) {
level.team2respawn = level.time + (g_RQ3_ctb_respawndelay.integer * 1000);
RQ3_StartTimer(TEAM_BLUE, g_RQ3_ctb_respawndelay.integer);
}
}
ClientSpawn(ent);
return;
}
if (ent->r.svFlags & SVF_BOT)
client->sess.spectatorState = SPECTATOR_FREE;
else if (g_RQ3_limchasecam.integer != 0) {

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.21 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
// Revision 1.20 2002/06/22 00:19:57 jbravo
// Cleanups for colors and stopped bots looking for team leaders in TP
//
@ -124,3 +127,4 @@ int IsInIgnoreList(gentity_t * source, gentity_t * subject);
void RQ3_GetSpawnPoints (void);
void ResetKills(gentity_t * ent);
void AddKilledPlayer(gentity_t * self, gentity_t * ent);
void RQ3_Respawn_CTB_players(int team);