Revision: 2683
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2683&view=rev
Author:   rorthomas
Date:     2012-05-26 03:14:08 +0000 (Sat, 26 May 2012)
Log Message:
-----------
moved some stuff around

Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gameplay/RoRFrameListener.h
    trunk/source/main/terrain/TerrainManager.cpp
    trunk/source/main/terrain/TerrainManager.h
    trunk/source/main/terrain/TerrainObjectManager.cpp
    trunk/source/main/terrain/TerrainObjectManager.h

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-26 03:04:40 UTC 
(rev 2682)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-26 03:14:08 UTC 
(rev 2683)
@@ -2955,25 +2955,8 @@
 }
 
 
-void RoRFrameListener::initializeCompontents()
-{
-       // load map
-#ifdef USE_MYGUI
-       LoadingWindow::getSingleton().setProgress(0, _L("Loading Terrain"));
-       bool disableMap = (BSETTING("disableOverViewMap", false));
 
-       // map must be loaded before the script engine
-       // init the map
-       if (!disableMap)
-       {
-               surveyMap = new MapControl(mapsizex, mapsizey, mapsizez);
-       }
-#endif //USE_MYGUI
 
-
-}
-
-
 void RoRFrameListener::loadTerrain(String terrainfile)
 {
        ScopeLog log("terrain_"+terrainfile);
@@ -2991,40 +2974,26 @@
                }
        }
 
-       loadedTerrain = terrainfile;
+#ifdef USE_MYGUI
+       LoadingWindow::getSingleton().setProgress(0, _L("Loading Terrain"));
+#endif //USE_MYGUI
 
-       initializeCompontents();
+       LOG("Loading new terrain format: " + terrainfile);
 
-       if (terrainfile.find(".terrn2") != String::npos)
+       if(terrainManager)
        {
-               LOG("Loading new terrain format: " + terrainfile);
-               loadNewTerrain(terrainfile);
-
-       } else if (terrainfile.find(".terrn") != String::npos)
-       {
-               LOG("Old Terrain not supported anymore");
-               showError(_L("Terrain loading error"), _L("Old Terrain not 
supported"));
-               exit(1);
-       } else
-       {
-               // exit on unknown terrain handler
-               LOG("Terrain not supported, unknown format: " + terrainfile);
-               showError(_L("Terrain loading error"), _L("Terrain not 
supported, unknown format: ") + terrainfile);
-               exit(1);
+               // remove old terrain
+               delete(terrainManager);
        }
 
-#ifdef USE_MYGUI
-       if (!BSETTING("REPO_MODE", false))
-       {
-               // hide loading window
-               LoadingWindow::getSingleton().hide();
-               // hide wallpaper
-               MyGUI::Window *w = 
MyGUI::Gui::getInstance().findWidget<MyGUI::Window>("wallpaper");
-               if (w) w->setVisibleSmooth(false);
-       }
-#endif // USE_MYGUI
+       terrainManager = new TerrainManager();
+       terrainManager->loadTerrain(terrainfile);
 
        if (person) person->setVisible(true);
+
+#ifdef USE_MYGUI
+       LoadingWindow::getSingleton().hide();
+#endif //USE_MYGUI
 }
 
 void RoRFrameListener::initTrucks(bool loadmanual, Ogre::String selected, 
Ogre::String selectedExtension, std::vector<Ogre::String> *truckconfig, bool 
enterTruck, Skin *skin)
@@ -3332,21 +3301,6 @@
        }
 }
 
-bool RoRFrameListener::updateAnimatedObjects(float dt)
-{
-       if (animatedObjects.size() == 0)
-               return true;
-       std::vector<animated_object_t>::iterator it;
-       for(it=animatedObjects.begin(); it!=animatedObjects.end(); it++)
-       {
-               if (it->anim && it->speedfactor != 0)
-               {
-                       Real time = dt * it->speedfactor;
-                       it->anim->addTime(time);
-               }
-       }
-       return true;
-}
 
 bool RoRFrameListener::updateTruckMirrors(float dt)
 {

Modified: trunk/source/main/gameplay/RoRFrameListener.h
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.h       2012-05-26 03:04:40 UTC 
(rev 2682)
+++ trunk/source/main/gameplay/RoRFrameListener.h       2012-05-26 03:14:08 UTC 
(rev 2683)
@@ -196,7 +196,6 @@
 
        unsigned int mNumScreenShots;
        
-       bool updateAnimatedObjects(float dt);
        bool updateTruckMirrors(float dt);
 
        int setupBenchmark();

Modified: trunk/source/main/terrain/TerrainManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainManager.cpp        2012-05-26 03:04:40 UTC 
(rev 2682)
+++ trunk/source/main/terrain/TerrainManager.cpp        2012-05-26 03:14:08 UTC 
(rev 2683)
@@ -166,6 +166,12 @@
        if(!BSETTING("Envmapdisable", false))
                initEnvironmentMap();
 
+       // map must be loaded before the script engine
+       // init the map
+       if (!BSETTING("disableOverViewMap", false))
+               initSurveyMap();
+
+
        initDashboards();
 }
 
@@ -557,7 +563,12 @@
        BeamFactory::getSingleton().recalcGravityMasses();
 }
 
