Revision: 2476 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2476&view=rev Author: rorthomas Date: 2012-03-16 20:03:38 +0000 (Fri, 16 Mar 2012) Log Message: ----------- noticed bug in soundscriptmanager improved cameramanager a bit, NOT USEABLE YET
Modified Paths: -------------- trunk/source/main/audio/SoundScriptManager.cpp trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp trunk/source/main/gfx/camera/CameraManager.cpp trunk/source/main/gfx/camera/CameraManager.h Modified: trunk/source/main/audio/SoundScriptManager.cpp =================================================================== --- trunk/source/main/audio/SoundScriptManager.cpp 2012-03-16 13:26:32 UTC (rev 2475) +++ trunk/source/main/audio/SoundScriptManager.cpp 2012-03-16 20:03:38 UTC (rev 2476) @@ -44,7 +44,17 @@ free_pitches[i]=0; free_gains[i]=0; } - + + // TODO: there is a memory corruption going on here, need to fix + for(int i=0; i < SS_MAX_TRIG * MAX_INSTANCES_PER_GROUP; i++) + trigs[i] = 0; + + for(int i=0; i < SS_MAX_MOD * MAX_INSTANCES_PER_GROUP; i++) + pitches[i] = 0; + + for(int i=0; i < SS_MAX_MOD * MAX_INSTANCES_PER_GROUP; i++) + gains[i] = 0; + // reset all states statemap.clear(); Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp 2012-03-16 13:26:32 UTC (rev 2475) +++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp 2012-03-16 20:03:38 UTC (rev 2476) @@ -31,7 +31,7 @@ using namespace Ogre; CameraBehaviorVehicleSpline::CameraBehaviorVehicleSpline() : - splinePos(0) + splinePos(0.5f) , myManualObject(0) , myManualObjectNode(0) , spline(new SimpleSpline()) Modified: trunk/source/main/gfx/camera/CameraManager.cpp =================================================================== --- trunk/source/main/gfx/camera/CameraManager.cpp 2012-03-16 13:26:32 UTC (rev 2475) +++ trunk/source/main/gfx/camera/CameraManager.cpp 2012-03-16 20:03:38 UTC (rev 2476) @@ -44,14 +44,15 @@ mSceneMgr(scm) , mCamera(cam) , currentBehavior(0) + , currentBehaviorID(-1) // TODO: initialize other vars here { setSingleton(this); lastcameramode=CAMERA_EXT; cameramode=CAMERA_EXT; - mMoveScale = 0.0f; - mRotScale = 0.0f; + mMoveScale = 1.0f; + mRotScale = 0.1f; lastPosition = Vector3::ZERO; camCollided=false; camPosColl=Vector3::ZERO; @@ -236,6 +237,14 @@ #endif // 0 } +void CameraManager::switchToNextBehavior() +{ + int i = currentBehaviorID + 1; + if(i >= CAMBEHAVIOR_END) + i=0; + switchBehavior(i); +} + void CameraManager::switchBehavior(int newBehavior) { if(globalBehaviors.find(newBehavior) == globalBehaviors.end()) return; @@ -246,6 +255,7 @@ // set new currentBehavior = globalBehaviors[newBehavior]; + currentBehaviorID = newBehavior; // activate new currentBehavior->activate(ctx); @@ -253,22 +263,15 @@ void CameraManager::update(float dt) { + if (dt == 0) return; - // If this is the first frame, pick a speed - if (dt == 0) + mMoveScale = mMoveSpeed * dt; + mRotScale = mRotateSpeed * dt; + + if(INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_CHANGE)) { - mMoveScale = 1; - mRotScale = 0.1; + switchToNextBehavior(); } - // Otherwise scale movement units by time passed since last frame - else - { - // Move about 100 units per second, - mMoveScale = mMoveSpeed * dt; - // Take about 10 seconds for full rotation - mRotScale = mRotateSpeed * dt; - } - #ifdef MYGUI if (SceneMouse::getSingleton().isMouseGrabbed()) return; //freeze camera #endif //MYGUI Modified: trunk/source/main/gfx/camera/CameraManager.h =================================================================== --- trunk/source/main/gfx/camera/CameraManager.h 2012-03-16 13:26:32 UTC (rev 2475) +++ trunk/source/main/gfx/camera/CameraManager.h 2012-03-16 20:03:38 UTC (rev 2476) @@ -55,6 +55,7 @@ cameraContext_t ctx; CameraBehavior *currentBehavior; + int currentBehaviorID; enum { CAMBEHAVIOR_FREE , CAMBEHAVIOR_CHARACTER_ORBIT @@ -76,6 +77,7 @@ void updateInput(); void switchBehavior(int newBehavior); + void switchToNextBehavior(); enum { CAMERA_EXT=0, CAMERA_FIX, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel