forked from teamnwah/openmw-tes3coop
This commit is contained in:
parent
8b3a393a6b
commit
8dd930cf97
14 changed files with 92 additions and 31 deletions
|
@ -202,6 +202,8 @@ 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;
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace ESM
|
|||
|
||||
namespace MWRender
|
||||
{
|
||||
class Camera;
|
||||
class ExternalRendering;
|
||||
class Animation;
|
||||
}
|
||||
|
@ -115,6 +116,8 @@ namespace MWBase
|
|||
|
||||
virtual MWWorld::Player& getPlayer() = 0;
|
||||
|
||||
virtual MWRender::Camera* getCamera() const = 0;
|
||||
|
||||
virtual const MWWorld::ESMStore& getStore() const = 0;
|
||||
|
||||
virtual std::vector<ESM::ESMReader>& getEsmReader() = 0;
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace MWGui
|
|||
MainMenu::MainMenu(int w, int h)
|
||||
: OEngine::GUI::Layout("openmw_mainmenu.layout")
|
||||
, mButtonBox(0)
|
||||
, mNoReturn(false)
|
||||
{
|
||||
onResChange(w,h);
|
||||
}
|
||||
|
@ -33,7 +34,8 @@ namespace MWGui
|
|||
int curH = 0;
|
||||
|
||||
std::vector<std::string> buttons;
|
||||
buttons.push_back("return");
|
||||
if(!mNoReturn)
|
||||
buttons.push_back("return");
|
||||
buttons.push_back("newgame");
|
||||
//buttons.push_back("loadgame");
|
||||
//buttons.push_back("savegame");
|
||||
|
@ -68,6 +70,15 @@ 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);
|
||||
|
|
|
@ -12,9 +12,13 @@ namespace MWGui
|
|||
|
||||
void onResChange(int w, int h);
|
||||
|
||||
void setNoReturn(bool bNoReturn);
|
||||
|
||||
private:
|
||||
MyGUI::Widget* mButtonBox;
|
||||
|
||||
bool mNoReturn;
|
||||
|
||||
std::map<std::string, MWGui::ImageButton*> mButtons;
|
||||
|
||||
void onButtonClicked (MyGUI::Widget* sender);
|
||||
|
|
|
@ -880,6 +880,11 @@ namespace MWGui
|
|||
mHud->setSneakVisible(visible);
|
||||
}
|
||||
|
||||
void WindowManager::setMainMenuNoReturn(bool noreturn)
|
||||
{
|
||||
mMenu->setNoReturn(noreturn);
|
||||
}
|
||||
|
||||
void WindowManager::setDragDrop(bool dragDrop)
|
||||
{
|
||||
mToolTips->setEnabled(!dragDrop);
|
||||
|
|
|
@ -198,6 +198,9 @@ 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);
|
||||
|
|
|
@ -367,24 +367,27 @@ namespace MWInput
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -570,15 +570,13 @@ namespace MWMechanics
|
|||
continue;
|
||||
}
|
||||
|
||||
if(iter->second->isDead())
|
||||
continue;
|
||||
if (iter->second->kill())
|
||||
{
|
||||
++mDeathCount[cls.getId(iter->first)];
|
||||
|
||||
iter->second->kill();
|
||||
|
||||
++mDeathCount[cls.getId(iter->first)];
|
||||
|
||||
if(cls.isEssential(iter->first))
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sKilledEssential}");
|
||||
if(cls.isEssential(iter->first))
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sKilledEssential}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "security.hpp"
|
||||
|
||||
#include "../mwrender/animation.hpp"
|
||||
#include "../mwrender/camera.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -1055,10 +1056,19 @@ void CharacterController::forceStateUpdate()
|
|||
}
|
||||
}
|
||||
|
||||
void CharacterController::kill()
|
||||
bool CharacterController::kill()
|
||||
{
|
||||
if(mDeathState != CharState_None)
|
||||
return;
|
||||
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(mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
|
@ -1096,6 +1106,10 @@ void 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);
|
||||
|
@ -1103,6 +1117,8 @@ void CharacterController::kill()
|
|||
|
||||
mIdleState = CharState_None;
|
||||
mCurrentIdle.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CharacterController::resurrect()
|
||||
|
|
|
@ -190,7 +190,7 @@ public:
|
|||
void skipAnim();
|
||||
bool isAnimPlaying(const std::string &groupName);
|
||||
|
||||
void kill();
|
||||
bool kill();
|
||||
void resurrect();
|
||||
bool isDead() const
|
||||
{ return mDeathState != CharState_None; }
|
||||
|
|
|
@ -211,6 +211,11 @@ MWRender::SkyManager* RenderingManager::getSkyManager()
|
|||
return mSkyManager;
|
||||
}
|
||||
|
||||
MWRender::Camera* RenderingManager::getCamera() const
|
||||
{
|
||||
return mCamera;
|
||||
}
|
||||
|
||||
MWRender::Objects& RenderingManager::getObjects(){
|
||||
return *mObjects;
|
||||
}
|
||||
|
|
|
@ -98,6 +98,8 @@ public:
|
|||
SkyManager* getSkyManager();
|
||||
Compositors* getCompositors();
|
||||
|
||||
MWRender::Camera* getCamera() const;
|
||||
|
||||
void toggleLight();
|
||||
bool toggleRenderMode(int mode);
|
||||
|
||||
|
|
|
@ -312,6 +312,8 @@ namespace MWWorld
|
|||
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback);
|
||||
|
||||
MWBase::Environment::get().getScriptManager()->resetGlobalScripts();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->setMainMenuNoReturn(false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -403,6 +405,11 @@ namespace MWWorld
|
|||
return *mPlayer;
|
||||
}
|
||||
|
||||
MWRender::Camera* World::getCamera() const
|
||||
{
|
||||
return mRendering->getCamera();
|
||||
}
|
||||
|
||||
const MWWorld::ESMStore& World::getStore() const
|
||||
{
|
||||
return mStore;
|
||||
|
@ -1304,7 +1311,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 ())
|
||||
|
|
|
@ -187,6 +187,8 @@ namespace MWWorld
|
|||
|
||||
virtual Player& getPlayer();
|
||||
|
||||
virtual MWRender::Camera* getCamera() const;
|
||||
|
||||
virtual const MWWorld::ESMStore& getStore() const;
|
||||
|
||||
virtual std::vector<ESM::ESMReader>& getEsmReader();
|
||||
|
|
Loading…
Reference in a new issue