Advertisement
KeinMitleid

VMF

Jul 4th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.32 KB | None | 0 0
  1. #include <map>
  2. #include <tuple>
  3. #include <string>
  4. #include <vector>
  5. #include "objects.h"
  6.  
  7. using namespace std;
  8.  
  9. // This block holds reused sections of the VMF structure.
  10. // They will be part of what's below this block.
  11.  
  12. struct Editor
  13. {
  14.     Vector color;
  15.     int visgroupid;
  16.     int group;
  17.     bool visgroupshown;
  18.     bool visgroupautoshown;
  19.     string comments;
  20. };
  21.  
  22. struct Solid
  23. {
  24.     struct Side
  25.     {
  26.         Vector plane[3];
  27.         string material;
  28.         Vector uaxis[2];
  29.         Vector vaxis[2];
  30.         float rotation;
  31.         int lightmapscale;
  32.         int smoothing_groups;
  33.  
  34.         struct Dispinfo
  35.         {
  36.             int power;
  37.             Vector startposition;
  38.             float elevation;
  39.             bool subdiv;
  40.             vector<vector<Vector>> normals;
  41.             vector<vector<float>> distances;
  42.             vector<vector<Vector>> offsets;
  43.             vector<vector<Vector>> offset_normals;
  44.             vector<vector<float>> alphas;
  45.             vector<vector<int>> triangle_tags;
  46.             vector<vector<int>> allowed_verts;
  47.         }
  48.         dispinfo;
  49.     };
  50.     map<int, Side> side;
  51.  
  52.     Editor editor;
  53. };
  54.  
  55. struct Hidden
  56. {
  57.     map<int, Solid> solid;
  58. };
  59.  
  60. // A struct that holds the VMF file.
  61. // https://developer.valvesoftware.com/wiki/VMF_documentation
  62.  
  63. struct Data
  64. {
  65.     struct Versioninfo
  66.     {
  67.         int editorversion;
  68.         int editorbuild;
  69.         int mapversion;
  70.         int formatversion;
  71.         bool prefab;
  72.     }
  73.     versioninfo;
  74.  
  75.     struct Visgroups
  76.     {
  77.         int visgroupid;
  78.         Vector rgb;
  79.         map<string, Visgroups> branch;
  80.     };
  81.     map<string, Visgroups> visgroups;
  82.  
  83.     struct Viewsettings
  84.     {
  85.         bool bSnapToGrid;
  86.         bool bShowGrid;
  87.         bool bShowLogicalGrid;
  88.         int nGridSpacing;
  89.         bool bShow3DGrid;
  90.     }
  91.     viewsettings;
  92.  
  93.     struct World
  94.     {
  95.         string mapversion;
  96.         string classname;
  97.         string skyname;
  98.         Hidden hidden;
  99.         map<int, Solid> solid;
  100.  
  101.         struct Group
  102.         {
  103.             Editor editor;
  104.         };
  105.         map<int, Group> group;
  106.     };
  107.     map<int, World> world;
  108.  
  109.     struct Entity
  110.     {
  111.         string classname;
  112.         int spawnflags;
  113.         Vector origin;
  114.         Solid solid;
  115.         Editor editor;
  116.         Hidden hidden;
  117.         map<string, string> properties;
  118.  
  119.         struct Connections
  120.         {
  121.             map<string, tuple<string, string, string, float, bool>> output;
  122.         }
  123.         connections;
  124.     };
  125.     map<int, Entity> entity;
  126.  
  127.     struct Cameras
  128.     {
  129.         int activecamera;
  130.  
  131.         struct Camera
  132.         {
  133.             Vector position;
  134.             Vector look;
  135.         };
  136.         vector<Camera> camera;
  137.     }
  138.     cameras;
  139.  
  140.     struct Cordon
  141.     {
  142.         Vector mins;
  143.         Vector maxs;
  144.         bool active;
  145.     }
  146.     cordon;
  147. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement