From e7ec40d0c839d730d0e730597e44d740f91850a7 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 12 Jul 2010 22:46:37 +0000 Subject: [PATCH] Trying to fix some leaks. git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3547 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_ents.c | 13 ++- engine/client/cl_main.c | 11 +-- engine/client/image.c | 6 +- engine/client/menu.c | 22 ++++- engine/client/menu.h | 3 +- engine/client/pr_menu.c | 18 ++-- engine/client/r_surf.c | 12 +++ engine/client/renderer.c | 8 +- engine/client/sys_linux.c | 19 ++--- engine/common/cmd.c | 3 +- engine/common/gl_q2bsp.c | 11 --- engine/common/mathlib.h | 2 +- engine/common/pmovetst.c | 2 - engine/common/q1bsp.c | 174 +++++++++++++++++++++++++++++++++++--- engine/gl/gl_model.c | 12 ++- engine/gl/gl_model.h | 10 +-- engine/gl/gl_rlight.c | 2 +- engine/gl/gl_rsurf.c | 5 ++ engine/gl/gl_vidcommon.c | 8 +- engine/qclib/initlib.c | 8 ++ engine/server/sv_init.c | 3 + engine/server/sv_phys.c | 13 +-- engine/server/world.c | 2 - 23 files changed, 271 insertions(+), 96 deletions(-) diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 7363a0450..32027fb13 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -83,10 +83,16 @@ qboolean CL_FilterModelindex(int modelindex, int frame) //============================================================ +void CL_FreeDlights(void) +{ + rtlights_max = cl_maxdlights = 0; + BZ_Free(cl_dlights); + cl_dlights = NULL; +} void CL_InitDlights(void) { rtlights_max = cl_maxdlights = RTL_FIRST; - cl_dlights = BZ_Realloc(NULL, sizeof(*cl_dlights)*cl_maxdlights); + cl_dlights = BZ_Realloc(cl_dlights, sizeof(*cl_dlights)*cl_maxdlights); memset(cl_dlights, 0, sizeof(*cl_dlights)*cl_maxdlights); } @@ -1555,6 +1561,11 @@ static void CL_TransitionPacketEntities(packet_entities_t *newpack, packet_entit //new this frame (or we noticed something changed significantly) VectorCopy(snew->origin, le->origin); VectorCopy(snew->angles, le->angles); + + VectorCopy(snew->origin, le->oldorigin); + VectorCopy(snew->angles, le->oldangle); + VectorCopy(snew->origin, le->neworigin); + VectorCopy(snew->angles, le->newangle); le->orglerpdeltatime = 0.1; le->orglerpstarttime = oldpack->servertime; diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 6205e8589..c59d12322 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1166,13 +1166,8 @@ void CL_Disconnect (void) if (cl.worldmodel) { -#if defined(RUNTIMELIGHTING) && defined(GLQUAKE) - extern model_t *lightmodel; - lightmodel = NULL; -#endif - - cl.worldmodel->needload=true; - cl.worldmodel=NULL; + Mod_ClearAll(); + cl.worldmodel = NULL; } if (cls.downloadmethod <= DL_QWPENDING) @@ -3784,6 +3779,8 @@ void Host_Shutdown(void) S_Shutdown(); IN_Shutdown (); R_ShutdownRenderer(); + CL_FreeDlights(); + M_Shutdown(); #ifndef CLIENTONLY SV_Shutdown(); #else diff --git a/engine/client/image.c b/engine/client/image.c index 43cfcd36f..8fdfc2a7d 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -2104,7 +2104,11 @@ texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags) //now look in wad files. (halflife compatability) data = W_GetTexture(name, &image_width, &image_height, &alphaed); if (data) - return R_LoadTexture32 (name, image_width, image_height, (unsigned*)data, flags); + { + tex = R_LoadTexture32 (name, image_width, image_height, (unsigned*)data, flags) + BZ_Free(data); + return tex; + } return r_nulltex; } texid_t R_LoadReplacementTexture(char *name, char *subpath, unsigned int flags) diff --git a/engine/client/menu.c b/engine/client/menu.c index 083c3603e..9002866b3 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -852,12 +852,30 @@ void M_DeInit_Internal (void) Cmd_RemoveCommand ("quickconnect"); } +void M_Shutdown(void) +{ +#ifdef MENU_DAT + MP_Shutdown(); +#endif + M_DeInit_Internal(); +} + +void M_Reinit(void) +{ +#ifdef MENU_DAT + if (!MP_Init()) +#endif + { + M_Init_Internal(); + } +} +#warning ----------- move menu reload here -------------- + void FPS_Preset_f(void); //menu.dat is loaded later... after the video and everything is up. void M_Init (void) { - M_Init_Internal(); Cmd_AddCommand("togglemenu", M_ToggleMenu_f); Cmd_AddCommand("closemenu", M_CloseMenu_f); @@ -870,6 +888,8 @@ void M_Init (void) M_Serverlist_Init(); #endif M_Script_Init(); + + M_Reinit(); } diff --git a/engine/client/menu.h b/engine/client/menu.h index 82341cafd..4a8db95cb 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -389,8 +389,7 @@ void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic); void M_FindKeysForCommand (char *command, int *twokeys); void M_UnbindCommand (char *command); -void MP_Shutdown (void); -void MP_Init (void); +qboolean MP_Init (void); qboolean MP_Toggle(void); void MP_Draw(void); void MP_RegisterCvarsAndCmds(void); diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index bc7445c2a..fc7670742 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -1709,7 +1709,6 @@ int menu_numbuiltins = sizeof(menu_builtins)/sizeof(menu_builtins[0]); -void M_Init_Internal (void); void M_DeInit_Internal (void); int inmenuprogs; @@ -1762,8 +1761,6 @@ void MP_Shutdown (void) mouseusedforgui = false; - M_Init_Internal(); - if (inmenuprogs) //something in the menu caused the problem, so... { inmenuprogs = 0; @@ -1801,15 +1798,15 @@ void VARGS Menu_Abort (char *format, ...) } double menutime; -void MP_Init (void) +qboolean MP_Init (void) { if (qrenderer == QR_NONE) { - return; + return false; } if (forceqmenu.value) - return; + return false; M_DeInit_Internal(); @@ -1863,15 +1860,13 @@ void MP_Init (void) //failed to load or something // CloseProgs(menuprogs); // menuprogs = NULL; - M_Init_Internal(); - return; + return false; } if (setjmp(mp_abort)) { - M_Init_Internal(); Con_DPrintf("Failed to initialize menu.dat\n"); inmenuprogs = false; - return; + return false; } inmenuprogs++; @@ -1900,6 +1895,7 @@ void MP_Init (void) inmenuprogs--; Con_DPrintf("Initialized menu.dat\n"); + return true; } } @@ -1923,7 +1919,7 @@ void MP_CoreDump_f(void) void MP_Reload_f(void) { MP_Shutdown(); - MP_Init(); + M_Init(); } void MP_RegisterCvarsAndCmds(void) diff --git a/engine/client/r_surf.c b/engine/client/r_surf.c index 6ae41e2c6..a9ea438e8 100644 --- a/engine/client/r_surf.c +++ b/engine/client/r_surf.c @@ -2674,6 +2674,18 @@ void Surf_DeInit(void) numlightmaps=0; } +void Surf_Clear(model_t *mod) +{ + batch_t *b; + while ((b = mod->batches)) + { + mod->batches = b->next; + + BZ_Free(b->mesh); + Z_Free(b); + } +} + /* ================== GL_BuildLightmaps diff --git a/engine/client/renderer.c b/engine/client/renderer.c index cc4325dc2..a83bfa0f7 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -1815,9 +1815,7 @@ void R_RestartRenderer_f (void) int i, j; rendererstate_t oldr; rendererstate_t newr; -#ifdef MENU_DAT - MP_Shutdown(); -#endif + M_Shutdown(); memset(&newr, 0, sizeof(newr)); TRACE(("dbg: R_RestartRenderer_f\n")); @@ -1951,9 +1949,7 @@ TRACE(("dbg: R_RestartRenderer_f\n")); SCR_EndLoadingPlaque(); TRACE(("dbg: R_RestartRenderer_f success\n")); -#ifdef MENU_DAT - MP_Init(); -#endif + M_Reinit(); CL_InitDlights(); } diff --git a/engine/client/sys_linux.c b/engine/client/sys_linux.c index 18614dda2..74379db5d 100644 --- a/engine/client/sys_linux.c +++ b/engine/client/sys_linux.c @@ -319,20 +319,6 @@ int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const int secbase; -unsigned int Sys_Milliseconds (void) -{ - struct timeval tp; - struct timezone tzp; - - gettimeofday(&tp, &tzp); - - if (!secbase) - { - secbase = tp.tv_sec; - return tp.tv_usec/1000; - } - return (tp.tv_sec - secbase)*1000 + tp.tv_usec/1000; -} double Sys_DoubleTime (void) { @@ -350,6 +336,11 @@ double Sys_DoubleTime (void) return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0; } +unsigned int Sys_Milliseconds (void) +{ + return Sys_DoubleTime() * 1000; +} + static void *game_library; void Sys_UnloadGame(void) diff --git a/engine/common/cmd.c b/engine/common/cmd.c index d505c350e..9e4366216 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -387,7 +387,7 @@ void Cbuf_ExecuteLevel (int level) { i++; cmd_text[level].buf.cursize -= i; - Q_memcpy (text, text+i, cmd_text[level].buf.cursize); + memmove (text, text+i, cmd_text[level].buf.cursize); } // execute the command line @@ -521,7 +521,6 @@ void Cmd_Exec_f (void) else Q_strncpyz(name, Cmd_Argv(1), sizeof(name)); - FS_LoadFile(name, &f); if (FS_LoadFile(name, &f) != -1) ; else if (FS_LoadFile(va("%s.cfg", name), &f) != -1) diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 04271705f..0c258ff79 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -33,7 +33,6 @@ qboolean RMod_LoadSurfedges (lump_t *l); void RMod_LoadLighting (lump_t *l); -void Q2BSP_SetHullFuncs(hull_t *hull); qboolean CM_Trace(model_t *model, int forcehullnum, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, trace_t *trace); qboolean CM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int contents, trace_t *trace); unsigned int CM_NativeContents(struct model_s *model, int hulloverride, int frame, vec3_t p, vec3_t mins, vec3_t maxs); @@ -3907,13 +3906,11 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned mod->hulls[0].firstclipnode = map_cmodels[0].headnode; mod->hulls[0].available = true; - Q2BSP_SetHullFuncs(&mod->hulls[0]); for (j=1 ; jhulls[j].firstclipnode = map_cmodels[0].headnode; mod->hulls[j].available = false; - Q2BSP_SetHullFuncs(&mod->hulls[j]); } for (i=1 ; i< loadmodel->numsubmodels ; i++) @@ -3935,13 +3932,11 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned mod->hulls[j].available = true; mod->nummodelsurfaces = bm->numsurfaces; mod->firstmodelsurface = bm->firstsurface; - Q2BSP_SetHullFuncs(&mod->hulls[0]); for (j=1 ; jhulls[j].firstclipnode = bm->headnode; mod->hulls[j].lastclipnode = mod->numclipnodes-1; mod->hulls[j].available = false; - Q2BSP_SetHullFuncs(&mod->hulls[j]); } VectorCopy (bm->maxs, mod->maxs); @@ -4063,7 +4058,6 @@ void CM_InitBoxHull (void) box_model.funcs.NativeTrace = CM_NativeTrace; box_model.hulls[0].available = true; - Q2BSP_SetHullFuncs(&box_model.hulls[0]); box_model.nodes = Hunk_Alloc(sizeof(mnode_t)*6); box_planes = &map_planes[numplanes]; @@ -5691,11 +5685,6 @@ unsigned int Q2BSP_PointContents(model_t *mod, vec3_t p) return ret; } -void Q2BSP_SetHullFuncs(hull_t *hull) -{ -// hull->funcs.HullPointContents = Q2BSP_HullPointContents; -} - diff --git a/engine/common/mathlib.h b/engine/common/mathlib.h index 9d2276c6c..5f9b0dc48 100644 --- a/engine/common/mathlib.h +++ b/engine/common/mathlib.h @@ -61,7 +61,7 @@ extern vec3_t vec3_origin; #define nanmask (255<<23) #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) -#define FloatInterpolate(a, bness, b, c) (c) = (a)*(1-bness) + (b)*bness +#define FloatInterpolate(a, bness, b, c) ((c) = (a) + (b - a)*bness) #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) #define VectorSubtract(a,b,c) do{(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}while(0) diff --git a/engine/common/pmovetst.c b/engine/common/pmovetst.c index a4f195843..756dc7d00 100644 --- a/engine/common/pmovetst.c +++ b/engine/common/pmovetst.c @@ -46,8 +46,6 @@ void PM_InitBoxHull (void) box_hull.firstclipnode = 0; box_hull.lastclipnode = 5; - Q1BSP_SetHullFuncs(&box_hull); - for (i=0 ; i<6 ; i++) { box_clipnodes[i].planenum = i; diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index e31e1e5a3..276ce33a1 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -8,6 +8,21 @@ Physics functions (common) */ +void Q1BSP_CheckHullNodes(hull_t *hull) +{ + int num, c; + dclipnode_t *node; + for (num = hull->firstclipnode; num < hull->lastclipnode; num++) + { + node = hull->clipnodes + num; + for (c = 0; c < 2; c++) + if (node->children[c] >= 0) + if (node->children[c] < hull->firstclipnode || node->children[c] > hull->lastclipnode) + Sys_Error ("Q1BSP_CheckHull: bad node number"); + + } +} + #if !id386 /* @@ -24,9 +39,6 @@ static int Q1_HullPointContents (hull_t *hull, int num, vec3_t p) while (num >= 0) { - if (num < hull->firstclipnode || num > hull->lastclipnode) - Sys_Error ("SV_HullPointContents: bad node number"); - node = hull->clipnodes + num; plane = hull->planes + node->planenum; @@ -49,6 +61,153 @@ int VARGS Q1_HullPointContents (hull_t *hull, int num, vec3_t p); #define DIST_EPSILON (0.03125) +#if 1 +enum +{ + rht_solid, + rht_empty, + rht_impact +}; +vec3_t rht_start, rht_end; +static int Q1BSP_RecursiveHullTrace (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace) +{ + dclipnode_t *node; + mplane_t *plane; + float t1, t2; + vec3_t mid; + int side; + float midf; + int rht; + +reenter: + + if (num < 0) + { + /*hit a leaf*/ + if (num == Q1CONTENTS_SOLID) + { + if (trace->allsolid) + trace->startsolid = true; + return rht_solid; + } + else + { + trace->allsolid = false; + if (num == Q1CONTENTS_EMPTY) + trace->inopen = true; + else + trace->inwater = true; + return rht_empty; + } + } + + /*its a node*/ + + /*get the node info*/ + node = hull->clipnodes + num; + plane = hull->planes + node->planenum; + + if (plane->type < 3) + { + t1 = p1[plane->type] - plane->dist; + t2 = p2[plane->type] - plane->dist; + } + else + { + t1 = DotProduct (plane->normal, p1) - plane->dist; + t2 = DotProduct (plane->normal, p2) - plane->dist; + } + + /*if its completely on one side, resume on that side*/ + if (t1 >= 0 && t2 >= 0) + { + //return Q1BSP_RecursiveHullTrace (hull, node->children[0], p1f, p2f, p1, p2, trace); + num = node->children[0]; + goto reenter; + } + if (t1 < 0 && t2 < 0) + { + //return Q1BSP_RecursiveHullTrace (hull, node->children[1], p1f, p2f, p1, p2, trace); + num = node->children[1]; + goto reenter; + } + + if (plane->type < 3) + { + t1 = rht_start[plane->type] - plane->dist; + t2 = rht_end[plane->type] - plane->dist; + } + else + { + t1 = DotProduct (plane->normal, rht_start) - plane->dist; + t2 = DotProduct (plane->normal, rht_end) - plane->dist; + } + + side = t1 < 0; + + midf = t1 / (t1 - t2); + if (midf < p1f) midf = p1f; + if (midf > p2f) midf = p2f; + VectorInterpolate(rht_start, midf, rht_end, mid); + + rht = Q1BSP_RecursiveHullTrace(hull, node->children[side], p1f, midf, p1, mid, trace); + if (rht != rht_empty) + return rht; + rht = Q1BSP_RecursiveHullTrace(hull, node->children[side^1], midf, p2f, mid, p2, trace); + if (rht != rht_solid) + return rht; + + trace->fraction = midf; + if (side) + { + /*we impacted the back of the node, so flip the plane*/ + trace->plane.dist = -plane->dist; + VectorNegate(plane->normal, trace->plane.normal); + midf = (t1 + DIST_EPSILON) / (t1 - t2); + } + else + { + /*we impacted the front of the node*/ + trace->plane.dist = plane->dist; + VectorCopy(plane->normal, trace->plane.normal); + midf = (t1 - DIST_EPSILON) / (t1 - t2); + } + VectorCopy (mid, trace->endpos); + VectorInterpolate(rht_start, midf, rht_end, trace->endpos); + + return rht_impact; +} + +qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace) +{ + if (VectorEquals(p1, p2)) + { + /*points cannot cross planes, so do it faster*/ + switch(Q1_HullPointContents(hull, num, p1)) + { + case Q1CONTENTS_SOLID: + trace->startsolid = true; + break; + case Q1CONTENTS_EMPTY: + trace->allsolid = false; + trace->inopen = true; + break; + default: + trace->allsolid = false; + trace->inwater = true; + break; + } + return true; + } + else + { + VectorCopy(p1, rht_start); + VectorCopy(p2, rht_end); + return Q1BSP_RecursiveHullTrace(hull, num, p1f, p2f, p1, p2, trace) != rht_impact; + } +} + +#else qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace) { dclipnode_t *node; @@ -76,9 +235,6 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, return true; // empty } - if (num < hull->firstclipnode || num > hull->lastclipnode) - Sys_Error ("Q1BSP_RecursiveHullCheck: bad node number"); - // // find the point distances // @@ -187,6 +343,7 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, return false; } +#endif int Q1BSP_HullPointContents(hull_t *hull, vec3_t p) { @@ -210,11 +367,6 @@ int Q1BSP_HullPointContents(hull_t *hull, vec3_t p) } } -void Q1BSP_SetHullFuncs(hull_t *hull) -{ -// hull->funcs.HullPointContents = Q1BSP_HullPointContents; -} - unsigned int Q1BSP_PointContents(model_t *model, vec3_t point) { return Q1BSP_HullPointContents(&model->hulls[0], point); diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index a7e68ea5c..0dc3f3ee7 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -282,6 +282,7 @@ void RMod_ClearAll (void) if (mod->type == mod_brush) { + Surf_Clear(mod); for (t = 0; t < mod->numtextures; t++) { if (!mod->textures[t]) @@ -304,6 +305,7 @@ Mod_Init */ void RMod_Init (void) { + RMod_ClearAll(); mod_numknown = 0; Q1BSP_Init(); @@ -313,12 +315,11 @@ void RMod_Init (void) void RMod_Shutdown (void) { + RMod_ClearAll(); mod_numknown = 0; Cmd_RemoveCommand("mod_texturelist"); Cmd_RemoveCommand("mod_usetexture"); - - RMod_ClearAll(); } /* @@ -2412,6 +2413,7 @@ qboolean RMod_LoadClipnodes (lump_t *l) if (numsuplementryclipnodes) //now load the crouch ones. { +/*This looks buggy*/ for (i = 3; i < MAX_MAP_HULLSM; i++) { hull = &loadmodel->hulls[i]; @@ -2965,7 +2967,8 @@ qboolean RMod_LoadBrushModel (model_t *mod, void *buffer) mod->hulls[0].firstclipnode = bm->headnode[0]; mod->hulls[0].available = true; - Q1BSP_SetHullFuncs(&mod->hulls[0]); + Q1BSP_CheckHullNodes(&mod->hulls[0]); + for (j=1 ; jhulls[j].firstclipnode > mod->hulls[j].lastclipnode) mod->hulls[j].available = false; - Q1BSP_SetHullFuncs(&mod->hulls[j]); + if (mod->hulls[j].available) + Q1BSP_CheckHullNodes(&mod->hulls[j]); } mod->firstmodelsurface = bm->firstface; diff --git a/engine/gl/gl_model.h b/engine/gl/gl_model.h index b33858322..50016e3ec 100644 --- a/engine/gl/gl_model.h +++ b/engine/gl/gl_model.h @@ -30,12 +30,6 @@ struct wedict_s; struct model_s; struct world_s; -typedef struct { -// qboolean (*RecursiveHullCheck) (struct hull_s *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, struct trace_s *trace); -// int (*HullPointContents) (struct hull_s *hull, vec3_t p); //return FTE contents - int dummy; -} hullfuncs_t; - typedef struct { //deals with FTECONTENTS (assumes against solid) void (*PurgeModel) (struct model_s *mod); @@ -423,11 +417,9 @@ typedef struct hull_s vec3_t clip_mins; vec3_t clip_maxs; int available; - - hullfuncs_t funcs; } hull_t; -void Q1BSP_SetHullFuncs(hull_t *hull); +void Q1BSP_CheckHullNodes(hull_t *hull); void Q1BSP_SetModelFuncs(struct model_s *mod); void Q1BSP_Init(void); diff --git a/engine/gl/gl_rlight.c b/engine/gl/gl_rlight.c index 12022bb59..78ea12c87 100644 --- a/engine/gl/gl_rlight.c +++ b/engine/gl/gl_rlight.c @@ -236,7 +236,7 @@ void GLR_RenderDlights (void) l = cl_dlights+rtlights_first; for (i=rtlights_first; iradius || !(l->flags & LFLAG_ALLOW_FLASH)) + if (!l->radius)// || !(l->flags & LFLAG_ALLOW_FLASH)) continue; //dlights emitting from the local player are not visible as flashblends diff --git a/engine/gl/gl_rsurf.c b/engine/gl/gl_rsurf.c index 7cc5ec753..d1aa35105 100644 --- a/engine/gl/gl_rsurf.c +++ b/engine/gl/gl_rsurf.c @@ -53,6 +53,11 @@ void BE_ClearVBO(vbo_t *vbo) if (j == 7) qglDeleteBuffersARB(1, &vboh[i]); } + if (!vbo->vbocoord) + BZ_Free(vbo->coord); + if (!vbo->vboe) + BZ_Free(vbo->indicies); + BZ_Free(vbo->meshlist); memset(vbo, 0, sizeof(*vbo)); } diff --git a/engine/gl/gl_vidcommon.c b/engine/gl/gl_vidcommon.c index 90a25043d..b5ce97fe1 100644 --- a/engine/gl/gl_vidcommon.c +++ b/engine/gl/gl_vidcommon.c @@ -745,15 +745,15 @@ void GL_Init(void *(*getglfunction) (char *name)) gl_minor_version = 1; } qglGetIntegerv(GL_NUM_EXTENSIONS, &gl_num_extensions); - if (!qglGetError()) + if (gl_num_extensions && !qglGetError()) { int i; if (developer.value) { - Con_DPrintf ("GL_EXTENSIONS:"); + Con_Printf ("GL_EXTENSIONS:"); for (i = 0; i < gl_num_extensions; i++) - Con_DPrintf (" %s", qglGetStringi(GL_EXTENSIONS, i)); - Con_DPrintf ("\n"); + Con_Printf (" %s", qglGetStringi(GL_EXTENSIONS, i)); + Con_Printf ("\n"); } else Con_Printf ("GL_EXTENSIONS: %i extensions\n", gl_num_extensions); diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index 1ca5728b3..77c4f13de 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -736,6 +736,14 @@ void CloseProgs(progfuncs_t *inst) free(inst->addressablehunk); #endif + if (inst->prinst->allocedstrings) + f(inst->prinst->allocedstrings); + inst->prinst->allocedstrings = NULL; + if (inst->prinst->tempstrings) + f(inst->prinst->tempstrings); + inst->prinst->tempstrings = NULL; + + /* while(inst->prinst->extensionbuiltin) { diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index d4f502c5c..68b07831a 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -553,6 +553,9 @@ void SV_UnspawnServer (void) //terminate the running server. } for (i = 0; i < MAX_CLIENTS; i++) { + if (svs.clients[i].frameunion.frames) + Z_Free(svs.clients[i].frameunion.frames); + svs.clients[i].frameunion.frames = NULL; svs.clients[i].state = 0; *svs.clients[i].namebuf = '\0'; svs.clients[i].name = NULL; diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 9839836ae..4e11b4182 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -2135,12 +2135,7 @@ qboolean SV_Physics (void) if (ent->isfree) continue; - if (ent->solidtype != ent->v->solid) - { - // Con_Printf("Entity \"%s\" improperly changed solid type\n", svprogfuncs->stringtable+ent->v->classname); - World_LinkEdict (&sv.world, (wedict_t*)ent, true); // a change of solidity should always relink the edict. someone messed up. - } - else if (retouch) + if (retouch) World_LinkEdict (&sv.world, (wedict_t*)ent, true); // force retouch even for stationary if (i > 0 && i <= sv.allocated_client_slots) @@ -2157,6 +2152,12 @@ qboolean SV_Physics (void) SV_RunEntity (ent); SV_RunNewmis (); + + if (ent->solidtype != ent->v->solid) + { + Con_DPrintf("Entity \"%s\" improperly changed solid type\n", PR_GetString(svprogfuncs, ent->v->classname)); + World_LinkEdict (&sv.world, (wedict_t*)ent, true); // a change of solidity should always relink the edict. someone messed up. + } } if (retouch) diff --git a/engine/server/world.c b/engine/server/world.c index bf782cb3e..a6d129923 100644 --- a/engine/server/world.c +++ b/engine/server/world.c @@ -79,8 +79,6 @@ static void World_InitBoxHull (void) box_hull.firstclipnode = 0; box_hull.lastclipnode = 5; - Q1BSP_SetHullFuncs(&box_hull); - for (i=0 ; i<6 ; i++) { box_clipnodes[i].planenum = i;