|
|
|
@ -8,7 +8,6 @@
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
|
|
|
|
#include "../mwbase/dialoguemanager.hpp"
|
|
|
|
|
#include "../mwbase/soundmanager.hpp"
|
|
|
|
|
|
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
|
#include "../mwworld/esmstore.hpp"
|
|
|
|
@ -167,8 +166,6 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
doPerFrameActionsForState(actor, duration, storage);
|
|
|
|
|
|
|
|
|
|
playIdleDialogueRandomly(actor);
|
|
|
|
|
|
|
|
|
|
float& lastReaction = storage.mReaction;
|
|
|
|
|
lastReaction += duration;
|
|
|
|
|
if (AI_REACTION_TIME <= lastReaction)
|
|
|
|
@ -492,36 +489,6 @@ namespace MWMechanics
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AiWander::playIdleDialogueRandomly(const MWWorld::Ptr& actor)
|
|
|
|
|
{
|
|
|
|
|
int hello = actor.getClass().getCreatureStats(actor).getAiSetting(CreatureStats::AI_Hello).getModified();
|
|
|
|
|
if (hello > 0 && !MWBase::Environment::get().getWorld()->isSwimming(actor)
|
|
|
|
|
&& MWBase::Environment::get().getSoundManager()->sayDone(actor))
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Ptr player = getPlayer();
|
|
|
|
|
|
|
|
|
|
static float fVoiceIdleOdds = MWBase::Environment::get().getWorld()->getStore()
|
|
|
|
|
.get<ESM::GameSetting>().find("fVoiceIdleOdds")->mValue.getFloat();
|
|
|
|
|
|
|
|
|
|
float roll = Misc::Rng::rollProbability() * 10000.0f;
|
|
|
|
|
|
|
|
|
|
// In vanilla MW the chance was FPS dependent, and did not allow proper changing of fVoiceIdleOdds
|
|
|
|
|
// due to the roll being an integer.
|
|
|
|
|
// Our implementation does not have these issues, so needs to be recalibrated. We chose to
|
|
|
|
|
// use the chance MW would have when run at 60 FPS with the default value of the GMST for calibration.
|
|
|
|
|
float x = fVoiceIdleOdds * 0.6f * (MWBase::Environment::get().getFrameDuration() / 0.1f);
|
|
|
|
|
|
|
|
|
|
// Only say Idle voices when player is in LOS
|
|
|
|
|
// A bit counterintuitive, likely vanilla did this to reduce the appearance of
|
|
|
|
|
// voices going through walls?
|
|
|
|
|
const osg::Vec3f playerPos(player.getRefData().getPosition().asVec3());
|
|
|
|
|
const osg::Vec3f actorPos(actor.getRefData().getPosition().asVec3());
|
|
|
|
|
if (roll < x && (playerPos - actorPos).length2() < 3000 * 3000 // maybe should be fAudioVoiceDefaultMaxDistance*fAudioMaxDistanceMult instead
|
|
|
|
|
&& MWBase::Environment::get().getWorld()->getLOS(player, actor))
|
|
|
|
|
MWBase::Environment::get().getDialogueManager()->say(actor, "idle");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AiWander::playGreetingIfPlayerGetsTooClose(const MWWorld::Ptr& actor, AiWanderStorage& storage)
|
|
|
|
|
{
|
|
|
|
|
// Play a random voice greeting if the player gets too close
|
|
|
|
|