mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
resolving conflicts
This commit is contained in:
commit
61923349e5
2 changed files with 49 additions and 46 deletions
|
@ -45,6 +45,8 @@ namespace MWInput
|
|||
, mUISensitivity (Settings::Manager::getFloat("ui sensitivity", "Input"))
|
||||
, mCameraYMultiplier (Settings::Manager::getFloat("camera y multiplier", "Input"))
|
||||
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
|
||||
, mPreviewPOVDelay(0.f)
|
||||
, mTimeIdle(0.f)
|
||||
{
|
||||
Ogre::RenderWindow* window = ogre.getWindow ();
|
||||
size_t windowHnd;
|
||||
|
@ -149,7 +151,6 @@ namespace MWInput
|
|||
if (currentValue == 1)
|
||||
{
|
||||
// trigger action activated
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case A_GameMenu:
|
||||
|
@ -168,24 +169,30 @@ namespace MWInput
|
|||
toggleConsole ();
|
||||
break;
|
||||
case A_Activate:
|
||||
resetIdleTime();
|
||||
activate();
|
||||
break;
|
||||
case A_Journal:
|
||||
toggleJournal ();
|
||||
break;
|
||||
case A_AutoMove:
|
||||
resetIdleTime();
|
||||
toggleAutoMove ();
|
||||
break;
|
||||
case A_ToggleSneak:
|
||||
/// \todo implement
|
||||
resetIdleTime();
|
||||
break;
|
||||
case A_ToggleWalk:
|
||||
resetIdleTime();
|
||||
toggleWalking ();
|
||||
break;
|
||||
case A_ToggleWeapon:
|
||||
resetIdleTime();
|
||||
toggleWeapon ();
|
||||
break;
|
||||
case A_ToggleSpell:
|
||||
resetIdleTime();
|
||||
toggleSpell ();
|
||||
break;
|
||||
}
|
||||
|
@ -269,29 +276,18 @@ namespace MWInput
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (actionIsActive(A_MoveLeft)
|
||||
|| actionIsActive(A_MoveRight)
|
||||
|| actionIsActive(A_MoveForward)
|
||||
|| actionIsActive(A_MoveBackward)
|
||||
|| actionIsActive(A_Jump)
|
||||
|| actionIsActive(A_Crouch)
|
||||
|| actionIsActive(A_TogglePOV))
|
||||
|
||||
if (actionIsActive(A_MoveForward) ||
|
||||
actionIsActive(A_MoveBackward) ||
|
||||
actionIsActive(A_MoveLeft) ||
|
||||
actionIsActive(A_MoveRight) ||
|
||||
actionIsActive(A_Jump) ||
|
||||
actionIsActive(A_Crouch) ||
|
||||
actionIsActive(A_TogglePOV))
|
||||
{
|
||||
resetIdleTime ();
|
||||
resetIdleTime();
|
||||
} else {
|
||||
updateIdleTime(dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mTimeIdle >= 0.f) {
|
||||
mTimeIdle += dt;
|
||||
}
|
||||
if (mTimeIdle > 30.f && !mWindows.isGuiMode()) {
|
||||
MWBase::Environment::get().getWorld()->toggleVanityMode(true, false);
|
||||
mTimeIdle = -1.f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InputManager::setDragDrop(bool dragDrop)
|
||||
|
@ -312,10 +308,8 @@ namespace MWInput
|
|||
}
|
||||
else
|
||||
{
|
||||
// Start mouse-looking again if allowed.
|
||||
if (mControlSwitch["playerlooking"]) {
|
||||
// Enable mouse look
|
||||
mMouseLookEnabled = true;
|
||||
}
|
||||
|
||||
// Disable GUI events
|
||||
mGuiCursorEnabled = false;
|
||||
|
@ -360,24 +354,14 @@ namespace MWInput
|
|||
} else if (sw == "playerjumping" && !value) {
|
||||
/// \fixme maybe crouching at this time
|
||||
mPlayer.setUpDown(0);
|
||||
} else if (sw == "vanitymode") {
|
||||
MWBase::Environment::get().getWorld()->allowVanityMode(value);
|
||||
} else if (sw == "playerlooking") {
|
||||
if (value) {
|
||||
mMouseLookEnabled = true;
|
||||
} else {
|
||||
mMouseLookEnabled = false;
|
||||
}
|
||||
MWBase::Environment::get().getWorld()->togglePlayerLooking(value);
|
||||
}
|
||||
mControlSwitch[sw] = value;
|
||||
}
|
||||
|
||||
void InputManager::resetIdleTime ()
|
||||
{
|
||||
if (mTimeIdle < 0) {
|
||||
MWBase::Environment::get().getWorld()->toggleVanityMode(false, false);
|
||||
}
|
||||
mTimeIdle = 0.f;
|
||||
}
|
||||
|
||||
void InputManager::adjustMouseRegion(int width, int height)
|
||||
{
|
||||
const OIS::MouseState &ms = mMouse->getMouseState();
|
||||
|
@ -450,6 +434,8 @@ namespace MWInput
|
|||
|
||||
if (mMouseLookEnabled)
|
||||
{
|
||||
resetIdleTime();
|
||||
|
||||
float x = arg.state.X.rel * mCameraSensitivity * 0.2;
|
||||
float y = arg.state.Y.rel * mCameraSensitivity * 0.2 * (mInvertY ? -1 : 1) * mUIYMultiplier;
|
||||
|
||||
|
@ -576,6 +562,25 @@ namespace MWInput
|
|||
Ogre::Root::getSingleton().queueEndRendering ();
|
||||
}
|
||||
|
||||
void InputManager::resetIdleTime()
|
||||
{
|
||||
if (mTimeIdle < 0) {
|
||||
MWBase::Environment::get().getWorld()->toggleVanityMode(false, false);
|
||||
}
|
||||
mTimeIdle = 0.f;
|
||||
}
|
||||
|
||||
void InputManager::updateIdleTime(float dt)
|
||||
{
|
||||
if (mTimeIdle >= 0.f) {
|
||||
mTimeIdle += dt;
|
||||
}
|
||||
if (mTimeIdle > 30.f) {
|
||||
MWBase::Environment::get().getWorld()->toggleVanityMode(true, false);
|
||||
mTimeIdle = -1.f;
|
||||
}
|
||||
}
|
||||
|
||||
bool InputManager::actionIsActive (int id)
|
||||
{
|
||||
return mInputCtrl->getChannel (id)->getValue () == 1;
|
||||
|
|
|
@ -83,7 +83,6 @@ namespace MWInput
|
|||
virtual void enableDetectingBindingMode (int action);
|
||||
virtual void resetToDefaultBindings();
|
||||
|
||||
|
||||
public:
|
||||
virtual bool keyPressed( const OIS::KeyEvent &arg );
|
||||
virtual bool keyReleased( const OIS::KeyEvent &arg );
|
||||
|
@ -139,6 +138,8 @@ namespace MWInput
|
|||
float mUISensitivity;
|
||||
float mCameraYMultiplier;
|
||||
float mUIYMultiplier;
|
||||
float mPreviewPOVDelay;
|
||||
float mTimeIdle;
|
||||
|
||||
bool mMouseLookEnabled;
|
||||
bool mGuiCursorEnabled;
|
||||
|
@ -146,15 +147,14 @@ namespace MWInput
|
|||
float mMouseX;
|
||||
float mMouseY;
|
||||
|
||||
float mPreviewPOVDelay;
|
||||
float mTimeIdle;
|
||||
|
||||
std::map<std::string, bool> mControlSwitch;
|
||||
|
||||
|
||||
private:
|
||||
void adjustMouseRegion(int width, int height);
|
||||
|
||||
void resetIdleTime();
|
||||
void updateIdleTime(float dt);
|
||||
|
||||
private:
|
||||
void toggleMainMenu();
|
||||
void toggleSpell();
|
||||
|
@ -172,8 +172,6 @@ namespace MWInput
|
|||
|
||||
void loadKeyDefaults(bool force = false);
|
||||
|
||||
void resetIdleTime();
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue