Changes for Jedi Knight 2

This commit is contained in:
Vladislav Khorev 2013-04-11 20:49:41 +00:00
parent f6f7cc380c
commit 8fdd1da938
5 changed files with 54 additions and 3 deletions

View File

@ -43,6 +43,8 @@ std::string GetFilePathUserData(const std::string& filename);
#ifdef TARGET_WIN32 #ifdef TARGET_WIN32
void GetFileList(const std::string& searchkey, std::vector<std::string> &list);
template<typename TYPENAME> template<typename TYPENAME>
boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, cardinal& intCount) boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, cardinal& intCount)
{ {
@ -244,6 +246,18 @@ inline std::string GetFileExt(const std::string& filename)
} }
inline std::string GetFileNameWithoutExt(const std::string& filename)
{
std::string result = GetFileName(filename);
std::string::const_iterator i = result.end() - 1;
while (*i != '.')
--i;
return std::string(result.begin(), i);
}
std::string GetFilePath(const std::string& filename); std::string GetFilePath(const std::string& filename);
#ifdef TARGET_IOS #ifdef TARGET_IOS

View File

@ -39,7 +39,9 @@ void TFlexModelResource::Serialize(boost::property_tree::ptree& propertyTree)
} }
} }
BOOST_FOREACH(auto& ptree, propertyTree.get_child("Model.SamplerMap")) if (propertyTree.find("Model")->second.find("SamplerMap") != propertyTree.not_found())
{
BOOST_FOREACH(auto& ptree, propertyTree.get_child("Model.SamplerMap")) //Xperimental - fix it!
{ {
if (ptree.first == "Sampler") if (ptree.first == "Sampler")
{ {
@ -50,6 +52,7 @@ void TFlexModelResource::Serialize(boost::property_tree::ptree& propertyTree)
} }
} }
}
} }

View File

@ -93,12 +93,22 @@ void TVolumeBody::Rotate(const mat3& r)
void TVolumeBody::Scale(float s) void TVolumeBody::Scale(float s)
{ {
throw ErrorToLog("TVolumeBody::Scale not implemented yet!"); BOOST_FOREACH(TSmpTriangle& smpTriangle, SmpTriangleArr)
{
smpTriangle.p[0] *= s;
smpTriangle.p[1] *= s;
smpTriangle.p[2] *= s;
}
} }
void TVolumeBody::Scale(const vec3& s) void TVolumeBody::Scale(const vec3& s)
{ {
throw ErrorToLog("TVolumeBody::Scale not implemented yet!"); BOOST_FOREACH(TSmpTriangle& smpTriangle, SmpTriangleArr)
{
smpTriangle.p[0] *= s.v[0];
smpTriangle.p[1] *= s.v[1];
smpTriangle.p[2] *= s.v[2];
}
} }

View File

@ -825,6 +825,7 @@ void FillMemoryWithZero(char* bufferPtr, cardinal bufferSize)
void TSoundManagerWindows::Update(cardinal dt) void TSoundManagerWindows::Update(cardinal dt)
{ {
//Xperimental need mutex here
std::map<std::string, boost::shared_ptr<TMusicStreamAncestor> >::iterator i; std::map<std::string, boost::shared_ptr<TMusicStreamAncestor> >::iterator i;
for (i = StreamMap.begin(); i != StreamMap.end(); ++i) for (i = StreamMap.begin(); i != StreamMap.end(); ++i)

View File

@ -90,6 +90,29 @@ std::string GetFilePathUserData(const std::string& filename)
return realFileName; return realFileName;
} }
#ifdef TARGET_WIN32
void GetFileList(const std::string& searchkey, std::vector<std::string> &list)
{
WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile(searchkey.c_str(), &fd);
if(h == INVALID_HANDLE_VALUE)
{
return;
}
while(1)
{
list.push_back(fd.cFileName);
if(FindNextFile(h, &fd) == FALSE)
break;
}
}
#endif
#ifdef TARGET_IOS #ifdef TARGET_IOS
//Special for IOS -> Foundation.h conflicts with sq_plus.h //Special for IOS -> Foundation.h conflicts with sq_plus.h
std::string GetPathToResources() std::string GetPathToResources()