* show player corpse bones instead of cubes. requires re-extracting model data. patch by bLuma, thx
* return flags when returning files with MemoryDataHolder. this is a preparation for better threading and less crashes with it. * enable stuffextract build in vc90 solution
This commit is contained in:
parent
08a1645599
commit
905c08cf17
@ -1,5 +1,5 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PseuWoW", "src\PseuWoW_VC90.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||
@ -121,16 +121,25 @@ Global
|
||||
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Static lib - Release|Win32.ActiveCfg = Release|Win32
|
||||
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Static lib - Release|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Relase - Fast FPU|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release - Fast FPU|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release - Fast FPU|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release - No console|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release - No console|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release noconsole|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release noconsole|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Release|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Static lib - Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Static lib - Debug|Win32.Build.0 = Debug|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Static lib - Release - Fast FPU|Win32.Build.0 = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Static lib - Release|Win32.ActiveCfg = Release|Win32
|
||||
{F14CA928-E505-41F1-BE45-CCF6B85547D2}.Static lib - Release|Win32.Build.0 = Release|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
|
||||
|
||||
@ -61,6 +61,21 @@ void DrawObject::_Init(void)
|
||||
texture = std::string("data/texture/") + cdi->GetString(displayid,"name1");
|
||||
opacity = cdi && displayid ? cdi->GetUint32(displayid,"opacity") : 255;
|
||||
}
|
||||
else if (_obj->IsCorpse())
|
||||
{
|
||||
uint8 race = (_obj->GetUInt32Value(CORPSE_FIELD_BYTES_1) >> 8)&0xFF;
|
||||
uint8 gender = (_obj->GetUInt32Value(CORPSE_FIELD_BYTES_1) >> 16)&0xFF;
|
||||
std::string racename = "", gendername = "";
|
||||
|
||||
SCPDatabase *scprace = _instance->dbmgr.GetDB("race");
|
||||
SCPDatabase *scpgender = _instance->dbmgr.GetDB("gender");
|
||||
if (scprace)
|
||||
racename = scprace->GetString(race, "name_general");
|
||||
if (scpgender)
|
||||
gendername = scpgender->GetString(gender, "name");
|
||||
|
||||
modelfile = std::string("data/model/") + racename + gendername + "DeathSkeleton.m2";
|
||||
}
|
||||
else if (_obj->IsGameObject())
|
||||
{
|
||||
GameobjectTemplate* gotempl = _instance->GetWSession()->objmgr.GetGOTemplate(_obj->GetEntry());
|
||||
@ -153,7 +168,7 @@ void DrawObject::Draw(void)
|
||||
|
||||
//cube->setRotation(irr::core::vector3df(0,RAD_TO_DEG(((WorldObject*)_obj)->GetO()),0));
|
||||
irr::core::stringw tmp = L"";
|
||||
if(_obj->GetName().empty())
|
||||
if(_obj->GetName().empty() && !_obj->IsCorpse())
|
||||
{
|
||||
tmp += L"unk<";
|
||||
tmp += _obj->GetTypeId();
|
||||
|
||||
@ -29,11 +29,11 @@ namespace io
|
||||
|
||||
IReadFile * IrrCreateIReadFileBasic(irr::IrrlichtDevice *device, std::string fn)
|
||||
{
|
||||
MemoryDataHolder::memblock mb = MemoryDataHolder::GetFileBasic(fn);
|
||||
if(!mb.ptr)
|
||||
MemoryDataHolder::MemoryDataResult mdr = MemoryDataHolder::GetFileBasic(fn);
|
||||
if( !(mdr.data.ptr && mdr.flags & MemoryDataHolder::MDH_FILE_OK) )
|
||||
return NULL;
|
||||
|
||||
return new CMDHReadFile(mb.ptr, mb.size, fn.c_str());
|
||||
return new CMDHReadFile(mdr.data.ptr, mdr.data.size, fn.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -148,7 +148,7 @@ namespace MemoryDataHolder
|
||||
};
|
||||
|
||||
|
||||
memblock GetFile(std::string s, bool threaded, callback_func func, void *ptr, ZThread::Condition *cond, bool ref_counted)
|
||||
MemoryDataResult GetFile(std::string s, bool threaded, callback_func func, void *ptr, ZThread::Condition *cond, bool ref_counted)
|
||||
{
|
||||
mutex.acquire(); // we need exclusive access, other threads might unload the requested file during checking
|
||||
|
||||
@ -177,12 +177,13 @@ namespace MemoryDataHolder
|
||||
// the file was requested some other time, is still present in memory and the pointer can simply be returned...
|
||||
mutex.release(); // everything ok, mutex can be unloaded safely
|
||||
// execute callback and broadcast condition (must check for MDH_FILE_ALREADY_EXIST in callback func)
|
||||
uint32 rf = MDH_FILE_OK | MDH_FILE_ALREADY_EXIST;
|
||||
if(func)
|
||||
(*func)(ptr, s, MDH_FILE_OK | MDH_FILE_ALREADY_EXIST);
|
||||
(*func)(ptr, s, rf);
|
||||
if(cond)
|
||||
cond->broadcast();
|
||||
|
||||
return *mb;
|
||||
return MemoryDataResult(*mb, rf);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -194,7 +195,9 @@ namespace MemoryDataHolder
|
||||
ldr = loaders.Get(s);
|
||||
ldr->SetStores(&storage,&loaders);
|
||||
ldr->AddCallback(func,ptr,cond); // not threadsafe!
|
||||
|
||||
mutex.release(); // the mutex can be released safely now
|
||||
|
||||
ldr->SetThreaded(threaded);
|
||||
ldr->SetName(s); // here we set the filename the thread should load
|
||||
|
||||
@ -202,7 +205,6 @@ namespace MemoryDataHolder
|
||||
{
|
||||
ZThread::Task task(ldr);
|
||||
executor->execute(task);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -210,7 +212,10 @@ namespace MemoryDataHolder
|
||||
delete ldr;
|
||||
memblock *mbret = storage.GetNoCreate(s);
|
||||
DEBUG(logdev("Non-threaded loader returning memblock at 0x%X",mbret));
|
||||
return mbret ? *mbret : memblock();
|
||||
uint32 rf = MDH_FILE_JUST_LOADED;
|
||||
if(mbret)
|
||||
rf |= MDH_FILE_OK;
|
||||
return MemoryDataResult(mbret ? *mbret : memblock(), rf);
|
||||
}
|
||||
}
|
||||
else // if a loader is already existing, add callbacks to that loader.
|
||||
@ -219,7 +224,7 @@ namespace MemoryDataHolder
|
||||
mutex.release();
|
||||
}
|
||||
}
|
||||
return memblock();
|
||||
return MemoryDataResult(memblock(), MDH_FILE_LOADING); // we reach this point only in multithreaded mode
|
||||
}
|
||||
|
||||
bool IsLoaded(std::string s)
|
||||
|
||||
@ -12,10 +12,11 @@ namespace MemoryDataHolder
|
||||
{
|
||||
enum ResultFlags
|
||||
{
|
||||
MDH_FILE_ERROR = 0, // file doesnt exist, cant be loaded, etc
|
||||
MDH_FILE_OK = 1, // file was loaded properly or already present in memory. point is: we have good data
|
||||
MDH_FILE_ALREADY_EXIST = 2, // file was loaded before
|
||||
MDH_FILE_JUST_LOADED = 4, // file was freshly loaded
|
||||
MDH_FILE_ERROR = 0x00, // file doesnt exist, cant be loaded, etc
|
||||
MDH_FILE_OK = 0x01, // file was loaded properly or already present in memory. point is: we have good data
|
||||
MDH_FILE_ALREADY_EXIST = 0x02, // file was loaded before
|
||||
MDH_FILE_JUST_LOADED = 0x04, // file was freshly loaded
|
||||
MDH_FILE_LOADING = 0x08, // file is currently beeing loaded (returned only in multithreaded mode)
|
||||
};
|
||||
|
||||
typedef void (*callback_func)(void *ptr,std::string filename, uint32 flags);
|
||||
@ -37,11 +38,18 @@ namespace MemoryDataHolder
|
||||
uint32 size;
|
||||
};
|
||||
|
||||
struct MemoryDataResult
|
||||
{
|
||||
MemoryDataResult(memblock mb, uint32 f) { data = mb; flags = f; }
|
||||
memblock data;
|
||||
uint32 flags; // see ResultFlags enum
|
||||
};
|
||||
|
||||
void Init(void);
|
||||
void SetThreadCount(uint32);
|
||||
|
||||
memblock GetFile(std::string s, bool threaded = false, callback_func func = NULL,void *ptr = NULL, ZThread::Condition *cond = NULL, bool ref_counted = true);
|
||||
inline memblock GetFileBasic(std::string s) { return GetFile(s, false, NULL, NULL, NULL, false); }
|
||||
MemoryDataResult GetFile(std::string s, bool threaded = false, callback_func func = NULL,void *ptr = NULL, ZThread::Condition *cond = NULL, bool ref_counted = true);
|
||||
inline MemoryDataResult GetFileBasic(std::string s) { return GetFile(s, false, NULL, NULL, NULL, false); }
|
||||
bool IsLoaded(std::string);
|
||||
void BackgroundLoadFile(std::string);
|
||||
bool Delete(std::string);
|
||||
|
||||
@ -102,11 +102,11 @@ void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m)
|
||||
|
||||
char buf[300];
|
||||
MakeMapFilename(buf,m,gx,gy);
|
||||
MemoryDataHolder::memblock mb = MemoryDataHolder::GetFileBasic(buf);
|
||||
if(mb.size)
|
||||
MemoryDataHolder::MemoryDataResult mdr = MemoryDataHolder::GetFileBasic(buf);
|
||||
if(mdr.flags & MemoryDataHolder::MDH_FILE_OK && mdr.data.size)
|
||||
{
|
||||
ByteBuffer bb(mb.size);
|
||||
bb.append(mb.ptr,mb.size);
|
||||
ByteBuffer bb(mdr.data.size);
|
||||
bb.append(mdr.data.ptr,mdr.data.size);
|
||||
MemoryDataHolder::Delete(buf);
|
||||
ADTFile *adt = new ADTFile();
|
||||
adt->LoadMem(bb);
|
||||
|
||||
@ -321,6 +321,14 @@ bool ConvertDBC(void)
|
||||
RaceDataStorage[id].push_back(std::string(ChrRacesFieldNames[field]).append("=").append(value));
|
||||
}
|
||||
}
|
||||
if (doModels)
|
||||
{
|
||||
// corpse models
|
||||
|
||||
modelNames.insert(NameAndAlt("World\\Generic\\PassiveDoodads\\DeathSkeletons\\" + racemap[id] + "MaleDeathSkeleton.m2"));
|
||||
modelNames.insert(NameAndAlt("World\\Generic\\PassiveDoodads\\DeathSkeletons\\" + racemap[id] + "FemaleDeathSkeleton.m2"));
|
||||
}
|
||||
|
||||
std::stringstream temp;
|
||||
temp << classmask[id];
|
||||
RaceDataStorage[id].push_back(std::string("classmask").append("=").append(temp.str()));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user