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

View file

@ -17682,24 +17682,11 @@ int32_t screencapture(const char *filename, char inverseit, const char *versions
} }
#ifdef POLYMER
// static void PolymerProcessModels(void)
// 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)
{
int32_t i;
// potentially deferred MD3 postprocessing // 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) 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) 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(); nextpage();
warned = 1; warned = 1;
} }
@ -17722,9 +17709,29 @@ int32_t setrendermode(int32_t renderer)
// else // else
// OSD_Printf("mdmodel %d already postprocessed.\n", i); // 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()) if (!polymer_init())
renderer = 3; renderer = REND_POLYMOST;
} }
else if (getrendermode() == REND_POLYMER) // going from Polymer to another renderer else if (getrendermode() == REND_POLYMER) // going from Polymer to another renderer
{ {
@ -17732,8 +17739,6 @@ int32_t setrendermode(int32_t renderer)
G_Polymer_UnInit(); G_Polymer_UnInit();
polymer_uninit(); polymer_uninit();
} }
# else
else renderer = 3;
# endif # endif
basepalreset = 1; basepalreset = 1;
@ -17752,7 +17757,7 @@ int32_t setrendermode(int32_t renderer)
#ifdef USE_OPENGL #ifdef USE_OPENGL
void setrollangle(int32_t rolla) void setrollangle(int32_t rolla)
{ {
gtang = (float) rolla * PI * (1.f/1024.f); gtang = (float)rolla * PI * (1.f/1024.f);
} }
#endif #endif
@ -17796,7 +17801,6 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how)
if (getrendermode() == REND_POLYMER) if (getrendermode() == REND_POLYMER)
polymer_invalidateartmap(tilenume); polymer_invalidateartmap(tilenume);
#endif #endif
} }
#endif #endif
} }