aboutsummaryrefslogtreecommitdiff
path: root/contrib/map_extractor/adt.h
blob: 516ed88a86e7a8dd0ddcb66f34a78b8f5c492f35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef ADT_H
#define ADT_H

#define TILESIZE (533.33333f)
#define CHUNKSIZE ((TILESIZE) / 16.0f)
#define UNITSIZE (CHUNKSIZE / 8.0f)

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
class Liquid;
typedef struct
{
    float x;
    float y;
    float z;
} svec;

typedef struct
{
    double x;
    double y;
    double z;
} vec;

typedef struct
{
    vec v[3];
} triangle;

typedef struct
{
    float v9[16 * 8 + 1][16 * 8 + 1];
    float v8[16 * 8][16 * 8];
} Cell;

typedef struct
{
    double v9[9][9];
    double v8[8][8];
    uint16 area_id;
} chunk;

typedef struct
{
    chunk ch[16][16];
} mcell;

struct MapChunkHeader
{
    uint32 flags;
    uint32 ix;
    uint32 iy;
    uint32 nLayers;
    uint32 nDoodadRefs;
    uint32 ofsHeight;
    uint32 ofsNormal;
    uint32 ofsLayer;
    uint32 ofsRefs;
    uint32 ofsAlpha;
    uint32 sizeAlpha;
    uint32 ofsShadow;
    uint32 sizeShadow;
    uint32 areaid;
    uint32 nMapObjRefs;
    uint32 holes;
    uint16 s1;
    uint16 s2;
    uint32 d1;
    uint32 d2;
    uint32 d3;
    uint32 predTex;
    uint32 nEffectDoodad;
    uint32 ofsSndEmitters;
    uint32 nSndEmitters;
    uint32 ofsLiquid;                                       // not use in WotLK
    uint32 sizeLiquid;                                      // not use in WotLK
    float  zpos;
    float  xpos;
    float  ypos;
    uint32 textureId;                                       // new offsColorValues in WotLK
    uint32 props;
    uint32 effectId;
};

typedef struct
{
    uint32 offsData1;
    uint32 used;
    uint32 offsData2;
} MH2O_offsData;

typedef struct
{
    uint16 LiquidTypeId;
    uint16 type;
    float heightLevel1;
    float heightLevel2;
    uint8 xOffset;
    uint8 yOffset;
    uint8 width;
    uint8 height;
    uint32 ofsData2a;
    uint32 ofsData2b;
} MH2O_Data1;

typedef struct
{
    uint16 unk1;
    uint16 unk2;
    float height;
} LiqData;

enum LiquidType
{
    LIQUID_TYPE_WATER = 0,
    LIQUID_TYPE_OCEAN = 1,
    LIQUID_TYPE_MAGMA = 2,
    LIQUID_TYPE_SLIME = 3
};

class MPQFile;

float *MapLiqHeight;
uint8 *MapLiqFlag;
uint32 k, m, chunk_num;
void LoadMapChunk(MPQFile &, chunk*);
#endif