diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 6f6368de8..448e6fb60 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -776,7 +776,7 @@ void CL_Disconnect (void) // stop sounds (especially looping!) S_StopAllSounds (true); -#ifdef VM_CGAME +#ifdef VM_CG CG_Stop(); #endif @@ -2566,7 +2566,7 @@ void Host_Frame (float time) return; // framerate is too high */ - Mod_Think(); + Mod_Think(); //think even on idle (which means small walls and a fast cpu can get more surfaces done. if (!CL_FilterTime(realtime - oldrealtime)) return; @@ -2589,10 +2589,13 @@ void Host_Frame (float time) return; #endif + cls.framecount++; + #ifdef NQPROT NET_Poll(); #endif + RSpeedRemark(); if (cls.downloadtype == dl_none && !*cls.downloadname && cl.downloadlist) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 6804257c6..fb7c97177 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1247,6 +1247,8 @@ void CL_ParseServerData (void) Stats_NewMap(); cl.servercount = svcnt; + cl.teamfortress = !Q_strcasecmp(str, "fortress"); + if (cl.gamedirchanged) { cl.gamedirchanged = false; @@ -2330,31 +2332,31 @@ void CL_NewTranslation (int slot) int i, j; int top, bottom; qbyte *dest, *source; - player_info_t *player; - char s[512]; #endif + char *s; + player_info_t *player; + + if (slot > MAX_CLIENTS) + Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS"); + + player = &cl.players[slot]; + + s = Skin_FindName (player); + COM_StripExtension(s, s); + if (player->skin && !stricmp(s, player->skin->name)) + player->skin = NULL; + + #ifdef RGLQUAKE if (qrenderer == QR_OPENGL) - { - if (slot > MAX_CLIENTS) - Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS"); - - cl.players[slot].skin = NULL; -// R_TranslatePlayerSkin(slot); + { //gl doesn't need to do anything except prevent the sys_error below. } else #endif #ifdef SWQUAKE if (qrenderer == QR_SOFTWARE) { - player = &cl.players[slot]; - - strcpy(s, Info_ValueForKey(player->userinfo, "skin")); - COM_StripExtension(s, s); - if (player->skin && !stricmp(s, player->skin->name)) - player->skin = NULL; - top = player->topcolor; bottom = player->bottomcolor; if (!cl.splitclients && !(cl.fpd & FPD_NO_FORCE_COLOR)) //no colour/skin forcing in splitscreen. diff --git a/engine/client/client.h b/engine/client/client.h index af8391866..13cd5cc33 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -273,6 +273,8 @@ typedef struct qboolean resendinfo; + int framecount; + // network stuff netchan_t netchan; float lastarbiatarypackettime; //used to mark when packets were sent to prevent mvdsv servers from causing us to disconnect. @@ -514,6 +516,8 @@ typedef struct int teamplay; int deathmatch; + + qboolean teamfortress; //*sigh*. This is used for teamplay stuff. This sucks. } client_state_t; extern int cl_teamtopcolor; @@ -523,8 +527,10 @@ extern int cl_enemybottomcolor; //FPD values //(commented out ones are ones that we don't support) +#define FPD_NO_FORCE_SKIN 256 #define FPD_NO_FORCE_COLOR 512 - +#define FPD_LIMIT_PITCH (1 << 14) //limit scripted pitch changes +#define FPD_LIMIT_YAW (1 << 15) //limit scripted yaw changes // // cvars @@ -779,6 +785,7 @@ typedef struct } pcx_t; +char *Skin_FindName (player_info_t *sc); void Skin_Find (player_info_t *sc); qbyte *Skin_Cache8 (skin_t *skin); qbyte *Skin_Cache32 (skin_t *skin); diff --git a/engine/client/skin.c b/engine/client/skin.c index ef1b3629f..3a50cd85e 100644 --- a/engine/client/skin.c +++ b/engine/client/skin.c @@ -23,6 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cvar_t baseskin = {"baseskin", "base"}; cvar_t noskins = {"noskins", "0"}; +extern cvar_t cl_teamskin; +extern cvar_t cl_enemyskin; + extern cvar_t r_fb_models; char allskins[128]; @@ -30,6 +33,75 @@ char allskins[128]; skin_t skins[MAX_CACHED_SKINS]; int numskins; +//returns the name +char *Skin_FindName (player_info_t *sc) +{ + int tracknum; + char *s; + static char name[MAX_OSPATH]; + + char *skinforcing_team; + + if (allskins[0]) + { + Q_strncpyz(name, allskins, sizeof(name)); + } + else + { + s = Info_ValueForKey(sc->userinfo, "skin"); + if (s && s[0]) + Q_strncpyz(name, s, sizeof(name)); + else + Q_strncpyz(name, baseskin.string, sizeof(name)); + } + + if (cl.spectator && (tracknum = Cam_TrackNum()) != -1) + skinforcing_team = cl.players[tracknum].team; + else if (cl.spectator) + skinforcing_team = "spec"; + else + skinforcing_team = cl.players[cl.playernum[0]].team; + + //Don't force skins in splitscreen (it's probable that the new skin would be wrong). + //Don't force skins in TF (where skins are forced on a class basis by the mod). + //Don't force skins on servers that have it disabled. + if (cl.splitclients<2 && !cl.teamfortress && !(cl.fpd & FPD_NO_FORCE_SKIN)) + { + char *skinname = NULL; + player_state_t *state; + qboolean teammate; + + teammate = (cl.teamplay && !strcmp(sc->team, skinforcing_team)) ? true : false; +/* + if (!cl.validsequence) + goto nopowerups; + + state = cl.frames[cl.parsecount & UPDATE_MASK].playerstate + (sc - cl.players); + + if (state->messagenum != cl.parsecount) + goto nopowerups; + + if ((state->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED)) + skinname = teammate ? cl_teambothskin.string : cl_enemybothskin.string; + else if (state->effects & EF_BLUE) + skinname = teammate ? cl_teamquadskin.string : cl_enemyquadskin.string; + else if (state->effects & EF_RED) + skinname = teammate ? cl_teampentskin.string : cl_enemypentskin.string; + + nopowerups: +*/ + if (!skinname || !skinname[0]) + skinname = teammate ? cl_teamskin.string : cl_enemyskin.string; + if (skinname[0] && !strchr(skinname, '/')) // a '/' in a skin name is deemed as a model name, so we ignore it. + Q_strncpyz(name, skinname, sizeof(name)); + } + + if (strstr(name, "..") || *name == '.') + Q_strncpyz(name, baseskin.string, sizeof(name)); + + return name; +} + /* ================ Skin_Find @@ -69,7 +141,9 @@ void Skin_Find (player_info_t *sc) COM_StripExtension (mn, name); } else - COM_StripExtension (s, name); + + s = Skin_FindName(sc); + COM_StripExtension (s, name); s = strchr(name, '/'); if (s) diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index 809bf39ef..bd7c5da43 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -43,8 +43,6 @@ typedef qboolean qbool; #define SP 0 -#define teamfortress spectator -#define framecount qport #define Com_Printf Con_Printf #define strlcpy Q_strncpyz