refactor(Tools): restyle tools with astyle (#3465)

This commit is contained in:
Kargatum
2020-10-06 16:31:28 +07:00
committed by GitHub
parent be09e03756
commit b00a86f6ab
51 changed files with 1004 additions and 936 deletions

View File

@@ -33,13 +33,14 @@ enum LiquidType
//
class adt_MCVT
{
union{
union
{
uint32 fcc;
char fcc_txt[4];
};
uint32 size;
public:
float height_map[(ADT_CELL_SIZE+1)*(ADT_CELL_SIZE+1)+ADT_CELL_SIZE*ADT_CELL_SIZE];
float height_map[(ADT_CELL_SIZE + 1) * (ADT_CELL_SIZE + 1) + ADT_CELL_SIZE * ADT_CELL_SIZE];
bool prepareLoadedData();
};
@@ -49,7 +50,8 @@ public:
//
class adt_MCLQ
{
union{
union
{
uint32 fcc;
char fcc_txt[4];
};
@@ -57,10 +59,11 @@ public:
uint32 size;
float height1;
float height2;
struct liquid_data{
struct liquid_data
{
uint32 light;
float height;
} liquid[ADT_CELL_SIZE+1][ADT_CELL_SIZE+1];
} liquid[ADT_CELL_SIZE + 1][ADT_CELL_SIZE + 1];
// 1<<0 - ochen
// 1<<1 - lava/slime
@@ -78,7 +81,8 @@ public:
//
class adt_MCNK
{
union{
union
{
uint32 fcc;
char fcc_txt[4];
};
@@ -118,16 +122,16 @@ public:
uint32 effectId;
bool prepareLoadedData();
adt_MCVT *getMCVT()
adt_MCVT* getMCVT()
{
if (offsMCVT)
return (adt_MCVT *)((uint8 *)this + offsMCVT);
return (adt_MCVT*)((uint8*)this + offsMCVT);
return 0;
}
adt_MCLQ *getMCLQ()
adt_MCLQ* getMCLQ()
{
if (offsMCLQ)
return (adt_MCLQ *)((uint8 *)this + offsMCLQ);
return (adt_MCLQ*)((uint8*)this + offsMCLQ);
return 0;
}
};
@@ -137,13 +141,15 @@ public:
//
class adt_MCIN
{
union{
union
{
uint32 fcc;
char fcc_txt[4];
};
public:
uint32 size;
struct adt_CELLS{
struct adt_CELLS
{
uint32 offsMCNK;
uint32 size;
uint32 flags;
@@ -152,10 +158,10 @@ public:
bool prepareLoadedData();
// offset from begin file (used this-84)
adt_MCNK *getMCNK(int x, int y)
adt_MCNK* getMCNK(int x, int y)
{
if (cells[x][y].offsMCNK)
return (adt_MCNK *)((uint8 *)this + cells[x][y].offsMCNK - 84);
return (adt_MCNK*)((uint8*)this + cells[x][y].offsMCNK - 84);
return 0;
}
};
@@ -163,7 +169,8 @@ public:
#define ADT_LIQUID_HEADER_FULL_LIGHT 0x01
#define ADT_LIQUID_HEADER_NO_HIGHT 0x02
struct adt_liquid_header{
struct adt_liquid_header
{
uint16 liquidType; // Index from LiquidType.dbc
uint16 formatFlags;
float heightLevel1;
@@ -182,13 +189,15 @@ struct adt_liquid_header{
class adt_MH2O
{
public:
union{
union
{
uint32 fcc;
char fcc_txt[4];
};
uint32 size;
struct adt_LIQUID{
struct adt_LIQUID
{
uint32 offsData1;
uint32 used;
uint32 offsData2;
@@ -196,52 +205,52 @@ public:
bool prepareLoadedData();
adt_liquid_header *getLiquidData(int x, int y)
adt_liquid_header* getLiquidData(int x, int y)
{
if (liquid[x][y].used && liquid[x][y].offsData1)
return (adt_liquid_header *)((uint8*)this + 8 + liquid[x][y].offsData1);
return (adt_liquid_header*)((uint8*)this + 8 + liquid[x][y].offsData1);
return 0;
}
float *getLiquidHeightMap(adt_liquid_header *h)
float* getLiquidHeightMap(adt_liquid_header* h)
{
if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT)
return 0;
if (h->offsData2b)
return (float *)((uint8*)this + 8 + h->offsData2b);
return (float*)((uint8*)this + 8 + h->offsData2b);
return 0;
}
uint8 *getLiquidLightMap(adt_liquid_header *h)
uint8* getLiquidLightMap(adt_liquid_header* h)
{
if (h->formatFlags&ADT_LIQUID_HEADER_FULL_LIGHT)
if (h->formatFlags & ADT_LIQUID_HEADER_FULL_LIGHT)
return 0;
if (h->offsData2b)
{
if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT)
return (uint8 *)((uint8*)this + 8 + h->offsData2b);
return (uint8 *)((uint8*)this + 8 + h->offsData2b + (h->width+1)*(h->height+1)*4);
return (uint8*)((uint8*)this + 8 + h->offsData2b);
return (uint8*)((uint8*)this + 8 + h->offsData2b + (h->width + 1) * (h->height + 1) * 4);
}
return 0;
}
uint32 *getLiquidFullLightMap(adt_liquid_header *h)
uint32* getLiquidFullLightMap(adt_liquid_header* h)
{
if (!(h->formatFlags&ADT_LIQUID_HEADER_FULL_LIGHT))
if (!(h->formatFlags & ADT_LIQUID_HEADER_FULL_LIGHT))
return 0;
if (h->offsData2b)
{
if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT)
return (uint32 *)((uint8*)this + 8 + h->offsData2b);
return (uint32 *)((uint8*)this + 8 + h->offsData2b + (h->width+1)*(h->height+1)*4);
return (uint32*)((uint8*)this + 8 + h->offsData2b);
return (uint32*)((uint8*)this + 8 + h->offsData2b + (h->width + 1) * (h->height + 1) * 4);
}
return 0;
}
uint64 getLiquidShowMap(adt_liquid_header *h)
uint64 getLiquidShowMap(adt_liquid_header* h)
{
if (h->offsData2a)
return *((uint64 *)((uint8*)this + 8 + h->offsData2a));
return *((uint64*)((uint8*)this + 8 + h->offsData2a));
else
return 0xFFFFFFFFFFFFFFFFuLL;
}
@@ -274,7 +283,8 @@ public:
//
class adt_MHDR
{
union{
union
{
uint32 fcc;
char fcc_txt[4];
};
@@ -317,14 +327,15 @@ public:
}
};
class ADT_file : public FileLoader{
class ADT_file : public FileLoader
{
public:
bool prepareLoadedData();
ADT_file();
~ADT_file();
void free();
adt_MHDR *a_grid;
adt_MHDR* a_grid;
};
#endif