- cleanup and minor fixes.

This commit is contained in:
Christoph Oelckers 2020-09-22 23:07:11 +02:00
parent d6bf4306eb
commit 2a2209b085
3 changed files with 6 additions and 52 deletions

View file

@ -934,10 +934,8 @@ static int32_t defsparser(scriptfile *script)
case T_DEFINEMODELFRAME: case T_DEFINEMODELFRAME:
{ {
FString framename; FString framename;
#ifdef USE_OPENGL
char happy=1; char happy=1;
int32_t tilex; int32_t tilex;
#endif
int32_t ftilenume, ltilenume; int32_t ftilenume, ltilenume;
if (scriptfile_getstring(script,&framename)) break; if (scriptfile_getstring(script,&framename)) break;
@ -949,12 +947,9 @@ static int32_t defsparser(scriptfile *script)
if (lastmodelid < 0) if (lastmodelid < 0)
{ {
#ifdef USE_OPENGL
pos.Message(MSG_WARNING, "Ignoring frame definition.\n"); pos.Message(MSG_WARNING, "Ignoring frame definition.\n");
#endif
break; break;
} }
#ifdef USE_OPENGL
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
{ {
switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), 0.0f,0)) switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), 0.0f,0))
@ -973,7 +968,6 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
} }
#endif
seenframe = 1; seenframe = 1;
} }
break; break;
@ -990,12 +984,9 @@ static int32_t defsparser(scriptfile *script)
if (lastmodelid < 0) if (lastmodelid < 0)
{ {
#ifdef USE_OPENGL
Printf("Warning: Ignoring animation definition.\n"); Printf("Warning: Ignoring animation definition.\n");
#endif
break; break;
} }
#ifdef USE_OPENGL
switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags)) switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags))
{ {
case 0: case 0:
@ -1012,7 +1003,6 @@ static int32_t defsparser(scriptfile *script)
Printf("Out of memory"); Printf("Out of memory");
break; break;
} }
#endif
} }
break; break;
case T_DEFINEMODELSKIN: case T_DEFINEMODELSKIN:
@ -1041,7 +1031,6 @@ static int32_t defsparser(scriptfile *script)
if (!fileSystem.FileExists(skinfn)) if (!fileSystem.FileExists(skinfn))
break; break;
#ifdef USE_OPENGL
switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0, 0.0f, 1.0f, 1.0f, 0)) switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0, 0.0f, 1.0f, 1.0f, 0))
{ {
case 0: case 0:
@ -1058,7 +1047,6 @@ static int32_t defsparser(scriptfile *script)
Printf("Out of memory"); Printf("Out of memory");
break; break;
} }
#endif
} }
break; break;
case T_SELECTMODELSKIN: case T_SELECTMODELSKIN:
@ -1147,7 +1135,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getstring(script,&modelfn)) break; if (scriptfile_getstring(script,&modelfn)) break;
if (scriptfile_getbraces(script,&modelend)) break; if (scriptfile_getbraces(script,&modelend)) break;
#ifdef USE_OPENGL
lastmodelid = md_loadmodel(modelfn); lastmodelid = md_loadmodel(modelfn);
if (lastmodelid < 0) if (lastmodelid < 0)
{ {
@ -1155,7 +1143,6 @@ static int32_t defsparser(scriptfile *script)
scriptfile_setposition(script, modelend); scriptfile_setposition(script, modelend);
break; break;
} }
#endif
while (!scriptfile_endofblock(script, modelend)) while (!scriptfile_endofblock(script, modelend))
{ {
int32_t token = getatoken(script,modeltokens,countof(modeltokens)); int32_t token = getatoken(script,modeltokens,countof(modeltokens));
@ -1177,10 +1164,8 @@ static int32_t defsparser(scriptfile *script)
auto framepos = scriptfile_getposition(script); auto framepos = scriptfile_getposition(script);
FScanner::SavedPos frameend; FScanner::SavedPos frameend;
FString framename; FString framename;
#ifdef USE_OPENGL
char happy=1; char happy=1;
int32_t tilex = 0, framei; int32_t tilex = 0, framei;
#endif
int32_t ftilenume = -1, ltilenume = -1; int32_t ftilenume = -1, ltilenume = -1;
double smoothduration = 0.1f; double smoothduration = 0.1f;
@ -1223,9 +1208,7 @@ static int32_t defsparser(scriptfile *script)
if (lastmodelid < 0) if (lastmodelid < 0)
{ {
#ifdef USE_OPENGL
framepos.Message(MSG_WARNING, "ignoring frame definition"); framepos.Message(MSG_WARNING, "ignoring frame definition");
#endif
break; break;
} }
@ -1234,7 +1217,6 @@ static int32_t defsparser(scriptfile *script)
framepos.Message(MSG_WARNING, "smoothduration out of range"); framepos.Message(MSG_WARNING, "smoothduration out of range");
smoothduration = 1.0; smoothduration = 1.0;
} }
#ifdef USE_OPENGL
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
{ {
framei = md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), smoothduration,pal); framei = md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), smoothduration,pal);
@ -1254,10 +1236,8 @@ static int32_t defsparser(scriptfile *script)
if (framei >= 0 && framei<1024) if (framei >= 0 && framei<1024)
usedframebitmap[framei>>3] |= pow2char[framei&7]; usedframebitmap[framei>>3] |= pow2char[framei&7];
} }
model_ok &= happy; model_ok &= happy;
} }
#endif
seenframe = 1; seenframe = 1;
} }
break; break;
@ -1401,7 +1381,6 @@ static int32_t defsparser(scriptfile *script)
if (!fileSystem.FileExists(skinfn)) if (!fileSystem.FileExists(skinfn))
break; break;
#ifdef USE_OPENGL
switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum, param, specpower, specfactor, flags)) switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum, param, specpower, specfactor, flags))
{ {
case 0: case 0:
@ -1421,17 +1400,14 @@ static int32_t defsparser(scriptfile *script)
model_ok = 0; model_ok = 0;
break; break;
} }
#endif
} }
break; break;
case T_HUD: case T_HUD:
{ {
auto hudpos = scriptfile_getposition(script); auto hudpos = scriptfile_getposition(script);
FScanner::SavedPos frameend; FScanner::SavedPos frameend;
#ifdef USE_OPENGL
char happy=1; char happy=1;
int32_t tilex = 0; int32_t tilex = 0;
#endif
int32_t ftilenume = -1, ltilenume = -1, flags = 0, fov = -1, angadd = 0; int32_t ftilenume = -1, ltilenume = -1, flags = 0, fov = -1, angadd = 0;
double xadd = 0.0, yadd = 0.0, zadd = 0.0; double xadd = 0.0, yadd = 0.0, zadd = 0.0;
@ -1607,10 +1583,8 @@ static int32_t defsparser(scriptfile *script)
double scale=1.0; double scale=1.0;
scriptfile_getdouble(script,&scale); scriptfile_getdouble(script,&scale);
voxscale[lastvoxid] = (int32_t)(65536*scale); voxscale[lastvoxid] = (int32_t)(65536*scale);
#ifdef USE_OPENGL
if (voxmodels[lastvoxid]) if (voxmodels[lastvoxid])
voxmodels[lastvoxid]->scale = scale; voxmodels[lastvoxid]->scale = scale;
#endif
break; break;
} }
@ -2838,9 +2812,6 @@ static int32_t defsparser(scriptfile *script)
scriptfile_setposition(script, blockend); scriptfile_setposition(script, blockend);
break; break;
} }
int didLoadTransluc = 0;
while (!scriptfile_endofblock(script, blockend)) while (!scriptfile_endofblock(script, blockend))
{ {
int32_t token = getatoken(script,subtokens,countof(subtokens)); int32_t token = getatoken(script,subtokens,countof(subtokens));
@ -2913,8 +2884,6 @@ static int32_t defsparser(scriptfile *script)
pos.Message(MSG_ERROR, "blendtable: Read failed"); pos.Message(MSG_ERROR, "blendtable: Read failed");
break; break;
} }
didLoadTransluc = 1;
break; break;
} }
case T_COPY: case T_COPY:
@ -2927,18 +2896,11 @@ static int32_t defsparser(scriptfile *script)
pos.Message(MSG_ERROR, "blendtable: Invalid source blendtable number"); pos.Message(MSG_ERROR, "blendtable: Invalid source blendtable number");
break; break;
} }
didLoadTransluc = 1;
glblend[id] = glblend[source]; glblend[id] = glblend[source];
break; break;
} }
case T_UNDEF: case T_UNDEF:
{ {
didLoadTransluc = 0;
if (id == 0)
paletteloaded &= ~PALETTE_TRANSLUC;
glblend[id] = defaultglblend; glblend[id] = defaultglblend;
break; break;
} }
@ -3029,11 +2991,6 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
} }
if (didLoadTransluc && id == 0)
{
paletteloaded |= PALETTE_TRANSLUC;
}
} }
break; break;
case T_NUMALPHATABS: case T_NUMALPHATABS:
@ -3124,9 +3081,6 @@ static int32_t defsparser(scriptfile *script)
pos.Message(MSG_ERROR, "undefblendtablerange: Invalid range"); pos.Message(MSG_ERROR, "undefblendtablerange: Invalid range");
break; break;
} }
if (id0 == 0)
paletteloaded &= ~PALETTE_TRANSLUC;
} }
break; break;
case T_NEWGAMECHOICES: // stub case T_NEWGAMECHOICES: // stub

