GroundMaps.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_GroundMapsh_INCLUDE__)
00022 #define __INCLUDE_GroundMapsh_INCLUDE__
00023 
00024 #include <landscapemap/HeightMap.h>
00025 #include <landscapemap/NapalmMap.h>
00026 #include <landscapemap/TargetGroups.h>
00027 
00028 class RandomGenerator;
00029 class ScorchedContext;
00030 class LandscapeInclude;
00031 class LandscapeDefinitionCache;
00032 class GroundMaps
00033 {
00034 public:
00035         GroundMaps(LandscapeDefinitionCache &defnCache);
00036         virtual ~GroundMaps();
00037 
00038         // Generates the next level
00039         void generateMaps(
00040                 ScorchedContext &context,
00041                 ProgressCounter *counter = 0);
00042 
00043         // Height map functions
00044         fixed getHeight(int w, int h);
00045         fixed getInterpHeight(fixed w, fixed h);
00046         FixedVector &getNormal(int w, int h);
00047         void getInterpNormal(fixed w, fixed h, FixedVector &normal);
00048         bool getIntersect(Line &direction, Vector &intersect);
00049 
00050         // Napalm map functions
00051         fixed &getNapalmHeight(int w, int h)
00052                 { return nmap_.getNapalmHeight(w, h); }
00053 
00054         // Deformable landscape area fns
00055         int getLandscapeWidth();
00056         int getLandscapeHeight();
00057 
00058         // Playable landscape area fns
00059         int getArenaWidth();
00060         int getArenaHeight();
00061         int getArenaX();
00062         int getArenaY();
00063 
00064         // Objects funtions
00065         TargetGroups &getGroups() { return groups_; }
00066 
00067         // Actual heightmap
00068         HeightMap &getHeightMap() { return map_; }
00069 
00070 protected:
00071         int arenaX_, arenaY_;
00072         int arenaWidth_, arenaHeight_;
00073         HeightMap map_; // The current level's heightmap
00074         NapalmMap nmap_; // How high napalm is at certain points
00075         TargetGroups groups_; // The groups in the scene
00076         LandscapeDefinitionCache &defnCache_;
00077 
00078         // Generate levels
00079         void generateHMap(
00080                 ScorchedContext &context,
00081                 ProgressCounter *counter = 0);
00082         void generateObjects(
00083                 ScorchedContext &context,
00084                 ProgressCounter *counter = 0);
00085         void generateObject(RandomGenerator &generator, 
00086                 LandscapeInclude &place,
00087                 ScorchedContext &context,
00088                 unsigned int &playerId,
00089                 ProgressCounter *counter = 0);
00090 
00091 };
00092 
00093 #endif // __INCLUDE_GroundMapsh_INCLUDE__

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