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
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,4 +63,5 @@ namespace MWWorld
|
|||
delete mClass;
|
||||
mClass = new_class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/// <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)
|
||||
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.
|
||||
/// <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()
|
||||
|
|
Loading…
Reference in a new issue