mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
The player should now be able to run AND walk...
This commit is contained in:
parent
f96f53484c
commit
5aec3815fd
@ -61,6 +61,7 @@ namespace MWInput
|
|||||||
A_CycleWeaponLeft,//Cycling through weapons
|
A_CycleWeaponLeft,//Cycling through weapons
|
||||||
A_CycleWeaponRight,
|
A_CycleWeaponRight,
|
||||||
A_ToggleSneak, //Toggles Sneak, add Push-Sneak later
|
A_ToggleSneak, //Toggles Sneak, add Push-Sneak later
|
||||||
|
A_ToggleWalk, //Toggle Walking/Running
|
||||||
|
|
||||||
A_QuickSave,
|
A_QuickSave,
|
||||||
A_QuickLoad,
|
A_QuickLoad,
|
||||||
@ -145,6 +146,11 @@ namespace MWInput
|
|||||||
player.setmAutoMove(true);
|
player.setmAutoMove(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toggleWalking()
|
||||||
|
{
|
||||||
|
player.setmisWalking(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()
|
||||||
{
|
{
|
||||||
@ -188,6 +194,8 @@ namespace MWInput
|
|||||||
"Activate");
|
"Activate");
|
||||||
disp->funcs.bind(A_AutoMove, boost::bind(&InputImpl::toggleAutoMove, this),
|
disp->funcs.bind(A_AutoMove, boost::bind(&InputImpl::toggleAutoMove, this),
|
||||||
"Auto Move");
|
"Auto Move");
|
||||||
|
disp->funcs.bind(A_ToggleWalk, boost::bind(&InputImpl::toggleWalking, this),
|
||||||
|
"Toggle Walk/Run");
|
||||||
|
|
||||||
// Add the exit listener
|
// Add the exit listener
|
||||||
ogre.getRoot()->addFrameListener(&exit);
|
ogre.getRoot()->addFrameListener(&exit);
|
||||||
@ -233,6 +241,7 @@ namespace MWInput
|
|||||||
disp->bind(A_Activate, KC_SPACE);
|
disp->bind(A_Activate, KC_SPACE);
|
||||||
disp->bind(A_AutoMove, KC_Z);
|
disp->bind(A_AutoMove, KC_Z);
|
||||||
disp->bind(A_ToggleSneak, KC_X);
|
disp->bind(A_ToggleSneak, KC_X);
|
||||||
|
disp->bind(A_ToggleWalk, KC_C);
|
||||||
|
|
||||||
// Key bindings for polled keys
|
// Key bindings for polled keys
|
||||||
// NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.
|
// NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.
|
||||||
@ -271,7 +280,10 @@ namespace MWInput
|
|||||||
// Disable movement in Gui mode
|
// Disable movement in Gui mode
|
||||||
if(windows.isGuiMode()) return true;
|
if(windows.isGuiMode()) return true;
|
||||||
|
|
||||||
float speed = 300 * evt.timeSinceLastFrame;
|
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 moveX = 0, moveY = 0, moveZ = 0;
|
float moveX = 0, moveY = 0, moveZ = 0;
|
||||||
|
|
||||||
//execute Automove - condition checked in function
|
//execute Automove - condition checked in function
|
||||||
@ -279,27 +291,51 @@ namespace MWInput
|
|||||||
|
|
||||||
//Poll and execute movement keys - will disable automove if pressed.
|
//Poll and execute movement keys - will disable automove if pressed.
|
||||||
if(poller.isDown(A_MoveLeft))
|
if(poller.isDown(A_MoveLeft))
|
||||||
|
{
|
||||||
|
if (player.getmisWalking() == false)
|
||||||
{
|
{
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveX -= speed;
|
moveX -= speed;
|
||||||
|
} else {
|
||||||
|
player.setmAutoMove(false);
|
||||||
|
moveX -= TESTwalkSpeed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(poller.isDown(A_MoveRight))
|
if(poller.isDown(A_MoveRight))
|
||||||
|
{
|
||||||
|
if (player.getmisWalking() == false)
|
||||||
{
|
{
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveX += speed;
|
moveX += speed;
|
||||||
|
} else {
|
||||||
|
player.setmAutoMove(false);
|
||||||
|
moveX += TESTwalkSpeed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(poller.isDown(A_MoveForward))
|
if(poller.isDown(A_MoveForward))
|
||||||
|
{
|
||||||
|
if (player.getmisWalking() == false)
|
||||||
{
|
{
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveZ -= speed;
|
moveZ -= speed;
|
||||||
|
} else {
|
||||||
|
player.setmAutoMove(false);
|
||||||
|
moveZ -= TESTwalkSpeed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(poller.isDown(A_MoveBackward))
|
if(poller.isDown(A_MoveBackward))
|
||||||
|
{
|
||||||
|
if (player.getmisWalking() == false)
|
||||||
{
|
{
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveZ += speed;
|
moveZ += speed;
|
||||||
|
} else {
|
||||||
|
player.setmAutoMove(false);
|
||||||
|
moveZ += TESTwalkSpeed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,8 +32,9 @@ namespace MWWorld
|
|||||||
bool mCollisionMode;
|
bool mCollisionMode;
|
||||||
|
|
||||||
bool mAutoMove;
|
bool mAutoMove;
|
||||||
bool misSneaking;
|
//bool misSneaking;
|
||||||
bool misHidden;
|
//bool misHidden;
|
||||||
|
bool misWalking; //Testing...
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -134,6 +135,17 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getmisWalking()
|
||||||
|
{
|
||||||
|
return this.misWalking;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setmisWalking(bool setMe)
|
||||||
|
{
|
||||||
|
this.misWalking = setMe;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user