From 1bc9a46c6b2721fff7695f000a1f9a44aeddbc73 Mon Sep 17 00:00:00 2001 From: Star-Demon Date: Mon, 17 Jan 2011 15:48:12 -0500 Subject: [PATCH] Cleaned up and changed executeAutoMove() --- apps/openmw/mwinput/inputmanager.cpp | 37 +++++++++++++------------ apps/openmw/mwworld/player.cpp | 1 + apps/openmw/mwworld/player.hpp | 40 +++++++++++----------------- 3 files changed, 35 insertions(+), 43 deletions(-) diff --git a/apps/openmw/mwinput/inputmanager.cpp b/apps/openmw/mwinput/inputmanager.cpp index 6e8cb6b2e..cd2c46715 100644 --- a/apps/openmw/mwinput/inputmanager.cpp +++ b/apps/openmw/mwinput/inputmanager.cpp @@ -280,38 +280,37 @@ namespace MWInput // Disable movement in Gui mode if(windows.isGuiMode()) return true; - float speed = 300 * evt.timeSinceLastFrame; //is this a placeholder player speed? - float TESTwalkSpeed = 100 * evt.timeSinceLastFrame; //Try this, then. - //float TESTsneakSpeed = 100 * evt.timeSinceLastFrame; //and this. + 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.timeSinceLastEvent); //or since last frame? - + player.executeAutoMove((float)evt.timeSinceLastFrame); //or since last frame? + //Poll and execute movement keys - will disable automove if pressed. if(poller.isDown(A_MoveLeft)) { if (player.getmisWalking() == false) - { + { player.setmAutoMove(false); moveX -= speed; - } else { - player.setmAutoMove(false); + } else { + player.setmAutoMove(false); moveX -= TESTwalkSpeed; - } + } } if(poller.isDown(A_MoveRight)) { - if (player.getmisWalking() == false) - { + if (player.getmisWalking() == false) + { player.setmAutoMove(false); moveX += speed; - } else { - player.setmAutoMove(false); + } else { + player.setmAutoMove(false); moveX += TESTwalkSpeed; - } + } } if(poller.isDown(A_MoveForward)) @@ -328,14 +327,14 @@ namespace MWInput if(poller.isDown(A_MoveBackward)) { - if (player.getmisWalking() == false) - { + if (player.getmisWalking() == false) + { player.setmAutoMove(false); moveZ += speed; - } else { - player.setmAutoMove(false); + } else { + player.setmAutoMove(false); moveZ += TESTwalkSpeed; - } + } } diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index d0d0e0022..b0805269d 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -63,4 +63,5 @@ namespace MWWorld delete mClass; mClass = new_class; } + } diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 972ab7c88..fc2597d89 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -32,8 +32,6 @@ namespace MWWorld bool mCollisionMode; bool mAutoMove; - //bool misSneaking; - //bool misHidden; bool misWalking; //Testing... public: @@ -114,33 +112,27 @@ namespace MWWorld mCollisionMode = !mCollisionMode; } - bool getmAutoMove() + bool getmAutoMove() { return mAutoMove; - } + } - void setmAutoMove(bool setMe) - { - mAutoMove = setMe; - } - - /// float value representing time since last call - void executeAutoMove(float duration) //call by value for MoveZ makes this harder. - { - if (mAutoMove == true) - { - //TODO: Make player go. - /*Access moveZ, access walking/running speed, -1 is for correct direction, - otherwise you end up running backwards - not a bad idea for a future feature, actually...*/ - /* - if (this.misWalking == false) + void setmAutoMove(bool setMe) { - //inputmanager.moveZ = 300 * duration * -1; - } else { - //inputmanager.moveZ = 100 * duration * -1; + 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) + { + if (mAutoMove == true) + { + //if player is running + //Make player go at full speed + //player.moveRel(0, 0, (300*duration*-1)); + //else go forward at walk speed. + } } bool getmisWalking()