Revision: 2420 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2420&view=rev Author: rorthomas Date: 2012-02-01 11:50:34 +0000 (Wed, 01 Feb 2012) Log Message: ----------- removed old map code, fixed linux bugs
Modified Paths: -------------- trunk/source/main/gameplay/RoRFrameListener.cpp trunk/source/main/gameplay/RoRFrameListener.h trunk/source/main/gui/MapTextureCreator.cpp trunk/source/main/gui/MapTextureCreator.h trunk/source/main/physics/BeamData.h trunk/source/main/physics/CmdKeyInertia.h trunk/source/main/physics/air/turbojet.h trunk/source/main/physics/collision/PointColDetector.h trunk/source/main/physics/input_output/SerializedRig.cpp trunk/source/main/utils/InputEngine.cpp trunk/source/main/utils/InputEngine.h trunk/source/main/utils/Settings.h trunk/source/main/utils/Singleton.h trunk/source/main/utils/language.cpp Modified: trunk/source/main/gameplay/RoRFrameListener.cpp =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.cpp 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/gameplay/RoRFrameListener.cpp 2012-02-01 11:50:34 UTC (rev 2420) @@ -299,31 +299,6 @@ if (raceStartTime > 0) updateRacingGUI(); - // update map -#ifdef USE_MYGUI - /* - if(bigMap) - { - for (int i=0; i<free_truck; i++) - { - if(!trucks[i]) continue; - MapEntity *e = bigMap->getEntityByName("Truck"+TOSTRING(i)); - if(!e) continue; - if (trucks[i]->state != RECYCLE && !interactivemap) - { - e->setState(trucks[i]->state); - e->setVisibility(true); - e->setPosition(trucks[i]->getPosition()); - e->setRotation(-Radian(trucks[i]->getHeadingDirectionAngle())); - } else - { - e->setVisibility(false); - } - } - } - */ -#endif // MYGUI - if (curr_truck->driveable == TRUCK) { //TRUCK @@ -839,7 +814,6 @@ bigMap=0; envmap=0; debugCollisions=false; - interactivemap=0; free_localizer=0; loading_state=NONE_LOADED; pressure_pressed=false; @@ -3231,18 +3205,6 @@ case 1 : mCamera->setPolygonMode(Ogre::PM_WIREFRAME) ; break ; case 2 : mCamera->setPolygonMode(Ogre::PM_POINTS) ; break ; } -#ifdef USE_MYGUI - if(mtc && interactivemap) - { - switch(mSceneDetailIndex) { - case 0 : mtc->setCameraMode(Ogre::PM_SOLID) ; break ; - case 1 : mtc->setCameraMode(Ogre::PM_WIREFRAME) ; break ; - case 2 : mtc->setCameraMode(Ogre::PM_POINTS) ; break ; - } - mtc->update(); - - } -#endif //MYGUI } #ifdef USE_MYGUI @@ -3259,7 +3221,6 @@ bigMap->setVisibility(true); if(cameramode!=CAMERA_INT) { - if(mtc) mtc->update(); //make it small again bigMap->updateRenderMetrics(mWindow); bigMap->setPosition(0, 0.81, 0.14, 0.19, mWindow); @@ -3267,7 +3228,6 @@ } else if(mapMode==1) { bigMap->setVisibility(true); - if(mtc) mtc->update(); // make it big bigMap->updateRenderMetrics(mWindow); bigMap->setPosition(0.2, 0, 0.8, 0.8, mWindow); @@ -3285,17 +3245,14 @@ if(fabs(1-bigMap->getAlpha()) < 0.001) { bigMap->setAlpha(0.5); - if(mtc) mtc->setTranlucency(0.5); } else if(fabs(0.5-bigMap->getAlpha()) < 0.001) { bigMap->setAlpha(0.2); - if(mtc) mtc->setTranlucency(0.2); } else if(fabs(0.2-bigMap->getAlpha()) < 0.001) { bigMap->setAlpha(1); - if(mtc) mtc->setTranlucency(1); } } } @@ -3534,49 +3491,6 @@ if(ow) ow->showDebugOverlay(mStatsOn); } -#ifdef USE_MYGUI - if (INPUTENGINE.getEventBoolValueBounce(EV_MAP_INTERACTIVE_TOGGLE, 0.5f) && mtc) - { - if(mtc && bigMap) - { - if(interactivemap) - { - interactivemap=0; - mtc->setCamZoom(((mapsizex+mapsizez)/2)*0.5); // zoom that fits 1:1 to the map - mtc->setCamPosition(Vector3(mapsizex/2, hfinder->getHeightAt(mapsizex/2, mapsizez/2) , mapsizez/2), Quaternion(Degree(0), Vector3::UNIT_X)); - mtc->update(); - bigMap->setEntitiesVisibility(true); - LOG("disabled interactive Map"); - } else - { - mtc->setCamZoom(30); // zoom very near - bigMap->setEntitiesVisibility(false); - interactivemap=1; - LOG("enabled interactive Map"); - } - } - } - - if (INPUTENGINE.getEventBoolValueBounce(EV_MAP_IN) && interactivemap && mtc) - { - //LOG("zoom in"); - if(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || INPUTENGINE.isKeyDown(OIS::KC_RSHIFT)) - mtc->setCamZoomRel(4); - else - mtc->setCamZoomRel(1); - mtc->update(); - } - if (INPUTENGINE.getEventBoolValueBounce(EV_MAP_OUT) && interactivemap && mtc) - { - //LOG("zoom out"); - if(INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) || INPUTENGINE.isKeyDown(OIS::KC_RSHIFT)) - mtc->setCamZoomRel(-4); - else - mtc->setCamZoomRel(-1); - mtc->update(); - } -#endif //MYGUI - if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_OUTPUT_POSITION) && loading_state == ALL_LOADED) { Vector3 pos = Vector3::ZERO; @@ -3681,7 +3595,6 @@ // important: update first! bigMap->updateRenderMetrics(mWindow); bigMap->setVisibility(true); - if(mtc) mtc->update(); //make it small again bigMap->updateRenderMetrics(mWindow); bigMap->setPosition(0, 0.81, 0.14, 0.19, mWindow); @@ -4608,10 +4521,6 @@ if(bigMap) { mtc = new MapTextureCreator(mScene, mCamera, this); - //mtc->setCamClip(mapsizex*1.2); - mtc->setCamZoom(((mapsizex+mapsizez)/2)*0.5); - mtc->setCamPosition(Vector3(mapsizex/2, hfinder->getHeightAt(mapsizex/2, mapsizez/2) , mapsizez/2), Quaternion(Degree(0), Vector3::UNIT_X)); - mtc->setAutoUpdated(false); // important! bigMap->setVisibility(false); bigMap->setMapTexture(mtc->getRTName()); } @@ -5434,16 +5343,6 @@ // hide truckhud if(ow) ow->truckhud->show(false); -#ifdef USE_MYGUI - // return to normal mapmode - if(mtc && interactivemap > 1) - { - // 2 = disabled normally, enabled for car - interactivemap = 0; - bigMap->setEntitiesVisibility(true); - } -#endif //MYGUI - //getting outside Vector3 position = Vector3::ZERO; if(previousTruck) @@ -5508,17 +5407,6 @@ // mapmode change? #ifdef USE_MYGUI - if(mtc && currentTruck->dynamicMapMode > 0) - { - // > 1 = disabled normally, enabled for car - if(interactivemap == 0) - interactivemap = 1 + currentTruck->dynamicMapMode; - else if(interactivemap == 1 && currentTruck->dynamicMapMode == 2) - interactivemap = 3; - mtc->setCamZoom(30); - bigMap->setEntitiesVisibility(false); - } - // show minimap and put it into lower left corner if(bigMap) { @@ -5676,13 +5564,6 @@ } if (!curr_truck) { -#ifdef USE_MYGUI - if(mtc && interactivemap) - { - mtc->setCamPosition(person->getPosition(), mCamera->getOrientation()); - mtc->update(); - } -#endif //MYGUI //perso mode if (cameramode==CAMERA_EXT) { @@ -5798,20 +5679,6 @@ else { // in truck -#ifdef USE_MYGUI - if(mtc && interactivemap) - { - // update the interactive map - // to improve: make the map, so it "looks forward", means the truck is at the bottom - // to improve: use average vehicle speed, not the current one - if(interactivemap == 3) // auto - zoom - { - mtc->setCamZoom(30 + curr_truck->WheelSpeed * 0.5); - } - mtc->setCamPosition(curr_truck->getPosition(), mCamera->getOrientation()); - mtc->update(); - } -#endif // MYGUI if (cameramode==CAMERA_EXT) { if (collisions->forcecam) Modified: trunk/source/main/gameplay/RoRFrameListener.h =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/gameplay/RoRFrameListener.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -151,7 +151,6 @@ MapControl *bigMap; StaticGeometry *bakesg; - int interactivemap; int externalCameraMode; int netPointToUID; Modified: trunk/source/main/gui/MapTextureCreator.cpp =================================================================== --- trunk/source/main/gui/MapTextureCreator.cpp 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/gui/MapTextureCreator.cpp 2012-02-01 11:50:34 UTC (rev 2420) @@ -43,7 +43,7 @@ mCamera = mSceneManager->createCamera("MapRenderCam"); mViewport = mRttTex->addViewport(mCamera); - mViewport->setBackgroundColour(Ogre::ColourValue::Black); + mViewport->setBackgroundColour(Ogre::ColourValue::White); mViewport->setOverlaysEnabled(false); mMaterial = Ogre::MaterialManager::getSingleton().create("MapRttMat"+TOSTRING(mCounter), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); @@ -51,71 +51,33 @@ mTextureUnitState = mMaterial->getTechnique(0)->getPass(0)->createTextureUnitState("MapRttTex"+TOSTRING(mCounter)); mRttTex->addListener(this); - //mCamera->setProjectionType(PT_ORTHOGRAPHIC); - mZoom = 3; - - mCamera->setPosition(0, 4500, 0.0001); - mCamera->lookAt(0,0,0); - mCamera->setFarClipDistance(0); mCamera->setAspectRatio(1.0); mCamera->setFixedYawAxis(false); mCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC); - mCamera->setFOVy(Ogre::Radian(Ogre::Math::HALF_PI)); - mCamera->setNearClipDistance(mZoom); + //mCamera->setFOVy(Ogre::Radian(Ogre::Math::HALF_PI)); } -void MapTextureCreator::setTranlucency(float amount) -{ - //mTextureUnitState->setAlphaOperation(LBX_MODULATE, LBS_TEXTURE, LBS_MANUAL, 1.0, amount); -} -void MapTextureCreator::setCameraMode(Ogre::PolygonMode pm) -{ - mCamera->setPolygonMode(pm); -} - void MapTextureCreator::setStaticGeometry(Ogre::StaticGeometry *geo) { mStatics = geo; } -void MapTextureCreator::setCamZoomRel(float zoomdelta) -{ - mZoom += zoomdelta * mZoom/100; -} - -void MapTextureCreator::setCamZoom(float newzoom) -{ - mZoom = newzoom; -} - -void MapTextureCreator::setCamPosition(Ogre::Vector3 pos, Ogre::Quaternion direction) -{ - mCampos = pos; - mCamdir = direction; -} - - void MapTextureCreator::update() { // 1 = max out = total overview - if(mZoom<=0.3) - mZoom=0.3; float width = mEfl->mapsizex; float height = mEfl->mapsizez; - float zoomfactor = mZoom * ((width+height)/2) * 0.002; //LOG(TOSTRING(mZoom)); - mCamera->setNearClipDistance(mZoom); - mCamera->setPosition(mCampos + Ogre::Vector3(0, zoomfactor, 0)); - if(mCamdir != Ogre::Quaternion::ZERO) mCamera->setOrientation(mCamdir); - mCamera->lookAt(mCampos - Ogre::Vector3(0, zoomfactor, 0)); + mCamera->setOrthoWindow(1024, 1024); + mCamera->setPosition(width*0.5f, 100, height*0.5f); + mCamera->lookAt(width*0.5f + 0.0001f, 0, height*0.5f); + //mCamera->setOrientation(Quaternion(Radian(0), Vector3::UNIT_Z)); - // output the zoom factor for debug purposes - //LOG(TOSTRING(mZoom)); /* // this is bugged, so deactivated for now @@ -186,11 +148,6 @@ #endif //0 } -void MapTextureCreator::setAutoUpdated(bool value) -{ - mRttTex->setAutoUpdated(value); -} - Ogre::String MapTextureCreator::getMaterialName() { return "MapRttMat"+TOSTRING(mCounter); Modified: trunk/source/main/gui/MapTextureCreator.h =================================================================== --- trunk/source/main/gui/MapTextureCreator.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/gui/MapTextureCreator.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -29,22 +29,14 @@ MapTextureCreator(Ogre::SceneManager *smgr, Ogre::Camera *mainCam, RoRFrameListener *efl); Ogre::String getMaterialName(); Ogre::String getRTName(); - void setAutoUpdated(bool value); void update(); - void setCamPosition(Ogre::Vector3 pos, Ogre::Quaternion direction); - void setCameraMode(Ogre::PolygonMode pm); void setStaticGeometry(Ogre::StaticGeometry *geo); - void setCamZoom(float newzoom); - void setCamZoomRel(float zoomdelta); - void setTranlucency(float amount); - Ogre::Camera *getCamera() { return mMainCam; }; protected: void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); void setFogVisible(bool value); static int mCounter; - float mZoom; Ogre::Vector3 mCampos; Ogre::Quaternion mCamdir; Ogre::Viewport *mViewport; Modified: trunk/source/main/physics/BeamData.h =================================================================== --- trunk/source/main/physics/BeamData.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/physics/BeamData.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -947,7 +947,6 @@ float fuseWidth; float brakeforce; float hbrakeforce; - int dynamicMapMode; int debugVisuals; Ogre::String speedomat, tachomat; float speedoMax; Modified: trunk/source/main/physics/CmdKeyInertia.h =================================================================== --- trunk/source/main/physics/CmdKeyInertia.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/physics/CmdKeyInertia.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -54,4 +54,4 @@ }; -#endif __CmdKeyInertia_H_ +#endif // __CmdKeyInertia_H_ Modified: trunk/source/main/physics/air/turbojet.h =================================================================== --- trunk/source/main/physics/air/turbojet.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/physics/air/turbojet.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -98,4 +98,4 @@ float getAfterburner() {return (float)afterburner;}; }; -#endif __Turbojet_H_ +#endif // __Turbojet_H_ Modified: trunk/source/main/physics/collision/PointColDetector.h =================================================================== --- trunk/source/main/physics/collision/PointColDetector.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/physics/collision/PointColDetector.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -78,4 +78,4 @@ void partintwo(const int start, const int median, const int end, const int axis, float &minex, float &maxex); }; -#endif __PointColDetector_H_ +#endif // __PointColDetector_H_ Modified: trunk/source/main/physics/input_output/SerializedRig.cpp =================================================================== --- trunk/source/main/physics/input_output/SerializedRig.cpp 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/physics/input_output/SerializedRig.cpp 2012-02-01 11:50:34 UTC (rev 2420) @@ -292,7 +292,6 @@ fuseWidth=0; brakeforce=30000.0; hbrakeforce = 2*brakeforce; - dynamicMapMode = 0; debugVisuals = SETTINGS.getBooleanSetting("DebugBeams", false); shadowOptimizations = SETTINGS.getBooleanSetting("Shadow optimizations", true); @@ -4148,16 +4147,6 @@ strncpy(keyword, args[0].c_str(), 255); strncpy(value, args[1].c_str(), 255); - if(!strncmp(keyword, "interactiveOverviewMap", 255) && strnlen(value, 255) > 0) - { - dynamicMapMode = 0; - if(!strncmp(value, "off", 255)) - dynamicMapMode = 0; - else if(!strncmp(value, "simple", 255)) - dynamicMapMode = 1; - else if(!strncmp(value, "zoom", 255)) - dynamicMapMode = 2; - } if(!strncmp(keyword, "debugBeams", 255) && strnlen(value, 255) > 0) { // obsolete Modified: trunk/source/main/utils/InputEngine.cpp =================================================================== --- trunk/source/main/utils/InputEngine.cpp 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/utils/InputEngine.cpp 2012-02-01 11:50:34 UTC (rev 2420) @@ -882,24 +882,6 @@ _L("EXPERIMENTAL: save changes to the grass density image") }, { - "MAP_IN", - EV_MAP_IN, - "Keyboard EXPL+DIVIDE", - _L("zoom into the overview map in interactive mode") - }, - { - "MAP_INTERACTIVE_TOGGLE", - EV_MAP_INTERACTIVE_TOGGLE, - "Keyboard EXPL+CTRL+DIVIDE", - _L("toggle overview map interactive mode") - }, - { - "MAP_OUT", - EV_MAP_OUT, - "Keyboard EXPL+MULTIPLY", - _L("zoom into the overview map in interactive mode") - }, - { "MENU_DOWN", EV_MENU_DOWN, "Keyboard DOWN", Modified: trunk/source/main/utils/InputEngine.h =================================================================== --- trunk/source/main/utils/InputEngine.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/utils/InputEngine.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -220,9 +220,6 @@ EV_GRASS_MOST, //!< EXPERIMENTAL: set maximum amount of grass EV_GRASS_NONE, //!< EXPERIMENTAL: remove grass completely EV_GRASS_SAVE, //!< EXPERIMENTAL: save changes to the grass density image - EV_MAP_IN, //!< zoom into the overview map in interactive mode - EV_MAP_INTERACTIVE_TOGGLE, //!< toggle overview map interactive mode - EV_MAP_OUT, //!< zoom into the overview map in interactive mode EV_MENU_DOWN, //!< select next element in current category EV_MENU_LEFT, //!< select previous category EV_MENU_RIGHT, //!< select next category Modified: trunk/source/main/utils/Settings.h =================================================================== --- trunk/source/main/utils/Settings.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/utils/Settings.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -40,11 +40,11 @@ friend class RoRSingleton<Settings>; public: - Ogre::String getSetting(Ogre::String key, Ogre::String default); - int getIntegerSetting(Ogre::String key, int default); - float getFloatSetting(Ogre::String key, float default); - Ogre::UTFString getUTFSetting(Ogre::UTFString key, Ogre::UTFString default); - bool getBooleanSetting(Ogre::String key, bool default); + Ogre::String getSetting(Ogre::String key, Ogre::String defaultValue); + int getIntegerSetting(Ogre::String key, int defaultValue); + float getFloatSetting(Ogre::String key, float defaultValue); + Ogre::UTFString getUTFSetting(Ogre::UTFString key, Ogre::UTFString defaultValue); + bool getBooleanSetting(Ogre::String key, bool defaultValue); Ogre::String getSettingScriptSafe(const Ogre::String &key); void setSettingScriptSafe(const Ogre::String &key, const Ogre::String &value); Modified: trunk/source/main/utils/Singleton.h =================================================================== --- trunk/source/main/utils/Singleton.h 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/utils/Singleton.h 2012-02-01 11:50:34 UTC (rev 2420) @@ -30,7 +30,6 @@ template <class T> class RoRSingleton { - friend class RoRSingleton; static T* _instance; protected: RoRSingleton(){} @@ -65,7 +64,6 @@ template <class T> class RoRSingletonNoCreation { - friend class RoRSingletonNoCreation; static T* _instance; protected: RoRSingletonNoCreation(){} Modified: trunk/source/main/utils/language.cpp =================================================================== --- trunk/source/main/utils/language.cpp 2012-02-01 10:12:59 UTC (rev 2419) +++ trunk/source/main/utils/language.cpp 2012-02-01 11:50:34 UTC (rev 2420) @@ -106,10 +106,10 @@ else LOG("unable to read system locale!"); - if(!SSETTING("Language Short").empty()) + if(!SSETTING("Language Short", "en").empty()) { - LOG("setting new locale to " + SSETTING("Language Short")); - char *newlocale = setlocale(LC_ALL, SSETTING("Language Short").c_str()); + LOG("setting new locale to " + SSETTING("Language Short", "en")); + char *newlocale = setlocale(LC_ALL, SSETTING("Language Short", "en").c_str()); if(newlocale) LOG("new locale is: " + String(newlocale)); else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel