From 39990c213d3b75d187f9974d8df0b26dc81f5141 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 22 Jun 2005 17:10:13 +0000 Subject: [PATCH] I wonder how many things this will break... Anyway, made the renderer more modular (multiple gl renderers in the same binary, supported properly - menu still needs work). Rewrote parm1-16 handling, and added support for 17-32. Lightstyle smoothing cvar: r_lightstylesmooth git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1113 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/in_win.c | 4 - engine/client/merged.h | 90 ++++ engine/client/r_part.c | 102 +++- engine/client/render.h | 29 ++ engine/client/renderer.c | 836 +++++++++++++------------------- engine/common/bothdefs.h | 9 +- engine/ftequake/ftequake.dsp | 513 ++------------------ engine/gl/gl_rlight.c | 25 +- engine/gl/gl_vidnt.c | 4 +- engine/gl/gltod3d/gl_fakegl.cpp | 135 +++++- engine/server/pr_cmds.c | 21 +- engine/server/progdefs.h | 18 +- engine/server/progs.h | 4 + engine/server/savegame.c | 2 +- engine/server/server.h | 4 +- engine/server/sv_ents.c | 6 +- engine/server/sv_init.c | 14 +- engine/server/sv_main.c | 11 +- engine/server/sv_phys.c | 227 +++------ engine/server/sv_rankin.c | 23 + engine/server/sv_user.c | 136 ++++-- engine/sw/r_light.c | 28 +- 22 files changed, 990 insertions(+), 1251 deletions(-) diff --git a/engine/client/in_win.c b/engine/client/in_win.c index 451544043..375b6dac0 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -28,12 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #ifdef _MSC_VER -#ifdef AVAIL_DX7 -#pragma comment (lib, "../libs/dxsdk7/lib/dxguid.lib") -#else #pragma comment (lib, "dxguid.lib") #endif -#endif #define DINPUT_BUFFERSIZE 16 #define iDirectInputCreate(a,b,c,d) pDirectInputCreate(a,b,c,d) diff --git a/engine/client/merged.h b/engine/client/merged.h index 1fc71b199..270a66bfa 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -115,3 +115,93 @@ void Draw_FunString(int x, int y, unsigned char *str); #define Mod_Q1LeafPVS Mod_LeafPVS qbyte *Mod_LeafPVS (struct mleaf_s *leaf, struct model_s *model, qbyte *buffer); #endif + + + +typedef struct { + char *description; + char *name[4]; + r_qrenderer_t rtype; + + mpic_t *(*Draw_PicFromWad) (char *name); + mpic_t *(*Draw_SafePicFromWad) (char *name); + mpic_t *(*Draw_CachePic) (char *path); + mpic_t *(*Draw_SafeCachePic) (char *path); + void (*Draw_Init) (void); + void (*Draw_ReInit) (void); + void (*Draw_Character) (int x, int y, unsigned int num); + void (*Draw_ColouredCharacter) (int x, int y, unsigned int num); + void (*Draw_String) (int x, int y, const qbyte *str); + void (*Draw_Alt_String) (int x, int y, const qbyte *str); + void (*Draw_Crosshair) (void); + void (*Draw_DebugChar) (qbyte num); + void (*Draw_Pic) (int x, int y, mpic_t *pic); + void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); + void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); + void (*Draw_TransPic) (int x, int y, mpic_t *pic); + void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation); + void (*Draw_ConsoleBackground) (int lines); + void (*Draw_EditorBackground) (int lines); + void (*Draw_TileClear) (int x, int y, int w, int h); + void (*Draw_Fill) (int x, int y, int w, int h, int c); + void (*Draw_FadeScreen) (void); + void (*Draw_BeginDisc) (void); + void (*Draw_EndDisc) (void); + + void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic + void (*Draw_ImageColours) (float r, float g, float b, float a); + + void (*R_Init) (void); + void (*R_DeInit) (void); + void (*R_ReInit) (void); + void (*R_RenderView) (void); // must set r_refdef first + + void (*R_InitSky) (struct texture_s *mt); // called at level load + qboolean (*R_CheckSky) (void); + void (*R_SetSky) (char *name, float rotate, vec3_t axis); + + void (*R_NewMap) (void); + void (*R_PreNewMap) (void); + int (*R_LightPoint) (vec3_t point); + + void (*R_PushDlights) (void); + void (*R_AddStain) (vec3_t org, float red, float green, float blue, float radius); + void (*R_LessenStains) (void); + + void (*Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight); //input is bottom up... + void (*Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight); //top down + void (*Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette); //paletted topdown (framedata is 8bit indexes into palette) + + void (*Mod_Init) (void); + void (*Mod_ClearAll) (void); + struct model_s *(*Mod_ForName) (char *name, qboolean crash); + struct model_s *(*Mod_FindName) (char *name); + void *(*Mod_Extradata) (struct model_s *mod); // handles caching + void (*Mod_TouchModel) (char *name); + + struct mleaf_s *(*Mod_PointInLeaf) (float *p, struct model_s *model); + qbyte *(*Mod_Q1LeafPVS) (struct mleaf_s *leaf, struct model_s *model, qbyte *buffer); + void (*Mod_NowLoadExternal) (void); + void (*Mod_Think) (void); + qboolean(*Mod_GetTag) (struct model_s *model, int tagnum, int frame1, int frame2, float f2ness, float f1time, float f2time, float *result); + int (*Mod_TagNumForName) (struct model_s *model, char *name); + + + qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette); + void (*VID_DeInit) (void); + void (*VID_HandlePause) (qboolean pause); + void (*VID_LockBuffer) (void); + void (*VID_UnlockBuffer) (void); + void (*D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height); + void (*D_EndDirectRect) (int x, int y, int width, int height); + void (*VID_ForceLockState) (int lk); + int (*VID_ForceUnlockedAndReturnState) (void); + void (*VID_SetPalette) (unsigned char *palette); + void (*VID_ShiftPalette) (unsigned char *palette); + char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight); + void (*VID_SetWindowCaption) (char *msg); + + void (*SCR_UpdateScreen) (void); + + char *alignment; +} rendererinfo_t; diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 0612f92b3..6e4f26e3b 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -171,7 +171,7 @@ typedef struct part_type_s { float timelimit; - enum {PT_NORMAL, PT_BEAM, PT_DECAL} type; + enum {PT_NORMAL, PT_SPARK, PT_SPARKFAN, PT_TEXTUREDSPARK, PT_BEAM, PT_DECAL} type; enum {BM_MERGE, BM_ADD, BM_SUBTRACT} blendmode; float rotationstartmin, rotationstartrand; @@ -654,6 +654,12 @@ void P_ParticleEffect_f(void) { if (!strcmp(value, "beam")) ptype->type = PT_BEAM; + else if (!strcmp(value, "spark")) + ptype->type = PT_SPARK; + else if (!strcmp(value, "sparkfan") || !strcmp(value, "trianglefan")) + ptype->type = PT_SPARKFAN; + else if (!strcmp(value, "texturedspark")) + ptype->type = PT_TEXTUREDSPARK; else if (!strcmp(value, "decal")) ptype->type = PT_DECAL; else @@ -844,6 +850,16 @@ void P_ParticleEffect_f(void) if (ptype->friction) ptype->flags |= PT_FRICTION; + if (ptype->type == PT_NORMAL && !ptype->texname) + ptype->type = PT_SPARK; + if (ptype->type == PT_SPARK) + { + if (*ptype->texname) + ptype->type = PT_TEXTUREDSPARK; + if (ptype->scale) + ptype->type = PT_SPARKFAN; + } + if (ptype->rampmode && !ptype->ramp) { ptype->rampmode = RAMP_NONE; @@ -2824,12 +2840,6 @@ void GL_DrawTexturedParticle(particle_t *p, part_type_t *type) if (lasttype != type) { - if (type-part_type>=numparticletypes||type-part_type<0) //FIXME:! Work out why this is needed... - { - Con_Printf("Serious bug alert\n"); - return; - } - lasttype = type; qglEnd(); qglEnable(GL_TEXTURE_2D); @@ -2985,7 +2995,7 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type) qglBegin (GL_TRIANGLES); } -void GL_DrawSparkedParticle(particle_t *p, part_type_t *type) +void GL_DrawLineSparkParticle(particle_t *p, part_type_t *type) { if (lasttype != type) { @@ -3014,7 +3024,56 @@ void GL_DrawSparkedParticle(particle_t *p, part_type_t *type) p->rgb[2], 0); qglVertex3f (p->org[0]-p->vel[0]/10, p->org[1]-p->vel[1]/10, p->org[2]-p->vel[2]/10); +} +void GL_DrawTexturedSparkParticle(particle_t *p, part_type_t *type) +{ + vec3_t v, cr, o2, point; + if (lasttype != type) + { + lasttype = type; + qglEnd(); + qglEnable(GL_TEXTURE_2D); + GL_Bind(type->texturenum); + if (type->blendmode == BM_ADD) //addative + qglBlendFunc(GL_SRC_ALPHA, GL_ONE); +// else if (type->blendmode == BM_SUBTRACT) //subtractive +// qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + else + qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + qglShadeModel(GL_SMOOTH); + qglBegin(GL_QUADS); + } + + qglColor4f (p->rgb[0], + p->rgb[1], + p->rgb[2], + p->alpha); + + VectorSubtract(r_refdef.vieworg, p->org, v); + CrossProduct(v, p->vel, cr); + VectorNormalize(cr); + + VectorMA(p->org, -p->scale/2, cr, point); + qglTexCoord2f(0, 0); + qglVertex3fv(point); + VectorMA(p->org, p->scale/2, cr, point); + qglTexCoord2f(0, 1); + qglVertex3fv(point); + + + VectorMA(p->org, 0.1, p->vel, o2); + + VectorSubtract(r_refdef.vieworg, o2, v); + CrossProduct(v, p->vel, cr); + VectorNormalize(cr); + + VectorMA(o2, p->scale/2, cr, point); + qglTexCoord2f(1, 1); + qglVertex3fv(point); + VectorMA(o2, -p->scale/2, cr, point); + qglTexCoord2f(1, 0); + qglVertex3fv(point); } void GL_DrawSketchSparkParticle(particle_t *p, part_type_t *type) @@ -3364,7 +3423,7 @@ void SWD_DrawParticleBeam(beamseg_t *beam, part_type_t *type) } #endif -void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void sparklineparticles(particle_t*,part_type_t*), void sparkfanparticles(particle_t*,part_type_t*), void beamparticlest(beamseg_t*,part_type_t*), void beamparticlesut(beamseg_t*,part_type_t*), void drawdecalparticles(clippeddecal_t*,part_type_t*)) +void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void sparklineparticles(particle_t*,part_type_t*), void sparkfanparticles(particle_t*,part_type_t*), void sparktexturedparticles(particle_t*,part_type_t*), void beamparticlest(beamseg_t*,part_type_t*), void beamparticlesut(beamseg_t*,part_type_t*), void drawdecalparticles(clippeddecal_t*,part_type_t*)) { RSpeedMark(); @@ -3489,12 +3548,21 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void } else { - if (*type->texname) + switch(type->type) + { + default: pdraw = texturedparticles; - else if (type->scale || type->scaledelta) - pdraw = sparkfanparticles; - else + break; + case PT_SPARK: pdraw = sparklineparticles; + break; + case PT_SPARKFAN: + pdraw = sparkfanparticles; + break; + case PT_TEXTUREDSPARK: + pdraw = sparktexturedparticles; + break; + } } if (!type->die) @@ -3756,7 +3824,7 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void } } - if (type->type == PT_NORMAL) + if (type->type < PT_BEAM) RQ_AddDistReorder((void*)pdraw, p, type, p->org); } @@ -3877,9 +3945,9 @@ void P_DrawParticles (void) qglEnable(GL_POLYGON_OFFSET_FILL); qglBegin(GL_QUADS); if (r_drawflat.value == 2) - DrawParticleTypes(GL_DrawSketchParticle, GL_DrawSketchSparkParticle, GL_DrawSketchSparkParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured, GL_DrawClippedDecal); + DrawParticleTypes(GL_DrawSketchParticle, GL_DrawSketchSparkParticle, GL_DrawSketchSparkParticle, GL_DrawSketchSparkParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured, GL_DrawClippedDecal); else - DrawParticleTypes(GL_DrawTexturedParticle, GL_DrawSparkedParticle, GL_DrawTrifanParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured, GL_DrawClippedDecal); + DrawParticleTypes(GL_DrawTexturedParticle, GL_DrawLineSparkParticle, GL_DrawTrifanParticle, GL_DrawTexturedSparkParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured, GL_DrawClippedDecal); qglEnd(); qglDisable(GL_POLYGON_OFFSET_FILL); @@ -3901,7 +3969,7 @@ void P_DrawParticles (void) #ifdef SWQUAKE if (qrenderer == QR_SOFTWARE) { - DrawParticleTypes(SWD_DrawParticleBlob, SWD_DrawParticleSpark, SWD_DrawParticleSpark, SWD_DrawParticleBeam, SWD_DrawParticleBeam, NULL); + DrawParticleTypes(SWD_DrawParticleBlob, SWD_DrawParticleSpark, SWD_DrawParticleSpark, SWD_DrawParticleSpark, SWD_DrawParticleBeam, SWD_DrawParticleBeam, NULL); RSpeedRemark(); D_StartParticles(); diff --git a/engine/client/render.h b/engine/client/render.h index e0e369632..75819eb10 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -162,6 +162,7 @@ qboolean GLR_CheckSky(void); void GLR_AddEfrags (entity_t *ent); void GLR_RemoveEfrags (entity_t *ent); +void GLR_PreNewMap(void); void GLR_NewMap (void); void GLR_PushDlights (void); @@ -173,8 +174,23 @@ void GLR_LessenStains(void); void MediaGL_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette); void MediaGL_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down void MediaGL_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up... + +void GLR_SetSky (char *name, float rotate, vec3_t axis); +qboolean GLR_CheckSky(void); +void GLR_AddStain(vec3_t org, float red, float green, float blue, float radius); +void GLR_LessenStains(void); + +void GLVID_DeInit (void); +void GLR_DeInit (void); +void GLSCR_DeInit (void); + +int GLR_LightPoint (vec3_t p); #endif + + + + #if defined(SWQUAKE) void SWR_Init (void); void SWR_InitTextures (void); @@ -199,6 +215,17 @@ void SWR_LessenStains(void); void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette); void MediaSW_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down void MediaSW_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up... + +void SWR_SetSky (char *name, float rotate, vec3_t axis); +qboolean SWR_CheckSky(void); +void SWR_AddStain(vec3_t org, float red, float green, float blue, float radius); +void SWR_LessenStains(void); + +void SWVID_Shutdown (void); +void SWR_DeInit (void); +void SWSCR_DeInit (void); + +int SWR_LightPoint (vec3_t p); #endif void R_AddEfrags (entity_t *ent); @@ -327,6 +354,8 @@ extern cvar_t gl_polyblend; extern cvar_t gl_keeptjunctions; extern cvar_t gl_reporttjunctions; extern cvar_t r_flashblend; +extern cvar_t r_lightstylesmooth; +extern cvar_t r_lightstylespeed; extern cvar_t gl_nocolors; extern cvar_t gl_load24bit; extern cvar_t gl_finish; diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 29840552a..8a63201fd 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -10,30 +10,6 @@ qboolean vid_isfullscreen; -//move to headers - -void GLR_SetSky (char *name, float rotate, vec3_t axis); -qboolean GLR_CheckSky(void); -void GLR_AddStain(vec3_t org, float red, float green, float blue, float radius); -void GLR_LessenStains(void); - -void SWR_SetSky (char *name, float rotate, vec3_t axis); -qboolean SWR_CheckSky(void); -void SWR_AddStain(vec3_t org, float red, float green, float blue, float radius); -void SWR_LessenStains(void); - -void GLVID_DeInit (void); -void GLR_DeInit (void); -void GLSCR_DeInit (void); - -void SWVID_Shutdown (void); -void SWR_DeInit (void); -void SWSCR_DeInit (void); - -int SWR_LightPoint (vec3_t p); -int GLR_LightPoint (vec3_t p); -void GLR_PreNewMap(void); - #define VIDCOMMANDGROUP "Video config" #define GRAPHICALNICETIES "Graphical Nicaties" //or eyecandy, which ever you prefer. #define BULLETENVARS "BulletenBoard controls" @@ -101,7 +77,7 @@ cvar_t _vid_wait_override = {"_vid_wait_override", "0", NULL, CVAR_ARCHIVE|CVAR static cvar_t vid_stretch = {"vid_stretch","1", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //cvar_t _windowed_mouse = {"_windowed_mouse","1", CVAR_ARCHIVE}; static cvar_t gl_driver = {"gl_driver","", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //opengl library -cvar_t vid_renderer = {"vid_renderer", "", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; +cvar_t vid_renderer = {"vid_renderer", "", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //see R_RestartRenderer_f for the effective default 'if (newr.renderer == -1)'. static cvar_t vid_bpp = {"vid_bpp", "32", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; static cvar_t vid_allow_modex = {"vid_allow_modex", "1", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; @@ -197,6 +173,8 @@ extern cvar_t r_mirroralpha; extern cvar_t r_wateralpha; cvar_t r_dynamic = {"r_dynamic","1"}; cvar_t r_flashblend = {"gl_flashblend","0"}; +cvar_t r_lightstylesmooth = {"r_lightstylesmooth", "0"}; +cvar_t r_lightstylespeed = {"r_lightstylespeed", "10"}; extern cvar_t r_novis; extern cvar_t r_netgraph; @@ -462,6 +440,8 @@ void Renderer_Init(void) Cvar_Register(&r_dodgytgafiles, "Bug fixes"); Cvar_Register(&r_loadlits, GRAPHICALNICETIES); + Cvar_Register(&r_lightstylesmooth, GRAPHICALNICETIES); + Cvar_Register(&r_lightstylespeed, GRAPHICALNICETIES); Cvar_Register(&r_stains, GRAPHICALNICETIES); Cvar_Register(&r_stainfadetime, GRAPHICALNICETIES); @@ -630,314 +610,225 @@ r_qrenderer_t qrenderer=-1; char *q_renderername = "Non-Selected renderer"; - -struct { - char *name[4]; - r_qrenderer_t rtype; - - mpic_t *(*Draw_PicFromWad) (char *name); - mpic_t *(*Draw_SafePicFromWad) (char *name); - mpic_t *(*Draw_CachePic) (char *path); - mpic_t *(*Draw_SafeCachePic) (char *path); - void (*Draw_Init) (void); - void (*Draw_ReInit) (void); - void (*Draw_Character) (int x, int y, unsigned int num); - void (*Draw_ColouredCharacter) (int x, int y, unsigned int num); - void (*Draw_String) (int x, int y, const qbyte *str); - void (*Draw_Alt_String) (int x, int y, const qbyte *str); - void (*Draw_Crosshair) (void); - void (*Draw_DebugChar) (qbyte num); - void (*Draw_Pic) (int x, int y, mpic_t *pic); - void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); - void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); - void (*Draw_TransPic) (int x, int y, mpic_t *pic); - void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation); - void (*Draw_ConsoleBackground) (int lines); - void (*Draw_EditorBackground) (int lines); - void (*Draw_TileClear) (int x, int y, int w, int h); - void (*Draw_Fill) (int x, int y, int w, int h, int c); - void (*Draw_FadeScreen) (void); - void (*Draw_BeginDisc) (void); - void (*Draw_EndDisc) (void); - - void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic - void (*Draw_ImageColours) (float r, float g, float b, float a); - - void (*R_Init) (void); - void (*R_DeInit) (void); - void (*R_ReInit) (void); - void (*R_RenderView) (void); // must set r_refdef first - - void (*R_InitSky) (struct texture_s *mt); // called at level load - qboolean (*R_CheckSky) (void); - void (*R_SetSky) (char *name, float rotate, vec3_t axis); - - void (*R_NewMap) (void); - void (*R_PreNewMap) (void); - int (*R_LightPoint) (vec3_t point); - - void (*R_PushDlights) (void); - void (*R_AddStain) (vec3_t org, float red, float green, float blue, float radius); - void (*R_LessenStains) (void); - - void (*Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight); //input is bottom up... - void (*Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight); //top down - void (*Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette); //paletted topdown (framedata is 8bit indexes into palette) - - void (*Mod_Init) (void); - void (*Mod_ClearAll) (void); - struct model_s *(*Mod_ForName) (char *name, qboolean crash); - struct model_s *(*Mod_FindName) (char *name); - void *(*Mod_Extradata) (struct model_s *mod); // handles caching - void (*Mod_TouchModel) (char *name); - - struct mleaf_s *(*Mod_PointInLeaf) (float *p, struct model_s *model); - qbyte *(*Mod_Q1LeafPVS) (struct mleaf_s *leaf, struct model_s *model, qbyte *buffer); - void (*Mod_NowLoadExternal) (void); - void (*Mod_Think) (void); - qboolean(*Mod_GetTag) (model_t *model, int tagnum, int frame1, int frame2, float f2ness, float f1time, float f2time, float *result); - int (*Mod_TagNumForName) (struct model_s *model, char *name); - - - qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette); - void (*VID_DeInit) (void); - void (*VID_HandlePause) (qboolean pause); - void (*VID_LockBuffer) (void); - void (*VID_UnlockBuffer) (void); - void (*D_BeginDirectRect) (int x, int y, qbyte *pbitmap, int width, int height); - void (*D_EndDirectRect) (int x, int y, int width, int height); - void (*VID_ForceLockState) (int lk); - int (*VID_ForceUnlockedAndReturnState) (void); - void (*VID_SetPalette) (unsigned char *palette); - void (*VID_ShiftPalette) (unsigned char *palette); - char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight); - void (*VID_SetWindowCaption) (char *msg); - - void (*SCR_UpdateScreen) (void); - - char *alignment; -} rendererinfo[] = { - { //ALL builds need a 'none' renderer, as 0. - { - "none", - "dedicated", - "terminal", - "sw" - }, - QR_NONE, +rendererinfo_t dedicatedrendererinfo = { + //ALL builds need a 'none' renderer, as 0. + "Dedicated server", + { + "none", + "dedicated", + "terminal", + "sv" + }, + QR_NONE, - NULL, //Draw_PicFromWad; - NULL, //Draw_PicFromWad; //Not supported - NULL, //Draw_CachePic; - NULL, //Draw_SafeCachePic; - NULL, //Draw_Init; - NULL, //Draw_Init; - NULL, //Draw_Character; - NULL, //Draw_ColouredCharacter; - NULL, //Draw_String; - NULL, //Draw_Alt_String; - NULL, //Draw_Crosshair; - NULL, //Draw_DebugChar; - NULL, //Draw_Pic; - NULL, //Draw_SubPic; - NULL, //Draw_TransPic; - NULL, //Draw_TransPicTranslate; - NULL, //Draw_ConsoleBackground; - NULL, //Draw_EditorBackground; - NULL, //Draw_TileClear; - NULL, //Draw_Fill; - NULL, //Draw_FadeScreen; - NULL, //Draw_BeginDisc; - NULL, //Draw_EndDisc; - NULL, //I'm lazy. + NULL, //Draw_PicFromWad; + NULL, //Draw_PicFromWad; //Not supported + NULL, //Draw_CachePic; + NULL, //Draw_SafeCachePic; + NULL, //Draw_Init; + NULL, //Draw_Init; + NULL, //Draw_Character; + NULL, //Draw_ColouredCharacter; + NULL, //Draw_String; + NULL, //Draw_Alt_String; + NULL, //Draw_Crosshair; + NULL, //Draw_DebugChar; + NULL, //Draw_Pic; + NULL, //Draw_SubPic; + NULL, //Draw_TransPic; + NULL, //Draw_TransPicTranslate; + NULL, //Draw_ConsoleBackground; + NULL, //Draw_EditorBackground; + NULL, //Draw_TileClear; + NULL, //Draw_Fill; + NULL, //Draw_FadeScreen; + NULL, //Draw_BeginDisc; + NULL, //Draw_EndDisc; + NULL, //I'm lazy. - NULL, //Draw_Image - NULL, //Draw_ImageColours + NULL, //Draw_Image + NULL, //Draw_ImageColours - NULL, //R_Init; - NULL, //R_DeInit; - NULL, //R_ReInit; - NULL, //R_RenderView; - NULL, //R_InitSky; - NULL, //R_CheckSky; - NULL, //R_SetSky; + NULL, //R_Init; + NULL, //R_DeInit; + NULL, //R_ReInit; + NULL, //R_RenderView; + NULL, //R_InitSky; + NULL, //R_CheckSky; + NULL, //R_SetSky; - NULL, //R_NewMap; - NULL, //R_PreNewMap - NULL, //R_LightPoint; - NULL, //R_PushDlights; + NULL, //R_NewMap; + NULL, //R_PreNewMap + NULL, //R_LightPoint; + NULL, //R_PushDlights; - NULL, //R_AddStain; - NULL, //R_LessenStains; + NULL, //R_AddStain; + NULL, //R_LessenStains; - NULL, //Media_ShowFrameBGR_24_Flip; - NULL, //Media_ShowFrameRGBA_32; - NULL, //Media_ShowFrame8bit; + NULL, //Media_ShowFrameBGR_24_Flip; + NULL, //Media_ShowFrameRGBA_32; + NULL, //Media_ShowFrame8bit; #ifdef SWQUAKE - SWMod_Init, - SWMod_ClearAll, - SWMod_ForName, - SWMod_FindName, - SWMod_Extradata, - SWMod_TouchModel, + SWMod_Init, + SWMod_ClearAll, + SWMod_ForName, + SWMod_FindName, + SWMod_Extradata, + SWMod_TouchModel, - SWMod_PointInLeaf, - SWMod_LeafPVS, - SWMod_NowLoadExternal, - SWMod_Think, + SWMod_PointInLeaf, + SWMod_LeafPVS, + SWMod_NowLoadExternal, + SWMod_Think, #elif defined(RGLQUAKE) - GLMod_Init, - GLMod_ClearAll, - GLMod_ForName, - GLMod_FindName, - GLMod_Extradata, - GLMod_TouchModel, + GLMod_Init, + GLMod_ClearAll, + GLMod_ForName, + GLMod_FindName, + GLMod_Extradata, + GLMod_TouchModel, - GLMod_PointInLeaf, - GLMod_LeafPVS, - GLMod_NowLoadExternal, - GLMod_Think, + GLMod_PointInLeaf, + GLMod_LeafPVS, + GLMod_NowLoadExternal, + GLMod_Think, #else - #error "No renderer in client build" + #error "No renderer in client build" #endif - NULL, //Mod_GetTag - NULL, //fixme: server will need this one at some point. + NULL, //Mod_GetTag + NULL, //fixme: server will need this one at some point. - NULL, //VID_Init, - NULL, //VID_DeInit, - NULL, //VID_HandlePause, - NULL, //VID_LockBuffer, - NULL, //VID_UnlockBuffer, - NULL, //D_BeginDirectRect, - NULL, //D_EndDirectRect, - NULL, //VID_ForceLockState, - NULL, //VID_ForceUnlockedAndReturnState, - NULL, //VID_SetPalette, - NULL, //VID_ShiftPalette, - NULL, //VID_GetRGBInfo, + NULL, //VID_Init, + NULL, //VID_DeInit, + NULL, //VID_HandlePause, + NULL, //VID_LockBuffer, + NULL, //VID_UnlockBuffer, + NULL, //D_BeginDirectRect, + NULL, //D_EndDirectRect, + NULL, //VID_ForceLockState, + NULL, //VID_ForceUnlockedAndReturnState, + NULL, //VID_SetPalette, + NULL, //VID_ShiftPalette, + NULL, //VID_GetRGBInfo, - NULL, //set caption + NULL, //set caption - NULL, //SCR_UpdateScreen; + NULL, //SCR_UpdateScreen; + + "" +}; +rendererinfo_t *pdedicatedrendererinfo = &dedicatedrendererinfo; - "" - } #ifdef SWQUAKE - , +rendererinfo_t softwarerendererinfo = { + "Software rendering", { - { - "sw", - "software", - }, - QR_SOFTWARE, + "sw", + "software", + }, + QR_SOFTWARE, - SWDraw_PicFromWad, - SWDraw_PicFromWad, //Not supported - SWDraw_CachePic, - SWDraw_SafeCachePic, - SWDraw_Init, - SWDraw_Init, - SWDraw_Character, - SWDraw_ColouredCharacter, - SWDraw_String, - SWDraw_Alt_String, - SWDraw_Crosshair, - SWDraw_DebugChar, - SWDraw_Pic, - NULL,//SWDraw_ScaledPic, - SWDraw_SubPic, - SWDraw_TransPic, - SWDraw_TransPicTranslate, - SWDraw_ConsoleBackground, - SWDraw_EditorBackground, - SWDraw_TileClear, - SWDraw_Fill, - SWDraw_FadeScreen, - SWDraw_BeginDisc, - SWDraw_EndDisc, + SWDraw_PicFromWad, + SWDraw_PicFromWad, //Not supported + SWDraw_CachePic, + SWDraw_SafeCachePic, + SWDraw_Init, + SWDraw_Init, + SWDraw_Character, + SWDraw_ColouredCharacter, + SWDraw_String, + SWDraw_Alt_String, + SWDraw_Crosshair, + SWDraw_DebugChar, + SWDraw_Pic, + NULL,//SWDraw_ScaledPic, + SWDraw_SubPic, + SWDraw_TransPic, + SWDraw_TransPicTranslate, + SWDraw_ConsoleBackground, + SWDraw_EditorBackground, + SWDraw_TileClear, + SWDraw_Fill, + SWDraw_FadeScreen, + SWDraw_BeginDisc, + SWDraw_EndDisc, - SWDraw_Image, - SWDraw_ImageColours, + SWDraw_Image, + SWDraw_ImageColours, - SWR_Init, - SWR_DeInit, - NULL,//SWR_ReInit, - SWR_RenderView, + SWR_Init, + SWR_DeInit, + NULL,//SWR_ReInit, + SWR_RenderView, - SWR_InitSky, - SWR_CheckSky, - SWR_SetSky, + SWR_InitSky, + SWR_CheckSky, + SWR_SetSky, - SWR_NewMap, - NULL, - SWR_LightPoint, - SWR_PushDlights, + SWR_NewMap, + NULL, + SWR_LightPoint, + SWR_PushDlights, - SWR_AddStain, - SWR_LessenStains, + SWR_AddStain, + SWR_LessenStains, - MediaSW_ShowFrameBGR_24_Flip, - MediaSW_ShowFrameRGBA_32, - MediaSW_ShowFrame8bit, + MediaSW_ShowFrameBGR_24_Flip, + MediaSW_ShowFrameRGBA_32, + MediaSW_ShowFrame8bit, - SWMod_Init, - SWMod_ClearAll, - SWMod_ForName, - SWMod_FindName, - SWMod_Extradata, - SWMod_TouchModel, + SWMod_Init, + SWMod_ClearAll, + SWMod_ForName, + SWMod_FindName, + SWMod_Extradata, + SWMod_TouchModel, - SWMod_PointInLeaf, - SWMod_LeafPVS, - SWMod_NowLoadExternal, - SWMod_Think, + SWMod_PointInLeaf, + SWMod_LeafPVS, + SWMod_NowLoadExternal, + SWMod_Think, - NULL, //Mod_GetTag - NULL, //Mod_TagForName + NULL, //Mod_GetTag + NULL, //Mod_TagForName - SWVID_Init, - SWVID_Shutdown, - SWVID_HandlePause, - SWVID_LockBuffer, - SWVID_UnlockBuffer, - SWD_BeginDirectRect, - SWD_EndDirectRect, - SWVID_ForceLockState, - SWVID_ForceUnlockedAndReturnState, - SWVID_SetPalette, - SWVID_ShiftPalette, - SWVID_GetRGBInfo, + SWVID_Init, + SWVID_Shutdown, + SWVID_HandlePause, + SWVID_LockBuffer, + SWVID_UnlockBuffer, + SWD_BeginDirectRect, + SWD_EndDirectRect, + SWVID_ForceLockState, + SWVID_ForceUnlockedAndReturnState, + SWVID_SetPalette, + SWVID_ShiftPalette, + SWVID_GetRGBInfo, - NULL, + NULL, - SWSCR_UpdateScreen, + SWSCR_UpdateScreen, - "" - } -#else - , - { - { - NULL - } - } + "" +}; +rendererinfo_t *psoftwarerendererinfo = &softwarerendererinfo; #endif #ifdef RGLQUAKE - , - { +rendererinfo_t openglrendererinfo = { + "OpenGL", { "gl", "opengl", "hardware", }, - QR_SOFTWARE, + QR_OPENGL, GLDraw_PicFromWad, @@ -1026,21 +917,27 @@ struct { GLSCR_UpdateScreen, "" - } -#else - , - { - { - NULL - } - } +}; +rendererinfo_t *popenglrendererinfo = &openglrendererinfo; +#endif + +rendererinfo_t *pd3drendererinfo; + +rendererinfo_t **rendererinfo[] = +{ + &pdedicatedrendererinfo, +#ifdef SWQUAKE + &psoftwarerendererinfo, +#endif +#ifdef RGLQUAKE + &popenglrendererinfo, + &pd3drendererinfo, #endif }; - typedef struct vidmode_s { const char *description; @@ -1190,7 +1087,7 @@ void M_Menu_Video_f (void) #endif #ifdef RGLQUAKE "OpenGL", -#ifdef AVAIL_DX7 +#ifdef USE_D3D "Direct3D", #endif #endif @@ -1232,7 +1129,7 @@ void M_Menu_Video_f (void) #if defined(SWQUAKE) && defined(RGLQUAKE) if (qrenderer == QR_OPENGL) { -#ifdef AVAIL_DX7 +#ifdef USE_D3D if (!strcmp(vid_renderer.string, "d3d")) i = 2; else @@ -1241,7 +1138,7 @@ void M_Menu_Video_f (void) } else #endif -#if defined(RGLQUAKE) && defined(AVAIL_DX7) +#if defined(RGLQUAKE) && defined(USE_D3D) if (!strcmp(vid_renderer.string, "d3d")) i = 1; else @@ -1291,88 +1188,96 @@ void M_Menu_Video_f (void) void R_SetRenderer(int wanted) { - qrenderer = wanted; + rendererinfo_t *ri; if (wanted<0) - wanted=QR_NONE; - q_renderername = rendererinfo[wanted].name[0]; + { //-1 is used so we know when we've applied something instead of never setting anything. + wanted=0; + qrenderer = -1; + } + else + qrenderer = (*rendererinfo[wanted])->rtype; - Draw_PicFromWad = rendererinfo[wanted].Draw_PicFromWad; - Draw_SafePicFromWad = rendererinfo[wanted].Draw_SafePicFromWad; //Not supported - Draw_CachePic = rendererinfo[wanted].Draw_CachePic; - Draw_SafeCachePic = rendererinfo[wanted].Draw_SafeCachePic; - Draw_Init = rendererinfo[wanted].Draw_Init; - Draw_ReInit = rendererinfo[wanted].Draw_Init; - Draw_Character = rendererinfo[wanted].Draw_Character; - Draw_ColouredCharacter = rendererinfo[wanted].Draw_ColouredCharacter; - Draw_String = rendererinfo[wanted].Draw_String; - Draw_Alt_String = rendererinfo[wanted].Draw_Alt_String; - Draw_Crosshair = rendererinfo[wanted].Draw_Crosshair; - Draw_DebugChar = rendererinfo[wanted].Draw_DebugChar; - Draw_Pic = rendererinfo[wanted].Draw_Pic; - Draw_SubPic = rendererinfo[wanted].Draw_SubPic; - Draw_TransPic = rendererinfo[wanted].Draw_TransPic; - Draw_TransPicTranslate = rendererinfo[wanted].Draw_TransPicTranslate; - Draw_ConsoleBackground = rendererinfo[wanted].Draw_ConsoleBackground; - Draw_EditorBackground = rendererinfo[wanted].Draw_EditorBackground; - Draw_TileClear = rendererinfo[wanted].Draw_TileClear; - Draw_Fill = rendererinfo[wanted].Draw_Fill; - Draw_FadeScreen = rendererinfo[wanted].Draw_FadeScreen; - Draw_BeginDisc = rendererinfo[wanted].Draw_BeginDisc; - Draw_EndDisc = rendererinfo[wanted].Draw_EndDisc; - Draw_ScalePic = rendererinfo[wanted].Draw_ScalePic; + ri = (*rendererinfo[wanted]); - Draw_Image = rendererinfo[wanted].Draw_Image; - Draw_ImageColours = rendererinfo[wanted].Draw_ImageColours; + q_renderername = ri->name[0]; - R_Init = rendererinfo[wanted].R_Init; - R_DeInit = rendererinfo[wanted].R_DeInit; - R_RenderView = rendererinfo[wanted].R_RenderView; - R_NewMap = rendererinfo[wanted].R_NewMap; - R_PreNewMap = rendererinfo[wanted].R_PreNewMap; - R_LightPoint = rendererinfo[wanted].R_LightPoint; - R_PushDlights = rendererinfo[wanted].R_PushDlights; - R_InitSky = rendererinfo[wanted].R_InitSky; - R_CheckSky = rendererinfo[wanted].R_CheckSky; - R_SetSky = rendererinfo[wanted].R_SetSky; + Draw_PicFromWad = ri->Draw_PicFromWad; + Draw_SafePicFromWad = ri->Draw_SafePicFromWad; //Not supported + Draw_CachePic = ri->Draw_CachePic; + Draw_SafeCachePic = ri->Draw_SafeCachePic; + Draw_Init = ri->Draw_Init; + Draw_ReInit = ri->Draw_Init; + Draw_Character = ri->Draw_Character; + Draw_ColouredCharacter = ri->Draw_ColouredCharacter; + Draw_String = ri->Draw_String; + Draw_Alt_String = ri->Draw_Alt_String; + Draw_Crosshair = ri->Draw_Crosshair; + Draw_DebugChar = ri->Draw_DebugChar; + Draw_Pic = ri->Draw_Pic; + Draw_SubPic = ri->Draw_SubPic; + Draw_TransPic = ri->Draw_TransPic; + Draw_TransPicTranslate = ri->Draw_TransPicTranslate; + Draw_ConsoleBackground = ri->Draw_ConsoleBackground; + Draw_EditorBackground = ri->Draw_EditorBackground; + Draw_TileClear = ri->Draw_TileClear; + Draw_Fill = ri->Draw_Fill; + Draw_FadeScreen = ri->Draw_FadeScreen; + Draw_BeginDisc = ri->Draw_BeginDisc; + Draw_EndDisc = ri->Draw_EndDisc; + Draw_ScalePic = ri->Draw_ScalePic; - R_AddStain = rendererinfo[wanted].R_AddStain; - R_LessenStains = rendererinfo[wanted].R_LessenStains; + Draw_Image = ri->Draw_Image; + Draw_ImageColours = ri->Draw_ImageColours; - VID_Init = rendererinfo[wanted].VID_Init; - VID_DeInit = rendererinfo[wanted].VID_DeInit; - VID_HandlePause = rendererinfo[wanted].VID_HandlePause; - VID_LockBuffer = rendererinfo[wanted].VID_LockBuffer; - VID_UnlockBuffer = rendererinfo[wanted].VID_UnlockBuffer; - D_BeginDirectRect = rendererinfo[wanted].D_BeginDirectRect; - D_EndDirectRect = rendererinfo[wanted].D_EndDirectRect; - VID_ForceLockState = rendererinfo[wanted].VID_ForceLockState; - VID_ForceUnlockedAndReturnState = rendererinfo[wanted].VID_ForceUnlockedAndReturnState; - VID_SetPalette = rendererinfo[wanted].VID_SetPalette; - VID_ShiftPalette = rendererinfo[wanted].VID_ShiftPalette; - VID_GetRGBInfo = rendererinfo[wanted].VID_GetRGBInfo; + R_Init = ri->R_Init; + R_DeInit = ri->R_DeInit; + R_RenderView = ri->R_RenderView; + R_NewMap = ri->R_NewMap; + R_PreNewMap = ri->R_PreNewMap; + R_LightPoint = ri->R_LightPoint; + R_PushDlights = ri->R_PushDlights; + R_InitSky = ri->R_InitSky; + R_CheckSky = ri->R_CheckSky; + R_SetSky = ri->R_SetSky; - Media_ShowFrame8bit = rendererinfo[wanted].Media_ShowFrame8bit; - Media_ShowFrameRGBA_32 = rendererinfo[wanted].Media_ShowFrameRGBA_32; - Media_ShowFrameBGR_24_Flip = rendererinfo[wanted].Media_ShowFrameBGR_24_Flip; + R_AddStain = ri->R_AddStain; + R_LessenStains = ri->R_LessenStains; - Mod_Init = rendererinfo[wanted].Mod_Init; - Mod_Think = rendererinfo[wanted].Mod_Think; - Mod_ClearAll = rendererinfo[wanted].Mod_ClearAll; - Mod_ForName = rendererinfo[wanted].Mod_ForName; - Mod_FindName = rendererinfo[wanted].Mod_FindName; - Mod_Extradata = rendererinfo[wanted].Mod_Extradata; - Mod_TouchModel = rendererinfo[wanted].Mod_TouchModel; + VID_Init = ri->VID_Init; + VID_DeInit = ri->VID_DeInit; + VID_HandlePause = ri->VID_HandlePause; + VID_LockBuffer = ri->VID_LockBuffer; + VID_UnlockBuffer = ri->VID_UnlockBuffer; + D_BeginDirectRect = ri->D_BeginDirectRect; + D_EndDirectRect = ri->D_EndDirectRect; + VID_ForceLockState = ri->VID_ForceLockState; + VID_ForceUnlockedAndReturnState = ri->VID_ForceUnlockedAndReturnState; + VID_SetPalette = ri->VID_SetPalette; + VID_ShiftPalette = ri->VID_ShiftPalette; + VID_GetRGBInfo = ri->VID_GetRGBInfo; - Mod_PointInLeaf = rendererinfo[wanted].Mod_PointInLeaf; - Mod_Q1LeafPVS = rendererinfo[wanted].Mod_Q1LeafPVS; - Mod_NowLoadExternal = rendererinfo[wanted].Mod_NowLoadExternal; + Media_ShowFrame8bit = ri->Media_ShowFrame8bit; + Media_ShowFrameRGBA_32 = ri->Media_ShowFrameRGBA_32; + Media_ShowFrameBGR_24_Flip = ri->Media_ShowFrameBGR_24_Flip; - Mod_GetTag = rendererinfo[wanted].Mod_GetTag; - Mod_TagNumForName = rendererinfo[wanted].Mod_TagNumForName; + Mod_Init = ri->Mod_Init; + Mod_Think = ri->Mod_Think; + Mod_ClearAll = ri->Mod_ClearAll; + Mod_ForName = ri->Mod_ForName; + Mod_FindName = ri->Mod_FindName; + Mod_Extradata = ri->Mod_Extradata; + Mod_TouchModel = ri->Mod_TouchModel; + + Mod_PointInLeaf = ri->Mod_PointInLeaf; + Mod_Q1LeafPVS = ri->Mod_Q1LeafPVS; + Mod_NowLoadExternal = ri->Mod_NowLoadExternal; + + Mod_GetTag = ri->Mod_GetTag; + Mod_TagNumForName = ri->Mod_TagNumForName; - SCR_UpdateScreen = rendererinfo[wanted].SCR_UpdateScreen; + SCR_UpdateScreen = ri->SCR_UpdateScreen; } static qbyte default_quakepal[768] = @@ -1477,20 +1382,23 @@ qboolean R_ApplyRenderer (rendererstate_t *newr) { #ifdef SWQUAKE float f; - data = host_colormap = BZ_Malloc(256*VID_GRADES+sizeof(int)); - //let's try making one. this is probably caused by running out of baseq2. - for (j = 0; j < VID_GRADES; j++) + if (qrenderer == QR_SOFTWARE) //glquake doesn't care { - f = 1 - ((float)j/VID_GRADES); - for (i = 0; i < 256-vid.fullbright; i++) + data = host_colormap = BZ_Malloc(256*VID_GRADES+sizeof(int)); + //let's try making one. this is probably caused by running out of baseq2. + for (j = 0; j < VID_GRADES; j++) { - data[i] = GetPalette(host_basepal[i*3+0]*f, host_basepal[i*3+1]*f, host_basepal[i*3+2]*f); + f = 1 - ((float)j/VID_GRADES); + for (i = 0; i < 256-vid.fullbright; i++) + { + data[i] = GetPalette(host_basepal[i*3+0]*f, host_basepal[i*3+1]*f, host_basepal[i*3+2]*f); + } + for (; i < 256; i++) + data[i] = i; + data+=256; } - for (; i < 256; i++) - data[i] = i; - data+=256; } -#endif //glquake doesn't really care. +#endif vid.fullbright=0; } @@ -1521,7 +1429,7 @@ TRACE(("dbg: R_ApplyRenderer: Palette loaded\n")); } TRACE(("dbg: R_ApplyRenderer: vid applied\n")); -#ifdef RGLQUAKE +#ifdef RGLQUAKE //fixme: should we scrap this in favor of only hardware gamma? if (qrenderer == QR_OPENGL) GLV_UpdatePalette(); #endif @@ -1544,7 +1452,10 @@ TRACE(("dbg: R_ApplyRenderer: screen inited\n")); else { #ifdef CLIENTONLY - Host_Error("Tried setting dedicated mode\n"); + Sys_Error("Tried setting dedicated mode\n"); + //we could support this, but there's no real reason to actually do so. + + //fixme: despite the checks in the setrenderer command, we can still get here via a config using vid_renderer. #else TRACE(("dbg: R_ApplyRenderer: isDedicated = true\n")); isDedicated = true; @@ -1750,6 +1661,7 @@ TRACE(("dbg: R_ApplyRenderer: efrags\n")); void R_RestartRenderer_f (void) { + int i, j; rendererstate_t oldr; rendererstate_t newr; #ifdef MENU_DAT @@ -1773,8 +1685,25 @@ TRACE(("dbg: R_RestartRenderer_f\n")); newr.rate = vid_refreshrate.value; Q_strncpyz(newr.glrenderer, gl_driver.string, sizeof(newr.glrenderer)); - if (!*vid_renderer.string) + newr.renderer = -1; + for (i = 0; i < sizeof(rendererinfo)/sizeof(rendererinfo[0]); i++) { + if (!*rendererinfo[i]) + continue; //not valid in this build. :( + for (j = 4-1; j >= 0; j--) + { + if (!(*rendererinfo[i])->name[j]) + continue; + if (!stricmp((*rendererinfo[i])->name[j], vid_renderer.string)) + { + newr.renderer = i; + break; + } + } + } + if (newr.renderer == -1) + { + Con_Printf("vid_renderer unset or invalid. Using default.\n"); //gotta do this after main hunk is saved off. #if defined(RGLQUAKE) && defined(SWQUAKE) Cmd_ExecuteString("setrenderer sw 8\n", RESTRICT_LOCAL); @@ -1788,37 +1717,6 @@ TRACE(("dbg: R_RestartRenderer_f\n")); return; } -#ifdef SWQUAKE - if (!stricmp(vid_renderer.string, "sw") || !stricmp(vid_renderer.string, "software")) - newr.renderer = QR_SOFTWARE; - else -#endif -#ifdef RGLQUAKE - if (!stricmp(vid_renderer.string, "gl") || !stricmp(vid_renderer.string, "opengl")) - newr.renderer = QR_OPENGL; - else -#endif -#if defined(RGLQUAKE) && defined(AVAIL_DX7) - if (!stricmp(vid_renderer.string, "d3d") || !stricmp(vid_renderer.string, "dx")) - { - newr.renderer = QR_OPENGL; //direct3d is done via a gl->d3d wrapper. - Q_strncpyz(newr.glrenderer, "d3d", sizeof(newr.glrenderer)); - } - else -#endif -#ifndef CLIENTONLY - if (!stricmp(vid_renderer.string, "sv") || !stricmp(vid_renderer.string, "dedicated")) - newr.renderer = QR_NONE; - else -#endif -#if defined(SWQUAKE) - newr.renderer = QR_SOFTWARE; -#elif defined(RGLQUAKE) - newr.renderer = QR_OPENGL; -#else -#error "no default renderer" -#endif - TRACE(("dbg: R_RestartRenderer_f renderer %i\n", newr.renderer)); memcpy(&oldr, ¤trendererstate, sizeof(rendererstate_t)); @@ -1832,12 +1730,13 @@ TRACE(("dbg: R_RestartRenderer_f\n")); } else { + //failed, try dedicated as a last ditch effort to avoid having to edit configs. newr.renderer = QR_NONE; if (R_ApplyRenderer(&newr)) { TRACE(("dbg: R_RestartRenderer_f going to dedicated\n")); Con_Printf("\n================================\n"); - Con_Printf("^1Video mode switch failed. Old mode wasn't supported either. Console forced.\nChange vid_mode to a compatable mode, and then use the setrenderer command.\n"); + Con_Printf("^1Video mode switch failed. Old mode wasn't supported either. Console forced.\nChange vid_width, vid_height, vid_bpp, vid_displayfrequency to a compatable mode, and then use the setrenderer command.\n"); Con_Printf("================================\n\n"); } else @@ -1854,103 +1753,58 @@ TRACE(("dbg: R_RestartRenderer_f\n")); void R_SetRenderer_f (void) { - if (!strcmp(Cmd_Argv(1), "help")) + int i, j; + int best; + char *param = Cmd_Argv(1); + if (Cmd_Argc() == 1 || !stricmp(param, "help")) { - Con_Printf ("\nValid commands are:\n" -#ifdef SWQUAKE - "%s SW 8 will set 8bit software rendering\n" - "%s SW 32 will set 32 bit software rendering\n" -#endif //SWQUAKE -#ifdef RGLQUAKE - "%s GL will use the default OpenGL on your pc\n" - "%s GL 3dfxgl will use a 3dfx minidriver (not supplied)\n" - #ifdef AVAIL_DX7 - "%s D3D will use direct3d rendering\n" - #endif -#endif - "\n" -#ifdef SWQUAKE - ,Cmd_Argv(0),Cmd_Argv(0) -#endif -#ifdef RGLQUAKE - ,Cmd_Argv(0),Cmd_Argv(0) - #ifdef AVAIL_DX7 - ,Cmd_Argv(0) - #endif -#endif - ); + Con_Printf ("\nValid setrenderer parameters are:\n"); + for (i = 0; i < sizeof(rendererinfo)/sizeof(rendererinfo[0]); i++) + { + if ((*rendererinfo[i])) + Con_Printf("%s: %s\n", (*rendererinfo[i])->name[0], (*rendererinfo[i])->description); + } return; } - else if (!stricmp(Cmd_Argv(1), "dedicated")) + + best = -1; + for (i = 0; i < sizeof(rendererinfo)/sizeof(rendererinfo[0]); i++) { - Cvar_Set(&vid_renderer, "dedicated"); - R_RestartRenderer_f(); - } - else if (!stricmp(Cmd_Argv(1), "SW") || !stricmp(Cmd_Argv(1), "Software")) - { -#ifndef SWQUAKE - Con_Printf("Software rendering is not supported in this binary\n"); -#else - if (Cmd_Argc() >= 3) //set vid_use32bit accordingly. + if (!*rendererinfo[i]) + continue; //not valid in this build. :( + for (j = 4-1; j >= 0; j--) { - switch(atoi(Cmd_Argv(2))) + if (!(*rendererinfo[i])->name[j]) + continue; + if (!stricmp((*rendererinfo[i])->name[j], param)) { - default: - Con_Printf ("The parameter you specified is not linked to the software renderer."); - return; - case 32: - Cvar_Set(&vid_bpp, "32"); - break; - case 8: - Cvar_Set(&vid_bpp, "8"); + best = i; break; } } - Cvar_Set(&vid_renderer, "sw"); - - R_RestartRenderer_f(); - -#endif } - else if (!stricmp(Cmd_Argv(1), "GL") || !stricmp(Cmd_Argv(1), "OpenGL")) + +#ifdef CLIENTONLY + if (best == 0) { -#ifndef RGLQUAKE - Con_Printf("OpenGL rendering is not supported in this binary\n"); -#else - if (Cmd_Argc() == 3) //set gl_driver accordingly. - Cvar_Set(&gl_driver, Cmd_Argv(2)); - - Cvar_ForceSet(&vid_renderer, "gl"); - - if (vid_bpp.value == 8) - Cvar_Set(&vid_bpp, "16"); - - R_RestartRenderer_f(); -#endif + Con_Printf("Client-only builds cannot use dedicated modes.\n"); + return; } - else if (!stricmp(Cmd_Argv(1), "D3D") || !stricmp(Cmd_Argv(1), "DX")) - { -#if defined(RGLQUAKE) && defined(AVAIL_DX7) - Cvar_Set(&vid_renderer, "d3d"); - - if (vid_bpp.value == 8) - Cvar_Set(&vid_bpp, "16"); - - R_RestartRenderer_f(); -#else - Con_Printf("Direct3D rendering is not supported in this binary\n"); #endif - } - else if (Cmd_Argc() < 2) + + if (best == -1) { - Con_Printf ("%s: Switch to a different renderer\n\ttype %s help for more info.\n", Cmd_Argv(0), Cmd_Argv(0)); + Con_Printf("setrenderer: parameter not supported (%s)\n", param); return; } else { - Con_Printf ("%s: Parameters are bad.\n\ttype %s help for more info.\n", Cmd_Argv(0), Cmd_Argv(0)); - return; + if (Cmd_Argc() == 3) + Cvar_Set(&vid_bpp, Cmd_Argv(2)); } + + Cvar_Set(&vid_renderer, param); + R_RestartRenderer_f(); } diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index caf729ef7..71bc080fe 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -61,9 +61,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef NO_OGG #undef AVAIL_OGGVORBIS #endif -#if defined(NO_D3D) || !defined(_WIN32) - #undef AVAIL_DX7 -#endif #if defined(NO_MASM) || !defined(_WIN32) #undef AVAIL_MASM #endif @@ -88,7 +85,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef AVAIL_JPEGLIB //no jpeg support #undef AVAIL_PNGLIB //no png support #undef USE_MADLIB //no internal mp3 playing - #undef AVAIL_DX7 //no d3d support + #undef USE_D3D //no d3d support #define NOMEDIA //NO playing of avis/cins/roqs #define MD3MODELS //we DO want to use quake3 alias models. This might be a minimal build, but we still want this. @@ -172,8 +169,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #endif -#ifdef NODIRECTX - #undef AVAIL_DX7 +#if defined(NODIRECTX) || (!defined(GLQUAKE) && !defined(RGLQUAKE)) + #undef USE_D3D #endif diff --git a/engine/ftequake/ftequake.dsp b/engine/ftequake/ftequake.dsp index f7a5877d2..9fe2ad627 100644 --- a/engine/ftequake/ftequake.dsp +++ b/engine/ftequake/ftequake.dsp @@ -63,7 +63,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /machine:I386 /out:"../../fteswqw.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /machine:I386 /out:"../../fteswqw.exe" /libpath:"../libs/dxsdk7/lib" !ELSEIF "$(CFG)" == "ftequake - Win32 Debug" @@ -89,7 +89,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 comctl32.lib wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteswqw_dbg.exe" +# ADD LINK32 comctl32.lib wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteswqw_dbg.exe" /libpath:"../libs/dxsdk7/lib" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" @@ -117,7 +117,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteglqw_dbg.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteglqw_dbg.exe" /libpath:"../libs/dxsdk7/lib" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" @@ -145,7 +145,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 comctl32.lib ..\dxsdk\sdk\lib\dxguid.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /machine:I386 /out:"../../../fteqw.exe" -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /map /machine:I386 /out:"../../fteglqw.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /map /machine:I386 /out:"../../fteglqw.exe" /libpath:"../libs/dxsdk7/lib" # SUBTRACT LINK32 /debug !ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" @@ -163,7 +163,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NQPROT" /D "_DEBUG" /D "GLQUAKE" /D "SERVERDLL" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c -# ADD CPP /nologo /G5 /W3 /Gi /GX /ZI /Od /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "AVAIL_DX7" /Fr /Fp".\MDebug/qwcl.pch" /Yu"quakedef.h" /FD /c +# ADD CPP /nologo /G5 /W3 /Gi /GX /ZI /Od /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "USE_D3D" /Fr /Fp".\MDebug/qwcl.pch" /Yu"quakedef.h" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -174,7 +174,7 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../fteglqw.exe" # SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../../fteqw_dbg.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../../fteqw_dbg.exe" /libpath:"../libs/dxsdk7/lib" # SUBTRACT LINK32 /profile /pdb:none !ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" @@ -192,7 +192,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NOSOUNDASM" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "SERVERDLL" /D "NQPROT" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c -# ADD CPP /nologo /G6 /GX /O2 /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "AVAIL_DX7" /Fr /Yu"quakedef.h" /FD /c +# ADD CPP /nologo /G6 /GX /O2 /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "USE_D3D" /Fr /Yu"quakedef.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "NDEBUG" @@ -202,7 +202,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /machine:I386 /out:"../../../fteglqw.exe" -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /map /machine:I386 /out:"../../fteqw.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /map /machine:I386 /out:"../../fteqw.exe" /libpath:"../libs/dxsdk7/lib" !ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" @@ -230,7 +230,7 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../fteglqw.exe" # SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"../../fteminglqw_dbg.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"../../fteminglqw_dbg.exe" /libpath:"../libs/dxsdk7/lib" !ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" @@ -257,7 +257,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /machine:I386 /out:"../../../fteglqw.exe" -# ADD LINK32 wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib /nologo /subsystem:windows /pdb:none /machine:I386 /out:"../../fteminglqw.exe" +# ADD LINK32 wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib /nologo /subsystem:windows /pdb:none /machine:I386 /out:"../../fteminglqw.exe" /libpath:"../libs/dxsdk7/lib" !ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" @@ -286,7 +286,7 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../fteminglqw.exe" # SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"../../fteqwsv.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"../../fteqwsv.exe" /libpath:"../libs/dxsdk7/lib" !ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" @@ -314,7 +314,7 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../fteminglqw.exe" # SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 winmm.lib wsock32.lib user32.lib shell32.lib Advapi32.lib /nologo /subsystem:console /pdb:none /map /machine:I386 /out:"../../fteqwsv.exe" +# ADD LINK32 winmm.lib wsock32.lib user32.lib shell32.lib Advapi32.lib /nologo /subsystem:console /pdb:none /map /machine:I386 /out:"../../fteqwsv.exe" /libpath:"../libs/dxsdk7/lib" # SUBTRACT LINK32 /debug !ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" @@ -342,7 +342,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteswqw_dbg.exe" /pdbtype:sept -# ADD LINK32 comctl32.lib wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"../../fteswqw_dbg.exe" +# ADD LINK32 comctl32.lib wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"../../fteswqw_dbg.exe" /libpath:"../libs/dxsdk7/lib" !ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" @@ -371,7 +371,7 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../fteglqw_dbg.exe" # SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 comctl32.lib wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteglqw_dbg.exe" +# ADD LINK32 comctl32.lib wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteglqw_dbg.exe" /libpath:"../libs/dxsdk7/lib" # SUBTRACT LINK32 /pdb:none !ENDIF @@ -2099,6 +2099,37 @@ SOURCE=..\client\skin.c # Begin Source File SOURCE=..\client\snd_directx.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 + +!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" + +!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" + +!ENDIF + # End Source File # Begin Source File @@ -5006,449 +5037,45 @@ SOURCE=..\common\zone.c # Begin Source File SOURCE=..\QCLIB\Comprout.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File SOURCE=..\qclib\execloop.h - -!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" - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -!ENDIF - # End Source File # Begin Source File SOURCE=..\QCLIB\hash.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File SOURCE=..\QCLIB\initlib.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File SOURCE=..\QCLIB\pr_edict.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File SOURCE=..\QCLIB\Pr_exec.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /WX /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File SOURCE=..\QCLIB\pr_multi.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File SOURCE=..\QCLIB\progtype.h - -!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" - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -!ENDIF - # End Source File # Begin Source File SOURCE=..\QCLIB\qcc_cmdlib.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File @@ -5621,57 +5248,7 @@ SOURCE=..\QCLIB\QccMain.c # Begin Source File SOURCE=..\QCLIB\qcd_main.c - -!IF "$(CFG)" == "ftequake - Win32 Release" - # SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3" - -# SUBTRACT CPP /YX /Yc /Yu - -!ENDIF - # End Source File # Begin Source File diff --git a/engine/gl/gl_rlight.c b/engine/gl/gl_rlight.c index 4054d8f5c..a44cf9f1a 100644 --- a/engine/gl/gl_rlight.c +++ b/engine/gl/gl_rlight.c @@ -33,12 +33,22 @@ R_AnimateLight */ void GLR_AnimateLight (void) { - int i,j,k; + int i,j; + int v1, v2; + float f; // // light animations // 'm' is normal light, 'a' is no light, 'z' is double bright - i = (int)(cl.time*10); + f = (cl.time*r_lightstylespeed.value); + if (f < 0) + f = 0; + i = (int)f; + + if (r_lightstylesmooth.value) + f -= i; //this can require updates at 1000 times a second.. Depends on your framerate of course + else + f = 0; //only update them 10 times a second for (j=0 ; jglrenderer, "D3D")) { extern cvar_t gl_ztrick; diff --git a/engine/gl/gltod3d/gl_fakegl.cpp b/engine/gl/gltod3d/gl_fakegl.cpp index 79912c4a3..d583e4076 100644 --- a/engine/gl/gltod3d/gl_fakegl.cpp +++ b/engine/gl/gltod3d/gl_fakegl.cpp @@ -26,7 +26,7 @@ the fact that it uses wrapper functions to call methods in a class could be a re #include "bothdefs.h" //our always-present config file -#ifdef AVAIL_DX7 +#ifdef USE_D3D #define WIN32_LEAN_AND_MEAN @@ -56,9 +56,9 @@ the fact that it uses wrapper functions to call methods in a class could be a re #define D3D_OVERLOADS #define RELEASENULL(object) if (object) {object->Release();} -#include "dxsdk7/include/ddraw.h" -#include "dxsdk7/include/d3d.h" -#include "dxsdk7/include/d3dx.h" +#include "ddraw.h" +#include "d3d.h" +#include "d3dx.h" typedef HRESULT (WINAPI *qD3DXInitialize_t)(); qD3DXInitialize_t qD3DXInitialize; @@ -83,11 +83,11 @@ qD3DXMakeDDPixelFormat_t qD3DXMakeDDPixelFormat; typedef D3DXMATRIX* (WINAPI *qD3DXMatrixTranslation_t) ( D3DXMATRIX *pOut, float x, float y, float z ); qD3DXMatrixTranslation_t qD3DXMatrixTranslation; -#include "quakedef.h" extern "C" { +#include "quakedef.h" #include "glquake.h" } -#ifdef AVAIL_DX7 +#ifdef USE_D3D // Choose one of the following. D3DXContext is new in DX7, and // provides a standard way of managing DX. D3DFrame is from @@ -109,9 +109,9 @@ extern "C" { // #define USE_D3DFRAME #ifdef USE_D3DFRAME -#include "sdk7/include/d3denum.h" -#include "sdk7/include/d3dframe.h" -#include "sdk7/include/d3dutil.h" +#include "d3denum.h" +#include "d3dframe.h" +#include "d3dutil.h" #endif #if 0 @@ -3554,6 +3554,12 @@ void APIENTRY D3DViewport (GLint x, GLint y, GLsizei width, GLsizei height){ gFakeGL->cglViewport(x, y, width, height); } + +int APIENTRY D3DGetError (void) +{ + return 0; +} + HDC gHDC; HGLRC gHGLRC; @@ -4039,6 +4045,8 @@ d3dglfunc_t glfuncs[] = { {"glColorPointer", (PROC)D3DColorPointer}, {"glEnableClientState", (PROC)D3DEnableClientState}, {"glDisableClientState", (PROC)D3DDisableClientState}, + + {"glGetError", (PROC)D3DGetError}, /* qwglCreateContext = D3DwglCreateContext; qwglDeleteContext = D3DwglDeleteContext; @@ -4051,6 +4059,115 @@ d3dglfunc_t glfuncs[] = { }; +qboolean D3DVID_Init(rendererstate_t *info, unsigned char *palette) +{ + strcpy(info->glrenderer, "D3D"); + return GLVID_Init(info, palette); +} + +extern "C" { +#include "gl_draw.h" +} + +rendererinfo_t d3drendererinfo = { + "Direct3D", + { + "d3d", + "crap" + }, + QR_OPENGL, + + + GLDraw_PicFromWad, + GLDraw_SafePicFromWad, + GLDraw_CachePic, + GLDraw_SafeCachePic, + GLDraw_Init, + GLDraw_ReInit, + GLDraw_Character, + GLDraw_ColouredCharacter, + GLDraw_String, + GLDraw_Alt_String, + GLDraw_Crosshair, + GLDraw_DebugChar, + GLDraw_Pic, + GLDraw_ScalePic, + GLDraw_SubPic, + GLDraw_TransPic, + GLDraw_TransPicTranslate, + GLDraw_ConsoleBackground, + GLDraw_EditorBackground, + GLDraw_TileClear, + GLDraw_Fill, + GLDraw_FadeScreen, + GLDraw_BeginDisc, + GLDraw_EndDisc, + + GLDraw_Image, + GLDraw_ImageColours, + + GLR_Init, + GLR_DeInit, + GLR_ReInit, + GLR_RenderView, + + + GLR_InitSky, + GLR_CheckSky, + GLR_SetSky, + + GLR_NewMap, + GLR_PreNewMap, + GLR_LightPoint, + GLR_PushDlights, + + + GLR_AddStain, + GLR_LessenStains, + + MediaGL_ShowFrameBGR_24_Flip, + MediaGL_ShowFrameRGBA_32, + MediaGL_ShowFrame8bit, + + + GLMod_Init, + GLMod_ClearAll, + GLMod_ForName, + GLMod_FindName, + GLMod_Extradata, + GLMod_TouchModel, + + GLMod_PointInLeaf, + GLMod_LeafPVS, + GLMod_NowLoadExternal, + GLMod_Think, + + GLMod_GetTag, + GLMod_TagNumForName, + + D3DVID_Init, + GLVID_DeInit, + GLVID_HandlePause, + GLVID_LockBuffer, + GLVID_UnlockBuffer, + GLD_BeginDirectRect, + GLD_EndDirectRect, + GLVID_ForceLockState, + GLVID_ForceUnlockedAndReturnState, + GLVID_SetPalette, + GLVID_ShiftPalette, + GLVID_GetRGBInfo, + + NULL, //setcaption + + + GLSCR_UpdateScreen, + + "" +}; +extern "C" { +rendererinfo_t *pd3drendererinfo = &d3drendererinfo; +} #endif diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 46555be73..3d79949df 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -428,22 +428,6 @@ void PR_LoadGlabalStruct(void) globalfloat (true, total_monsters); globalfloat (true, found_secrets); globalfloat (true, killed_monsters); - globalfloat (true, parm1); - globalfloat (true, parm2); - globalfloat (true, parm3); - globalfloat (true, parm4); - globalfloat (true, parm5); - globalfloat (true, parm6); - globalfloat (true, parm7); - globalfloat (true, parm8); - globalfloat (true, parm9); - globalfloat (true, parm10); - globalfloat (true, parm11); - globalfloat (true, parm12); - globalfloat (true, parm13); - globalfloat (true, parm14); - globalfloat (true, parm15); - globalfloat (true, parm16); globalvec (true, v_forward); globalvec (true, v_up); globalvec (true, v_right); @@ -474,6 +458,9 @@ void PR_LoadGlabalStruct(void) memset(&evalc_idealpitch, 0, sizeof(evalc_idealpitch)); memset(&evalc_pitch_speed, 0, sizeof(evalc_pitch_speed)); + for (i = 0; i < NUM_SPAWN_PARMS; i++) + spawnparamglobals[i] = (float *)PR_FindGlobal(svprogfuncs, va("parm%i", i+1), 0); + if (!((nqglobalvars_t*)pr_globals)->dimension_send) { //make sure dimension send is always a valid pointer. ((nqglobalvars_t*)pr_globals)->dimension_send = &dimension_send_default; @@ -4918,7 +4905,7 @@ void PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals) client = svs.clients + (i-1); for (i=0 ; i< NUM_SPAWN_PARMS ; i++) - (&pr_global_struct->parm1)[i] = client->spawn_parms[i]; + *spawnparamglobals[i] = client->spawn_parms[i]; } /* diff --git a/engine/server/progdefs.h b/engine/server/progdefs.h index ef5e0f607..9a66e23ac 100644 --- a/engine/server/progdefs.h +++ b/engine/server/progdefs.h @@ -36,7 +36,7 @@ typedef struct globalvars_s } globalvars_t; typedef struct nqglobalvars_s -{ int *pad[28]; +{ int *self; int *other; int *world; @@ -53,22 +53,6 @@ typedef struct nqglobalvars_s float *total_monsters; float *found_secrets; float *killed_monsters; - float *parm1; - float *parm2; - float *parm3; - float *parm4; - float *parm5; - float *parm6; - float *parm7; - float *parm8; - float *parm9; - float *parm10; - float *parm11; - float *parm12; - float *parm13; - float *parm14; - float *parm15; - float *parm16; vec3_t *V_v_forward; vec3_t *V_v_up; vec3_t *V_v_right; diff --git a/engine/server/progs.h b/engine/server/progs.h index 757ebedc3..f662f6518 100644 --- a/engine/server/progs.h +++ b/engine/server/progs.h @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAX_PROGS 64 #define MAXADDONS 16 +#define NUM_SPAWN_PARMS 32 //moved from server.h because of include ordering :(. + #define NewGetEdictFieldValue GetEdictFieldValue void Q_SetProgsParms(qboolean forcompiler); void PR_Deinit(void); @@ -97,6 +99,8 @@ typedef struct edict_s //#define pr_nqglobal_struct *((nqglobalvars_t*)pr_globals) #define pr_global_struct *pr_nqglobal_struct +float *spawnparamglobals[NUM_SPAWN_PARMS]; + extern nqglobalvars_t *pr_nqglobal_struct; extern progfuncs_t *svprogfuncs; //instance diff --git a/engine/server/savegame.c b/engine/server/savegame.c index 2a3cd3587..b3472d0bd 100644 --- a/engine/server/savegame.c +++ b/engine/server/savegame.c @@ -637,7 +637,7 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers) if (e2) e2->_float = 1; for (j=0 ; j< NUM_SPAWN_PARMS ; j++) - (&pr_global_struct->parm1)[j] = host_client->spawn_parms[j]; + *spawnparamglobals[j] = host_client->spawn_parms[j]; pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent); ent->area.next = ent->area.prev = NULL; diff --git a/engine/server/server.h b/engine/server/server.h index 7541cd16c..cab978ef7 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -271,9 +271,6 @@ typedef struct int csqcentversion[MAX_EDICTS];//prevents ent versions from going backwards } server_t; - -#define NUM_SPAWN_PARMS 16 - typedef enum { cs_free, // can be reused for a new connection @@ -465,6 +462,7 @@ typedef struct client_s int delta_sequence; // -1 = no compression int last_sequence; netchan_t netchan; + qboolean isindependant; int lastsequence_acknoledged; diff --git a/engine/server/sv_ents.c b/engine/server/sv_ents.c index d635f389d..ad69e754f 100644 --- a/engine/server/sv_ents.c +++ b/engine/server/sv_ents.c @@ -968,7 +968,7 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t MSG_WriteByte(msg, svcdp_entities); MSG_WriteLong(msg, 0); if (client->protocol == SCP_DARKPLACES7) - MSG_WriteLong(msg, 0); + MSG_WriteLong(msg, client->last_sequence); for (newindex = 0; newindex < to->num_entities; newindex++) to->entities[newindex].bitmask = 0; @@ -2344,8 +2344,8 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore continue; if (e >= 1024 && !(client->fteprotocolextensions & PEXT_ENTITYDBL2)) continue; - if (/*dement->modelindex >= 256 &&*/ !(client->fteprotocolextensions & PEXT_MODELDBL)) - continue; +// if (dement->modelindex >= 256 && !(client->fteprotocolextensions & PEXT_MODELDBL)) +// continue; state = &pack->entities[pack->num_entities]; pack->num_entities++; diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index 392a42bb4..716601400 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -304,7 +304,12 @@ void SV_SaveSpawnparms (qboolean dontsave) pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, host_client->edict); PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetChangeParms); for (j=0 ; jspawn_parms[j] = (&pr_global_struct->parm1)[j]; + { + if (spawnparamglobals[j]) + host_client->spawn_parms[j] = *spawnparamglobals[j]; + else + host_client->spawn_parms[j] = 0; + } } #ifdef SVRANKING @@ -320,7 +325,12 @@ void SV_SaveSpawnparms (qboolean dontsave) host_client->kills=0; host_client->deaths=0; for (j=0 ; jparm1)[j]; + { + if (spawnparamglobals[j]) + rs.parm[j] = *spawnparamglobals[j]; + else + rs.parm[j] = 0; + } Rank_SetPlayerStats(host_client->rankid, &rs); } } diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index f3d4069ac..7e3d1bc05 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -376,7 +376,7 @@ void SV_DropClient (client_t *drop) if (pr_nqglobal_struct->SetChangeParms) PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetChangeParms); for (j=0 ; jparm1)[j]; + rs.parm[j] = *spawnparamglobals[j]; Rank_SetPlayerStats(drop->rankid, &rs); } } @@ -1029,7 +1029,12 @@ void SV_GetNewSpawnParms(client_t *cl) if (pr_nqglobal_struct->SetNewParms) PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetNewParms); for (i=0 ; ispawn_parms[i] = (&pr_global_struct->parm1)[i]; + { + if (spawnparamglobals[i]) + cl->spawn_parms[i] = *spawnparamglobals[i]; + else + cl->spawn_parms[i] = 0; + } } } @@ -3297,7 +3302,7 @@ qboolean ReloadRanking(client_t *cl, char *newname) if (pr_nqglobal_struct->SetChangeParms) PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetChangeParms); for (j=0 ; jparm1)[j]; + rs.parm[j] = *spawnparamglobals[j]; Rank_SetPlayerStats(cl->rankid, &rs); } if (!Rank_GetPlayerStats(newid, &rs)) diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index bfbcc065c..fd410e504 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -868,20 +868,6 @@ if (l > 1.0/64) } -/* -============= -SV_Physics_None - -Non moving objects can only think -============= -*/ -void SV_Physics_None (edict_t *ent) -{ -// regular thinking - SV_RunThink (ent); -} - - /* ============= SV_Physics_Follow @@ -1660,106 +1646,7 @@ void SV_WalkMove (edict_t *ent) #endif -/* -================ -SV_Physics_Client - -Player character actions - - -From normal Quake in an attempt to fix physics in QuakeRally -================ -*/ #define FL_JUMPRELEASED 4096 -void SV_Physics_Client (edict_t *ent, int num) -{ - qboolean readyforjump; - float oldvel; - - if ( svs.clients[num-1].state < cs_spawned ) - return; // unconnected slot - - readyforjump = false; - if (progstype == PROG_QW) - if (ent->v->button2) - if ((int)ent->v->flags & FL_JUMPRELEASED) - readyforjump = true; -// -// call standard client pre-think -// - pr_global_struct->time = sv.time; - pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent); - PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPreThink); - - if (readyforjump) //qw progs can't jump for themselves... - { - if (!ent->v->button2 && !((int)ent->v->flags & FL_JUMPRELEASED)) - ent->v->velocity[2] += 270; - } -// -// do a move -// - SV_CheckVelocity (ent); - -// -// decide which move function to call -// - switch ((int)ent->v->movetype) - { - case MOVETYPE_NONE: - if (!SV_RunThink (ent)) - return; - break; - - case MOVETYPE_WALK: - oldvel = ent->v->velocity[0]; - if (!SV_RunThink (ent)) - return; - if (!SV_CheckWater (ent) && ! ((int)ent->v->flags & FL_WATERJUMP) ) - SV_AddGravity (ent, ent->v->gravity); - - SV_CheckStuck (ent); - SV_WalkMove (ent); - break; - - case MOVETYPE_FOLLOW: - SV_Physics_Follow (ent); - break; - - case MOVETYPE_TOSS: - case MOVETYPE_BOUNCE: - SV_Physics_Toss (ent); - break; - - case MOVETYPE_FLY: - case MOVETYPE_SWIM: - if (!SV_RunThink (ent)) - return; - SV_FlyMove (ent, host_frametime, NULL); - break; - - case MOVETYPE_NOCLIP: - if (!SV_RunThink (ent)) - return; - VectorMA (ent->v->origin, host_frametime, ent->v->velocity, ent->v->origin); - VectorMA (ent->v->angles, host_frametime, ent->v->avelocity, ent->v->angles); - break; - - default: - Sys_Error ("SV_Physics_client: bad movetype %i", (int)ent->v->movetype); - } - -// -// call standard player post-think -// - SV_LinkEdict (ent, true); - - pr_global_struct->time = sv.time; - pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent); - PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPostThink); -} - - /* ================ SV_RunEntity @@ -1768,19 +1655,53 @@ SV_RunEntity */ void SV_RunEntity (edict_t *ent) { - int c,originMoved; - edict_t *ent2; - vec3_t oldOrigin,oldAngle; + edict_t *movechain; + vec3_t initial_origin,initial_angle; - if (ent->v->lastruntime == (float)realtime) - return; - ent->v->lastruntime = (float)realtime; + if (ent->entnum > 0 && ent->entnum <= sv.allocated_client_slots) + { //a client woo. + qboolean readyforjump = false; - ent2 = PROG_TO_EDICT(svprogfuncs, ent->v->movechain); - if (ent2 != sv.edicts) + if ( svs.clients[ent->entnum-1].state < cs_spawned ) + return; // unconnected slot + + + host_client = &svs.clients[ent->entnum-1]; + SV_ClientThink(); + + + if (progstype == PROG_QW) //detect if the mod should do a jump + if (ent->v->button2) + if ((int)ent->v->flags & FL_JUMPRELEASED) + readyforjump = true; + + // + // call standard client pre-think + // + pr_global_struct->time = sv.time; + pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent); + PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPreThink); + + if (readyforjump) //qw progs can't jump for themselves... + { + if (!ent->v->button2 && !((int)ent->v->flags & FL_JUMPRELEASED) && ent->v->velocity[2] <= 0) + ent->v->velocity[2] += 270; + } + } + else { - VectorCopy(ent->v->origin,oldOrigin); - VectorCopy(ent->v->angles,oldAngle); + if (ent->v->lastruntime == (float)realtime) + return; + ent->v->lastruntime = (float)realtime; + } + + + + movechain = PROG_TO_EDICT(svprogfuncs, ent->v->movechain); + if (movechain != sv.edicts) + { + VectorCopy(ent->v->origin,initial_origin); + VectorCopy(ent->v->angles,initial_angle); } switch ( (int)ent->v->movetype) @@ -1789,7 +1710,8 @@ void SV_RunEntity (edict_t *ent) SV_Physics_Pusher (ent); break; case MOVETYPE_NONE: - SV_Physics_None (ent); + if (!SV_RunThink (ent)) + return; break; case MOVETYPE_NOCLIP: SV_Physics_Noclip (ent); @@ -1826,37 +1748,40 @@ void SV_RunEntity (edict_t *ent) SV_Error ("SV_Physics: bad movetype %i on %s", (int)ent->v->movetype, svprogfuncs->stringtable + ent->v->classname); } - if (ent2 != sv.edicts) + if (movechain != sv.edicts) { - originMoved = !VectorCompare(ent->v->origin,oldOrigin); - if (originMoved || !VectorCompare(ent->v->angles,oldAngle)) + qboolean callfunc; + if ((callfunc=DotProduct(ent->v->origin, initial_origin)) || DotProduct(ent->v->angles, initial_angle)) { - VectorSubtract(ent->v->origin,oldOrigin,oldOrigin); - VectorSubtract(ent->v->angles,oldAngle,oldAngle); + vec3_t moveang, moveorg; + int i; + VectorSubtract(ent->v->angles, initial_angle, moveang) + VectorSubtract(ent->v->origin, initial_origin, moveorg) - for(c=0;c<10;c++) - { // chain a max of 10 objects - if (ent2->isfree) break; + for(i=16;i && movechain != sv.edicts && !movechain->isfree;i--, movechain = PROG_TO_EDICT(svprogfuncs, movechain->v->movechain)) + { + if ((int)movechain->v->flags & FL_MOVECHAIN_ANGLE) + VectorAdd(movechain->v->angles, moveang, movechain->v->angles); + VectorAdd(movechain->v->origin, moveorg, movechain->v->origin); - VectorAdd(oldOrigin,ent2->v->origin,ent2->v->origin); - if ((int)ent2->v->flags & FL_MOVECHAIN_ANGLE) + if (movechain->v->chainmoved && callfunc) { - VectorAdd(oldAngle,ent2->v->angles,ent2->v->angles); - } - - if (originMoved && ent2->v->chainmoved) - { // callback function - pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent2); + pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, movechain); pr_global_struct->other = EDICT_TO_PROG(svprogfuncs, ent); - PR_ExecuteProgram(svprogfuncs, ent2->v->chainmoved); + PR_ExecuteProgram(svprogfuncs, movechain->v->chainmoved); } - - ent2 = PROG_TO_EDICT(svprogfuncs, ent2->v->movechain); - if (ent2 == sv.edicts) break; - } } } + + if (ent->entnum > 0 && ent->entnum <= sv.allocated_client_slots) + { + SV_LinkEdict (ent, true); + + pr_global_struct->time = sv.time; + pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent); + PR_ExecuteProgram (svprogfuncs, pr_global_struct->PlayerPostThink); + } } /* @@ -1990,14 +1915,6 @@ qboolean SV_Physics (void) pr_global_struct->frametime = host_frametime; - for (i = 0; i < sv.allocated_client_slots; i++) - { - host_client = &svs.clients[i]; - if (host_client->state == cs_spawned) - if (sv_nomsec.value || SV_PlayerPhysicsQC || !ISQWCLIENT(host_client)) - SV_ClientThink(); - } - SV_ProgStartFrame (); PR_RunThreads(); @@ -2025,9 +1942,9 @@ qboolean SV_Physics (void) if (i > 0 && i <= sv.allocated_client_slots) { - if (sv_nomsec.value || SV_PlayerPhysicsQC || !ISQWCLIENT(&svs.clients[i-1])) + if (!svs.clients[i-1].isindependant) { - SV_Physics_Client(ent, i); + SV_RunEntity(ent); SV_RunNewmis (); } else diff --git a/engine/server/sv_rankin.c b/engine/server/sv_rankin.c index e05f778f2..a35a2b9af 100644 --- a/engine/server/sv_rankin.c +++ b/engine/server/sv_rankin.c @@ -9,6 +9,8 @@ #ifdef SVRANKING typedef struct { + int ident; + int version; int usedslots; int leader; int freeslot; @@ -26,6 +28,9 @@ cvar_t rank_needlogin = {"rank_needlogin", "0"}; cvar_t rank_filename = {"rank_filename", ""}; char rank_cvargroup[] = "server rankings"; +#define RANKFILE_VERSION 0x00000000 +#define RANKFILE_IDENT *(int*)"RANK" + void inline READ_PLAYERSTATS(int x, rankstats_t *os) { int i; @@ -102,6 +107,8 @@ void inline WRITEHEADER(void) { rankfileheader_t nh; + nh.ident = RANKFILE_IDENT; + nh.version = swaplong(RANKFILE_VERSION); nh.usedslots = swaplong(rankfileheader.usedslots); nh.leader = swaplong(rankfileheader.leader); nh.freeslot = swaplong(rankfileheader.freeslot); @@ -115,6 +122,7 @@ void inline WRITEHEADER(void) qboolean Rank_OpenRankings(void) { + qboolean created; if (!rankfile) { if (!*rank_filename.string) @@ -127,7 +135,12 @@ qboolean Rank_OpenRankings(void) rankfile = fopen(va("%s/%s", com_gamedir, rank_filename.string), "r+b"); if (!rankfile) //hmm... try creating + { rankfile = fopen(va("%s/%s", com_gamedir, rank_filename.string), "w+b"); + created = true; + } + else + created = false; if (!rankfile) return false; //couldn't open file. @@ -136,10 +149,20 @@ qboolean Rank_OpenRankings(void) fseek(rankfile, 0, SEEK_SET); fread(&rankfileheader, sizeof(rankfileheader_t), 1, rankfile); + rankfileheader.version = swaplong(rankfileheader.version); rankfileheader.usedslots = swaplong(rankfileheader.usedslots); rankfileheader.leader = swaplong(rankfileheader.leader); rankfileheader.freeslot = swaplong(rankfileheader.freeslot); + if (!created && (rankfileheader.version != RANKFILE_VERSION || rankfileheader.ident != RANKFILE_IDENT)) + { + Con_Printf("Rank file is version %i not %i\nEither delete the file or use an equivelent version of " DISTRIBUTION "\n"); + fclose(rankfile); + rankfile = NULL; + + return false; + } + return true; //success. } return true; //already open diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 3d5936e31..2b08cc98a 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -136,13 +136,13 @@ void SV_New_f (void) //NOTE: This doesn't go through ClientReliableWrite since it's before the user //spawns. These functions are written to not overflow - if (host_client->num_backbuf) +/* if (host_client->num_backbuf) { Con_TPrintf(STL_BACKBUFSET, host_client->name, host_client->netchan.message.cursize); host_client->num_backbuf = 0; SZ_Clear(&host_client->netchan.message); } - +*/ if (sizeofcoord > 2 && !(host_client->fteprotocolextensions & PEXT_FLOATCOORDS)) { SV_ClientPrintf(host_client, 2, "\n\n\n\nSorry, but your client does not appear to support FTE's bigcoords\nFTE users will need to set cl_nopext to 0 and then reconnect, or to upgrade\n"); @@ -150,9 +150,10 @@ void SV_New_f (void) return; } + ClientReliableCheckBlock(host_client, 800); //okay, so it might be longer, but I'm too lazy to work out the real size. // send the serverdata - MSG_WriteByte (&host_client->netchan.message, ISQ2CLIENT(host_client)?svcq2_serverdata:svc_serverdata); + ClientReliableWrite_Byte (host_client, ISQ2CLIENT(host_client)?svcq2_serverdata:svc_serverdata); #ifdef PROTOCOL_VERSION_FTE if (host_client->fteprotocolextensions)//let the client know { @@ -163,11 +164,11 @@ void SV_New_f (void) MSG_WriteLong (&host_client->netchan.message, host_client->fteprotocolextensions); } #endif - MSG_WriteLong (&host_client->netchan.message, ISQ2CLIENT(host_client)?PROTOCOL_VERSION_Q2:PROTOCOL_VERSION); - MSG_WriteLong (&host_client->netchan.message, svs.spawncount); + ClientReliableWrite_Long (host_client, ISQ2CLIENT(host_client)?PROTOCOL_VERSION_Q2:PROTOCOL_VERSION); + ClientReliableWrite_Long (host_client, svs.spawncount); if (ISQ2CLIENT(host_client)) - MSG_WriteByte (&host_client->netchan.message, 0); - MSG_WriteString (&host_client->netchan.message, gamedir); + ClientReliableWrite_Byte (host_client, 0); + ClientReliableWrite_String (host_client, gamedir); splitnum = 0; for (split = host_client; split; split = split->controlled) @@ -189,9 +190,9 @@ void SV_New_f (void) playernum = -1; if (ISQ2CLIENT(host_client)) - MSG_WriteShort (&host_client->netchan.message, playernum); + ClientReliableWrite_Short (host_client, playernum); else - MSG_WriteByte (&host_client->netchan.message, playernum); + ClientReliableWrite_Byte (host_client, playernum); split->state = cs_connected; split->connection_started = realtime; @@ -201,13 +202,13 @@ void SV_New_f (void) splitnum++; } if (host_client->fteprotocolextensions & PEXT_SPLITSCREEN) - MSG_WriteByte (&host_client->netchan.message, 128); + ClientReliableWrite_Byte (host_client, 128); // send full levelname if (sv.demostatevalid) - MSG_WriteString (&host_client->netchan.message, sv.demfullmapname); + ClientReliableWrite_String (host_client, sv.demfullmapname); else - MSG_WriteString (&host_client->netchan.message, sv.mapname); + ClientReliableWrite_String (host_client, sv.mapname); // // game server @@ -221,39 +222,48 @@ void SV_New_f (void) memset (&host_client->lastcmd, 0, sizeof(host_client->lastcmd)); // begin fetching configstrings - MSG_WriteByte (&host_client->netchan.message, svcq2_stufftext); - MSG_WriteString (&host_client->netchan.message, va("cmd configstrings %i 0\n",svs.spawncount) ); + ClientReliableWrite_Byte (host_client, svcq2_stufftext); + ClientReliableWrite_String (host_client, va("cmd configstrings %i 0\n",svs.spawncount) ); } return; } #endif // send the movevars - MSG_WriteFloat(&host_client->netchan.message, movevars.gravity); - MSG_WriteFloat(&host_client->netchan.message, movevars.stopspeed); - MSG_WriteFloat(&host_client->netchan.message, movevars.maxspeed); - MSG_WriteFloat(&host_client->netchan.message, movevars.spectatormaxspeed); - MSG_WriteFloat(&host_client->netchan.message, movevars.accelerate); - MSG_WriteFloat(&host_client->netchan.message, movevars.airaccelerate); - MSG_WriteFloat(&host_client->netchan.message, movevars.wateraccelerate); - MSG_WriteFloat(&host_client->netchan.message, movevars.friction); - MSG_WriteFloat(&host_client->netchan.message, movevars.waterfriction); - MSG_WriteFloat(&host_client->netchan.message, movevars.entgravity); + ClientReliableWrite_Float(host_client, movevars.gravity); + ClientReliableWrite_Float(host_client, movevars.stopspeed); + ClientReliableWrite_Float(host_client, movevars.maxspeed); + ClientReliableWrite_Float(host_client, movevars.spectatormaxspeed); + ClientReliableWrite_Float(host_client, movevars.accelerate); + ClientReliableWrite_Float(host_client, movevars.airaccelerate); + ClientReliableWrite_Float(host_client, movevars.wateraccelerate); + ClientReliableWrite_Float(host_client, movevars.friction); + ClientReliableWrite_Float(host_client, movevars.waterfriction); + ClientReliableWrite_Float(host_client, movevars.entgravity); // send server info string - MSG_WriteByte (&host_client->netchan.message, svc_stufftext); if (sv.demostatevalid) - MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", sv.demoinfo)); + { + ClientReliableCheckBlock(host_client, 20 + strlen(sv.demoinfo)); + ClientReliableWrite_Byte (host_client, svc_stufftext); + ClientReliableWrite_String (host_client, va("fullserverinfo \"%s\"\n", sv.demoinfo) ); + } else - MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", svs.info) ); + { + ClientReliableCheckBlock(host_client, 20 + strlen(svs.info)); + ClientReliableWrite_Byte (host_client, svc_stufftext); + ClientReliableWrite_String (host_client, va("fullserverinfo \"%s\"\n", svs.info) ); + } host_client->csqcactive = false; // send music - MSG_WriteByte (&host_client->netchan.message, svc_cdtrack); + ClientReliableCheckBlock(host_client, 2); + + ClientReliableWrite_Byte (host_client, svc_cdtrack); if (svprogfuncs) - MSG_WriteByte (&host_client->netchan.message, sv.edicts->v->sounds); + ClientReliableWrite_Byte (host_client, sv.edicts->v->sounds); else - MSG_WriteByte (&host_client->netchan.message, 0); + ClientReliableWrite_Byte (host_client, 0); } #define GAME_DEATHMATCH 0 #define GAME_COOP 1 @@ -1245,7 +1255,10 @@ void SV_Begin_f (void) { // copy spawn parms out of the client_t for (i=0 ; i< NUM_SPAWN_PARMS ; i++) - (&pr_global_struct->parm1)[i] = split->spawn_parms[i]; + { + if (spawnparamglobals[i]) + *spawnparamglobals[i] = split->spawn_parms[i]; + } // call the spawn function pr_global_struct->time = sv.time; @@ -1273,7 +1286,10 @@ void SV_Begin_f (void) if (eval2) eval2->_float = 1; for (j=0 ; j< NUM_SPAWN_PARMS ; j++) - (&pr_global_struct->parm1)[j] = split->spawn_parms[j]; + { + if (spawnparamglobals[j]) + *spawnparamglobals[j] = split->spawn_parms[j]; + } pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, ent); G_FLOAT(OFS_PARM0) = sv.time - split->spawninfotime; @@ -1283,7 +1299,10 @@ void SV_Begin_f (void) { // copy spawn parms out of the client_t for (i=0 ; i< NUM_SPAWN_PARMS ; i++) - (&pr_global_struct->parm1)[i] = split->spawn_parms[i]; + { + if (spawnparamglobals[i]) + *spawnparamglobals[i] = split->spawn_parms[i]; + } // call the spawn function pr_global_struct->time = sv.time; @@ -2702,7 +2721,12 @@ void Cmd_Join_f (void) // call the progs to get default spawn parms for the new client PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetNewParms); for (i=0 ; ispawn_parms[i] = (&pr_global_struct->parm1)[i]; + { + if (spawnparamglobals[i]) + host_client->spawn_parms[i] = *spawnparamglobals[i]; + else + host_client->spawn_parms[i] = 0; + } // call the spawn function pr_global_struct->time = sv.time; @@ -2779,7 +2803,12 @@ void Cmd_Observe_f (void) // call the progs to get default spawn parms for the new client PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetNewParms); for (i=0 ; ispawn_parms[i] = (&pr_global_struct->parm1)[i]; + { + if (spawnparamglobals[i]) + host_client->spawn_parms[i] = *spawnparamglobals[i]; + else + host_client->spawn_parms[i] = 0; + } SV_SpawnSpectator (); @@ -3119,7 +3148,10 @@ void SVNQ_Begin_f (void) { // copy spawn parms out of the client_t for (i=0 ; i< NUM_SPAWN_PARMS ; i++) - (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i]; + { + if (spawnparamglobals[i]) + *spawnparamglobals[i] = host_client->spawn_parms[i]; + } // call the spawn function pr_global_struct->time = sv.time; @@ -3131,7 +3163,10 @@ void SVNQ_Begin_f (void) { // copy spawn parms out of the client_t for (i=0 ; i< NUM_SPAWN_PARMS ; i++) - (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i]; + { + if (spawnparamglobals[i]) + *spawnparamglobals[i] = host_client->spawn_parms[i]; + } // call the spawn function pr_global_struct->time = sv.time; @@ -3742,6 +3777,10 @@ int SV_PMTypeForClient (client_t *cl) return PM_NORMAL; } + +//called for common csqc/server code (supposedly) +void SV_RunEntity (edict_t *ent); + /* =========== SV_PreRunCmd @@ -3933,6 +3972,15 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse) V_CalcRoll (sv_player->v->angles, sv_player->v->velocity)*4; } + if (SV_PlayerPhysicsQC) + { //csqc independant physics support + pr_global_struct->frametime = host_frametime; + pr_global_struct->time = sv.time; + SV_RunEntity(sv_player); + return; + } + + if (!host_client->spectator) { vec_t oldvz; @@ -4306,8 +4354,9 @@ haveannothergo: if (!sv.paused) { - if (sv_nomsec.value || SV_PlayerPhysicsQC) + if (sv_nomsec.value) { + cl->isindependant = false; if (!sv_player->v->fixangle) { sv_player->v->v_angle[0] = newcmd.angles[0]* (360.0/65536); @@ -4349,6 +4398,7 @@ haveannothergo: } continue; } + cl->isindependant = true; SV_PreRunCmd(); if (net_drop < 20) @@ -4365,7 +4415,8 @@ haveannothergo: } SV_RunCmd (&newcmd, false); - SV_PostRunCmd(); + if (!SV_PlayerPhysicsQC) + SV_PostRunCmd(); } @@ -4589,7 +4640,9 @@ void SVNQ_ReadClientMove (usercmd_t *move) frame = &host_client->frames[host_client->netchan.incoming_acknowledged & UPDATE_MASK]; if (host_client->protocol == SCP_DARKPLACES7) - MSG_ReadLong (); + host_client->last_sequence = MSG_ReadLong (); + else + host_client->last_sequence = 0; frame->ping_time = sv.time - MSG_ReadFloat (); @@ -4657,6 +4710,9 @@ void SVNQ_ReadClientMove (usercmd_t *move) host_client->edict->v->button6 = ((bits >> 5) & 1); host_client->edict->v->button7 = ((bits >> 6) & 1); host_client->edict->v->button8 = ((bits >> 7) & 1); + + if (host_client->last_sequence) + SV_RunEntity(host_client->edict); } void SVNQ_ExecuteClientMessage (client_t *cl) diff --git a/engine/sw/r_light.c b/engine/sw/r_light.c index e5296a157..8ad9a7322 100644 --- a/engine/sw/r_light.c +++ b/engine/sw/r_light.c @@ -32,24 +32,38 @@ R_AnimateLight */ void SWR_AnimateLight (void) { - int i,j,k; + int i,j; + int v1, v2; + float f; // // light animations // 'm' is normal light, 'a' is no light, 'z' is double bright - i = (int)(cl.time*10); + f = (cl.time*r_lightstylespeed.value); + if (f < 0) + f = 0; + i = (int)f; + + if (r_lightstylesmooth.value) + f -= i; //this can require updates at 1000 times a second.. Depends on your framerate of course + else + f = 0; //only update them 10 times a second for (j=0 ; j