Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
adt.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef ADT_H
7#define ADT_H
8
9#include "loadlib.h"
10
11#define TILESIZE (533.33333f)
12#define CHUNKSIZE ((TILESIZE) / 16.0f)
13#define UNITSIZE (CHUNKSIZE / 8.0f)
14
22
23//**************************************************************************************
24// ADT file class
25//**************************************************************************************
26#define ADT_CELLS_PER_GRID 16
27#define ADT_CELL_SIZE 8
28#define ADT_GRID_SIZE (ADT_CELLS_PER_GRID*ADT_CELL_SIZE)
29
30#pragma pack(push, 1)
31
32//
33// Adt file height map chunk
34//
36{
37 union{
39 char fcc_txt[4];
40 };
42public:
44};
45
46//
47// Adt file liquid map chunk (old)
48//
50{
51 union{
53 char fcc_txt[4];
54 };
56public:
57 float height1;
58 float height2;
63
64 // 1<<0 - ochen
65 // 1<<1 - lava/slime
66 // 1<<2 - water
67 // 1<<6 - all water
68 // 1<<7 - dark water
69 // == 0x0F - not show liquid
72};
73
74//
75// Adt file cell chunk
76//
78{
79 union{
81 char fcc_txt[4];
82 };
84public:
90 union
91 {
92 struct
93 {
94 uint32 offsMCVT; // height map
95 uint32 offsMCNR; // Normal vectors for each vertex
97 uint64 HighResHoles; // TODO: maybe use this?
99 uint32 offsMCLY; // Texture layer definitions
100 uint32 offsMCRF; // A list of indices into the parent file's MDDF chunk
101 uint32 offsMCAL; // Alpha maps for additional texture layers
103 uint32 offsMCSH; // Shadow map for static shadows on the terrain
116 uint32 offsMCLQ; // Liqid level (old)
118 float zpos;
119 float xpos;
120 float ypos;
121 uint32 offsMCCV; // offsColorValues in WotLK
124};
125
126#define ADT_LIQUID_HEADER_FULL_LIGHT 0x01
127#define ADT_LIQUID_HEADER_NO_HIGHT 0x02
128
141
142//
143// Adt file liquid data chunk (new)
144//
146{
147public:
148 union{
150 char fcc_txt[4];
151 };
153
159
161 {
162 if (liquid[x][y].used && liquid[x][y].offsData1)
163 return (adt_liquid_header *)((uint8*)this + 8 + liquid[x][y].offsData1);
164 return 0;
165 }
166
168 {
170 return 0;
171 if (h->offsData2b)
172 return (float *)((uint8*)this + 8 + h->offsData2b);
173 return 0;
174 }
175
177 {
179 return 0;
180 if (h->offsData2b)
181 {
183 return (uint8 *)((uint8*)this + 8 + h->offsData2b);
184 return (uint8 *)((uint8*)this + 8 + h->offsData2b + (h->width+1)*(h->height+1)*4);
185 }
186 return 0;
187 }
188
190 {
192 return 0;
193 if (h->offsData2b)
194 {
196 return (uint32 *)((uint8*)this + 8 + h->offsData2b);
197 return (uint32 *)((uint8*)this + 8 + h->offsData2b + (h->width+1)*(h->height+1)*4);
198 }
199 return 0;
200 }
201
203 {
204 if (h->offsData2a)
205 return *((uint64 *)((uint8*)this + 8 + h->offsData2a));
206 else
207 return 0xFFFFFFFFFFFFFFFFuLL;
208 }
209};
210
211#pragma pack(pop)
212
213#endif
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
std::uint16_t uint16
Definition Define.h:78
#define ADT_LIQUID_HEADER_FULL_LIGHT
Definition adt.h:126
#define ADT_LIQUID_HEADER_NO_HIGHT
Definition adt.h:127
#define ADT_CELL_SIZE
Definition adt.h:27
LiquidType
Definition adt.h:16
@ LIQUID_TYPE_WATER
Definition adt.h:17
@ LIQUID_TYPE_SLIME
Definition adt.h:20
@ LIQUID_TYPE_MAGMA
Definition adt.h:19
@ LIQUID_TYPE_OCEAN
Definition adt.h:18
#define ADT_CELLS_PER_GRID
Definition adt.h:26
Definition adt.h:50
uint32 size
Definition adt.h:55
float height1
Definition adt.h:57
char fcc_txt[4]
Definition adt.h:53
uint8 data[84]
Definition adt.h:71
uint32 fcc
Definition adt.h:52
float height2
Definition adt.h:58
struct adt_MCLQ::liquid_data liquid[ADT_CELL_SIZE+1][ADT_CELL_SIZE+1]
uint8 flags[ADT_CELL_SIZE][ADT_CELL_SIZE]
Definition adt.h:70
Definition adt.h:78
uint32 nEffectDoodad
Definition adt.h:113
uint32 offsMCRF
Definition adt.h:100
uint32 offsMCAL
Definition adt.h:101
uint32 sizeMCLQ
Definition adt.h:117
uint32 offsMCLY
Definition adt.h:99
uint32 offsMCSE
Definition adt.h:114
uint64 HighResHoles
Definition adt.h:97
uint32 nSndEmitters
Definition adt.h:115
union adt_MCNK::@365053364162235155223362363250025005154125047120 union_5_3_0
float zpos
Definition adt.h:118
uint32 data2
Definition adt.h:110
uint32 holes
Definition adt.h:107
uint32 ix
Definition adt.h:86
float xpos
Definition adt.h:119
uint32 props
Definition adt.h:122
uint32 sizeMCSH
Definition adt.h:104
uint32 size
Definition adt.h:83
uint32 offsMCNR
Definition adt.h:95
char fcc_txt[4]
Definition adt.h:81
struct adt_MCNK::@365053364162235155223362363250025005154125047120::@231155030214270125170040150100311170176170073216 offsets
uint32 data1
Definition adt.h:109
uint32 fcc
Definition adt.h:80
uint32 predTex
Definition adt.h:112
uint32 effectId
Definition adt.h:123
uint32 offsMCVT
Definition adt.h:94
uint32 data3
Definition adt.h:111
uint32 nLayers
Definition adt.h:88
uint32 iy
Definition adt.h:87
uint32 sizeMCAL
Definition adt.h:102
uint16 s[2]
Definition adt.h:108
uint32 nMapObjRefs
Definition adt.h:106
uint32 flags
Definition adt.h:85
uint32 nDoodadRefs
Definition adt.h:89
uint32 offsMCSH
Definition adt.h:103
uint32 areaid
Definition adt.h:105
uint32 offsMCLQ
Definition adt.h:116
uint32 offsMCCV
Definition adt.h:121
float ypos
Definition adt.h:120
Definition adt.h:36
float height_map[(ADT_CELL_SIZE+1) *(ADT_CELL_SIZE+1)+ADT_CELL_SIZE *ADT_CELL_SIZE]
Definition adt.h:43
uint32 fcc
Definition adt.h:38
char fcc_txt[4]
Definition adt.h:39
uint32 size
Definition adt.h:41
uint64 getLiquidShowMap(adt_liquid_header *h)
Definition adt.h:202
uint32 size
Definition adt.h:152
adt_liquid_header * getLiquidData(int x, int y)
Definition adt.h:160
uint32 * getLiquidFullLightMap(adt_liquid_header *h)
Definition adt.h:189
char fcc_txt[4]
Definition adt.h:150
uint32 fcc
Definition adt.h:149
uint8 * getLiquidLightMap(adt_liquid_header *h)
Definition adt.h:176
struct adt_MH2O::adt_LIQUID liquid[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]
float * getLiquidHeightMap(adt_liquid_header *h)
Definition adt.h:167
uint32 offsData1
Definition adt.h:155
uint32 offsData2
Definition adt.h:157
uint16 liquidType
Definition adt.h:130
float heightLevel2
Definition adt.h:133
uint16 formatFlags
Definition adt.h:131
uint8 width
Definition adt.h:136
uint32 offsData2a
Definition adt.h:138
float heightLevel1
Definition adt.h:132
uint8 xOffset
Definition adt.h:134
uint8 yOffset
Definition adt.h:135
uint32 offsData2b
Definition adt.h:139
uint8 height
Definition adt.h:137