diff --git a/apps/openmw/mwinput/inputmanager.cpp b/apps/openmw/mwinput/inputmanager.cpp index 009dd635f..1cc6eca2a 100644 --- a/apps/openmw/mwinput/inputmanager.cpp +++ b/apps/openmw/mwinput/inputmanager.cpp @@ -94,7 +94,7 @@ namespace MWInput // Write screenshot to file. void screenshot() { - + // Find the first unused filename with a do-while char buf[50]; do @@ -105,7 +105,7 @@ namespace MWInput ogre.screenshot(buf); } - + /* toggleInventory() is called when the user presses the button to toggle the inventory screen. */ void toggleInventory() { @@ -141,19 +141,19 @@ namespace MWInput mEngine.activate(); } - void toggleAutoMove() + void toggleAutoMove() { - if (player.getAutoMove() == false) - { - player.setAutoMove(true); - } else { - player.setAutoMove(false); - } - } + if (player.getAutoMove() == false) + { + player.setAutoMove(true); + } else { + player.setAutoMove(false); + } + } - void toggleWalking() + void toggleWalking() { - player.setisWalking(true); + player.setisWalking(true); } // Exit program now button (which is disabled in GUI mode) @@ -285,39 +285,38 @@ namespace MWInput // Disable movement in Gui mode if(windows.isGuiMode()) return true; - float speed = 300 * evt.timeSinceLastFrame; //placeholder player speed? + float speed = 300 * evt.timeSinceLastFrame; //placeholder player speed? //float TESTwalkSpeed = 100 * evt.timeSinceLastFrame; //How about another? float moveX = 0, moveY = 0, moveZ = 0; - + //execute Automove - condition checked in function player.executeAutoMove((float)evt.timeSinceLastFrame); //or since last frame? - + //Poll and execute movement keys - will disable automove if pressed. - if(poller.isDown(A_MoveLeft)) - { - player.setAutoMove(false); + if(poller.isDown(A_MoveLeft)) + { + player.setAutoMove(false); moveX -= speed; - } - if(poller.isDown(A_MoveRight)) - { - player.setAutoMove(false); + if(poller.isDown(A_MoveRight)) + { + player.setAutoMove(false); moveX += speed; } if(poller.isDown(A_MoveForward)) - { + { player.setAutoMove(false); moveZ -= speed; - } + } if(poller.isDown(A_MoveBackward)) - { - player.setAutoMove(false); - moveZ += speed; - } + { + player.setAutoMove(false); + moveZ += speed; + } // TODO: These should be enabled for floating modes (like diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index e46bda486..5174c2d33 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -31,8 +31,8 @@ namespace MWWorld ESM::Class *mClass; bool mCollisionMode; - bool mAutoMove; - bool misWalking; //Testing... + bool mAutoMove; + bool misWalking;//Testing... public: @@ -112,44 +112,38 @@ namespace MWWorld mCollisionMode = !mCollisionMode; } - bool getAutoMove() - { - return mAutoMove; - } - - void setAutoMove(bool setMe) - { - mAutoMove = setMe; - } - - //NOTE: we don't have speed being calculated yet, so for now this function only requires a frame duration. - /// float value representing time since last call - void executeAutoMove(float duration) + bool getAutoMove() { - float X_Val = 0.0f; - float Y_Val = 0.0f; - float Z_Val = 300.0f * duration * -1.0f; - if (mAutoMove == true) - { - //if player is running - //Make player go at full speed - moveRel(X_Val, Y_Val, Z_Val); - //else go forward at walk speed. - } - } + return mAutoMove; + } - bool getisWalking() - { - return misWalking; - } + void setAutoMove(bool setMe) + { + mAutoMove = setMe; + } - void setisWalking(bool setMe) - { - misWalking = setMe; - } +//NOTE: we don't have speed being calculated yet, so for now this function only requires a frame duration. +/// float value representing time since last call + void executeAutoMove(float duration) + { + float X_Val = 0.0f; + float Y_Val = 0.0f; + float Z_Val = 300.0f * duration * -1.0f; + if (mAutoMove == true) + { + moveRel(X_Val, Y_Val, Z_Val); + } + } + bool getisWalking() + { + return misWalking; + } - - }; + void setisWalking(bool setMe) + { + misWalking = setMe; + } + }; } #endif