diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 33c0675e1..b795f92aa 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -486,7 +486,9 @@ void CL_Stop_f (void) { if (!cls.demorecording) { +#ifndef CLIENTONLY SV_MVDStop_f(); +#endif Con_Printf ("Not recording a demo.\n"); return; } diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 38e466467..537f372cd 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -578,7 +578,7 @@ void CL_ParsePacketEntities (qboolean delta) newp->num_entities = newindex; } -#ifdef NQPROT + entity_state_t *CL_FindOldPacketEntity(int num) { int pnum; @@ -597,6 +597,7 @@ entity_state_t *CL_FindOldPacketEntity(int num) } return NULL; } +#ifdef NQPROT // reset all entity fields (typically used if status changed) #define E5_FULLUPDATE (1<<0) // E5_ORIGIN32=0: short[3] = s->origin[0] * 8, s->origin[1] * 8, s->origin[2] * 8 diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 5597be26c..80edf5a88 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -189,7 +189,9 @@ CL_Quit_f */ void CL_Quit_f (void) { +#ifndef CLIENTONLY if (!isDedicated) +#endif { M_Menu_Quit_f (); return; @@ -558,7 +560,9 @@ void CLNQ_BeginServerConnect(void) #endif void CL_BeginServerReconnect(void) { +#ifndef CLIENTONLY if (isDedicated) +#endif { Con_TPrintf (TLC_DEDICATEDCANNOTCONNECT); return; @@ -859,7 +863,9 @@ void CL_Disconnect (void) #endif CL_StopUpload(); +#ifndef CLIENTONLY if (!isDedicated) +#endif SCR_EndLoadingPlaque(); } @@ -1383,7 +1389,11 @@ void CL_Startdemos_f (void) for (i=1 ; ibpp == -1) return false; @@ -1319,7 +1320,9 @@ qboolean R_ApplyRenderer (rendererstate_t *newr) if (qrenderer) //graphics stuff only when not dedicated { qbyte *data; +#ifndef CLIENTONLY isDedicated = false; +#endif v_gamma.modified = true; //force the gamma to be reset Con_Printf("Setting mode %i*%i*%i*%i\n", newr->width, newr->height, newr->bpp, newr->rate); @@ -1421,6 +1424,9 @@ TRACE(("dbg: R_ApplyRenderer: screen inited\n")); } else { +#ifdef CLIENTONLY + Host_Error("Tried setting dedicated mode\n"); +#else TRACE(("dbg: R_ApplyRenderer: isDedicated = true\n")); isDedicated = true; if (cls.state) @@ -1432,6 +1438,7 @@ TRACE(("dbg: R_ApplyRenderer: isDedicated = true\n")); } Sys_InitTerminal(); Con_PrintToSys(); +#endif } TRACE(("dbg: R_ApplyRenderer: initing mods\n")); Mod_Init(); @@ -1447,6 +1454,7 @@ TRACE(("dbg: R_ApplyRenderer: initing bulletein boards\n")); R_PreNewMap(); } +#ifndef CLIENTONLY if (sv.worldmodel) { edict_t *ent; @@ -1514,6 +1522,7 @@ TRACE(("dbg: R_ApplyRenderer: clearing world\n")); } #endif } +#endif #ifdef PLUGINS Plug_ResChanged(); #endif @@ -1616,9 +1625,9 @@ void R_RestartRenderer_f (void) { rendererstate_t oldr; rendererstate_t newr; - +#ifdef MENU_DAT MP_Shutdown(); - +#endif memset(&newr, 0, sizeof(newr)); TRACE(("dbg: R_RestartRenderer_f\n")); @@ -1717,8 +1726,9 @@ TRACE(("dbg: R_RestartRenderer_f\n")); } TRACE(("dbg: R_RestartRenderer_f success\n")); - +#ifdef MENU_DAT MP_Init(); +#endif } void R_SetRenderer_f (void) diff --git a/engine/client/resource.h b/engine/client/resource.h index 3e53da243..6e0d5a9f8 100644 --- a/engine/client/resource.h +++ b/engine/client/resource.h @@ -15,7 +15,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 121 +#define _APS_NEXT_RESOURCE_VALUE 122 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1005 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index 0cb74f7a1..4a4c0925c 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -755,7 +755,9 @@ void Sys_SendKeyEvents (void) if (!qrenderer) { +#ifndef CLIENTONLY SV_GetConsoleCommands (); +#endif return; } @@ -994,6 +996,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin /* main window message loop */ while (1) { +#ifndef CLIENTONLY if (isDedicated) { NET_Sleep(100, false); @@ -1006,6 +1009,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin SV_Frame (time); } else +#endif { // yield the CPU for a little while when paused, minimized, or not the focus if (((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing) && !media_filmtype) diff --git a/engine/client/view.c b/engine/client/view.c index 1d63ad475..e9fd83c44 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -1230,10 +1230,10 @@ void V_RenderPlayerViews(int plnum) int viewnum; SCR_VRectForPlayer(&r_refdef.vrect, plnum); view_message = &view_frame->playerstate[cl.playernum[plnum]]; - +#ifdef NQPROT if (cls.netcon) view_message->weaponframe = cl.stats[0][STAT_WEAPONFRAME]; - +#endif cl.simangles[plnum][ROLL] = 0; // FIXME @@@ diff --git a/engine/client/wad.c b/engine/client/wad.c index 7a691fa07..d9e84d25d 100644 --- a/engine/client/wad.c +++ b/engine/client/wad.c @@ -469,8 +469,10 @@ void Mod_ParseInfoFromEntityLump(char *data) //actually, this should be in the m wads[0] = '\0'; +#ifndef CLIENTONLY if (isDedicated) //don't bother return; +#endif R_SetSky("", 0, r_origin); diff --git a/engine/client/winquake.rc b/engine/client/winquake.rc index 7f8542b7d..f56f8914d 100644 --- a/engine/client/winquake.rc +++ b/engine/client/winquake.rc @@ -56,7 +56,7 @@ IDD_DIALOG1 DIALOGEX 0, 0, 67, 40 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE -FONT 16, "Times New Roman" +FONT 16, "Times New Roman", 0, 0, 0x1 BEGIN CTEXT "FTE QuakeWorld",IDC_STATIC,0,0,67,21,SS_CENTERIMAGE CTEXT "http://fte.quakesrc.org",IDC_STATIC,0,23,66,17, diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 32fe83f7a..0e1146582 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -67,12 +67,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MD3MODELS //we DO want to use quake3 alias models. This might be a minimal build, but we still want this. + #define CLIENTONLY + #else #define SIDEVIEWS 4 //enable secondary/reverse views. #define SP2MODELS //quake2 sprite models #define MD2MODELS //quake2 alias models #define MD3MODELS //quake3 alias models + #define ZYMOTICMODELS //zymotic skeletal models. #define HUFFNETWORK //huffman network compression #define HALFLIFEMODELS //halflife model support (experimental) #define DOOMWADS //doom wad/map/sprite support @@ -99,9 +102,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define R_XFLIP //allow view to be flipped horizontally #define IN_XFLIP //allow input to be flipped horizontally. #define TEXTEDITOR + #define PPL //per pixel lighting (stencil shadowing) #define PLUGINS + #define MENU_DAT //support for menu.dat + // #define VOICECHAT //experimental //these things were moved to plugins. diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 94115cdfd..0dbb2fc76 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -964,6 +964,7 @@ void IPX_CloseSocket (int socket) // sleeps msec or until net socket is ready //stdin can sometimes be a socket. As a result, //we give the option to select it for nice console imput with timeouts. +#ifndef CLIENTONLY qboolean NET_Sleep(int msec, qboolean stdinissocket) { struct timeval timeout; @@ -1004,6 +1005,7 @@ qboolean NET_Sleep(int msec, qboolean stdinissocket) return FD_ISSET(0, &fdset); return true; } +#endif void NET_GetLocalIP6Address (int socket) { diff --git a/engine/common/pmove.c b/engine/common/pmove.c index 1ddd3dbc0..79bd5cb42 100644 --- a/engine/common/pmove.c +++ b/engine/common/pmove.c @@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" +extern float pm_stepheight; + movevars_t movevars; playermove_t pmove; diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 3d00f7b2b..bd4aee049 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -76,7 +76,7 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, } if (num < hull->firstclipnode || num > hull->lastclipnode) - SV_Error ("Q1BSP_RecursiveHullCheck: bad node number"); + Host_Error ("Q1BSP_RecursiveHullCheck: bad node number"); // // find the point distances @@ -268,7 +268,7 @@ Rendering functions (Client only) Server only functions */ - +#ifndef CLIENTONLY extern int fatbytes; extern qbyte fatpvs[(MAX_MAP_LEAFS+1)/4]; @@ -386,6 +386,7 @@ void Q1BSP_FindTouchedLeafs(edict_t *ent) Q1BSP_RFindTouchedLeafs (ent, sv.worldmodel->nodes); } +#endif /* Server only functions diff --git a/engine/common/world.h b/engine/common/world.h index 56e27bbdc..630f5265b 100644 --- a/engine/common/world.h +++ b/engine/common/world.h @@ -85,6 +85,7 @@ typedef struct q2trace_s struct edict_s *ent; // not set by CM_*() functions } q2trace_t; +#ifndef CLIENTONLY #define MOVE_NORMAL 0 #define MOVE_NOMONSTERS 1 @@ -141,3 +142,5 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e edict_t *SV_TestPlayerPosition (edict_t *ent, vec3_t origin); + +#endif diff --git a/engine/ftequake/ftequake.dsp b/engine/ftequake/ftequake.dsp index 54ea68a90..4429f9964 100644 --- a/engine/ftequake/ftequake.dsp +++ b/engine/ftequake/ftequake.dsp @@ -405,42 +405,6 @@ SOURCE=..\server\pr_cmds.c # End Source File # Begin Source File -SOURCE=..\client\pr_menu.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# PROP Exclude_From_Build 1 -# ADD CPP /WX - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "ftequake - Win32 Q3Debug" - -!ELSEIF "$(CFG)" == "ftequake - Win32 Q3Release" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=..\server\savegame.c # End Source File # Begin Source File @@ -1489,6 +1453,42 @@ SOURCE=..\client\net_master.c # End Source File # Begin Source File +SOURCE=..\client\pr_menu.c + +!IF "$(CFG)" == "ftequake - Win32 Release" + +!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" + +!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" + +!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" + +!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" + +!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" + +!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" + +!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" + +!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" + +# PROP Exclude_From_Build 1 +# ADD CPP /WX + +!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "ftequake - Win32 Q3Debug" + +!ELSEIF "$(CFG)" == "ftequake - Win32 Q3Release" + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=..\client\r_bulleten.c !IF "$(CFG)" == "ftequake - Win32 Release" diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index c9e668a11..cc1852867 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -3,6 +3,10 @@ #include "shader.h" #include "hash.h" +#ifdef ZYMOTICMODELS +#define SKELETALMODELS +#endif + //FIXME typedef struct { @@ -95,8 +99,9 @@ typedef struct { //frame is an index into this typedef struct { +#ifdef SKELETALMODELS qboolean isskeletal; - +#endif int numposes; float rate; int poseofs; @@ -110,7 +115,7 @@ typedef struct { vec3_t scale_origin; } galiaspose_t; - +#ifdef SKELETALMODELS typedef struct { int parent; } galiasbone_t; @@ -121,6 +126,7 @@ typedef struct { int boneindex; vec4_t org; } galisskeletaltransforms_t; +#endif //we can't be bothered with animating skins. //We'll load up to four of them but after that you're on your own @@ -277,6 +283,7 @@ static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float } } +#ifdef SKELETALMODELS static void R_BuildSkeletalMesh(mesh_t *mesh, float *plerp, float **pose, int poses, galiasbone_t *bones, int bonecount, galisskeletaltransforms_t *weights, int numweights) { float bonepose[256][12]; @@ -340,6 +347,7 @@ static void R_BuildSkeletalMesh(mesh_t *mesh, float *plerp, float **pose, int po out[2] += v->org[0] * matrix[8] + v->org[1] * matrix[9] + v->org[2] * matrix[10] + v->org[3] * matrix[11]; } } +#endif static void R_GAliasAddDlights(mesh_t *mesh, vec3_t org, vec3_t angles) { @@ -486,6 +494,7 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i //we don't support meshes with one pose skeletal and annother not. //we don't support meshes with one group skeletal and annother not. +#ifdef SKELETALMODELS if (g1->isskeletal) { int l=0; @@ -531,6 +540,7 @@ static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, i R_BuildSkeletalMesh(mesh, plerp, pose, l, (galiasbone_t *)((char*)inf+inf->ofsbones), inf->numbones, (galisskeletaltransforms_t *)((char*)inf+inf->ofstransforms), inf->numtransforms); return false; } +#endif if (g1 == g2) //lerping within group is only done if not changing group { @@ -2846,7 +2856,7 @@ void GL_LoadQ3Model(model_t *mod, void *buffer) - +#ifdef ZYMOTICMODELS typedef struct zymlump_s @@ -3101,4 +3111,6 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer) memcpy (mod->cache.data, root, hunktotal); Hunk_FreeToLowMark (hunkstart); -} \ No newline at end of file +} + +#endif diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 556ff4a54..5bd347128 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -53,9 +53,8 @@ void GL_BindType (int type, int texnum) { if (gl_state.currenttextures[gl_state.currenttmu] == texnum) return; + gl_state.currenttextures[gl_state.currenttmu] = texnum; - - bindTexFunc (type, texnum); } diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 626ae2563..dd04db736 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -49,7 +49,9 @@ void Mod_LoadQ2BrushModel (model_t *mod, void *buffer); void Mod_LoadHLModel (model_t *mod, void *buffer); void Mod_LoadAlias3Model (model_t *mod, void *buffer); void Mod_LoadGroupModel (model_t *mod, void *buffer); +#ifdef ZYMOTICMODELS void GLMod_LoadZymoticModel(model_t *mod, void *buffer); +#endif model_t *GLMod_LoadModel (model_t *mod, qboolean crash); #ifdef DOOMWADS @@ -659,11 +661,11 @@ couldntload: case 29: //q1 GLMod_LoadBrushModel (mod, buf); break; - +#ifdef ZYMOTICMODELS case (('O'<<24)+('M'<<16)+('Y'<<8)+'Z'): GLMod_LoadZymoticModel(mod, buf); break; - +#endif default: Con_Printf("Unrecognised model format %i\n", LittleLong(*(unsigned *)buf)); goto couldntload; @@ -2586,15 +2588,18 @@ void GLMod_LoadBrushModel (model_t *mod, void *buffer) Mod_ParseInfoFromEntityLump(mod_base + header->lumps[LUMP_ENTITIES].fileofs); } - mod->funcs.FatPVS = Q1BSP_FatPVS; - mod->funcs.EdictInFatPVS = Q1BSP_EdictInFatPVS; - mod->funcs.FindTouchedLeafs_Q1 = Q1BSP_FindTouchedLeafs; mod->funcs.LightPointValues = GLQ1BSP_LightPointValues; mod->funcs.StainNode = Q1BSP_StainNode; mod->funcs.MarkLights = Q1BSP_MarkLights; mod->funcs.LeafForPoint = GLMod_LeafForPoint; mod->funcs.LeafPVS = GLMod_LeafnumPVS; + +#ifndef CLIENTONLY + mod->funcs.FindTouchedLeafs_Q1 = Q1BSP_FindTouchedLeafs; + mod->funcs.EdictInFatPVS = Q1BSP_EdictInFatPVS; + mod->funcs.FatPVS = Q1BSP_FatPVS; +#endif mod->numframes = 2; // regular and alternate animation diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index 337a5b182..6366045df 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -1555,8 +1555,9 @@ void PPL_BaseBModelTextures(entity_t *e) { for (k=0 ; kfuncs.MarkLights (&cl_dlights[k], 1<stl); - if (t->gl_texturenumbumpmap && gl_mtexarbable>2) + if (t->gl_texturenumbumpmap && gl_mtexarbable>3) { GL_MBind(GL_TEXTURE0_ARB, t->gl_texturenumbumpmap); glEnable(GL_TEXTURE_2D); @@ -1796,7 +1798,7 @@ void PPL_LightTextures(model_t *model, vec3_t modelorigin, dlight_t *light) GL_SelectTexture(GL_TEXTURE1_ARB); GL_BindType(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap); glEnable(GL_TEXTURE_CUBE_MAP_ARB); - GL_TexEnv(GL_COMBINE_ARB); //normalisation cubemap * normalmap + GL_TexEnv(GL_COMBINE_ARB); //normalisation cubemap . normalmap glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGB_ARB); @@ -1811,12 +1813,24 @@ void PPL_LightTextures(model_t *model, vec3_t modelorigin, dlight_t *light) glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); + + GL_MBind(GL_TEXTURE3_ARB, t->gl_texturenum); + glEnable(GL_TEXTURE_2D); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(3, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw); } else { - GL_TexEnv(GL_MODULATE); - glDisable(GL_TEXTURE_2D); + if (gl_mtexarbable>3) + { + GL_TexEnv(GL_MODULATE); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + GL_SelectTexture(GL_TEXTURE2_ARB); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } GL_SelectTexture(GL_TEXTURE1_ARB); GL_TexEnv(GL_MODULATE); glDisableClientState(GL_TEXTURE_COORD_ARRAY); @@ -1856,6 +1870,16 @@ void PPL_LightTextures(model_t *model, vec3_t modelorigin, dlight_t *light) } } + if (gl_mtexarbable>2) + { + GL_TexEnv(GL_MODULATE); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + GL_SelectTexture(GL_TEXTURE2_ARB); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } + GL_TexEnv(GL_MODULATE); glDisable(GL_TEXTURE_2D); @@ -1894,7 +1918,7 @@ void PPL_LightBModelTextures(entity_t *e, dlight_t *light) glEnableClientState(GL_COLOR_ARRAY); glColorPointer(3, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stl); - if (t->gl_texturenumbumpmap && gl_mtexarbable>2) + if (t->gl_texturenumbumpmap && gl_mtexarbable>3) { GL_MBind(GL_TEXTURE0_ARB, t->gl_texturenumbumpmap); glEnable(GL_TEXTURE_2D); @@ -1922,9 +1946,25 @@ void PPL_LightBModelTextures(entity_t *e, dlight_t *light) glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); + + GL_MBind(GL_TEXTURE3_ARB, t->gl_texturenum); + glEnable(GL_TEXTURE_2D); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(3, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw); } else { + if (gl_mtexarbable>3) + { + GL_TexEnv(GL_MODULATE); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + GL_SelectTexture(GL_TEXTURE2_ARB); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } + GL_TexEnv(GL_MODULATE); glDisable(GL_TEXTURE_2D); qglActiveTextureARB(GL_TEXTURE1_ARB); @@ -1965,6 +2005,17 @@ void PPL_LightBModelTextures(entity_t *e, dlight_t *light) PPL_FlushArrays(); } + if (gl_mtexarbable>2) + { + GL_TexEnv(GL_MODULATE); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + GL_SelectTexture(GL_TEXTURE2_ARB); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } + GL_TexEnv(GL_MODULATE); glDisable(GL_TEXTURE_2D); qglClientActiveTextureARB(GL_TEXTURE1_ARB); @@ -2034,6 +2085,7 @@ void PPL_DrawEntLighting(dlight_t *light) } } } +#endif void PPL_FullBrights(model_t *model) { @@ -2178,7 +2230,7 @@ void PPL_DrawEntFullBrights(void) - +#ifdef PPL @@ -3064,6 +3116,35 @@ void PPL_UpdateNodeShadowFrames(qbyte *lvis) #if 1 //DP's stolen code static void GL_Scissor (int x, int y, int width, int height) { +#if 0 //visible scissors + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho (0, glwidth, glheight, 0, -99999, 99999); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); +// GL_Set2D(); + + glColor4f(1,1,1,1); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE ); + glDisable(GL_TEXTURE_2D); + GL_TexEnv(GL_REPLACE); + + glBegin(GL_LINE_LOOP); + glVertex2f(x, y); + glVertex2f(x+glwidth, y); + glVertex2f(x+glwidth, y+glheight); + glVertex2f(x, y+glheight); + glEnd(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); +#endif qglScissor(x, glheight - (y + height),width,height); } @@ -3281,9 +3362,6 @@ void PPL_AddLight(dlight_t *dl) maxs[1] = dl->origin[1] + dl->radius; maxs[2] = dl->origin[2] + dl->radius; - if (R_CullBox(mins, maxs)) - return; - if (PPL_ScissorForBox(mins, maxs)) return; //was culled. @@ -3457,9 +3535,15 @@ void PPL_AddLight(dlight_t *dl) qglDisable(GL_SCISSOR_TEST); } +#endif + void PPL_DrawWorld (void) { dlight_t *l; +#if 0 + dlight_t *lc, *furthestprev; + float furthest; +#endif int i; vec3_t mins, maxs; @@ -3483,10 +3567,12 @@ void PPL_DrawWorld (void) // if (qglGetError()) // Con_Printf("GL Error on entities\n"); +#ifdef PPL if (r_shadows.value && glStencilFunc) { if (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife || cl.worldmodel->fromgame == fg_quake2 /*|| cl.worldmodel->fromgame == fg_quake3*/) { +// lc = NULL; for (l = cl_dlights, i=0 ; iradius || l->noppl) @@ -3508,32 +3594,67 @@ void PPL_DrawWorld (void) maxs[2] = l->origin[2] + l->radius; if (R_CullBox(mins, maxs)) continue; - if (R_CullSphere(l->origin, l->radius)) - continue; +// if (R_CullSphere(l->origin, l->radius*1.1)) +// continue; +#if 1 if (!maxshadowlights--) - break; + continue; +#else + VectorSubtract(l->origin, r_refdef.vieworg, mins) + l->dist = Length(mins); + VectorNormalize(mins); + l->dist*=1-sqrt(DotProduct(vpn, mins)*DotProduct(vpn, mins)); + l->next = lc; + lc = l; + maxshadowlights--; + } + while (maxshadowlights<0)//ooer... we exceeded our quota... strip the furthest ones out. + { + furthest = lc->dist; + furthestprev=NULL; + for (l = lc; l->next; l = l->next) + { + if (l->next->dist > furthest) + { + furthest = l->next->dist; + furthestprev = l; + } + } + if (furthestprev) + furthestprev->next = furthestprev->next->next; + else + lc = lc->next; + + maxshadowlights++; + } + + for (l = lc; l; l = l->next) //we now have our quotaed list + { +#endif if(!l->isstatic) { - l->color[0]*=2.5; - l->color[1]*=2.5; - l->color[2]*=2.5; + l->color[0]*=2.5; + l->color[1]*=2.5; + l->color[2]*=2.5; } TRACE(("dbg: calling PPL_AddLight\n")); PPL_AddLight(l); if(!l->isstatic) { - l->color[0]/=2.5; - l->color[1]/=2.5; - l->color[2]/=2.5; + l->color[0]/=2.5; + l->color[1]/=2.5; + l->color[2]/=2.5; } } glEnable(GL_TEXTURE_2D); + } glDisableClientState(GL_COLOR_ARRAY); } +#endif // if (qglGetError()) // Con_Printf("GL Error on shadow lighting\n"); diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index cc70b4e40..d14bf4d15 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -149,7 +149,7 @@ qboolean R_CullBox (vec3_t mins, vec3_t maxs) int i; for (i=0 ; i<4 ; i++) - if (BoxOnPlaneSide (mins, maxs, &frustum[i]) == 2) + if (BOX_ON_PLANE_SIDE (mins, maxs, &frustum[i]) == 2) return true; return false; } @@ -163,7 +163,7 @@ qboolean R_CullSphere (vec3_t org, float radius) for (i=0 ; i<4 ; i++) { d = DotProduct(frustum[i].normal, org)-frustum[i].dist; - if (d < -radius) + if (d <= -radius) return true; } return false; diff --git a/engine/gl/gl_rsurf.c b/engine/gl/gl_rsurf.c index 0ddab433d..261ddf39a 100644 --- a/engine/gl/gl_rsurf.c +++ b/engine/gl/gl_rsurf.c @@ -387,6 +387,9 @@ void GLR_AddDynamicLights (msurface_t *surf) if ( !(surf->dlightbits & (1<plane->normal) - surf->plane->dist; @@ -452,6 +455,9 @@ void GLR_AddDynamicLightNorms (msurface_t *surf) if ( !(surf->dlightbits & (1<plane->normal) - surf->plane->dist; diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index 0a5a59d11..0c5ec919e 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -263,12 +263,26 @@ void GLSCR_UpdateScreen (void) char *GLVID_GetRGBInfo(int prepadbytes, int *truewidth, int *trueheight) { //returns a BZ_Malloced array + extern qboolean gammaworks; + int i, c; qbyte *ret = BZ_Malloc(prepadbytes + glwidth*glheight*3); glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, ret + prepadbytes); *truewidth = glwidth; *trueheight = glheight; + + if (gammaworks) + { + c = prepadbytes+glwidth*glheight*3; + for (i=prepadbytes ; iedicts+i*ge->edict_size) #ifdef _WIN32 @@ -3465,3 +3466,5 @@ void SV_Init (quakeparms_t *parms) } } + +#endif diff --git a/engine/server/sv_move.c b/engine/server/sv_move.c index ef51efae9..8ee7bf198 100644 --- a/engine/server/sv_move.c +++ b/engine/server/sv_move.c @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "qwsvdef.h" +#ifndef CLIENTONLY + /* ============= SV_CheckBottom @@ -447,3 +449,4 @@ void SV_MoveToGoal (progfuncs_t *prinst, struct globalvars_s *pr_globals) } } +#endif diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index ed80b60d8..cbb21373c 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "qwsvdef.h" +#ifndef CLIENTONLY #include "winquake.h" #define Q_strncatz strncat @@ -838,7 +839,7 @@ void SV_MVDStop (int reason) SV_BroadcastPrintf (PRINT_CHAT, "Server recording canceled, demo removed\n"); -// Cvar_SetROM(&serverdemo, ""); + Cvar_ForceSet(Cvar_Get("serverdemo", "", CVAR_NOSET, ""), ""); return; } @@ -854,22 +855,33 @@ void SV_MVDStop (int reason) SV_MVDWritePackets(demo.parsecount - demo.lastwritten + 1); // finish up - if (!demo.disk) + + if (demo.file) { - fwrite(svs.demomem, 1, demo.size - demo_size, demo.file); - fflush(demo.file); + if (!demo.disk) + { + fwrite(svs.demomem, 1, demo.size - demo_size, demo.file); + fflush(demo.file); + } + + fclose (demo.file); + + demo.file = NULL; + } + else + { + UDP_CloseSocket(demo.tcpsocket); + demo.tcpsocket = 0; } - fclose (demo.file); - - demo.file = NULL; + sv.mvdrecording = false; if (!reason) SV_BroadcastPrintf (PRINT_CHAT, "Server recording completed\n"); else SV_BroadcastPrintf (PRINT_CHAT, "Server recording stoped\nMax demo size exceeded\n"); -// Cvar_SetROM(&serverdemo, ""); + Cvar_ForceSet(Cvar_Get("serverdemo", "", CVAR_NOSET, ""), ""); } /* @@ -984,13 +996,17 @@ static char *SV_PrintTeams(void) if (numcl == 2) // duel { _snprintf(buf, sizeof(buf), "team1 %s\nteam2 %s\n", clients[0]->name, clients[1]->name); - } else if (!teamplay.value) // ffa + } + else if (!teamplay.value) // ffa { _snprintf(buf, sizeof(buf), "players:\n"); for (i = 0; i < numcl; i++) _snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %s\n", clients[i]->name); - } else { // teamplay - for (j = 0; j < numt; j++) { + } + else + { // teamplay + for (j = 0; j < numt; j++) + { _snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "team %s:\n", teams[j]); for (i = 0; i < numcl; i++) if (!strcmp(Info_ValueForKey(clients[i]->userinfo, "team"), teams[j])) @@ -1004,13 +1020,13 @@ static char *SV_PrintTeams(void) return va("%s",buf); } -static void SV_MVD_Record (char *name) +static qboolean SV_MVD_Record (char *name, int tcpsocket) { sizebuf_t buf; char buf_data[MAX_QWMSGLEN]; int n, i; char *s, info[MAX_INFO_STRING], path[MAX_OSPATH]; - + client_t *player; char *gamedir; int seq = 1; @@ -1022,56 +1038,66 @@ static void SV_MVD_Record (char *name) demo.recorder.frames[i].entities.max_entities = MAX_MVDPACKET_ENTITIES; demo.recorder.frames[i].entities.entities = demo_entities[i]; } - + MVDBuffer_Init(&demo.dbuffer, demo.buffer, sizeof(demo.buffer)); MVDSetMsgBuf(NULL, &demo.frames[0].buf); demo.datagram.maxsize = sizeof(demo.datagram_data); demo.datagram.data = demo.datagram_data; - demo.file = fopen (name, "wb"); - if (!demo.file) + if (name) { - Con_Printf ("ERROR: couldn't open %s\n", name); - return; - } - - SV_InitRecord(); - - s = name + strlen(name); - while (*s != '/') s--; - Q_strncpyz(demo.name, s+1, sizeof(demo.name)); - Q_strncpyz(demo.path, sv_demoDir.string, sizeof(demo.path)); - - if (!*demo.path) - Q_strncpyz(demo.path, ".", MAX_OSPATH); - - SV_BroadcastPrintf (PRINT_CHAT, "Server starts recording (%s):\n%s\n", demo.disk ? "disk" : "memory", demo.name); -// Cvar_SetROM(&serverdemo, demo.name); - - Q_strncpyz(path, name, MAX_OSPATH); - Q_strncpyz(path + strlen(path) - 3, "txt", MAX_OSPATH - strlen(path) + 3); - - if (sv_demotxt.value) - { - FILE *f; - - f = fopen (path, "w+t"); - if (f != NULL) + demo.file = fopen (name, "wb"); + if (!demo.file) { - char buf[2000]; - date_t date; - - SV_TimeOfDay(&date); - - _snprintf(buf, sizeof(buf), "date %s\nmap %s\nteamplay %d\ndeathmatch %d\ntimelimit %d\n%s",date.str, sv.name, (int)teamplay.value, (int)deathmatch.value, (int)timelimit.value, SV_PrintTeams()); - fwrite(buf, strlen(buf),1,f); - fflush(f); - fclose(f); + Con_Printf ("ERROR: couldn't open %s\n", name); + return false; } + + SV_InitRecord(); + + s = name + strlen(name); + while (*s != '/') s--; + Q_strncpyz(demo.name, s+1, sizeof(demo.name)); + Q_strncpyz(demo.path, sv_demoDir.string, sizeof(demo.path)); + + if (!*demo.path) + Q_strncpyz(demo.path, ".", MAX_OSPATH); + + SV_BroadcastPrintf (PRINT_CHAT, "Server starts recording (%s):\n%s\n", demo.disk ? "disk" : "memory", demo.name); + Cvar_ForceSet(Cvar_Get("serverdemo", "", CVAR_NOSET, ""), demo.name); + + Q_strncpyz(path, name, MAX_OSPATH); + Q_strncpyz(path + strlen(path) - 3, "txt", MAX_OSPATH - strlen(path) + 3); + + if (sv_demotxt.value) + { + FILE *f; + + f = fopen (path, "w+t"); + if (f != NULL) + { + char buf[2000]; + date_t date; + + SV_TimeOfDay(&date); + + _snprintf(buf, sizeof(buf), "date %s\nmap %s\nteamplay %d\ndeathmatch %d\ntimelimit %d\n%s",date.str, sv.name, (int)teamplay.value, (int)deathmatch.value, (int)timelimit.value, SV_PrintTeams()); + fwrite(buf, strlen(buf),1,f); + fflush(f); + fclose(f); + } + } + else + Sys_remove(path); + } + else + { + if (demo.tcpsocket) + return false; + SV_BroadcastPrintf (PRINT_CHAT, "Server starts recording to network client\n"); + demo.tcpsocket = tcpsocket; } - else - Sys_remove(path); sv.mvdrecording = true; demo.pingtime = demo.time = sv.time; @@ -1327,6 +1353,7 @@ static void SV_MVD_Record (char *name) SV_WriteSetMVDMessage(); // done + return true; } /* @@ -1485,7 +1512,7 @@ void SV_MVD_Record_f (void) COM_DefaultExtension(name, ".mvd"); - SV_MVD_Record (name); + SV_MVD_Record (name, 0); } /* @@ -1720,7 +1747,7 @@ void SV_MVDEasyRecord_f (void) } while (f); } - SV_MVD_Record (name2); + SV_MVD_Record (name2, 0); } void SV_MVDList_f (void) @@ -2097,3 +2124,4 @@ void SV_MVDInit(void) Cmd_AddCommand ("rmdemonum", SV_MVDRemoveNum_f); } +#endif diff --git a/engine/server/sv_nchan.c b/engine/server/sv_nchan.c index 80f9b3d86..617532a56 100644 --- a/engine/server/sv_nchan.c +++ b/engine/server/sv_nchan.c @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // sv_nchan.c, user reliable data stream writes #include "qwsvdef.h" +#ifndef CLIENTONLY // check to see if client block will fit, if not, rotate buffers void ClientReliableCheckBlock(client_t *cl, int maxsize) @@ -258,3 +259,5 @@ void ClientReliableWrite_ZLib(client_t *cl, void *data, int len) // return i; } #endif + +#endif diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 9a6d87eff..689236a77 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // sv_phys.c #include "qwsvdef.h" - +#ifndef CLIENTONLY extern nqglobalvars_t realpr_nqglobal_struct; /* @@ -2053,3 +2053,4 @@ void SV_SetMoveVars(void) movevars.waterfriction = sv_waterfriction.value; movevars.entgravity = 1.0; } +#endif \ No newline at end of file diff --git a/engine/server/sv_rankin.c b/engine/server/sv_rankin.c index a716259fc..25841cff5 100644 --- a/engine/server/sv_rankin.c +++ b/engine/server/sv_rankin.c @@ -1,5 +1,7 @@ #include "qwsvdef.h" +#ifndef CLIENTONLY + #if defined(_WIN32) && !defined(MINGW) #define inline //_inline //fix for stupid VC #endif @@ -865,3 +867,4 @@ void Rank_Flush (void) //new game dir? } } #endif +#endif diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index 65508a9a8..c1d10da87 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "qwsvdef.h" +#ifndef CLIENTONLY + #define CHAN_AUTO 0 #define CHAN_WEAPON 1 #define CHAN_VOICE 2 @@ -1792,3 +1794,4 @@ void SV_SendMessagesToAll (void) SV_SendClientMessages (); } +#endif diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 8730aa637..2e78913ad 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // sv_user.c -- server code for moving users #include "qwsvdef.h" + +#ifndef CLIENTONLY + #include #define Q2EDICT_NUM(i) (q2edict_t*)((char *)ge->edicts+i*ge->edict_size) #define Q2NUM_FOR_EDICT(ent) (((char *)ent - (char *)ge->edicts) / ge->edict_size) @@ -4814,3 +4817,4 @@ void SV_ClientThink (void) SV_AirMove (); } +#endif diff --git a/engine/server/svq2_ents.c b/engine/server/svq2_ents.c index 2945cc34a..9846435ed 100644 --- a/engine/server/svq2_ents.c +++ b/engine/server/svq2_ents.c @@ -1,5 +1,7 @@ #include "qwsvdef.h" +#ifndef CLIENTONLY + #define Q2EDICT_NUM(i) (q2edict_t*)((char *)ge->edicts+i*ge->edict_size) #ifndef Q2SERVER @@ -772,4 +774,4 @@ void SVQ2_Ents_Init(void) } #endif - +#endif diff --git a/engine/server/world.c b/engine/server/world.c index 59968c740..7c8395bb1 100644 --- a/engine/server/world.c +++ b/engine/server/world.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "qwsvdef.h" +#ifndef CLIENTONLY /* entities never clip against themselves, or their owner @@ -1888,3 +1889,4 @@ trace_t SVQ2_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, } #endif +#endif