From 19ab4fd0507103984144018a4636c40317df9fb6 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 2 Jan 2006 23:01:54 +0000 Subject: [PATCH] Meh, I'm just going to commit everything. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1778 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_cg.c | 2 +- engine/client/cl_ents.c | 4 +- engine/client/cl_main.c | 11 ++++-- engine/client/cl_plugin.inc | 79 ++++++++++++++++++++++++++----------- engine/client/cl_screen.c | 2 +- engine/client/client.h | 2 +- engine/client/clq3_parse.c | 21 +++++----- engine/client/in_win.c | 8 ++++ engine/client/pr_menu.c | 2 +- engine/client/renderer.c | 2 - engine/common/cmd.c | 27 ++++++++----- engine/gl/gl_alias.c | 22 +++++++++++ engine/gl/gl_backend.c | 6 +-- engine/gl/gl_draw.c | 45 +++++++++------------ engine/gl/gl_model.c | 11 +++--- engine/gl/gl_ppl.c | 5 +++ engine/gl/gl_rmain.c | 1 - engine/http/httpclient.c | 4 +- engine/qclib/qccguistuff.c | 10 +++++ 19 files changed, 173 insertions(+), 91 deletions(-) diff --git a/engine/client/cl_cg.c b/engine/client/cl_cg.c index 700ca20d0..eaf862934 100644 --- a/engine/client/cl_cg.c +++ b/engine/client/cl_cg.c @@ -447,7 +447,7 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long Con_Printf("%s", VM_POINTER(arg[0])); break; case CG_ERROR: - Host_EndGame("%s", VM_POINTER(arg[0])); + Host_EndGame("%s", VM_POINTER(arg[0])); break; case CG_ARGC: diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 6cd7fb5fc..eacb718bc 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1451,7 +1451,7 @@ packet_entities_t *CL_ProcessPacketEntities(float *servertime, qboolean nolerp) { //force our emulated time to as late as we can. //this will disable all position interpolation *servertime = cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities.servertime; - Con_DPrintf("No lerp\n"); +// Con_DPrintf("No lerp\n"); } packnew = NULL; @@ -1496,7 +1496,7 @@ packet_entities_t *CL_ProcessPacketEntities(float *servertime, qboolean nolerp) CL_TransitionPacketEntities(packnew, packold, *servertime); - Con_DPrintf("%f %f %f %f %f %f\n", packnew->servertime, *servertime, packold->servertime, cl.gametime, cl.oldgametime, cl.servertime); +// Con_DPrintf("%f %f %f %f %f %f\n", packnew->servertime, *servertime, packold->servertime, cl.gametime, cl.oldgametime, cl.servertime); // if (packold->servertime < oldoldtime) // Con_Printf("Spike screwed up\n"); diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 84a5b7d60..8ea570215 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -829,7 +829,7 @@ void CL_Rcon_f (void) int i; netadr_t to; - if (!rcon_password.string) //FIXME: this is strange... + if (!*rcon_password.string) //FIXME: this is strange... { Con_TPrintf (TLC_NORCONPASSWORD); return; @@ -1038,7 +1038,8 @@ void CL_Disconnect (void) #ifndef CLIENTONLY //running a server, and it's our own - if (serverrunning && !tolocalserver)SV_UnspawnServer(); + if (serverrunning && !tolocalserver) + SV_UnspawnServer(); #endif } Cam_Reset(); @@ -1058,7 +1059,7 @@ void CL_Disconnect (void) cls.downloadmethod = DL_NONE; if (cls.downloadqw) { - fclose(cls.downloadqw); + VFS_CLOSE(cls.downloadqw); cls.downloadqw = NULL; } if (!cls.downloadmethod) @@ -2733,6 +2734,8 @@ void VARGS Host_EndGame (char *message, ...) CL_Disconnect (); + SV_UnspawnServer(); + Cvar_Set(&cl_shownet, "0"); longjmp (host_abort, 1); @@ -2789,7 +2792,7 @@ void Host_WriteConfiguration (void) return; } - f = FS_OpenVFS(va("%s.cfg",cfg_save_name.string), "w", FS_GAMEONLY); + f = FS_OpenVFS(va("%s.cfg",cfg_save_name.string), "wb", FS_GAMEONLY); if (!f) { Con_TPrintf (TLC_CONFIGCFG_WRITEFAILED); diff --git a/engine/client/cl_plugin.inc b/engine/client/cl_plugin.inc index 1fe23d0b5..3a8d50b32 100644 --- a/engine/client/cl_plugin.inc +++ b/engine/client/cl_plugin.inc @@ -13,6 +13,9 @@ static plugin_t *protocolclientplugin; int VARGS Plug_Menu_Control(void *offset, unsigned int mask, const long *arg) { + if (qrenderer <= 0) + return 0; + switch(VM_LONG(arg[0])) { case 0: //take away all menus @@ -53,6 +56,9 @@ int VARGS Plug_Key_GetKeyCode(void *offset, unsigned int mask, const long *arg) int VARGS Plug_SCR_CenterPrint(void *offset, unsigned int mask, const long *arg) { + if (qrenderer <= 0) + return 0; + SCR_CenterPrint(0, VM_POINTER(arg[0])); return 0; } @@ -66,6 +72,9 @@ int VARGS Plug_Media_ShowFrameRGBA_32(void *offset, unsigned int mask, const lon int width = VM_LONG(arg[5]); int height = VM_LONG(arg[6]); + if (qrenderer <= 0) + return 0; + Media_ShowFrameRGBA_32(src, srcwidth, srcheight); return 0; } @@ -110,7 +119,7 @@ int VARGS Plug_Draw_LoadImage(void *offset, unsigned int mask, const long *arg) if (pluginimagearray[i].pic) return i; //already loaded. - if (qrenderer) + if (qrenderer > 0) { if (fromwad && Draw_SafePicFromWad) pic = Draw_SafePicFromWad(name); @@ -175,7 +184,7 @@ int VARGS Plug_Draw_Image(void *offset, unsigned int mask, const long *arg) { mpic_t *pic; int i; - if (!qrenderer) + if (qrenderer <= 0) return 0; if (!Draw_Image) return 0; @@ -211,11 +220,15 @@ int VARGS Plug_Draw_Line(void *offset, unsigned int mask, const long *arg) qglEnable(GL_TEXTURE_2D); break; #endif + default: + return 0; } return 1; } int VARGS Plug_Draw_Character(void *offset, unsigned int mask, const long *arg) { + if (qrenderer <= 0) + return 0; Draw_Character(arg[0], arg[1], (unsigned int)arg[2]); return 0; } @@ -223,6 +236,8 @@ int VARGS Plug_Draw_Character(void *offset, unsigned int mask, const long *arg) int VARGS Plug_Draw_Fill(void *offset, unsigned int mask, const long *arg) { float x, y, width, height; + if (qrenderer <= 0) + return 0; x = VM_FLOAT(arg[0]); y = VM_FLOAT(arg[1]); width = VM_FLOAT(arg[2]); @@ -289,6 +304,9 @@ int VARGS Plug_Draw_Colour4f(void *offset, unsigned int mask, const long *arg) int VARGS Plug_LocalSound(void *offset, unsigned int mask, const long *arg) { + if (qrenderer <= 0) + return false; + S_LocalSound(VM_POINTER(arg[0])); return 0; } @@ -306,6 +324,9 @@ int VARGS Plug_CL_GetStats(void *offset, unsigned int mask, const long *arg) if (VM_OOB(arg[1], arg[2]*4)) return 0; + if (qrenderer <= 0) + return false; + max = pluginstats; if (max > MAX_CL_STATS) max = MAX_CL_STATS; @@ -324,6 +345,10 @@ int VARGS Plug_Con_SubPrint(void *offset, unsigned int mask, const long *arg) char *name = VM_POINTER(arg[0]); char *text = VM_POINTER(arg[1]); console_t *con; + + if (qrenderer <= 0) + return false; + con = Con_FindConsole(name); if (!con) { @@ -345,6 +370,8 @@ int VARGS Plug_Con_RenameSub(void *offset, unsigned int mask, const long *arg) { char *name = VM_POINTER(arg[0]); console_t *con; + if (qrenderer <= 0) + return false; con = Con_FindConsole(name); if (!con) return 0; @@ -357,6 +384,8 @@ int VARGS Plug_Con_IsActive(void *offset, unsigned int mask, const long *arg) { char *name = VM_POINTER(arg[0]); console_t *con; + if (qrenderer <= 0) + return false; con = Con_FindConsole(name); if (!con) return false; @@ -367,6 +396,8 @@ int VARGS Plug_Con_SetActive(void *offset, unsigned int mask, const long *arg) { char *name = VM_POINTER(arg[0]); console_t *con; + if (qrenderer <= 0) + return false; con = Con_FindConsole(name); if (!con) con = Con_Create(name); @@ -378,6 +409,8 @@ int VARGS Plug_Con_Destroy(void *offset, unsigned int mask, const long *arg) { char *name = VM_POINTER(arg[0]); console_t *con; + if (qrenderer <= 0) + return false; con = Con_FindConsole(name); if (!con) return false; @@ -392,6 +425,8 @@ int VARGS Plug_Con_NameForNum(void *offset, unsigned int mask, const long *arg) int buffersize = VM_LONG(arg[2]); if (VM_OOB(arg[1], arg[2]) || buffersize < 1) return false; + if (qrenderer <= 0) + return false; return Con_NameForNum(num, buffer, buffersize); } @@ -400,29 +435,29 @@ int VARGS Plug_Con_NameForNum(void *offset, unsigned int mask, const long *arg) void Plug_Client_Init(void) { - Plug_RegisterBuiltin("CL_GetStats", Plug_CL_GetStats, 0); - Plug_RegisterBuiltin("Menu_Control", Plug_Menu_Control, 0); - Plug_RegisterBuiltin("Key_GetKeyCode", Plug_Key_GetKeyCode, 0); + Plug_RegisterBuiltin("CL_GetStats", Plug_CL_GetStats, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Menu_Control", Plug_Menu_Control, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Key_GetKeyCode", Plug_Key_GetKeyCode, PLUG_BIF_NEEDSRENDERER); - Plug_RegisterBuiltin("Draw_LoadImage", Plug_Draw_LoadImage, 0); - Plug_RegisterBuiltin("Draw_Image", Plug_Draw_Image, 0); - Plug_RegisterBuiltin("Draw_Character", Plug_Draw_Character, 0); - Plug_RegisterBuiltin("Draw_Fill", Plug_Draw_Fill, 0); - Plug_RegisterBuiltin("Draw_Line", Plug_Draw_Line, 0); - Plug_RegisterBuiltin("Draw_Colourp", Plug_Draw_ColourP, 0); - Plug_RegisterBuiltin("Draw_Colour3f", Plug_Draw_Colour3f, 0); - Plug_RegisterBuiltin("Draw_Colour4f", Plug_Draw_Colour4f, 0); + Plug_RegisterBuiltin("Draw_LoadImage", Plug_Draw_LoadImage, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Draw_Image", Plug_Draw_Image, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Draw_Character", Plug_Draw_Character, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Draw_Fill", Plug_Draw_Fill, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Draw_Line", Plug_Draw_Line, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Draw_Colourp", Plug_Draw_ColourP, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Draw_Colour3f", Plug_Draw_Colour3f, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Draw_Colour4f", Plug_Draw_Colour4f, PLUG_BIF_NEEDSRENDERER); - Plug_RegisterBuiltin("Con_SubPrint", Plug_Con_SubPrint, 0); - Plug_RegisterBuiltin("Con_RenameSub", Plug_Con_RenameSub, 0); - Plug_RegisterBuiltin("Con_IsActive", Plug_Con_IsActive, 0); - Plug_RegisterBuiltin("Con_SetActive", Plug_Con_SetActive, 0); - Plug_RegisterBuiltin("Con_Destroy", Plug_Con_Destroy, 0); - Plug_RegisterBuiltin("Con_NameForNum", Plug_Con_NameForNum, 0); + Plug_RegisterBuiltin("Con_SubPrint", Plug_Con_SubPrint, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Con_RenameSub", Plug_Con_RenameSub, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Con_IsActive", Plug_Con_IsActive, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Con_SetActive", Plug_Con_SetActive, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Con_Destroy", Plug_Con_Destroy, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Con_NameForNum", Plug_Con_NameForNum, PLUG_BIF_NEEDSRENDERER); - Plug_RegisterBuiltin("LocalSound", Plug_LocalSound, 0); - Plug_RegisterBuiltin("SCR_CenterPrint", Plug_SCR_CenterPrint, 0); - Plug_RegisterBuiltin("Media_ShowFrameRGBA_32", Plug_Media_ShowFrameRGBA_32, 0); + Plug_RegisterBuiltin("LocalSound", Plug_LocalSound, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("SCR_CenterPrint", Plug_SCR_CenterPrint, PLUG_BIF_NEEDSRENDERER); + Plug_RegisterBuiltin("Media_ShowFrameRGBA_32", Plug_Media_ShowFrameRGBA_32, PLUG_BIF_NEEDSRENDERER); } void Plug_Client_Close(plugin_t *plug) diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 2a4011f8c..ca3c473a9 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -1576,7 +1576,7 @@ void SCR_ScreenShot_f (void) pcxname[18] = (i%100)/10 + '0'; pcxname[19] = (i%10) + '0'; sprintf (checkname, "%s/%s", com_gamedir, pcxname); - if (!(vfs = FS_OpenVFS(pcxname, "r", FS_GAMEONLY))) + if (!(vfs = FS_OpenVFS(pcxname, "rb", FS_GAMEONLY))) break; // file doesn't exist VFS_CLOSE(vfs); } diff --git a/engine/client/client.h b/engine/client/client.h index b79f26e67..747d409a7 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -329,7 +329,7 @@ typedef struct #endif enum {DL_NONE, DL_QW, DL_QWCHUNKS, DL_Q3, DL_QWPENDING, DL_HTTP, DL_FTP} downloadmethod; - FILE *downloadqw; // file transfer from server + vfsfile_t *downloadqw; // file transfer from server char downloadtempname[MAX_OSPATH]; char downloadname[MAX_OSPATH]; int downloadpercent; diff --git a/engine/client/clq3_parse.c b/engine/client/clq3_parse.c index dd52797f3..98b48a922 100644 --- a/engine/client/clq3_parse.c +++ b/engine/client/clq3_parse.c @@ -396,7 +396,7 @@ void CLQ3_ParseDownload(void) } COM_CreatePath(cls.downloadtempname); - cls.downloadqw = fopen(cls.downloadtempname, "wb"); + cls.downloadqw = FS_OpenVFS(cls.downloadtempname, "wb", FS_BASE); if (!cls.downloadqw) { Con_Printf("Couldn't write to temporary file %s - stopping download\n", cls.downloadtempname); @@ -410,9 +410,9 @@ void CLQ3_ParseDownload(void) if (!chunksize) { - fclose(cls.downloadqw); + VFS_CLOSE(cls.downloadqw); cls.downloadqw = NULL; - rename(cls.downloadtempname, cls.downloadname); // -> + FS_Rename(cls.downloadtempname, cls.downloadname, FS_BASE); // -> *cls.downloadtempname = *cls.downloadname = 0; cls.downloadmethod = DL_NONE; @@ -423,9 +423,9 @@ void CLQ3_ParseDownload(void) } else { - fwrite(chunkdata, chunksize, 1, cls.downloadqw); - chunksize=ftell(cls.downloadqw); - Con_Printf("Recieved %i\n", chunksize); + VFS_WRITE(cls.downloadqw, chunkdata, chunksize); + chunksize=VFS_TELL(cls.downloadqw); +// Con_Printf("Recieved %i\n", chunksize); cls.downloadpercent = (100.0 * chunksize) / downloadsize; } @@ -474,14 +474,17 @@ qboolean CLQ3_SystemInfoChanged(char *str) while(rn) { - FILE *f; + vfsfile_t *f; rn = COM_Parse(rn); if (!*com_token) break; - f = fopen(va("%s.pk3", com_token), "rb"); + if (!strchr(com_token, '/')) //don't let some muppet tell us to download quake3.exe + break; + + f = FS_OpenVFS(va("%s.pk3", com_token), "rb", FS_BASE); if (f) - fclose(f); + VFS_CLOSE(f); else { //fixme: request to download it diff --git a/engine/client/in_win.c b/engine/client/in_win.c index 2f4539733..be26984dc 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -63,6 +63,8 @@ cvar_t m_threshold_noforce = {"m_threshold_noforce", "0"}; cvar_t cl_keypad = {"cl_keypad", "0"}; +qboolean CSQC_MouseMove(float xdelta, float ydelta); + typedef struct { union { struct { // serial mouse @@ -1409,6 +1411,12 @@ static void ProcessMouse(mouse_t *mouse, usercmd_t *cmd, int pnum) #endif } + if (CSQC_MouseMove(mx, my)) + { + mx = 0; + my = 0; + } + if (m_filter.value) { double fraction = bound(0, m_filter.value, 2) * 0.5; diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 87129202f..cb15c1e68 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -957,7 +957,7 @@ void PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals) int modifier; char *s; - s = PR_GetStringOfs(prinst, OFS_PARM1); + s = PR_GetStringOfs(prinst, OFS_PARM0); i = Key_StringToKeynum(s, &modifier); if (i < 0 || modifier != ~0) { diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 4c2e6b307..4e509ff1e 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -184,7 +184,6 @@ extern cvar_t r_drawviewmodel; extern cvar_t r_speeds; extern cvar_t r_waterwarp; extern cvar_t r_fullbright; -extern cvar_t r_lightmap; extern cvar_t r_shadows; extern cvar_t r_mirroralpha; extern cvar_t r_wateralpha; @@ -253,7 +252,6 @@ void GLRenderer_Init(void) Cvar_Register (&r_novis, GLRENDEREROPTIONS); Cvar_Register (&r_wateralpha, GLRENDEREROPTIONS); Cvar_Register (&r_mirroralpha, GLRENDEREROPTIONS); - Cvar_Register (&r_lightmap, GLRENDEREROPTIONS); Cvar_Register (&r_norefresh, GLRENDEREROPTIONS); diff --git a/engine/common/cmd.c b/engine/common/cmd.c index d2dd773fe..81ab8b20c 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -1228,7 +1228,10 @@ qboolean Cmd_AddCommand (char *cmd_name, xcommand_t function) { if (!Q_strcmp (cmd_name, cmd->name)) { - Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name); + if (cmd->function == function) //happens a lot with q3 + Con_DPrintf ("Cmd_AddCommand: %s already defined\n", cmd_name); + else + Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name); return false; } } @@ -2740,12 +2743,17 @@ void Cmd_WriteConfig_f(void) FS_FlushFSHash(); } +void Cmd_Reset_f(void) +{ +} + #ifndef SERVERONLY // dumps current console contents to a text file void Cmd_Condump_f(void) { - FILE *f; + vfsfile_t *f; char *filename; + unsigned char c; if (!con_current) { @@ -2760,10 +2768,10 @@ void Cmd_Condump_f(void) if (!*filename) filename = "condump"; - filename = va("%s/%s", com_gamedir, filename); + filename = va("%s", filename); COM_DefaultExtension(filename, ".txt"); - f = fopen (filename, "wb"); + f = FS_OpenVFS (filename, "wb", FS_GAME); if (!f) { Con_Printf ("Couldn't write console dump %s\n",filename); @@ -2791,16 +2799,17 @@ void Cmd_Condump_f(void) { content = 1; for (; spc > 0; spc--) - fprintf(f, " "); - fprintf(f, "%c", (qbyte)text[x]&255); + VFS_WRITE(f, " ", 1); + c = (qbyte)text[x]&255; + VFS_WRITE(f, &c, 1); } } if (content) - fprintf(f, "\n"); + VFS_WRITE(f, "\n", 1); } } - fclose(f); + VFS_CLOSE(f); Con_Printf ("Dumped console to %s\n",filename); } @@ -2819,7 +2828,7 @@ void Cmd_Init (void) Cmd_AddCommand ("cfg_save",Cmd_WriteConfig_f); Cmd_AddCommand ("cfg_load",Cmd_Exec_f); - //Cmd_AddCommand ("cfg_reset",Cmd_Reset_f); + Cmd_AddCommand ("cfg_reset",Cmd_Reset_f); Cmd_AddCommand ("exec",Cmd_Exec_f); Cmd_AddCommand ("echo",Cmd_Echo_f); diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index af141e20d..40fa5716d 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -1942,6 +1942,28 @@ void R_DrawGAliasModel (entity_t *e) GL_DrawAliasMesh(&mesh, skin->fullbright); qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } + + if (fog) + { + meshbuffer_t mb; + shader_t dummyshader = {0}; + + R_IBrokeTheArrays(); + + mb.entity = currententity; + mb.shader = &dummyshader; + mb.fog = fog; + mb.mesh = &mesh; + mb.infokey = -1;//currententity->keynum; + mb.dlightbits = 0; + + R_PushMesh(&mesh, mb.shader->features | MF_NONBATCHED | MF_COLORS); + + R_RenderMeshBuffer ( &mb, false ); + + + R_ClearArrays(); + } } } diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 436ea22df..d0c880520 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -2137,7 +2137,7 @@ void R_RenderFogOnMesh ( shader_t *shader, struct mfog_s *fog ) qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); GL_TexEnv(GL_MODULATE); - if ( !shader->numpasses || shader->fog_dist || (shader->flags & SHADER_SKY) ) + if ( !shader || !shader->numpasses || shader->fog_dist || (shader->flags & SHADER_SKY) ) { extern int gldepthfunc; qglDepthFunc ( gldepthfunc ); @@ -2152,7 +2152,7 @@ void R_RenderFogOnMesh ( shader_t *shader, struct mfog_s *fog ) // distance to fog dist = PlaneDiff ( r_origin, fogplane ); - if ( shader->flags & SHADER_SKY ) + if ( shader && shader->flags & SHADER_SKY ) { if ( dist > 0 ) VectorMA( r_origin, -dist, fogplane->normal, viewtofog ); @@ -2192,7 +2192,7 @@ void R_RenderFogOnMesh ( shader_t *shader, struct mfog_s *fog ) currentCoords[1] = -vdist * fogshader->fog_dist + 1.5f/(float)FOG_TEXTURE_HEIGHT; } - if ( !shader->numpasses ) + if ( shader && !shader->numpasses ) { R_LockArrays ( numVerts ); } diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index a56f3ef32..4f119abb9 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -2779,7 +2779,7 @@ void GLDraw_Init15to8(void) int r1, g1, b1; qbyte *pal; float dist, bestdist; - FILE *f; + vfsfile_t *f; qboolean savetable; @@ -2793,13 +2793,13 @@ void GLDraw_Init15to8(void) savetable = COM_CheckParm("-save15to8"); if (savetable) - COM_FOpenFile("glquake/15to8.pal", &f); + f = FS_OpenVFS("glquake/15to8.pal"); else f = NULL; if (f) { - fread(d_15to8table, 1<<15, 1, f); - fclose(f); + VFS_READ(f, d_15to8table, 1<<15); + VFS_CLOSE(f); } else { @@ -2829,14 +2829,7 @@ void GLDraw_Init15to8(void) } if (savetable) { - char s[256]; - sprintf(s, "%s/glquake", com_gamedir); - Sys_mkdir (s); - sprintf(s, "%s/glquake/15to8.pal", com_gamedir); - if ((f = fopen(s, "wb")) != NULL) { - fwrite(d_15to8table, 1<<15, 1, f); - fclose(f); - } + FS_WriteFile("glquake/15to8.pal", d_15to8table, 1<<15, FS_GAME); } } } @@ -3032,7 +3025,7 @@ texels += scaled_width * scaled_height; } if (gl_config.arb_texture_compression && gl_compress.value && gl_savecompressedtex.value && name&&mipmap) { - FILE *out; + vfsfile_t *out; int miplevels; GLint compressed; GLint compressed_size; @@ -3044,19 +3037,19 @@ texels += scaled_width * scaled_height; qglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &compressed); if (compressed == GL_TRUE && !strstr(name, "..")) //is there any point in bothering with the whole endian thing? { - sprintf(outname, "%s/tex/%s.tex", com_gamedir, name); - COM_CreatePath(outname); - out = fopen(outname, "wb"); + sprintf(outname, "tex/%s.tex", name); + FS_CreatePath(outname, FS_GAME); + out = FS_OpenVFS(outname, "wb", FS_GAME); if (out) { i = LittleLong(miplevels); - fwrite(&i, 1, sizeof(i), out); + VFS_WRITE(out, &i, sizeof(i)); i = LittleLong(width); - fwrite(&i, 1, sizeof(i), out); + VFS_WRITE(out, &i, sizeof(i)); i = LittleLong(height); - fwrite(&i, 1, sizeof(i), out); + VFS_WRITE(out, &i, sizeof(i)); i = LittleLong(mipmap); - fwrite(&i, 1, sizeof(i), out); + VFS_WRITE(out, &i, sizeof(i)); for (miplevel = 0; miplevel < miplevels; miplevel++) { qglGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_COMPRESSED_ARB, &compressed); @@ -3068,17 +3061,17 @@ texels += scaled_width * scaled_height; qglGetCompressedTexImageARB(GL_TEXTURE_2D, miplevel, img); i = LittleLong(width); - fwrite(&i, 1, sizeof(i), out); + VFS_WRITE(out, &i, sizeof(i)); i = LittleLong(height); - fwrite(&i, 1, sizeof(i), out); + VFS_WRITE(out, &i, sizeof(i)); i = LittleLong(compressed_size); - fwrite(&i, 1, sizeof(i), out); + VFS_WRITE(out, &i, sizeof(i)); i = LittleLong(internalformat); - fwrite(&i, 1, sizeof(i), out); - fwrite(img, 1, compressed_size, out); + VFS_WRITE(out, &i, sizeof(i)); + VFS_WRITE(out, img, compressed_size); BZ_Free(img); } - fclose(out); + VFS_CLOSE(out); } } } diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 1785440fe..183faaf64 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -333,20 +333,19 @@ void GLMod_Think (void) strcpy(filename, lightmodel->name); f = COM_SkipPath(filename); *f = '\0'; - Sys_mkdir(va("%s/%s", com_gamedir, filename)); if (lightmodel->deluxdata) { COM_StripExtension(lightmodel->name, filename); COM_DefaultExtension(filename, ".lux"); - COM_WriteFile(filename, lightmodel->deluxdata-8, numlightdata*3+8); + FS_WriteFile(filename, lightmodel->deluxdata-8, numlightdata*3+8, FS_GAME); } if (writelitfile) //the user might already have a lit file (don't overwrite it). { COM_StripExtension(lightmodel->name, filename); COM_DefaultExtension(filename, ".lit"); - COM_WriteFile(filename, lightmodel->lightdata-8, numlightdata*3+8); + FS_WriteFile(filename, lightmodel->lightdata-8, numlightdata*3+8, FS_GAME); } } } @@ -455,9 +454,9 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash) // // load the file // - //look for a replacement -// ext = COM_FileExtension(mod->name); -// if (!Q_strcasecmp(ext, "mdl") || !Q_strcasecmp(ext, "bsp")) + //look for a replacement, but not for q1 sprites + ext = COM_FileExtension(mod->name); + if (Q_strcasecmp(ext, "spr") && Q_strcasecmp(ext, "sp2")) { char mdlbase[MAX_QPATH]; COM_StripExtension(mod->name, mdlbase); diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index e5d434928..461af5bb0 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -411,6 +411,8 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex) vi = -1; for (; s ; s=s->texturechain) { + if (!s->mesh) //urm. + continue; if (vi != s->lightmaptexturenum) { if (vi<0) @@ -2116,6 +2118,9 @@ void PPL_BaseEntTextures(void) break; case mod_brush: + qglDepthFunc ( gldepthfunc ); + qglEnable(GL_DEPTH_TEST); + qglDepthMask(1); PPL_BaseBModelTextures (currententity); break; diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 0cd71aebc..1d2507c4e 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -104,7 +104,6 @@ cvar_t r_norefresh = {"r_norefresh","0"}; //cvar_t r_drawviewmodel = {"r_drawviewmodel","1"}; //cvar_t r_speeds = {"r_speeds","0"}; //cvar_t r_fullbright = {"r_fullbright","0"}; -cvar_t r_lightmap = {"r_lightmap","0", NULL, CVAR_CHEAT}; cvar_t r_mirroralpha = {"r_mirroralpha","1", NULL, CVAR_CHEAT}; cvar_t r_wateralpha = {"r_wateralpha","1", NULL}; //cvar_t r_waterwarp = {"r_waterwarp", "0"}; diff --git a/engine/http/httpclient.c b/engine/http/httpclient.c index 4f2ae1b8b..c53a7639c 100644 --- a/engine/http/httpclient.c +++ b/engine/http/httpclient.c @@ -309,9 +309,7 @@ static qboolean HTTP_CL_Run(http_con_t *con) VFS_CLOSE(con->file); else { - snprintf(Location, sizeof(Location)-1, "%s/%s", com_gamedir, con->filename); - COM_CreatePath(Location); - COM_WriteFile(con->filename, con->buffer, con->bufferused); + FS_WriteFile(con->filename, con->buffer, con->bufferused, FS_GAME); } if (con->NotifyFunction) { diff --git a/engine/qclib/qccguistuff.c b/engine/qclib/qccguistuff.c index 8166f5698..84a976fb7 100644 --- a/engine/qclib/qccguistuff.c +++ b/engine/qclib/qccguistuff.c @@ -160,6 +160,16 @@ void GUI_ParseCommandLine(char *args) { fl_log = true; } + else if (!strnicmp(parameters+paramlen, "-srcfile", 8) || !strnicmp(parameters+paramlen, "/srcfile", 8)) + { + while (*next == ' ') + next++; + + l = 0; + while (*next != ' ' && *next) + progssrcname[l++] = *next++; + progssrcname[l] = 0; + } else if (!strnicmp(parameters+paramlen, "-T", 2) || !strnicmp(parameters+paramlen, "/T", 2)) //the target { if (!strnicmp(parameters+paramlen+2, "h2", 2))