Merge remote-tracking branch 'upstream/master' into osgshadow-test-vdsm

pull/541/head
AnyOldName3 7 years ago
commit 9ff31cc80d

@ -44,6 +44,7 @@ Programmers
crussell187 crussell187
DanielVukelich DanielVukelich
darkf darkf
David Cernat (davidcernat)
devnexen devnexen
Dieho Dieho
Dmitry Shkurskiy (endorph) Dmitry Shkurskiy (endorph)

@ -216,6 +216,8 @@ case $VS_VERSION in
15|15.0|2017 ) 15|15.0|2017 )
GENERATOR="Visual Studio 15 2017" GENERATOR="Visual Studio 15 2017"
TOOLSET="vc140" TOOLSET="vc140"
TOOLSET_REAL="vc141"
MSVC_REAL_VER="15"
MSVC_VER="14" MSVC_VER="14"
MSVC_YEAR="2015" MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2017" MSVC_DISPLAY_YEAR="2017"
@ -224,6 +226,8 @@ case $VS_VERSION in
14|14.0|2015 ) 14|14.0|2015 )
GENERATOR="Visual Studio 14 2015" GENERATOR="Visual Studio 14 2015"
TOOLSET="vc140" TOOLSET="vc140"
TOOLSET_REAL="vc140"
MSVC_REAL_VER="14"
MSVC_VER="14" MSVC_VER="14"
MSVC_YEAR="2015" MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2015" MSVC_DISPLAY_YEAR="2015"
@ -232,6 +236,8 @@ case $VS_VERSION in
12|12.0|2013 ) 12|12.0|2013 )
GENERATOR="Visual Studio 12 2013" GENERATOR="Visual Studio 12 2013"
TOOLSET="vc120" TOOLSET="vc120"
TOOLSET_REAL="vc120"
MSVC_REAL_VER="12"
MSVC_VER="12" MSVC_VER="12"
MSVC_YEAR="2013" MSVC_YEAR="2013"
MSVC_DISPLAY_YEAR="2013" MSVC_DISPLAY_YEAR="2013"
@ -385,7 +391,7 @@ else
if [ $MSVC_VER -eq 12 ]; then if [ $MSVC_VER -eq 12 ]; then
printf "Boost 1.58.0 AppVeyor... " printf "Boost 1.58.0 AppVeyor... "
else else
printf "Boost 1.60.0 AppVeyor... " printf "Boost 1.67.0 AppVeyor... "
fi fi
fi fi
{ {
@ -408,14 +414,20 @@ fi
echo Done. echo Done.
else else
# Appveyor unstable has all the boost we need already # Appveyor unstable has all the boost we need already
if [ $MSVC_VER -eq 12 ]; then if [ $MSVC_REAL_VER -eq 12 ]; then
BOOST_SDK="c:/Libraries/boost_1_58_0" BOOST_SDK="c:/Libraries/boost_1_58_0"
else else
BOOST_SDK="c:/Libraries/boost_1_60_0" BOOST_SDK="c:/Libraries/boost_1_67_0"
fi fi
if [ $MSVC_REAL_VER -eq 15 ]; then
LIB_SUFFIX="1"
else
LIB_SUFFIX="0"
fi
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.${LIB_SUFFIX}"
add_cmake_opts -DBoost_COMPILER="-${TOOLSET}" add_cmake_opts -DBoost_COMPILER="-${TOOLSET_REAL}"
echo Done. echo Done.
fi fi
@ -568,7 +580,7 @@ echo
if [ -z $APPVEYOR ]; then if [ -z $APPVEYOR ]; then
printf "Qt 5.7.0... " printf "Qt 5.7.0... "
else else
printf "Qt 5.7 AppVeyor... " printf "Qt 5.10 AppVeyor... "
fi fi
{ {
if [ $BITS -eq 64 ]; then if [ $BITS -eq 64 ]; then
@ -618,7 +630,7 @@ fi
echo Done. echo Done.
else else
QT_SDK="C:/Qt/5.7/msvc${MSVC_YEAR}${SUFFIX}" QT_SDK="C:/Qt/5.10/msvc${MSVC_DISPLAY_YEAR}${SUFFIX}"
add_cmake_opts -DDESIRED_QT_VERSION=5 \ add_cmake_opts -DDESIRED_QT_VERSION=5 \
-DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \

@ -105,7 +105,7 @@ namespace CSMWorld
{ ColumnId_Respawn, "Respawn" }, { ColumnId_Respawn, "Respawn" },
{ ColumnId_CreatureType, "Creature Type" }, { ColumnId_CreatureType, "Creature Type" },
{ ColumnId_SoulPoints, "Soul Points" }, { ColumnId_SoulPoints, "Soul Points" },
{ ColumnId_OriginalCreature, "Original Creature" }, { ColumnId_ParentCreature, "Parent Creature" },
{ ColumnId_Biped, "Biped" }, { ColumnId_Biped, "Biped" },
{ ColumnId_HasWeapon, "Has Weapon" }, { ColumnId_HasWeapon, "Has Weapon" },
{ ColumnId_Swims, "Swims" }, { ColumnId_Swims, "Swims" },

@ -99,7 +99,7 @@ namespace CSMWorld
ColumnId_Respawn = 84, ColumnId_Respawn = 84,
ColumnId_CreatureType = 85, ColumnId_CreatureType = 85,
ColumnId_SoulPoints = 86, ColumnId_SoulPoints = 86,
ColumnId_OriginalCreature = 87, ColumnId_ParentCreature = 87,
ColumnId_Biped = 88, ColumnId_Biped = 88,
ColumnId_HasWeapon = 89, ColumnId_HasWeapon = 89,
// unused // unused

@ -1368,13 +1368,15 @@ QVariant CSMWorld::CreatureAttackRefIdAdapter::getNestedData (const RefIdColumn
const ESM::Creature& creature = record.get(); const ESM::Creature& creature = record.get();
if (subRowIndex < 0 || subRowIndex > 2 || subColIndex < 0 || subColIndex > 2) if (subRowIndex < 0 || subRowIndex > 2)
throw std::runtime_error ("index out of range"); throw std::runtime_error ("index out of range");
if (subColIndex == 0) if (subColIndex == 0)
return subRowIndex + 1; return subRowIndex + 1;
else if (subColIndex < 3) // 1 or 2 else if (subColIndex == 1 || subColIndex == 2)
return creature.mData.mAttack[(subRowIndex * 2) + (subColIndex - 1)]; return creature.mData.mAttack[(subRowIndex * 2) + (subColIndex - 1)];
else
throw std::runtime_error ("index out of range");
} }
void CSMWorld::CreatureAttackRefIdAdapter::setNestedData (const RefIdColumn *column, void CSMWorld::CreatureAttackRefIdAdapter::setNestedData (const RefIdColumn *column,

@ -331,7 +331,7 @@ CSMWorld::RefIdCollection::RefIdCollection()
creatureColumns.mType = &mColumns.back(); creatureColumns.mType = &mColumns.back();
mColumns.push_back (RefIdColumn (Columns::ColumnId_Scale, ColumnBase::Display_Float)); mColumns.push_back (RefIdColumn (Columns::ColumnId_Scale, ColumnBase::Display_Float));
creatureColumns.mScale = &mColumns.back(); creatureColumns.mScale = &mColumns.back();
mColumns.push_back (RefIdColumn (Columns::ColumnId_OriginalCreature, ColumnBase::Display_Creature)); mColumns.push_back (RefIdColumn (Columns::ColumnId_ParentCreature, ColumnBase::Display_Creature));
creatureColumns.mOriginal = &mColumns.back(); creatureColumns.mOriginal = &mColumns.back();
static const struct static const struct

@ -337,7 +337,7 @@ namespace MWBase
/// Cycle to next or previous weapon /// Cycle to next or previous weapon
virtual void cycleWeapon(bool next) = 0; virtual void cycleWeapon(bool next) = 0;
virtual void playSound(const std::string& soundId, bool preventOverlapping = false, float volume = 1.f, float pitch = 1.f) = 0; virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f) = 0;
// In WindowManager for now since there isn't a VFS singleton // In WindowManager for now since there isn't a VFS singleton
virtual std::string correctIconPath(const std::string& path) = 0; virtual std::string correctIconPath(const std::string& path) = 0;

@ -325,7 +325,10 @@ namespace MWClass
// add reach and attack speed for melee weapon // add reach and attack speed for melee weapon
if (ref->mBase->mData.mType < 9 && Settings::Manager::getBool("show melee info", "Game")) if (ref->mBase->mData.mType < 9 && Settings::Manager::getBool("show melee info", "Game"))
{ {
text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mReach, "#{sRange}"); // 64 game units = 1 yard = 3 ft, display value in feet
const float combatDistance = store.get<ESM::GameSetting>().find("fCombatDistance")->getFloat() * ref->mBase->mData.mReach;
text += MWGui::ToolTips::getWeightString(combatDistance*3/64, "#{sRange}");
text += " #{sFeet}";
text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mSpeed, "#{sAttributeSpeed}"); text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mSpeed, "#{sAttributeSpeed}");
} }

@ -200,7 +200,7 @@ namespace MWGui
{ {
if ((mCurrentPage+1)*2 < mPages.size()) if ((mCurrentPage+1)*2 < mPages.size())
{ {
MWBase::Environment::get().getWindowManager()->playSound("book page2", true); MWBase::Environment::get().getWindowManager()->playSound("book page2");
++mCurrentPage; ++mCurrentPage;
@ -211,7 +211,7 @@ namespace MWGui
{ {
if (mCurrentPage > 0) if (mCurrentPage > 0)
{ {
MWBase::Environment::get().getWindowManager()->playSound("book page", true); MWBase::Environment::get().getWindowManager()->playSound("book page");
--mCurrentPage; --mCurrentPage;

@ -913,6 +913,9 @@ namespace MWGui
updateMap(); updateMap();
if (!mMap->isVisible())
mMap->onFrame(frameDuration);
mHud->onFrame(frameDuration); mHud->onFrame(frameDuration);
mDebugWindow->onFrame(frameDuration); mDebugWindow->onFrame(frameDuration);
@ -1919,16 +1922,12 @@ namespace MWGui
mInventoryWindow->cycle(next); mInventoryWindow->cycle(next);
} }
void WindowManager::playSound(const std::string& soundId, bool preventOverlapping, float volume, float pitch) void WindowManager::playSound(const std::string& soundId, float volume, float pitch)
{ {
if (soundId.empty()) if (soundId.empty())
return; return;
MWBase::SoundManager *sndmgr = MWBase::Environment::get().getSoundManager(); MWBase::Environment::get().getSoundManager()->playSound(soundId, volume, pitch, MWSound::Type::Sfx, MWSound::PlayMode::NoEnv);
if (preventOverlapping && sndmgr->getSoundPlaying(MWWorld::Ptr(), soundId))
return;
sndmgr->playSound(soundId, volume, pitch, MWSound::Type::Sfx, MWSound::PlayMode::NoEnv);
} }
void WindowManager::updateSpellWindow() void WindowManager::updateSpellWindow()

@ -366,7 +366,7 @@ namespace MWGui
/// Cycle to next or previous weapon /// Cycle to next or previous weapon
virtual void cycleWeapon(bool next); virtual void cycleWeapon(bool next);
virtual void playSound(const std::string& soundId, bool preventOverlapping = false, float volume = 1.f, float pitch = 1.f); virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f);
// In WindowManager for now since there isn't a VFS singleton // In WindowManager for now since there isn't a VFS singleton
virtual std::string correctIconPath(const std::string& path); virtual std::string correctIconPath(const std::string& path);

@ -125,7 +125,7 @@ namespace MWRender
{ {
for (int cellX=0; cellX<mCellSize; ++cellX) for (int cellX=0; cellX<mCellSize; ++cellX)
{ {
int vertexX = static_cast<int>(float(cellX)/float(mCellSize) * 9); int vertexX = static_cast<int>(float(cellX) / float(mCellSize) * 9);
int vertexY = static_cast<int>(float(cellY) / float(mCellSize) * 9); int vertexY = static_cast<int>(float(cellY) / float(mCellSize) * 9);
int texelX = (x-mMinX) * mCellSize + cellX; int texelX = (x-mMinX) * mCellSize + cellX;
@ -135,9 +135,9 @@ namespace MWRender
float y2 = 0; float y2 = 0;
if (land && (land->mDataTypes & ESM::Land::DATA_WNAM)) if (land && (land->mDataTypes & ESM::Land::DATA_WNAM))
y2 = (land->mWnam[vertexY * 9 + vertexX] << 4) / 2048.f; y2 = land->mWnam[vertexY * 9 + vertexX] / 128.f;
else else
y2 = (SCHAR_MIN << 4) / 2048.f; y2 = SCHAR_MIN / 128.f;
if (y2 < 0) if (y2 < 0)
{ {
r = static_cast<unsigned char>(14 * y2 + 38); r = static_cast<unsigned char>(14 * y2 + 38);

@ -951,10 +951,11 @@ std::pair<Sound_Handle,size_t> OpenAL_Output::loadSound(const std::string &fname
getALError(); getALError();
std::vector<char> data; std::vector<char> data;
ALenum format; ALenum format = AL_NONE;
int srate; int srate = 0;
try { try
{
DecoderPtr decoder = mManager.getDecoder(); DecoderPtr decoder = mManager.getDecoder();
// Workaround: Bethesda at some point converted some of the files to mp3, but the references were kept as .wav. // Workaround: Bethesda at some point converted some of the files to mp3, but the references were kept as .wav.
if(decoder->mResourceMgr->exists(fname)) if(decoder->mResourceMgr->exists(fname))
@ -974,7 +975,8 @@ std::pair<Sound_Handle,size_t> OpenAL_Output::loadSound(const std::string &fname
format = getALFormat(chans, type); format = getALFormat(chans, type);
if(format) decoder->readAll(data); if(format) decoder->readAll(data);
} }
catch(std::exception &e) { catch(std::exception &e)
{
std::cerr<< "Failed to load audio from "<<fname<<": "<<e.what() <<std::endl; std::cerr<< "Failed to load audio from "<<fname<<": "<<e.what() <<std::endl;
} }

@ -20,9 +20,9 @@
#include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/actorutil.hpp"
#include "sound_output.hpp"
#include "sound_buffer.hpp" #include "sound_buffer.hpp"
#include "sound_decoder.hpp" #include "sound_decoder.hpp"
#include "sound_output.hpp"
#include "sound.hpp" #include "sound.hpp"
#include "openal_output.hpp" #include "openal_output.hpp"
@ -577,6 +577,9 @@ namespace MWSound
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId)); Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
if(!sfx) return nullptr; if(!sfx) return nullptr;
// Only one copy of given sound can be played at time, so stop previous copy
stopSound(sfx, MWWorld::ConstPtr());
Sound *sound = getSoundRef(); Sound *sound = getSoundRef();
sound->init(volume * sfx->mVolume, volumeFromType(type), pitch, mode|type|Play_2D); sound->init(volume * sfx->mVolume, volumeFromType(type), pitch, mode|type|Play_2D);
if(!mOutput->playSound(sound, sfx->mHandle, offset)) if(!mOutput->playSound(sound, sfx->mHandle, offset))
@ -611,7 +614,7 @@ namespace MWSound
return nullptr; return nullptr;
// Only one copy of given sound can be played at time on ptr, so stop previous copy // Only one copy of given sound can be played at time on ptr, so stop previous copy
stopSound3D(ptr, soundId); stopSound(sfx, ptr);
bool played; bool played;
Sound *sound = getSoundRef(); Sound *sound = getSoundRef();
@ -678,12 +681,11 @@ namespace MWSound
mOutput->finishSound(sound); mOutput->finishSound(sound);
} }
void SoundManager::stopSound3D(const MWWorld::ConstPtr &ptr, const std::string& soundId) void SoundManager::stopSound(Sound_Buffer *sfx, const MWWorld::ConstPtr &ptr)
{ {
SoundMap::iterator snditer = mActiveSounds.find(ptr); SoundMap::iterator snditer = mActiveSounds.find(ptr);
if(snditer != mActiveSounds.end()) if(snditer != mActiveSounds.end())
{ {
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
for(SoundBufferRefPair &snd : snditer->second) for(SoundBufferRefPair &snd : snditer->second)
{ {
if(snd.second == sfx) if(snd.second == sfx)
@ -692,6 +694,22 @@ namespace MWSound
} }
} }
void SoundManager::stopSound(const std::string& soundId)
{
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
if (!sfx) return;
stopSound(sfx, MWWorld::ConstPtr());
}
void SoundManager::stopSound3D(const MWWorld::ConstPtr &ptr, const std::string& soundId)
{
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
if (!sfx) return;
stopSound(sfx, ptr);
}
void SoundManager::stopSound3D(const MWWorld::ConstPtr &ptr) void SoundManager::stopSound3D(const MWWorld::ConstPtr &ptr)
{ {
SoundMap::iterator snditer = mActiveSounds.find(ptr); SoundMap::iterator snditer = mActiveSounds.find(ptr);
@ -715,6 +733,7 @@ namespace MWSound
mOutput->finishSound(sndbuf.first); mOutput->finishSound(sndbuf.first);
} }
} }
for(SaySoundMap::value_type &snd : mActiveSaySounds) for(SaySoundMap::value_type &snd : mActiveSaySounds)
{ {
if(!snd.first.isEmpty() && snd.first != MWMechanics::getPlayer() && snd.first.getCell() == cell) if(!snd.first.isEmpty() && snd.first != MWMechanics::getPlayer() && snd.first.getCell() == cell)
@ -722,20 +741,6 @@ namespace MWSound
} }
} }
void SoundManager::stopSound(const std::string& soundId)
{
SoundMap::iterator snditer = mActiveSounds.find(MWWorld::ConstPtr());
if(snditer != mActiveSounds.end())
{
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
for(SoundBufferRefPair &sndbuf : snditer->second)
{
if(sndbuf.second == sfx)
mOutput->finishSound(sndbuf.first);
}
}
}
void SoundManager::fadeOutSound3D(const MWWorld::ConstPtr &ptr, void SoundManager::fadeOutSound3D(const MWWorld::ConstPtr &ptr,
const std::string& soundId, float duration) const std::string& soundId, float duration)
{ {

@ -145,6 +145,9 @@ namespace MWSound
DecoderPtr getDecoder(); DecoderPtr getDecoder();
friend class OpenAL_Output; friend class OpenAL_Output;
void stopSound(Sound_Buffer *sfx, const MWWorld::ConstPtr &ptr);
///< Stop the given object from playing given sound buffer.
public: public:
SoundManager(const VFS::Manager* vfs, const std::map<std::string, std::string>& fallbackMap, bool useSound); SoundManager(const VFS::Manager* vfs, const std::map<std::string, std::string>& fallbackMap, bool useSound);
virtual ~SoundManager(); virtual ~SoundManager();

@ -8,35 +8,31 @@ branches:
environment: environment:
matrix: matrix:
- msvc: 2013
- msvc: 2015 - msvc: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- msvc: 2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
platform: platform:
- Win32 # - Win32
# - x64 - x64
configuration: configuration:
- Debug - Debug
# - Release # - Release
# For the Qt, Boost, CMake, etc installs # For the Qt, Boost, CMake, etc installs
os: Visual Studio 2015 #os: Visual Studio 2017
# We want the git revision for versioning, # We want the git revision for versioning,
# so shallow clones don't work. # so shallow clones don't work.
clone_depth: 1 clone_depth: 1
cache: cache:
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2013-win32.7z
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2013-win64.7z
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win32.7z - C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win32.7z
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win64.7z - C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win64.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2013-win32.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2013-win32.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z - C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z - C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2013-win32.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2013-win32.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z - C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z - C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z
- C:\projects\openmw\deps\ffmpeg-3.0.1-dev-win32.7z - C:\projects\openmw\deps\ffmpeg-3.0.1-dev-win32.7z
@ -52,7 +48,7 @@ install:
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH% - set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
before_build: before_build:
- cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -u -p %PLATFORM% -v %msvc% - cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -u -p %PLATFORM% -v %msvc% -V
build_script: build_script:
- cmd: if %PLATFORM%==Win32 set build=MSVC%msvc%_32 - cmd: if %PLATFORM%==Win32 set build=MSVC%msvc%_32

Loading…
Cancel
Save