mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
- started fixing memory leaks: Console and clip shapes done.
This commit is contained in:
parent
58d0585eaa
commit
0d908960ed
7 changed files with 16 additions and 34 deletions
|
@ -1108,9 +1108,7 @@ int32_t md_loadmodel(const char *fn);
|
||||||
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags);
|
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags);
|
||||||
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
|
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
|
||||||
|
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
extern TArray<FString> g_clipMapFiles;
|
||||||
extern GrowArray<char *> g_clipMapFiles;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EXTERN int32_t nextvoxid;
|
EXTERN int32_t nextvoxid;
|
||||||
EXTERN intptr_t voxoff[MAXVOXELS][MAXVOXMIPS]; // used in KenBuild
|
EXTERN intptr_t voxoff[MAXVOXELS][MAXVOXMIPS]; // used in KenBuild
|
||||||
|
|
|
@ -26,7 +26,6 @@ static int16_t clipobjectval[MAXCLIPNUM];
|
||||||
static uint8_t clipignore[(MAXCLIPNUM+7)>>3];
|
static uint8_t clipignore[(MAXCLIPNUM+7)>>3];
|
||||||
|
|
||||||
////// sector-like clipping for sprites //////
|
////// sector-like clipping for sprites //////
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
|
||||||
void engineSetClipMap(mapinfo_t *bak, mapinfo_t *newmap)
|
void engineSetClipMap(mapinfo_t *bak, mapinfo_t *newmap)
|
||||||
{
|
{
|
||||||
if (bak)
|
if (bak)
|
||||||
|
@ -63,9 +62,7 @@ static uwalltype *loadwall, *loadwallinv;
|
||||||
static uspritetype *loadsprite;
|
static uspritetype *loadsprite;
|
||||||
|
|
||||||
vec2_t hitscangoal = { (1<<29)-1, (1<<29)-1 };
|
vec2_t hitscangoal = { (1<<29)-1, (1<<29)-1 };
|
||||||
#ifdef USE_OPENGL
|
|
||||||
int32_t hitallsprites = 0;
|
int32_t hitallsprites = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
void engineInitClipMaps()
|
void engineInitClipMaps()
|
||||||
{
|
{
|
||||||
|
@ -96,7 +93,7 @@ int32_t engineLoadClipMaps(void)
|
||||||
|
|
||||||
int32_t lwcp = 0;
|
int32_t lwcp = 0;
|
||||||
size_t fi;
|
size_t fi;
|
||||||
size_t const g_clipMapFilesNum = g_clipMapFiles.size();
|
size_t const g_clipMapFilesNum = g_clipMapFiles.Size();
|
||||||
|
|
||||||
int32_t *fisec = NULL;
|
int32_t *fisec = NULL;
|
||||||
int32_t *fispr = NULL;
|
int32_t *fispr = NULL;
|
||||||
|
@ -129,13 +126,13 @@ int32_t engineLoadClipMaps(void)
|
||||||
continue;
|
continue;
|
||||||
// Numsprites will now be set!
|
// Numsprites will now be set!
|
||||||
|
|
||||||
initprintf("Loading clip map: %s\n", g_clipMapFiles[fi]);
|
initprintf("Loading clip map: %s\n", g_clipMapFiles[fi].GetChars());
|
||||||
|
|
||||||
if (ournumsectors+numsectors>MAXSECTORS ||
|
if (ournumsectors+numsectors>MAXSECTORS ||
|
||||||
ournumwalls+numwalls>MAXWALLS ||
|
ournumwalls+numwalls>MAXWALLS ||
|
||||||
ournumsprites+Numsprites>MAXSPRITES)
|
ournumsprites+Numsprites>MAXSPRITES)
|
||||||
{
|
{
|
||||||
initprintf("clip map: warning: exceeded limits when loading %s, aborting.\n", g_clipMapFiles[fi]);
|
initprintf("clip map: warning: exceeded limits when loading %s, aborting.\n", g_clipMapFiles[fi].GetChars());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +248,7 @@ int32_t engineLoadClipMaps(void)
|
||||||
if (k>=fisec[fi])
|
if (k>=fisec[fi])
|
||||||
break;
|
break;
|
||||||
initprintf("clip map \"%s\": error: tried to chain picnum %d (sprite %d) in sector %d which"
|
initprintf("clip map \"%s\": error: tried to chain picnum %d (sprite %d) in sector %d which"
|
||||||
" already belongs to picnum %d.\n", g_clipMapFiles[fi], pn, i-fispr[fi], k-fisec[fi],
|
" already belongs to picnum %d.\n", g_clipMapFiles[fi].GetChars(), pn, i-fispr[fi], k-fisec[fi],
|
||||||
clipinfo[sectoidx[k]].picnum);
|
clipinfo[sectoidx[k]].picnum);
|
||||||
engineInitClipMaps();
|
engineInitClipMaps();
|
||||||
|
|
||||||
|
@ -279,7 +276,7 @@ int32_t engineLoadClipMaps(void)
|
||||||
if (i>=fispr[fi])
|
if (i>=fispr[fi])
|
||||||
break;
|
break;
|
||||||
initprintf("clip map \"%s\": warning: sprite %d pointing neither northward nor southward. %s will be wrong.\n",
|
initprintf("clip map \"%s\": warning: sprite %d pointing neither northward nor southward. %s will be wrong.\n",
|
||||||
g_clipMapFiles[fi], i-fispr[fi], (sprite[i].cstat&48)==32 ? "Scaling and flipping" : "X-flipping");
|
g_clipMapFiles[fi].GetChars(), i-fispr[fi], (sprite[i].cstat&48)==32 ? "Scaling and flipping" : "X-flipping");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +313,7 @@ int32_t engineLoadClipMaps(void)
|
||||||
if (ns>=fisec[fi])
|
if (ns>=fisec[fi])
|
||||||
break;
|
break;
|
||||||
initprintf("clip map \"%s\": error: encountered more than one outer sector (%d and %d)"
|
initprintf("clip map \"%s\": error: encountered more than one outer sector (%d and %d)"
|
||||||
" for sprite %d.\n", g_clipMapFiles[fi], outersect-fisec[fi], ns-fisec[fi], i-fispr[fi]);
|
" for sprite %d.\n", g_clipMapFiles[fi].GetChars(), outersect-fisec[fi], ns-fisec[fi], i-fispr[fi]);
|
||||||
engineInitClipMaps();
|
engineInitClipMaps();
|
||||||
|
|
||||||
Xfree(fisec);
|
Xfree(fisec);
|
||||||
|
@ -335,7 +332,7 @@ int32_t engineLoadClipMaps(void)
|
||||||
break;
|
break;
|
||||||
initprintf("clip map \"%s\": error: encountered sector %d belonging to index %d"
|
initprintf("clip map \"%s\": error: encountered sector %d belonging to index %d"
|
||||||
" while collecting sectors for sprite %d (index %d).\n",
|
" while collecting sectors for sprite %d (index %d).\n",
|
||||||
g_clipMapFiles[fi], ns-fisec[fi], sectoidx[ns], i-fispr[fi], numclipmaps);
|
g_clipMapFiles[fi].GetChars(), ns-fisec[fi], sectoidx[ns], i-fispr[fi], numclipmaps);
|
||||||
engineInitClipMaps();
|
engineInitClipMaps();
|
||||||
|
|
||||||
Xfree(fisec);
|
Xfree(fisec);
|
||||||
|
@ -535,15 +532,6 @@ int clipshape_idx_for_sprite(uspriteptr_t const curspr, int curidx)
|
||||||
|
|
||||||
return curidx;
|
return curidx;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int32_t clipshape_idx_for_sprite(uspriteptr_t const curspr, int32_t curidx)
|
|
||||||
{
|
|
||||||
(void)curspr;
|
|
||||||
UNREFERENCED_PARAMETER(curidx);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif // HAVE_CLIPSHAPE_FEATURE
|
|
||||||
////// //////
|
|
||||||
|
|
||||||
////////// CLIPMOVE //////////
|
////////// CLIPMOVE //////////
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// def/clipmap handling
|
// def/clipmap handling
|
||||||
|
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||||
GrowArray<char *> g_clipMapFiles;
|
TArray<FString> g_clipMapFiles;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SetClipshapes()
|
void SetClipshapes()
|
||||||
|
@ -24,7 +24,7 @@ void SetClipshapes()
|
||||||
char clipshape[16] = "_clipshape0.map";
|
char clipshape[16] = "_clipshape0.map";
|
||||||
|
|
||||||
clipshape[10] = j;
|
clipshape[10] = j;
|
||||||
g_clipMapFiles.append(Xstrdup(clipshape));
|
g_clipMapFiles.Push(clipshape);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ void SetClipshapes()
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||||
void G_AddClipMap(const char *buffer)
|
void G_AddClipMap(const char *buffer)
|
||||||
{
|
{
|
||||||
g_clipMapFiles.append(Xstrdup(buffer));
|
g_clipMapFiles.Push(buffer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -313,9 +313,11 @@ int GameMain()
|
||||||
}
|
}
|
||||||
ShutdownSystem();
|
ShutdownSystem();
|
||||||
G_SaveConfig();
|
G_SaveConfig();
|
||||||
|
C_DeinitConsole();
|
||||||
#ifndef NETCODE_DISABLE
|
#ifndef NETCODE_DISABLE
|
||||||
if (gHaveNetworking) enet_deinitialize();
|
if (gHaveNetworking) enet_deinitialize();
|
||||||
#endif
|
#endif
|
||||||
|
if (Args) delete Args;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5880,15 +5880,11 @@ int GameInterface::app_main()
|
||||||
|
|
||||||
registerosdcommands();
|
registerosdcommands();
|
||||||
|
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
|
||||||
int const clipMapError = engineLoadClipMaps();
|
int const clipMapError = engineLoadClipMaps();
|
||||||
if (clipMapError > 0)
|
if (clipMapError > 0)
|
||||||
initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError);
|
initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError);
|
||||||
|
|
||||||
for (char * m : g_clipMapFiles)
|
g_clipMapFiles.Reset();
|
||||||
free(m);
|
|
||||||
g_clipMapFiles.clear();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1172,7 +1172,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int
|
||||||
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
|
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
|
||||||
|
|
||||||
// Use this to break at a specific allocation number.
|
// Use this to break at a specific allocation number.
|
||||||
//_crtBreakAlloc = 227524;
|
//_crtBreakAlloc = 167;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ret = DoMain (hInstance);
|
int ret = DoMain (hInstance);
|
||||||
|
|
|
@ -7341,9 +7341,7 @@ int GameInterface::app_main()
|
||||||
if (clipMapError > 0)
|
if (clipMapError > 0)
|
||||||
initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError);
|
initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError);
|
||||||
|
|
||||||
for (char * m : g_clipMapFiles)
|
g_clipMapFiles.Reset();
|
||||||
free(m);
|
|
||||||
g_clipMapFiles.clear();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
V_Init2();
|
V_Init2();
|
||||||
|
|
Loading…
Reference in a new issue