mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
Speed up HRP loading
git-svn-id: https://svn.eduke32.com/eduke32@543 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e2fe946d35
commit
4ec4aac70f
4 changed files with 57 additions and 34 deletions
|
@ -2784,7 +2784,7 @@ void overheadeditor(void)
|
|||
drawline16(0,ydim-STATUS2DSIZ,0,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(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);
|
||||
|
||||
// printmessage16("Version: "VERSION);
|
||||
|
@ -7335,7 +7335,7 @@ void _printmessage16(char name[82])
|
|||
}
|
||||
snotbuf[54] = 0;
|
||||
begindrawing();
|
||||
printext16(200L, ydim-STATUS2DSIZ+8L, 9, 0, snotbuf, 0);
|
||||
printext16(200L-24, ydim-STATUS2DSIZ+8L, 9, 0, snotbuf, 0);
|
||||
enddrawing();
|
||||
}
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ static int defsparser(scriptfile *script)
|
|||
case T_DEFINETEXTURE:
|
||||
{
|
||||
int tile,pal,fnoo,i;
|
||||
char *fn;
|
||||
char *fn, *tfn = NULL;
|
||||
|
||||
if (scriptfile_getsymbol(script,&tile)) 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_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);
|
||||
pathsearchmode = i;
|
||||
break;
|
||||
} else kclose(i);
|
||||
} else Bfree(tfn);
|
||||
pathsearchmode = i;
|
||||
|
||||
hicsetsubsttex(tile,pal,fn,-1.0,1.0,1.0,0);
|
||||
}
|
||||
break;
|
||||
case T_DEFINESKYBOX:
|
||||
{
|
||||
int tile,pal,i,j;
|
||||
char *fn[6],happy=1;
|
||||
int tile,pal,i,j,ii;
|
||||
char *fn[6],happy=1,*tfn = NULL;
|
||||
|
||||
if (scriptfile_getsymbol(script,&tile)) break;
|
||||
if (scriptfile_getsymbol(script,&pal)) break;
|
||||
if (scriptfile_getsymbol(script,&i)) break; //future expansion
|
||||
for (i=0;i<6;i++) {
|
||||
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]);
|
||||
happy = 0;
|
||||
} else kclose(j);
|
||||
} else Bfree(tfn);
|
||||
pathsearchmode = ii;
|
||||
}
|
||||
if (i < 6 || !happy) break;
|
||||
hicsetskybox(tile,pal,fn);
|
||||
|
@ -1034,8 +1041,8 @@ static int defsparser(scriptfile *script)
|
|||
case T_SKYBOX:
|
||||
{
|
||||
char *skyboxtokptr = script->ltextptr;
|
||||
char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1;
|
||||
int i, tile = -1, pal = 0,j;
|
||||
char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1, *tfn = NULL;
|
||||
int i, tile = -1, pal = 0,j,ii;
|
||||
|
||||
if (scriptfile_getbraces(script,&modelend)) break;
|
||||
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;
|
||||
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 ((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]);
|
||||
happy = 0;
|
||||
} else kclose(j);
|
||||
} else Bfree(tfn);
|
||||
pathsearchmode = ii;
|
||||
}
|
||||
if (!happy) break;
|
||||
|
||||
|
@ -1116,7 +1126,7 @@ static int defsparser(scriptfile *script)
|
|||
case T_PAL: {
|
||||
char *paltokptr = script->ltextptr, *palend;
|
||||
int pal=-1, i;
|
||||
char *fn = NULL;
|
||||
char *fn = NULL, *tfn = NULL;
|
||||
double alphacut = -1.0, xscale = 1.0, yscale = 1.0;
|
||||
char flags = 0;
|
||||
|
||||
|
@ -1150,11 +1160,14 @@ static int defsparser(scriptfile *script)
|
|||
script->filename, scriptfile_getlinum(script,paltokptr));
|
||||
break;
|
||||
}
|
||||
if ((i = kopen4load(fn,0)) < 0) {
|
||||
|
||||
i = pathsearchmode;
|
||||
pathsearchmode = 1;
|
||||
if (!findfrompath(fn,&tfn)) {
|
||||
initprintf("Error: file '%s' does not exist\n",fn);
|
||||
break;
|
||||
} else kclose(i);
|
||||
|
||||
} else Bfree(tfn);
|
||||
pathsearchmode = i;
|
||||
xscale = 1.0f / xscale;
|
||||
yscale = 1.0f / yscale;
|
||||
|
||||
|
@ -1163,7 +1176,7 @@ static int defsparser(scriptfile *script)
|
|||
case T_DETAIL: case T_GLOW: {
|
||||
char *detailtokptr = script->ltextptr, *detailend;
|
||||
int pal = 0, i;
|
||||
char *fn = NULL;
|
||||
char *fn = NULL, *tfn = NULL;
|
||||
double xscale = 1.0, yscale = 1.0;
|
||||
char flags = 0;
|
||||
|
||||
|
@ -1189,10 +1202,15 @@ static int defsparser(scriptfile *script)
|
|||
script->filename, scriptfile_getlinum(script,detailtokptr));
|
||||
break;
|
||||
}
|
||||
if ((i = kopen4load(fn,0)) < 0) {
|
||||
|
||||
i = pathsearchmode;
|
||||
pathsearchmode = 1;
|
||||
if (!findfrompath(fn,&tfn)) {
|
||||
initprintf("Error: file '%s' does not exist\n",fn);
|
||||
pathsearchmode = i;
|
||||
break;
|
||||
} else kclose(i);
|
||||
} else Bfree(tfn);
|
||||
pathsearchmode = i;
|
||||
|
||||
if (token == T_DETAIL)
|
||||
{
|
||||
|
|
|
@ -884,12 +884,14 @@ void getpackets(void)
|
|||
Bcorrectfilename(boardfilename,0);
|
||||
if (boardfilename[0] != 0)
|
||||
{
|
||||
if ((i = kopen4load(boardfilename,0)) < 0)
|
||||
char *tfn;
|
||||
|
||||
if (!findfrompath(boardfilename,&tfn))
|
||||
{
|
||||
Bmemset(boardfilename,0,sizeof(boardfilename));
|
||||
sendboardname();
|
||||
}
|
||||
else kclose(i);
|
||||
else Bfree(tfn);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
char *dot, *slash;
|
||||
char *dot, *slash, *tfn;
|
||||
int i;
|
||||
|
||||
boardfilename[0] = '/';
|
||||
boardfilename[1] = 0;
|
||||
|
@ -9457,17 +9460,19 @@ static void Startup(long argc, char **argv)
|
|||
|
||||
Bcorrectfilename(boardfilename,0);
|
||||
|
||||
i = kopen4load(boardfilename,0);
|
||||
if (i!=-1)
|
||||
{
|
||||
initprintf("Using level: '%s'.\n",boardfilename);
|
||||
kclose(i);
|
||||
}
|
||||
else
|
||||
// i = pathsearchmode;
|
||||
// pathsearchmode = 1;
|
||||
if (!findfrompath(boardfilename,&tfn))
|
||||
{
|
||||
initprintf("Level '%s' not found.\n",boardfilename);
|
||||
boardfilename[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
initprintf("Using level: '%s'.\n",boardfilename);
|
||||
Bfree(tfn);
|
||||
}
|
||||
// pathsearchmode = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ static int GetGameID(const char *szGameLabel)
|
|||
|
||||
long GetGameVarID(int id, int iActor, int iPlayer)
|
||||
{
|
||||
int inv=0;
|
||||
int inv = 0;
|
||||
|
||||
if (id == g_iThisActorID)
|
||||
return iActor;
|
||||
|
@ -442,14 +442,14 @@ long GetGameVarID(int id, int iActor, int iPlayer)
|
|||
return -1;
|
||||
}
|
||||
|
||||
inv=1;
|
||||
inv = 1;
|
||||
id ^= (MAXGAMEVARS<<1);
|
||||
}
|
||||
|
||||
if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER)
|
||||
{
|
||||
// for the current player
|
||||
if (iPlayer >=0 && iPlayer < MAXPLAYERS)
|
||||
if (iPlayer >= 0 && iPlayer < MAXPLAYERS)
|
||||
{
|
||||
//Bsprintf(g_szBuf,"GetGameVarID(%d, %d, %d) returns %ld\n",id,iActor,iPlayer, aGameVars[id].plValues[iPlayer]);
|
||||
//AddLog(g_szBuf);
|
||||
|
@ -464,7 +464,7 @@ long GetGameVarID(int id, int iActor, int iPlayer)
|
|||
if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR)
|
||||
{
|
||||
// for the current actor
|
||||
if (iActor >= 0 && iActor <=MAXSPRITES)
|
||||
if (iActor >= 0 && iActor <= MAXSPRITES)
|
||||
{
|
||||
if (inv) return(-aGameVars[id].plValues[iActor]);
|
||||
return (aGameVars[id].plValues[iActor]);
|
||||
|
|
Loading…
Reference in a new issue