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

Function parseModelSkinBlock

source/core/defparser.cpp:1497–1545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1495}
1496
1497static bool parseModelSkinBlock(FScanner& sc, int pal)
1498{
1499 FScanner::SavedPos blockend;
1500 FScriptPosition pos = sc;
1501
1502 FString filename;
1503 int surface = 0;
1504 float param = 1.0, specpower = 1.0, specfactor = 1.0;
1505 int flags = 0;
1506
1507 if (sc.StartBraces(&blockend)) return false;
1508 while (!sc.FoundEndBrace(blockend))
1509 {
1510 sc.MustGetString();
1511 if (sc.Compare("pal")) sc.GetNumber(pal, true);
1512 else if (sc.Compare("file")) sc.GetString(filename);
1513 else if (sc.Compare({ "surface", "surf" })) sc.GetNumber(surface, true);
1514 else if (sc.Compare({ "intensity", "scale", "detailscale" })) sc.GetFloat(param, true);
1515 else if (sc.Compare({ "specpower", "specularpower", "parallaxscale" })) sc.GetFloat(specpower, true);
1516 else if (sc.Compare({ "specfactor", "specularfactor", "parallaxbias" })) sc.GetFloat(specfactor, true);
1517 else if (sc.Compare("forcefilter")) { /* not suppoted yet*/ }
1518 }
1519
1520
1521 if (filename.IsEmpty())
1522 {
1523 pos.Message(MSG_ERROR, "missing 'skin filename' for skin definition");
1524 return false;
1525 }
1526
1527 if (mdglobal.seenframe) mdglobal.modelskin = ++mdglobal.lastmodelskin;
1528 mdglobal.seenframe = 0;
1529
1530 if (!fileSystem.FileExists(filename.GetChars()))
1531 {
1532 pos.Message(MSG_ERROR, "%s: file not found", filename.GetChars());
1533 return false;
1534 }
1535
1536 if (pal == DETAILPAL) param = 1.f / param;
1537 int res = modelManager.DefineSkin(mdglobal.lastmodelid, filename.GetChars(), pal, max(0, mdglobal.modelskin), surface, param, specpower, specfactor, flags);
1538 if (res < 0)
1539 {
1540 if (res == -2) pos.Message(MSG_ERROR, "Invalid skin filename %s", filename.GetChars());
1541 else if (res == -3) pos.Message(MSG_ERROR, "Invalid palette number %d", pal);
1542 return false;
1543 }
1544 return true;
1545}
1546
1547static bool parseModelHudBlock(FScanner& sc)
1548{

Callers 1

parseModelFunction · 0.85

Calls 12

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

Tested by

no test coverage detected