TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
wmo.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 WMO_H
20 #define WMO_H
21 #define TILESIZE (533.33333f)
22 #define CHUNKSIZE ((TILESIZE) / 16.0f)
23 
24 #include <string>
25 #include <set>
26 #include "vec3d.h"
27 #include "mpqfile.h"
28 
29 // MOPY flags
30 #define WMO_MATERIAL_NOCAMCOLLIDE 0x01
31 #define WMO_MATERIAL_DETAIL 0x02
32 #define WMO_MATERIAL_NO_COLLISION 0x04
33 #define WMO_MATERIAL_HINT 0x08
34 #define WMO_MATERIAL_RENDER 0x10
35 #define WMO_MATERIAL_COLLIDE_HIT 0x20
36 #define WMO_MATERIAL_WALL_SURFACE 0x40
37 
38 class WMOInstance;
39 class WMOManager;
40 class MPQFile;
41 
42 /* for whatever reason a certain company just can't stick to one coordinate system... */
43 static inline Vec3D fixCoords(const Vec3D &v){ return Vec3D(v.z, v.x, v.y); }
44 
45 class WMORoot
46 {
47 private:
48  std::string filename;
49 public:
50  unsigned int col;
52  float bbcorn1[3];
53  float bbcorn2[3];
54 
55  WMORoot(std::string& filename);
56 
57  bool open();
58  bool ConvertToVMAPRootWmo(FILE* output);
59 };
60 
62 {
64  float pos_x;
65  float pos_y;
66  float pos_z;
67  short type;
68 };
69 
70 #pragma pack(push, 1)
71 
73 {
76  float height;
77 };
78 
79 #pragma pack(pop)
80 
81 class WMOGroup
82 {
83 private:
84  std::string filename;
85 public:
86  // MOGP
87 
88  char* MOPY;
91  float* MOVT;
93  int* MobaEx;
96  char* LiquBytes;
98  int mogpFlags;
99  float bbcorn1[3];
100  float bbcorn2[3];
106 
109  unsigned int nVertices; // number when loaded
110  int nTriangles; // number when loaded
112 
113  WMOGroup(std::string const& filename);
114  ~WMOGroup();
115 
116  bool open();
117  int ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool preciseVectorData);
118 };
119 
121 {
122  static std::set<int> ids;
123 public:
124  std::string MapName;
125  int currx;
126  int curry;
132 
133  WMOInstance(MPQFile&f , char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
134 
135  static void reset();
136 };
137 
138 #endif
int * MobaEx
Definition: wmo.h:93
int groupName
Definition: wmo.h:97
float x
Definition: vec3d.h:28
uint32 indx
Definition: wmo.h:131
int currx
Definition: wmo.h:125
int ytiles
Definition: wmo.h:63
int mopy_size
Definition: wmo.h:107
Definition: wmo.h:81
static void reset()
uint32 groupWMOID
Definition: wmo.h:105
int descGroupName
Definition: wmo.h:97
float pos_z
Definition: wmo.h:66
uint32 nLights
Definition: wmo.h:51
uint16 * MOVI
Definition: wmo.h:89
float height
Definition: wmo.h:76
static std::set< int > ids
Definition: wmo.h:122
uint16 unk1
Definition: wmo.h:74
uint16 nBatchA
Definition: wmo.h:103
~WMOGroup()
Definition: wmo.cpp:477
uint16 moprNItems
Definition: wmo.h:102
Definition: wmo.h:72
WMOGroup(std::string const &filename)
Definition: wmo.cpp:141
Vec3D pos2
Definition: wmo.h:130
float bbcorn2[3]
Definition: wmo.h:100
float bbcorn1[3]
Definition: wmo.h:52
uint32 d3
Definition: wmo.h:131
char * MOPY
Definition: wmo.h:88
uint16 nBatchB
Definition: wmo.h:104
float pos_y
Definition: wmo.h:65
#define output
Definition: wire_format_lite.h:381
static Vec3D fixCoords(const Vec3D &v)
Definition: wmo.h:43
uint32 liquidType
Definition: wmo.h:105
uint32 d2
Definition: wmo.h:131
Definition: mpqfile.h:32
std::string MapName
Definition: wmo.h:124
uint32 nGroups
Definition: wmo.h:51
int yverts
Definition: wmo.h:63
float bbcorn2[3]
Definition: wmo.h:53
bool open()
Definition: wmo.cpp:44
float pos_x
Definition: wmo.h:64
uint32 nTextures
Definition: wmo.h:51
WMOGroup * wmo
Definition: wmo.h:127
WMOInstance(MPQFile &f, char const *WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
Definition: wmo.cpp:488
WMOLiquidVert * LiquEx
Definition: wmo.h:95
uint32 id
Definition: wmo.h:131
uint16 * MoviEx
Definition: wmo.h:90
unsigned int col
Definition: wmo.h:50
int curry
Definition: wmo.h:126
uint32 RootWMOID
Definition: wmo.h:51
uint16 moprIdx
Definition: wmo.h:101
int ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool preciseVectorData)
Definition: wmo.cpp:248
uint32 nDoodadSets
Definition: wmo.h:51
uint32 nModels
Definition: wmo.h:51
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
int doodadset
Definition: wmo.h:128
std::string filename
Definition: wmo.h:48
char * LiquBytes
Definition: wmo.h:96
int nTriangles
Definition: wmo.h:110
WMOLiquidHeader * hlq
Definition: wmo.h:94
WMORoot(std::string &filename)
Definition: wmo.cpp:34
bool open()
Definition: wmo.cpp:152
bool ConvertToVMAPRootWmo(FILE *output)
Definition: wmo.cpp:129
float z
Definition: vec3d.h:28
int LiquEx_size
Definition: wmo.h:108
uint32 liquidType
Definition: wmo.h:51
float bbcorn1[3]
Definition: wmo.h:99
unsigned int nVertices
Definition: wmo.h:109
uint32 liquflags
Definition: wmo.h:111
uint32 nDoodads
Definition: wmo.h:51
Vec3D pos3
Definition: wmo.h:130
Definition: wmo.h:120
int xtiles
Definition: wmo.h:63
float y
Definition: vec3d.h:28
std::string filename
Definition: wmo.h:84
short type
Definition: wmo.h:67
Definition: wmo.h:45
Vec3D pos
Definition: wmo.h:129
float * MOVT
Definition: wmo.h:91
uint32 nBatchC
Definition: wmo.h:105
Definition: vec3d.h:25
int mogpFlags
Definition: wmo.h:98
uint32 fogIdx
Definition: wmo.h:105
int moba_size
Definition: wmo.h:107
Definition: wmo.h:61
uint32 nP
Definition: wmo.h:51
uint16 * MOBA
Definition: wmo.h:92
uint16 unk2
Definition: wmo.h:75
Vec3D rot
Definition: wmo.h:130
bool preciseVectorData
Definition: vmapexport.cpp:76
int xverts
Definition: wmo.h:63