Make deferred polymer model processing not crash; make tile name search case-insensitive.

git-svn-id: https://svn.eduke32.com/eduke32@1750 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-01-01 18:35:59 +00:00
parent 002ac54ca8
commit 79a52e1bc5
3 changed files with 28 additions and 9 deletions

View file

@ -13362,11 +13362,9 @@ int32_t setrendermode(int32_t renderer)
{ {
int32_t i; int32_t i;
if (!polymer_init())
renderer = 3;
// potentially deferred MD3 postprocessing // potentially deferred MD3 postprocessing
for (i=0; i<nextmodelid; i++) for (i=0; i<nextmodelid; i++)
{
if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL) if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
{ {
static int32_t warned=0; static int32_t warned=0;
@ -13378,8 +13376,18 @@ int32_t setrendermode(int32_t renderer)
warned = 1; warned = 1;
} }
md3postload_polymer((md3model_t *)models[i]); if (!md3postload_polymer((md3model_t *)models[i]))
OSD_Printf("INTERNAL ERROR: mdmodel %d failed postprocessing!\n", i);
if (((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
OSD_Printf("INTERNAL ERROR: wtf?\n");
} }
// else
// OSD_Printf("mdmodel %d already postprocessed.\n", i);
}
if (!polymer_init())
renderer = 3;
} }
# else # else
else renderer = 3; else renderer = 3;

View file

@ -1337,6 +1337,7 @@ static md3model_t *md3load(int32_t fil)
klseek(fil,m->head.ofssurfs,SEEK_SET); i = m->head.numsurfs*sizeof(md3surf_t); klseek(fil,m->head.ofssurfs,SEEK_SET); i = m->head.numsurfs*sizeof(md3surf_t);
m->head.surfs = (md3surf_t *)Bmalloc(i); if (!m->head.surfs) { if (m->head.tags) Bfree(m->head.tags); Bfree(m->head.frames); Bfree(m); return(0); } m->head.surfs = (md3surf_t *)Bmalloc(i); if (!m->head.surfs) { if (m->head.tags) Bfree(m->head.tags); Bfree(m->head.frames); Bfree(m); return(0); }
m->head.surfs[0].geometry = NULL; // for deferred polymer model postprocessing (else: crashes)
#if B_BIG_ENDIAN != 0 #if B_BIG_ENDIAN != 0
{ {

View file

@ -3092,23 +3092,32 @@ static int32_t m32gettile(int32_t idInitialTile)
// //
iTile = clamp(iTile, 0, min(MAXTILES-1, localartlookupnum+nDisplayedTiles-1)); iTile = clamp(iTile, 0, min(MAXTILES-1, localartlookupnum+nDisplayedTiles-1));
// 'S' KEYPRESS: search for named tile // 'S' KEYPRESS: search for named tile
if (PRESSED_KEYSC(S)) if (PRESSED_KEYSC(S))
{ {
static char laststr[MAXTILES] = ""; static char laststr[25] = "";
const char *searchstr = getstring_simple("Search for tile name: ", laststr, MAXTILES-1); const char *searchstr = getstring_simple("Search for tile name: ", laststr, MAXTILES-1);
static char buf[2][25];
if (searchstr && searchstr[0]) if (searchstr && searchstr[0])
{ {
int32_t i, i0, slen=Bstrlen(searchstr)-1; int32_t i, i0, slen=Bstrlen(searchstr)-1;
Bstrcpy(laststr, searchstr); Bstrncpy(laststr, searchstr, 25);
laststr[24] = 0;
i0 = localartlookup[iTile]; i0 = localartlookup[iTile];
Bmemcpy(buf[0], laststr, 25);
Bstrupr(buf[0]);
for (i=(i0+1)%MAXTILES; i!=i0; i=(i+1)%MAXTILES) for (i=(i0+1)%MAXTILES; i!=i0; i=(i+1)%MAXTILES)
if ((searchstr[0]=='^' && !Bstrncmp(names[i], searchstr+1, slen)) || {
(searchstr[0]!='^' && strstr(names[i], searchstr))) Bmemcpy(buf[1], names[i], 25);
buf[1][24]=0;
Bstrupr(buf[1]);
if ((searchstr[0]=='^' && !Bstrncmp(buf[1], buf[0]+1, slen)) ||
(searchstr[0]!='^' && strstr(buf[1], buf[0])))
{ {
SelectAllTiles(i); SelectAllTiles(i);
iTile = i; iTile = i;
@ -3116,6 +3125,7 @@ static int32_t m32gettile(int32_t idInitialTile)
} }
} }
} }
}
// //
// Adjust top-left to ensure tilenum is within displayed range of tiles // Adjust top-left to ensure tilenum is within displayed range of tiles