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,6 +17682,35 @@ int32_t screencapture(const char *filename, char inverseit, const char *versions
} }
#ifdef POLYMER
static void PolymerProcessModels(void)
{
// potentially deferred MD3 postprocessing
for (int32_t i=0; i<nextmodelid; i++)
{
if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
{
static int32_t warned=0;
if (!warned)
{
OSD_Printf("Post-processing MD3 models for Polymer. This may take a while...\n");
nextpage();
warned = 1;
}
if (!md3postload_polymer((md3model_t *)models[i]))
OSD_Printf("INTERNAL ERROR: mdmodel %s failed postprocessing!\n",
((md3model_t *)models[i])->head.nam);
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);
}
}
#endif
// //
// setrendermode // setrendermode
@ -17689,42 +17718,20 @@ int32_t screencapture(const char *filename, char inverseit, const char *versions
int32_t setrendermode(int32_t renderer) int32_t setrendermode(int32_t renderer)
{ {
UNREFERENCED_PARAMETER(renderer); UNREFERENCED_PARAMETER(renderer);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (bpp == 8) renderer = 0; if (bpp == 8)
renderer = REND_CLASSIC;
# ifdef POLYMER # ifdef POLYMER
else renderer = min(4,max(3,renderer)); else
renderer = clamp(renderer, REND_POLYMOST, REND_POLYMER);
if (renderer == 4) if (renderer == REND_POLYMER)
{ {
int32_t i; PolymerProcessModels();
// potentially deferred MD3 postprocessing
for (i=0; i<nextmodelid; i++)
{
if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
{
static int32_t warned=0;
if (!warned)
{
OSD_Printf("Post-processing MD3 models for Polymer. This can take a while...\n");
nextpage();
warned = 1;
}
if (!md3postload_polymer((md3model_t *)models[i]))
OSD_Printf("INTERNAL ERROR: mdmodel %s failed postprocessing!\n",
((md3model_t *)models[i])->head.nam);
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()) 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
} }