Permalink
Browse files

Now for the bug fixes. Ogre has filesystem archive bugs now! Still no…

…t working, more segvs on the way
  • Loading branch information...
volca02 committed Apr 22, 2014
1 parent 9f3f8da commit 61c439cc2a65d35ddfa06275532cfcead1dccb21
View
4 TODO
@@ -67,6 +67,10 @@ Pre-0.3 release:
* rendering optimizations
* dev assistant script - find thief/ss2 game files, setup config files accordingly next to opde executable (install-less developement)
* Redo the console using draw service to avoid the usage of ogre3d overlays
+ * Cleanup
+ - replace tabs by 4 spaces. Update formatting guide, astyle config
+ - convert pimpl where possible
+ - forward pointer types, include in cpp files as needed
----------------------------------
- Some random side-project ideas -
@@ -688,6 +688,7 @@ namespace Ogre {
mMaterialsExtra(NULL),
mVHots(NULL),
mVertices(NULL),
+ mNormals(NULL),
mLights(NULL),
mUVs(NULL),
mSubObjects(NULL),
@@ -1475,7 +1476,6 @@ namespace Ogre {
pass->setDiffuse(1,1,1,1);
}
-
pass->setSpecular(0,0,0,0);
pass->setCullingMode(CULL_CLOCKWISE);
@@ -1486,6 +1486,11 @@ namespace Ogre {
if (!ResourceGroupManager::getSingleton().resourceExists(ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, String("txt16/") + String(mat.name))) {
// Not in txt16, will be in txt then...
txtname = String("txt/") + String(mat.name);
+
+ if (!ResourceGroupManager::getSingleton().resourceExists(ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, txtname)) {
+ OPDE_EXCEPT(String("Can't find texture in txt16 or txt folder: ") + mat.name,
+ "ObjectMeshLoader::prepareMaterial");
+ }
}
pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
@@ -135,6 +135,11 @@ namespace Ogre {
// ---------------------------------------------------------------------------------------------------
Codec::DecodeResult CustomImageCodec::decode(DataStreamPtr& input) const {
+ if (!input.get())
+ OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+ "Cannot decode empty stream",
+ "CustomImageCodec::decode");
+
// Buffer stream into memory (TODO: override IO functions instead?)
MemoryDataStream memStream(input, true);
View
@@ -72,10 +72,11 @@ namespace Opde {
mViewport = renderSrv->getDefaultViewport();
// display loading... message
- mLoadingOverlay = OverlayManager::getSingleton().getByName("Opde/LoadOverlay");
+ // TODO: replace with DrawService code...
+ // mLoadingOverlay = OverlayManager::getSingleton().getByName("Opde/LoadOverlay");
// Create a panel
- mLoadingOverlay->show();
+ // mLoadingOverlay->show();
LOG_INFO("LoadState: Started");
@@ -85,9 +86,7 @@ namespace Opde {
void GameLoadState::exit() {
LOG_INFO("LoadState: Exiting");
- // mLoadingOverlay->hide();
-
- mLoadingOverlay->hide();
+ // TODO: Replace with drawservice code mLoadingOverlay->hide();
LOG_INFO("LoadState: Exited");
@@ -103,18 +102,16 @@ namespace Opde {
void GameLoadState::resume() {
LOG_INFO("LoadState: Resume?!");
mLoaded = false;
- mFirstTime = true;
-
-
- // mLoadingOverlay->show();
+ mFirstTime = true;
}
void GameLoadState::update(unsigned long timePassed) {
if (!mFirstTime && !mLoaded) {
unsigned long start_ms = Ogre::Root::getSingleton().getTimer()->getMilliseconds();
- OverlayElement* guiLdr = OverlayManager::getSingleton().getOverlayElement("Opde/LoadPanel/Description");
- guiLdr->setCaption("Loading, please wait...");
+ // TODO: Replace with draw service
+ /* OverlayElement* guiLdr = OverlayManager::getSingleton().getOverlayElement("Opde/LoadPanel/Description");
+ guiLdr->setCaption("Loading, please wait...");*/
mRoot->renderOneFrame();
@@ -126,11 +123,11 @@ namespace Opde {
mLoaded = true;
- guiLdr->setCaption("Loaded, press ESC...");
+ // guiLdr->setCaption("Loaded, press ESC...");
LOG_INFO("Loading took %10.2f seconds", (Ogre::Root::getSingleton().getTimer()->getMilliseconds() - start_ms) / 1000.0f);
- // popState(); // Hardcoded, so no escape key is needed
+ popState(); // Hardcoded, so no escape key is needed
}
mFirstTime = false;
View
@@ -48,22 +48,22 @@ namespace Ogre {
// load, build map
mArchive->load();
- StringVectorPtr lst = mArchive->list(true, false);
+ FileInfoListPtr lst = mArchive->listFileInfo(true, false);
- StringVector::iterator it = lst->begin();
+ FileInfoList::iterator it = lst->begin();
while (it != lst->end()) {
- const std::string& fn = *it++;
- std::string tn = transformName(fn);
+ const FileInfo& fi = *it++;
+ std::string tn = transformName(fi.filename);
StringUtil::toLowerCase(tn);
// insert into the map
std::pair<NameTable::iterator, bool> result =
- mExtToIntNames.insert(std::make_pair(tn, fn));
+ mExtToIntNames.insert(std::make_pair(tn, fi.filename));
// see if the result is ok, except if not
if (!result.second)
OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM,
- "Archive '" + mName + "' contains duplicities : " + fn,
+ "Archive '" + mName + "' contains duplicities : " + fi.filename,
"ProxyArchive::load");
}
}
View
@@ -89,8 +89,9 @@ namespace Opde {
mDirArchiveFactory(NULL),
mCrfArchiveFactory(NULL),
mResourceGroupManager(NULL),
- mArchiveManager(NULL) {
-
+ mArchiveManager(NULL),
+ mOverlaySystem(NULL)
+ {
mLogger = new Logger();
if (logFileName) {
@@ -100,7 +101,7 @@ namespace Opde {
LOG_INFO("Root: Starting openDarkEngine %d.%d.%d (%s), build %s, %s", OPDE_VER_MAJOR, OPDE_VER_MINOR, OPDE_VER_PATCH, OPDE_CODE_NAME, __DATE__, __TIME__);
mServiceMgr = new ServiceManager(mServiceMask);
-
+
LOG_INFO("Root: Created a ServiceManager instance with global mask %X", mServiceMask);
LOG_INFO("Root: Hooking up the Ogre logging");
@@ -139,6 +140,11 @@ namespace Opde {
Ogre::CustomImageCodec::startup();
}
+ LOG_INFO("Root: Creating overlay system");
+
+ mOverlaySystem = new Ogre::OverlaySystem();
+#warning do this: m_pSceneMgr->addRenderQueueListener(pOverlaySystem);
+
LOG_INFO("Root: Creating console backend");
mConsoleBackend = new ConsoleBackend();
@@ -167,25 +173,26 @@ namespace Opde {
#endif
// Archive manager has no way to remove the archive factories...
delete mServiceMgr;
-
+
// delete all the service factories
ServiceFactoryList::iterator sit = mServiceFactories.begin();
while (sit != mServiceFactories.end()) {
delete *sit++;
}
-
+
mServiceFactories.clear();
delete mConsoleBackend;
if (mServiceMask & SERVICE_RENDERER) {
Ogre::CustomImageCodec::shutdown();
}
-
+
delete mOgreRoot;
delete mResourceGroupManager;
delete mArchiveManager;
+ delete mOverlaySystem;
LogListenerList::iterator it = mLogListeners.begin();
@@ -243,7 +250,7 @@ namespace Opde {
// -------------------------------------------------------
void Root::loadPLDefScript(const std::string& fileName, const std::string& groupName) {
-#ifdef SCRIPT_COMPILERS
+#ifdef SCRIPT_COMPILERS
// try to open the given resource stream
Ogre::DataStreamPtr str = Ogre::ResourceGroupManager::getSingleton().openResource(fileName, groupName, true, NULL);
mPLDefScriptCompiler->parseScript(str, groupName);
@@ -317,9 +324,9 @@ namespace Opde {
mServiceFactories.push_back(new RoomServiceFactory());
// mServiceFactories.push_back(new GUIServiceFactory());
mServiceFactories.push_back(new PlatformServiceFactory());
-
+
ServiceFactoryList::iterator it = mServiceFactories.begin();
-
+
while (it != mServiceFactories.end()) {
mServiceMgr->addServiceFactory(*it++);
}
View
@@ -41,32 +41,33 @@
#include <OgreRoot.h>
#include <OgreLogManager.h>
+#include <Overlay/OgreOverlaySystem.h>
/** OpenDarkEngine namespace. Holds the whole openDarkEngine project. */
namespace Opde {
-
+
/** OPDE core class. Used to initialize the whole engine. Singleton */
class OPDELIB_EXPORT Root : public Singleton<Root> {
public:
/** Initializes the opde core
- * @param serviceMask the mask of the services which should be used (others will be ignored and unreachable)
+ * @param serviceMask the mask of the services which should be used (others will be ignored and unreachable)
* @param logFileName - optional log file name - when specified, logging to file will be initialized automatically
*/
Root(uint serviceMask = SERVICE_ALL, const char* logFileName = NULL);
-
+
/** stops the opde core, does cleanup */
~Root();
// ----------------- Methods used for boostrapping --------------------
/// Loads a config file, given it's file name, which contains resource locations configuration
void loadResourceConfig(const std::string& fileName);
-
+
/// Loads dynamic type definitions from a given file name and group name
void loadDTypeScript(const std::string& fileName, const std::string& groupName);
-
+
/// Loads property and link definitions
void loadPLDefScript(const std::string& fileName, const std::string& groupName);
-
+
/// Loads a config file with opde settings
void loadConfigFile(const std::string& fileName);
@@ -79,22 +80,22 @@ namespace Opde {
/** To be called when bootstrapping process was finished */
void bootstrapFinished();
-
+
/** @returns a pointer to the logger used */
Logger* getLogger() { return mLogger; };
-
+
/** @returns a pointer to the service manager */
ServiceManager* getServiceManager() { return mServiceMgr; };
-
+
/** Creates a new logger instance that logs to a file (Logger will be automatically destroyed on termination) */
void logToFile(const std::string& fname);
-
+
/** A shortcut to set loglevel. Valid values are 0-4 */
void setLogLevel(int level);
-
+
/// registers custom script loaders with ogre, meaning the custom scripts will get loaded automatically
void registerCustomScriptLoaders();
-
+
protected:
/// Registers all the service factories to the Service Manger
void registerServiceFactories();
@@ -107,42 +108,45 @@ namespace Opde {
Ogre::Root* mOgreRoot;
Ogre::LogManager* mOgreLogManager;
OgreOpdeLogConnector* mOgreOpdeLogConnector;
-
+
/// @deprecated
ConsoleBackend* mConsoleBackend;
-#ifdef SCRIPT_COMPILERS
+#ifdef SCRIPT_COMPILERS
DTypeScriptCompiler* mDTypeScriptCompiler;
PLDefScriptCompiler* mPLDefScriptCompiler;
-
+
/// Loader for the DType scripts.
DTypeScriptLoader* mDTypeScriptLdr;
/// Loader for the PLDef scripts
PLDefScriptLoader* mPLDefScriptLdr;
-#endif
-
+#endif
+
typedef std::list< LogListener* > LogListenerList;
typedef std::list< ServiceFactory* > ServiceFactoryList;
-
+
LogListenerList mLogListeners;
-
- const unsigned int mServiceMask;
+
+ const unsigned int mServiceMask;
/// Factory for case-less filesystem archives
/// Factory for case-less filesystem archives
Ogre::ArchiveFactory* mDirArchiveFactory;
-
+
/// Factory for Crf archives (zip archives with archivename prefix)
Ogre::ArchiveFactory* mCrfArchiveFactory;
-
+
// If ogre is not used, these point to particular managers we hijack
Ogre::ResourceGroupManager* mResourceGroupManager;
Ogre::ArchiveManager* mArchiveManager;
-
+
// list of all service factories (for deletion in destructor)
ServiceFactoryList mServiceFactories;
+
+ // Overlay system module pointer
+ Ogre::OverlaySystem* mOverlaySystem;
};
-
+
} // namespace Opde
#endif
Oops, something went wrong.

0 comments on commit 61c439c

Please sign in to comment.