| 1455 | } |
| 1456 | |
| 1457 | static 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 | |
| 1497 | static bool parseModelSkinBlock(FScanner& sc, int pal) |
| 1498 | { |
no test coverage detected