-static float TerrainManager::getGravity()
+float TerrainManager::getGravity()
 {
        return gravity;
 }
+
+void TerrainManager::initSurveyMap()
+{
+       surveyMap = new MapControl(mapsizex, mapsizey, mapsizez);
+}

Modified: trunk/source/main/terrain/TerrainManager.h
===================================================================
--- trunk/source/main/terrain/TerrainManager.h  2012-05-26 03:04:40 UTC (rev 
2682)
+++ trunk/source/main/terrain/TerrainManager.h  2012-05-26 03:14:08 UTC (rev 
2683)
@@ -56,6 +56,7 @@
        Dashboard *dashboard;
        Collisions *collisions;
        Water *water;
+       MapControl *surveyMap;
 
        // subsystem properties
        HDRListener *hdrListener;
@@ -95,6 +96,7 @@
        void initShadows();
        void initCollisions();
        void initScripting();
+       void initSurveyMap();
 
        void fixCompositorClearColor();
 

Modified: trunk/source/main/terrain/TerrainObjectManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainObjectManager.cpp  2012-05-26 03:04:40 UTC 
(rev 2682)
+++ trunk/source/main/terrain/TerrainObjectManager.cpp  2012-05-26 03:14:08 UTC 
(rev 2683)
@@ -1138,4 +1138,20 @@
                        }
                }
 #endif //USE_MYGUI
+}
+
+bool TerrainObjectManager::updateAnimatedObjects(float dt)
+{
+       if (animatedObjects.size() == 0)
+               return true;
+       std::vector<animated_object_t>::iterator it;
+       for(it=animatedObjects.begin(); it!=animatedObjects.end(); it++)
+       {
+               if (it->anim && it->speedfactor != 0)
+               {
+                       Real time = dt * it->speedfactor;
+                       it->anim->addTime(time);
+               }
+       }
+       return true;
 }
\ No newline at end of file

Modified: trunk/source/main/terrain/TerrainObjectManager.h
===================================================================
--- trunk/source/main/terrain/TerrainObjectManager.h    2012-05-26 03:04:40 UTC 
(rev 2682)
+++ trunk/source/main/terrain/TerrainObjectManager.h    2012-05-26 03:14:08 UTC 
(rev 2683)
@@ -65,7 +65,7 @@
 
        void loadObject(const char* name, float px, float py, float pz, float 
rx, float ry, float rz, Ogre::SceneNode * bakeNode, const char* instancename, 
bool enable_collisions=true, int scripthandler=-1, const char *type=0, bool 
uniquifyMaterial=false);
        void unloadObject(const char* name);
-
+       bool updateAnimatedObjects(float dt);
 };
 #endif // TERRAINOBJECTMANAGER_H__
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to