A couple of miscellaneous cleanups.

defs.c: sync some dup'd code for 'definevoxel' and 'voxel' DEF tokens.
engine.c: factor out PolymerProcessModels().

git-svn-id: https://svn.eduke32.com/eduke32@4835 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-12-26 17:29:52 +00:00
parent 3a6bcdc102
commit bd93fd2aab
2 changed files with 54 additions and 38 deletions

View file

@ -920,7 +920,7 @@ static int32_t defsparser(scriptfile *script)
if (EDUKE32_PREDICT_FALSE(nextvoxid == MAXVOXELS))
{
initprintf("Maximum number of voxels already defined.\n");
initprintf("Maximum number of voxels (%d) already defined.\n", MAXVOXELS);
break;
}
@ -1421,9 +1421,21 @@ static int32_t defsparser(scriptfile *script)
{ "scale", T_SCALE },
};
if (EDUKE32_PREDICT_FALSE(scriptfile_getstring(script,&fn))) break; //voxel filename
if (EDUKE32_PREDICT_FALSE(nextvoxid == MAXVOXELS)) { initprintf("Maximum number of voxels already defined.\n"); break; }
if (EDUKE32_PREDICT_FALSE(qloadkvx(nextvoxid, fn))) { initprintf("Failure loading voxel file \"%s\"\n",fn); break; }
if (EDUKE32_PREDICT_FALSE(scriptfile_getstring(script,&fn)))
break; //voxel filename
if (EDUKE32_PREDICT_FALSE(nextvoxid == MAXVOXELS))
{
initprintf("Maximum number of voxels (%d) already defined.\n", MAXVOXELS);
break;
}
if (EDUKE32_PREDICT_FALSE(qloadkvx(nextvoxid, fn)))
{
initprintf("Failure loading voxel file \"%s\"\n",fn);
break;
}
lastvoxid = nextvoxid++;
if (scriptfile_getbraces(script,&modelend)) break;

View file

@ -17682,24 +17682,11 @@ int32_t screencapture(const char *filename, char inverseit, const char *versions
}
//
// setrendermode
//
int32_t setrendermode(int32_t renderer)
{
UNREFERENCED_PARAMETER(renderer);
#ifdef USE_OPENGL
if (bpp == 8) renderer = 0;
#ifdef POLYMER
else renderer = min(4,max(3,renderer));
if (renderer == 4)
static void PolymerProcessModels(void)
{
int32_t i;
// potentially deferred MD3 postprocessing
for (i=0; i<nextmodelid; i++)
for (int32_t i=0; i<nextmodelid; i++)
{
if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
{
@ -17707,7 +17694,7 @@ int32_t setrendermode(int32_t renderer)
if (!warned)
{
OSD_Printf("Post-processing MD3 models for Polymer. This can take a while...\n");
OSD_Printf("Post-processing MD3 models for Polymer. This may take a while...\n");
nextpage();
warned = 1;
}
@ -17722,9 +17709,29 @@ int32_t setrendermode(int32_t renderer)
// else
// OSD_Printf("mdmodel %d already postprocessed.\n", i);
}
}
#endif
//
// setrendermode
//
int32_t setrendermode(int32_t renderer)
{
UNREFERENCED_PARAMETER(renderer);
#ifdef USE_OPENGL
if (bpp == 8)
renderer = REND_CLASSIC;
# ifdef POLYMER
else
renderer = clamp(renderer, REND_POLYMOST, REND_POLYMER);
if (renderer == REND_POLYMER)
{
PolymerProcessModels();
if (!polymer_init())
renderer = 3;
renderer = REND_POLYMOST;
}
else if (getrendermode() == REND_POLYMER) // going from Polymer to another renderer
{
@ -17732,8 +17739,6 @@ int32_t setrendermode(int32_t renderer)
G_Polymer_UnInit();
polymer_uninit();
}
# else
else renderer = 3;
# endif
basepalreset = 1;
@ -17796,7 +17801,6 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how)
if (getrendermode() == REND_POLYMER)
polymer_invalidateartmap(tilenume);
#endif
}
#endif
}