Trying to fix some leaks.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3547 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-07-12 22:46:37 +00:00
parent ad3da01975
commit e7ec40d0c8
23 changed files with 271 additions and 96 deletions

View file

@ -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) void CL_InitDlights(void)
{ {
rtlights_max = cl_maxdlights = RTL_FIRST; 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); 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) //new this frame (or we noticed something changed significantly)
VectorCopy(snew->origin, le->origin); VectorCopy(snew->origin, le->origin);
VectorCopy(snew->angles, le->angles); 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->orglerpdeltatime = 0.1;
le->orglerpstarttime = oldpack->servertime; le->orglerpstarttime = oldpack->servertime;

View file

@ -1166,13 +1166,8 @@ void CL_Disconnect (void)
if (cl.worldmodel) if (cl.worldmodel)
{ {
#if defined(RUNTIMELIGHTING) && defined(GLQUAKE) Mod_ClearAll();
extern model_t *lightmodel; cl.worldmodel = NULL;
lightmodel = NULL;
#endif
cl.worldmodel->needload=true;
cl.worldmodel=NULL;
} }
if (cls.downloadmethod <= DL_QWPENDING) if (cls.downloadmethod <= DL_QWPENDING)
@ -3784,6 +3779,8 @@ void Host_Shutdown(void)
S_Shutdown(); S_Shutdown();
IN_Shutdown (); IN_Shutdown ();
R_ShutdownRenderer(); R_ShutdownRenderer();
CL_FreeDlights();
M_Shutdown();
#ifndef CLIENTONLY #ifndef CLIENTONLY
SV_Shutdown(); SV_Shutdown();
#else #else

View file

@ -2104,7 +2104,11 @@ texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags)
//now look in wad files. (halflife compatability) //now look in wad files. (halflife compatability)
data = W_GetTexture(name, &image_width, &image_height, &alphaed); data = W_GetTexture(name, &image_width, &image_height, &alphaed);
if (data) 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; return r_nulltex;
} }
texid_t R_LoadReplacementTexture(char *name, char *subpath, unsigned int flags) texid_t R_LoadReplacementTexture(char *name, char *subpath, unsigned int flags)

View file

@ -852,12 +852,30 @@ void M_DeInit_Internal (void)
Cmd_RemoveCommand ("quickconnect"); 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); void FPS_Preset_f(void);
//menu.dat is loaded later... after the video and everything is up. //menu.dat is loaded later... after the video and everything is up.
void M_Init (void) void M_Init (void)
{ {
M_Init_Internal();
Cmd_AddCommand("togglemenu", M_ToggleMenu_f); Cmd_AddCommand("togglemenu", M_ToggleMenu_f);
Cmd_AddCommand("closemenu", M_CloseMenu_f); Cmd_AddCommand("closemenu", M_CloseMenu_f);
@ -870,6 +888,8 @@ void M_Init (void)
M_Serverlist_Init(); M_Serverlist_Init();
#endif #endif
M_Script_Init(); M_Script_Init();
M_Reinit();
} }

View file

@ -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_FindKeysForCommand (char *command, int *twokeys);
void M_UnbindCommand (char *command); void M_UnbindCommand (char *command);
void MP_Shutdown (void); qboolean MP_Init (void);
void MP_Init (void);
qboolean MP_Toggle(void); qboolean MP_Toggle(void);
void MP_Draw(void); void MP_Draw(void);
void MP_RegisterCvarsAndCmds(void); void MP_RegisterCvarsAndCmds(void);

View file

