MCPcopy Create free account
hub / github.com/ZDoom/Raze / parseModelFrameBlock

Function parseModelFrameBlock

source/core/defparser.cpp:1412–1455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1410//===========================================================================
1411
1412static bool parseModelFrameBlock(FScanner& sc, FixedBitArray<1024>& usedframes)
1413{
1414 FScanner::SavedPos blockend;
1415 FScriptPosition pos = sc;
1416
1417 FString framename;
1418 bool ok = true;
1419 int pal = -1;
1420 int starttile = -1, endtile = -1;
1421 float smoothduration = 0.1f;
1422
1423 if (sc.StartBraces(&blockend)) return false;
1424 while (!sc.FoundEndBrace(blockend))
1425 {
1426 sc.MustGetString();
1427 if (sc.Compare("pal")) sc.GetNumber(pal, true);
1428 else if (sc.Compare({ "name", "frame" })) sc.GetString(framename);
1429 else if (sc.Compare("tile")) { sc.GetNumber(starttile, true); endtile = starttile; }
1430 else if (sc.Compare("tile0")) sc.GetNumber(starttile, true);
1431 else if (sc.Compare("tile1")) sc.GetNumber(endtile, true);
1432 else if (sc.Compare("smoothduration")) sc.GetFloat(smoothduration, true);
1433 }
1434
1435 if (!ValidateTileRange("model/frame", starttile, endtile, pos)) return false;
1436
1437 if (smoothduration > 1.0)
1438 {
1439 pos.Message(MSG_WARNING, "smoothduration out of range");
1440 smoothduration = 1.0;
1441 }
1442 for (int i = starttile; i <= endtile && ok; i++)
1443 {
1444 int res = modelManager.DefineFrame(mdglobal.lastmodelid, framename.GetChars(), i, max(0, mdglobal.modelskin), smoothduration, pal);
1445 if (res < 0)
1446 {
1447 ok = false;
1448 if (res == -2) pos.Message(MSG_WARNING, "Invalid tile number %d", i);
1449 else if (res == -3) pos.Message(MSG_WARNING, "%s: Invalid frame name", framename.GetChars());
1450 }
1451 else if (res < 1024) usedframes.Set(res);
1452 }
1453 mdglobal.seenframe = 1;
1454 return ok;
1455}
1456
1457static bool parseModelAnimBlock(FScanner& sc)
1458{

Callers 1

parseModelFunction · 0.85

Calls 12

ValidateTileRangeFunction · 0.85
StartBracesMethod · 0.80
FoundEndBraceMethod · 0.80
MustGetStringMethod · 0.80
MessageMethod · 0.80
DefineFrameMethod · 0.80
CompareMethod · 0.45
GetNumberMethod · 0.45
GetStringMethod · 0.45
GetFloatMethod · 0.45
GetCharsMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected