forked from teamnwah/openmw-tes3coop
Cleaned up and changed executeAutoMove()
This commit is contained in:
parent
90e6029bad
commit
1bc9a46c6b
3 changed files with 35 additions and 43 deletions
|
@ -280,38 +280,37 @@ 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; //is this a placeholder player speed?
|
float speed = 300 * evt.timeSinceLastFrame; //placeholder player speed?
|
||||||
float TESTwalkSpeed = 100 * evt.timeSinceLastFrame; //Try this, then.
|
float TESTwalkSpeed = 100 * evt.timeSinceLastFrame; //How about another?
|
||||||
//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
|
||||||
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.
|
//Poll and execute movement keys - will disable automove if pressed.
|
||||||
if(poller.isDown(A_MoveLeft))
|
if(poller.isDown(A_MoveLeft))
|
||||||
{
|
{
|
||||||
if (player.getmisWalking() == false)
|
if (player.getmisWalking() == false)
|
||||||
{
|
{
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveX -= speed;
|
moveX -= speed;
|
||||||
} else {
|
} else {
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveX -= TESTwalkSpeed;
|
moveX -= TESTwalkSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(poller.isDown(A_MoveRight))
|
if(poller.isDown(A_MoveRight))
|
||||||
{
|
{
|
||||||
if (player.getmisWalking() == false)
|
if (player.getmisWalking() == false)
|
||||||
{
|
{
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveX += speed;
|
moveX += speed;
|
||||||
} else {
|
} else {
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveX += TESTwalkSpeed;
|
moveX += TESTwalkSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(poller.isDown(A_MoveForward))
|
if(poller.isDown(A_MoveForward))
|
||||||
|
@ -328,14 +327,14 @@ namespace MWInput
|
||||||
|
|
||||||
if(poller.isDown(A_MoveBackward))
|
if(poller.isDown(A_MoveBackward))
|
||||||
{
|
{
|
||||||
if (player.getmisWalking() == false)
|
if (player.getmisWalking() == false)
|
||||||
{
|
{
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveZ += speed;
|
moveZ += speed;
|
||||||
} else {
|
} else {
|
||||||
player.setmAutoMove(false);
|
player.setmAutoMove(false);
|
||||||
moveZ += TESTwalkSpeed;
|
moveZ += TESTwalkSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,4 +63,5 @@ namespace MWWorld
|
||||||
delete mClass;
|
delete mClass;
|
||||||
mClass = new_class;
|
mClass = new_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ namespace MWWorld
|
||||||
bool mCollisionMode;
|
bool mCollisionMode;
|
||||||
|
|
||||||
bool mAutoMove;
|
bool mAutoMove;
|
||||||
//bool misSneaking;
|
|
||||||
//bool misHidden;
|
|
||||||
bool misWalking; //Testing...
|
bool misWalking; //Testing...
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -114,33 +112,27 @@ namespace MWWorld
|
||||||
mCollisionMode = !mCollisionMode;
|
mCollisionMode = !mCollisionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getmAutoMove()
|
bool getmAutoMove()
|
||||||
{
|
{
|
||||||
return mAutoMove;
|
return mAutoMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setmAutoMove(bool setMe)
|
void setmAutoMove(bool setMe)
|
||||||
{
|
|
||||||
mAutoMove = setMe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <param name="duration">float value representing time since last call</param>
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
//inputmanager.moveZ = 300 * duration * -1;
|
mAutoMove = setMe;
|
||||||
} else {
|
|
||||||
//inputmanager.moveZ = 100 * duration * -1;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
//NOTE: we don't have speed being calculated yet, so for now this function only requires a frame duration.
|
||||||
|
/// <param name="duration">float value representing time since last call</param>
|
||||||
|
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()
|
bool getmisWalking()
|
||||||
|
|
Loading…
Reference in a new issue