Revision: 2607 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2607&view=rev Author: ulteq Date: 2012-05-20 02:19:14 +0000 (Sun, 20 May 2012) Log Message: ----------- -Bugfix: Survey map (WIP) added proper enum for survey map modes disabled big survey map in cinecam behavior reduced alpha value for big survey map in vehicles behaviors
Modified Paths: -------------- trunk/source/main/gameplay/RoRFrameListener.cpp trunk/source/main/gameplay/RoRFrameListener.h Modified: trunk/source/main/gameplay/RoRFrameListener.cpp =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-20 02:14:23 UTC (rev 2606) +++ trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-20 02:19:14 UTC (rev 2607) @@ -735,15 +735,14 @@ // Constructor takes a RenderWindow because it uses that to determine input context RoRFrameListener::RoRFrameListener(AppState *parentState, RenderWindow* win, Camera* cam, SceneManager* scm, Root* root, bool isEmbedded, Ogre::String inputhwnd) : - bigMap(0), clutch(0), collisions(0), dashboard(0), debugCollisions(false), + dof(0), editor(0), editorfd(0), envmap(0), - dof(0), flaresMode(3), // on by default forcefeedback(0), freeTruckPosition(false), @@ -765,7 +764,6 @@ mTimeUntilNextToggle(0), mTruckInfoOn(false), mWindow(win), - mapMode(0), mapsizex(3000), mapsizez(3000), mtc(0), @@ -788,6 +786,8 @@ road(0), rtime(0), shaderSchemeMode(1), + surveyMap(0), + surveyMapMode(SURVEY_MAP_NONE), terrainFileHash(""), terrainFileName(""), terrainHasTruckShop(false), @@ -1040,7 +1040,7 @@ NetworkStreamManager::getSingleton(); // new factory for characters, net is INVALID, will be set later - new CharacterFactory(cam, 0, collisions, hfinder, w, bigMap, mSceneMgr); + new CharacterFactory(cam, 0, collisions, hfinder, w, surveyMap, mSceneMgr); new ChatSystemFactory(0); // notice: all factories must be available before starting the network! @@ -1820,7 +1820,7 @@ //add icons if type is set #ifdef USE_MYGUI String typestr = ""; - if (type && bigMap) + if (type && surveyMap) { typestr = String(type); // hack for raceways @@ -1833,7 +1833,7 @@ if (typestr != String("") && typestr != String("road") && typestr != String("sign")) { - MapEntity *e = bigMap->createMapEntity(typestr); + MapEntity *e = surveyMap->createMapEntity(typestr); if (e) { e->setVisibility(true); @@ -3061,55 +3061,59 @@ } #ifdef USE_MYGUI - if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_VIEW_MAP)) + if (surveyMap) { - if (bigMap) + if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_VIEW_MAP)) { - mapMode++; - if (mapMode>2) - mapMode=0; + surveyMapMode = (surveyMapMode + 1) % SURVEY_MAP_END; - if (mapMode==0) + if (surveyMapMode == SURVEY_MAP_BIG && + CameraManager::singletonExists() && + CameraManager::getSingleton().hasActiveBehavior() && + CameraManager::getSingleton().getCameraBehavior() == CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM) { - bigMap->setVisibility(true); - if (CameraManager::singletonExists() && - CameraManager::getSingleton().hasActiveBehavior() && - CameraManager::getSingleton().getCameraBehavior() != CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM) - { - //make it small again - bigMap->updateRenderMetrics(mWindow); - bigMap->setPosition(0, 0.81, 0.14, 0.19, mWindow); - } - } else if (mapMode==1) + surveyMapMode = (surveyMapMode + 1) % SURVEY_MAP_END; + } + + if (surveyMapMode == SURVEY_MAP_NONE) { - bigMap->setVisibility(true); - // make it big - bigMap->updateRenderMetrics(mWindow); - bigMap->setPosition(0.2, 0, 0.8, 0.8, mWindow); + surveyMap->setVisibility(false); } else { - bigMap->setVisibility(false); + if (surveyMapMode == SURVEY_MAP_SMALL) + { + surveyMap->setPosition(0, 0.81, 0.14, 0.19, mWindow); + } else if (surveyMapMode == SURVEY_MAP_BIG) + { + surveyMap->setPosition(0.2, 0, 0.8, 0.8, mWindow); + } + surveyMap->setVisibility(true); } } - - } - if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_MAP_ALPHA)) - { - if (bigMap) + if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_MAP_ALPHA)) { - if (fabs(1-bigMap->getAlpha()) < 0.001) + if (fabs(1.0f - surveyMap->getAlpha()) < 0.001f) { - bigMap->setAlpha(0.5); + surveyMap->setAlpha(0.5f); } - else if (fabs(0.5-bigMap->getAlpha()) < 0.001) + else if (fabs(0.5f - surveyMap->getAlpha()) < 0.001f) { - bigMap->setAlpha(0.2); + surveyMap->setAlpha(0.2f); } - else if (fabs(0.2-bigMap->getAlpha()) < 0.001) + else if (fabs(0.2f - surveyMap->getAlpha()) < 0.001f) { - bigMap->setAlpha(1); + surveyMap->setAlpha(1.0f); } } + if (surveyMapMode == SURVEY_MAP_BIG && + CameraManager::singletonExists() && + CameraManager::getSingleton().hasActiveVehicleBehavior()) + { + surveyMap->setAlpha(0.5f); + } else if (surveyMapMode != SURVEY_MAP_NONE) + { + surveyMap->setAlpha(1.0f); + } } #endif //USE_MYGUI if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_RESCUE_TRUCK, 0.5f) && curr_truck && !netmode && curr_truck->driveable != AIRPLANE) @@ -3267,9 +3271,9 @@ freeTruckPosition=false; // reset this, only to be used once } - if (bigMap && localTruck) + if (surveyMap && localTruck) { - MapEntity *e = bigMap->createNamedMapEntity("Truck"+TOSTRING(localTruck->trucknum), MapControl::getTypeByDriveable(localTruck->driveable)); + MapEntity *e = surveyMap->createNamedMapEntity("Truck"+TOSTRING(localTruck->trucknum), MapControl::getTypeByDriveable(localTruck->driveable)); if (e) { e->setState(DESACTIVATED); @@ -3422,8 +3426,8 @@ void RoRFrameListener::hideMap() { #ifdef USE_MYGUI - if (bigMap) - bigMap->setVisibility(false); + if (surveyMap) + surveyMap->setVisibility(false); #endif //USE_MYGUI } @@ -3439,15 +3443,7 @@ // init the map if (!disableMap) { - bigMap = new MapControl((int)mapsizex, (int)mapsizez); - // important: update first! - bigMap->updateRenderMetrics(mWindow); - bigMap->setVisibility(true); - //make it small again - bigMap->updateRenderMetrics(mWindow); - bigMap->setPosition(0, 0.81, 0.14, 0.19, mWindow); - //bigMap->setPosition(0, 0, 1, 1); - //bigMap->resizeToScreenRatio(win); + surveyMap = new MapControl((int)mapsizex, (int)mapsizez); } #endif //USE_MYGUI @@ -3781,8 +3777,8 @@ if (tmpSize != String("")) mapsizez = atof(tmpSize.c_str()); #ifdef USE_MYGUI - if (bigMap) - bigMap->setWorldSize(mapsizex, mapsizez); + if (surveyMap) + surveyMap->setWorldSize(mapsizex, mapsizez); #endif //MYGUI if (!newTerrainMode && !disableTetrrain) @@ -4352,11 +4348,10 @@ if (spl.rot != Quaternion::ZERO) mCamera->setOrientation(spl.rot); #ifdef USE_MYGUI - if (bigMap) + if (surveyMap) { mtc = new MapTextureCreator(mSceneMgr, mCamera, this); - bigMap->setVisibility(false); - bigMap->setMapTexture(mtc->getRTName()); + surveyMap->setMapTexture(mtc->getRTName()); } #endif //USE_MYGUI @@ -4970,13 +4965,6 @@ #ifdef USE_MYGUI LoadingWindow::getSingleton().hide(); - - if (bigMap) - { - // this has a slight offset in size, thus forces the icons to recalc their size -> correct size on screen - bigMap->updateRenderMetrics(mWindow); - bigMap->setPosition(0, 0.81, 0.14, 0.1901, mWindow); - } #endif //MYGUI #if 0 @@ -5060,9 +5048,9 @@ } #ifdef USE_MYGUI - if (b && bigMap) + if (b && surveyMap) { - MapEntity *e = bigMap->createNamedMapEntity("Truck"+TOSTRING(b->trucknum), MapControl::getTypeByDriveable(b->driveable)); + MapEntity *e = surveyMap->createNamedMapEntity("Truck"+TOSTRING(b->trucknum), MapControl::getTypeByDriveable(b->driveable)); if (e) { e->setState(DESACTIVATED); @@ -5087,9 +5075,9 @@ { Beam *b = BeamFactory::getSingleton().createLocal(Vector3(truck_preload[i].px, truck_preload[i].py, truck_preload[i].pz), truck_preload[i].rotation, truck_preload[i].name, 0, truck_preload[i].ismachine, flaresMode, truckconfig, 0, truck_preload[i].freePosition); #ifdef USE_MYGUI - if (b && bigMap) + if (b && surveyMap) { - MapEntity *e = bigMap->createNamedMapEntity("Truck"+TOSTRING(b->trucknum), MapControl::getTypeByDriveable(b->driveable)); + MapEntity *e = surveyMap->createNamedMapEntity("Truck"+TOSTRING(b->trucknum), MapControl::getTypeByDriveable(b->driveable)); if (e) { e->setState(DESACTIVATED); @@ -5253,16 +5241,6 @@ ow->showEditorOverlay(currentTruck->editorId>=0); } - // mapmode change? -#ifdef USE_MYGUI - // show minimap and put it into lower left corner - if (bigMap) - { - //bigMap->setVisibility(true); - bigMap->setPosition(0, 0.81, 0.14, 0.19, mWindow); - } -#endif //USE_MYGUI - currentTruck->activate(); //if (trucks[current_truck]->engine->running) trucks[current_truck]->audio->playStart(); //hide unused items @@ -5444,7 +5422,7 @@ #endif // USE_CAELUM } else { - envmap->update(Vector3(terrainxsize/2.0, hfinder->getHeightAt(terrainxsize/2.0, terrainzsize/2.0)+50.0, terrainzsize/2.0)); + envmap->update(Vector3(terrainxsize / 2.0f, hfinder->getHeightAt(terrainxsize / 2.0f, terrainzsize / 2.0f ) + 50.0f, terrainzsize / 2.0f)); } } @@ -5628,9 +5606,9 @@ // TODO: fix that below! //removeTruck(number); #ifdef USE_MYGUI - if (bigMap) + if (surveyMap) { - MapEntity *e = bigMap->getEntityByName("Truck"+TOSTRING(number)); + MapEntity *e = surveyMap->getEntityByName("Truck"+TOSTRING(number)); if (e) e->setVisibility(false); } Modified: trunk/source/main/gameplay/RoRFrameListener.h =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.h 2012-05-20 02:14:23 UTC (rev 2606) +++ trunk/source/main/gameplay/RoRFrameListener.h 2012-05-20 02:19:14 UTC (rev 2607) @@ -80,8 +80,8 @@ int loading_state; - enum { NONE_LOADED, TERRAIN_LOADED, ALL_LOADED, EXITING, EDITING, RELOADING, EDITOR_PAUSE }; - enum { EVENT_NONE, EVENT_ALL, EVENT_AVATAR, EVENT_TRUCK, EVENT_AIRPLANE, EVENT_DELETE }; + enum LoadingStatuses { NONE_LOADED, TERRAIN_LOADED, ALL_LOADED, EXITING, EDITING, RELOADING, EDITOR_PAUSE }; + enum SurveyMapTypes { SURVEY_MAP_NONE, SURVEY_MAP_SMALL, SURVEY_MAP_BIG, SURVEY_MAP_END}; protected: @@ -90,7 +90,7 @@ float px; float py; float pz; - // float ry; + //float ry; Ogre::Quaternion rotation; char name[256]; bool ismachine; @@ -154,7 +154,7 @@ HDRListener *hdrListener; HeatHaze *heathaze; MOC::CollisionTools *mCollisionTools; - MapControl *bigMap; + MapControl *surveyMap; MapTextureCreator *mtc; Network *net; @@ -214,7 +214,7 @@ int inputGrabMode; int joyshiftlock; int mStatsOn; - int mapMode; + int surveyMapMode; int mouseGrabState; int netPointToUID; int nodegrabbed; @@ -257,28 +257,6 @@ void windowClosed(Ogre::RenderWindow* rw); void windowFocusChange(Ogre::RenderWindow* rw); - //GUI_TruckTool *truckToolGUI; - //GUI_MainMenu *mainmenu; - //GUI_Progress *gui_progress; - - //SceneNode *speed_node; - //SceneNode *tach_node; - //SceneNode *roll_node; - //SceneNode *pitch_node; - //SceneNode *rollcorr_node; - - //bool usejoy; - //bool useforce; - //BeamJoystick *joy; - - //SceneNode *personode; - //AnimationState *persoanim; - //float persoangle; - //float persospeed; - //float persovspeed; - //bool perso_canjump; - //Vector3 lastpersopos; - private: int net_quality; @@ -312,7 +290,6 @@ int getLoadingState() { return loading_state; }; int getNetPointToUID() { return netPointToUID; }; - void RTSSgenerateShaders(Ogre::Entity *entity, Ogre::String normalTextureName); void changedCurrentTruck(Beam *previousTruck, Beam *currentTruck); void checkRemoteStreamResultsChanged(); void hideGUI(bool visible); @@ -326,6 +303,7 @@ void pauseSim(bool value); void reloadCurrentTruck(); void removeBeam(Beam *); + void RTSSgenerateShaders(Ogre::Entity *entity, Ogre::String normalTextureName); void setDirectionArrow(char *text, Ogre::Vector3 position); void setLoadingState(int value); void setNetPointToUID(int uid); 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