AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
adt_MH2O Class Reference

#include "adt.h"

Classes

struct  adt_LIQUID
 

Public Member Functions

bool prepareLoadedData ()
 
adt_liquid_instance const * GetLiquidInstance (int32 x, int32 y) const
 
adt_liquid_attributes GetLiquidAttributes (int32 x, int32 y) const
 
uint16 GetLiquidType (adt_liquid_instance const *h) const
 
float GetLiquidHeight (adt_liquid_instance const *h, int32 pos) const
 
int8 GetLiquidDepth (adt_liquid_instance const *h, int32 pos) const
 
uint16 const * GetLiquidTextureCoordMap (adt_liquid_instance const *h, int32 pos) const
 
uint64 GetLiquidExistsBitmap (adt_liquid_instance const *h) const
 

Public Attributes

union {
   uint32   fcc
 
   char   fcc_txt [4]
 
}; 
 
uint32 size
 
struct adt_MH2O::adt_LIQUID liquid [ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]
 

Detailed Description

Member Function Documentation

◆ GetLiquidAttributes()

adt_liquid_attributes adt_MH2O::GetLiquidAttributes ( int32  x,
int32  y 
) const
inline
242 {
243 if (liquid[x][y].used)
244 {
245 if (liquid[x][y].OffsetAttributes)
246 return *((adt_liquid_attributes *)((uint8*)this + 8 + liquid[x][y].OffsetAttributes));
247 return { 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF };
248 }
249 return { 0, 0 };
250 }
std::uint8_t uint8
Definition: Define.h:109
Definition: adt.h:207
struct adt_MH2O::adt_LIQUID liquid[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]
uint32 OffsetAttributes
Definition: adt.h:229

References liquid, and adt_MH2O::adt_LIQUID::OffsetAttributes.

Referenced by ConvertADT().

◆ GetLiquidDepth()

int8 adt_MH2O::GetLiquidDepth ( adt_liquid_instance const *  h,
int32  pos 
) const
inline
280 {
281 if (!h->OffsetVertexData)
282 return -1;
283
284 switch (h->LiquidVertexFormat)
285 {
286 case LiquidVertexFormatType::HeightDepth:
287 return ((int8 const*)((int8 const*)this + 8 + h->OffsetVertexData + (h->GetWidth() + 1) * (h->GetHeight() + 1) * 4))[pos];
288 case LiquidVertexFormatType::HeightTextureCoord:
289 return 0;
290 case LiquidVertexFormatType::Depth:
291 return ((int8 const*)((uint8*)this + 8 + h->OffsetVertexData))[pos];
292 default:
293 break;
294 }
295 return 0;
296 }
std::int8_t int8
Definition: Define.h:105

References adt_liquid_instance::GetHeight(), adt_liquid_instance::GetWidth(), adt_liquid_instance::LiquidVertexFormat, and adt_liquid_instance::OffsetVertexData.

◆ GetLiquidExistsBitmap()

uint64 adt_MH2O::GetLiquidExistsBitmap ( adt_liquid_instance const *  h) const
inline
317 {
318 if (h->OffsetExistsBitmap)
319 return *((uint64 *)((uint8*)this + 8 + h->OffsetExistsBitmap));
320 else
321 return 0xFFFFFFFFFFFFFFFFuLL;
322 }
std::uint64_t uint64
Definition: Define.h:106

References adt_liquid_instance::OffsetExistsBitmap.

Referenced by ConvertADT().

◆ GetLiquidHeight()

float adt_MH2O::GetLiquidHeight ( adt_liquid_instance const *  h,
int32  pos 
) const
inline
261 {
262 if (!h->OffsetVertexData)
263 return 0.0f;
264
265 switch (h->LiquidVertexFormat)
266 {
267 case LiquidVertexFormatType::HeightDepth:
268 case LiquidVertexFormatType::HeightTextureCoord:
269 return ((float const*)((uint8*)this + 8 + h->OffsetVertexData))[pos];
270 case LiquidVertexFormatType::Depth:
271 return 0.0f;
272 default:
273 break;
274 }
275
276 return 0.0f;
277 }

References adt_liquid_instance::LiquidVertexFormat, and adt_liquid_instance::OffsetVertexData.

Referenced by ConvertADT().

◆ GetLiquidInstance()

adt_liquid_instance const * adt_MH2O::GetLiquidInstance ( int32  x,
int32  y 
) const
inline
235 {
236 if (liquid[x][y].used && liquid[x][y].OffsetInstances)
237 return (adt_liquid_instance *)((uint8*)this + 8 + liquid[x][y].OffsetInstances);
238 return nullptr;
239 }
Definition: adt.h:188

References liquid.

Referenced by ConvertADT().

◆ GetLiquidTextureCoordMap()

uint16 const * adt_MH2O::GetLiquidTextureCoordMap ( adt_liquid_instance const *  h,
int32  pos 
) const
inline
299 {
300 if (!h->OffsetVertexData)
301 return nullptr;
302
303 switch (h->LiquidVertexFormat)
304 {
305 case LiquidVertexFormatType::HeightDepth:
306 case LiquidVertexFormatType::Depth:
307 return nullptr;
308 case LiquidVertexFormatType::HeightTextureCoord:
309 return (uint16 const*)((uint8 const*)this + 8 + h->OffsetVertexData + 4 * ((h->GetWidth() + 1) * (h->GetHeight() + 1) + pos));
310 default:
311 break;
312 }
313 return nullptr;
314 }
std::uint16_t uint16
Definition: Define.h:108

References adt_liquid_instance::GetHeight(), adt_liquid_instance::GetWidth(), adt_liquid_instance::LiquidVertexFormat, and adt_liquid_instance::OffsetVertexData.

◆ GetLiquidType()

uint16 adt_MH2O::GetLiquidType ( adt_liquid_instance const *  h) const
inline
253 {
254 if (h->LiquidVertexFormat == LiquidVertexFormatType::Depth)
255 return 2;
256
257 return h->LiquidType;
258 }

References adt_liquid_instance::LiquidType, and adt_liquid_instance::LiquidVertexFormat.

◆ prepareLoadedData()

bool adt_MH2O::prepareLoadedData ( )
116{
117 if (fcc != MH2OMagic.fcc)
118 return false;
119
120 // Check liquid data
121 // for (int i=0; i<ADT_CELLS_PER_GRID;i++)
122 // for (int j=0; j<ADT_CELLS_PER_GRID;j++)
123
124 return true;
125}
u_map_fcc MH2OMagic
Definition: adt.cpp:28
uint32 fcc
Definition: adt.h:220
uint32 fcc
Definition: loadlib.h:29

References fcc, u_map_fcc::fcc, and MH2OMagic.

Member Data Documentation

◆ 

union { ... } adt_MH2O::@382

◆ fcc

uint32 adt_MH2O::fcc

Referenced by prepareLoadedData().

◆ fcc_txt

char adt_MH2O::fcc_txt[4]

◆ liquid

◆ size

uint32 adt_MH2O::size