From b98cfe2d1b887a8c305945fd40e2d0ee7b34bebf Mon Sep 17 00:00:00 2001 From: mrcheko Date: Fri, 20 Dec 2013 22:39:02 +0200 Subject: [PATCH] Revert "bug fix http://bugs.openmw.org/issues/428" This reverts commit 8dd930cf97fc4a0fee398a31209fabf24ad7fcb1. --- apps/openmw/mwbase/windowmanager.hpp | 2 -- apps/openmw/mwbase/world.hpp | 3 -- apps/openmw/mwgui/mainmenu.cpp | 13 +------- apps/openmw/mwgui/mainmenu.hpp | 4 --- apps/openmw/mwgui/windowmanagerimp.cpp | 5 --- apps/openmw/mwgui/windowmanagerimp.hpp | 3 -- apps/openmw/mwinput/inputmanagerimp.cpp | 37 +++++++++++------------ apps/openmw/mwmechanics/actors.cpp | 14 +++++---- apps/openmw/mwmechanics/character.cpp | 22 ++------------ apps/openmw/mwmechanics/character.hpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 5 --- apps/openmw/mwrender/renderingmanager.hpp | 2 -- apps/openmw/mwworld/worldimp.cpp | 9 +----- apps/openmw/mwworld/worldimp.hpp | 2 -- 14 files changed, 31 insertions(+), 92 deletions(-) diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 4ffb44615d..c47ad066b5 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -202,8 +202,6 @@ namespace MWBase virtual void setSpellVisibility(bool visible) = 0; virtual void setSneakVisibility(bool visible) = 0; - void virtual setMainMenuNoReturn(bool noreturn) = 0; - virtual void activateQuickKey (int index) = 0; virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0; diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index b1f236bd11..8141af7124 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -40,7 +40,6 @@ namespace ESM namespace MWRender { - class Camera; class ExternalRendering; class Animation; } @@ -116,8 +115,6 @@ namespace MWBase virtual MWWorld::Player& getPlayer() = 0; - virtual MWRender::Camera* getCamera() const = 0; - virtual const MWWorld::ESMStore& getStore() const = 0; virtual std::vector& getEsmReader() = 0; diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp index e1c72193b6..fa7ed2aceb 100644 --- a/apps/openmw/mwgui/mainmenu.cpp +++ b/apps/openmw/mwgui/mainmenu.cpp @@ -17,7 +17,6 @@ namespace MWGui MainMenu::MainMenu(int w, int h) : OEngine::GUI::Layout("openmw_mainmenu.layout") , mButtonBox(0) - , mNoReturn(false) { onResChange(w,h); } @@ -34,8 +33,7 @@ namespace MWGui int curH = 0; std::vector buttons; - if(!mNoReturn) - buttons.push_back("return"); + buttons.push_back("return"); buttons.push_back("newgame"); //buttons.push_back("loadgame"); //buttons.push_back("savegame"); @@ -70,15 +68,6 @@ namespace MWGui mButtonBox->setCoord (w/2 - maxwidth/2, h/2 - curH/2, maxwidth, curH); } - void MainMenu::setNoReturn(bool bNoReturn) - { - if (mNoReturn != bNoReturn) - { - mNoReturn = bNoReturn; - onResChange( Settings::Manager::getInt("resolution x", "Video"), Settings::Manager::getInt("resolution y", "Video") ); - } - } - void MainMenu::onButtonClicked(MyGUI::Widget *sender) { MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); diff --git a/apps/openmw/mwgui/mainmenu.hpp b/apps/openmw/mwgui/mainmenu.hpp index a686cb020b..4e76a64df7 100644 --- a/apps/openmw/mwgui/mainmenu.hpp +++ b/apps/openmw/mwgui/mainmenu.hpp @@ -12,13 +12,9 @@ namespace MWGui void onResChange(int w, int h); - void setNoReturn(bool bNoReturn); - private: MyGUI::Widget* mButtonBox; - bool mNoReturn; - std::map mButtons; void onButtonClicked (MyGUI::Widget* sender); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 69ec11cccc..78986a0522 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -880,11 +880,6 @@ namespace MWGui mHud->setSneakVisible(visible); } - void WindowManager::setMainMenuNoReturn(bool noreturn) - { - mMenu->setNoReturn(noreturn); - } - void WindowManager::setDragDrop(bool dragDrop) { mToolTips->setEnabled(!dragDrop); diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 3d6972718d..4f19602958 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -198,9 +198,6 @@ namespace MWGui virtual void setSpellVisibility(bool visible); virtual void setSneakVisibility(bool visible); - //disables 'return' button in the main menu (used when player is dead) - void virtual setMainMenuNoReturn(bool noreturn); - virtual void activateQuickKey (int index); virtual void setSelectedSpell(const std::string& spellId, int successChancePercent); diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 9b7fe98bd4..ab25696351 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -367,27 +367,24 @@ namespace MWInput } } - MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); - if ( !player.getClass().getCreatureStats(player).isDead() ) { - if (mControlSwitch["playerviewswitch"]) { - // work around preview mode toggle when pressing Alt+Tab - if (actionIsActive(A_TogglePOV) && !mInputManager->isModifierHeld(SDL_Keymod(KMOD_ALT))) { - - if (mPreviewPOVDelay <= 0.5 && - (mPreviewPOVDelay += dt) > 0.5) - { - mPreviewPOVDelay = 1.f; - MWBase::Environment::get().getWorld()->togglePreviewMode(true); - } - } else { - if (mPreviewPOVDelay > 0.5) { - //disable preview mode - MWBase::Environment::get().getWorld()->togglePreviewMode(false); - } else if (mPreviewPOVDelay > 0.f) { - MWBase::Environment::get().getWorld()->togglePOV(); - } - mPreviewPOVDelay = 0.f; + if (mControlSwitch["playerviewswitch"]) { + + // work around preview mode toggle when pressing Alt+Tab + if (actionIsActive(A_TogglePOV) && !mInputManager->isModifierHeld(SDL_Keymod(KMOD_ALT))) { + if (mPreviewPOVDelay <= 0.5 && + (mPreviewPOVDelay += dt) > 0.5) + { + mPreviewPOVDelay = 1.f; + MWBase::Environment::get().getWorld()->togglePreviewMode(true); } + } else { + if (mPreviewPOVDelay > 0.5) { + //disable preview mode + MWBase::Environment::get().getWorld()->togglePreviewMode(false); + } else if (mPreviewPOVDelay > 0.f) { + MWBase::Environment::get().getWorld()->togglePOV(); + } + mPreviewPOVDelay = 0.f; } } } diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 5dd294f906..22a641b34b 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -570,13 +570,15 @@ namespace MWMechanics continue; } - if (iter->second->kill()) - { - ++mDeathCount[cls.getId(iter->first)]; + if(iter->second->isDead()) + continue; - if(cls.isEssential(iter->first)) - MWBase::Environment::get().getWindowManager()->messageBox("#{sKilledEssential}"); - } + iter->second->kill(); + + ++mDeathCount[cls.getId(iter->first)]; + + if(cls.isEssential(iter->first)) + MWBase::Environment::get().getWindowManager()->messageBox("#{sKilledEssential}"); } } diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index c8eba20d6b..da3ed25232 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -27,7 +27,6 @@ #include "security.hpp" #include "../mwrender/animation.hpp" -#include "../mwrender/camera.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -1056,19 +1055,10 @@ void CharacterController::forceStateUpdate() } } -bool CharacterController::kill() +void CharacterController::kill() { - if( isDead() ) - { - //player death animation is over: toggle game menu without 'return' option - if( mPtr == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() - && !isAnimPlaying(mCurrentDeath) ) - { - MWBase::Environment::get().getWindowManager()->setMainMenuNoReturn(true); - MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu); - } - return false; - } + if(mDeathState != CharState_None) + return; if(mPtr.getTypeName() == typeid(ESM::NPC).name()) { @@ -1106,10 +1096,6 @@ bool CharacterController::kill() if(mAnimation) { - if (mPtr == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() - && MWBase::Environment::get().getWorld()->getCamera()->isFirstPerson() ) - MWBase::Environment::get().getWorld()->togglePOV(); - mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::Group_All, false, 1.0f, "start", "stop", 0.0f, 0); mAnimation->disable(mCurrentIdle); @@ -1117,8 +1103,6 @@ bool CharacterController::kill() mIdleState = CharState_None; mCurrentIdle.clear(); - - return true; } void CharacterController::resurrect() diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 2a5c7bb03c..9e07fca7d4 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -190,7 +190,7 @@ public: void skipAnim(); bool isAnimPlaying(const std::string &groupName); - bool kill(); + void kill(); void resurrect(); bool isDead() const { return mDeathState != CharState_None; } diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 7d51627474..b216c789f7 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -211,11 +211,6 @@ MWRender::SkyManager* RenderingManager::getSkyManager() return mSkyManager; } -MWRender::Camera* RenderingManager::getCamera() const -{ - return mCamera; -} - MWRender::Objects& RenderingManager::getObjects(){ return *mObjects; } diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index d6c1ef6c1b..e5dcf0aebc 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -98,8 +98,6 @@ public: SkyManager* getSkyManager(); Compositors* getCompositors(); - MWRender::Camera* getCamera() const; - void toggleLight(); bool toggleRenderMode(int mode); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index a900d27aba..f64d221223 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -312,8 +312,6 @@ namespace MWWorld mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback); MWBase::Environment::get().getScriptManager()->resetGlobalScripts(); - - MWBase::Environment::get().getWindowManager()->setMainMenuNoReturn(false); } @@ -405,11 +403,6 @@ namespace MWWorld return *mPlayer; } - MWRender::Camera* World::getCamera() const - { - return mRendering->getCamera(); - } - const MWWorld::ESMStore& World::getStore() const { return mStore; @@ -1311,7 +1304,7 @@ namespace MWWorld // inform the GUI about focused object MWWorld::Ptr object = getFacedObject (); - MWBase::Environment::get().getWindowManager()->setFocusObject(object); + MWBase::Environment::get().getWindowManager()->setFocusObject(object); // retrieve object dimensions so we know where to place the floating label if (!object.isEmpty ()) diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 2e572d0bbc..c8133441db 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -187,8 +187,6 @@ namespace MWWorld virtual Player& getPlayer(); - virtual MWRender::Camera* getCamera() const; - virtual const MWWorld::ESMStore& getStore() const; virtual std::vector& getEsmReader();