1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "nel/3d/tile_element.h"
20 #include "nel/misc/debug.h"
30 void CTileElement::setTileOrient(sint i
, uint8 orient
)
32 nlassert(i
>=0 && i
<=2);
34 sint where
= NL_TILE_ELM_SIZE_ROTATE
*i
+NL_TILE_ELM_OFFSET_ROTATE
;
35 Flags
&= ~(NL_TILE_ELM_MASK_ROTATE
<<where
);
36 Flags
|= orient
<<where
;
40 uint8
CTileElement::getTileOrient(sint i
) const
42 nlassert(i
>=0 && i
<=2);
43 sint where
= NL_TILE_ELM_SIZE_ROTATE
*i
+NL_TILE_ELM_OFFSET_ROTATE
;
44 return uint8 ((Flags
>>where
) & NL_TILE_ELM_MASK_ROTATE
);
48 void CTileElement::setTile256Info(bool is256x256
, uint8 uvOff
)
51 sint where
= NL_TILE_ELM_OFFSET_UVINFO
;
52 sint info
= uvOff
+(is256x256
?4:0);
53 Flags
&= ~(NL_TILE_ELM_MASK_UVINFO
<<where
);
58 void CTileElement::getTile256Info(bool &is256x256
, uint8
&uvOff
) const
60 sint where
= NL_TILE_ELM_OFFSET_UVINFO
;
61 sint info
= ((Flags
>>where
) & NL_TILE_ELM_MASK_UVINFO
);
63 is256x256
= (info
&4)?true:false;
67 void CTileElement::setTileSubNoise(uint8 subNoise
)
69 nlassert(subNoise
<=15);
70 sint where
= NL_TILE_ELM_OFFSET_SUBNOISE
;
71 Flags
&= ~(NL_TILE_ELM_MASK_SUBNOISE
<<where
);
72 Flags
|= subNoise
<<where
;
76 void CTileElement::serial(NLMISC::IStream
&f
)
78 f
.xmlSerial (Flags
, "FLAGS");
79 f
.xmlSerial (Tile
[0], Tile
[1], Tile
[2], "TILES_ID");
83 void CTileElement::setVegetableState(TVegetableInfo state
)
85 nlassert(state
< VegetInfoLast
);
86 const uint16 mask
= NL_TILE_ELM_MASK_VEGETABLE
<< NL_TILE_ELM_OFFSET_VEGETABLE
;
87 Flags
= (Flags
& ~mask
) | ((uint16
) state
<< NL_TILE_ELM_OFFSET_VEGETABLE
);