@ -1709,7 +1709,6 @@ int menu_numbuiltins = sizeof(menu_builtins)/sizeof(menu_builtins[0]);
void M_Init_Internal (void);
void M_DeInit_Internal (void); void M_DeInit_Internal (void);
int inmenuprogs; int inmenuprogs;
@ -1762,8 +1761,6 @@ void MP_Shutdown (void)
mouseusedforgui = false; mouseusedforgui = false;
M_Init_Internal();
if (inmenuprogs) //something in the menu caused the problem, so... if (inmenuprogs) //something in the menu caused the problem, so...
{ {
inmenuprogs = 0; inmenuprogs = 0;
@ -1801,15 +1798,15 @@ void VARGS Menu_Abort (char *format, ...)
} }
double menutime; double menutime;
void MP_Init (void) qboolean MP_Init (void)
{ {
if (qrenderer == QR_NONE) if (qrenderer == QR_NONE)
{ {
return; return false;
} }
if (forceqmenu.value) if (forceqmenu.value)
return; return false;
M_DeInit_Internal(); M_DeInit_Internal();
@ -1863,15 +1860,13 @@ void MP_Init (void)
//failed to load or something //failed to load or something
// CloseProgs(menuprogs); // CloseProgs(menuprogs);
// menuprogs = NULL; // menuprogs = NULL;
M_Init_Internal(); return false;
return;
} }
if (setjmp(mp_abort)) if (setjmp(mp_abort))
{ {
M_Init_Internal();
Con_DPrintf("Failed to initialize menu.dat\n"); Con_DPrintf("Failed to initialize menu.dat\n");
inmenuprogs = false; inmenuprogs = false;
return; return false;
} }
inmenuprogs++; inmenuprogs++;
@ -1900,6 +1895,7 @@ void MP_Init (void)
inmenuprogs--; inmenuprogs--;
Con_DPrintf("Initialized menu.dat\n"); Con_DPrintf("Initialized menu.dat\n");
return true;
} }
} }
@ -1923,7 +1919,7 @@ void MP_CoreDump_f(void)
void MP_Reload_f(void) void MP_Reload_f(void)
{ {
MP_Shutdown(); MP_Shutdown();
MP_Init(); M_Init();
} }
void MP_RegisterCvarsAndCmds(void) void MP_RegisterCvarsAndCmds(void)

View file

@ -2674,6 +2674,18 @@ void Surf_DeInit(void)
numlightmaps=0; 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 GL_BuildLightmaps

View file

@ -1815,9 +1815,7 @@ void R_RestartRenderer_f (void)
int i, j; int i, j;
rendererstate_t oldr; rendererstate_t oldr;
rendererstate_t newr; rendererstate_t newr;
#ifdef MENU_DAT M_Shutdown();
MP_Shutdown();
#endif
memset(&newr, 0, sizeof(newr)); memset(&newr, 0, sizeof(newr));
TRACE(("dbg: R_RestartRenderer_f\n")); TRACE(("dbg: R_RestartRenderer_f\n"));
@ -1951,9 +1949,7 @@ TRACE(("dbg: R_RestartRenderer_f\n"));
SCR_EndLoadingPlaque(); SCR_EndLoadingPlaque();
TRACE(("dbg: R_RestartRenderer_f success\n")); TRACE(("dbg: R_RestartRenderer_f success\n"));
#ifdef MENU_DAT M_Reinit();
MP_Init();
#endif
CL_InitDlights(); CL_InitDlights();
} }

View file

@ -319,20 +319,6 @@ int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const
int secbase; 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) double Sys_DoubleTime (void)
{ {
@ -350,6 +336,11 @@ double Sys_DoubleTime (void)
return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0; return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
} }
unsigned int Sys_Milliseconds (void)
{
return Sys_DoubleTime() * 1000;
}
static void *game_library; static void *game_library;
void Sys_UnloadGame(void) void Sys_UnloadGame(void)

View file

