#if WORKINGLQUAKE
pointfile = COM_LoadTempFile (name);
#else
- pointfile = FS_LoadFile(name, true);
+ pointfile = FS_LoadFile(name, tempmempool, true);
#endif
if (!pointfile)
{
return;
}
- f = (char *)FS_LoadFile (Cmd_Argv(1), false);
+ f = (char *)FS_LoadFile (Cmd_Argv(1), tempmempool, false);
if (!f)
{
Con_Printf("couldn't exec %s\n",Cmd_Argv(1));
Always appends a 0 byte.
============
*/
-qbyte *FS_LoadFile (const char *path, qboolean quiet)
+qbyte *FS_LoadFile (const char *path, mempool_t *pool, qboolean quiet)
{
qfile_t *h;
qbyte *buf;
if (!h)
return NULL;
- buf = Mem_Alloc(tempmempool, fs_filesize+1);
+ buf = Mem_Alloc(pool, fs_filesize+1);
if (!buf)
Sys_Error ("FS_LoadFile: not enough available memory for %s (size %i)", path, fs_filesize);
fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet);
void FS_FreeSearch(fssearch_t *search);
-qbyte *FS_LoadFile (const char *path, qboolean quiet);
+qbyte *FS_LoadFile (const char *path, mempool_t *pool, qboolean quiet);
qboolean FS_WriteFile (const char *filename, void *data, int len);
if (l >= 0 && !strcmp(entname + l, ".bsp"))
{
strcpy(entname + l, ".ent");
- if ((entities = FS_LoadFile(entname, true)))
+ if ((entities = FS_LoadFile(entname, tempmempool, true)))
{
CL_ParseEntityLump(entities);
Mem_Free(entities);
for (i = 0;imageformats[i].formatstring;i++)
{
sprintf (name, imageformats[i].formatstring, basename);
- f = FS_LoadFile(name, true);
+ f = FS_LoadFile(name, tempmempool, true);
if (f)
{
data = imageformats[i].loadfunc(f, matchwidth, matchheight);
menuplyr_load = false;
menuplyr_top = -1;
menuplyr_bottom = -1;
- if ((f = FS_LoadFile("gfx/menuplyr.lmp", true)))
+ if ((f = FS_LoadFile("gfx/menuplyr.lmp", tempmempool, true)))
{
data = LoadLMPAs8Bit (f, 0, 0);
menuplyr_width = image_width;
strlcpy (litfilename, loadmodel->name, sizeof (litfilename));
FS_StripExtension (litfilename, litfilename, sizeof (litfilename));
strlcat (litfilename, ".lit", sizeof (litfilename));
- data = (qbyte*) FS_LoadFile(litfilename, false);
+ data = (qbyte*) FS_LoadFile(litfilename, tempmempool, false);
if (data)
{
if (fs_filesize > 8 && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
strlcpy (lightsfilename, loadmodel->name, sizeof (lightsfilename));
FS_StripExtension (lightsfilename, lightsfilename, sizeof(lightsfilename));
strlcat (lightsfilename, ".lights", sizeof (lightsfilename));
- s = lightsstring = (char *) FS_LoadFile(lightsfilename, false);
+ s = lightsstring = (char *) FS_LoadFile(lightsfilename, tempmempool, false);
if (s)
{
numlights = 0;
{
for (i = 0;i < search->numfilenames;i++)
{
- if ((f = FS_LoadFile(search->filenames[i], false)))
+ if ((f = FS_LoadFile(search->filenames[i], tempmempool, false)))
{
text = f;
while (COM_ParseToken(&text, false))
{
if (checkdisk)
{
- buf = FS_LoadFile (mod->name, false);
+ buf = FS_LoadFile (mod->name, tempmempool, false);
if (!buf)
{
if (crash)
if (!buf)
{
- buf = FS_LoadFile (mod->name, false);
+ buf = FS_LoadFile (mod->name, tempmempool, false);
if (!buf)
{
if (crash)
*/
memset(tagsets, 0, sizeof(tagsets));
memset(word, 0, sizeof(word));
- for (i = 0;i < MAX_SKINS && (data = text = FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), true));i++)
+ for (i = 0;i < MAX_SKINS && (data = text = FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), tempmempool, true));i++)
{
numtags = 0;
skinfile = Mem_Alloc(tempmempool, sizeof(skinfile_t));
palette_complete[255] = 0; // completely transparent black
// FIXME: fullbright_start should be read from colormap.lmp
- colormap = FS_LoadFile("gfx/colormap.lmp", true);
+ colormap = FS_LoadFile("gfx/colormap.lmp", tempmempool, true);
if (colormap && fs_filesize >= 16385)
fullbright_start = 256 - colormap[16384];
else
float gamma, scale, base;
qbyte *pal;
qbyte temp[256];
- pal = (qbyte *)FS_LoadFile ("gfx/palette.lmp", false);
+ pal = (qbyte *)FS_LoadFile ("gfx/palette.lmp", tempmempool, false);
if (pal && fs_filesize >= 768)
{
memcpy(host_basepal, pal, 765);
int i;
dstatement_t *st;
ddef_t *infielddefs;
- void *temp;
dfunction_t *dfunctions;
// flush the non-C variable lookup cache
Mem_EmptyPool(progs_mempool);
Mem_EmptyPool(edictstring_mempool);
- temp = FS_LoadFile ("progs.dat", false);
- if (!temp)
+ progs = (dprograms_t *)FS_LoadFile ("progs.dat", progs_mempool, false);
+ if (!progs)
Host_Error ("PR_LoadProgs: couldn't load progs.dat");
- progs = (dprograms_t *)Mem_Alloc(progs_mempool, fs_filesize);
-
- memcpy(progs, temp, fs_filesize);
- Mem_Free(temp);
-
Con_DPrintf("Programs occupy %iK.\n", fs_filesize/1024);
pr_crc = CRC_Block((qbyte *)progs, fs_filesize);
}
// not conform with VM_fopen
- data = FS_LoadFile(filename, false);
+ data = FS_LoadFile(filename, tempmempool, false);
if (data == NULL)
PRVM_G_FLOAT(OFS_RETURN) = -1;
int i;
dstatement_t *st;
ddef_t *infielddefs;
- void *temp;
dfunction_t *dfunctions;
Mem_EmptyPool(prog->progs_mempool);
Mem_EmptyPool(prog->edictstring_mempool);
- temp = FS_LoadFile (filename, false);
- if (temp == 0)
+ prog->progs = (dprograms_t *)FS_LoadFile (filename, prog->progs_mempool, false);
+ if (prog->progs == NULL)
PRVM_ERROR ("PRVM_LoadProgs: couldn't load %s for %s", filename, PRVM_NAME);
- prog->progs = (dprograms_t *)Mem_Alloc(prog->progs_mempool, fs_filesize);
-
- memcpy(prog->progs, temp, fs_filesize);
- Mem_Free(temp);
-
Con_DPrintf("%s programs occupy %iK.\n", PRVM_NAME, fs_filesize/1024);
pr_crc = CRC_Block((qbyte *)prog->progs, fs_filesize);
}
FS_StripExtension (cl.worldmodel->name, name, sizeof (name));
strlcat (name, ".rtlights", sizeof (name));
- lightsstring = FS_LoadFile(name, false);
+ lightsstring = FS_LoadFile(name, tempmempool, false);
if (lightsstring)
{
s = lightsstring;
}
FS_StripExtension (cl.worldmodel->name, name, sizeof (name));
strlcat (name, ".lights", sizeof (name));
- lightsstring = FS_LoadFile(name, false);
+ lightsstring = FS_LoadFile(name, tempmempool, false);
if (lightsstring)
{
s = lightsstring;
sfxcache_t *sc;
// Load the file
- data = FS_LoadFile(filename, false);
+ data = FS_LoadFile(filename, tempmempool, false);
if (!data)
return NULL;
return NULL;
// Load the file
- data = FS_LoadFile (filename, false);
+ data = FS_LoadFile (filename, tempmempool, false);
if (data == NULL)
return NULL;
// load replacement entity file if found
entities = NULL;
if (sv_entpatch.integer)
- entities = FS_LoadFile(va("maps/%s.ent", sv.name), true);
+ entities = FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true);
if (entities)
{
Con_Printf("Loaded maps/%s.ent\n", sv.name);
if (!wad_loaded)
{
wad_loaded = true;
- if ((temp = FS_LoadFile ("gfx.wad", false)))
+ if ((temp = FS_LoadFile ("gfx.wad", tempmempool, false)))
{
if (memcmp(temp, "WAD2", 4))
Con_Print("gfx.wad doesn't have WAD2 id\n");