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

Function parseModelAnimBlock

source/core/defparser.cpp:1457–1495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1455}
1456
1457static bool parseModelAnimBlock(FScanner& sc)
1458{
1459 FScanner::SavedPos blockend;
1460 FScriptPosition pos = sc;
1461
1462 FString startframe, endframe;
1463 int flags = 0;
1464 double fps = 1.0;
1465
1466 if (sc.StartBraces(&blockend)) return false;
1467 while (!sc.FoundEndBrace(blockend))
1468 {
1469 sc.MustGetString();
1470 if (sc.Compare("frame0")) sc.GetString(startframe);
1471 else if (sc.Compare("frame1")) sc.GetString(endframe);
1472 else if (sc.Compare("fps")) sc.GetFloat(fps, true);
1473 else if (sc.Compare("flags")) sc.GetNumber(flags, true);
1474 }
1475
1476 if (startframe.IsEmpty())
1477 {
1478 pos.Message(MSG_ERROR, "missing start frame for anim definition");
1479 return false;
1480 }
1481 if (endframe.IsEmpty())
1482 {
1483 pos.Message(MSG_ERROR, "missing end frame for anim definition");
1484 return false;
1485 }
1486
1487 int res = modelManager.DefineAnimation(mdglobal.lastmodelid, startframe.GetChars(), endframe.GetChars(), (int)(fps * (65536.0 * .001)), flags);
1488 if (res < 0)
1489 {
1490 if (res == -2) pos.Message(MSG_ERROR, "Invalid start frame name %s", startframe.GetChars());
1491 else if (res == -3) pos.Message(MSG_ERROR, "Invalid end frame name %s", endframe.GetChars());
1492 return false;
1493 }
1494 return true;
1495}
1496
1497static bool parseModelSkinBlock(FScanner& sc, int pal)
1498{

Callers 1

parseModelFunction · 0.85

Calls 11

StartBracesMethod · 0.80
FoundEndBraceMethod · 0.80
MustGetStringMethod · 0.80
MessageMethod · 0.80
DefineAnimationMethod · 0.80
CompareMethod · 0.45
GetStringMethod · 0.45
GetFloatMethod · 0.45
GetNumberMethod · 0.45
IsEmptyMethod · 0.45
GetCharsMethod · 0.45

Tested by

no test coverage detected