Speed up HRP loading

git-svn-id: https://svn.eduke32.com/eduke32@543 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-04-30 19:41:19 +00:00
parent e2fe946d35
commit 4ec4aac70f
4 changed files with 57 additions and 34 deletions

View file

@ -2784,7 +2784,7 @@ void overheadeditor(void)
drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,1); drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,1);
drawline16(xdim-1,ydim-STATUS2DSIZ,xdim-1,ydim-1,1); drawline16(xdim-1,ydim-STATUS2DSIZ,xdim-1,ydim-1,1);
drawline16(0,ydim-STATUS2DSIZ+24,xdim-1,ydim-STATUS2DSIZ+24,1); drawline16(0,ydim-STATUS2DSIZ+24,xdim-1,ydim-STATUS2DSIZ+24,1);
drawline16(192,ydim-STATUS2DSIZ,192,ydim-STATUS2DSIZ+24,1); drawline16(192-24,ydim-STATUS2DSIZ,192-24,ydim-STATUS2DSIZ+24,1);
if (totalclock < 120*5) printext16(8L,ydim-STATUS2DSIZ+32L,9,-1,kensig,0); if (totalclock < 120*5) printext16(8L,ydim-STATUS2DSIZ+32L,9,-1,kensig,0);
// printmessage16("Version: "VERSION); // printmessage16("Version: "VERSION);
@ -7335,7 +7335,7 @@ void _printmessage16(char name[82])
} }
snotbuf[54] = 0; snotbuf[54] = 0;
begindrawing(); begindrawing();
printext16(200L, ydim-STATUS2DSIZ+8L, 9, 0, snotbuf, 0); printext16(200L-24, ydim-STATUS2DSIZ+8L, 9, 0, snotbuf, 0);
enddrawing(); enddrawing();
} }

View file

@ -285,7 +285,7 @@ static int defsparser(scriptfile *script)
case T_DEFINETEXTURE: case T_DEFINETEXTURE:
{ {
int tile,pal,fnoo,i; int tile,pal,fnoo,i;
char *fn; char *fn, *tfn = NULL;
if (scriptfile_getsymbol(script,&tile)) break; if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getsymbol(script,&pal)) break; if (scriptfile_getsymbol(script,&pal)) break;
@ -295,28 +295,35 @@ static int defsparser(scriptfile *script)
if (scriptfile_getnumber(script,&fnoo)) break; //y-size if (scriptfile_getnumber(script,&fnoo)) break; //y-size
if (scriptfile_getstring(script,&fn)) break; if (scriptfile_getstring(script,&fn)) break;
if ((i = kopen4load(fn,0)) < 0) { i = pathsearchmode;
pathsearchmode = 1;
if (!findfrompath(fn,&tfn)) {
initprintf("Error: file '%s' does not exist\n",fn); initprintf("Error: file '%s' does not exist\n",fn);
pathsearchmode = i;
break; break;
} else kclose(i); } else Bfree(tfn);
pathsearchmode = i;
hicsetsubsttex(tile,pal,fn,-1.0,1.0,1.0,0); hicsetsubsttex(tile,pal,fn,-1.0,1.0,1.0,0);
} }
break; break;
case T_DEFINESKYBOX: case T_DEFINESKYBOX:
{ {
int tile,pal,i,j; int tile,pal,i,j,ii;
char *fn[6],happy=1; char *fn[6],happy=1,*tfn = NULL;
if (scriptfile_getsymbol(script,&tile)) break; if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getsymbol(script,&pal)) break; if (scriptfile_getsymbol(script,&pal)) break;
if (scriptfile_getsymbol(script,&i)) break; //future expansion if (scriptfile_getsymbol(script,&i)) break; //future expansion
for (i=0;i<6;i++) { for (i=0;i<6;i++) {
if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces
if ((j = kopen4load(fn[i],0)) < 0) { ii = pathsearchmode;
pathsearchmode = 1;
if (!findfrompath(fn[i],&tfn)) {
initprintf("Error: file '%s' does not exist\n",fn[i]); initprintf("Error: file '%s' does not exist\n",fn[i]);
happy = 0; happy = 0;
} else kclose(j); } else Bfree(tfn);
pathsearchmode = ii;
} }
if (i < 6 || !happy) break; if (i < 6 || !happy) break;
hicsetskybox(tile,pal,fn); hicsetskybox(tile,pal,fn);
@ -1034,8 +1041,8 @@ static int defsparser(scriptfile *script)
case T_SKYBOX: case T_SKYBOX:
{ {
char *skyboxtokptr = script->ltextptr; char *skyboxtokptr = script->ltextptr;
char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1; char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1, *tfn = NULL;
int i, tile = -1, pal = 0,j; int i, tile = -1, pal = 0,j,ii;
if (scriptfile_getbraces(script,&modelend)) break; if (scriptfile_getbraces(script,&modelend)) break;
while (script->textptr < modelend) { while (script->textptr < modelend) {
@ -1063,10 +1070,13 @@ static int defsparser(scriptfile *script)
if (tile < 0) initprintf("Error: missing 'tile number' for skybox definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy=0; if (tile < 0) initprintf("Error: missing 'tile number' for skybox definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy=0;
for (i=0;i<6;i++) { for (i=0;i<6;i++) {
if (!fn[i]) initprintf("Error: missing '%s filename' for skybox definition near line %s:%d\n", skyfaces[i], script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy = 0; if (!fn[i]) initprintf("Error: missing '%s filename' for skybox definition near line %s:%d\n", skyfaces[i], script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy = 0;
if ((j = kopen4load(fn[i],0)) < 0) { ii = pathsearchmode;
pathsearchmode = 1;
if (!findfrompath(fn[i],&tfn)) {
initprintf("Error: file '%s' does not exist\n",fn[i]); initprintf("Error: file '%s' does not exist\n",fn[i]);
happy = 0; happy = 0;
} else kclose(j); } else Bfree(tfn);
pathsearchmode = ii;
} }
if (!happy) break; if (!happy) break;
@ -1116,7 +1126,7 @@ static int defsparser(scriptfile *script)
case T_PAL: { case T_PAL: {
char *paltokptr = script->ltextptr, *palend; char *paltokptr = script->ltextptr, *palend;
int pal=-1, i; int pal=-1, i;
char *fn = NULL; char *fn = NULL, *tfn = NULL;
double alphacut = -1.0, xscale = 1.0, yscale = 1.0; double alphacut = -1.0, xscale = 1.0, yscale = 1.0;
char flags = 0; char flags = 0;
@ -1150,11 +1160,14 @@ static int defsparser(scriptfile *script)
script->filename, scriptfile_getlinum(script,paltokptr)); script->filename, scriptfile_getlinum(script,paltokptr));
break; break;
} }
if ((i = kopen4load(fn,0)) < 0) {
i = pathsearchmode;
pathsearchmode = 1;
if (!findfrompath(fn,&tfn)) {
initprintf("Error: file '%s' does not exist\n",fn); initprintf("Error: file '%s' does not exist\n",fn);
break; break;
} else kclose(i); } else Bfree(tfn);
pathsearchmode = i;
xscale = 1.0f / xscale; xscale = 1.0f / xscale;
yscale = 1.0f / yscale; yscale = 1.0f / yscale;
@ -1163,7 +1176,7 @@ static int defsparser(scriptfile *script)
case T_DETAIL: case T_GLOW: { case T_DETAIL: case T_GLOW: {
char *detailtokptr = script->ltextptr, *detailend; char *detailtokptr = script->ltextptr, *detailend;
int pal = 0, i; int pal = 0, i;
char *fn = NULL; char *fn = NULL, *tfn = NULL;
double xscale = 1.0, yscale = 1.0; double xscale = 1.0, yscale = 1.0;
char flags = 0; char flags = 0;
@ -1189,10 +1202,15 @@ static int defsparser(scriptfile *script)
script->filename, scriptfile_getlinum(script,detailtokptr)); script->filename, scriptfile_getlinum(script,detailtokptr));
break; break;
} }
if ((i = kopen4load(fn,0)) < 0) {
i = pathsearchmode;
pathsearchmode = 1;
if (!findfrompath(fn,&tfn)) {
initprintf("Error: file '%s' does not exist\n",fn); initprintf("Error: file '%s' does not exist\n",fn);
pathsearchmode = i;
break; break;
} else kclose(i); } else Bfree(tfn);
pathsearchmode = i;
if (token == T_DETAIL) if (token == T_DETAIL)
{ {

View file

@ -884,12 +884,14 @@ void getpackets(void)
Bcorrectfilename(boardfilename,0); Bcorrectfilename(boardfilename,0);
if (boardfilename[0] != 0) if (boardfilename[0] != 0)
{ {
if ((i = kopen4load(boardfilename,0)) < 0) char *tfn;
if (!findfrompath(boardfilename,&tfn))
{ {
Bmemset(boardfilename,0,sizeof(boardfilename)); Bmemset(boardfilename,0,sizeof(boardfilename));
sendboardname(); sendboardname();
} }
else kclose(i); else Bfree(tfn);
} }
if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0) if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0)
@ -9442,7 +9444,8 @@ static void Startup(long argc, char **argv)
} }
else else
{ {
char *dot, *slash; char *dot, *slash, *tfn;
int i;
boardfilename[0] = '/'; boardfilename[0] = '/';
boardfilename[1] = 0; boardfilename[1] = 0;
@ -9457,17 +9460,19 @@ static void Startup(long argc, char **argv)
Bcorrectfilename(boardfilename,0); Bcorrectfilename(boardfilename,0);
i = kopen4load(boardfilename,0); // i = pathsearchmode;
if (i!=-1) // pathsearchmode = 1;
{ if (!findfrompath(boardfilename,&tfn))
initprintf("Using level: '%s'.\n",boardfilename);
kclose(i);
}
else
{ {
initprintf("Level '%s' not found.\n",boardfilename); initprintf("Level '%s' not found.\n",boardfilename);
boardfilename[0] = 0; boardfilename[0] = 0;
} }
else
{
initprintf("Using level: '%s'.\n",boardfilename);
Bfree(tfn);
}
// pathsearchmode = i;
} }
} }