|
|
|
@ -41,27 +41,25 @@ namespace MWInput
|
|
|
|
|
|
|
|
|
|
A_MoveLeft, // Move player left / right
|
|
|
|
|
A_MoveRight,
|
|
|
|
|
A_MoveUp, // Move up / down
|
|
|
|
|
A_MoveDown,
|
|
|
|
|
A_MoveForward, // Forward / Backward
|
|
|
|
|
A_MoveBackward,
|
|
|
|
|
|
|
|
|
|
A_Activate,
|
|
|
|
|
|
|
|
|
|
A_Use, //Use weapon, spell, etc.
|
|
|
|
|
A_Use, //Use weapon, spell, etc.
|
|
|
|
|
A_Jump,
|
|
|
|
|
A_AutoMove, //Toggle Auto-move forward
|
|
|
|
|
A_Rest, //Rest
|
|
|
|
|
A_Journal, //Journal
|
|
|
|
|
A_Weapon, //Draw/Sheath weapon
|
|
|
|
|
A_Spell, //Ready/Unready Casting
|
|
|
|
|
A_AlwaysRun, //Toggle Always Run
|
|
|
|
|
A_AutoMove, //Toggle Auto-move forward
|
|
|
|
|
A_Rest, //Rest
|
|
|
|
|
A_Journal, //Journal
|
|
|
|
|
A_Weapon, //Draw/Sheath weapon
|
|
|
|
|
A_Spell, //Ready/Unready Casting
|
|
|
|
|
A_AlwaysRun, //Toggle Always Run
|
|
|
|
|
A_CycleSpellLeft, //cycling through spells
|
|
|
|
|
A_CycleSpellRight,
|
|
|
|
|
A_CycleWeaponLeft,//Cycling through weapons
|
|
|
|
|
A_CycleWeaponRight,
|
|
|
|
|
A_ToggleSneak, //Toggles Sneak, add Push-Sneak later
|
|
|
|
|
A_ToggleWalk, //Toggle Walking/Running
|
|
|
|
|
A_ToggleSneak, //Toggles Sneak, add Push-Sneak later
|
|
|
|
|
A_ToggleWalk, //Toggle Walking/Running
|
|
|
|
|
|
|
|
|
|
A_QuickSave,
|
|
|
|
|
A_QuickLoad,
|
|
|
|
@ -143,24 +141,19 @@ namespace MWInput
|
|
|
|
|
|
|
|
|
|
void toggleAutoMove()
|
|
|
|
|
{
|
|
|
|
|
if (player.getAutoMove() == false)
|
|
|
|
|
{
|
|
|
|
|
player.setAutoMove(true);
|
|
|
|
|
} else {
|
|
|
|
|
player.setAutoMove(false);
|
|
|
|
|
}
|
|
|
|
|
player.setAutoMove (!player.getAutoMove());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void toggleWalking()
|
|
|
|
|
{
|
|
|
|
|
player.setisWalking(true);
|
|
|
|
|
player.toggleRunning();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Exit program now button (which is disabled in GUI mode)
|
|
|
|
|
void exitNow()
|
|
|
|
|
{
|
|
|
|
|
if(!windows.isGuiMode())
|
|
|
|
|
exit.exitNow();
|
|
|
|
|
if(!windows.isGuiMode())
|
|
|
|
|
exit.exitNow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
@ -262,73 +255,54 @@ namespace MWInput
|
|
|
|
|
poller.bind(A_MoveRight, KC_D);
|
|
|
|
|
poller.bind(A_MoveForward, KC_W);
|
|
|
|
|
poller.bind(A_MoveBackward, KC_S);
|
|
|
|
|
|
|
|
|
|
// Use shift and ctrl for up and down
|
|
|
|
|
poller.bind(A_MoveUp, KC_LSHIFT);
|
|
|
|
|
poller.bind(A_MoveDown, KC_LCONTROL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//NOTE: Used to check for movement keys
|
|
|
|
|
bool frameStarted(const Ogre::FrameEvent &evt)
|
|
|
|
|
{
|
|
|
|
|
// Tell OIS to handle all input events
|
|
|
|
|
input.capture();
|
|
|
|
|
|
|
|
|
|
// Update windows/gui as a result of input events
|
|
|
|
|
// For instance this could mean opening a new window/dialog,
|
|
|
|
|
// by doing this after the input events are handled we
|
|
|
|
|
// ensure that window/gui changes appear quickly while
|
|
|
|
|
// avoiding that window/gui changes does not happen in
|
|
|
|
|
// event callbacks (which may crash)
|
|
|
|
|
windows.update();
|
|
|
|
|
|
|
|
|
|
// Disable movement in Gui mode
|
|
|
|
|
if(windows.isGuiMode()) return true;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
moveX -= speed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: These should be enabled for floating modes (like
|
|
|
|
|
// swimming and levitation) and disabled for everything else.
|
|
|
|
|
if(poller.isDown(A_MoveUp)) moveY += speed;
|
|
|
|
|
if(poller.isDown(A_MoveDown)) moveY -= speed;
|
|
|
|
|
|
|
|
|
|
if(moveX != 0 || moveY != 0 || moveZ != 0)
|
|
|
|
|
player.moveRel(moveX, moveY, moveZ);
|
|
|
|
|
// Tell OIS to handle all input events
|
|
|
|
|
input.capture();
|
|
|
|
|
|
|
|
|
|
// Update windows/gui as a result of input events
|
|
|
|
|
// For instance this could mean opening a new window/dialog,
|
|
|
|
|
// by doing this after the input events are handled we
|
|
|
|
|
// ensure that window/gui changes appear quickly while
|
|
|
|
|
// avoiding that window/gui changes does not happen in
|
|
|
|
|
// event callbacks (which may crash)
|
|
|
|
|
windows.update();
|
|
|
|
|
|
|
|
|
|
// Disable movement in Gui mode
|
|
|
|
|
if (windows.isGuiMode()) return true;
|
|
|
|
|
|
|
|
|
|
// Configure player movement according to keyboard input. Actual movement will
|
|
|
|
|
// be done in the physics system.
|
|
|
|
|
if (poller.isDown(A_MoveLeft))
|
|
|
|
|
{
|
|
|
|
|
player.setAutoMove (false);
|
|
|
|
|
player.setLeftRight (1);
|
|
|
|
|
}
|
|
|
|
|
else if (poller.isDown(A_MoveRight))
|
|
|
|
|
{
|
|
|
|
|
player.setAutoMove (false);
|
|
|
|
|
player.setLeftRight (-1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
player.setLeftRight (0);
|
|
|
|
|
|
|
|
|
|
if (poller.isDown(A_MoveForward))
|
|
|
|
|
{
|
|
|
|
|
player.setAutoMove (false);
|
|
|
|
|
player.setForwardBackward (1);
|
|
|
|
|
}
|
|
|
|
|
else if (poller.isDown(A_MoveBackward))
|
|
|
|
|
{
|
|
|
|
|
player.setAutoMove (false);
|
|
|
|
|
player.setForwardBackward (-1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
player.setForwardBackward (0);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Switch between gui modes. Besides controlling the Gui windows
|
|
|
|
|