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

Method ParseTexture

source/common/textures/multipatchtexturebuilder.cpp:611–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609//==========================================================================
610
611void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType, int deflump)
612{
613 BuildInfo &buildinfo = BuiltTextures[BuiltTextures.Reserve(1)];
614
615 bool bSilent = false;
616
617 buildinfo.textual = true;
618 sc.SetCMode(true);
619 sc.MustGetString();
620
621 const char *textureName = nullptr;
622 if (sc.Compare("optional"))
623 {
624 bSilent = true;
625 sc.MustGetString();
626 if (sc.Compare(","))
627 {
628 // this is not right. Apparently a texture named 'optional' is being defined right now...
629 sc.UnGet();
630 textureName = "optional";
631 bSilent = false;
632 }
633 }
634 buildinfo.Name = !textureName ? sc.String : textureName;
635 buildinfo.Name.ToUpper();
636 sc.MustGetStringName(",");
637 sc.MustGetNumber();
638 buildinfo.Width = sc.Number;
639 sc.MustGetStringName(",");
640 sc.MustGetNumber();
641 buildinfo.Height = sc.Number;
642 buildinfo.DefinitionLump = deflump;
643
644 bool offset2set = false;
645 if (sc.CheckString("{"))
646 {
647 while (!sc.CheckString("}"))
648 {
649 sc.MustGetString();
650 if (sc.Compare("XScale"))
651 {
652 sc.MustGetFloat();
653 buildinfo.Scale.X = sc.Float;
654 if (buildinfo.Scale.X == 0) sc.ScriptError("Texture %s is defined with null x-scale\n", buildinfo.Name.GetChars());
655 }
656 else if (sc.Compare("YScale"))
657 {
658 sc.MustGetFloat();
659 buildinfo.Scale.Y = sc.Float;
660 if (buildinfo.Scale.Y == 0) sc.ScriptError("Texture %s is defined with null y-scale\n", buildinfo.Name.GetChars());
661 }
662 else if (sc.Compare("WorldPanning"))
663 {
664 buildinfo.bWorldPanning = true;
665 }
666 else if (sc.Compare("NullTexture"))
667 {
668 UseType = ETextureType::Null;

Callers 1

ParseTextureDefMethod · 0.80

Calls 15

PrintfFunction · 0.85
ReserveMethod · 0.80
SetCModeMethod · 0.80
MustGetStringMethod · 0.80
UnGetMethod · 0.80
MustGetStringNameMethod · 0.80
MustGetNumberMethod · 0.80
MustGetFloatMethod · 0.80
IsNotEmptyMethod · 0.80
CompareMethod · 0.45
ToUpperMethod · 0.45
CheckStringMethod · 0.45

Tested by

no test coverage detected