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