@ -387,7 +387,7 @@ void Cbuf_ExecuteLevel (int level)
{ {
i++; i++;
cmd_text[level].buf.cursize -= 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 // execute the command line
@ -521,7 +521,6 @@ void Cmd_Exec_f (void)
else else
Q_strncpyz(name, Cmd_Argv(1), sizeof(name)); Q_strncpyz(name, Cmd_Argv(1), sizeof(name));
FS_LoadFile(name, &f);
if (FS_LoadFile(name, &f) != -1) if (FS_LoadFile(name, &f) != -1)
; ;
else if (FS_LoadFile(va("%s.cfg", name), &f) != -1) else if (FS_LoadFile(va("%s.cfg", name), &f) != -1)

View file

@ -33,7 +33,6 @@ qboolean RMod_LoadSurfedges (lump_t *l);
void RMod_LoadLighting (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_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); 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); 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].firstclipnode = map_cmodels[0].headnode;
mod->hulls[0].available = true; mod->hulls[0].available = true;
Q2BSP_SetHullFuncs(&mod->hulls[0]);
for (j=1 ; j<MAX_MAP_HULLSM ; j++) for (j=1 ; j<MAX_MAP_HULLSM ; j++)
{ {
mod->hulls[j].firstclipnode = map_cmodels[0].headnode; mod->hulls[j].firstclipnode = map_cmodels[0].headnode;
mod->hulls[j].available = false; mod->hulls[j].available = false;
Q2BSP_SetHullFuncs(&mod->hulls[j]);
} }
for (i=1 ; i< loadmodel->numsubmodels ; i++) 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->hulls[j].available = true;
mod->nummodelsurfaces = bm->numsurfaces; mod->nummodelsurfaces = bm->numsurfaces;
mod->firstmodelsurface = bm->firstsurface; mod->firstmodelsurface = bm->firstsurface;
Q2BSP_SetHullFuncs(&mod->hulls[0]);
for (j=1 ; j<MAX_MAP_HULLSM ; j++) for (j=1 ; j<MAX_MAP_HULLSM ; j++)
{ {
mod->hulls[j].firstclipnode = bm->headnode; mod->hulls[j].firstclipnode = bm->headnode;
mod->hulls[j].lastclipnode = mod->numclipnodes-1; mod->hulls[j].lastclipnode = mod->numclipnodes-1;
mod->hulls[j].available = false; mod->hulls[j].available = false;
Q2BSP_SetHullFuncs(&mod->hulls[j]);
} }
VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->maxs, mod->maxs);
@ -4063,7 +4058,6 @@ void CM_InitBoxHull (void)
box_model.funcs.NativeTrace = CM_NativeTrace; box_model.funcs.NativeTrace = CM_NativeTrace;
box_model.hulls[0].available = true; box_model.hulls[0].available = true;
Q2BSP_SetHullFuncs(&box_model.hulls[0]);
box_model.nodes = Hunk_Alloc(sizeof(mnode_t)*6); box_model.nodes = Hunk_Alloc(sizeof(mnode_t)*6);
box_planes = &map_planes[numplanes]; box_planes = &map_planes[numplanes];
@ -5691,11 +5685,6 @@ unsigned int Q2BSP_PointContents(model_t *mod, vec3_t p)
return ret; return ret;
} }
void Q2BSP_SetHullFuncs(hull_t *hull)
{
// hull->funcs.HullPointContents = Q2BSP_HullPointContents;
}

View file

@ -61,7 +61,7 @@ extern vec3_t vec3_origin;
#define nanmask (255<<23) #define nanmask (255<<23)
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) #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 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) #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)

View file

