* fixed linker error with Irrlicht7.1.vcproj in release mode

* added adt->maptile texture layers & alpha maps conversion
* added a compiled stuffextract.exe for linux users to use with wine
This commit is contained in:
false_genesis 2008-04-06 00:58:05 +00:00
parent 3f9686eaed
commit b4ece10cb1
6 changed files with 30 additions and 4 deletions

BIN
bin/stuffextract_svn.exe Normal file

Binary file not shown.

View File

@ -83,7 +83,7 @@
Optimization="2"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="FALSE"
AdditionalIncludeDirectories="..\..\include\irrlicht;zlib"
AdditionalIncludeDirectories="..\..\include\irrlicht;..\..\include\DXSDK\include;zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="TRUE"
ExceptionHandling="FALSE"
@ -147,7 +147,7 @@
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="0"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\..\include\irrlicht;zlib"
AdditionalIncludeDirectories="..\..\include\irrlicht;..\..\include\DXSDK\include;zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="TRUE"
ExceptionHandling="FALSE"

View File

@ -210,6 +210,7 @@ bool ADTFile::LoadMem(ByteBuffer& buf)
}
else if(!strcmp((char*)mfcc,"MCAL"))
{
// we can NOT use _chunks[mcnkid].hdr.nLayers here... so we use: (full block size - header size) / single block size
for(uint32 i = 0; i < (_chunks[mcnkid].hdr.sizeAlpha - 8) / 2048; i++)
{
buf.read((uint8*)(_chunks[mcnkid].alphamap[i]),2048);

View File

@ -7,6 +7,8 @@
#define OFFSET_MODELS 8
#define OFFSET_WMOS 10
#define ADT_MAXLAYERS 4
struct MHDR_chunk
{
uint32 pad;
@ -195,10 +197,10 @@ struct ADTMapChunk
ADTMapChunkHeader hdr;
float vertices[145];
NormalVector normalvecs[145];
MCLY_chunk layer[4]; // can be less
MCLY_chunk layer[ADT_MAXLAYERS]; // can be less
uint32 nTextures;
uint8 shadowmap[512]; // 1 bit 64x64
uint8 alphamap[4][2048]; // 4 bits, 64x64. max 4, 1 per layer
uint8 alphamap[ADT_MAXLAYERS][2048]; // 4 bits, 64x64. max 4, 1 per layer
bool haswater;
float waterlevel;
LiquidVertex lqvertex[81];

View File

@ -27,6 +27,7 @@ void MapTile::ImportFromADT(ADTFile *adt)
_chunks[ch].basex = adt->_chunks[ch].hdr.xbase; // here converting it to (x/y) on ground and basehight as actual height.
_chunks[ch].basey = adt->_chunks[ch].hdr.ybase; // strange coords they use... :S
_chunks[ch].lqheight = adt->_chunks[ch].waterlevel;
// extract heightmap
uint32 fcnt=0, rcnt=0;
while(true) //9*9 + 8*8
{
@ -43,14 +44,34 @@ void MapTile::ImportFromADT(ADTFile *adt)
fcnt++;
}
}
// extract water heightmap
for(uint32 i = 0; i < 81; i++)
{
_chunks[ch].hmap_lq[i] = adt->_chunks[ch].lqvertex[i].h;
}
// extract map layers with texture filenames
for(uint32 ly = 0; ly < adt->_chunks[ch].hdr.nLayers; ly++)
{
uint32 texoffs = adt->_chunks[ch].layer[ly].textureId;
_chunks[ch].texlayer.push_back(std::string("data/texture/") + _PathToFileName(adt->_textures[texoffs]));
}
// extract alpha maps. in adt they are stored in 4-bit encoding, which makes 4096 entries in 64x32 values
for(uint32 al = 0; al < (adt->_chunks[ch].hdr.sizeAlpha - 8) / 2048; al++) // see comment in ADTFile.cpp when loading MCAL chunk for explanation
{
for(uint32 aly = 0; aly < 64; aly++)
{
for(uint32 alx = 0; alx < 32; alx++)
{
_chunks[ch].alphamap[al][aly*64 + (alx*2)] = adt->_chunks[ch].alphamap[al][aly*64 + alx] & 0xF0; // first 4 bits
_chunks[ch].alphamap[al][aly*64 + (alx*2)+1] = adt->_chunks[ch].alphamap[al][aly*64 + alx] & 0x0F; // second
}
}
}
}
_xbase = _chunks[0].basex;
_ybase = _chunks[0].basey;
_hbase = _chunks[0].baseheight;
DEBUG(logdebug("MapTile first chunk base: h=%f x=%f y=%f",_hbase,_xbase,_ybase));
}

View File

@ -20,6 +20,8 @@ public:
float hmap[17*17]; // combined rough and fine hmap
float basex,basey,baseheight,lqheight;
float hmap_lq[9*9]; // liquid (water, lava) height map
std::vector<std::string> texlayer;
uint8 alphamap[ADT_MAXLAYERS][64*64]; // TODO: make this a vector also
//... TODO: implement the rest of this
};