mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
Check file availability before calling the hightile substitution functions
git-svn-id: https://svn.eduke32.com/eduke32@326 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d1bff5a20b
commit
f24ac5dd86
1 changed files with 29 additions and 9 deletions
|
@ -273,7 +273,7 @@ static int defsparser(scriptfile *script)
|
||||||
// OLD (DEPRECATED) DEFINITION SYNTAX
|
// OLD (DEPRECATED) DEFINITION SYNTAX
|
||||||
case T_DEFINETEXTURE:
|
case T_DEFINETEXTURE:
|
||||||
{
|
{
|
||||||
int tile,pal,fnoo;
|
int tile,pal,fnoo,i;
|
||||||
char *fn;
|
char *fn;
|
||||||
|
|
||||||
if (scriptfile_getsymbol(script,&tile)) break;
|
if (scriptfile_getsymbol(script,&tile)) break;
|
||||||
|
@ -283,19 +283,31 @@ static int defsparser(scriptfile *script)
|
||||||
if (scriptfile_getnumber(script,&fnoo)) break; //x-size
|
if (scriptfile_getnumber(script,&fnoo)) break; //x-size
|
||||||
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) {
|
||||||
|
initprintf("Error: file '%s' does not exist\n",fn);
|
||||||
|
break;
|
||||||
|
} else kclose(i);
|
||||||
|
|
||||||
hicsetsubsttex(tile,pal,fn,-1.0,0);
|
hicsetsubsttex(tile,pal,fn,-1.0,0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_DEFINESKYBOX:
|
case T_DEFINESKYBOX:
|
||||||
{
|
{
|
||||||
int tile,pal,i;
|
int tile,pal,i,j;
|
||||||
char *fn[6];
|
char *fn[6],happy=1;
|
||||||
|
|
||||||
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++) if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces
|
for (i=0;i<6;i++) {
|
||||||
if (i < 6) break;
|
if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces
|
||||||
|
if ((j = kopen4load(fn[i],0)) < 0) {
|
||||||
|
initprintf("Error: file '%s' does not exist\n",fn[i]);
|
||||||
|
happy = 0;
|
||||||
|
} else kclose(j);
|
||||||
|
}
|
||||||
|
if (i < 6 || !happy) break;
|
||||||
hicsetskybox(tile,pal,fn);
|
hicsetskybox(tile,pal,fn);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -959,7 +971,7 @@ static int defsparser(scriptfile *script)
|
||||||
{
|
{
|
||||||
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;
|
||||||
int i, tile = -1, pal = 0;
|
int i, tile = -1, pal = 0,j;
|
||||||
|
|
||||||
if (scriptfile_getbraces(script,&modelend)) break;
|
if (scriptfile_getbraces(script,&modelend)) break;
|
||||||
while (script->textptr < modelend) {
|
while (script->textptr < modelend) {
|
||||||
|
@ -979,8 +991,11 @@ 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) {
|
||||||
|
initprintf("Error: file '%s' does not exist\n",fn[i]);
|
||||||
|
happy = 0;
|
||||||
|
} else kclose(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!happy) break;
|
if (!happy) break;
|
||||||
|
|
||||||
hicsetskybox(tile,pal,fn);
|
hicsetskybox(tile,pal,fn);
|
||||||
|
@ -1022,7 +1037,7 @@ static int defsparser(scriptfile *script)
|
||||||
switch (getatoken(script,texturetokens,sizeof(texturetokens)/sizeof(tokenlist))) {
|
switch (getatoken(script,texturetokens,sizeof(texturetokens)/sizeof(tokenlist))) {
|
||||||
case T_PAL: {
|
case T_PAL: {
|
||||||
char *paltokptr = script->ltextptr, *palend;
|
char *paltokptr = script->ltextptr, *palend;
|
||||||
int pal=-1;
|
int pal=-1, i;
|
||||||
char *fn = NULL;
|
char *fn = NULL;
|
||||||
double alphacut = -1.0;
|
double alphacut = -1.0;
|
||||||
char flags = 0;
|
char flags = 0;
|
||||||
|
@ -1049,6 +1064,11 @@ 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) {
|
||||||
|
initprintf("Error: file '%s' does not exist\n",fn);
|
||||||
|
break;
|
||||||
|
} else kclose(i);
|
||||||
|
|
||||||
hicsetsubsttex(tile,pal,fn,alphacut,flags);
|
hicsetsubsttex(tile,pal,fn,alphacut,flags);
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
Loading…
Reference in a new issue