From 8fdd1da9385b3ce6cc957b68a118a502df186e3b Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Thu, 11 Apr 2013 20:49:41 +0000 Subject: [PATCH] Changes for Jedi Knight 2 --- include/Utils/FileUtils/FileUtils.h | 14 ++++++++++++++ src/ModelManager/NewModelManager.cpp | 5 ++++- src/PhysicsManager/PhysicsManager.cpp | 14 ++++++++++++-- src/SoundManager/SoundManagerWindows.cpp | 1 + src/Utils/FileUtils/FileUtils.cpp | 23 +++++++++++++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) diff --git a/include/Utils/FileUtils/FileUtils.h b/include/Utils/FileUtils/FileUtils.h index d607a0a..eb9faf1 100644 --- a/include/Utils/FileUtils/FileUtils.h +++ b/include/Utils/FileUtils/FileUtils.h @@ -43,6 +43,8 @@ std::string GetFilePathUserData(const std::string& filename); #ifdef TARGET_WIN32 +void GetFileList(const std::string& searchkey, std::vector &list); + template boost::shared_array 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); #ifdef TARGET_IOS diff --git a/src/ModelManager/NewModelManager.cpp b/src/ModelManager/NewModelManager.cpp index ed4a56a..c5b9d86 100644 --- a/src/ModelManager/NewModelManager.cpp +++ b/src/ModelManager/NewModelManager.cpp @@ -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") { @@ -50,6 +52,7 @@ void TFlexModelResource::Serialize(boost::property_tree::ptree& propertyTree) } } + } } diff --git a/src/PhysicsManager/PhysicsManager.cpp b/src/PhysicsManager/PhysicsManager.cpp index c9f2233..7ad5e9f 100644 --- a/src/PhysicsManager/PhysicsManager.cpp +++ b/src/PhysicsManager/PhysicsManager.cpp @@ -93,12 +93,22 @@ void TVolumeBody::Rotate(const mat3& r) 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) { - 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]; + } } diff --git a/src/SoundManager/SoundManagerWindows.cpp b/src/SoundManager/SoundManagerWindows.cpp index de162d5..7d16216 100644 --- a/src/SoundManager/SoundManagerWindows.cpp +++ b/src/SoundManager/SoundManagerWindows.cpp @@ -825,6 +825,7 @@ void FillMemoryWithZero(char* bufferPtr, cardinal bufferSize) void TSoundManagerWindows::Update(cardinal dt) { + //Xperimental need mutex here std::map >::iterator i; for (i = StreamMap.begin(); i != StreamMap.end(); ++i) diff --git a/src/Utils/FileUtils/FileUtils.cpp b/src/Utils/FileUtils/FileUtils.cpp index 54f8356..5071d5a 100644 --- a/src/Utils/FileUtils/FileUtils.cpp +++ b/src/Utils/FileUtils/FileUtils.cpp @@ -90,6 +90,29 @@ std::string GetFilePathUserData(const std::string& filename) return realFileName; } + +#ifdef TARGET_WIN32 +void GetFileList(const std::string& searchkey, std::vector &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 //Special for IOS -> Foundation.h conflicts with sq_plus.h std::string GetPathToResources()