1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 11:36:43 +00:00

fixed tab problem

This commit is contained in:
Marc Zinnschlag 2011-01-18 15:20:36 +01:00
parent 246544806a
commit 36cb10572a
2 changed files with 57 additions and 64 deletions

View file

@ -94,7 +94,7 @@ namespace MWInput
// Write screenshot to file. // Write screenshot to file.
void screenshot() void screenshot()
{ {
// Find the first unused filename with a do-while // Find the first unused filename with a do-while
char buf[50]; char buf[50];
do do
@ -105,7 +105,7 @@ namespace MWInput
ogre.screenshot(buf); ogre.screenshot(buf);
} }
/* toggleInventory() is 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()
{ {
@ -141,19 +141,19 @@ namespace MWInput
mEngine.activate(); mEngine.activate();
} }
void toggleAutoMove() void toggleAutoMove()
{ {
if (player.getAutoMove() == false) if (player.getAutoMove() == false)
{ {
player.setAutoMove(true); player.setAutoMove(true);
} else { } else {
player.setAutoMove(false); player.setAutoMove(false);
} }
} }
void toggleWalking() void toggleWalking()
{ {
player.setisWalking(true); player.setisWalking(true);
} }
// Exit program now button (which is disabled in GUI mode) // Exit program now button (which is disabled in GUI mode)
@ -285,39 +285,38 @@ 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; //placeholder player speed? float speed = 300 * evt.timeSinceLastFrame; //placeholder player speed?
//float TESTwalkSpeed = 100 * evt.timeSinceLastFrame; //How about another? //float TESTwalkSpeed = 100 * evt.timeSinceLastFrame; //How about another?
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.timeSinceLastFrame); //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))
{ {
player.setAutoMove(false); player.setAutoMove(false);
moveX -= speed; moveX -= speed;
} }
if(poller.isDown(A_MoveRight)) if(poller.isDown(A_MoveRight))
{ {
player.setAutoMove(false); player.setAutoMove(false);
moveX += speed; moveX += speed;
} }
if(poller.isDown(A_MoveForward)) if(poller.isDown(A_MoveForward))
{ {
player.setAutoMove(false); player.setAutoMove(false);
moveZ -= speed; moveZ -= speed;
} }
if(poller.isDown(A_MoveBackward)) if(poller.isDown(A_MoveBackward))
{ {
player.setAutoMove(false); player.setAutoMove(false);
moveZ += speed; moveZ += speed;
} }
// TODO: These should be enabled for floating modes (like // TODO: These should be enabled for floating modes (like

View file

@ -31,8 +31,8 @@ namespace MWWorld
ESM::Class *mClass; ESM::Class *mClass;
bool mCollisionMode; bool mCollisionMode;
bool mAutoMove; bool mAutoMove;
bool misWalking; //Testing... bool misWalking;//Testing...
public: public:
@ -112,44 +112,38 @@ namespace MWWorld
mCollisionMode = !mCollisionMode; mCollisionMode = !mCollisionMode;
} }
bool getAutoMove() bool getAutoMove()
{
return mAutoMove;
}
void setAutoMove(bool setMe)
{
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)
{ {
float X_Val = 0.0f; return mAutoMove;
float Y_Val = 0.0f; }
float Z_Val = 300.0f * duration * -1.0f;
if (mAutoMove == true)
{
//if player is running
//Make player go at full speed
moveRel(X_Val, Y_Val, Z_Val);
//else go forward at walk speed.
}
}
bool getisWalking() void setAutoMove(bool setMe)
{ {
return misWalking; mAutoMove = setMe;
} }
void setisWalking(bool 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>
misWalking = setMe; void executeAutoMove(float duration)
} {
float X_Val = 0.0f;
float Y_Val = 0.0f;
float Z_Val = 300.0f * duration * -1.0f;
if (mAutoMove == true)
{
moveRel(X_Val, Y_Val, Z_Val);
}
}
bool getisWalking()
{
return misWalking;
}
void setisWalking(bool setMe)
}; {
misWalking = setMe;
}
};
} }
#endif #endif