[mq]: vm3

--HG--
branch : trunk
This commit is contained in:
Brian
2010-07-09 04:02:26 -06:00
parent 948e86ef17
commit 70a31424f8
11 changed files with 165 additions and 102 deletions
@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by the
* the Free Software Foundation; either version 2 of the License, or * Free Software Foundation; either version 2 of the License, or (at your
* (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT
* but WITHOUT ANY WARRANTY; without even the implied warranty of * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* GNU General Public License for more details. * more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <iostream> #include <iostream>
@@ -57,7 +57,7 @@ namespace VMAP
Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const
{ {
Vector3 pos; Vector3 pos;
const float mid = 0.5 * 64.0 * 533.33333333f; const float mid = 0.5f * 64.0f * 533.33333333f;
pos.x = mid - x; pos.x = mid - x;
pos.y = mid - y; pos.y = mid - y;
pos.z = z; pos.z = z;
@@ -70,7 +70,7 @@ namespace VMAP
Vector3 VMapManager2::convertPositionToMangosRep(float x, float y, float z) const Vector3 VMapManager2::convertPositionToMangosRep(float x, float y, float z) const
{ {
Vector3 pos; Vector3 pos;
const float mid = 0.5 * 64.0 * 533.33333333f; const float mid = 0.5f * 64.0f * 533.33333333f;
pos.x = mid - x; pos.x = mid - x;
pos.y = mid - y; pos.y = mid - y;
pos.z = z; pos.z = z;
@@ -301,11 +301,11 @@ namespace VMAP
WorldModel *worldmodel = new WorldModel(); WorldModel *worldmodel = new WorldModel();
if (!worldmodel->readFile(basepath + filename + ".vmo")) if (!worldmodel->readFile(basepath + filename + ".vmo"))
{ {
sLog.outError("VMapManager2: could not load '%s%s.vmo'!", basepath.c_str(), filename.c_str()); sLog.outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
delete worldmodel; delete worldmodel;
return NULL; return NULL;
} }
sLog.outDebug("VMapManager2: loading file '%s%s'.", basepath.c_str(), filename.c_str()); sLog.outDebug("VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str());
model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first; model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first;
model->second.setModel(worldmodel); model->second.setModel(worldmodel);
} }
@@ -318,7 +318,7 @@ namespace VMAP
ModelFileMap::iterator model = iLoadedModelFiles.find(filename); ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end()) if (model == iLoadedModelFiles.end())
{ {
sLog.outError("VMapManager2: trying to unload non-loaded file '%s'!", filename.c_str()); sLog.outError("VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
return; return;
} }
if( model->second.decRefCount() == 0) if( model->second.decRefCount() == 0)
+37 -27
View File
@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by the
* the Free Software Foundation; either version 2 of the License, or * Free Software Foundation; either version 2 of the License, or (at your
* (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT
* but WITHOUT ANY WARRANTY; without even the implied warranty of * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* GNU General Public License for more details. * more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "MapTree.h" #include "MapTree.h"
@@ -57,7 +57,7 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry) void operator()(const Vector3& point, uint32 entry)
{ {
#ifdef VMAP_DEBUG #ifdef VMAP_DEBUG
sLog.outDebug("trying to intersect '%s'", prims[entry].name.c_str()); sLog.outDebug("AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
#endif #endif
prims[entry].intersectPoint(point, aInfo); prims[entry].intersectPoint(point, aInfo);
} }
@@ -73,7 +73,7 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry) void operator()(const Vector3& point, uint32 entry)
{ {
#ifdef VMAP_DEBUG #ifdef VMAP_DEBUG
sLog.outDebug("trying to intersect '%s'", prims[entry].name.c_str()); sLog.outDebug("LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
#endif #endif
if (prims[entry].GetLocationInfo(point, locInfo)) if (prims[entry].GetLocationInfo(point, locInfo))
result = true; result = true;
@@ -121,7 +121,7 @@ namespace VMAP
} }
StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath): StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath):
iMapID(mapID), /* iTree(0), */ iTreeValues(0), iBasePath(basePath) iMapID(mapID), iTreeValues(0), iBasePath(basePath)
{ {
if (iBasePath.length() > 0 && (iBasePath[iBasePath.length()-1] != '/' || iBasePath[iBasePath.length()-1] != '\\')) if (iBasePath.length() > 0 && (iBasePath[iBasePath.length()-1] != '/' || iBasePath[iBasePath.length()-1] != '\\'))
{ {
@@ -260,7 +260,11 @@ namespace VMAP
if (!tf) if (!tf)
success = false; success = false;
else else
{
if (!readChunk(tf, chunk, VMAP_MAGIC, 8))
success = false;
fclose(tf); fclose(tf);
}
} }
fclose(rf); fclose(rf);
return success; return success;
@@ -270,7 +274,7 @@ namespace VMAP
bool StaticMapTree::InitMap(const std::string &fname, VMapManager2 *vm) bool StaticMapTree::InitMap(const std::string &fname, VMapManager2 *vm)
{ {
sLog.outDebug("Initializing StaticMapTree '%s'", fname.c_str()); sLog.outDebug("StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str());
bool success = true; bool success = true;
std::string fullname = iBasePath + fname; std::string fullname = iBasePath + fname;
FILE *rf = fopen(fullname.c_str(), "rb"); FILE *rf = fopen(fullname.c_str(), "rb");
@@ -298,12 +302,12 @@ namespace VMAP
// only non-tiled maps have them, and if so exactly one (so far at least...) // only non-tiled maps have them, and if so exactly one (so far at least...)
ModelSpawn spawn; ModelSpawn spawn;
#ifdef VMAP_DEBUG #ifdef VMAP_DEBUG
sLog.outDebug("Map isTiled: %u", static_cast<uint32>(iIsTiled)); sLog.outDebug("StaticMapTree::InitMap() : map isTiled: %u", static_cast<uint32>(iIsTiled));
#endif #endif
if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn))
{ {
WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name); WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name);
sLog.outDebug("StaticMapTree::InitMap(): loading %s", spawn.name.c_str()); sLog.outDebug("StaticMapTree::InitMap() : loading %s", spawn.name.c_str());
if (model) if (model)
{ {
// assume that global model always is the first and only tree value (could be improved...) // assume that global model always is the first and only tree value (could be improved...)
@@ -313,7 +317,7 @@ namespace VMAP
else else
{ {
success = false; success = false;
sLog.outError("Could not acquire WorldModel pointer!"); sLog.outError("StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str());
} }
} }
@@ -349,7 +353,7 @@ namespace VMAP
} }
if (!iTreeValues) if (!iTreeValues)
{ {
sLog.outError("Tree has not been initialized! [%u,%u]", tileX, tileY); sLog.outError("StaticMapTree::LoadMapTile() : tree has not been initialized [%u,%u]", tileX, tileY);
return false; return false;
} }
bool result = true; bool result = true;
@@ -358,8 +362,12 @@ namespace VMAP
FILE* tf = fopen(tilefile.c_str(), "rb"); FILE* tf = fopen(tilefile.c_str(), "rb");
if (tf) if (tf)
{ {
char chunk[8];
if (!readChunk(tf, chunk, VMAP_MAGIC, 8))
result = false;
uint32 numSpawns; uint32 numSpawns;
if (fread(&numSpawns, sizeof(uint32), 1, tf) != 1) if (result && fread(&numSpawns, sizeof(uint32), 1, tf) != 1)
result = false; result = false;
for (uint32 i=0; i<numSpawns && result; ++i) for (uint32 i=0; i<numSpawns && result; ++i)
{ {
@@ -371,7 +379,7 @@ namespace VMAP
// acquire model instance // acquire model instance
WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name); WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name);
if (!model) if (!model)
sLog.outError("error: could not acquire WorldModel pointer! [%u,%u]", tileX, tileY); sLog.outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u,%u]", tileX, tileY);
// update tree // update tree
uint32 referencedVal; uint32 referencedVal;
@@ -382,7 +390,7 @@ namespace VMAP
#ifdef VMAP_DEBUG #ifdef VMAP_DEBUG
if (referencedVal > iNTreeValues) if (referencedVal > iNTreeValues)
{ {
sLog.outDebug("invalid tree element! (%u/%u)", referencedVal, iNTreeValues); sLog.outDebug("StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues);
continue; continue;
} }
#endif #endif
@@ -394,9 +402,9 @@ namespace VMAP
++iLoadedSpawns[referencedVal]; ++iLoadedSpawns[referencedVal];
#ifdef VMAP_DEBUG #ifdef VMAP_DEBUG
if (iTreeValues[referencedVal].ID != spawn.ID) if (iTreeValues[referencedVal].ID != spawn.ID)
sLog.outDebug("error: trying to load wrong spawn in node!"); sLog.outDebug("StaticMapTree::LoadMapTile() : trying to load wrong spawn in node");
else if (iTreeValues[referencedVal].name != spawn.name) else if (iTreeValues[referencedVal].name != spawn.name)
sLog.outDebug("error: name collision on GUID=%u", spawn.ID); sLog.outDebug("StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID);
#endif #endif
} }
} }
@@ -417,7 +425,7 @@ namespace VMAP
loadedTileMap::iterator tile = iLoadedTiles.find(tileID); loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
if (tile == iLoadedTiles.end()) if (tile == iLoadedTiles.end())
{ {
sLog.outError("WARNING: trying to unload non-loaded tile. Map:%u X:%u Y:%u", iMapID, tileX, tileY); sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
return; return;
} }
if (tile->second) // file associated with tile if (tile->second) // file associated with tile
@@ -427,6 +435,9 @@ namespace VMAP
if (tf) if (tf)
{ {
bool result=true; bool result=true;
char chunk[8];
if (!readChunk(tf, chunk, VMAP_MAGIC, 8))
result = false;
uint32 numSpawns; uint32 numSpawns;
if (fread(&numSpawns, sizeof(uint32), 1, tf) != 1) if (fread(&numSpawns, sizeof(uint32), 1, tf) != 1)
result = false; result = false;
@@ -446,11 +457,10 @@ namespace VMAP
fread(&referencedNode, sizeof(uint32), 1, tf); fread(&referencedNode, sizeof(uint32), 1, tf);
if (!iLoadedSpawns.count(referencedNode)) if (!iLoadedSpawns.count(referencedNode))
{ {
sLog.outError("Trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
} }
else if (--iLoadedSpawns[referencedNode] == 0) else if (--iLoadedSpawns[referencedNode] == 0)
{ {
//std::cout << "MapTree: removing '" << spawn.name << "' from tree\n";
iTreeValues[referencedNode].setUnloaded(); iTreeValues[referencedNode].setUnloaded();
iLoadedSpawns.erase(referencedNode); iLoadedSpawns.erase(referencedNode);
} }
+1
View File
@@ -22,6 +22,7 @@
#include "Define.h" #include "Define.h"
#include "Dynamic/UnorderedMap.h" #include "Dynamic/UnorderedMap.h"
#include "BoundingIntervalHierarchy.h" #include "BoundingIntervalHierarchy.h"
#include "Log.h"
namespace VMAP namespace VMAP
{ {
+15 -13
View File
@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by the
* the Free Software Foundation; either version 2 of the License, or * Free Software Foundation; either version 2 of the License, or (at your
* (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT
* but WITHOUT ANY WARRANTY; without even the implied warranty of * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* GNU General Public License for more details. * more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "WorldModel.h" #include "WorldModel.h"
@@ -82,6 +82,7 @@ namespace VMAP
// build global map tree // build global map tree
std::vector<ModelSpawn*> mapSpawns; std::vector<ModelSpawn*> mapSpawns;
UniqueEntryMap::iterator entry; UniqueEntryMap::iterator entry;
printf("Calculating model bounds for map %u...\n", map_iter->first);
for (entry = map_iter->second->UniqueEntries.begin(); entry != map_iter->second->UniqueEntries.end(); ++entry) for (entry = map_iter->second->UniqueEntries.begin(); entry != map_iter->second->UniqueEntries.end(); ++entry)
{ {
// M2 models don't have a bound set in WDT/ADT placement data, i still think they're not used for LoS at all on retail // M2 models don't have a bound set in WDT/ADT placement data, i still think they're not used for LoS at all on retail
@@ -100,6 +101,7 @@ namespace VMAP
spawnedModelFiles.insert(entry->second.name); spawnedModelFiles.insert(entry->second.name);
} }
printf("Creating map tree...\n", map_iter->first);
BIH pTree; BIH pTree;
pTree.build(mapSpawns, BoundsTrait<ModelSpawn*>::getBounds); pTree.build(mapSpawns, BoundsTrait<ModelSpawn*>::getBounds);
@@ -107,8 +109,6 @@ namespace VMAP
std::map<uint32, uint32> modelNodeIdx; std::map<uint32, uint32> modelNodeIdx;
for (uint32 i=0; i<mapSpawns.size(); ++i) for (uint32 i=0; i<mapSpawns.size(); ++i)
modelNodeIdx.insert(pair<uint32, uint32>(mapSpawns[i]->ID, i)); modelNodeIdx.insert(pair<uint32, uint32>(mapSpawns[i]->ID, i));
if (!modelNodeIdx.empty())
printf("min GUID: %u, max GUID: %u\n", modelNodeIdx.begin()->first, modelNodeIdx.rbegin()->first);
// write map tree file // write map tree file
std::stringstream mapfilename; std::stringstream mapfilename;
@@ -158,6 +158,8 @@ namespace VMAP
StaticMapTree::unpackTileID(tile->first, x, y); StaticMapTree::unpackTileID(tile->first, x, y);
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile"; tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
FILE *tilefile = fopen(tilefilename.str().c_str(), "wb"); FILE *tilefile = fopen(tilefilename.str().c_str(), "wb");
// file header
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) success = false;
// write number of tile spawns // write number of tile spawns
if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) success = false; if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) success = false;
// write tile spawns // write tile spawns
+12 -11
View File
@@ -1,24 +1,25 @@
/* /*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by the
* the Free Software Foundation; either version 2 of the License, or * Free Software Foundation; either version 2 of the License, or (at your
* (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT
* but WITHOUT ANY WARRANTY; without even the implied warranty of * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* GNU General Public License for more details. * more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "ModelInstance.h" #include "ModelInstance.h"
#include "WorldModel.h" #include "WorldModel.h"
#include "MapTree.h" #include "MapTree.h"
#include "VMapDefinitions.h"
using G3D::Vector3; using G3D::Vector3;
using G3D::Ray; using G3D::Ray;
+48 -15
View File
@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by the
* the Free Software Foundation; either version 2 of the License, or * Free Software Foundation; either version 2 of the License, or (at your
* (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT
* but WITHOUT ANY WARRANTY; without even the implied warranty of * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* GNU General Public License for more details. * more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "WorldModel.h" #include "WorldModel.h"
@@ -148,15 +148,48 @@ namespace VMAP
bool WmoLiquid::GetLiquidHeight(const Vector3 &pos, float &liqHeight) const bool WmoLiquid::GetLiquidHeight(const Vector3 &pos, float &liqHeight) const
{ {
uint32 tx = (pos.x - iCorner.x)/LIQUID_TILE_SIZE; float tx_f = (pos.x - iCorner.x)/LIQUID_TILE_SIZE;
uint32 tx = uint32(tx_f);
if (tx<0 || tx >= iTilesX) return false; if (tx<0 || tx >= iTilesX) return false;
uint32 ty = (pos.y - iCorner.y)/LIQUID_TILE_SIZE; float ty_f = (pos.y - iCorner.y)/LIQUID_TILE_SIZE;
uint32 ty = uint32(ty_f);
if (ty<0 || ty >= iTilesY) return false; if (ty<0 || ty >= iTilesY) return false;
// check if tile shall be used for liquid level
// checking for 0x08 *might* be enough, but disabled tiles always are 0x?F: // checking for 0x08 *might* be enough, but disabled tiles always are 0x?F:
if ((iFlags[tx + ty*iTilesX] & 0x0F) == 0x0F) if ((iFlags[tx + ty*iTilesX] & 0x0F) == 0x0F)
return false; return false;
//placeholder...use only lower left corner vertex
liqHeight = /* iCorner.z + */ iHeight[tx + ty*(iTilesX+1)]; // (dx, dy) coordinates inside tile, in [0,1]^2
float dx = tx_f - (float)tx;
float dy = ty_f - (float)ty;
/* Tesselate tile to two triangles (not sure if client does it exactly like this)
^ dy
|
1 x---------x (1,1)
| (b) / |
| / |
| / |
| / (a) |
x---------x---> dx
0 1
*/
const uint32 rowOffset = iTilesX + 1;
if (dx > dy) // case (a)
{
float sx = iHeight[tx+1 + ty * rowOffset] - iHeight[tx + ty * rowOffset];
float sy = iHeight[tx+1 + (ty+1) * rowOffset] - iHeight[tx+1 + ty * rowOffset];
liqHeight = iHeight[tx + ty * rowOffset] + dx * sx + dy * sy;
}
else // case (b)
{
float sx = iHeight[tx+1 + (ty+1) * rowOffset] - iHeight[tx + (ty+1) * rowOffset];
float sy = iHeight[tx + (ty+1) * rowOffset] - iHeight[tx + ty * rowOffset];
liqHeight = iHeight[tx + ty * rowOffset] + dx * sx + dy * sy;
}
return true; return true;
} }
+11 -11
View File
@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2008-YYYY TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by the
* the Free Software Foundation; either version 2 of the License, or * Free Software Foundation; either version 2 of the License, or (at your
* (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT
* but WITHOUT ANY WARRANTY; without even the implied warranty of * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* GNU General Public License for more details. * more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef _VMAPDEFINITIONS_H #ifndef _VMAPDEFINITIONS_H
+3 -3
View File
@@ -177,7 +177,7 @@ EAIErrorLevel = 2
# #
# vmap.enableIndoorCheck # vmap.enableIndoorCheck
# Enable/Disable VMap based indoor check to remove outdoor-only auras (mounts etc.) # Enable/Disable VMap based indoor check to remove outdoor-only auras (mounts etc.)
# Default: 0 (disabled) # Default: 1 (enabled)
# #
# DetectPosCollision # DetectPosCollision
# Check final move position, summon position, etc for visible collision # Check final move position, summon position, etc for visible collision
@@ -244,10 +244,10 @@ PlayerSave.Stats.MinLevel = 0
PlayerSave.Stats.SaveOnlyOnLogout = 1 PlayerSave.Stats.SaveOnlyOnLogout = 1
vmap.enableLOS = 0 vmap.enableLOS = 0
vmap.enableHeight = 0 vmap.enableHeight = 0
vmap.ignoreMapIds = "369" vmap.ignoreMapIds = ""
vmap.ignoreSpellIds = "7720" vmap.ignoreSpellIds = "7720"
vmap.petLOS = 0 vmap.petLOS = 0
vmap.enableIndoorCheck = 0 vmap.enableIndoorCheck = 1
DetectPosCollision = 1 DetectPosCollision = 1
TargetPosRecalculateRange = 1.5 TargetPosRecalculateRange = 1.5
UpdateUptimeInterval = 10 UpdateUptimeInterval = 10
+3 -1
View File
@@ -76,11 +76,13 @@ A '#' at the beginning of a line defines a comment
return(result); return(result);
} */ } */
//======================================================= //=======================================================
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if(argc != 3 && argc != 4) if(argc != 3 && argc != 4)
{ {
printf("\nusage: %s <raw data dir> <vmap dest dir> [config file name]\n", argv[0]); //printf("\nusage: %s <raw data dir> <vmap dest dir> [config file name]\n", argv[0]);
printf("\nusage: %s <raw data dir> <vmap dest dir>\n", argv[0]);
return 1; return 1;
} }
+18 -4
View File
@@ -1,13 +1,27 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DBCFILE_H #ifndef DBCFILE_H
#define DBCFILE_H #define DBCFILE_H
#define __STORMLIB_SELF__
#include <cassert> #include <cassert>
#include <string> #include <string>
//#include "StormLib.h"
#undef min
#undef max
class DBCFile class DBCFile
{ {
public: public:
+1 -1
View File
@@ -435,7 +435,7 @@ bool processArgv(int argc, char ** argv, const char *versionString)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
bool success=true; bool success=true;
const char *versionString = "V2.90 2010_05"; const char *versionString = "V3.00 2010_07";
// Use command line arguments, when some // Use command line arguments, when some
if(!processArgv(argc, argv, versionString)) if(!processArgv(argc, argv, versionString))