Lots of spectator code updates. Removed debugshit, added some color.

This commit is contained in:
Richard Allen 2002-03-30 02:29:43 +00:00
parent 1efd1b0d94
commit ae001e4294
9 changed files with 139 additions and 124 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.37 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.36 2002/03/24 22:51:30 niceass
// scoreboard toggle changes
//
@ -957,6 +960,4 @@ void CG_InitConsoleCommands( void ) {
trap_AddCommand ("reflogin");
trap_AddCommand ("ref");
trap_AddCommand ("refresign");
// JBravo: debugging cmd
trap_AddCommand ("debugshit");
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.32 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.31 2002/03/24 22:50:52 niceass
// misc. 2d screen stuff changed
//
@ -2556,23 +2559,22 @@ static qboolean CG_DrawFollow( void ) {
color[2] = 1;
color[3] = 1;
CG_DrawBigString( 320 - 9 * 8, 24, "following", 1.0F );
// JBravo: if gametype >= team, append teamname to his name.
if ( cgs.gametype >= GT_TEAM ) {
team = cgs.clientinfo[ cg.snap->ps.clientNum ].team;
if (team == TEAM_RED) {
Com_sprintf (combinedName, sizeof(combinedName), "%s/%s",
cgs.clientinfo[cg.snap->ps.clientNum].name,
cg_RQ3_team1name.string);
Com_sprintf (combinedName, sizeof(combinedName), "%sFollowing%s %s%s/%s%s", S_COLOR_RED,
S_COLOR_WHITE, cgs.clientinfo[cg.snap->ps.clientNum].name, S_COLOR_RED,
S_COLOR_MAGENTA, cg_RQ3_team2name.string);
} else {
Com_sprintf (combinedName, sizeof(combinedName), "%s/%s",
cgs.clientinfo[cg.snap->ps.clientNum].name,
cg_RQ3_team2name.string);
Com_sprintf (combinedName, sizeof(combinedName), "%sFollowing%s %s%s/%s%s", S_COLOR_RED,
S_COLOR_WHITE, cgs.clientinfo[cg.snap->ps.clientNum].name, S_COLOR_RED,
S_COLOR_MAGENTA, cg_RQ3_team2name.string);
}
x = 0.5 * ( 640 - GIANT_WIDTH -16 * CG_DrawStrlen( combinedName ) );
CG_DrawStringExt( x, 40, combinedName, color, qtrue, qtrue, GIANT_WIDTH - 16, GIANT_HEIGHT - 16, 0 );
x = 0.5 * ( 640 - BIGCHAR_WIDTH * CG_DrawStrlen(combinedName));
CG_DrawStringExt( x, 372, combinedName, color, qfalse, qtrue, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, 0 );
} else {
CG_DrawBigString( 320 - 9 * 8, 24, "following", 1.0F );
name = cgs.clientinfo[ cg.snap->ps.clientNum ].name;
x = 0.5 * ( 640 - GIANT_WIDTH * CG_DrawStrlen( combinedName ) );
CG_DrawStringExt( x, 40, name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.18 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.17 2002/03/23 05:17:42 jbravo
// Major cleanup of game -> cgame communication with LCA vars.
//
@ -448,13 +451,10 @@ void CG_PredictPlayerState( void ) {
// demo playback just copies the moves
if ( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW)
#ifdef __ZCAM__
/* camera jitter fix (client side) */
// || (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR)
|| ((cg.snap->ps.stats[STAT_RQ3] & RQ3_ZCAM) == RQ3_ZCAM)
#endif /* __ZCAM__ */
) {
// JBravo: Zcam fix
/* camera jitter fix (client side) */
if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) ||
((cg.snap->ps.stats[STAT_RQ3] & RQ3_ZCAM) == RQ3_ZCAM)) {
CG_InterpolatePlayerState( qfalse );
return;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.63 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.62 2002/03/26 11:32:04 jbravo
// Remember specstate between rounds.
//
@ -530,51 +533,12 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) {
client = ent->client;
clientNum = client - level.clients;
client->oldbuttons = client->buttons;
client->buttons = ucmd->buttons;
//Slicer - Changing this for aq2 way
// Jump button cycles throught spectators
if(client->sess.spectatorState == SPECTATOR_FOLLOW) {
if(ucmd->upmove >=10 ) {
if (!(client->ps.pm_flags & PMF_JUMP_HELD)) {
client->ps.pm_flags |= PMF_JUMP_HELD;
Cmd_FollowCycle_f( ent, 1 );
}
}
else
client->ps.pm_flags &= ~PMF_JUMP_HELD;
}
// Attack Button cycles throught free view or follow
if((ucmd->buttons & BUTTON_ATTACK) && !( client->oldbuttons & BUTTON_ATTACK )) {
if (client->sess.spectatorState == SPECTATOR_FREE && OKtoFollow(clientNum)) {
client->sess.spectatorState = SPECTATOR_FOLLOW;
client->specMode = SPECTATOR_FOLLOW;
client->ps.pm_flags |= PMF_FOLLOW;
Cmd_FollowCycle_f( ent, 1 );
} else {
StopFollowing(ent);
}
}
#ifdef __ZCAM__
// client->ps.commandTime = ucmd->serverTime;
// client->oldbuttons = client->buttons;
// client->buttons = ucmd->buttons;
if (client->sess.spectatorState == SPECTATOR_ZCAM) {
if (g_gametype.integer != GT_TEAMPLAY) {
camera_think(ent);
return;
} else {
if (level.team_game_going == 1) {
camera_think(ent);
return;
}
}
client->ps.commandTime = ucmd->serverTime;
camera_think(ent);
}
#endif
if ( client->sess.spectatorState != SPECTATOR_FOLLOW ) {
if (client->sess.spectatorState == SPECTATOR_FREE) {
client->ps.pm_type = PM_SPECTATOR;
client->ps.speed = 400; // faster than normal
@ -594,8 +558,52 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) {
G_TouchTriggers( ent );
trap_UnlinkEntity( ent );
}
}
//Slicer - Changing this for aq2 way
// Jump button cycles throught spectators
if(client->sess.spectatorState == SPECTATOR_FOLLOW || client->sess.spectatorState == SPECTATOR_ZCAM) {
if(ucmd->upmove >=10 ) {
if (!(client->ps.pm_flags & PMF_JUMP_HELD)) {
client->ps.pm_flags |= PMF_JUMP_HELD;
if (client->sess.spectatorState == SPECTATOR_ZCAM)
CameraSwingCycle(ent, 1);
else
Cmd_FollowCycle_f(ent, 1);
}
}
else
client->ps.pm_flags &= ~PMF_JUMP_HELD;
}
client->oldbuttons = client->buttons;
client->buttons = ucmd->buttons;
// Attack Button cycles throught free view, follow or zcam
if((ucmd->buttons & BUTTON_ATTACK) && !(client->oldbuttons & BUTTON_ATTACK)) {
if (client->sess.spectatorState == SPECTATOR_FREE) {
client->sess.spectatorState = SPECTATOR_ZCAM;
client->specMode = SPECTATOR_ZCAM;
client->ps.stats[STAT_RQ3] |= RQ3_ZCAM;
client->ps.pm_flags &= ~PMF_FOLLOW;
CameraSwingCycle(ent, 1);
RQ3_SpectatorMode(ent);
} else if (client->sess.spectatorState == SPECTATOR_ZCAM && OKtoFollow(clientNum)) {
client->sess.spectatorState = SPECTATOR_FOLLOW;
client->specMode = SPECTATOR_FOLLOW;
client->ps.pm_flags |= PMF_FOLLOW;
client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM;
Cmd_FollowCycle_f(ent, 1);
RQ3_SpectatorMode(ent);
} else {
client->sess.spectatorState = SPECTATOR_FREE;
client->specMode = SPECTATOR_FREE;
client->ps.pm_flags &= ~PMF_FOLLOW;
client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM;
StopFollowing(ent);
RQ3_SpectatorMode(ent);
}
}
}
/*
@ -1528,31 +1536,24 @@ void ClientThink( int clientNum ) {
// phone jack if they don't get any for a while
ent->client->lastCmdTime = level.time;
if ( !(ent->r.svFlags & SVF_BOT) && !g_synchronousClients.integer
#ifdef __ZCAM__
/* camera jitter fix (server side) */
// JBravo: Take SPECTATOR_ZCAM into account
&& (ent->client->sess.sessionTeam != TEAM_SPECTATOR ||
if ( !(ent->r.svFlags & SVF_BOT) && !g_synchronousClients.integer &&
(ent->client->sess.sessionTeam != TEAM_SPECTATOR ||
(ent->client->sess.sessionTeam == TEAM_SPECTATOR &&
ent->client->sess.spectatorState != SPECTATOR_ZCAM))
#endif /* __ZCAM__ */
) {
ClientThink_real( ent );
ent->client->sess.spectatorState != SPECTATOR_ZCAM))) {
ClientThink_real( ent );
}
}
void G_RunClient( gentity_t *ent ) {
if ( !(ent->r.svFlags & SVF_BOT) && !g_synchronousClients.integer
#ifdef __ZCAM__
/* camera jitter fix (server side) */
// JBravo: Take SPECTATOR_ZCAM into account
&& (ent->client->sess.sessionTeam != TEAM_SPECTATOR ||
if ( !(ent->r.svFlags & SVF_BOT) && !g_synchronousClients.integer &&
(ent->client->sess.sessionTeam != TEAM_SPECTATOR ||
(ent->client->sess.sessionTeam == TEAM_SPECTATOR &&
ent->client->sess.spectatorState != SPECTATOR_ZCAM))
#endif /* __ZCAM__ */
)
{
ent->client->sess.spectatorState != SPECTATOR_ZCAM))) {
return;
}
ent->client->pers.cmd.serverTime = level.time;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.55 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.54 2002/03/26 11:32:04 jbravo
// Remember specstate between rounds.
//
@ -1274,9 +1277,7 @@ void ClientBegin( int clientNum ) {
client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_MP5MODE;
client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_M4MODE;
client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_MK23MODE;
#ifdef __ZCAM__
client->camera->mode = CAMERA_MODE_SWING;
#endif
}
if (client->sess.sessionTeam != TEAM_SPECTATOR && g_gametype.integer != GT_TEAMPLAY) {
@ -1328,6 +1329,7 @@ void ClientSpawn(gentity_t *ent) {
int eventSequence;
int savedWeapon, savedItem, savedSpec; // JBravo: to save weapon/item info
int savedRadiopower, savedRadiogender; // JBravo: for radio.
camera_t savedCamera; // JBravo: to save camera stuff
char userinfo[MAX_INFO_STRING];
index = ent - g_entities;
@ -1360,11 +1362,6 @@ void ClientSpawn(gentity_t *ent) {
if ( client->sess.sessionTeam == TEAM_SPECTATOR ) {
spawnPoint = SelectSpectatorSpawnPoint (
spawn_origin, spawn_angles);
// JBravo: remember saved specmodes.
if (g_gametype.integer == GT_TEAMPLAY) {
if (client->specMode == SPECTATOR_FOLLOW || client->specMode == SPECTATOR_FREE)
client->sess.spectatorState = client->specMode;
}
} else if (g_gametype.integer >= GT_CTF ) {
// all base oriented team games use the CTF spawn points
spawnPoint = SelectCTFSpawnPoint (
@ -1443,6 +1440,7 @@ void ClientSpawn(gentity_t *ent) {
// JBravo: save radiosettings
savedRadiopower = client->radioOff;
savedRadiogender = client->radioGender;
memcpy (&savedCamera, &client->camera, sizeof(camera_t));
memset (client, 0, sizeof(*client)); // bk FIXME: Com_Memset?
@ -1453,6 +1451,7 @@ void ClientSpawn(gentity_t *ent) {
// JBravo: restore radiosettings
client->radioOff = savedRadiopower;
client->radioGender = savedRadiogender;
memcpy (&client->camera, &savedCamera, sizeof(camera_t));
client->pers = saved;
client->sess = savedSess;
@ -1498,9 +1497,7 @@ void ClientSpawn(gentity_t *ent) {
client->ps.clientNum = index;
#ifdef __ZCAM__
camera_begin (ent);
#endif /* __ZCAM__ */
//Blaze: changed WP_MACHINEGUN to WP_PISTOL, makes the base weapon you start with the pistol
// JBravo: Not in TP
@ -1561,6 +1558,19 @@ void ClientSpawn(gentity_t *ent) {
//Elder: reset all RQ3 non-persistent stats
ent->client->ps.stats[STAT_RQ3] = 0;
// JBravo: remember saved specmodes.
if (g_gametype.integer == GT_TEAMPLAY && client->sess.sessionTeam == TEAM_SPECTATOR) {
if (client->specMode == SPECTATOR_FOLLOW || client->specMode == SPECTATOR_FREE) {
client->sess.spectatorState = client->specMode;
client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM;
}
if (client->specMode == SPECTATOR_ZCAM && client->sess.sessionTeam == TEAM_SPECTATOR) {
client->sess.spectatorState = client->specMode;
client->ps.stats[STAT_RQ3] |= RQ3_ZCAM;
client->ps.pm_flags &= ~PMF_FOLLOW;
}
}
//Elder: set weaponfireNextTime amount
client->weaponfireNextTime = 0;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.83 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.82 2002/03/26 11:32:05 jbravo
// Remember specstate between rounds.
//
@ -158,39 +161,10 @@
#include "../ui/menudef.h" // for the voice chats
//Blaze for door code
void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator );
// JBravo: for Stopfollowing
void LookAtKiller(gentity_t *self, gentity_t *inflictor, gentity_t *attacker);
//Blaze: Get amount of ammo a clip holds
//Elder: def'd in bg_public.h
//int ClipAmountForWeapon( int );
// JBravo: debugging cmd
void RQ3_Cmd_debugshit (gentity_t *ent)
{
trap_SendServerCommand(ent-g_entities, va("print \"client->ps.stats[STAT_WEAPONS] = %i\n\"",
ent->client->ps.stats[STAT_WEAPONS]));
trap_SendServerCommand(ent-g_entities, va("print \"client->ps.weapon = %i\n\"",
ent->client->ps.weapon));
trap_SendServerCommand(ent-g_entities, va("print \"client->teamplayWeapon = %i\n\"",
ent->client->teamplayWeapon));
trap_SendServerCommand(ent-g_entities, va("print \"client->ps.weaponstate = %i\n\"",
ent->client->ps.weaponstate));
trap_SendServerCommand(ent-g_entities, va("print \"client->ps.weaponTime = %i\n\"",
ent->client->ps.weaponTime));
trap_SendServerCommand(ent-g_entities, va("print \"client->uniqueWeapons = %i\n\"",
ent->client->uniqueWeapons));
trap_SendServerCommand(ent-g_entities, va("print \"client->uniqueItems = %i\n\"",
ent->client->uniqueItems));
trap_SendServerCommand(ent-g_entities, va("print \"client->sess.sessionTeam = %i\n\"",
ent->client->sess.sessionTeam));
trap_SendServerCommand(ent-g_entities, va("print \"client->sess.savedTeam = %i\n\"",
ent->client->sess.savedTeam));
trap_SendServerCommand(ent-g_entities, va("print \"client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK = %i\n\"",
ent->client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK));
trap_SendServerCommand(ent-g_entities, va("print \"client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_NEED = %i\n\"",
ent->client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_NEED));
}
/*
==================
DeathmatchScoreboardMessage
@ -967,7 +941,7 @@ to free floating spectator mode
=================
*/
void StopFollowing( gentity_t *ent ) {
gentity_t *followee;
vec3_t angle;
ent->client->ps.persistant[ PERS_TEAM ] = TEAM_SPECTATOR;
ent->client->sess.sessionTeam = TEAM_SPECTATOR;
@ -977,9 +951,9 @@ void StopFollowing( gentity_t *ent ) {
Cmd_Unzoom(ent);
ent->client->ps.pm_flags &= ~PMF_FOLLOW;
ent->r.svFlags &= ~SVF_BOT;
followee = &g_entities[ent->client->ps.clientNum];
ent->client->ps.clientNum = ent - g_entities;
LookAtKiller(ent, followee, followee);
angle[0] = angle[1] = angle[2] = 0.0;
SetClientViewAngle(ent, angle);
}
/*
@ -2974,9 +2948,6 @@ void ClientCommand( int clientNum ) {
RQ3_Cmd_Radio_power_f (ent);
else if (Q_stricmp (cmd, "radio") == 0)
RQ3_Cmd_Radio_f (ent);
// JBravo: debugging cmd
else if (Q_stricmp (cmd, "debugshit") == 0)
RQ3_Cmd_debugshit (ent);
else if (Q_stricmp (cmd, "dropweapon") == 0) // XRAY FMJ
Cmd_DropWeapon_f( ent );
//Elder: stuff for dropping items

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.47 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.46 2002/03/26 11:32:05 jbravo
// Remember specstate between rounds.
//
@ -611,6 +614,10 @@ void SpawnPlayers()
if(g_RQ3_matchmode.integer && player->client->pers.sub != TEAM_FREE)
continue;
// JBravo: lets not respawn spectators in free floating mode
if(player->client->sess.savedTeam == TEAM_SPECTATOR &&
player->client->specMode == SPECTATOR_FREE)
continue;
client = player->client;
clientNum = client - level.clients;
@ -1335,3 +1342,13 @@ void ParseSayText (gentity_t * ent, char *text)
text[225] = 0;
}
void RQ3_SpectatorMode(gentity_t *ent)
{
if (ent->client->sess.spectatorState == SPECTATOR_ZCAM)
trap_SendServerCommand(ent->client->ps.clientNum,
va("print \"\n" S_COLOR_MAGENTA "Spectator Mode-" S_COLOR_YELLOW"ZCAM\n"));
else
trap_SendServerCommand(ent->client->ps.clientNum,
va("print \"\n" S_COLOR_MAGENTA "Spectator Mode-" S_COLOR_YELLOW"%s\n",
(ent->client->sess.spectatorState == SPECTATOR_FREE)? "FREE":"FOLLOW"));
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.7 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.6 2002/03/14 23:54:12 jbravo
// Added a variable system from AQ. Works the same except it uses $ for %
//
@ -54,3 +57,4 @@ 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);
void RQ3_SpectatorMode(gentity_t *ent);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.8 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color.
//
// Revision 1.7 2002/03/03 02:04:15 jbravo
// Zcam tewaking
//
@ -782,9 +785,15 @@ static gentity_t *CameraSwingTarget (gentity_t *ent)
else
color = S_COLOR_GREEN;
trap_SendServerCommand( ent->client->ps.clientNum,
va("cp \"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n%sTracking " S_COLOR_WHITE "%s\n",
color, target2nd->client->pers.netname) );
// JBravo: take teamnames into account
if (target2nd->client->sess.sessionTeam == TEAM_RED)
trap_SendServerCommand( ent->client->ps.clientNum,
va("cp \"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n%sTracking " S_COLOR_WHITE "%s" S_COLOR_RED "/" S_COLOR_MAGENTA "%s\n",
color, target2nd->client->pers.netname, g_RQ3_team1name.string));
else if (target2nd->client->sess.sessionTeam == TEAM_BLUE)
trap_SendServerCommand( ent->client->ps.clientNum,
va("cp \"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n%sTracking " S_COLOR_WHITE "%s" S_COLOR_RED "/" S_COLOR_MAGENTA "%s\n",
color, target2nd->client->pers.netname, g_RQ3_team2name.string));
}
return target2nd;