diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 743faa760..eab78e294 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -2764,6 +2764,8 @@ Create visible entities in the correct position for all current players ============= */ +vec3_t nametagorg[MAX_CLIENTS]; +qboolean nametagseen[MAX_CLIENTS]; void CL_LinkPlayers (void) { int pnum; @@ -2793,6 +2795,8 @@ void CL_LinkPlayers (void) for (j=0, info=cl.players, state=frame->playerstate ; j < MAX_CLIENTS ; j++, info++, state++) { + nametagseen[j] = false; + if (state->messagenum != cl.validsequence) { #ifdef CSQC_DAT @@ -2992,6 +2996,9 @@ void CL_LinkPlayers (void) VectorCopy (exact.origin, ent->origin); } + VectorCopy(ent->origin, nametagorg[j]); + nametagseen[j] = true; + if (state->effects & QWEF_FLAG1) CL_AddFlagModels (ent, 0); else if (state->effects & QWEF_FLAG2) @@ -3021,6 +3028,7 @@ void CL_LinkViewModel(void) static struct model_s *oldmodel[MAX_SPLITS]; static float lerptime[MAX_SPLITS]; + static float frameduration[MAX_SPLITS]; static int prevframe[MAX_SPLITS]; static int oldframe[MAX_SPLITS]; float alpha; @@ -3094,6 +3102,12 @@ void CL_LinkViewModel(void) if (ent.framestate.g[FS_REG].frame[0] != prevframe[r_refdef.currentplayernum]) { oldframe[r_refdef.currentplayernum] = ent.framestate.g[FS_REG].frame[1] = prevframe[r_refdef.currentplayernum]; + + frameduration[r_refdef.currentplayernum] = (realtime - lerptime[r_refdef.currentplayernum]); + if (frameduration[r_refdef.currentplayernum] < 0.01)//no faster than 100 times a second... to avoid divide by zero + frameduration[r_refdef.currentplayernum] = 0.01; + if (frameduration[r_refdef.currentplayernum] > 0.2) //no slower than 5 times a second + frameduration[r_refdef.currentplayernum] = 0.2; lerptime[r_refdef.currentplayernum] = realtime; } prevframe[r_refdef.currentplayernum] = ent.framestate.g[FS_REG].frame[0]; @@ -3102,9 +3116,10 @@ void CL_LinkViewModel(void) { oldmodel[r_refdef.currentplayernum] = ent.model; oldframe[r_refdef.currentplayernum] = ent.framestate.g[FS_REG].frame[1] = ent.framestate.g[FS_REG].frame[0]; + frameduration[r_refdef.currentplayernum] = 0.1; lerptime[r_refdef.currentplayernum] = realtime; } - ent.framestate.g[FS_REG].lerpfrac = 1-(realtime-lerptime[r_refdef.currentplayernum])*10; + ent.framestate.g[FS_REG].lerpfrac = 1-(realtime-lerptime[r_refdef.currentplayernum])/frameduration[r_refdef.currentplayernum]; ent.framestate.g[FS_REG].lerpfrac = bound(0, ent.framestate.g[FS_REG].lerpfrac, 1); } #define Q2RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors diff --git a/engine/client/client.h b/engine/client/client.h index 05d449d1d..3da69ef11 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -26,7 +26,12 @@ typedef struct char name[64]; int width; int height; - int cachedbpp; + + //for hardware 32bit texture overrides + int tex_base; + int tex_lower; + int tex_upper; + qboolean failedload; // the name isn't a valid skin cache_user_t cache; } skin_t; diff --git a/engine/client/p_classic.c b/engine/client/p_classic.c index 550d19225..3e8501145 100644 --- a/engine/client/p_classic.c +++ b/engine/client/p_classic.c @@ -1,3 +1,22 @@ +/* +Copyright (C) 1996-1997 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the included (GNU.txt) GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ #include "quakedef.h" #ifdef PSET_CLASSIC diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 5b4ad7ad4..e3783c72a 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -1,3 +1,22 @@ +/* +Copyright (C) 1996-1997 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the included (GNU.txt) GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ #include "quakedef.h" #define NUMVERTEXNORMALS 162 diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 359825484..b59760128 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -99,13 +99,8 @@ cvar_t r_floortexture = SCVARF ("r_floortexture", "", CVAR_RENDERERCALLBACK); cvar_t r_fullbright = SCVARF ("r_fullbright", "0", CVAR_CHEAT); -#ifdef MINIMAL cvar_t r_fullbrightSkins = SCVARF ("r_fullbrightSkins", "1", CVAR_SEMICHEAT); -#else -cvar_t r_fullbrightSkins = SCVARF ("r_fullbrightSkins", "0", - CVAR_SEMICHEAT); -#endif cvar_t r_lightmap_saturation = SCVAR ("r_lightmap_saturation", "1"); cvar_t r_lightstylesmooth = SCVAR ("r_lightstylesmooth", "0"); cvar_t r_lightstylespeed = SCVAR ("r_lightstylespeed", "10"); diff --git a/engine/client/skin.c b/engine/client/skin.c index ed0b6989b..89e022be7 100644 --- a/engine/client/skin.c +++ b/engine/client/skin.c @@ -222,6 +222,10 @@ qbyte *Skin_Cache8 (skin_t *skin) if (skin->failedload) return NULL; + skin->tex_base = 0; + skin->tex_lower = 0; + skin->tex_upper = 0; + out = Cache_Check (&skin->cache); if (out) return out; @@ -250,7 +254,6 @@ qbyte *Skin_Cache8 (skin_t *skin) skin->width = 320; skin->height = 200; - skin->cachedbpp = 8; out = Cache_Alloc (&skin->cache, 320*200, skin->name); @@ -272,6 +275,22 @@ qbyte *Skin_Cache8 (skin_t *skin) { if (strcmp(skin->name, baseskin.string)) { +#if defined(RGLQUAKE) || defined(D3DQUAKE) + if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D) + { + skin->tex_base = Mod_LoadReplacementTexture(skin->name, "skins", true, false, true); + if (skin->tex_base) + { + sprintf (name, "%s_shirt", skin->name); + skin->tex_upper = Mod_LoadReplacementTexture(name, "skins", true, true, true); + sprintf (name, "%s_pants", skin->name); + skin->tex_lower = Mod_LoadReplacementTexture(name, "skins", true, true, true); + + skin->failedload = true; + return NULL; + } + } +#endif //if its not already the base skin, try the base (and warn if anything not base couldn't load). Con_Printf ("Couldn't load skin %s\n", name); sprintf (name, "skins/%s.pcx", baseskin.string); @@ -301,8 +320,6 @@ qbyte *Skin_Cache8 (skin_t *skin) return NULL; } - skin->cachedbpp = 8; - pcx->xmax = (unsigned short)LittleShort(pcx->xmax); pcx->ymax = (unsigned short)LittleShort(pcx->ymax); pcx->xmin = (unsigned short)LittleShort(pcx->xmin); @@ -416,8 +433,6 @@ qbyte *Skin_Cache32 (skin_t *skin) else path = "skins/"; - skin->cachedbpp = 32; - // // load the pic from disk // diff --git a/engine/client/view.c b/engine/client/view.c index 2c655356b..dabe66f96 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -94,7 +94,7 @@ cvar_t v_gunkick = SCVAR("v_gunkick", "0"); cvar_t v_viewheight = SCVAR("v_viewheight", "0"); -cvar_t scr_autoid = SCVAR("scr_autoid", "0"); +cvar_t scr_autoid = SCVAR("scr_autoid", "1"); extern cvar_t cl_chasecam; @@ -1234,19 +1234,24 @@ void SCR_VRectForPlayer(vrect_t *vrect, int pnum) } } +void Draw_ExpandedString(int x, int y, conchar_t *str); +extern vec3_t nametagorg[MAX_CLIENTS]; +extern qboolean nametagseen[MAX_CLIENTS]; void R_DrawNameTags(void) { + conchar_t buffer[256]; int i; + int len; vec3_t center; vec3_t tagcenter; vec3_t waste, waste2; - frame_t *frame; - player_state_t *state; if (!cl.spectator && !cls.demoplayback) return; if (!scr_autoid.value) return; + if (cls.state != ca_active || !cl.validsequence) + return; #ifdef RGLQUAKE if (qrenderer == QR_OPENGL) @@ -1256,26 +1261,23 @@ void R_DrawNameTags(void) } #endif - frame = &cl.frames[cl.parsecount&UPDATE_MASK]; - state = frame->playerstate; - for (i = 0; i < MAX_CLIENTS; i++, state++) + for (i = 0; i < MAX_CLIENTS; i++) { - if (state->messagenum != cl.parsecount) - continue; // not present this frame + if (!nametagseen[i]) + continue; if (i == cl.playernum[r_refdef.currentplayernum]) continue; // Don't draw tag for the local player - if (Cam_DrawPlayer(r_refdef.currentplayernum, i) == false) - continue; // Don't draw tag for players not drawn on the map - if (view_frame && view_frame->playerstate[i].flags & PF_DEAD) - continue; // Don't draw tag for dead people - if (!TraceLineN(r_refdef.vieworg, state->origin, waste, waste2)) + + if (TP_IsPlayerVisible(nametagorg[i])) { - VectorCopy(state->origin, tagcenter); + VectorCopy(nametagorg[i], tagcenter); tagcenter[2] += 32; Matrix4_Project(tagcenter, center, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y); if (center[2] > 1) continue; - Draw_FunString(center[0]*r_refdef.vrect.width+r_refdef.vrect.x, (1-center[1])*r_refdef.vrect.height+r_refdef.vrect.y, cl.players[i].name); + + len = COM_ParseFunString(CON_WHITEMASK, cl.players[i].name, buffer, sizeof(buffer), false) - buffer; + Draw_ExpandedString(center[0]*r_refdef.vrect.width+r_refdef.vrect.x - len*4, (1-center[1])*r_refdef.vrect.height+r_refdef.vrect.y, buffer); } } } @@ -1339,7 +1341,7 @@ void V_RenderPlayerViews(int plnum) } else gl_ztrickdisabled&=~16; - + #ifdef SIDEVIEWS /* //adjust main view height to strip off the rearviews at the top @@ -1379,7 +1381,7 @@ void V_RenderPlayerViews(int plnum) continue; if (vsec_scaley[viewnum].value+vsec_y[viewnum].value > 1) continue; - + oldrect = r_refdef.vrect; memcpy(oldangles, r_refdef.viewangles, sizeof(vec3_t)); memcpy(oldposition, r_refdef.vieworg, sizeof(vec3_t)); @@ -1410,7 +1412,7 @@ void V_RenderPlayerViews(int plnum) r_refdef.vieworg[0]=r_refdef.vieworg[0];//*s+(1-s)*e->lerporigin[0]; r_refdef.vieworg[1]=r_refdef.vieworg[1];//*s+(1-s)*e->lerporigin[1]; r_refdef.vieworg[2]=r_refdef.vieworg[2];//*s+(1-s)*e->lerporigin[2]; - + r_refdef.viewangles[0]=e->angles[0];//*s+(1-s)*e->msg_angles[1][0]; r_refdef.viewangles[1]=e->angles[1];//*s+(1-s)*e->msg_angles[1][1]; r_refdef.viewangles[2]=e->angles[2];//*s+(1-s)*e->msg_angles[1][2]; @@ -1462,12 +1464,12 @@ void V_RenderView (void) if (r_worldentity.model) { RSpeedMark(); - + CL_AllowIndependantSendCmd(false); //work out which packet entities are solid CL_SetSolidEntities (); - + CL_EmitEntities(); // Set up prediction for other players @@ -1508,7 +1510,7 @@ void V_RenderView (void) { V_RenderPlayerViews(viewnum); } - + #ifdef PEXT_BULLETENS alreadyrendering=false; #endif diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index a857cff26..c4f17555c 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -2746,6 +2746,25 @@ static qboolean TP_IsItemVisible(item_vis_t *visitem) return false; } +//checks to see if a point at org the size of a player is visible or not +qboolean TP_IsPlayerVisible(vec3_t origin) +{ + item_vis_t visitem; + + VectorCopy(vpn, visitem.forward); + VectorCopy(vright, visitem.right); + VectorCopy(vup, visitem.up); + VectorCopy(r_origin, visitem.vieworg); + + VectorCopy (origin, visitem.entorg); + visitem.entorg[2] += 27; + VectorSubtract (visitem.entorg, visitem.vieworg, visitem.dir); + visitem.dist = DotProduct (visitem.dir, visitem.forward); + visitem.radius = 25; + + return TP_IsItemVisible(&visitem); +} + static float TP_RankPoint(item_vis_t *visitem) { vec3_t v2, v3; diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 3ce26be16..0b33186a0 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -366,6 +366,15 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur return &cm->texnum; } } + + if (e->scoreboard->skin->tex_base) + { + texnums = &cm->texnum; + texnums->loweroverlay = e->scoreboard->skin->tex_lower; + texnums->upperoverlay = e->scoreboard->skin->tex_upper; + texnums->base = e->scoreboard->skin->tex_base; + return texnums; + } cm->texnum.base = Mod_LoadHiResTexture(e->scoreboard->skin->name, "skins", true, false, true); return &cm->texnum; @@ -379,6 +388,15 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur original = Skin_Cache8(e->scoreboard->skin); inwidth = e->scoreboard->skin->width; inheight = e->scoreboard->skin->height; + + if (!original && e->scoreboard->skin->tex_base) + { + texnums = &cm->texnum; + texnums->loweroverlay = e->scoreboard->skin->tex_lower; + texnums->upperoverlay = e->scoreboard->skin->tex_upper; + texnums->base = e->scoreboard->skin->tex_base; + return texnums; + } } else { diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 92e07a1b4..bb7bae217 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -2193,8 +2193,6 @@ void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals) { char *s; int entnum; - client_t *cl, *sp; - int slen; entnum = G_EDICTNUM(prinst, OFS_PARM0); s = PF_VarString(prinst, 1, pr_globals);