diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index c2f5aba72..e007a7f29 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -7175,6 +7175,19 @@ void CLNQ_ParseServerMessage (void) CL_SetStatFloat (0, i, j); CL_SetStatInt (0, i, j); break; + case svcfte_updatestatstring: + i = MSG_ReadByte(); + s = MSG_ReadString(); + CL_SetStatString (destsplit, i, s); + break; + case svcfte_updatestatfloat: + i = MSG_ReadByte(); + { + float f = MSG_ReadFloat(); + CL_SetStatInt (destsplit, i, f); + CL_SetStatFloat (destsplit, i, f); + } + break; case svc_setangle: { inframe_t *inf = &cl.inframes[cls.netchan.incoming_sequence&UPDATE_MASK]; diff --git a/engine/client/client.h b/engine/client/client.h index 1bfc4b4a3..80c0fcb06 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -1500,8 +1500,6 @@ int Stats_GetCaptures(int playernum); qboolean Stats_HaveFlags(int mode); qboolean Stats_HaveKills(void); void VARGS Stats_Message(char *msg, ...) LIKEPRINTF(1); -int qm_strcmp(char *s1, char *s2); -int qm_stricmp(char *s1, char *s2); qboolean Stats_ParsePrintLine(char *line); void Stats_NewMap(void); void Stats_Clear(void); diff --git a/engine/client/fragstats.c b/engine/client/fragstats.c index e2b8c2a0f..264b5ace6 100644 --- a/engine/client/fragstats.c +++ b/engine/client/fragstats.c @@ -668,8 +668,8 @@ static void Stats_LoadFragFile(char *name) } } -/* -int qm_strcmp(char *s1, char *s2)//not like strcmp at all... + +static int qm_strcmp(char *s1, char *s2)//not like strcmp at all... { while(*s1) { @@ -678,8 +678,8 @@ int qm_strcmp(char *s1, char *s2)//not like strcmp at all... } return 0; } - -int qm_stricmp(char *s1, char *s2)//not like strcmp at all... +/* +static int qm_stricmp(char *s1, char *s2)//not like strcmp at all... { int c1,c2; while(*s1) diff --git a/engine/client/image.c b/engine/client/image.c index 289c03252..b7cdd706c 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -2369,15 +2369,38 @@ static qboolean Image_ReadDDSFile(texid_t tex, unsigned int flags, char *fname, divsize = 4; blocksize = 8; } - else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT2" || *(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT3") + else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT2") //dx3 with premultiplied alpha { +// if (!(tex->flags & IF_PREMULTIPLYALPHA)) + return false; encoding = PTI_S3RGBA3; pad = 8; divsize = 4; blocksize = 16; } - else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT4" || *(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT5") + else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT3") { + if (tex->flags & IF_PREMULTIPLYALPHA) + return false; + encoding = PTI_S3RGBA3; + pad = 8; + divsize = 4; + blocksize = 16; + } + else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT4") //dx5 with premultiplied alpha + { +// if (!(tex->flags & IF_PREMULTIPLYALPHA)) + return false; + encoding = PTI_S3RGBA5; + pad = 8; + divsize = 4; + blocksize = 16; + } + else if (*(int*)&fmtheader.ddpfPixelFormat.dwFourCC == *(int*)"DXT5") + { + if (tex->flags & IF_PREMULTIPLYALPHA) + return false; + encoding = PTI_S3RGBA5; pad = 8; divsize = 4; @@ -3128,14 +3151,20 @@ static void Image_RoundDimensions(int *scaled_width, int *scaled_height, unsigne if (flags & IF_NOMIPMAP) { - *scaled_width >>= gl_picmip2d.ival; - *scaled_height >>= gl_picmip2d.ival; + if (gl_picmip2d.ival > 0) + { + *scaled_width >>= gl_picmip2d.ival; + *scaled_height >>= gl_picmip2d.ival; + } } else { - TRACE(("dbg: GL_RoundDimensions: %f\n", gl_picmip.value)); - *scaled_width >>= gl_picmip.ival; - *scaled_height >>= gl_picmip.ival; + if (gl_picmip.ival > 0) + { + TRACE(("dbg: GL_RoundDimensions: %f\n", gl_picmip.value)); + *scaled_width >>= gl_picmip.ival; + *scaled_height >>= gl_picmip.ival; + } } TRACE(("dbg: GL_RoundDimensions: %f\n", gl_max_size.value)); diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 7aeffa593..a10abbce6 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -350,7 +350,7 @@ void SV_Master_Heartbeat (void) int i; qboolean enabled; - if (!sv_public.ival || SSV_IsSubServer()) + if (sv_public.ival<=0 || SSV_IsSubServer()) return; if (realtime-HEARTBEAT_SECONDS - svs.last_heartbeat < HEARTBEAT_SECONDS) diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 1fa93a953..5a2028e9e 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -476,9 +476,10 @@ void QCBUILTIN PF_CL_drawpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl { if (!CL_IsDownloading(picname)) p = R2D_SafeCachePic("no_texture"); + G_FLOAT(OFS_RETURN) = 0; } else - G_FLOAT(OFS_RETURN) = 0; + G_FLOAT(OFS_RETURN) = 1; r2d_be_flags = PF_SelectDPDrawFlag(flag); R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha); diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index 08e47f3d4..8c0bcdb65 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -1708,7 +1708,7 @@ void TP_SearchForMsgTriggers (char *s, int level) { if (level == PRINT_CHAT && ( strstr (s, "f_version") || strstr (s, "f_system") || - strstr (s, "f_speed") || strstr (s, "f_modified"))) + strstr (s, "f_speed") || strstr (s, "f_modified") || strstr (s, "f_ruleset"))) continue; // don't let llamas fake proxy replies string = Cmd_AliasExist (t->name, RESTRICT_LOCAL); diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 6e8f86634..02b1b6de8 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -491,17 +491,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PLATFORM "Web" #elif defined(NACL) #define PLATFORM "Nacl" + #elif defined(_WIN32_WCE) + #define PLATFORM "WinCE" + #define ARCH_DL_POSTFIX ".dll" #elif defined(_WIN32) - #if defined(__amd64__) + #if defined(WINRT) + #define PLATFORM "WinRT" /*those poor poor souls. maybe just maybe I'll actually get the tools for a port, its just a shame that I won't be able to release said port*/ + #elif defined(__amd64__) #define PLATFORM "Win64" #else #define PLATFORM "Win32" #endif #define ARCH_DL_POSTFIX ".dll" + #elif defined(_WIN16) + #define PLATFORM "Win16" + #define ARCH_DL_POSTFIX ".dll" #elif defined(__CYGWIN__) #define PLATFORM "Cygwin" /*technically also windows*/ #define ARCH_DL_POSTFIX ".dll" - #elif defined(ANDROID) + #elif defined(ANDROID) || defined(__ANDROID__) #define PLATFORM "Android" /*technically also linux*/ #elif defined(__linux__) #if defined(__amd64__) @@ -509,16 +517,33 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #else #define PLATFORM "Linux" #endif + #elif defined(__APPLE__) + #include "TargetConditionals.h" + #if TARGET_IPHONE_SIMULATOR + #define PLATFORM "iOSSim" + #elif TARGET_OS_IPHONE + #define PLATFORM "iOS" + #elif TARGET_OS_MAC + #define PLATFORM "Mac" + #else + #define PLATFORM "Apple" + #endif #elif defined(__FreeBSD__) #define PLATFORM "FreeBSD" #elif defined(__OpenBSD__) #define PLATFORM "OpenBSD" #elif defined(__NetBSD__) #define PLATFORM "NetBSD" + #elif defined(BSD) + #define PLATFORM "BSD" #elif defined(__MORPHOS__) #define PLATFORM "MorphOS" + #elif defined(__amigaos__) + #define PLATFORM "AmigaOS" #elif defined(MACOSX) #define PLATFORM "MacOS X" + #elif defined(__DOS__) + #define PLATFORM "Dos" #else #define PLATFORM "Unknown" #endif diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 38ea1cff5..40953eec9 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -850,12 +850,14 @@ hull_t *Q1BSP_ChooseHull(model_t *model, int forcehullnum, vec3_t mins, vec3_t m { if (size[0] < 3 || !model->hulls[1].available) hull = &model->hulls[0]; - else if (size[0] <= 32.1) + else if (size[0] <= 32.1 || !model->hulls[2].available) { if (size[2] < 54.1 && model->hulls[3].available) hull = &model->hulls[3]; // 32x32x36 (half-life's crouch) - else + else if (model->hulls[1].available) hull = &model->hulls[1]; + else + hull = &model->hulls[0]; } else hull = &model->hulls[2]; diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 9dc9307d2..f15fd2d59 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -4572,7 +4572,7 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist) qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } - oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_RB_DEPTH, &shaderstate.tex_reflection, 1, r_nulltex, shaderstate.tex_reflection->width, shaderstate.tex_reflection->height); + oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_RB_DEPTH, &shaderstate.tex_reflection, 1, r_nulltex, shaderstate.tex_reflection->width, shaderstate.tex_reflection->height, 0); r_refdef.pxrect.maxheight = shaderstate.fbo_reflectrefrac.rb_size[1]; GL_ViewportUpdate(); GL_ForceDepthWritable(); @@ -4635,11 +4635,11 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist) qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } - oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_TEX_DEPTH, &shaderstate.tex_refraction, 1, shaderstate.tex_refractiondepth, r_refdef.pxrect.width, r_refdef.pxrect.height); + oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_TEX_DEPTH, &shaderstate.tex_refraction, 1, shaderstate.tex_refractiondepth, r_refdef.pxrect.width, r_refdef.pxrect.height, 0); } else { - oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_RB_DEPTH, &shaderstate.tex_refraction, 1, r_nulltex, r_refdef.pxrect.width, r_refdef.pxrect.height); + oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_RB_DEPTH, &shaderstate.tex_refraction, 1, r_nulltex, r_refdef.pxrect.width, r_refdef.pxrect.height, 0); } r_refdef.pxrect.maxheight = shaderstate.fbo_reflectrefrac.rb_size[1]; GL_ViewportUpdate(); @@ -4688,7 +4688,7 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist) qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } - oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, 0, &shaderstate.tex_ripplemap, 1, r_nulltex, r_refdef.pxrect.width, r_refdef.pxrect.height); + oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, 0, &shaderstate.tex_ripplemap, 1, r_nulltex, r_refdef.pxrect.width, r_refdef.pxrect.height, 0); r_refdef.pxrect.maxheight = shaderstate.fbo_reflectrefrac.rb_size[1]; GL_ViewportUpdate(); @@ -4832,7 +4832,7 @@ void GLBE_RenderToTextureUpdate2d(qboolean destchanged) if (*r_refdef.rt_destcolour[0].texname) { texid_t tex = R2D_RT_GetTexture(r_refdef.rt_destcolour[0].texname, &width, &height); - GLBE_FBO_Update(&shaderstate.fbo_2dfbo, 0, &tex, 1, r_nulltex, width, height); + GLBE_FBO_Update(&shaderstate.fbo_2dfbo, 0, &tex, 1, r_nulltex, width, height, 0); } else GLBE_FBO_Push(NULL); @@ -4895,7 +4895,7 @@ void GLBE_FBO_Destroy(fbostate_t *state) } //state->colour is created if usedepth is set and it doesn't previously exist -int GLBE_FBO_Update(fbostate_t *state, unsigned int enables, texid_t *destcol, int mrt, texid_t destdepth, int width, int height) +int GLBE_FBO_Update(fbostate_t *state, unsigned int enables, texid_t *destcol, int mrt, texid_t destdepth, int width, int height, int layer) { GLenum allcolourattachments[] ={GL_COLOR_ATTACHMENT0_EXT,GL_COLOR_ATTACHMENT1_EXT,GL_COLOR_ATTACHMENT2_EXT,GL_COLOR_ATTACHMENT3_EXT, GL_COLOR_ATTACHMENT4_EXT,GL_COLOR_ATTACHMENT5_EXT,GL_COLOR_ATTACHMENT6_EXT,GL_COLOR_ATTACHMENT7_EXT}; @@ -4996,7 +4996,17 @@ int GLBE_FBO_Update(fbostate_t *state, unsigned int enables, texid_t *destcol, i } for (i = 0; i < mrt; i++) - qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_TEXTURE_2D, destcol[i]->num, 0); + { + if ((destcol[i]->flags & IF_TEXTYPE) == IF_CUBEMAP) + { + //fixme: we should probably support whole-cubemap rendering for shadowmaps or something. + qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + layer, destcol[i]->num, 0); + } + else + { //layer does not make sense here + qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_TEXTURE_2D, destcol[i]->num, 0); + } + } i = qglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (GL_FRAMEBUFFER_COMPLETE_EXT != i) @@ -5199,7 +5209,7 @@ void GLBE_DrawLightPrePass(qbyte *vis) } /*set the FB up to draw surface info*/ - oldfbo = GLBE_FBO_Update(&shaderstate.fbo_lprepass, FBO_RB_DEPTH, &shaderstate.tex_normals, 1, r_nulltex, vid.pixelwidth, vid.pixelheight); + oldfbo = GLBE_FBO_Update(&shaderstate.fbo_lprepass, FBO_RB_DEPTH, &shaderstate.tex_normals, 1, r_nulltex, vid.pixelwidth, vid.pixelheight, 0); GL_ForceDepthWritable(); //FIXME: should probably clear colour buffer too. qglClear(GL_DEPTH_BUFFER_BIT); @@ -5215,7 +5225,7 @@ void GLBE_DrawLightPrePass(qbyte *vis) /*reconfigure - now drawing diffuse light info using the previous fb image as a source image*/ GLBE_FBO_Sources(shaderstate.tex_normals, r_nulltex); - GLBE_FBO_Update(&shaderstate.fbo_lprepass, FBO_RB_DEPTH, &shaderstate.tex_diffuse, 1, r_nulltex, vid.pixelwidth, vid.pixelheight); + GLBE_FBO_Update(&shaderstate.fbo_lprepass, FBO_RB_DEPTH, &shaderstate.tex_diffuse, 1, r_nulltex, vid.pixelwidth, vid.pixelheight, 0); BE_SelectMode(BEM_STANDARD); qglClearColor (0,0,0,1); diff --git a/engine/gl/gl_bloom.c b/engine/gl/gl_bloom.c index 45d08b410..c5c7a1e39 100644 --- a/engine/gl/gl_bloom.c +++ b/engine/gl/gl_bloom.c @@ -197,7 +197,7 @@ void R_BloomBlend (texid_t source, int x, int y, int w, int h) if (i == 0) { /*filter the screen into a downscaled image*/ - oldfbo = GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][0], 1, r_nulltex, 0, 0); + oldfbo = GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][0], 1, r_nulltex, 0, 0, 0); GLBE_FBO_Sources(source, r_nulltex); qglViewport (0, 0, texwidth[0], texheight[0]); R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomfilter); @@ -205,7 +205,7 @@ void R_BloomBlend (texid_t source, int x, int y, int w, int h) else { /*simple downscale that multiple times*/ - GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][i], 1, r_nulltex, 0, 0); + GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][i], 1, r_nulltex, 0, 0, 0); GLBE_FBO_Sources(pingtex[0][i-1], r_nulltex); qglViewport (0, 0, texwidth[i], texheight[i]); R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomrescale); @@ -219,7 +219,7 @@ void R_BloomBlend (texid_t source, int x, int y, int w, int h) */ r_worldentity.glowmod[0] = 1.2 / texwidth[i]; r_worldentity.glowmod[1] = 0; - GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[1][i], 1, r_nulltex, 0, 0); + GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[1][i], 1, r_nulltex, 0, 0, 0); GLBE_FBO_Sources(pingtex[0][i], r_nulltex); qglViewport (0, 0, texwidth[i], texheight[i]); BE_SelectEntity(&r_worldentity); @@ -227,7 +227,7 @@ void R_BloomBlend (texid_t source, int x, int y, int w, int h) r_worldentity.glowmod[0] = 0; r_worldentity.glowmod[1] = 1.2 / texheight[i]; - GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][i], 1, r_nulltex, 0, 0); + GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][i], 1, r_nulltex, 0, 0, 0); GLBE_FBO_Sources(pingtex[1][i], r_nulltex); qglViewport (0, 0, texwidth[i], texheight[i]); BE_SelectEntity(&r_worldentity); diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index ab21091d5..0509996fd 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -1387,6 +1387,9 @@ qboolean R_RenderScene_Cubemap(void) shader_t *shader; int facemask; extern cvar_t r_projection; + int oldfbo = -1; + qboolean usefbo = true; //this appears to be a 20% speedup in my tests. + static fbostate_t fbostate; //FIXME /*needs glsl*/ if (!gl_config.arb_shader_objects) @@ -1494,7 +1497,7 @@ qboolean R_RenderScene_Cubemap(void) else cmapsize = prect.height; } - else + else if (!usefbo) { while (cmapsize > prect.width || cmapsize > prect.height) { @@ -1502,6 +1505,14 @@ qboolean R_RenderScene_Cubemap(void) } } + if (usefbo) + { + r_refdef.flags |= RDF_FISHEYE; + vid.fbpwidth = vid.fbpheight = cmapsize; + } + + //FIXME: gl_max_size + VectorCopy(r_refdef.viewangles, saveang); saveang[2] = 0; @@ -1539,6 +1550,7 @@ qboolean R_RenderScene_Cubemap(void) ang[1][1] = 90; ang[1][2] = saveang[0]; ang[5][0] = -saveang[0]*2; + //in theory, we could use a geometry shader to duplicate the polygons to each face. //that would of course require that every bit of glsl had such a geometry shader. //it would at least reduce cpu load quite a bit. @@ -1547,24 +1559,38 @@ qboolean R_RenderScene_Cubemap(void) if (!(facemask & (1<= ERR_PARSEERRORS) { if (!file || !*file) - printf ("error%s: %s\n", wnam, string); + printf (":: error%s: %s\n", wnam, string); else if (flag_msvcstyle) printf ("%s(%i) : error%s: %s\n", file, line, wnam, string); else @@ -3383,7 +3383,7 @@ pbool VARGS QCC_PR_PrintWarning (int type, const char *file, int line, const cha else if (qccwarningaction[type] == 2) { //-werror if (!file || !*file) - printf ("werror%s: %s\n", wnam, string); + printf (": werror%s: %s\n", wnam, string); else if (flag_msvcstyle) printf ("%s(%i) : werror%s: %s\n", file, line, wnam, string); else @@ -3393,7 +3393,7 @@ pbool VARGS QCC_PR_PrintWarning (int type, const char *file, int line, const cha else { if (!file || !*file) - printf ("warning%s: %s\n", wnam, string); + printf (": warning%s: %s\n", wnam, string); else if (flag_msvcstyle) printf ("%s(%i) : warning%s: %s\n", file, line, wnam, string); else diff --git a/engine/qclib/qccgui.c b/engine/qclib/qccgui.c index 9d5c800c3..f0e181537 100644 --- a/engine/qclib/qccgui.c +++ b/engine/qclib/qccgui.c @@ -14,7 +14,7 @@ #define EMBEDDEBUG -void AddSourceFile(char *format, ...); +void AddSourceFile(const char *parentsrc, const char *filename); void GUI_ParseCommandLine(char *args); void GUI_RevealOptions(void); @@ -331,10 +331,7 @@ int PDECL QCC_PopFileSize (const char *fname) int len = QCC_RawFileSize(fname); if (len >= 0 && qcc_compileactive) { - if (strcmp(compilingrootfile, fname)) - AddSourceFile("%s/%s", compilingrootfile, fname); - else - AddSourceFile("%s", fname); + AddSourceFile(compilingrootfile, fname); } return len; } @@ -4096,7 +4093,7 @@ int GUIprintf(const char *msg, ...) char rn[3] = "\n"; char *st, *s; int args; - MSG wmsg; +// MSG wmsg; DWORD col; @@ -4141,7 +4138,7 @@ int GUIprintf(const char *msg, ...) return 0; } - if (strstr(buf, ": error")) + if (strstr(buf, ": error") || strstr(buf, ": werror")) { if (outstatus < 2) { @@ -4336,11 +4333,12 @@ void RunCompiler(char *args, pbool quick) else logfile = NULL; - SendMessage(outputbox, WM_SETREDRAW, FALSE, 0); + if (outputbox) + SendMessage(outputbox, WM_SETREDRAW, FALSE, 0); argc = GUI_BuildParms(args, argv, quick); - if (CompileParams(&funcs, compilecb, argc, argv)) + if (CompileParams(&funcs, outputbox?compilecb:NULL, argc, argv)) { if (!quick) { @@ -4350,8 +4348,11 @@ void RunCompiler(char *args, pbool quick) } } - SendMessage(outputbox, WM_SETREDRAW, TRUE, 0); - RedrawWindow(outputbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + if (outputbox) + { + SendMessage(outputbox, WM_SETREDRAW, TRUE, 0); + RedrawWindow(outputbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + } if (logfile) fclose(logfile); @@ -4457,20 +4458,19 @@ void GrepAllFiles(char *string) else GUIprintf("grep found nothing\n"); } -void AddSourceFile(char *format, ...) +void AddSourceFile(const char *parentpath, const char *filename) { - va_list argptr; char string[1024]; + unsigned int flags = 0; + HANDLE pi; TVINSERTSTRUCT item; TV_ITEM parent; char parentstring[256]; char *slash; - va_start (argptr, format); - vsnprintf (string,sizeof(string)-1, format,argptr); - va_end (argptr); + QC_strlcpy(string, filename, sizeof(string)); memset(&item, 0, sizeof(item)); @@ -4482,12 +4482,41 @@ void AddSourceFile(char *format, ...) item.item.state = TVIS_EXPANDED; item.item.stateMask = TVIS_EXPANDED; item.item.mask = TVIF_TEXT|TVIF_STATE|TVIF_PARAM; + + if (parentpath && stricmp(parentpath, filename)) + { + item.hParent = TreeView_GetChild(projecttree, item.hParent); + do + { + parent.hItem = item.hParent; + parent.mask = TVIF_TEXT; + parent.pszText = parentstring; + parent.cchTextMax = sizeof(parentstring)-1; + if (TreeView_GetItem(projecttree, &parent)) + { + if (!stricmp(parent.pszText, parentpath)) + { + pi = item.hParent; + break; + } + } + } while(item.hParent=TreeView_GetNextSibling(projecttree, item.hParent)); + } + else + parentpath = NULL; + while(item.item.pszText) { - slash = strchr(item.item.pszText, '/'); - if (slash) - *slash++ = '\0'; - item.hParent = TreeView_GetChild(projecttree, item.hParent); + if (parentpath) + { + slash = strchr(item.item.pszText, '/'); + if (slash) + *slash++ = '\0'; + } + else + slash = NULL; + + item.hParent = TreeView_GetChild(projecttree, pi); do { parent.hItem = item.hParent; @@ -4500,10 +4529,11 @@ void AddSourceFile(char *format, ...) break; } } while(item.hParent=TreeView_GetNextSibling(projecttree, item.hParent)); + if (!item.hParent) { //add a directory. item.hParent = pi; - item.item.lParam = !slash; + item.item.lParam = !slash; //lparam = false if we're only adding this node to get at a child. pi = (HANDLE)SendMessage(projecttree,TVM_INSERTITEM,0,(LPARAM)&item); item.hParent = pi; } @@ -4548,15 +4578,15 @@ void SetProgsSrc(void) if (*qcc_token == '#') { //aaaahhh! newstyle! - AddSourceFile("%s", progssrcname); + AddSourceFile(NULL, progssrcname); } else { pr_file_p = QCC_COM_Parse(pr_file_p); //we dont care about the produced progs.dat - AddSourceFile("%s", progssrcname); + AddSourceFile(NULL, progssrcname); while(pr_file_p) { - AddSourceFile("%s/%s", progssrcname, qcc_token); + AddSourceFile(progssrcname, qcc_token); pr_file_p = QCC_COM_Parse(pr_file_p); //we dont care about the produced progs.dat } } diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index fb57949e0..0288cd4ed 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -57,15 +57,17 @@ QCC_def_t *sourcefilesdefs[MAXSOURCEFILESLIST]; int sourcefilesnumdefs; int currentsourcefile; int numsourcefiles; -extern char *compilingfile; -char compilingrootfile[1024]; +extern char *compilingfile; //file currently being compiled +char compilingrootfile[1024]; //the .src file we started from (the current one, not original) + +char qccmsourcedir[1024]; //the -src path, for #includes void QCC_PR_ResetErrorScope(void); pbool compressoutput; pbool newstylesource; -char destfile[1024]; +char destfile[1024]; //the file we're going to output to QCC_eval_t *qcc_pr_globals; unsigned int numpr_globals; @@ -760,14 +762,18 @@ int WriteBodylessFuncs (int handle) void QCC_DetermineNeededSymbols(QCC_def_t *endsyssym) { - QCC_def_t *sym; + QCC_def_t *sym = pr.def_head.next; size_t i; //make sure system defs are not hurt by this. - for (sym = pr.def_head.next; sym; sym = sym->next) + if (endsyssym) { - sym->used = true; - if (sym == endsyssym) - break; + for (; sym; sym = sym->next) + { + sym->used = true; + sym->referenced = true; //silence warnings about unreferenced things that can't be stripped + if (sym == endsyssym) + break; + } } //non-system fields should maybe be present too. for (; sym; sym = sym->next) @@ -1573,8 +1579,10 @@ strofs = (strofs+3)&~3; printf(" %s)\n", QCC_VarAtOffset(statements[i].c, 1)); } #endif - if ((signed)a >= (signed)numpr_globals || (signed)b >= (signed)numpr_globals || (signed)c >= (signed)numpr_globals) - printf("invalid offset\n"); +#ifdef _DEBUG + if (((signed)a >= (signed)numpr_globals && statements[i].a.sym) || ((signed)b >= (signed)numpr_globals && statements[i].b.sym) || ((signed)c >= (signed)numpr_globals && statements[i].c.sym)) + printf("invalid offset on %s instruction\n", pr_opcodes[statements[i].op].opname); +#endif if (a < 0) statements16[i].a = PRLittleShort(a); else @@ -2674,10 +2682,10 @@ unsigned short QCC_PR_WriteProgdefs (char *filename) break; case 32401: - QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "Warning: please update your tenebrae system defs.\n"); + QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "please update your tenebrae system defs.\n"); break; default: - QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "Warning: progs CRC not recognised from quake nor clones\n"); + QCC_PR_Warning(WARN_SYSTEMCRC, NULL, 0, "progs CRC not recognised from quake nor clones\n"); break; } @@ -3328,7 +3336,6 @@ char *qccmsrc; char *qccmsrc2; char qccmfilename[1024]; char qccmprogsdat[1024]; -char qccmsourcedir[1024]; void QCC_FinishCompile(void); @@ -3502,6 +3509,65 @@ int QCC_FindQCFiles(const char *sourcedir) return numfiles; } + +void QCC_GenerateRelativePath(char *dest, size_t destsize, char *base, char *relative) +{ + int p; + char *s1, *s2; + QC_strlcpy (dest, base, destsize); + s1 = strchr(dest, '\\'); + s2 = strchr(dest, '/'); + if (s2 > s1) + s1 = s2; + if (s1) + *s1 = 0; + else + *dest = 0; + + p=0; + s2 = relative; + for (;;) + { + if (!strncmp(s2, "./", 2)) + s2+=2; + else if(!strncmp(s2, "../", 3)) + { + s2+=3; + p++; + } + else + break; + } + for (s1=dest+strlen(dest)-1;p && s1>=dest; s1--) + { + if (*s1 == '/' || *s1 == '\\') + { + *s1 = '\0'; + p--; + } + } + if (*dest) + { + if (p) + { //we were still looking for a separator, but didn't find one, so kill the entire path. + QC_strlcpy(dest, "", destsize); + p--; + } + else + QC_strlcat(dest, "/", destsize); + } + QC_strlcat(dest, s2, destsize); + + while (p>0 && strlen(dest)+3 < destsize) + { + memmove(dest+3, dest, strlen(dest)+1); + dest[0] = '.'; + dest[1] = '.'; + dest[2] = '/'; + p--; + } +} + int qcc_compileactive = false; extern int accglobalsblock; char *originalqccmsrc; //for autoprototype. @@ -3514,9 +3580,6 @@ pbool QCC_main (int argc, char **argv) //as part of the quake engine int p; extern int qccpersisthunk; -#ifndef QCCONLY - char destfile2[1024], *s2; -#endif char *s; if (numsourcefiles && currentsourcefile == numsourcefiles) @@ -3894,41 +3957,8 @@ newstyle: if (!qccmsrc) QCC_Error (ERR_NOOUTPUT, "No destination filename. qcc -help for info."); - strcpy (destfile, qcc_token); -#ifndef QCCONLY - p=0; - s2 = strcpy(destfile2, destfile); - if (!strncmp(s2, "./", 2)) - s2+=2; - else - { - while(!strncmp(s2, "../", 3)) - { - s2+=3; - p++; - } - } - strcpy(qccmfilename, qccmsourcedir); - for (s=qccmfilename+strlen(qccmfilename);p && s>=qccmfilename; s--) - { - if (*s == '/' || *s == '\\') - { - *(s+1) = '\0'; - p--; - } - } - sprintf(destfile, "%s", s2); - - while (p>0) - { - memmove(destfile+3, destfile, strlen(destfile)+1); - destfile[0] = '.'; - destfile[1] = '.'; - destfile[2] = '/'; - p--; - } -#endif + QCC_GenerateRelativePath(destfile, sizeof(destfile), qccmprogsdat, qcc_token); p = QCC_CheckParm ("-o"); if (p > 0 && p < argc-1 && argv[p+1][0] != '-') @@ -3977,7 +4007,6 @@ void new_QCC_ContinueCompile(void); //called between exe frames - won't loose net connection (is the theory)... void QCC_ContinueCompile(void) { - char *s, *s2; currentchunk = NULL; if (!qcc_compileactive) //HEY! @@ -4032,38 +4061,8 @@ void QCC_ContinueCompile(void) } return; } - s = qcc_token; + QCC_GenerateRelativePath(qccmfilename, sizeof(qccmfilename), compilingrootfile, qcc_token); - strcpy (qccmfilename, qccmsourcedir); - while(1) - { - if (!strncmp(s, "..\\", 3) || !strncmp(s, "../", 3)) - { - s2 = qccmfilename + strlen(qccmfilename)-2; - while (s2>=qccmfilename) - { - if (*s2 == '/' || *s2 == '\\') - { - s2[1] = '\0'; - break; - } - s2--; - } - if (s2>=qccmfilename) - { - s+=3; - continue; - } - } - if (!strncmp(s, ".\\", 2) || !strncmp(s, "./", 2)) - { - s+=2; - continue; - } - - break; - } - strcat (qccmfilename, s); if (autoprototype) printf ("prototyping %s\n", qccmfilename); else @@ -4118,6 +4117,9 @@ void QCC_FinishCompile(void) // write progdefs.h crc = QCC_PR_WriteProgdefs ("progdefs.h"); + if (pr_error_count) + QCC_Error (ERR_PARSEERRORS, "compilation errors"); + // write data file donesomething = QCC_WriteData (crc); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 12eb6bea6..98a697b1f 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -685,6 +685,7 @@ void SV_DropClient (client_t *drop) if (drop->controlled) { drop->controlled->controller = NULL; + drop->controlled->protocol = SCP_BAD; //with the controller dead, make sure we don't try sending anything to it SV_DropClient(drop->controlled); drop->controlled = NULL; } @@ -2904,11 +2905,17 @@ client_t *SVC_DirectConnect(void) } //only advertise PEXT_SPLITSCREEN when splitscreen is allowed, to avoid spam. this might mean people need to reconnect after its enabled. oh well. - if (!sv_allow_splitscreen.ival) + if (!sv_allow_splitscreen.ival && newcl->netchan.remote_address.type != NA_LOOPBACK) + { newcl->fteprotocolextensions &= ~PEXT_SPLITSCREEN; - - for (clients = 1; clients < numssclients; clients++) - SV_AddSplit(newcl, userinfo[clients], clients); + if (numssclients > 1) + SV_PrintToClient(newcl, PRINT_HIGH, "Splitscreen is disabled on this server\n"); + } + else + { + for (clients = 1; clients < numssclients; clients++) + SV_AddSplit(newcl, userinfo[clients], clients); + } #if 0 for (clients = 1; clients < numssclients; clients++) { @@ -3285,8 +3292,9 @@ qboolean SV_ConnectionlessPacket (void) SVC_ACK (); else if (!strcmp(c,"status")) { - if (SVC_ThrottleInfo()) - SVC_Status (); + if (sv_public.ival >= 0) + if (SVC_ThrottleInfo()) + SVC_Status (); } else if (!strcmp(c,"log")) { @@ -3296,8 +3304,9 @@ qboolean SV_ConnectionlessPacket (void) #ifdef Q2SERVER else if (!strcmp(c, "info")) { - if (SVC_ThrottleInfo()) - SVC_InfoQ2 (); + if (sv_public.ival >= 0) + if (SVC_ThrottleInfo()) + SVC_InfoQ2 (); } #endif else if (!strncmp(c,"connect", 7)) @@ -3346,13 +3355,15 @@ qboolean SV_ConnectionlessPacket (void) /*for DP*/ else if (!strcmp(c, "getstatus")) { - if (SVC_ThrottleInfo()) - SVC_GetInfo(Cmd_Args(), true); + if (sv_public.ival >= 0) + if (SVC_ThrottleInfo()) + SVC_GetInfo(Cmd_Args(), true); } else if (!strcmp(c, "getinfo")) { - if (SVC_ThrottleInfo()) - SVC_GetInfo(Cmd_Args(), false); + if (sv_public.ival >= 0) + if (SVC_ThrottleInfo()) + SVC_GetInfo(Cmd_Args(), false); } #endif else if (!strcmp(c, "rcon")) @@ -3570,6 +3581,8 @@ qboolean SVNQ_ConnectionlessPacket(void) } return true; case CCREQ_SERVER_INFO: + if (sv_public.ival < 0) + return false; if (SV_BannedReason (&net_from)) return false; if (Q_strcmp (MSG_ReadString(), NQ_NETCHAN_GAMENAME) != 0) @@ -3598,6 +3611,8 @@ qboolean SVNQ_ConnectionlessPacket(void) NET_SendPacket(NS_SERVER, sb.cursize, sb.data, &net_from); return true; case CCREQ_PLAYER_INFO: + if (sv_public.ival < 0) + return false; if (SV_BannedReason (&net_from)) return false; /*one request per player, ouch ouch ouch, what will it make of 32 players, I wonder*/ @@ -3628,6 +3643,8 @@ qboolean SVNQ_ConnectionlessPacket(void) NET_SendPacket(NS_SERVER, sb.cursize, sb.data, &net_from); return true; case CCREQ_RULE_INFO: + if (sv_public.ival < 0) + return false; if (SV_BannedReason (&net_from)) return false;