mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Idle voice fix
This commit is contained in:
parent
2ac4a74a34
commit
a3c861b7fa
1 changed files with 7 additions and 3 deletions
|
@ -311,14 +311,18 @@ namespace MWMechanics
|
||||||
&& actor.getRefData().getPosition().pos[2] < 3000 &&
|
&& actor.getRefData().getPosition().pos[2] < 3000 &&
|
||||||
MWBase::Environment::get().getSoundManager()->sayDone(actor))
|
MWBase::Environment::get().getSoundManager()->sayDone(actor))
|
||||||
{
|
{
|
||||||
float roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 10000; // [0, 9999]
|
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
|
|
||||||
// Don't bother if the player is out of hearing range
|
|
||||||
static float fVoiceIdleOdds = MWBase::Environment::get().getWorld()->getStore()
|
static float fVoiceIdleOdds = MWBase::Environment::get().getWorld()->getStore()
|
||||||
.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
|
.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
|
||||||
|
|
||||||
float x = fVoiceIdleOdds * MWBase::Environment::get().getFrameDuration();
|
float roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 10000;
|
||||||
|
|
||||||
|
// 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.6 * (MWBase::Environment::get().getFrameDuration() / 0.1);
|
||||||
|
|
||||||
// Only say Idle voices when player is in LOS
|
// Only say Idle voices when player is in LOS
|
||||||
// A bit counterintuitive, likely vanilla did this to reduce the appearance of
|
// A bit counterintuitive, likely vanilla did this to reduce the appearance of
|
||||||
|
|
Loading…
Reference in a new issue