Index: code/cgame/cg_local.h
===================================================================
--- code/cgame/cg_local.h (revision 263)
+++ code/cgame/cg_local.h (working copy)
@@ -1702,6 +1702,9 @@
extern vmCvar_t cg_teamChatHeight;
extern vmCvar_t cg_stats;
extern vmCvar_t cg_forceModel;
+extern vmCvar_t cg_enemyModel;
+extern vmCvar_t cg_teamModel;
+extern vmCvar_t cg_forceModelTeamSkin;
extern vmCvar_t cg_buildScript;
extern vmCvar_t cg_paused;
#ifdef SMOKINGUNS
@@ -1937,6 +1940,7 @@
extern int sortedTeamPlayers[TEAM_MAXOVERLAY];
extern int numSortedTeamPlayers;
extern int drawTeamOverlayModificationCount;
+extern int forceModelModificationCount;
extern char systemChat[256];
extern char teamChat1[256];
extern char teamChat2[256];
Index: code/cgame/cg_main.c
===================================================================
--- code/cgame/cg_main.c (revision 263)
+++ code/cgame/cg_main.c (working copy)
@@ -164,6 +164,10 @@
vmCvar_t cg_stats;
vmCvar_t cg_buildScript;
vmCvar_t cg_forceModel;
+vmCvar_t cg_forceModelTeamSkin;
+vmCvar_t cg_teamModel;
+vmCvar_t cg_enemyModel;
+
vmCvar_t cg_paused;
#ifdef SMOKINGUNS
vmCvar_t cg_menu;
@@ -392,6 +396,9 @@
{ &cg_teamChatTime, "cg_teamChatTime", "3000", CVAR_ARCHIVE },
{ &cg_teamChatHeight, "cg_teamChatHeight", "0", CVAR_ARCHIVE },
{ &cg_forceModel, "cg_forceModel", "0", CVAR_ARCHIVE },
+ { &cg_forceModelTeamSkin, "cg_forceModelTeamSkin", "1", CVAR_ARCHIVE },
+ { &cg_enemyModel, "cg_enemyModel", "", CVAR_ARCHIVE },
+ { &cg_teamModel, "cg_teamModel", "", CVAR_ARCHIVE },
{ &cg_predictItems, "cg_predictItems", "1", CVAR_ARCHIVE },
#ifndef SMOKINGUNS
{ &cg_deferPlayers, "cg_deferPlayers", "0", CVAR_ARCHIVE },
Index: code/cgame/cg_players.c
===================================================================
--- code/cgame/cg_players.c (revision 263)
+++ code/cgame/cg_players.c (working copy)
@@ -1386,6 +1386,31 @@
v = Info_ValueForKey( configstring, "t" );
newInfo.team = atoi( v );
+ //Check if the player has changed his team
+ //Don't check everyone - only main one
+ if (cg_forceModel.integer && (cgs.gametype >= GT_TEAM) &&
+ (cg.clientNum == clientNum) && (newInfo.team != ci->team)) {
+ switch (ci->team) {
+ case TEAM_BLUE:
+ case TEAM_BLUE_SPECTATOR:
+ //We may use the following logic because TEAM_BLUE_SPECTATOR != TEAM_BLUE,
+ //otherwise don't use it!
+ if ((newInfo.team != TEAM_BLUE_SPECTATOR) && (newInfo.team != TEAM_BLUE))
+ //Player has switched teams (from one team to another or to spectator)
+ forceModelModificationCount--;
+ break;
+ case TEAM_RED:
+ case TEAM_RED_SPECTATOR:
+ if ((newInfo.team != TEAM_RED_SPECTATOR) && (newInfo.team != TEAM_RED))
+ //Player has switched teams (from one team to another or to spectator)
+ forceModelModificationCount--;
+ break;
+ default:
+ //Player has switched teams (from spectator to team)
+ forceModelModificationCount--;
+ }
+ }
+
// team task
v = Info_ValueForKey( configstring, "tt" );
newInfo.teamTask = atoi(v);
@@ -1416,48 +1441,68 @@
char modelStr[MAX_QPATH];
char *skin;
- if( cgs.gametype >= GT_TEAM ) {
-#ifndef SMOKINGUNS
- Q_strncpyz( newInfo.modelName, DEFAULT_TEAM_MODEL, sizeof( newInfo.modelName ) );
- Q_strncpyz( newInfo.skinName, "default", sizeof( newInfo.skinName ) );
-#else
- Q_strncpyz( newInfo.modelName, DEFAULT_MODEL, sizeof( newInfo.modelName ) );
- Q_strncpyz( newInfo.skinName, "red", sizeof( newInfo.skinName ) );
-#endif
+ //Model section
+ if( cgs.gametype >= GT_TEAM && cg.clientNum != clientNum ) {
+ switch (cgs.clientinfo[cg.clientNum].team) {
+ case TEAM_BLUE:
+ case TEAM_BLUE_SPECTATOR:
+ if ((newInfo.team == TEAM_BLUE_SPECTATOR) ||
+ (newInfo.team == TEAM_BLUE)) {
+ trap_Cvar_VariableStringBuffer( "cg_teamModel", modelStr, sizeof( modelStr ) );
+ } else {
+ trap_Cvar_VariableStringBuffer( "cg_enemyModel", modelStr, sizeof( modelStr ) );
+ }
+ break;
+ case TEAM_RED:
+ case TEAM_RED_SPECTATOR:
+ if ((newInfo.team == TEAM_RED_SPECTATOR) ||
+ (newInfo.team == TEAM_RED)) {
+ trap_Cvar_VariableStringBuffer( "cg_teamModel", modelStr, sizeof( modelStr ) );
+ } else {
+ trap_Cvar_VariableStringBuffer( "cg_enemyModel", modelStr, sizeof( modelStr ) );
+ }
+ break;
+ default:
+ trap_Cvar_VariableStringBuffer( "cg_enemyModel", modelStr, sizeof( modelStr ) );
+ }
} else {
trap_Cvar_VariableStringBuffer( "model", modelStr, sizeof( modelStr ) );
- if ( ( skin = strchr( modelStr, '/' ) ) == NULL) {
-#ifndef SMOKINGUNS
- skin = "default";
-#else
- skin = "red";
-#endif
- } else {
- *skin++ = 0;
+ }
+ //Skins section
+ if ( ( skin = strchr( modelStr, '/' ) ) == NULL) {
+ //model name doesn't include a skin name
+ skin = "red";
+ } else {
+ //Cutting off the skin name is required for force skins feature!
+ //Without it the model won't be taken
+ *skin++ = 0;
+ }
+ if (cgs.gametype >= GT_TEAM && (cg_forceModelTeamSkin.integer ||
+ (cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR))) {
+ //Force skins in team games
+ //Skins are forced if player is just spectating
+ switch (newInfo.team) {
+ case TEAM_BLUE:
+ case TEAM_BLUE_SPECTATOR:
+ skin = "blue";
+ break;
+ case TEAM_RED:
+ case TEAM_RED_SPECTATOR:
+ default:
+ skin = "red";
}
-
- Q_strncpyz( newInfo.skinName, skin, sizeof( newInfo.skinName ) );
- Q_strncpyz( newInfo.modelName, modelStr, sizeof( newInfo.modelName ) );
}
- if ( cgs.gametype >= GT_TEAM ) {
- // keep skin name
- slash = strchr( v, '/' );
- if ( slash ) {
- Q_strncpyz( newInfo.skinName, slash + 1, sizeof( newInfo.skinName ) );
- }
- }
+ //Set skin&model
+ Q_strncpyz( newInfo.modelName, modelStr, sizeof( newInfo.modelName ) );
+ Q_strncpyz( newInfo.skinName, skin, sizeof( newInfo.skinName ) );
} else {
Q_strncpyz( newInfo.modelName, v, sizeof( newInfo.modelName ) );
slash = strchr( newInfo.modelName, '/' );
if ( !slash ) {
// modelName didn not include a skin name
-#ifndef SMOKINGUNS
- Q_strncpyz( newInfo.skinName, "default", sizeof( newInfo.skinName ) );
-#else
Q_strncpyz( newInfo.skinName, "red", sizeof( newInfo.skinName ) );
-#endif
} else {
Q_strncpyz( newInfo.skinName, slash + 1, sizeof( newInfo.skinName ) );
// truncate modelName
Index: code/game/g_client.c
===================================================================
--- code/game/g_client.c (revision 263)
+++ code/game/g_client.c (working copy)
@@ -1322,22 +1322,6 @@
}
*/
-#ifdef SMOKINGUNS
- // team skin in Smokin' Guns
- switch( team ) {
- case TEAM_RED:
- case TEAM_RED_SPECTATOR:
- ForceClientSkin(client, model, "red");
- ForceClientSkin(client, headModel, "red");
- break;
- case TEAM_BLUE:
- case TEAM_BLUE_SPECTATOR:
- ForceClientSkin(client, model, "blue");
- ForceClientSkin(client, headModel, "blue");
- break;
- }
-#endif
-
#ifndef SMOKINGUNS
if (g_gametype.integer >= GT_TEAM) {
client->pers.teamInfo = qtrue;