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

Function parseVoxel

source/core/defparser.cpp:901–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899//===========================================================================
900
901static void parseVoxel(FScanner& sc, FScriptPosition& pos)
902{
903 FScanner::SavedPos blockend;
904 int tile0 = MAXTILES, tile1 = -1;
905 FString fn;
906 bool error = false;
907
908 if (!sc.GetString(fn)) return;
909
910 if (tbuild->nextvoxid == MAXVOXELS)
911 {
912 pos.Message(MSG_ERROR, "Maximum number of voxels (%d) already defined.", MAXVOXELS);
913 error = true;
914 }
915 else if (voxDefine(tbuild->nextvoxid, fn.GetChars()))
916 {
917 pos.Message(MSG_ERROR, "Unable to load voxel file \"%s\"", fn.GetChars());
918 error = true;
919 }
920
921 int lastvoxid = tbuild->nextvoxid++;
922
923 if (sc.StartBraces(&blockend)) return;
924 while (!sc.FoundEndBrace(blockend))
925 {
926 sc.MustGetString();
927 if (sc.Compare("tile"))
928 {
929 sc.GetNumber(true);
930 if (ValidateTilenum("voxel", sc.Number, pos))
931 {
932 if (!error) tbuild->tile[sc.Number].extinfo.tiletovox = lastvoxid;
933 }
934 }
935 if (sc.Compare("tile0")) sc.GetNumber(tile0, true);
936 if (sc.Compare("tile1"))
937 {
938 sc.GetNumber(tile1, true);
939 if (ValidateTileRange("voxel", tile0, tile1, pos) && !error)
940 {
941 for (int i = tile0; i <= tile1; i++) tbuild->tile[i].extinfo.tiletovox = lastvoxid;
942 }
943 }
944 if (sc.Compare("scale"))
945 {
946 sc.GetFloat(true);
947 if (!error) voxscale[lastvoxid] = (float)sc.Float;
948 }
949 if (sc.Compare("rotate") && !error) voxrotate.Set(lastvoxid);
950 }
951}
952
953//===========================================================================
954//

Callers

nothing calls this directly

Calls 13

voxDefineFunction · 0.85
ValidateTilenumFunction · 0.85
ValidateTileRangeFunction · 0.85
MessageMethod · 0.80
StartBracesMethod · 0.80
FoundEndBraceMethod · 0.80
MustGetStringMethod · 0.80
GetStringMethod · 0.45
GetCharsMethod · 0.45
CompareMethod · 0.45
GetNumberMethod · 0.45
GetFloatMethod · 0.45

Tested by

no test coverage detected