mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 09:20:51 +00:00
SW: Replace some stuff we removed from MACT.
git-svn-id: https://svn.eduke32.com/eduke32@6043 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
64ba5ed84d
commit
a6dbb7987c
1 changed files with 17 additions and 17 deletions
|
@ -104,8 +104,8 @@ int32_t RTS_AddFile(char *filename)
|
||||||
kclose(handle);
|
kclose(handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
header.numlumps = IntelLong(header.numlumps);
|
header.numlumps = B_LITTLE32(header.numlumps);
|
||||||
header.infotableofs = IntelLong(header.infotableofs);
|
header.infotableofs = B_LITTLE32(header.infotableofs);
|
||||||
length = header.numlumps*sizeof(filelump_t);
|
length = header.numlumps*sizeof(filelump_t);
|
||||||
fileinfo = fileinfoo = malloc(length);
|
fileinfo = fileinfoo = malloc(length);
|
||||||
if (!fileinfo)
|
if (!fileinfo)
|
||||||
|
@ -135,8 +135,8 @@ int32_t RTS_AddFile(char *filename)
|
||||||
for (i=startlump; i<numlumps; i++,lump_p++, fileinfo++)
|
for (i=startlump; i<numlumps; i++,lump_p++, fileinfo++)
|
||||||
{
|
{
|
||||||
lump_p->handle = handle;
|
lump_p->handle = handle;
|
||||||
lump_p->position = IntelLong(fileinfo->filepos);
|
lump_p->position = B_LITTLE32(fileinfo->filepos);
|
||||||
lump_p->size = IntelLong(fileinfo->size);
|
lump_p->size = B_LITTLE32(fileinfo->size);
|
||||||
strncpy(lump_p->name, fileinfo->name, 8);
|
strncpy(lump_p->name, fileinfo->name, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,13 +168,13 @@ void RTS_Init(char *filename)
|
||||||
if (RTS_AddFile(filename)) return;
|
if (RTS_AddFile(filename)) return;
|
||||||
|
|
||||||
if (!numlumps) return;
|
if (!numlumps) return;
|
||||||
// Error ("RTS_Init: no files found");
|
// buildprintf ("RTS_Init: no files found");
|
||||||
|
|
||||||
//
|
//
|
||||||
// set up caching
|
// set up caching
|
||||||
//
|
//
|
||||||
length = (numlumps) * sizeof(*lumpcache);
|
length = (numlumps) * sizeof(*lumpcache);
|
||||||
lumpcache = SafeMalloc(length);
|
lumpcache = Xmalloc(length);
|
||||||
memset(lumpcache,0,length);
|
memset(lumpcache,0,length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,13 +199,13 @@ void RTS_Shutdown(void)
|
||||||
{
|
{
|
||||||
if (lumpcache[i])
|
if (lumpcache[i])
|
||||||
{
|
{
|
||||||
SafeFree(lumpcache[i]);
|
Bfree(lumpcache[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SafeFree(lumpcache);
|
Bfree(lumpcache);
|
||||||
}
|
}
|
||||||
if (lumpinfo) SafeFree(lumpinfo);
|
if (lumpinfo) Bfree(lumpinfo);
|
||||||
|
|
||||||
numlumps = 0;
|
numlumps = 0;
|
||||||
lumpinfo = NULL;
|
lumpinfo = NULL;
|
||||||
|
@ -240,7 +240,7 @@ int32_t RTS_SoundLength(int32_t lump)
|
||||||
{
|
{
|
||||||
lump++;
|
lump++;
|
||||||
if (lump >= numlumps)
|
if (lump >= numlumps)
|
||||||
Error("RTS_SoundLength: %i >= numlumps",lump);
|
buildprintf("RTS_SoundLength: %i >= numlumps",lump);
|
||||||
return lumpinfo[lump].size;
|
return lumpinfo[lump].size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ char *RTS_GetSoundName(int32_t i)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
if (i>=numlumps)
|
if (i>=numlumps)
|
||||||
Error("RTS_GetSoundName: %i >= numlumps",i);
|
buildprintf("RTS_GetSoundName: %i >= numlumps",i);
|
||||||
return &(lumpinfo[i].name[0]);
|
return &(lumpinfo[i].name[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,9 +274,9 @@ void RTS_ReadLump(int32_t lump, void *dest)
|
||||||
lumpinfo_t *l;
|
lumpinfo_t *l;
|
||||||
|
|
||||||
if (lump >= numlumps)
|
if (lump >= numlumps)
|
||||||
Error("RTS_ReadLump: %i >= numlumps",lump);
|
buildprintf("RTS_ReadLump: %i >= numlumps",lump);
|
||||||
if (lump < 0)
|
if (lump < 0)
|
||||||
Error("RTS_ReadLump: %i < 0",lump);
|
buildprintf("RTS_ReadLump: %i < 0",lump);
|
||||||
l = lumpinfo+lump;
|
l = lumpinfo+lump;
|
||||||
klseek(l->handle, l->position, SEEK_SET);
|
klseek(l->handle, l->position, SEEK_SET);
|
||||||
kread(l->handle,dest,l->size);
|
kread(l->handle,dest,l->size);
|
||||||
|
@ -297,7 +297,7 @@ void *RTS_GetSound(int32_t lump)
|
||||||
{
|
{
|
||||||
lump++;
|
lump++;
|
||||||
if ((uint16_t)lump >= (uint16_t)numlumps)
|
if ((uint16_t)lump >= (uint16_t)numlumps)
|
||||||
Error("RTS_GetSound: %i >= %i\n",lump,numlumps);
|
buildprintf("RTS_GetSound: %i >= %i\n",lump,numlumps);
|
||||||
|
|
||||||
if (lumpcache[lump] == NULL)
|
if (lumpcache[lump] == NULL)
|
||||||
{
|
{
|
||||||
|
@ -326,15 +326,15 @@ void *RTS_GetSound(int32_t lump)
|
||||||
{
|
{
|
||||||
lump++;
|
lump++;
|
||||||
if ((uint16_t)lump >= numlumps)
|
if ((uint16_t)lump >= numlumps)
|
||||||
Error("RTS_GetSound: %i >= numlumps",lump);
|
buildprintf("RTS_GetSound: %i >= numlumps",lump);
|
||||||
|
|
||||||
else if (lump < 0)
|
else if (lump < 0)
|
||||||
Error("RTS_GetSound: %i < 0\n",lump);
|
buildprintf("RTS_GetSound: %i < 0\n",lump);
|
||||||
|
|
||||||
if (lumpcache[lump] == NULL)
|
if (lumpcache[lump] == NULL)
|
||||||
{
|
{
|
||||||
// read the lump in
|
// read the lump in
|
||||||
lumpcache[lump] = SafeMalloc(RTS_SoundLength(lump-1));
|
lumpcache[lump] = Xmalloc(RTS_SoundLength(lump-1));
|
||||||
RTS_ReadLump(lump, lumpcache[lump]);
|
RTS_ReadLump(lump, lumpcache[lump]);
|
||||||
}
|
}
|
||||||
return lumpcache[lump];
|
return lumpcache[lump];
|
||||||
|
|
Loading…
Reference in a new issue