From 0cedbbb1a1e6157df6cfe16290266ba146c85838 Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Sat, 26 Oct 2002 22:03:43 +0000 Subject: [PATCH] Made TeamDM work RQ3 style. --- reaction/ChangeLog | Bin 22168 -> 22240 bytes reaction/cgame/cg_draw.c | 7 +++++-- reaction/cgame/cg_players.c | 11 +++++++---- reaction/cgame/cg_servercmds.c | 5 ++++- reaction/game/g_active.c | 15 +++++++++------ reaction/game/g_client.c | 33 ++++++++++++++++++--------------- reaction/game/g_cmds.c | 25 ++++++++++++++----------- reaction/game/g_combat.c | 23 +++++++++++++---------- reaction/game/g_items.c | 11 +++++++---- reaction/game/g_main.c | 17 ++++++++++------- reaction/game/g_matchmode.c | 7 ++++--- reaction/game/g_session.c | 7 +++++-- reaction/game/g_teamplay.c | 10 +++++++--- reaction/game/g_weapon.c | 23 +++++++++++++---------- 14 files changed, 116 insertions(+), 78 deletions(-) diff --git a/reaction/ChangeLog b/reaction/ChangeLog index 57e88ef6e7ae783e4b949ec6cdf2f7be214fae89..e09f94abfa340ebd582df7c0a2f1fff536ab23f3 100644 GIT binary patch delta 78 zcmbQSmhr(_#t9LYAq=Sui43_6E)2d53JjSH#XvHTA)lcfNS6cYB8F_BXdXj4kRQYl a$Y2bliy2B7Dkpywk)Hg)i)UkjMi>C;#S=gP delta 20 ccmaE`mT|^f#t9LVqvUxe7kKh)+@TQ$09#xL6aWAK diff --git a/reaction/cgame/cg_draw.c b/reaction/cgame/cg_draw.c index 9e598d06..6ad2b8ed 100644 --- a/reaction/cgame/cg_draw.c +++ b/reaction/cgame/cg_draw.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.68 2002/10/26 22:03:42 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.67 2002/10/26 00:37:18 jbravo // New multiple item code and added PB support to the UI // @@ -686,7 +689,7 @@ static float CG_DrawScore(float y) y += 4; - if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF) + if (cgs.gametype >= GT_TEAM) team = cg.snap->ps.persistant[PERS_SAVEDTEAM]; else team = cg.snap->ps.persistant[PERS_TEAM]; @@ -2001,7 +2004,7 @@ static void CG_DrawSpectator(void) MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f); - if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF) { + if (cgs.gametype >= GT_TEAM) { team = (cgs.gametype == GT_TEAMPLAY) ? cg.snap->ps.persistant[PERS_SAVEDTEAM] : cg.snap->ps.persistant[PERS_TEAM]; CG_TeamColor(team, Color); Color[0] *= 0.7f; diff --git a/reaction/cgame/cg_players.c b/reaction/cgame/cg_players.c index 5517c5a8..c7b34629 100644 --- a/reaction/cgame/cg_players.c +++ b/reaction/cgame/cg_players.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.55 2002/10/26 22:03:42 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.54 2002/10/26 00:37:18 jbravo // New multiple item code and added PB support to the UI // @@ -465,7 +468,7 @@ static qboolean CG_FindClientModelFile(char *filename, int length, clientInfo_t if (CG_FileExists(filename)) { return qtrue; } - if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF) { + if (cgs.gametype >= GT_TEAM) { Com_sprintf(filename, length, "models/players/%s/%s_%s.%s", modelName, base, skinName, ext); } else if (cgs.gametype >= GT_TEAM) { @@ -551,7 +554,7 @@ static qboolean CG_FindClientHeadFile(char *filename, int length, clientInfo_t * if (CG_FileExists(filename)) { return qtrue; } - if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF) { + if (cgs.gametype >= GT_TEAM) { Com_sprintf(filename, length, "models/players/%s/%s_%s.%s", headModelName, base, headSkinName, ext); } else if (cgs.gametype >= GT_TEAM) { @@ -2176,7 +2179,7 @@ static void CG_PlayerFloatSprite(centity_t * cent, qhandle_t shader) refEntity_t ent; // NiceAss: Don't draw floating sprites for enemies in TP - if ( cgs.gametype == GT_TEAMPLAY && + if ( cgs.gametype >= GT_TEAM && cgs.clientinfo[cent->currentState.clientNum].team != cg.snap->ps.persistant[PERS_SAVEDTEAM] && ( cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_RED || cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_BLUE ) ) @@ -2253,7 +2256,7 @@ static void CG_PlayerSprites(centity_t * cent) return; } // JBravo: no triangles over teammates. - if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF) { + if (cgs.gametype >= GT_TEAM) { return; } diff --git a/reaction/cgame/cg_servercmds.c b/reaction/cgame/cg_servercmds.c index 2ca59c7d..5324a689 100644 --- a/reaction/cgame/cg_servercmds.c +++ b/reaction/cgame/cg_servercmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.70 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.69 2002/10/21 21:03:32 niceass // ref ready code // @@ -681,7 +684,7 @@ static void CG_MapRestart(void) // play the "fight" sound if this is a restart without warmup // JBravo: unless we are in teamplay mode. - if (cgs.gametype == GT_TEAMPLAY) + if (cgs.gametype >= GT_TEAM) return; if (cg.warmup == 0 /* && cgs.gametype == GT_TOURNAMENT */ ) { trap_S_StartLocalSound(cgs.media.countFightSound, CHAN_ANNOUNCER); diff --git a/reaction/game/g_active.c b/reaction/game/g_active.c index e6d86e83..282b02f0 100644 --- a/reaction/game/g_active.c +++ b/reaction/game/g_active.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.92 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.91 2002/10/26 00:37:18 jbravo // New multiple item code and added PB support to the UI // @@ -745,7 +748,7 @@ void ClientEvents(gentity_t * ent, int oldEventSequence) break; } // JBravo: fix falling pain during lca - if (g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action) { + if (g_gametype.integer >= GT_TEAM && level.lights_camera_action) { break; } @@ -776,7 +779,7 @@ void ClientEvents(gentity_t * ent, int oldEventSequence) break; } // JBravo: fix falling pain during lca again - if (g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action) { + if (g_gametype.integer >= GT_TEAM && level.lights_camera_action) { break; } @@ -949,7 +952,7 @@ void ThrowItem(gentity_t * ent) gclient_t *client; gitem_t *xr_item; gentity_t *xr_drop; - int item; +// int item; client = ent->client; @@ -1277,12 +1280,12 @@ void ClientThink_real(gentity_t * ent) if (ucmd->forwardmove == 0 && ucmd->rightmove == 0) { if (client->idletime) { if (level.time >= client->idletime + (g_RQ3_ppl_idletime.integer * 1000)) { - if (g_gametype.integer == GT_TEAMPLAY && g_RQ3_idleaction.integer == 1 && + if (g_gametype.integer >= GT_TEAM && g_RQ3_idleaction.integer == 1 && (ent->client->sess.sessionTeam == TEAM_RED || ent->client->sess.sessionTeam == TEAM_BLUE)) { trap_SendServerCommand( -1, va("print \"Removing %s^7 from his team for excessive Idling\n\"", ent->client->pers.netname)); trap_SendServerCommand(ent - g_entities, "stuff team none\n"); - } else if (g_gametype.integer == GT_TEAMPLAY && g_RQ3_idleaction.integer == 2 && + } else if (g_gametype.integer >= GT_TEAM && g_RQ3_idleaction.integer == 2 && (ent->client->sess.sessionTeam == TEAM_RED || ent->client->sess.sessionTeam == TEAM_BLUE)) { trap_SendServerCommand( -1, va("print \"Kicking %s^7 for excessive Idling\n\"", ent->client->pers.netname)); @@ -1381,7 +1384,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 || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { for (i = 0; i < MAX_PERSISTANT; i++) ent->client->ps.persistant[i] = savedPers[i]; diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index 9a94549c..b3cc0744 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.120 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.119 2002/10/26 18:29:17 jbravo // Added allweap and allitem funtionality. // @@ -863,7 +866,7 @@ team_t PickTeam(int ignoreClientNum) { int counts[TEAM_NUM_TEAMS]; - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { counts[TEAM_BLUE] = RQ3TeamCount(ignoreClientNum, TEAM_BLUE); counts[TEAM_RED] = RQ3TeamCount(ignoreClientNum, TEAM_RED); } else { @@ -1333,7 +1336,7 @@ char *ClientConnect(int clientNum, qboolean firstTime, qboolean isBot) CalculateRanks(); // JBravo: clients in TP begin as spectators - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { client->sess.sessionTeam = TEAM_SPECTATOR; client->ps.persistant[PERS_TEAM] = TEAM_SPECTATOR; client->sess.spectatorState = SPECTATOR_FREE; @@ -1382,7 +1385,7 @@ void ClientBegin(int clientNum) ent->client = client; //Slicer: Saving persistant and ping - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { savedPing = client->ps.ping; for (i = 0; i < MAX_PERSISTANT; i++) savedPers[i] = client->ps.persistant[i]; @@ -1401,7 +1404,7 @@ void ClientBegin(int clientNum) client->ps.eFlags = flags; //Slicer: Repost score and ping - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { client->ps.ping = savedPing; for (i = 0; i < MAX_PERSISTANT; i++) client->ps.persistant[i] = savedPers[i]; @@ -1410,7 +1413,7 @@ void ClientBegin(int clientNum) ClientSpawn(ent); // JBravo: if teamplay and the client has not been on teams, make them a spectator. - if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) && + if ((g_gametype.integer >= GT_TEAM) && client->sess.sessionTeam != TEAM_RED && client->sess.sessionTeam != TEAM_BLUE) { client->sess.sessionTeam = TEAM_SPECTATOR; client->ps.persistant[PERS_SAVEDTEAM] = TEAM_SPECTATOR; @@ -1450,7 +1453,7 @@ void ClientBegin(int clientNum) G_LogPrintf("ClientBegin: %i\n", clientNum); // JBravo: synching the cvars over to clients for the MM ingame menu. - if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) && g_RQ3_matchmode.integer) { + if ((g_gametype.integer >= GT_TEAM) && g_RQ3_matchmode.integer) { for (i = 0; i < 9; ++i) { trap_SendServerCommand(ent - g_entities, va("rq3_cmd %i %s %i", CVARSET, settings2[i], trap_Cvar_VariableIntegerValue(settings[i]))); @@ -1473,7 +1476,7 @@ void ClientBegin(int clientNum) CalculateRanks(); // JBravo: default weapons - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { // NiceAss: Only set it if there is no value. Fix for going into spectator resetting values. if (ent->r.svFlags & SVF_BOT) { //Makro - changed to m4/laser from pistol/kevlar @@ -1701,7 +1704,7 @@ void ClientSpawn(gentity_t * ent) //Blaze: changed WP_MACHINEGUN to WP_PISTOL, makes the base weapon you start with the pistol // JBravo: Not in TP - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) { + if (g_gametype.integer == GT_FFA) { if ((int) g_RQ3_weaponban.integer & WPF_MK23) { client->ps.stats[STAT_WEAPONS] = (1 << WP_PISTOL); client->numClips[WP_PISTOL] = 0; @@ -1759,7 +1762,7 @@ void ClientSpawn(gentity_t * ent) ent->client->ps.stats[STAT_RQ3] = 0; // JBravo: remember saved specmodes. - if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) && + if ((g_gametype.integer >= GT_TEAM) && client->sess.sessionTeam == TEAM_SPECTATOR) { if (client->specMode == SPECTATOR_FOLLOW || client->specMode == SPECTATOR_FREE) { client->sess.spectatorState = client->specMode; @@ -1785,7 +1788,7 @@ void ClientSpawn(gentity_t * ent) client->ps.torsoAnim = TORSO_STAND; client->ps.legsAnim = LEGS_IDLE; // weapon animations - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) + if (g_gametype.integer == GT_FFA) client->ps.generic1 = ((client->ps.generic1 & ANIM_TOGGLEBIT) ^ ANIM_TOGGLEBIT) | WP_ANIM_IDLE; @@ -1799,7 +1802,7 @@ void ClientSpawn(gentity_t * ent) // select the highest weapon number available, after any // spawn given items have fired // JBravo: Lets make sure we have the right weapons - if ((g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) && + if ((g_gametype.integer >= GT_TEAM) && (client->sess.sessionTeam == TEAM_RED || client->sess.sessionTeam == TEAM_BLUE)) { EquipPlayer(ent); } else { @@ -1820,7 +1823,7 @@ void ClientSpawn(gentity_t * ent) client->ps.commandTime = level.time - 100; ent->client->pers.cmd.serverTime = level.time; // JBravo: We should not have to call this during TP spawns - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) + if (g_gametype.integer == GT_FFA) ClientThink(ent - g_entities); // positively link the client, even if the command times are weird @@ -1831,7 +1834,7 @@ void ClientSpawn(gentity_t * ent) } // run the presend to set anything else // JBravo: We should not have to call this during TP spawns - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) + if (g_gametype.integer == GT_FFA) ClientEndFrame(ent); ent->client->noHead = qfalse; @@ -1899,7 +1902,7 @@ void ClientDisconnect(int clientNum) return; } // JBravo: to keep the ui teamcount cvars right. - if (g_gametype.integer == GT_TEAMPLAY) { + if (g_gametype.integer >= GT_TEAM) { oldTeam = ent->client->sess.sessionTeam; } //Slicer: matchmode @@ -1973,7 +1976,7 @@ void ClientDisconnect(int clientNum) CalculateRanks(); // JBravo: to keep the ui teamcount cvars right. - if (g_gametype.integer == GT_TEAMPLAY) { + if (g_gametype.integer >= GT_TEAM) { i = RQ3TeamCount(-1, oldTeam); } diff --git a/reaction/game/g_cmds.c b/reaction/game/g_cmds.c index c5b12603..876536c6 100644 --- a/reaction/game/g_cmds.c +++ b/reaction/game/g_cmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.174 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.173 2002/10/26 18:29:17 jbravo // Added allweap and allitem funtionality. // @@ -942,7 +945,7 @@ void BroadcastTeamChange(gclient_t * client, int oldTeam) { // JBravo: change team names if teamplay - if (g_gametype.integer == GT_TEAMPLAY) { + if (g_gametype.integer >= GT_TEAM) { if (client->sess.savedTeam == TEAM_RED) { trap_SendServerCommand(-1, va("print \"%s" S_COLOR_WHITE " joined %s.\n\"", client->pers.netname, g_RQ3_team1name.string)); @@ -989,7 +992,7 @@ void SetTeam(gentity_t * ent, char *s) client = ent->client; clientNum = client - level.clients; - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) { + if (g_gametype.integer < GT_TEAM) { specClient = 0; specState = SPECTATOR_NOT; } @@ -1011,7 +1014,7 @@ void SetTeam(gentity_t * ent, char *s) specState = SPECTATOR_FREE; } else if (g_gametype.integer >= GT_TEAM) { // if running a team game, assign player to one of the teams - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) { + if (g_gametype.integer < GT_TEAM) { specState = SPECTATOR_NOT; } if (!Q_stricmp(s, "red") || !Q_stricmp(s, "r") || !Q_stricmp(s, "1")) { @@ -1094,7 +1097,7 @@ void SetTeam(gentity_t * ent, char *s) } // JBravo: lets set the correct var here. - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { client->sess.savedTeam = team; client->ps.persistant[PERS_SAVEDTEAM] = team; } else { @@ -1121,7 +1124,7 @@ void SetTeam(gentity_t * ent, char *s) client->sess.spectatorTime = level.time; } // JBravo: not messing with spec system in TP during teamswitches - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) { + if (g_gametype.integer < GT_TEAM) { client->sess.spectatorState = specState; client->sess.spectatorClient = specClient; } @@ -1133,7 +1136,7 @@ void SetTeam(gentity_t * ent, char *s) // JBravo: save sessionTeam and then set it correctly for the call to ClientUserinfoChanged // so the scoreboard will be correct. Also check for uneven teams. - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { if (g_RQ3_matchmode.integer && g_RQ3_maxplayers.integer > 0) { if (RQ3TeamCount(-1, client->sess.savedTeam) > g_RQ3_maxplayers.integer) // If it overflows max players //Make him a sub immeadiatly. @@ -1339,7 +1342,7 @@ void Cmd_FollowCycle_f(gentity_t * ent, int dir) } // first set them to spectator // JBravo: Unless we are in teamplay. No need to mess with teams. - if (ent->client->sess.spectatorState == SPECTATOR_NOT && g_gametype.integer != GT_TEAMPLAY) { + if (ent->client->sess.spectatorState == SPECTATOR_NOT && g_gametype.integer < GT_TEAM) { SetTeam(ent, "spectator"); } @@ -1366,7 +1369,7 @@ void Cmd_FollowCycle_f(gentity_t * ent, int dir) continue; } // JBravo: limchasecam - if (g_gametype.integer == GT_TEAMPLAY && g_RQ3_limchasecam.integer != 0 && + if (g_gametype.integer >= GT_TEAM && g_RQ3_limchasecam.integer != 0 && ent->client->sess.savedTeam != level.clients[clientnum].sess.sessionTeam && ent->client->sess.referee == 0) { G_Printf("SavedTeam = (%d)\n",ent->client->sess.savedTeam); continue; @@ -1982,8 +1985,8 @@ void Cmd_CallVote_f(gentity_t * ent) // special case for g_gametype, check for bad values if (!Q_stricmp(arg1, "g_gametype")) { i = atoi(arg2); - if (i != GT_FFA && i != GT_TEAMPLAY && i != GT_CTF) { - trap_SendServerCommand(ent - g_entities, "print \"Invalid gametype. Valid gametypes are 0, 4 and 5.\n\""); + if (i != GT_FFA && i != GT_TEAMPLAY && i != GT_CTF && i != GT_TEAM) { + trap_SendServerCommand(ent - g_entities, "print \"Invalid gametype. Valid gametypes are 0, 3, 4 and 5.\n\""); return; } @@ -2093,7 +2096,7 @@ void Cmd_CallTeamVote_f(gentity_t * ent) char arg2[MAX_STRING_TOKENS]; // JBravo: not wanted for TP - if (g_gametype.integer == GT_TEAMPLAY) + if (g_gametype.integer >= GT_TEAM) return; team = ent->client->sess.sessionTeam; diff --git a/reaction/game/g_combat.c b/reaction/game/g_combat.c index aeeb60e8..38e4f7b6 100644 --- a/reaction/game/g_combat.c +++ b/reaction/game/g_combat.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.130 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.129 2002/10/26 00:37:18 jbravo // New multiple item code and added PB support to the UI // @@ -363,7 +366,7 @@ void AddScore(gentity_t * ent, vec3_t origin, int score) ScorePlum(ent, origin, score); // ent->client->ps.persistant[PERS_SCORE] += score; - if (g_gametype.integer == GT_TEAM) + if (g_gametype.integer == GT_TEAM && score > 0) level.teamScores[ent->client->ps.persistant[PERS_TEAM]] += score; CalculateRanks(); } @@ -1169,7 +1172,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i return; } // JBravo: lets not bother with those CTF functions in Teamplay - if (g_gametype.integer != GT_TEAMPLAY) { + if (g_gametype.integer == GT_CTF) { // check for an almost capture CheckAlmostCapture(self, attacker); // check for a player that almost brought in cubes @@ -1353,7 +1356,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i Add_TeamKill(attacker); trap_SendServerCommand(self - g_entities, va("rq3_cmd %i %s", TKOK, attacker->client->pers.netname)); - } else if (g_gametype.integer == GT_CTF) { + } else if (g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM) { AddScore(attacker, self->r.currentOrigin, -1); attacker->client->pers.records[REC_KILLS]--; attacker->client->pers.records[REC_TEAMKILLS]++; @@ -1376,7 +1379,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i // DM reward scoring, should add an if statement to get around this when // we add teamplay. // JBravo: Done ;) - if (g_gametype.integer == GT_FFA) { + if (g_gametype.integer == GT_FFA || g_gametype.integer == GT_TEAM) { if (attacker->client->killStreak < 4) AddScore(attacker, self->r.currentOrigin, 1); else if (attacker->client->killStreak < 8) { @@ -1431,7 +1434,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i self->client->pers.records[REC_SUICIDES]++; self->client->pers.records[REC_KILLS]--; } - if (g_gametype.integer != GT_TEAMPLAY) { + if (g_gametype.integer == GT_CTF) { if (self->client->ps.powerups[PW_NEUTRALFLAG]) { // only happens in One Flag CTF Team_ReturnFlag(TEAM_FREE); self->client->ps.powerups[PW_NEUTRALFLAG] = 0; @@ -1449,7 +1452,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i if (!(contents & CONTENTS_NODROP)) { TossClientItems(self); } else { - if (g_gametype.integer != GT_TEAMPLAY) { + if (g_gametype.integer == GT_CTF) { if (self->client->ps.powerups[PW_NEUTRALFLAG]) { // only happens in One Flag CTF Team_ReturnFlag(TEAM_FREE); } else if (self->client->ps.powerups[PW_REDFLAG]) { // only happens in standard CTF @@ -1864,7 +1867,7 @@ void G_Damage(gentity_t * targ, gentity_t * inflictor, gentity_t * attacker, return; } - if (g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action) { + if (g_gametype.integer >= GT_TEAM && level.lights_camera_action) { return; // JBravo: No dmg during LCA } // NiceAss: Fixed pointer bug causing DLLs to crash @@ -1872,7 +1875,7 @@ void G_Damage(gentity_t * targ, gentity_t * inflictor, gentity_t * attacker, if (targ != attacker && attacker && targ && targ->client && attacker->client && targ->client->sess.sessionTeam == attacker->client->sess.sessionTeam && ((g_gametype.integer == GT_TEAMPLAY && !g_friendlyFire.integer && level.team_round_going) || - (g_gametype.integer == GT_CTF && !g_friendlyFire.integer))) + (g_gametype.integer >= GT_TEAM && !g_friendlyFire.integer))) return; // the intermission has allready been qualified for, so don't @@ -2086,10 +2089,10 @@ void G_Damage(gentity_t * targ, gentity_t * inflictor, gentity_t * attacker, if (g_gametype.integer == GT_TEAMPLAY && g_friendlyFire.integer == 2 && level.team_round_going) { return; } - if (g_gametype.integer == GT_CTF && g_friendlyFire.integer == 2) + if (g_gametype.integer >= GT_TEAM && g_friendlyFire.integer == 2) return; if ((g_gametype.integer == GT_TEAMPLAY && level.team_round_going) - || g_gametype.integer == GT_CTF) + || g_gametype.integer >= GT_TEAM) Add_TeamWound(attacker, targ, mod); } // check for godmode diff --git a/reaction/game/g_items.c b/reaction/game/g_items.c index f1e1b240..1d5fa161 100644 --- a/reaction/game/g_items.c +++ b/reaction/game/g_items.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.51 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.50 2002/10/26 00:37:18 jbravo // New multiple item code and added PB support to the UI // @@ -796,7 +799,7 @@ gentity_t *LaunchItem(gitem_t * item, vec3_t origin, vec3_t velocity, int xr_fla else dropped->think = RQ3_DroppedWeaponThink; // JBravo: weapons and items go away faster in CTF - if (g_gametype.integer == GT_CTF) + if (g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM) dropped->nextthink = level.time + RQ3_CTF_RESPAWNTIME_DEFAULT; else if (g_gametype.integer == GT_TEAMPLAY) dropped->nextthink = 0; @@ -811,7 +814,7 @@ gentity_t *LaunchItem(gitem_t * item, vec3_t origin, vec3_t velocity, int xr_fla else dropped->think = RQ3_DroppedItemThink; // JBravo: weapons and items go away faster in CTF - if (g_gametype.integer == GT_CTF) + if (g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM) dropped->nextthink = level.time + RQ3_CTF_RESPAWNTIME_DEFAULT; else if (g_gametype.integer == GT_TEAMPLAY) dropped->nextthink = 0; @@ -1086,7 +1089,7 @@ void ClearRegisteredItems(void) RegisterItem(BG_FindItemForHoldable(HI_LASER)); //Makro - all weapons should be loaded in teamplay //JBravo: and CTF - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM) { RegisterItem(BG_FindItemForWeapon(WP_M3)); RegisterItem(BG_FindItemForWeapon(WP_MP5)); RegisterItem(BG_FindItemForWeapon(WP_HANDCANNON)); @@ -1484,7 +1487,7 @@ void RQ3_ResetItem(int itemTag) float angle = rand() % 360; // JBravo: no resetting items in TP or CTB - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) return; switch (itemTag) { diff --git a/reaction/game/g_main.c b/reaction/game/g_main.c index fa5a8f97..57344a80 100644 --- a/reaction/game/g_main.c +++ b/reaction/game/g_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.124 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.123 2002/10/26 18:29:17 jbravo // Added allweap and allitem funtionality. // @@ -789,7 +792,7 @@ void G_RegisterCvars(void) } // JBravo: lets disable the untested modes. if (g_gametype.integer != GT_FFA && g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF && - g_gametype.integer != GT_TOURNAMENT) { + g_gametype.integer != GT_TOURNAMENT && g_gametype.integer != GT_TEAM) { G_Printf("g_gametype %i is currently not supported by ReactionQuake3. Defaulting to 0\n", g_gametype.integer); trap_Cvar_Set("g_gametype", "0"); @@ -1063,7 +1066,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) } //Elder: spawn unique items. // JBravo: unless we are in Teamplay - if (g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) { + if (g_gametype.integer < GT_TEAM) { RQ3_StartUniqueItems(); } // Elder: force sv_floodprotect to 0 -- remove when we finish @@ -1084,7 +1087,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) G_SoundIndex("sound/player/gurp2.wav"); } // JBravo: reset teamplay stuff. - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { //Slicer: Default Radio Gender according to MODEL gender Q_strncpyz(model, g_RQ3_team1model.string, sizeof(model)); Q_strncpyz(model2, g_RQ3_team2model.string, sizeof(model)); @@ -1116,7 +1119,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) level.team1respawn = level.team2respawn = 0; } // Slicer: reset matchmode vars - if (g_RQ3_matchmode.integer && (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF)) { + if (g_RQ3_matchmode.integer && g_gametype.integer >= GT_TEAM) { level.refAmmount = 0; for (i = 0; i < level.maxclients; i++) { ent = &g_entities[i]; @@ -1664,7 +1667,7 @@ void BeginIntermission(void) MoveClientToIntermission(client); // JBravo: send the TP scoreboard to players // NiceAss: And CTF - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) trap_SendServerCommand(i, va("rq3_cmd %i", MAPEND)); } @@ -1990,7 +1993,7 @@ void CheckExitRules(void) return; } //Slicer - if (g_gametype.integer == GT_TEAMPLAY) { + if (g_gametype.integer >= GT_TEAM) { //Let's check fraglimit here, everything else is on teamplay.c if (g_fraglimit.integer > 0) { for (i = 0; i < g_maxclients.integer; i++) { @@ -2525,7 +2528,7 @@ void G_RunFrame(int levelTime) CheckVote(); // JBravo: this is the main function in g_teamplay that does everything for TP and CTB - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM) { CheckTeamRules(); } // Slicer: matchmode diff --git a/reaction/game/g_matchmode.c b/reaction/game/g_matchmode.c index bd503e5d..6649246e 100644 --- a/reaction/game/g_matchmode.c +++ b/reaction/game/g_matchmode.c @@ -81,6 +81,7 @@ void MM_RunFrame(void) //Each Type has different ways of dealing things.. case (GT_TEAMPLAY): case (GT_CTF): + case (GT_TEAM): if (level.team_game_going && level.inGame) level.matchTime += 1.0f / (float) fps; break; @@ -162,8 +163,8 @@ void MM_Ready_f(gentity_t * ent) return; } - if (level.inGame && g_gametype.integer == GT_CTF) { - trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "CTB does not yet support un-readying your team after the match started\n\"")); + if (level.inGame && (g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM)) { + trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This gametype does not yet support un-readying your team after the match started\n\"")); return; } @@ -405,7 +406,7 @@ void MM_ClearScores(qboolean clearTeamFlags) ent->client->ps.persistant[PERS_KILLED] = 0; ent->client->ps.persistant[PERS_DAMAGE_DELT] = 0; } - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) { + if (g_gametype.integer >= GT_TEAM) { level.teamScores[TEAM_RED] = 0; level.teamScores[TEAM_BLUE] = 0; } diff --git a/reaction/game/g_session.c b/reaction/game/g_session.c index b5d85d0e..38757571 100644 --- a/reaction/game/g_session.c +++ b/reaction/game/g_session.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.23 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.22 2002/10/21 21:00:39 slicer // New MM features and bug fixes // @@ -94,7 +97,7 @@ void G_WriteClientSessionData(gclient_t * client) //Slicer how about savedTeam ?! - if (!g_RQ3_matchmode.integer && (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF)) { + if (!g_RQ3_matchmode.integer && g_gametype.integer >= GT_TEAM) { //Reset teams on map changes / map_restarts, except on matchmode client->sess.savedTeam = TEAM_SPECTATOR; } @@ -204,7 +207,7 @@ 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) { + } else if (g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM) { sess->savedTeam = PickTeam(-1); client->ps.persistant[PERS_SAVEDTEAM] = sess->savedTeam; sess->sessionTeam = sess->savedTeam; diff --git a/reaction/game/g_teamplay.c b/reaction/game/g_teamplay.c index af81c54b..1cc009cd 100644 --- a/reaction/game/g_teamplay.c +++ b/reaction/game/g_teamplay.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.142 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.141 2002/10/26 00:37:18 jbravo // New multiple item code and added PB support to the UI // @@ -1163,6 +1166,8 @@ void EquipPlayer(gentity_t * ent) if ((int) g_RQ3_weaponban.integer & WPF_KNIFE) { ent->client->ps.stats[STAT_WEAPONS] |= (1 << WP_KNIFE); + ent->client->weaponCount[WP_KNIFE] = 1; + ent->client->ps.ammo[WP_KNIFE] = 1; } switch (ent->client->teamplayWeapon) { @@ -2268,7 +2273,7 @@ void Add_TeamWound(gentity_t * attacker, gentity_t * victim, int mod) char userinfo[MAX_INFO_STRING]; char *value; - if ((g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) || !attacker->client || !victim->client) + if (g_gametype.integer < GT_TEAM || !attacker->client || !victim->client) return; attacker->client->team_wounds++; @@ -2315,8 +2320,7 @@ void Add_TeamKill(gentity_t * attacker) char *value; // NiceAss: No TKing in matchmode - if ((g_gametype.integer != GT_TEAMPLAY && g_gametype.integer != GT_CTF) || !attacker->client - || g_RQ3_matchmode.integer) + if (g_gametype.integer < GT_TEAM || !attacker->client || g_RQ3_matchmode.integer) return; attacker->client->team_kills++; diff --git a/reaction/game/g_weapon.c b/reaction/game/g_weapon.c index d0fd0745..aa42cc7d 100644 --- a/reaction/game/g_weapon.c +++ b/reaction/game/g_weapon.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.84 2002/10/26 22:03:43 jbravo +// Made TeamDM work RQ3 style. +// // Revision 1.83 2002/10/26 00:37:18 jbravo // New multiple item code and added PB support to the UI // @@ -282,7 +285,7 @@ qboolean JumpKick(gentity_t * ent) } // CTF if (ent->client->sess.sessionTeam == traceEnt->client->sess.sessionTeam && - g_gametype.integer == GT_CTF) { + (g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM)) { return qfalse; } } @@ -1189,7 +1192,7 @@ void Weapon_Knife_Fire(gentity_t * ent) //m = Knife_Throw(ent, muzzle, forward, THROW_DAMAGE, 1200); // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); m = fire_knife(ent, muzzle, forward); @@ -1224,7 +1227,7 @@ void Weapon_M4_Fire(gentity_t * ent) } // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); Bullet_Fire(ent, RQ3_Spread(ent, M4_SPREAD), M4_DAMAGE, MOD_M4); @@ -1259,7 +1262,7 @@ void Weapon_MK23_Fire(gentity_t * ent) spread = PISTOL_SPREAD; } // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); Bullet_Fire(ent, RQ3_Spread(ent, spread), PISTOL_DAMAGE, MOD_PISTOL); } @@ -1280,7 +1283,7 @@ void Weapon_SSG3000_FireOld(gentity_t * ent) spread = RQ3_Spread(ent, SNIPER_SPREAD); } // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); Bullet_Fire(ent, spread, SNIPER_DAMAGE, MOD_SNIPER); @@ -1526,7 +1529,7 @@ void Weapon_MP5_Fire(gentity_t * ent) } // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); Bullet_Fire(ent, RQ3_Spread(ent, MP5_SPREAD), MP5_DAMAGE, MOD_MP5); @@ -1542,7 +1545,7 @@ void Weapon_HandCannon_Fire(gentity_t * ent) gentity_t *tent, *tent2; // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); //Elder: added for damage report @@ -1582,7 +1585,7 @@ void Weapon_M3_Fire(gentity_t * ent) gentity_t *tent; // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); //Elder: added for damage report RQ3_InitShotgunDamageReport(); @@ -1678,7 +1681,7 @@ void Weapon_Akimbo_Fire(gentity_t * ent) //Blaze: Will need 2 of these spread = AKIMBO_SPREAD; // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); Bullet_Fire(ent, RQ3_Spread(ent, spread), AKIMBO_DAMAGE, MOD_AKIMBO); @@ -1706,7 +1709,7 @@ void Weapon_Grenade_Fire(gentity_t * ent) VectorNormalize(forward); // JBravo: ff - if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF) + if (g_gametype.integer >= GT_TEAM) setFFState(ent); m = fire_grenade(ent, muzzle, forward);