Revision: 2626
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2626&view=rev
Author:   ulteq
Date:     2012-05-22 05:18:56 +0000 (Tue, 22 May 2012)
Log Message:
-----------
-Feature: auto fading survey map

Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-22 03:15:20 UTC 
(rev 2625)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-22 05:18:56 UTC 
(rev 2626)
@@ -3051,8 +3051,41 @@
                                        if (ow) ow->showPressureOverlay(false);
                                }
 
+                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_COMMON_RESCUE_TRUCK, 0.5f) && !netmode 
&& curr_truck->driveable != AIRPLANE)
+                               {
+                                       if 
(!BeamFactory::getSingleton().enterRescueTruck())
+                                       {
+#ifdef USE_MYGUI
+                                               
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("No rescue truck found!"), "warning.png");
+#endif // USE_MYGUI
+                                       }
+                               }
 
-                       }//end of truck!=-1
+                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_BLINK_LEFT))
+                               {
+                                       if (curr_truck->getBlinkType() == 
BLINK_LEFT)
+                                               
curr_truck->setBlinkType(BLINK_NONE);
+                                       else
+                                               
curr_truck->setBlinkType(BLINK_LEFT);
+                               }
+
+                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_BLINK_RIGHT))
+                               {
+                                       if (curr_truck->getBlinkType() == 
BLINK_RIGHT)
+                                               
curr_truck->setBlinkType(BLINK_NONE);
+                                       else
+                                               
curr_truck->setBlinkType(BLINK_RIGHT);
+                               }
+
+                               if 
(INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_BLINK_WARN))
+                               {
+                                       if (curr_truck->getBlinkType() == 
BLINK_WARN)
+                                               
curr_truck->setBlinkType(BLINK_NONE);
+                                       else
+                                               
curr_truck->setBlinkType(BLINK_WARN);
+                               }
+
+                       } // end of truck!=-1
                }
 
 #ifdef USE_CAELUM
@@ -3118,14 +3151,20 @@
 #ifdef USE_MYGUI
                if (surveyMap)
                {
+                       static float alphaValue = 1.0f;
+                       float velocity = 0.0f;
+                       if (curr_truck)
+                       {
+                               velocity = 
curr_truck->nodes[0].Velocity.length();
+                       }
                        if 
(INPUTENGINE.getEventBoolValueBounce(EV_COMMON_VIEW_MAP))
                        {
                                surveyMapMode = (surveyMapMode + 1) % 
SURVEY_MAP_END;
 
-                               if (surveyMapMode == SURVEY_MAP_BIG &&
-                                       CameraManager::singletonExists() &&
+                               if (surveyMapMode == SURVEY_MAP_BIG && 
(velocity > 5.0f ||
+                                       (CameraManager::singletonExists() &&
                                        
CameraManager::getSingleton().hasActiveBehavior() &&
-                                       
CameraManager::getSingleton().getCameraBehavior() == 
CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM)
+                                       
CameraManager::getSingleton().getCameraBehavior() == 
CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM)))
                                {
                                        surveyMapMode = (surveyMapMode + 1) % 
SURVEY_MAP_END;
                                }
@@ -3142,69 +3181,44 @@
                                        {
                                                surveyMap->setPosition(0, 0, 
0.98f, mWindow);
                                        }
+                                       surveyMap->setAlpha(alphaValue);
                                        surveyMap->setVisibility(true);
                                }
                        }
                        if 
(INPUTENGINE.getEventBoolValueBounce(EV_COMMON_MAP_ALPHA))
                        {
-                               if (fabs(1.0f - surveyMap->getAlpha()) < 0.001f)
+                               if (surveyMap->getAlpha() > 0.51f)
                                {
                                        surveyMap->setAlpha(0.5f);
                                }
-                               else if (fabs(0.5f - surveyMap->getAlpha()) < 
0.001f)
+                               else if (surveyMap->getAlpha() >= 0.21f && 
surveyMap->getAlpha() <= 0.51f)
                                {
                                        surveyMap->setAlpha(0.2f);
                                }
-                               else if (fabs(0.2f - surveyMap->getAlpha()) < 
0.001f)
+                               else if (surveyMap->getAlpha() < 0.21f)
                                {
                                        surveyMap->setAlpha(1.0f);
                                }
+                               alphaValue = surveyMap->getAlpha();
                        }
                        if (surveyMapMode == SURVEY_MAP_BIG &&
                                CameraManager::singletonExists() &&
-                               
CameraManager::getSingleton().hasActiveVehicleBehavior())
+                               
CameraManager::getSingleton().hasActiveBehavior() &&
+                               
CameraManager::getSingleton().getCameraBehavior() != 
CameraManager::CAMERA_BEHAVIOR_FREE)
                        {
-                               surveyMap->setAlpha(0.5f);
-                       } else if (surveyMapMode != SURVEY_MAP_NONE)
-                       {
-                               surveyMap->setAlpha(1.0f);
+                               if (velocity > 7.5f || 
CameraManager::getSingleton().getCameraBehavior() == 
CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM)
+                               {
+                                       surveyMap->setPosition(-1, 1, 0.3f, 
mWindow);
+                                       surveyMap->setAlpha(alphaValue);
+                                       surveyMapMode = SURVEY_MAP_SMALL;
+                               } else
+                               {
+                                       surveyMap->setAlpha(1.0f / 
sqrt(std::max(1.0f, velocity - 1.0f)));
+                               }
                        }
                }
 #endif //USE_MYGUI
-               if (INPUTENGINE.getEventBoolValueBounce(EV_COMMON_RESCUE_TRUCK, 
0.5f) && curr_truck && !netmode && curr_truck->driveable != AIRPLANE)
-               {
-                       if (!BeamFactory::getSingleton().enterRescueTruck())
-                       {
-#ifdef USE_MYGUI
-                               
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("No rescue truck found!"), "warning.png");
-#endif // USE_MYGUI
-                       }
-               }
-
-               if (INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_BLINK_LEFT) && 
curr_truck)
-               {
-                       if (curr_truck->getBlinkType() == BLINK_LEFT)
-                               curr_truck->setBlinkType(BLINK_NONE);
-                       else
-                               curr_truck->setBlinkType(BLINK_LEFT);
-               }
-
-               if (INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_BLINK_RIGHT) 
&& curr_truck)
-               {
-                       if (curr_truck->getBlinkType() == BLINK_RIGHT)
-                               curr_truck->setBlinkType(BLINK_NONE);
-                       else
-                               curr_truck->setBlinkType(BLINK_RIGHT);
-               }
-
-               if (INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_BLINK_WARN) && 
curr_truck)
-               {
-                       if (curr_truck->getBlinkType() == BLINK_WARN)
-                               curr_truck->setBlinkType(BLINK_NONE);
-                       else
-                               curr_truck->setBlinkType(BLINK_WARN);
-               }
-
+               
                if 
(INPUTENGINE.getEventBoolValue(EV_COMMON_ENTER_OR_EXIT_TRUCK) && 
mTimeUntilNextToggle <= 0)
                {
                        mTimeUntilNextToggle = 0.5; //Some delay before trying 
to re-enter(exit) truck

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