View file

@ -2509,7 +2509,7 @@ int ConCompiler::parsecommand()
if (tw == concmd_setactorvar && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR)) if (tw == concmd_setactorvar && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR))
{ {
errorcount++; errorcount++;
Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Variable '%s' is not per-actor.\n", fn, line_number, parselabel); Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Variable '%s' is not per-actor.\n", fn, line_number, parselabel.GetChars());
return 0; return 0;
} }
@ -2610,7 +2610,7 @@ int ConCompiler::parsecommand()
errorcount++; errorcount++;
ReportError(ERROR_NOTAGAMEDEF); ReportError(ERROR_NOTAGAMEDEF);
Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Symbol '%s' is not a Game Definition.\n", fn, line_number, parselabel); Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Symbol '%s' is not a Game Definition.\n", fn, line_number, parselabel.GetChars());
return 0; return 0;
} }
appendscriptvalue(i); // the ID of the DEF (offset into array...) appendscriptvalue(i); // the ID of the DEF (offset into array...)
@ -2677,7 +2677,7 @@ int ConCompiler::parsecommand()
int k = popscriptvalue(); int k = popscriptvalue();
if (k > VERSIONCHECK) if (k > VERSIONCHECK)
{ {
Printf(TEXTCOLOR_RED, " * ERROR: This CON Code requires at least Build %d, but we are only Build %d\n", k, (int)VERSIONCHECK); Printf(TEXTCOLOR_RED " * ERROR: This CON Code requires at least Build %d, but we are only Build %d\n", k, (int)VERSIONCHECK);
errorcount++; errorcount++;
} }
break; break;

View file

@ -303,8 +303,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break; break;
case PLAYER_LOOGIEY: case PLAYER_LOOGIEY:
if (bSet) ps[iPlayer].loogiey[64] = lValue; if (bSet) ps[iPlayer].loogiey[lParm2] = lValue;
else SetGameVarID((int)lVar2, ps[iPlayer].loogiey[64], sActor, sPlayer); else SetGameVarID((int)lVar2, ps[iPlayer].loogiey[lParm2], sActor, sPlayer);
break; break;
case PLAYER_NUMLOOGS: case PLAYER_NUMLOOGS: