* really use cached files (irrlicht uses full paths!)
* fixed vc71 non-debug builds
This commit is contained in:
parent
0056a1de25
commit
5e7190551e
@ -100,6 +100,7 @@ DEBUG(logdebug("Read %u/%u Vertices",M2MVertices.size(),header.nVertices));
|
||||
|
||||
std::string SkinName = MeshFile->getFileName();
|
||||
SkinName = SkinName.substr(0, SkinName.length()-3) + "00.skin"; // FIX ME (and stuffextract) ! as we need more skins
|
||||
_FixFileName(SkinName);
|
||||
io::IReadFile* SkinFile = io::IrrCreateIReadFileBasic(Device, SkinName.c_str());
|
||||
if (!SkinFile)
|
||||
{
|
||||
|
||||
@ -162,12 +162,14 @@ bool PseuInstance::Init(void)
|
||||
_rmcontrol = new RemoteController(this,GetConf()->rmcontrolport);
|
||||
}
|
||||
|
||||
#if !(PLATFORM == PLATFORM_WIN32 && !defined(_CONSOLE))
|
||||
if(GetConf()->enablecli)
|
||||
{
|
||||
log("Starting CLI...");
|
||||
_cli = new CliRunnable(this);
|
||||
ZThread::Thread t(_cli);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(_error)
|
||||
{
|
||||
@ -188,11 +190,11 @@ bool PseuInstance::InitGUI(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetConf()->enablegui)
|
||||
/*if (!GetConf()->enablegui)
|
||||
{
|
||||
logdebug("GUI: Can't start, gui disabled in config");
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
uint16 x,y,depth;
|
||||
uint8 driver;
|
||||
|
||||
@ -746,24 +746,31 @@ void WorldSession::PreloadDataBeforeEnterWorld(PlayerEnum& pl)
|
||||
log("Loading data before entering world...");
|
||||
GetWorld()->GetMapMgr()->Update(pl._x, pl._y, pl._mapId); // make it load the map files
|
||||
|
||||
for(uint32 tiley = 0; tiley < 3; tiley++)
|
||||
// preload additional map data only when the GUI is enabled
|
||||
// TODO: at some later point we will need the geometry for correct collision calculation, etc...
|
||||
if(GetInstance()->GetConf()->enablegui)
|
||||
{
|
||||
for(uint32 tilex = 0; tilex < 3; tilex++)
|
||||
for(uint32 tiley = 0; tiley < 3; tiley++)
|
||||
{
|
||||
MapTile *maptile = GetWorld()->GetMapMgr()->GetNearTile(tilex - 1, tiley - 1);
|
||||
if(maptile)
|
||||
for(uint32 tilex = 0; tilex < 3; tilex++)
|
||||
{
|
||||
for(uint32 i = 0; i < maptile->GetDoodadCount(); i++)
|
||||
MapTile *maptile = GetWorld()->GetMapMgr()->GetNearTile(tilex - 1, tiley - 1);
|
||||
if(maptile)
|
||||
{
|
||||
Doodad *doo = maptile->GetDoodad(i);
|
||||
for(uint32 i = 0; i < maptile->GetDoodadCount(); i++)
|
||||
{
|
||||
Doodad *doo = maptile->GetDoodad(i);
|
||||
|
||||
// it is useless to load the file here, since its loaded when irrlicht needs it and kept in the MeshCache for later use
|
||||
//MemoryDataHolder::BackgroundLoadFile(doo->model);
|
||||
// it is useless to load the file here, since its loaded when irrlicht needs it and kept in the MeshCache for later use
|
||||
//MemoryDataHolder::BackgroundLoadFile(doo->model);
|
||||
|
||||
// but we need to preload the .skin files, since they are not held in the MeshCache
|
||||
// TODO: load *all* necessary skin files, also fix stuffextract for this!
|
||||
std::string skinfile = doo->model.substr(0, doo->model.length()-3) + "00.skin";
|
||||
MemoryDataHolder::BackgroundLoadFile(skinfile);
|
||||
// but we need to preload the .skin files, since they are not held in the MeshCache
|
||||
// TODO: load *all* necessary skin files, also fix stuffextract for this!
|
||||
std::string skinfile = doo->model.substr(0, doo->model.length()-3) + "00.skin";
|
||||
skinfile = GetAbsolutePath(skinfile.c_str());
|
||||
_FixFileName(skinfile);
|
||||
MemoryDataHolder::BackgroundLoadFile(skinfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="FALSE"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht;..\..\include\DXSDK\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
@ -143,7 +143,7 @@
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="0"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht;..\..\include\DXSDK\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
@ -202,7 +202,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht;..\..\include\DXSDK\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_IRR_STATIC_LIB_;_CRT_SECURE_NO_DEPRECATE"
|
||||
ExceptionHandling="FALSE"
|
||||
BasicRuntimeChecks="3"
|
||||
@ -263,7 +263,7 @@
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="FALSE"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht;..\..\include\DXSDK\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_IRR_STATIC_LIB_;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
@ -326,7 +326,7 @@
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="0"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht"
|
||||
AdditionalIncludeDirectories="..\..\include\zlib;..\..\include\irrlicht;..\..\include\DXSDK\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_IRR_STATIC_LIB_;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
# include <windows.h>
|
||||
# include <mmsystem.h>
|
||||
# include <time.h>
|
||||
# include <direct.h>
|
||||
#else
|
||||
# include <sys/dir.h>
|
||||
# include <sys/stat.h>
|
||||
@ -17,6 +18,11 @@
|
||||
# include <time.h>
|
||||
# endif
|
||||
# include <sys/timeb.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 1024
|
||||
#endif
|
||||
|
||||
|
||||
@ -269,3 +275,61 @@ std::string FilesizeFormat(uint32 b)
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
//! Returns the string of the current working directory
|
||||
std::string GetWorkingDir(void)
|
||||
{
|
||||
char d[MAX_PATH];
|
||||
#if PLATFORM == PLATFORM_WIN32
|
||||
_getcwd(d, MAX_PATH);
|
||||
#else
|
||||
getcwd(d, MAX_PATH);
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
//! Changes the current Working Directory to the given string.
|
||||
bool SetWorkingDir(const char *dir)
|
||||
{
|
||||
bool success=false;
|
||||
#ifdef _MSC_VER
|
||||
success=(_chdir(dir) == 0);
|
||||
#else
|
||||
success=(chdir(dir) == 0);
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
std::string GetAbsolutePath(const char *filename)
|
||||
{
|
||||
char *p = NULL;
|
||||
|
||||
#if PLATFORM == PLATFORM_WIN32
|
||||
char fpath[MAX_PATH];
|
||||
p = _fullpath( fpath, filename, MAX_PATH);
|
||||
|
||||
#else
|
||||
char fpath[4096];
|
||||
fpath[0]=0;
|
||||
p = realpath(filename, fpath);
|
||||
if (!p)
|
||||
{
|
||||
// content in fpath is undefined at this point
|
||||
if ('0'==fpath[0]) // seems like fpath wasn't altered
|
||||
{
|
||||
// at least remove a ./ prefix
|
||||
if ('.'==filename[0] && '/'==filename[1])
|
||||
return &filename[2]; // skip first 2 chars
|
||||
else
|
||||
return filename;
|
||||
}
|
||||
else
|
||||
return fpath;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#define M_UNSETBIT(var,bit) ( (var)&=(~(1<<(bit))) )
|
||||
#define M_HASBIT(var,bit) ( (var)&(1<<(bit)) )
|
||||
|
||||
|
||||
void printchex(std::string,bool);
|
||||
void printchex(char *in, uint32 len, bool);
|
||||
std::string stringToUpper(std::string);
|
||||
@ -24,5 +25,8 @@ void _FixFileName(std::string&);
|
||||
std::string _PathToFileName(std::string);
|
||||
std::string NormalizeFilename(std::string);
|
||||
std::string FilesizeFormat(uint32);
|
||||
std::string GetWorkingDir(void);
|
||||
bool SetWorkingDir(const char*);
|
||||
std::string GetAbsolutePath(const char*);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user