mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 03:54:40 +00:00
Merge remote-tracking branch 'miroslavr/master'
This commit is contained in:
commit
16aa55dcde
@ -23,6 +23,8 @@
|
|||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
#include "../mwsound/soundmanagerimp.hpp"
|
#include "../mwsound/soundmanagerimp.hpp"
|
||||||
|
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
@ -1442,6 +1444,10 @@ namespace MWGui
|
|||||||
void WindowManager::updatePlayer()
|
void WindowManager::updatePlayer()
|
||||||
{
|
{
|
||||||
mInventoryWindow->updatePlayer();
|
mInventoryWindow->updatePlayer();
|
||||||
|
|
||||||
|
const MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
|
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||||
|
forceHide((GuiWindow)(MWGui::GW_Inventory | MWGui::GW_Magic));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::setKeyFocusWidget(MyGUI::Widget *widget)
|
void WindowManager::setKeyFocusWidget(MyGUI::Widget *widget)
|
||||||
@ -1532,6 +1538,8 @@ namespace MWGui
|
|||||||
|
|
||||||
mCustomMarkers.clear();
|
mCustomMarkers.clear();
|
||||||
|
|
||||||
|
mForceHidden = GW_None;
|
||||||
|
|
||||||
mGuiModes.clear();
|
mGuiModes.clear();
|
||||||
MWBase::Environment::get().getInputManager()->changeInputMode(false);
|
MWBase::Environment::get().getInputManager()->changeInputMode(false);
|
||||||
updateVisible();
|
updateVisible();
|
||||||
|
@ -580,6 +580,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
|
|||||||
, mIdleState(CharState_None)
|
, mIdleState(CharState_None)
|
||||||
, mMovementState(CharState_None)
|
, mMovementState(CharState_None)
|
||||||
, mMovementSpeed(0.0f)
|
, mMovementSpeed(0.0f)
|
||||||
|
, mHasMovedInXY(false)
|
||||||
, mMovementAnimationControlled(true)
|
, mMovementAnimationControlled(true)
|
||||||
, mDeathState(CharState_None)
|
, mDeathState(CharState_None)
|
||||||
, mHitState(CharState_None)
|
, mHitState(CharState_None)
|
||||||
@ -794,6 +795,7 @@ bool CharacterController::updateWeaponState()
|
|||||||
{
|
{
|
||||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
if(cls.getCreatureStats(mPtr).getStance(MWMechanics::CreatureStats::Stance_Run)
|
if(cls.getCreatureStats(mPtr).getStance(MWMechanics::CreatureStats::Stance_Run)
|
||||||
|
&& mHasMovedInXY
|
||||||
&& !MWBase::Environment::get().getWorld()->isSwimming(mPtr)
|
&& !MWBase::Environment::get().getWorld()->isSwimming(mPtr)
|
||||||
&& mWeaponType == WeapType_None)
|
&& mWeaponType == WeapType_None)
|
||||||
{
|
{
|
||||||
@ -1249,11 +1251,12 @@ void CharacterController::update(float duration)
|
|||||||
CharacterState idlestate = CharState_SpecialIdle;
|
CharacterState idlestate = CharState_SpecialIdle;
|
||||||
bool forcestateupdate = false;
|
bool forcestateupdate = false;
|
||||||
|
|
||||||
isrunning = isrunning && std::abs(vec[0])+std::abs(vec[1]) > 0.0f;
|
mHasMovedInXY = std::abs(vec[0])+std::abs(vec[1]) > 0.0f;
|
||||||
|
isrunning = isrunning && mHasMovedInXY;
|
||||||
|
|
||||||
|
|
||||||
// advance athletics
|
// advance athletics
|
||||||
if(std::abs(vec[0])+std::abs(vec[1]) > 0.0f && mPtr.getRefData().getHandle() == "player")
|
if(mHasMovedInXY && mPtr.getRefData().getHandle() == "player")
|
||||||
{
|
{
|
||||||
if(inwater)
|
if(inwater)
|
||||||
{
|
{
|
||||||
|
@ -147,6 +147,7 @@ class CharacterController
|
|||||||
CharacterState mMovementState;
|
CharacterState mMovementState;
|
||||||
std::string mCurrentMovement;
|
std::string mCurrentMovement;
|
||||||
float mMovementSpeed;
|
float mMovementSpeed;
|
||||||
|
bool mHasMovedInXY;
|
||||||
bool mMovementAnimationControlled;
|
bool mMovementAnimationControlled;
|
||||||
|
|
||||||
CharacterState mDeathState;
|
CharacterState mDeathState;
|
||||||
|
@ -869,6 +869,12 @@ namespace MWMechanics
|
|||||||
|
|
||||||
bool MechanicsManager::sleepInBed(const MWWorld::Ptr &ptr, const MWWorld::Ptr &bed)
|
bool MechanicsManager::sleepInBed(const MWWorld::Ptr &ptr, const MWWorld::Ptr &bed)
|
||||||
{
|
{
|
||||||
|
if (ptr.getClass().getNpcStats(ptr).isWerewolf())
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) {
|
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) {
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage2}");
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage2}");
|
||||||
return true;
|
return true;
|
||||||
@ -1296,6 +1302,17 @@ namespace MWMechanics
|
|||||||
+ ((50 - disposition) * fFightDispMult))
|
+ ((50 - disposition) * fFightDispMult))
|
||||||
+ bias;
|
+ bias;
|
||||||
|
|
||||||
|
if (ptr.getClass().isNpc() && target.getClass().isNpc())
|
||||||
|
{
|
||||||
|
if (target.getClass().getNpcStats(target).isWerewolf() ||
|
||||||
|
(target == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||||
|
MWBase::Environment::get().getWorld()->getGlobalInt("pcknownwerewolf")))
|
||||||
|
{
|
||||||
|
const ESM::GameSetting * iWerewolfFightMod = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().search("iWerewolfFightMod");
|
||||||
|
fight += iWerewolfFightMod->getInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (fight >= 100);
|
return (fight >= 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,6 +390,7 @@ namespace MWWorld
|
|||||||
// vanilla Morrowind does not define dayspassed.
|
// vanilla Morrowind does not define dayspassed.
|
||||||
globals["dayspassed"] = ESM::Variant(1); // but the addons start counting at 1 :(
|
globals["dayspassed"] = ESM::Variant(1); // but the addons start counting at 1 :(
|
||||||
globals["WerewolfClawMult"] = ESM::Variant(1.f);
|
globals["WerewolfClawMult"] = ESM::Variant(1.f);
|
||||||
|
globals["PCKnownWerewolf"] = ESM::Variant(0);
|
||||||
|
|
||||||
for (std::map<std::string, ESM::Variant>::iterator it = gmst.begin(); it != gmst.end(); ++it)
|
for (std::map<std::string, ESM::Variant>::iterator it = gmst.begin(); it != gmst.end(); ++it)
|
||||||
{
|
{
|
||||||
@ -2330,6 +2331,34 @@ namespace MWWorld
|
|||||||
windowManager->unsetForceHide(MWGui::GW_Inventory);
|
windowManager->unsetForceHide(MWGui::GW_Inventory);
|
||||||
windowManager->unsetForceHide(MWGui::GW_Magic);
|
windowManager->unsetForceHide(MWGui::GW_Magic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Witnesses of the player's transformation will make them a globally known werewolf
|
||||||
|
std::vector<MWWorld::Ptr> closeActors;
|
||||||
|
MWBase::Environment::get().getMechanicsManager()->getActorsInRange(Ogre::Vector3(actor.getRefData().getPosition().pos),
|
||||||
|
getStore().get<ESM::GameSetting>().search("fAlarmRadius")->getFloat(),
|
||||||
|
closeActors);
|
||||||
|
|
||||||
|
bool detected = false;
|
||||||
|
for (std::vector<MWWorld::Ptr>::const_iterator it = closeActors.begin(); it != closeActors.end(); ++it)
|
||||||
|
{
|
||||||
|
if (*it == actor)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!it->getClass().isNpc())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (getLOS(*it, actor) && MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor, *it))
|
||||||
|
{
|
||||||
|
detected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (detected)
|
||||||
|
{
|
||||||
|
windowManager->messageBox("#{sWerewolfAlarmMessage}");
|
||||||
|
setGlobalInt("pcknownwerewolf", 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user