* fixed crashes without SCP databases
* minor fixes
This commit is contained in:
parent
3fbca9faf8
commit
926a7566c8
@ -56,7 +56,7 @@ void DrawObject::_Init(void)
|
||||
SCPDatabase *cdi = _instance->dbmgr.GetDB("creaturedisplayinfo");
|
||||
SCPDatabase *cmd = _instance->dbmgr.GetDB("creaturemodeldata");
|
||||
uint32 modelid = cdi && displayid ? cdi->GetUint32(displayid,"model") : 0;
|
||||
modelfile = std::string("data/model/") + cmd->GetString(modelid,"file");
|
||||
modelfile = std::string("data/model/") + (cmd ? cmd->GetString(modelid,"file") : "");
|
||||
opacity = cdi && displayid ? cdi->GetUint32(displayid,"opacity") : 255;
|
||||
}
|
||||
else if (_obj->IsGameObject())
|
||||
@ -80,8 +80,7 @@ void DrawObject::_Init(void)
|
||||
SCPDatabase *gdi = _instance->dbmgr.GetDB("gameobjectdisplayinfo");
|
||||
if (gdi && displayid)
|
||||
modelfile = std::string("data/model/") + gdi->GetString(displayid,"model");
|
||||
std::string test = gdi->GetString(displayid,"model");
|
||||
DEBUG(logdebug("GAMEOBJECT: %u - %u - %s", _obj->GetEntry(), displayid, test.c_str()));
|
||||
DEBUG(logdebug("GAMEOBJECT: %u - %u", _obj->GetEntry(), displayid));
|
||||
} else {
|
||||
DEBUG(logdebug("GAMEOBJECT UNKNOWN: %u", _obj->GetEntry()));
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ inline irr::core::vector3df WPToIrr(WorldPosition wp)
|
||||
|
||||
inline WorldPosition IrrToWP(irr::core::vector3df v, float o_rad)
|
||||
{
|
||||
return WorldPosition(-v.X, v.Z, -v.Y, RAD_FIX(IRR_TO_O(o_rad))); // rotate by 90° and fix value
|
||||
return WorldPosition(-v.X, -v.Z, v.Y, IRR_TO_O(o_rad)); // rotate by 90° and fix value
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ u32 SImage::getBitsPerPixelFromFormat(ECOLOR_FORMAT format)
|
||||
}
|
||||
SImage::~SImage()
|
||||
{
|
||||
if (Data)
|
||||
delete Data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -369,7 +369,7 @@ void SceneWorld::UpdateTerrain(void)
|
||||
{
|
||||
logdebug("SceneWorld: Using alternative coords due to missing MapTile");
|
||||
tpos.X = -(maptile->GetBaseX() + TILESIZE);
|
||||
tpos.Y = -(maptile->GetBaseY() + TILESIZE);
|
||||
tpos.Z = -(maptile->GetBaseY() + TILESIZE);
|
||||
}
|
||||
logdebug("SceneWorld: Setting position of terrain (x:%.2f y:%.2f z:%.2f)", tpos.X, tpos.Y, tpos.Z);
|
||||
terrain->setPosition(tpos);
|
||||
@ -421,8 +421,19 @@ void SceneWorld::UpdateTerrain(void)
|
||||
// this is causing the framerate to drop to ~1. better leave it disabled for now :/
|
||||
//doodad->addShadowVolumeSceneNode();
|
||||
doodad->setPosition(core::vector3df(-d->x, d->z, -d->y));
|
||||
doodad->setRotation(core::vector3df(-d->ox, -d->oy-90, -d->oz));
|
||||
|
||||
// Rotation problems
|
||||
// MapTile.cpp - changed to
|
||||
// d.ox = mddf.c; d.oy = mddf.b; d.oz = mddf.a;
|
||||
// its nonsense to do d.oy = mddf.b-90; and rotation with -d->oy-90 = -(mddf.b-90)-90 = -mddf.b
|
||||
// here:
|
||||
// doodad->setRotation(core::vector3df(-d->ox,0,-d->oz)); // rotated axes looks good
|
||||
// doodad->setRotation(core::vector3df(0,-d->oy,0)); // same here
|
||||
doodad->setRotation(core::vector3df(-d->ox,-d->oy,-d->oz)); // very ugly with some rotations, |ang|>360?
|
||||
|
||||
doodad->setScale(core::vector3df(d->scale, d->scale, d->scale));
|
||||
|
||||
// smgr->addTextSceneNode(this->device->getGUIEnvironment()->getBuiltInFont(), (irr::core::stringw(L"")+(float)d->uniqueid).c_str() , irr::video::SColor(255,255,255,255),doodad, irr::core::vector3df(0,5,0));
|
||||
SceneNodeWithGridPos gp;
|
||||
gp.gx = mapmgr->GetGridX() + tilex - 1;
|
||||
gp.gy = mapmgr->GetGridY() + tiley - 1;
|
||||
|
||||
@ -585,6 +585,7 @@ void WorldSession::_HandleCharEnumOpcode(WorldPacket& recvPacket)
|
||||
*mapdb = GetDBMgr().GetDB("map"),
|
||||
*classdb = GetDBMgr().GetDB("class");
|
||||
char *zonename, *racename, *mapname, *classname;
|
||||
zonename = racename = mapname = classname = NULL;
|
||||
|
||||
for(unsigned int i=0;i<num;i++)
|
||||
{
|
||||
|
||||
@ -53,7 +53,7 @@ void MapTile::ImportFromADT(ADTFile *adt)
|
||||
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]));
|
||||
_chunks[ch].texlayer.push_back(std::string("data/texture/") + NormalizeFilename(std::string(adt->_textures[texoffs])).c_str());
|
||||
}
|
||||
// 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
|
||||
@ -80,8 +80,8 @@ void MapTile::ImportFromADT(ADTFile *adt)
|
||||
d.z = mddf.y;
|
||||
d.x = -(mddf.z - ZEROPOINT);
|
||||
d.ox = mddf.c;
|
||||
d.oy = mddf.b - 90.0f; // wowdev states Y=B-90, but this doesnt really look as expected...
|
||||
d.oz = -mddf.a;
|
||||
d.oy = mddf.b;
|
||||
d.oz = mddf.a;
|
||||
d.flags = mddf.flags;
|
||||
d.uniqueid = mddf.uniqueid;
|
||||
d.model = std::string("./data/model/") + NormalizeFilename(_PathToFileName(adt->_models[mddf.id]));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user