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

Function parseTextureSpecialBlock

source/core/defparser.cpp:407–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407static void parseTextureSpecialBlock(FScanner& sc, int tile, int pal)
408{
409 FScanner::SavedPos blockend;
410 FScriptPosition pos = sc;
411
412 FString fn;
413 float xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0;
414
415 if (sc.StartBraces(&blockend)) return;
416 while (!sc.FoundEndBrace(blockend))
417 {
418 sc.GetString();
419 if (sc.Compare("file")) sc.GetString(fn);
420 else if (sc.Compare({ "xscale", "scale", "intensity", "detailscale" })) sc.GetFloat(xscale, true); // what's the point of all of these names?
421 else if (sc.Compare("yscale")) sc.GetFloat(yscale, true);
422 else if (sc.Compare({ "specpower", "specularpower", "parallaxscale" })) sc.GetFloat(specpower, true);
423 else if (sc.Compare({ "specfactor", "specularfactor", "parallaxbias" })) sc.GetFloat(specfactor, true);
424 };
425
426 if ((unsigned)tile < MAXUSERTILES)
427 {
428 if (fn.IsEmpty()) pos.Message(MSG_ERROR, "texture (%d): missing file name for layer definition", tile);
429 else if (!fileSystem.FileExists(fn.GetChars())) pos.Message(MSG_ERROR, "texture (%d): file '%s' not found in layer definition", tile, fn.GetChars());
430 else
431 {
432 if (pal == DETAILPAL)
433 {
434 xscale = 1.0f / xscale;
435 yscale = 1.0f / yscale;
436 }
437
438 tileSetHightileReplacement(sc, tile, pal, fn.GetChars(), -1.f, xscale, yscale, specpower, specfactor);
439 }
440 }
441}
442
443static void parseTexture(FScanner& sc, FScriptPosition& pos)
444{

Callers 1

parseTextureFunction · 0.85

Calls 10

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

Tested by

no test coverage detected