git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / src / common / landscapemap / GroundMaps.h
blob047bcbdf532c6bf297b33cdc8d704dca95d4304e
1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
3 //
4 // This file is part of Scorched3D.
5 //
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #if !defined(__INCLUDE_GroundMapsh_INCLUDE__)
22 #define __INCLUDE_GroundMapsh_INCLUDE__
24 #include <landscapemap/HeightMap.h>
25 #include <landscapemap/NapalmMap.h>
26 #include <landscapemap/TargetGroups.h>
28 class RandomGenerator;
29 class ScorchedContext;
30 class LandscapeInclude;
31 class LandscapeDefinitionCache;
32 class GroundMaps
34 public:
35 GroundMaps(LandscapeDefinitionCache &defnCache);
36 virtual ~GroundMaps();
38 // Generates the next level
39 void generateMaps(
40 ScorchedContext &context,
41 ProgressCounter *counter = 0);
43 // Height map functions
44 fixed getHeight(int w, int h);
45 fixed getInterpHeight(fixed w, fixed h);
46 FixedVector &getNormal(int w, int h);
47 void getInterpNormal(fixed w, fixed h, FixedVector &normal);
48 bool getIntersect(Line &direction, Vector &intersect);
50 // Napalm map functions
51 fixed &getNapalmHeight(int w, int h)
52 { return nmap_.getNapalmHeight(w, h); }
54 // Deformable landscape area fns
55 int getLandscapeWidth();
56 int getLandscapeHeight();
58 // Playable landscape area fns
59 int getArenaWidth();
60 int getArenaHeight();
61 int getArenaX();
62 int getArenaY();
64 // Objects funtions
65 TargetGroups &getGroups() { return groups_; }
67 // Actual heightmap
68 HeightMap &getHeightMap() { return map_; }
70 protected:
71 int arenaX_, arenaY_;
72 int arenaWidth_, arenaHeight_;
73 HeightMap map_; // The current level's heightmap
74 NapalmMap nmap_; // How high napalm is at certain points
75 TargetGroups groups_; // The groups in the scene
76 LandscapeDefinitionCache &defnCache_;
78 // Generate levels
79 void generateHMap(
80 ScorchedContext &context,
81 ProgressCounter *counter = 0);
82 void generateObjects(
83 ScorchedContext &context,
84 ProgressCounter *counter = 0);
85 void generateObject(RandomGenerator &generator,
86 LandscapeInclude &place,
87 ScorchedContext &context,
88 unsigned int &playerId,
89 ProgressCounter *counter = 0);
93 #endif // __INCLUDE_GroundMapsh_INCLUDE__