| 899 | //=========================================================================== |
| 900 | |
| 901 | static 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 | // |
nothing calls this directly
no test coverage detected