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

Function parseTexturePaletteBlock

source/core/defparser.cpp:361–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359//===========================================================================
360
361static void parseTexturePaletteBlock(FScanner& sc, int tile)
362{
363 FScanner::SavedPos blockend;
364 FScriptPosition pos = sc;
365
366 int pal = -1, xsiz = 0, ysiz = 0;
367 FString fn;
368 float alphacut = -1.0, xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0;
369 bool indexed = false;
370
371 if (!sc.GetNumber(pal, true)) return;
372
373 if (sc.StartBraces(&blockend)) return;
374 while (!sc.FoundEndBrace(blockend))
375 {
376 sc.GetString();
377 if (sc.Compare("file")) sc.GetString(fn);
378 else if (sc.Compare("alphacut")) sc.GetFloat(alphacut, true);
379 else if (sc.Compare({ "xscale", "scale", "intensity", "detailscale" })) sc.GetFloat(xscale, true); // what's the point of all of these names?
380 else if (sc.Compare("yscale")) sc.GetFloat(yscale, true);
381 else if (sc.Compare({ "specpower", "specularpower", "parallaxscale" })) sc.GetFloat(specpower, true);
382 else if (sc.Compare({ "specfactor", "specularfactor", "parallaxbias" })) sc.GetFloat(specfactor, true);
383 else if (sc.Compare("orig_sizex")) sc.GetNumber(xsiz, true);
384 else if (sc.Compare("orig_sizey")) sc.GetNumber(ysiz, true);
385 else if (sc.Compare("indexed")) indexed = true;
386 };
387
388 if ((unsigned)tile < MAXUSERTILES)
389 {
390 if ((unsigned)pal >= MAXREALPAL) pos.Message(MSG_ERROR, "texture (%d): invalid palette number %d ", tile, pal);
391 else if (fn.IsEmpty()) pos.Message(MSG_ERROR, "texture (%d): missing file name in palette definition", tile);
392 else if (!fileSystem.FileExists(fn.GetChars())) pos.Message(MSG_ERROR, "texture (%d): file '%s' not found in palette definition", tile, fn.GetChars());
393 else
394 {
395 if (xsiz > 0 && ysiz > 0)
396 {
397 tbuild->tile[tile].tileimage = createDummyTile(xsiz, ysiz);
398 }
399 xscale = 1.0f / xscale;
400 yscale = 1.0f / yscale;
401
402 tileSetHightileReplacement(sc, tile, pal, fn.GetChars(), alphacut, xscale, yscale, specpower, specfactor, indexed);
403 }
404 }
405}
406
407static void parseTextureSpecialBlock(FScanner& sc, int tile, int pal)
408{

Callers 1

parseTextureFunction · 0.85

Calls 12

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

Tested by

no test coverage detected