@ -46,8 +46,6 @@ void PM_InitBoxHull (void)
box_hull.firstclipnode = 0; box_hull.firstclipnode = 0;
box_hull.lastclipnode = 5; box_hull.lastclipnode = 5;
Q1BSP_SetHullFuncs(&box_hull);
for (i=0 ; i<6 ; i++) for (i=0 ; i<6 ; i++)
{ {
box_clipnodes[i].planenum = i; box_clipnodes[i].planenum = i;

View file

@ -8,6 +8,21 @@
Physics functions (common) 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 #if !id386
/* /*
@ -24,9 +39,6 @@ static int Q1_HullPointContents (hull_t *hull, int num, vec3_t p)
while (num >= 0) while (num >= 0)
{ {
if (num < hull->firstclipnode || num > hull->lastclipnode)
Sys_Error ("SV_HullPointContents: bad node number");
node = hull->clipnodes + num; node = hull->clipnodes + num;
plane = hull->planes + node->planenum; 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) #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) qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace)
{ {
dclipnode_t *node; dclipnode_t *node;
@ -76,9 +235,6 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f,
return true; // empty return true; // empty
} }
if (num < hull->firstclipnode || num > hull->lastclipnode)
Sys_Error ("Q1BSP_RecursiveHullCheck: bad node number");
// //
// find the point distances // find the point distances
// //
@ -187,6 +343,7 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f,
return false; return false;
} }
#endif
int Q1BSP_HullPointContents(hull_t *hull, vec3_t p) 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) unsigned int Q1BSP_PointContents(model_t *model, vec3_t point)
{ {
return Q1BSP_HullPointContents(&model->hulls[0], point); return Q1BSP_HullPointContents(&model->hulls[0], point);

View file

@ -282,6 +282,7 @@ void RMod_ClearAll (void)
if (mod->type == mod_brush) if (mod->type == mod_brush)
{ {
Surf_Clear(mod);
for (t = 0; t < mod->numtextures; t++) for (t = 0; t < mod->numtextures; t++)
{ {
if (!mod->textures[t]) if (!mod->textures[t])
@ -304,6 +305,7 @@ Mod_Init
*/ */
void RMod_Init (void) void RMod_Init (void)
{ {
RMod_ClearAll();
mod_numknown = 0; mod_numknown = 0;
Q1BSP_Init(); Q1BSP_Init();
@ -313,12 +315,11 @@ void RMod_Init (void)
void RMod_Shutdown (void) void RMod_Shutdown (void)
{ {
RMod_ClearAll();
mod_numknown = 0; mod_numknown = 0;
Cmd_RemoveCommand("mod_texturelist"); Cmd_RemoveCommand("mod_texturelist");
Cmd_RemoveCommand("mod_usetexture"); Cmd_RemoveCommand("mod_usetexture");
RMod_ClearAll();
} }
/* /*
@ -2412,6 +2413,7 @@ qboolean RMod_LoadClipnodes (lump_t *l)
if (numsuplementryclipnodes) //now load the crouch ones. if (numsuplementryclipnodes) //now load the crouch ones.
{ {
/*This looks buggy*/
for (i = 3; i < MAX_MAP_HULLSM; i++) for (i = 3; i < MAX_MAP_HULLSM; i++)
{ {
hull = &loadmodel->hulls[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].firstclipnode = bm->headnode[0];
mod->hulls[0].available = true; mod->hulls[0].available = true;
Q1BSP_SetHullFuncs(&mod->hulls[0]); Q1BSP_CheckHullNodes(&mod->hulls[0]);
for (j=1 ; j<MAX_MAP_HULLSM ; j++) for (j=1 ; j<MAX_MAP_HULLSM ; j++)
{ {
@ -2976,7 +2979,8 @@ qboolean RMod_LoadBrushModel (model_t *mod, void *buffer)
if (mod->hulls[j].firstclipnode > mod->hulls[j].lastclipnode) if (mod->hulls[j].firstclipnode > mod->hulls[j].lastclipnode)
mod->hulls[j].available = false; mod->hulls[j].available = false;
Q1BSP_SetHullFuncs(&mod->hulls[j]); if (mod->hulls[j].available)
Q1BSP_CheckHullNodes(&mod->hulls[j]);
} }
mod->firstmodelsurface = bm->firstface; mod->firstmodelsurface = bm->firstface;

View file

@ -30,12 +30,6 @@ struct wedict_s;
struct model_s; struct model_s;
struct world_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 { typedef struct {
//deals with FTECONTENTS (assumes against solid) //deals with FTECONTENTS (assumes against solid)
void (*PurgeModel) (struct model_s *mod); void (*PurgeModel) (struct model_s *mod);
@ -423,11 +417,9 @@ typedef struct hull_s
vec3_t clip_mins; vec3_t clip_mins;
vec3_t clip_maxs; vec3_t clip_maxs;
int available; int available;
hullfuncs_t funcs;
} hull_t; } hull_t;
void Q1BSP_SetHullFuncs(hull_t *hull); void Q1BSP_CheckHullNodes(hull_t *hull);
void Q1BSP_SetModelFuncs(struct model_s *mod); void Q1BSP_SetModelFuncs(struct model_s *mod);
void Q1BSP_Init(void); void Q1BSP_Init(void);

View file

@ -236,7 +236,7 @@ void GLR_RenderDlights (void)
l = cl_dlights+rtlights_first; l = cl_dlights+rtlights_first;
for (i=rtlights_first; i<rtlights_max; i++, l++) for (i=rtlights_first; i<rtlights_max; i++, l++)
{ {
if (!l->radius || !(l->flags & LFLAG_ALLOW_FLASH)) if (!l->radius)// || !(l->flags & LFLAG_ALLOW_FLASH))
continue; continue;
//dlights emitting from the local player are not visible as flashblends //dlights emitting from the local player are not visible as flashblends

View file

@ -53,6 +53,11 @@ void BE_ClearVBO(vbo_t *vbo)
if (j == 7) if (j == 7)
qglDeleteBuffersARB(1, &vboh[i]); 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)); memset(vbo, 0, sizeof(*vbo));
} }

View file

@ -745,15 +745,15 @@ void GL_Init(void *(*getglfunction) (char *name))
gl_minor_version = 1; gl_minor_version = 1;
} }
qglGetIntegerv(GL_NUM_EXTENSIONS, &gl_num_extensions); qglGetIntegerv(GL_NUM_EXTENSIONS, &gl_num_extensions);
if (!qglGetError()) if (gl_num_extensions && !qglGetError())
{ {
int i; int i;
if (developer.value) if (developer.value)
{ {
Con_DPrintf ("GL_EXTENSIONS:"); Con_Printf ("GL_EXTENSIONS:");
for (i = 0; i < gl_num_extensions; i++) for (i = 0; i < gl_num_extensions; i++)
Con_DPrintf (" %s", qglGetStringi(GL_EXTENSIONS, i)); Con_Printf (" %s", qglGetStringi(GL_EXTENSIONS, i));
Con_DPrintf ("\n"); Con_Printf ("\n");
} }
else else
Con_Printf ("GL_EXTENSIONS: %i extensions\n", gl_num_extensions); Con_Printf ("GL_EXTENSIONS: %i extensions\n", gl_num_extensions);

View file

@ -736,6 +736,14 @@ void CloseProgs(progfuncs_t *inst)
free(inst->addressablehunk); free(inst->addressablehunk);
#endif #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) while(inst->prinst->extensionbuiltin)
{ {

View file

@ -553,6 +553,9 @@ void SV_UnspawnServer (void) //terminate the running server.
} }
for (i = 0; i < MAX_CLIENTS; i++) 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].state = 0;
*svs.clients[i].namebuf = '\0'; *svs.clients[i].namebuf = '\0';
svs.clients[i].name = NULL; svs.clients[i].name = NULL;

View file

@ -2135,12 +2135,7 @@ qboolean SV_Physics (void)
if (ent->isfree) if (ent->isfree)
continue; continue;
if (ent->solidtype != ent->v->solid) if (retouch)
{
// 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)
World_LinkEdict (&sv.world, (wedict_t*)ent, true); // force retouch even for stationary World_LinkEdict (&sv.world, (wedict_t*)ent, true); // force retouch even for stationary
if (i > 0 && i <= sv.allocated_client_slots) if (i > 0 && i <= sv.allocated_client_slots)
@ -2157,6 +2152,12 @@ qboolean SV_Physics (void)
SV_RunEntity (ent); SV_RunEntity (ent);
SV_RunNewmis (); 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) if (retouch)

View file

@ -79,8 +79,6 @@ static void World_InitBoxHull (void)
box_hull.firstclipnode = 0; box_hull.firstclipnode = 0;
box_hull.lastclipnode = 5; box_hull.lastclipnode = 5;
Q1BSP_SetHullFuncs(&box_hull);
for (i=0 ; i<6 ; i++) for (i=0 ; i<6 ; i++)
{ {
box_clipnodes[i].planenum = i; box_clipnodes[i].planenum = i;