mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Minor loadpics() cleanups, don't expose filegrp[] from cache1d.c.
git-svn-id: https://svn.eduke32.com/eduke32@3187 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
826be655db
commit
9434025e6d
3 changed files with 29 additions and 10 deletions
|
@ -13,7 +13,9 @@ extern "C" {
|
||||||
#define MAXGROUPFILES 8 //Warning: Fix groupfil if this is changed
|
#define MAXGROUPFILES 8 //Warning: Fix groupfil if this is changed
|
||||||
#define MAXOPENFILES 64 //Warning: Fix filehan if this is changed
|
#define MAXOPENFILES 64 //Warning: Fix filehan if this is changed
|
||||||
|
|
||||||
extern char filegrp[MAXOPENFILES];
|
#ifdef WITHKPLIB
|
||||||
|
int32_t cache1d_file_fromzip(int32_t fil);
|
||||||
|
#endif
|
||||||
|
|
||||||
void initcache(intptr_t dacachestart, int32_t dacachesize);
|
void initcache(intptr_t dacachestart, int32_t dacachesize);
|
||||||
void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr);
|
void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr);
|
||||||
|
|
|
@ -530,7 +530,7 @@ static int32_t groupfilpos[MAXGROUPFILES];
|
||||||
static char *gfilelist[MAXGROUPFILES];
|
static char *gfilelist[MAXGROUPFILES];
|
||||||
static int32_t *gfileoffs[MAXGROUPFILES];
|
static int32_t *gfileoffs[MAXGROUPFILES];
|
||||||
|
|
||||||
char filegrp[MAXOPENFILES];
|
static char filegrp[MAXOPENFILES];
|
||||||
static int32_t filepos[MAXOPENFILES];
|
static int32_t filepos[MAXOPENFILES];
|
||||||
static intptr_t filehan[MAXOPENFILES] =
|
static intptr_t filehan[MAXOPENFILES] =
|
||||||
{
|
{
|
||||||
|
@ -542,6 +542,11 @@ static intptr_t filehan[MAXOPENFILES] =
|
||||||
#ifdef WITHKPLIB
|
#ifdef WITHKPLIB
|
||||||
static char filenamsav[MAXOPENFILES][260];
|
static char filenamsav[MAXOPENFILES][260];
|
||||||
static int32_t kzcurhand = -1;
|
static int32_t kzcurhand = -1;
|
||||||
|
|
||||||
|
int32_t cache1d_file_fromzip(int32_t fil)
|
||||||
|
{
|
||||||
|
return (filegrp[fil] == 254);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t initgroupfile(const char *filename)
|
int32_t initgroupfile(const char *filename)
|
||||||
|
|
|
@ -10457,8 +10457,7 @@ void set_picsizanm(int32_t picnum, int16_t dasizx, int16_t dasizy, int32_t daanm
|
||||||
//
|
//
|
||||||
int32_t loadpics(const char *filename, int32_t askedsize)
|
int32_t loadpics(const char *filename, int32_t askedsize)
|
||||||
{
|
{
|
||||||
int32_t offscount, localtilestart, localtileend, dasiz;
|
int32_t i, tilefilei;
|
||||||
int32_t i, fil, tilefilei, numtiles_dummy;
|
|
||||||
|
|
||||||
Bstrcpy(artfilename,filename);
|
Bstrcpy(artfilename,filename);
|
||||||
|
|
||||||
|
@ -10470,12 +10469,17 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
||||||
|
|
||||||
for (tilefilei=0; tilefilei<MAXTILEFILES; tilefilei++)
|
for (tilefilei=0; tilefilei<MAXTILEFILES; tilefilei++)
|
||||||
{
|
{
|
||||||
|
int32_t fil;
|
||||||
|
|
||||||
artfilename[7] = (tilefilei%10)+48;
|
artfilename[7] = (tilefilei%10)+48;
|
||||||
artfilename[6] = ((tilefilei/10)%10)+48;
|
artfilename[6] = ((tilefilei/10)%10)+48;
|
||||||
artfilename[5] = ((tilefilei/100)%10)+48;
|
artfilename[5] = ((tilefilei/100)%10)+48;
|
||||||
|
|
||||||
if ((fil = kopen4load(artfilename,0)) != -1)
|
if ((fil = kopen4load(artfilename,0)) != -1)
|
||||||
{
|
{
|
||||||
|
int32_t localtilestart, localtileend, localnumtiles;
|
||||||
|
int32_t offscount, numtiles_dummy;
|
||||||
|
|
||||||
kread(fil,&artversion,4); artversion = B_LITTLE32(artversion);
|
kread(fil,&artversion,4); artversion = B_LITTLE32(artversion);
|
||||||
if (artversion != 1)
|
if (artversion != 1)
|
||||||
{
|
{
|
||||||
|
@ -10483,9 +10487,11 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
||||||
kclose(fil);
|
kclose(fil);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
kread(fil,&numtiles_dummy,4);
|
kread(fil,&numtiles_dummy,4);
|
||||||
kread(fil,&localtilestart,4); localtilestart = B_LITTLE32(localtilestart);
|
kread(fil,&localtilestart,4); localtilestart = B_LITTLE32(localtilestart);
|
||||||
kread(fil,&localtileend,4); localtileend = B_LITTLE32(localtileend);
|
kread(fil,&localtileend,4); localtileend = B_LITTLE32(localtileend);
|
||||||
|
|
||||||
if ((uint32_t)localtilestart >= MAXTILES || (uint32_t)localtileend >= MAXTILES)
|
if ((uint32_t)localtilestart >= MAXTILES || (uint32_t)localtileend >= MAXTILES)
|
||||||
{
|
{
|
||||||
initprintf("loadpics: Invalid localtilestart or localtileend in %s\n", artfilename);
|
initprintf("loadpics: Invalid localtilestart or localtileend in %s\n", artfilename);
|
||||||
|
@ -10498,9 +10504,13 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
||||||
kclose(fil);
|
kclose(fil);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
kread(fil,&tilesizx[localtilestart],(localtileend-localtilestart+1)<<1);
|
|
||||||
kread(fil,&tilesizy[localtilestart],(localtileend-localtilestart+1)<<1);
|
localnumtiles = (localtileend-localtilestart+1);
|
||||||
kread(fil,&picanm[localtilestart],(localtileend-localtilestart+1)<<2);
|
|
||||||
|
kread(fil,&tilesizx[localtilestart], localnumtiles<<1);
|
||||||
|
kread(fil,&tilesizy[localtilestart], localnumtiles<<1);
|
||||||
|
kread(fil,&picanm[localtilestart], localnumtiles<<2);
|
||||||
|
|
||||||
for (i=localtilestart; i<=localtileend; i++)
|
for (i=localtilestart; i<=localtileend; i++)
|
||||||
{
|
{
|
||||||
tilesizx[i] = B_LITTLE16(tilesizx[i]);
|
tilesizx[i] = B_LITTLE16(tilesizx[i]);
|
||||||
|
@ -10508,18 +10518,20 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
||||||
picanm[i] = B_LITTLE32(picanm[i]);
|
picanm[i] = B_LITTLE32(picanm[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
offscount = 4+4+4+4+((localtileend-localtilestart+1)<<3);
|
offscount = 4+4+4+4+(localnumtiles<<3);
|
||||||
for (i=localtilestart; i<=localtileend; i++)
|
for (i=localtilestart; i<=localtileend; i++)
|
||||||
{
|
{
|
||||||
|
int32_t dasiz = tilesizx[i]*tilesizy[i];
|
||||||
|
|
||||||
tilefilenum[i] = tilefilei;
|
tilefilenum[i] = tilefilei;
|
||||||
tilefileoffs[i] = offscount;
|
tilefileoffs[i] = offscount;
|
||||||
dasiz = (int32_t)(tilesizx[i]*tilesizy[i]);
|
|
||||||
offscount += dasiz;
|
offscount += dasiz;
|
||||||
artsize += ((dasiz+15)&0xfffffff0);
|
artsize += ((dasiz+15)&0xfffffff0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITHKPLIB
|
#ifdef WITHKPLIB
|
||||||
if (filegrp[fil] == 254) // from zip
|
if (cache1d_file_fromzip(fil)) // from zip
|
||||||
{
|
{
|
||||||
i = kfilelength(fil);
|
i = kfilelength(fil);
|
||||||
artptrs[tilefilei] = (char *)Brealloc(artptrs[tilefilei], i);
|
artptrs[tilefilei] = (char *)Brealloc(artptrs[tilefilei], i);
|
||||||
|
|
Loading…
Reference in a new issue