Revision: 2792 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2792&view=rev Author: ulteq Date: 2012-06-07 11:59:10 +0000 (Thu, 07 Jun 2012) Log Message: ----------- -Codechange: IBehaviorManager is derived from IManager now. +gameControlsLocked() now part of IBehaviorManager
Modified Paths: -------------- trunk/source/main/gameplay/Character.cpp trunk/source/main/gameplay/RoRFrameListener.cpp trunk/source/main/gfx/camera/CameraManager.cpp trunk/source/main/gfx/camera/CameraManager.h trunk/source/main/physics/Beam.cpp trunk/source/main/utils/IBehaviorManager.h trunk/source/main/utils/IManager.h Modified: trunk/source/main/gameplay/Character.cpp =================================================================== --- trunk/source/main/gameplay/Character.cpp 2012-06-07 10:02:14 UTC (rev 2791) +++ trunk/source/main/gameplay/Character.cpp 2012-06-07 11:59:10 UTC (rev 2792) @@ -276,7 +276,7 @@ { // disable character movement when using the free camera mode or when the menu is opened // TODO: check for menu being opened - if (gEnv->cameraManager && !gEnv->cameraManager->gameControlsEnabled()) return; + if (gEnv->cameraManager && gEnv->cameraManager->gameControlsLocked()) return; // small hack: if not visible do not apply physics Vector3 position = mCharacterNode->getPosition(); Modified: trunk/source/main/gameplay/RoRFrameListener.cpp =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.cpp 2012-06-07 10:02:14 UTC (rev 2791) +++ trunk/source/main/gameplay/RoRFrameListener.cpp 2012-06-07 11:59:10 UTC (rev 2792) @@ -1475,7 +1475,7 @@ if (loading_state==ALL_LOADED || loading_state == TERRAIN_EDITOR) { - if (gEnv->cameraManager && gEnv->cameraManager->gameControlsEnabled()) + if (gEnv->cameraManager && !gEnv->cameraManager->gameControlsLocked()) { if (!curr_truck) { @@ -2448,7 +2448,7 @@ surveyMapMode == SURVEY_MAP_BIG && gEnv->cameraManager && gEnv->cameraManager->hasActiveBehavior() && - gEnv->cameraManager->gameControlsEnabled()) + !gEnv->cameraManager->gameControlsLocked()) { if (velocity > 7.5f || gEnv->cameraManager->getCurrentBehavior() == CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM) { Modified: trunk/source/main/gfx/camera/CameraManager.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraManager.cpp 2012-06-07 10:02:14 UTC (rev 2791) +++ trunk/source/main/gfx/camera/CameraManager.cpp 2012-06-07 11:59:10 UTC (rev 2792) @@ -71,11 +71,11 @@ globalBehaviors.clear(); } -void CameraManager::update(float dt) +bool CameraManager::update(float dt) { static std::stack<int> precedingBehaviors; - if ( dt == 0 ) return; + if ( dt == 0 ) return false; mTransScale = mTransSpeed * dt; mRotScale = mRotateSpeed * dt; @@ -125,6 +125,8 @@ { switchBehavior(CAMERA_BEHAVIOR_CHARACTER); } + + return true; } void CameraManager::switchToNextBehavior(bool force /* = true */) @@ -233,8 +235,14 @@ return currentBehavior->mouseReleased(ctx, _arg, _id); } -bool CameraManager::gameControlsEnabled() +bool CameraManager::gameControlsLocked() { // game controls are only disabled in free camera mode for now - return (currentBehaviorID != CAMERA_BEHAVIOR_FREE); + return (currentBehaviorID == CAMERA_BEHAVIOR_FREE); } + +size_t CameraManager::getMemoryUsage() +{ + // TODO + return 0; +} Modified: trunk/source/main/gfx/camera/CameraManager.h =================================================================== --- trunk/source/main/gfx/camera/CameraManager.h 2012-06-07 10:02:14 UTC (rev 2791) +++ trunk/source/main/gfx/camera/CameraManager.h 2012-06-07 11:59:10 UTC (rev 2792) @@ -62,19 +62,22 @@ CAMERA_BEHAVIOR_ISOMETRIC }; - void update(float dt); + bool update(float dt); void switchBehavior(int newBehavior, bool reset = true); void switchToNextBehavior(bool force = true); void toggleBehavior(int behavior); - bool gameControlsEnabled(); + bool gameControlsLocked(); bool hasActiveBehavior(); bool hasActiveCharacterBehavior(); bool hasActiveVehicleBehavior(); int getCurrentBehavior(); + size_t getMemoryUsage(); + void freeResources() {}; + protected: CameraContext ctx; Modified: trunk/source/main/physics/Beam.cpp =================================================================== --- trunk/source/main/physics/Beam.cpp 2012-06-07 10:02:14 UTC (rev 2791) +++ trunk/source/main/physics/Beam.cpp 2012-06-07 11:59:10 UTC (rev 2792) @@ -5669,7 +5669,7 @@ if (driveable != TRUCK || !gEnv->cameraManager || !gEnv->cameraManager->hasActiveBehavior() || - gEnv->cameraManager->gameControlsEnabled()) + !gEnv->cameraManager->gameControlsLocked()) { return; } Modified: trunk/source/main/utils/IBehaviorManager.h =================================================================== --- trunk/source/main/utils/IBehaviorManager.h 2012-06-07 10:02:14 UTC (rev 2791) +++ trunk/source/main/utils/IBehaviorManager.h 2012-06-07 11:59:10 UTC (rev 2792) @@ -17,23 +17,24 @@ You should have received a copy of the GNU General Public License along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __IBehaviorManager_H__ -#define __IBehaviorManager_H__ +#ifndef __I_BehaviorManager_H__ +#define __I_BehaviorManager_H__ #include "RoRPrerequisites.h" -class IBehaviorManager : public ZeroedMemoryAllocator +#include "IManager.h" + +class IBehaviorManager : public IManager { public: virtual ~IBehaviorManager() {} - virtual void update(float dt) = 0; - virtual void switchBehavior(int newBehavior, bool reset = true) = 0; virtual void switchToNextBehavior(bool force = true) = 0; virtual void toggleBehavior(int behavior) = 0; + virtual bool gameControlsLocked() = 0; virtual bool hasActiveBehavior() = 0; virtual bool hasActiveCharacterBehavior() = 0; virtual bool hasActiveVehicleBehavior() = 0; @@ -41,4 +42,4 @@ virtual int getCurrentBehavior() = 0; }; -#endif // __IBehaviorManager_H__ +#endif // __I_BehaviorManager_H__ Modified: trunk/source/main/utils/IManager.h =================================================================== --- trunk/source/main/utils/IManager.h 2012-06-07 10:02:14 UTC (rev 2791) +++ trunk/source/main/utils/IManager.h 2012-06-07 11:59:10 UTC (rev 2792) @@ -17,14 +17,15 @@ You should have received a copy of the GNU General Public License along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef IMANAGER_H__ -#define IMANAGER_H__ +#ifndef __I_Manager_H_ +#define __I_Manager_H_ #include "RoRPrerequisites.h" class IManager : public ZeroedMemoryAllocator { public: + virtual ~IManager() {} virtual bool update(float dt) = 0; @@ -32,4 +33,4 @@ virtual void freeResources() = 0; }; -#endif // IMANAGER_H__ +#endif // __I_Manager_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