LandscapeDefn.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(__INCLUDE_LandscapeDefnh_INCLUDE__)
00022 #define __INCLUDE_LandscapeDefnh_INCLUDE__
00023 
00024 #include <landscapedef/LandscapeTexDefn.h>
00025 #include <common/fixed.h>
00026 #include <coms/ComsMessage.h>
00027 #include <XML/XMLFile.h>
00028 #include <string>
00029 
00030 class LandscapeDefnType
00031 {
00032 public:
00033         enum DefnType
00034         {
00035                 eNone,
00036                 eStartHeight,
00037                 eRoofCavern,
00038                 eHeightMapFile,
00039                 eHeightMapGenerate
00040         };
00041 
00042         virtual bool readXML(XMLNode *node) = 0;
00043         virtual DefnType getType() = 0;
00044 };
00045 
00046 class LandscapeDefnTypeNone : public LandscapeDefnType
00047 {
00048 public:
00049         virtual bool readXML(XMLNode *node);
00050         virtual DefnType getType() { return eNone; }
00051 };
00052 
00053 class LandscapeDefnStartHeight : public LandscapeDefnType
00054 {
00055 public:
00056         fixed flatness;
00057         fixed startcloseness;
00058         fixed heightmin, heightmax;
00059         std::string startmask;
00060 
00061         virtual bool readXML(XMLNode *node);
00062         virtual DefnType getType() { return eStartHeight; }
00063 };
00064 
00065 class LandscapeDefnRoofCavern : public LandscapeDefnType
00066 {
00067 public:
00068         LandscapeDefnRoofCavern();
00069         virtual ~LandscapeDefnRoofCavern();
00070 
00071         fixed width;
00072         fixed height;
00073         LandscapeDefnType *heightmap;
00074 
00075         virtual bool readXML(XMLNode *node);
00076         virtual DefnType getType() { return eRoofCavern; }
00077 };
00078 
00079 class LandscapeDefnHeightMapFile : public LandscapeDefnType
00080 {
00081 public:
00082         std::string file;
00083         bool levelsurround;
00084 
00085         virtual bool readXML(XMLNode *node);
00086         virtual DefnType getType() { return eHeightMapFile; }
00087 };
00088 
00089 class LandscapeDefnHeightMapGenerate : public LandscapeDefnType
00090 {
00091 public:
00092         std::string mask;
00093 
00094         fixed noisefactor;
00095         int noisewidth, noiseheight;
00096 
00097         int errosions;
00098         int errosionlayering, errosionsurroundsize;
00099         fixed errosionforce, errosionmaxdepth;
00100         fixed errosionsurroundforce;
00101         
00102         int landhillsmax, landhillsmin;
00103         fixed landheightmax, landheightmin;
00104         fixed landpeakwidthxmax, landpeakwidthxmin;
00105         fixed landpeakwidthymax, landpeakwidthymin;
00106         fixed landpeakheightmax, landpeakheightmin;
00107         fixed landsmoothing;
00108         bool levelsurround;
00109 
00110         virtual bool readXML(XMLNode *node);
00111         virtual DefnType getType() { return eHeightMapGenerate; }
00112 };
00113 
00114 class LandscapeDefn
00115 {
00116 public:
00117         LandscapeDefn();
00118         virtual ~LandscapeDefn();
00119 
00120         int getMinPlayers() { return minplayers; }
00121         int getMaxPlayers() { return maxplayers; }
00122         int getLandscapeWidth() { return landscapewidth; }
00123         int getLandscapeHeight() { return landscapeheight; }
00124         int getArenaWidth() { return arenawidth; }
00125         int getArenaHeight() { return arenaheight; }
00126         int getArenaX() { return arenax; }
00127         int getArenaY() { return arenay; }
00128 
00129         LandscapeDefnType *roof;
00130         LandscapeDefnType *tankstart;
00131         LandscapeDefnType *heightmap;
00132         LandscapeTexDefn texDefn;
00133 
00134         bool readXML(LandscapeDefinitions *definitions, XMLNode *node);
00135 
00136 protected:
00137         int minplayers, maxplayers;
00138         int landscapewidth, landscapeheight;
00139         int arenawidth, arenaheight;
00140         int arenax, arenay;
00141 
00142 private:
00143         LandscapeDefn(const LandscapeDefn &other);
00144         LandscapeDefn &operator=(LandscapeDefn &other);
00145 
00146 };
00147 
00148 #endif

Generated on Mon Feb 16 15:14:50 2009 for Scorched3D by  doxygen 1.5.3