$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
00001 // _________ __ __ 00002 // / _____// |_____________ _/ |______ ____ __ __ ______ 00003 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ 00004 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ | 00005 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > 00006 // \/ \/ \//_____/ \/ 00007 // ______________________ ______________________ 00008 // T H E W A R B E G I N S 00009 // Stratagus - A free fantasy real time strategy game engine 00010 // 00012 // 00013 // (c) Copyright 1998-2005 by Lutz Sammer and Jimmy Salmon 00014 // 00015 // This program is free software; you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation; only version 2 of the License. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00027 // 02111-1307, USA. 00028 // 00029 00030 #ifndef __TILESET_H__ 00031 #define __TILESET_H__ 00032 00034 00035 /*---------------------------------------------------------------------------- 00036 -- Documentation 00037 ----------------------------------------------------------------------------*/ 00038 00200 /*---------------------------------------------------------------------------- 00201 -- Declarations 00202 ----------------------------------------------------------------------------*/ 00203 00204 #include "vec2i.h" 00205 00206 00207 extern PixelSize PixelTileSize; 00208 00216 enum TileType { 00217 TileTypeUnknown, 00218 TileTypeWood, 00219 TileTypeRock, 00220 TileTypeCoast, 00221 TileTypeHumanWall, 00222 TileTypeOrcWall, 00223 TileTypeWater 00224 }; 00225 00227 struct TileInfo { 00228 unsigned char BaseTerrain; 00229 unsigned char MixTerrain; 00230 }; 00231 00233 struct SolidTerrainInfo { 00234 std::string TerrainName; 00235 // TODO: When drawing with the editor add some kind fo probabilities for every tile. 00236 }; 00237 00238 #define MapFieldWall 0x0200 00239 #define MapFieldRocks 0x0400 00240 #define MapFieldForest 0x0800 00241 00243 class CTileset { 00244 public: 00245 void Clear() { 00246 Name.clear(); 00247 ImageFile.clear(); 00248 NumTiles = 0; 00249 PixelTileSize.x = PixelTileSize.y = 0; 00250 delete[] Table; 00251 Table = NULL; 00252 delete[] FlagsTable; 00253 FlagsTable = NULL; 00254 delete[] Tiles; 00255 Tiles = NULL; 00256 delete[] TileTypeTable; 00257 TileTypeTable = NULL; 00258 delete[] SolidTerrainTypes; 00259 SolidTerrainTypes = NULL; 00260 NumTerrainTypes = 0; 00261 TopOneTree = 0; 00262 MidOneTree = 0; 00263 BotOneTree = 0; 00264 RemovedTree = 0; 00265 memset(GrowingTree, 0, sizeof(GrowingTree)); 00266 memset(WoodTable, 0, sizeof(WoodTable)); 00267 delete[] MixedLookupTable; 00268 MixedLookupTable = NULL; 00269 TopOneRock = 0; 00270 MidOneRock = 0; 00271 BotOneRock = 0; 00272 RemovedRock = 0; 00273 memset(RockTable, 0, sizeof(RockTable)); 00274 memset(HumanWallTable, 0, sizeof(HumanWallTable)); 00275 memset(OrcWallTable, 0, sizeof(OrcWallTable)); 00276 } 00277 std::string Name; 00278 std::string ImageFile; 00279 00280 int NumTiles; 00281 PixelSize PixelTileSize; 00282 unsigned short *Table; 00283 unsigned short *FlagsTable; 00284 00285 TileInfo *Tiles; 00286 00287 // TODO: currently hardcoded 00288 unsigned char *TileTypeTable; 00289 00290 unsigned int NumTerrainTypes; 00291 SolidTerrainInfo *SolidTerrainTypes; 00292 00293 unsigned TopOneTree; 00294 unsigned MidOneTree; 00295 unsigned BotOneTree; 00296 int RemovedTree; 00297 unsigned GrowingTree[2]; 00298 int WoodTable[20]; 00299 int *MixedLookupTable; 00300 unsigned TopOneRock; 00301 unsigned MidOneRock; 00302 unsigned BotOneRock; 00303 int RemovedRock; 00304 int RockTable[20]; 00305 00306 unsigned HumanWallTable[16]; 00307 unsigned OrcWallTable[16]; 00308 00309 bool IsSeenTile(unsigned short type, unsigned short seen) const 00310 { 00311 if(TileTypeTable) { 00312 switch (type) { 00313 case MapFieldForest: 00314 return TileTypeTable[seen] == TileTypeWood; 00315 case MapFieldRocks: 00316 return TileTypeTable[seen] == TileTypeRock; 00317 default: 00318 return false; 00319 } 00320 } 00321 return false; 00322 }; 00323 00324 }; 00325 00326 /*---------------------------------------------------------------------------- 00327 -- Functions 00328 ----------------------------------------------------------------------------*/ 00329 00330 extern void LoadTileset(); 00331 extern void CleanTilesets(); 00332 extern void TilesetCclRegister(); 00333 00335 00336 #endif // !__TILESET_H__