| 1545 | } |
| 1546 | |
| 1547 | static bool parseModelHudBlock(FScanner& sc) |
| 1548 | { |
| 1549 | FScanner::SavedPos blockend; |
| 1550 | FScriptPosition pos = sc; |
| 1551 | |
| 1552 | int starttile = -1, endtile = -1, flags = 0, fov = -1, angadd = 0; |
| 1553 | DVector3 add{}; |
| 1554 | |
| 1555 | if (sc.StartBraces(&blockend)) return false; |
| 1556 | while (!sc.FoundEndBrace(blockend)) |
| 1557 | { |
| 1558 | sc.MustGetString(); |
| 1559 | if (sc.Compare("tile")) { sc.GetNumber(starttile, true); endtile = starttile; } |
| 1560 | else if (sc.Compare("tile0")) sc.GetNumber(starttile, true); |
| 1561 | else if (sc.Compare("tile1")) sc.GetNumber(endtile, true); |
| 1562 | else if (sc.Compare("xadd")) sc.GetFloat(add.X, true); |
| 1563 | else if (sc.Compare("yadd")) sc.GetFloat(add.Y, true); |
| 1564 | else if (sc.Compare("zadd")) sc.GetFloat(add.Z, true); |
| 1565 | else if (sc.Compare("angadd")) sc.GetNumber(angadd, true); |
| 1566 | else if (sc.Compare("fov")) sc.GetNumber(fov, true); |
| 1567 | else if (sc.Compare("hide")) flags |= HUDFLAG_HIDE; |
| 1568 | else if (sc.Compare("nobob")) flags |= HUDFLAG_NOBOB; |
| 1569 | else if (sc.Compare("flipped")) flags |= HUDFLAG_FLIPPED; |
| 1570 | else if (sc.Compare("nodepth")) flags |= HUDFLAG_NODEPTH; |
| 1571 | } |
| 1572 | |
| 1573 | if (!ValidateTileRange("hud", starttile, endtile, pos)) return false; |
| 1574 | |
| 1575 | for (int i = starttile; i <= endtile; i++) |
| 1576 | { |
| 1577 | FVector3 addf = { (float)add.X, (float)add.Y, (float)add.Z }; |
| 1578 | int res = modelManager.DefineHud(mdglobal.lastmodelid, i, addf, angadd, flags, fov); |
| 1579 | if (res < 0) |
| 1580 | { |
| 1581 | if (res == -2) pos.Message(MSG_ERROR, "Invalid tile number %d", i); |
| 1582 | return false; |
| 1583 | } |
| 1584 | } |
| 1585 | return true; |
| 1586 | } |
| 1587 | |
| 1588 | static void parseModel(FScanner& sc, FScriptPosition& pos) |
| 1589 | { |
no test coverage detected