TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
adtfile.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef ADT_H
20 #define ADT_H
21 
22 #include "mpqfile.h"
23 #include "wmo.h"
24 #include "model.h"
25 
26 #define TILESIZE (533.33333f)
27 #define CHUNKSIZE ((TILESIZE) / 16.0f)
28 #define UNITSIZE (CHUNKSIZE / 8.0f)
29 
30 class Liquid;
31 
32 typedef struct
33 {
34  float x;
35  float y;
36  float z;
37 }svec;
38 
39 struct vec
40 {
41  double x;
42  double y;
43  double z;
44 };
45 
46 struct triangle
47 {
48  vec v[3];
49 };
50 
51 typedef struct
52 {
53  float v9[16*8+1][16*8+1];
54  float v8[16*8][16*8];
55 }Cell;
56 
57 typedef struct
58 {
59  double v9[9][9];
60  double v8[8][8];
62  //Liquid *lq;
63  float waterlevel[9][9];
65 }chunk;
66 
67 typedef struct
68 {
69  chunk ch[16][16];
70 }mcell;
71 
73 {
101  float zpos;
102  float xpos;
103  float ypos;
107 };
108 
109 
110 class ADTFile
111 {
112 private:
113  //size_t mcnk_offsets[256], mcnk_sizes[256];
115  //mcell Mcell;
116  std::string Adtfilename;
117 public:
118  ADTFile(char* filename);
119  ~ADTFile();
120  int nWMO;
121  int nMDX;
122  std::vector<std::string> WmoInstanceNames;
123  std::vector<std::string> ModelInstanceNames;
124  bool init(uint32 map_num, uint32 tileX, uint32 tileY);
125  //void LoadMapChunks();
126 
127  //uint32 wmo_count;
128 /*
129  const mcell& Getmcell() const
130  {
131  return Mcell;
132  }
133 */
134 };
135 
136 char const* GetPlainName(char const* FileName);
137 char* GetPlainName(char* FileName);
138 char* GetExtension(char* FileName);
139 void FixNameCase(char* name, size_t len);
140 void FixNameSpaces(char* name, size_t len);
141 //void fixMapNamen(char *name, size_t len);
142 
143 #endif
float zpos
Definition: adtfile.h:101
float y
Definition: adtfile.h:35
void FixNameSpaces(char *name, size_t len)
Definition: adtfile.cpp:64
uint32 ofsRefs
Definition: adtfile.h:82
uint32 areaid
Definition: adtfile.h:87
Definition: adtfile.h:46
double y
Definition: adtfile.h:42
vec v[3]
Definition: adtfile.h:48
int nMDX
Definition: adtfile.h:121
uint32 ofsLayer
Definition: adtfile.h:81
bool init(uint32 map_num, uint32 tileX, uint32 tileY)
Definition: adtfile.cpp:87
uint32 nSndEmitters
Definition: adtfile.h:98
std::vector< std::string > WmoInstanceNames
Definition: adtfile.h:122
uint32 nDoodadRefs
Definition: adtfile.h:78
uint32 ofsAlpha
Definition: adtfile.h:83
uint32 holes
Definition: adtfile.h:89
~ADTFile()
Definition: adtfile.cpp:203
uint32 ofsNormal
Definition: adtfile.h:80
uint32 predTex
Definition: adtfile.h:95
uint32 sizeAlpha
Definition: adtfile.h:84
uint32 flags
Definition: adtfile.h:74
MPQFile ADT
Definition: adtfile.h:114
uint16 area_id
Definition: adtfile.h:61
uint16 s1
Definition: adtfile.h:90
std::string Adtfilename
Definition: adtfile.h:116
Definition: adtfile.h:110
uint32 ofsLiquid
Definition: adtfile.h:99
Definition: adtfile.h:57
uint32 iy
Definition: adtfile.h:76
char const * GetPlainName(char const *FileName)
Definition: adtfile.cpp:29
void FixNameCase(char *name, size_t len)
Definition: adtfile.cpp:47
Definition: mpqfile.h:32
uint32 nEffectDoodad
Definition: adtfile.h:96
uint32 nLayers
Definition: adtfile.h:77
uint32 ofsHeight
Definition: adtfile.h:79
double z
Definition: adtfile.h:43
std::vector< std::string > ModelInstanceNames
Definition: adtfile.h:123
Definition: adtfile.h:39
uint16 s2
Definition: adtfile.h:91
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
Definition: adtfile.h:67
uint32 ofsSndEmitters
Definition: adtfile.h:97
char * GetExtension(char *FileName)
Definition: adtfile.cpp:73
uint32 effectId
Definition: adtfile.h:106
Definition: Cell.h:49
float x
Definition: adtfile.h:34
uint32 textureId
Definition: adtfile.h:104
uint8 flag
Definition: adtfile.h:64
uint32 ofsShadow
Definition: adtfile.h:85
uint32 props
Definition: adtfile.h:105
float z
Definition: adtfile.h:36
float ypos
Definition: adtfile.h:103
double x
Definition: adtfile.h:41
uint8_t uint8
Definition: Define.h:152
uint32 d3
Definition: adtfile.h:94
uint32 d1
Definition: adtfile.h:92
int nWMO
Definition: adtfile.h:120
uint32 d2
Definition: adtfile.h:93
uint32 sizeLiquid
Definition: adtfile.h:100
ADTFile(char *filename)
Definition: adtfile.cpp:82
uint32 sizeShadow
Definition: adtfile.h:86
float xpos
Definition: adtfile.h:102
Definition: adtfile.h:72
uint32 nMapObjRefs
Definition: adtfile.h:88
Definition: adtfile.h:32
uint32 ix
Definition: adtfile.h:75