mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 02:45:35 +00:00
Most of AutoMove finished - just needs some speed in Player class.
This commit is contained in:
parent
3ab4a4487f
commit
bfcfcecab6
2 changed files with 67 additions and 13 deletions
|
@ -87,6 +87,9 @@ namespace MWInput
|
||||||
// Count screenshots.
|
// Count screenshots.
|
||||||
int shotCount;
|
int shotCount;
|
||||||
|
|
||||||
|
|
||||||
|
/* InputImpl Methods */
|
||||||
|
|
||||||
// Write screenshot to file.
|
// Write screenshot to file.
|
||||||
void screenshot()
|
void screenshot()
|
||||||
{
|
{
|
||||||
|
@ -101,8 +104,8 @@ namespace MWInput
|
||||||
ogre.screenshot(buf);
|
ogre.screenshot(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the user presses the button to toggle the inventory
|
|
||||||
// screen.
|
/* toggleInventory() is called when the user presses the button to toggle the inventory screen. */
|
||||||
void toggleInventory()
|
void toggleInventory()
|
||||||
{
|
{
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
@ -137,6 +140,11 @@ namespace MWInput
|
||||||
mEngine.activate();
|
mEngine.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toggleAutoMove()
|
||||||
|
{
|
||||||
|
player.setmAutoMove(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Exit program now button (which is disabled in GUI mode)
|
// Exit program now button (which is disabled in GUI mode)
|
||||||
void exitNow()
|
void exitNow()
|
||||||
{
|
{
|
||||||
|
@ -178,7 +186,8 @@ namespace MWInput
|
||||||
"Toggle console");
|
"Toggle console");
|
||||||
disp->funcs.bind(A_Activate, boost::bind(&InputImpl::activate, this),
|
disp->funcs.bind(A_Activate, boost::bind(&InputImpl::activate, this),
|
||||||
"Activate");
|
"Activate");
|
||||||
|
disp->funcs.bind(A_AutoMove, boost::bind(&InputImpl::toggleAUtoMove, this),
|
||||||
|
"Auto Move");
|
||||||
|
|
||||||
// Add the exit listener
|
// Add the exit listener
|
||||||
ogre.getRoot()->addFrameListener(&exit);
|
ogre.getRoot()->addFrameListener(&exit);
|
||||||
|
@ -245,7 +254,7 @@ namespace MWInput
|
||||||
poller.bind(A_MoveDown, KC_LCONTROL);
|
poller.bind(A_MoveDown, KC_LCONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to check for movement keys
|
//NOTE: Used to check for movement keys
|
||||||
bool frameStarted(const Ogre::FrameEvent &evt)
|
bool frameStarted(const Ogre::FrameEvent &evt)
|
||||||
{
|
{
|
||||||
// Tell OIS to handle all input events
|
// Tell OIS to handle all input events
|
||||||
|
@ -266,17 +275,35 @@ namespace MWInput
|
||||||
float moveX = 0, moveY = 0, moveZ = 0;
|
float moveX = 0, moveY = 0, moveZ = 0;
|
||||||
|
|
||||||
|
|
||||||
//TODO: Where should I put bool isAutoMoving; ?
|
/*AUTO-MOVE*/
|
||||||
//AUTO-MOVE condition
|
//TODO: double Check this.
|
||||||
//Check Automove Toggle.
|
//player.executeAutoMove((float)evt.timeSinceLastEvent);
|
||||||
//If true...apply current MoveType speed to current direction
|
|
||||||
|
|
||||||
//If any other movement key is pressed, Toggle automove.
|
|
||||||
|
|
||||||
if(poller.isDown(A_MoveLeft)) moveX -= speed;
|
if(poller.isDown(A_MoveLeft))
|
||||||
if(poller.isDown(A_MoveRight)) moveX += speed;
|
{
|
||||||
if(poller.isDown(A_MoveForward)) moveZ -= speed;
|
player.setmAutoMove(false);
|
||||||
if(poller.isDown(A_MoveBackward)) moveZ += speed;
|
moveX -= speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(poller.isDown(A_MoveRight))
|
||||||
|
{
|
||||||
|
player.setmAutoMove(false);
|
||||||
|
moveX += speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(poller.isDown(A_MoveForward))
|
||||||
|
{
|
||||||
|
player.setmAutoMove(false);
|
||||||
|
moveZ -= speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(poller.isDown(A_MoveBackward))
|
||||||
|
{
|
||||||
|
player.setmAutoMove(false);
|
||||||
|
moveZ += speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: These should be enabled for floating modes (like
|
// TODO: These should be enabled for floating modes (like
|
||||||
// swimming and levitation) and disabled for everything else.
|
// swimming and levitation) and disabled for everything else.
|
||||||
|
@ -319,6 +346,7 @@ namespace MWInput
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/***CONSTRUCTOR***/
|
||||||
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
|
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
|
||||||
MWWorld::Player &player,
|
MWWorld::Player &player,
|
||||||
MWGui::WindowManager &windows,
|
MWGui::WindowManager &windows,
|
||||||
|
@ -328,6 +356,7 @@ namespace MWInput
|
||||||
impl = new InputImpl(ogre,player,windows,debug, engine);
|
impl = new InputImpl(ogre,player,windows,debug, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***DESTRUCTOR***/
|
||||||
MWInputManager::~MWInputManager()
|
MWInputManager::~MWInputManager()
|
||||||
{
|
{
|
||||||
delete impl;
|
delete impl;
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace MWWorld
|
||||||
ESM::Class *mClass;
|
ESM::Class *mClass;
|
||||||
bool mCollisionMode;
|
bool mCollisionMode;
|
||||||
|
|
||||||
|
bool mAutoMove;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
||||||
|
@ -108,6 +110,29 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
mCollisionMode = !mCollisionMode;
|
mCollisionMode = !mCollisionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getmAutoMove()
|
||||||
|
{
|
||||||
|
return mAutoMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setmAutoMove(bool setMe)
|
||||||
|
{
|
||||||
|
mAutoMove = setMe;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <param name="duration">float value representing time since last call</param>
|
||||||
|
void executeAutoMove(float duration)
|
||||||
|
{
|
||||||
|
if (this.mAutoMove == true)
|
||||||
|
{
|
||||||
|
//No code insight! ARGH!
|
||||||
|
//Z...? Forward is Z? /boggle
|
||||||
|
//player.setspeedZ() = speed * duration * -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue