Home | nevrax.com |
|
tile_element.hGo to the documentation of this file.00001 00007 /* Copyright, 2000 Nevrax Ltd. 00008 * 00009 * This file is part of NEVRAX NEL. 00010 * NEVRAX NEL is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2, or (at your option) 00013 * any later version. 00014 00015 * NEVRAX NEL is distributed in the hope that it will be useful, but 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * General Public License for more details. 00019 00020 * You should have received a copy of the GNU General Public License 00021 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00022 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00023 * MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef NL_TILE_ELEMENT_H 00027 #define NL_TILE_ELEMENT_H 00028 00029 #include "nel/misc/types_nl.h" 00030 #include "nel/misc/stream.h" 00031 00032 00033 namespace NL3D 00034 { 00035 00036 #define NL_TILE_ELM_MASK_ROTATE 0x03 00037 #define NL_TILE_ELM_OFFSET_ROTATE 0 00038 #define NL_TILE_ELM_SIZE_ROTATE 2 00039 #define NL_TILE_ELM_MASK_UVINFO 0x07 00040 #define NL_TILE_ELM_OFFSET_UVINFO 6 00041 #define NL_TILE_ELM_SIZE_UVINFO 3 00042 #define NL_TILE_ELM_MASK_SUBNOISE 0x0F 00043 #define NL_TILE_ELM_OFFSET_SUBNOISE 9 00044 #define NL_TILE_ELM_SIZE_SUBNOISE 4 00045 00049 #define NL_TILE_ELM_OFFSET_VEGETABLE 13 // start at the 14 th bit 00050 #define NL_TILE_ELM_MASK_VEGETABLE 0X03 // takes 2 bits 00051 #define NL_TILE_ELM_SIZE_VEGETABLE 2 00052 00053 #define NL_TILE_ELM_LAYER_EMPTY 0xffff 00054 00055 00056 // *************************************************************************** 00064 class CTileElement 00065 { 00066 private: 00067 uint16 Flags; // Tile Orientation, and Tile 256x256 UV offset. 00068 00069 public: 00070 00072 void copyFlagsFromOther(const CTileElement &other) { Flags = other.Flags; } 00073 00077 uint16 Tile[3]; 00078 00082 void setTileOrient(sint i, uint8 orient); 00083 00087 uint8 getTileOrient(sint i) const; 00088 00089 00103 void setTile256Info(bool is256x256, uint8 uvOff=0); 00104 00107 void getTile256Info(bool &is256x256, uint8 &uvOff) const; 00108 00109 00112 void setTileSubNoise(uint8 subNoise); 00113 00116 uint8 getTileSubNoise() const; 00117 00118 00119 void serial(NLMISC::IStream &f); 00120 00122 enum TVegetableInfo { AboveWater = 0, UnderWater, IntersectWater, VegetableDisabled, VegetInfoLast }; 00123 00125 void setVegetableState(TVegetableInfo state); 00126 00128 TVegetableInfo getVegetableState() const 00129 { 00130 return (TVegetableInfo) ((Flags >> NL_TILE_ELM_OFFSET_VEGETABLE) & NL_TILE_ELM_MASK_VEGETABLE); 00131 } 00132 00133 }; 00134 00135 00136 00137 } // NL3D 00138 00139 00140 #endif // NL_TILE_ELEMENT_H 00141 00142 /* End of tile_element.h */ |