mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 17:15:32 +00:00
Merge remote-tracking branch 'upstream/master' into osgshadow-test-vdsm
This commit is contained in:
commit
642002b302
93 changed files with 1882 additions and 778 deletions
87
.travis.yml
87
.travis.yml
|
@ -1,10 +1,4 @@
|
|||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode9.4
|
||||
language: cpp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
@ -20,45 +14,84 @@ addons:
|
|||
sources:
|
||||
- sourceline: 'ppa:openmw/openmw'
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
- llvm-toolchain-xenial-7
|
||||
packages: [
|
||||
# Dev
|
||||
cmake, clang-3.6, libunshield-dev, libtinyxml-dev,
|
||||
cmake, clang-7, clang-tools-7, gcc-8, g++-8,
|
||||
# Boost
|
||||
libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev,
|
||||
# FFmpeg
|
||||
libavcodec-dev, libavformat-dev, libavutil-dev, libswscale-dev,
|
||||
# Audio & Video
|
||||
libsdl2-dev, libqt4-dev, libopenal-dev,
|
||||
libavcodec-dev, libavformat-dev, libavutil-dev, libswresample-dev, libswscale-dev,
|
||||
# Audio, Video and Misc. deps
|
||||
libsdl2-dev, libqt5opengl5-dev, libopenal-dev, libunshield-dev, libtinyxml-dev,
|
||||
# The other ones from OpenMW ppa
|
||||
libbullet-dev, libswresample-dev, libopenscenegraph-3.4-dev, libmygui-dev
|
||||
libbullet-dev, libopenscenegraph-3.4-dev, libmygui-dev
|
||||
]
|
||||
|
||||
coverity_scan:
|
||||
coverity_scan: # TODO: currently takes too long, disabled openmw/openmw-cs for now.
|
||||
project:
|
||||
name: "OpenMW/openmw"
|
||||
description: "<Your project description here>"
|
||||
notification_email: 720642+scrawl@users.noreply.github.com
|
||||
build_command_prepend: "cmake . -DBUILD_UNITTESTS=FALSE -DBUILD_OPENCS=FALSE -DBUILD_BSATOOL=FALSE -DBUILD_ESMTOOL=FALSE -DBUILD_MWINIIMPORTER=FALSE -DBUILD_LAUNCHER=FALSE"
|
||||
build_command: "make -j3"
|
||||
branch_pattern: coverity_scan
|
||||
notification_email: 1122069+psi29a@users.noreply.github.com
|
||||
build_command_prepend: "cov-configure --comptype gcc --compiler gcc-5 --template; cmake . -DBUILD_OPENMW=FALSE -DBUILD_OPENCS=FALSE"
|
||||
build_command: "make VERBOSE=1 -j3"
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
- name: OpenMW (all) on MacOS xcode9.4
|
||||
os: osx
|
||||
osx_image: xcode9.4
|
||||
if: branch != coverity_scan
|
||||
- name: OpenMW (all) on Ubuntu Xenial GCC-5
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
if: branch != coverity_scan
|
||||
- name: OpenMW (all) on Ubuntu Xenial GCC-8
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
env:
|
||||
ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 "
|
||||
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
||||
if: branch != coverity_scan
|
||||
- name: OpenMW (openmw) on Ubuntu Xenial Clang-7 with Static Analysis
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
||||
- ANALYZE="scan-build-7 --force-analyze-debug-code --use-cc clang-7 --use-c++ clang++-7"
|
||||
- BUILD_OPENMW_CS="OFF"
|
||||
if: branch != coverity_scan
|
||||
compiler: clang
|
||||
allow_failures:
|
||||
- env: ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 "
|
||||
- name: OpenMW (openmw-cs) on Ubuntu Xenial Clang-7 with Static Analysis
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
||||
- ANALYZE="scan-build-7 --force-analyze-debug-code --use-cc clang-7 --use-c++ clang++-7"
|
||||
- BUILD_OPENMW="OFF"
|
||||
if: branch != coverity_scan
|
||||
compiler: clang
|
||||
- name: OpenMW Components Coverity Scan
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
if: branch = coverity_scan
|
||||
# allow_failures:
|
||||
# - name: OpenMW (openmw) on Ubuntu Xenial Clang-7 with Static Analysis
|
||||
|
||||
before_install: ./CI/before_install.${TRAVIS_OS_NAME}.sh
|
||||
before_script: ./CI/before_script.${TRAVIS_OS_NAME}.sh
|
||||
before_install:
|
||||
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then eval "${MATRIX_EVAL}"; fi
|
||||
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./CI/before_install.${TRAVIS_OS_NAME}.sh; fi
|
||||
before_script:
|
||||
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./CI/before_script.${TRAVIS_OS_NAME}.sh; fi
|
||||
script:
|
||||
- cd ./build
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j3; fi
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi
|
||||
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ${ANALYZE} make -j3; fi
|
||||
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi
|
||||
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi
|
||||
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi
|
||||
- cd "${TRAVIS_BUILD_DIR}"
|
||||
deploy:
|
||||
provider: script
|
||||
|
|
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,9 +1,17 @@
|
|||
0.46.0
|
||||
------
|
||||
|
||||
Bug #3623: Fix HiDPI on Windows
|
||||
Bug #4540: Rain delay when exiting water
|
||||
Bug #4701: PrisonMarker record is not hardcoded like other markers
|
||||
Bug #4714: Crash upon game load in the repair menu while the "Your repair failed!" message is active
|
||||
Bug #4715: "Cannot get class of an empty object" exception after pressing ESC in the dialogue mode
|
||||
Bug #4720: Inventory avatar has shield with two-handed weapon during [un]equipping animation
|
||||
Bug #4723: ResetActors command works incorrectly
|
||||
Feature #2229: Improve pathfinding AI
|
||||
Feature #3442: Default values for fallbacks from ini file
|
||||
|
||||
Feature #4673: Weapon sheathing
|
||||
Task #4686: Upgrade media decoder to a more current FFmpeg API
|
||||
|
||||
0.45.0
|
||||
------
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
sudo ln -s /usr/bin/clang-3.6 /usr/local/bin/clang
|
||||
sudo ln -s /usr/bin/clang++-3.6 /usr/local/bin/clang++
|
||||
#!/bin/bash -ex
|
||||
|
||||
sudo ln -sf /usr/bin/clang-7 /usr/local/bin/clang
|
||||
sudo ln -sf /usr/bin/clang++-7 /usr/local/bin/clang++
|
||||
|
|
|
@ -6,5 +6,5 @@ brew outdated cmake || brew upgrade cmake
|
|||
brew outdated pkgconfig || brew upgrade pkgconfig
|
||||
brew install qt
|
||||
|
||||
curl -fSL -R -J https://downloads.openmw.org/osx/dependencies/openmw-deps-4eec887.zip -o ~/openmw-deps.zip
|
||||
curl -fSL -R -J https://downloads.openmw.org/osx/dependencies/openmw-deps-7cf2789.zip -o ~/openmw-deps.zip
|
||||
unzip -o ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
#!/bin/bash -ex
|
||||
|
||||
free -m
|
||||
|
||||
|
@ -8,10 +8,26 @@ GOOGLETEST_DIR="$(pwd)/googletest/build"
|
|||
mkdir build
|
||||
cd build
|
||||
export CODE_COVERAGE=1
|
||||
if [ "${CC}" = "clang" ]; then export CODE_COVERAGE=0; fi
|
||||
${ANALYZE}cmake \
|
||||
|
||||
if [[ "${CC}" =~ "clang" ]]; then export CODE_COVERAGE=0; fi
|
||||
if [[ -z "${BUILD_OPENMW}" ]]; then export BUILD_OPENMW=ON; fi
|
||||
if [[ -z "${BUILD_OPENMW_CS}" ]]; then export BUILD_OPENMW_CS=ON; fi
|
||||
|
||||
${ANALYZE} cmake \
|
||||
-DBUILD_OPENMW=${BUILD_OPENMW} \
|
||||
-DBUILD_OPENCS=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_LAUNCHER=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_BSATOOL=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_ESMTOOL=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_MWINIIMPORTER=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_ESSIMPORTER=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_WIZARD=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_NIFTEST=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_MYGUI_PLUGIN=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_WITH_CODE_COVERAGE=${CODE_COVERAGE} \
|
||||
-DBUILD_UNITTESTS=1 \
|
||||
-DUSE_SYSTEM_TINYXML=1 \
|
||||
-DDESIRED_QT_VERSION=5 \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DBINDIR=/usr/games \
|
||||
-DCMAKE_BUILD_TYPE="None" \
|
||||
|
|
|
@ -194,7 +194,11 @@ download() {
|
|||
}
|
||||
|
||||
real_pwd() {
|
||||
pwd | sed "s,/\(.\),\1:,"
|
||||
if type cygpath >/dev/null 2>&1; then
|
||||
cygpath -am "$PWD"
|
||||
else
|
||||
pwd # not git bash, Cygwin or the like
|
||||
fi
|
||||
}
|
||||
|
||||
CMAKE_OPTS=""
|
||||
|
@ -349,9 +353,9 @@ if [ -z $SKIP_DOWNLOAD ]; then
|
|||
"MyGUI-3.2.2-msvc${MSVC_YEAR}-win${BITS}.7z"
|
||||
|
||||
# OpenAL
|
||||
download "OpenAL-Soft 1.17.2" \
|
||||
"http://openal-soft.org/openal-binaries/openal-soft-1.17.2-bin.zip" \
|
||||
"OpenAL-Soft-1.17.2.zip"
|
||||
download "OpenAL-Soft 1.19.1" \
|
||||
"http://openal-soft.org/openal-binaries/openal-soft-1.19.1-bin.zip" \
|
||||
"OpenAL-Soft-1.19.1.zip"
|
||||
|
||||
# OSG
|
||||
download "OpenSceneGraph 3.4.1-scrawl" \
|
||||
|
@ -529,18 +533,18 @@ printf "MyGUI 3.2.2... "
|
|||
cd $DEPS
|
||||
echo
|
||||
# OpenAL
|
||||
printf "OpenAL-Soft 1.17.2... "
|
||||
printf "OpenAL-Soft 1.19.1... "
|
||||
{
|
||||
if [ -d openal-soft-1.17.2-bin ]; then
|
||||
if [ -d openal-soft-1.19.1-bin ]; then
|
||||
printf "Exists. "
|
||||
elif [ -z $SKIP_EXTRACT ]; then
|
||||
rm -rf openal-soft-1.17.2-bin
|
||||
eval 7z x -y OpenAL-Soft-1.17.2.zip $STRIP
|
||||
rm -rf openal-soft-1.19.1-bin
|
||||
eval 7z x -y OpenAL-Soft-1.19.1.zip $STRIP
|
||||
fi
|
||||
OPENAL_SDK="$(real_pwd)/openal-soft-1.17.2-bin"
|
||||
OPENAL_SDK="$(real_pwd)/openal-soft-1.19.1-bin"
|
||||
add_cmake_opts -DOPENAL_INCLUDE_DIR="${OPENAL_SDK}/include/AL" \
|
||||
-DOPENAL_LIBRARY="${OPENAL_SDK}/libs/Win${BITS}/OpenAL32.lib"
|
||||
add_runtime_dlls "$(pwd)/openal-soft-1.17.2-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll"
|
||||
add_runtime_dlls "$(pwd)/openal-soft-1.19.1-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll"
|
||||
echo Done.
|
||||
}
|
||||
cd $DEPS
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
# Apps and tools
|
||||
option(BUILD_OPENMW "build OpenMW" ON)
|
||||
option(BUILD_BSATOOL "build BSA extractor" ON)
|
||||
option(BUILD_ESMTOOL "build ESM inspector" ON)
|
||||
option(BUILD_LAUNCHER "build Launcher" ON)
|
||||
option(BUILD_MWINIIMPORTER "build MWiniImporter" ON)
|
||||
option(BUILD_ESSIMPORTER "build ESS (Morrowind save game) importer" ON)
|
||||
option(BUILD_OPENCS "build OpenMW Construction Set" ON)
|
||||
option(BUILD_WIZARD "build Installation Wizard" ON)
|
||||
option(BUILD_OPENMW "Build OpenMW" ON)
|
||||
option(BUILD_LAUNCHER "Build Launcher" ON)
|
||||
option(BUILD_WIZARD "Build Installation Wizard" ON)
|
||||
option(BUILD_MWINIIMPORTER "Build MWiniImporter" ON)
|
||||
option(BUILD_OPENCS "Build OpenMW Construction Set" ON)
|
||||
option(BUILD_ESSIMPORTER "Build ESS (Morrowind save game) importer" ON)
|
||||
option(BUILD_BSATOOL "Build BSA extractor" ON)
|
||||
option(BUILD_ESMTOOL "Build ESM inspector" ON)
|
||||
option(BUILD_NIFTEST "Build nif file tester" ON)
|
||||
option(BUILD_MYGUI_PLUGIN "Build MyGUI plugin for OpenMW resources, to use with MyGUI tools" ON)
|
||||
option(BUILD_DOCS "Build documentation." OFF )
|
||||
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
||||
option(BUILD_NIFTEST "build nif file tester" OFF)
|
||||
option(BUILD_MYGUI_PLUGIN "build MyGUI plugin for OpenMW resources, to use with MyGUI tools" ON)
|
||||
option(BUILD_DOCS "build documentation." OFF )
|
||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
||||
|
||||
if (NOT BUILD_LAUNCHER AND NOT BUILD_OPENCS AND NOT BUILD_WIZARD)
|
||||
set(USE_QT FALSE)
|
||||
|
@ -54,7 +54,7 @@ endif()
|
|||
message(STATUS "Configuring OpenMW...")
|
||||
|
||||
set(OPENMW_VERSION_MAJOR 0)
|
||||
set(OPENMW_VERSION_MINOR 44)
|
||||
set(OPENMW_VERSION_MINOR 46)
|
||||
set(OPENMW_VERSION_RELEASE 0)
|
||||
|
||||
set(OPENMW_VERSION_COMMITHASH "")
|
||||
|
@ -153,7 +153,52 @@ if (USE_QT)
|
|||
endif()
|
||||
|
||||
# Sound setup
|
||||
|
||||
# Require at least ffmpeg 3.2 for now
|
||||
SET(FFVER_OK FALSE)
|
||||
|
||||
find_package(FFmpeg REQUIRED COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE)
|
||||
|
||||
if(FFmpeg_FOUND)
|
||||
SET(FFVER_OK TRUE)
|
||||
|
||||
# Can not detect FFmpeg version on Windows for now
|
||||
if (NOT WIN32)
|
||||
if(FFmpeg_AVFORMAT_VERSION VERSION_LESS "57.56.100")
|
||||
message(STATUS "libavformat is too old! (${FFmpeg_AVFORMAT_VERSION}, wanted 57.56.100)")
|
||||
set(FFVER_OK FALSE)
|
||||
endif()
|
||||
if(FFmpeg_AVCODEC_VERSION VERSION_LESS "57.64.100")
|
||||
message(STATUS "libavcodec is too old! (${FFmpeg_AVCODEC_VERSION}, wanted 57.64.100)")
|
||||
set(FFVER_OK FALSE)
|
||||
endif()
|
||||
if(FFmpeg_AVUTIL_VERSION VERSION_LESS "55.34.100")
|
||||
message(STATUS "libavutil is too old! (${FFmpeg_AVUTIL_VERSION}, wanted 55.34.100)")
|
||||
set(FFVER_OK FALSE)
|
||||
endif()
|
||||
if(FFmpeg_SWSCALE_VERSION VERSION_LESS "4.2.100")
|
||||
message(STATUS "libswscale is too old! (${FFmpeg_SWSCALE_VERSION}, wanted 4.2.100)")
|
||||
set(FFVER_OK FALSE)
|
||||
endif()
|
||||
if(FFmpeg_SWRESAMPLE_VERSION VERSION_LESS "2.3.100")
|
||||
message(STATUS "libswresample is too old! (${FFmpeg_SWRESAMPLE_VERSION}, wanted 2.3.100)")
|
||||
set(FFVER_OK FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT FFmpeg_FOUND)
|
||||
message(FATAL_ERROR "FFmpeg was not found" )
|
||||
endif()
|
||||
|
||||
if(NOT FFVER_OK)
|
||||
message(FATAL_ERROR "FFmpeg version is too old, 3.2 is required" )
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
message("Can not detect FFmpeg version, at least the 3.2 is required" )
|
||||
endif()
|
||||
|
||||
# Required for building the FFmpeg headers
|
||||
add_definitions(-D__STDC_CONSTANT_MACROS)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ OpenMW is an open-source game engine that supports playing Morrowind by Bethesda
|
|||
|
||||
OpenMW also comes with OpenMW-CS, a replacement for Bethesda's Construction Set.
|
||||
|
||||
* Version: 0.44.0
|
||||
* Version: 0.46.0
|
||||
* License: GPLv3 (see [LICENSE](https://github.com/OpenMW/openmw/blob/master/LICENSE) for more information)
|
||||
* Website: https://www.openmw.org
|
||||
* IRC: #openmw on irc.freenode.net
|
||||
|
|
|
@ -123,14 +123,9 @@ bool parseOptions (int argc, char** argv, Arguments &info)
|
|||
|
||||
bpo::store(valid_opts, variables);
|
||||
}
|
||||
catch(boost::program_options::unknown_option & x)
|
||||
catch(std::exception &e)
|
||||
{
|
||||
std::cerr << "ERROR: " << x.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
catch(boost::program_options::invalid_command_line_syntax & x)
|
||||
{
|
||||
std::cerr << "ERROR: " << x.what() << std::endl;
|
||||
std::cout << "ERROR parsing arguments: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -507,7 +502,7 @@ int clone(Arguments& info)
|
|||
esm.endRecord(typeName.toString());
|
||||
|
||||
saved++;
|
||||
int perc = (int)((saved / (float)recordCount)*100);
|
||||
int perc = recordCount == 0 ? 100 : (int)((saved / (float)recordCount)*100);
|
||||
if (perc % 10 == 0)
|
||||
{
|
||||
std::cerr << "\r" << perc << "%";
|
||||
|
|
|
@ -860,11 +860,12 @@ std::vector<std::string>::iterator MwIniImporter::findString(std::vector<std::st
|
|||
}
|
||||
|
||||
void MwIniImporter::addPaths(std::vector<boost::filesystem::path>& output, std::vector<std::string> input) {
|
||||
for (auto& path : input) {
|
||||
for (auto& path : input)
|
||||
{
|
||||
if (path.front() == '"')
|
||||
{
|
||||
path.erase(path.begin());
|
||||
path.erase(path.end() - 1);
|
||||
// Drop first and last characters - quotation marks
|
||||
path = path.substr(1, path.size() - 2);
|
||||
}
|
||||
output.emplace_back(path);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ void readVFS(VFS::Archive* anArchive,std::string archivePath = "")
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> parseOptions (int argc, char** argv)
|
||||
bool parseOptions (int argc, char** argv, std::vector<std::string>& files)
|
||||
{
|
||||
bpo::options_description desc("Ensure that OpenMW can use the provided NIF and BSA files\n\n"
|
||||
"Usages:\n"
|
||||
|
@ -107,35 +107,39 @@ std::vector<std::string> parseOptions (int argc, char** argv)
|
|||
{
|
||||
std::cout << "ERROR parsing arguments: " << e.what() << "\n\n"
|
||||
<< desc << std::endl;
|
||||
exit(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
bpo::notify(variables);
|
||||
if (variables.count ("help"))
|
||||
{
|
||||
std::cout << desc << std::endl;
|
||||
exit(1);
|
||||
return false;
|
||||
}
|
||||
if (variables.count("input-file"))
|
||||
{
|
||||
return variables["input-file"].as< std::vector<std::string> >();
|
||||
files = variables["input-file"].as< std::vector<std::string> >();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::cout << "No input files or directories specified!" << std::endl;
|
||||
std::cout << desc << std::endl;
|
||||
exit(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::vector<std::string> files = parseOptions (argc, argv);
|
||||
std::vector<std::string> files;
|
||||
if(!parseOptions (argc, argv, files))
|
||||
return 1;
|
||||
|
||||
// std::cout << "Reading Files" << std::endl;
|
||||
for(std::vector<std::string>::const_iterator it=files.begin(); it!=files.end(); ++it)
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string name = *it;
|
||||
|
||||
try{
|
||||
try
|
||||
{
|
||||
if(isNIF(name))
|
||||
{
|
||||
//std::cout << "Decoding: " << name << std::endl;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "document.hpp"
|
||||
|
||||
CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& configuration)
|
||||
: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252)
|
||||
: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252), mFsStrict(false)
|
||||
{
|
||||
boost::filesystem::path projectPath = configuration.getUserDataPath() / "projects";
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <QAction>
|
||||
#include <QWidget>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include "state.hpp"
|
||||
#include "shortcutmanager.hpp"
|
||||
|
||||
|
@ -71,7 +73,14 @@ namespace CSMPrefs
|
|||
|
||||
Shortcut::~Shortcut()
|
||||
{
|
||||
State::get().getShortcutManager().removeShortcut(this);
|
||||
try
|
||||
{
|
||||
State::get().getShortcutManager().removeShortcut(this);
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
bool Shortcut::isEnabled() const
|
||||
|
|
|
@ -21,6 +21,11 @@ namespace CSMWorld
|
|||
return mIsBeast;
|
||||
}
|
||||
|
||||
ActorAdapter::RaceData::RaceData()
|
||||
{
|
||||
mIsBeast = false;
|
||||
}
|
||||
|
||||
bool ActorAdapter::RaceData::handlesPart(ESM::PartReferenceType type) const
|
||||
{
|
||||
switch (type)
|
||||
|
@ -83,6 +88,12 @@ namespace CSMWorld
|
|||
}
|
||||
|
||||
|
||||
ActorAdapter::ActorData::ActorData()
|
||||
{
|
||||
mCreature = false;
|
||||
mFemale = false;
|
||||
}
|
||||
|
||||
const std::string& ActorAdapter::ActorData::getId() const
|
||||
{
|
||||
return mId;
|
||||
|
@ -113,17 +124,22 @@ namespace CSMWorld
|
|||
const std::string ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const
|
||||
{
|
||||
auto it = mParts.find(index);
|
||||
if (it == mParts.end() && mRaceData && mRaceData->handlesPart(index))
|
||||
if (it == mParts.end())
|
||||
{
|
||||
if (mFemale)
|
||||
if (mRaceData && mRaceData->handlesPart(index))
|
||||
{
|
||||
// Note: we should use male parts for females as fallback
|
||||
const std::string femalePart = mRaceData->getFemalePart(index);
|
||||
if (!femalePart.empty())
|
||||
return femalePart;
|
||||
if (mFemale)
|
||||
{
|
||||
// Note: we should use male parts for females as fallback
|
||||
const std::string femalePart = mRaceData->getFemalePart(index);
|
||||
if (!femalePart.empty())
|
||||
return femalePart;
|
||||
}
|
||||
|
||||
return mRaceData->getMalePart(index);
|
||||
}
|
||||
|
||||
return mRaceData->getMalePart(index);
|
||||
return "";
|
||||
}
|
||||
|
||||
const std::string& partName = it->second.first;
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace CSMWorld
|
|||
class RaceData
|
||||
{
|
||||
public:
|
||||
RaceData();
|
||||
|
||||
/// Retrieves the id of the race represented
|
||||
const std::string& getId() const;
|
||||
/// Checks if it's a beast race
|
||||
|
@ -80,6 +82,8 @@ namespace CSMWorld
|
|||
class ActorData
|
||||
{
|
||||
public:
|
||||
ActorData();
|
||||
|
||||
/// Retrieves the id of the actor represented
|
||||
const std::string& getId() const;
|
||||
/// Checks if the actor is a creature
|
||||
|
|
|
@ -198,7 +198,8 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI
|
|||
|
||||
if (mIndex.parent().isValid())
|
||||
{
|
||||
setText ("Modify " + dynamic_cast<CSMWorld::IdTree*>(mModel)->nestedHeaderData (
|
||||
CSMWorld::IdTree* tree = &dynamic_cast<CSMWorld::IdTree&>(*mModel);
|
||||
setText ("Modify " + tree->nestedHeaderData (
|
||||
mIndex.parent().column(), mIndex.column(), Qt::Horizontal, Qt::DisplayRole).toString());
|
||||
}
|
||||
else
|
||||
|
@ -243,12 +244,7 @@ void CSMWorld::CreateCommand::applyModifications()
|
|||
{
|
||||
if (!mNestedValues.empty())
|
||||
{
|
||||
CSMWorld::IdTree *tree = dynamic_cast<CSMWorld::IdTree *>(&mModel);
|
||||
if (tree == nullptr)
|
||||
{
|
||||
throw std::logic_error("CSMWorld::CreateCommand: Attempt to add nested values to the non-nested model");
|
||||
}
|
||||
|
||||
CSMWorld::IdTree* tree = &dynamic_cast<CSMWorld::IdTree&>(mModel);
|
||||
std::map<int, std::pair<int, QVariant> >::const_iterator current = mNestedValues.begin();
|
||||
std::map<int, std::pair<int, QVariant> >::const_iterator end = mNestedValues.end();
|
||||
for (; current != end; ++current)
|
||||
|
|
|
@ -977,15 +977,19 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base
|
|||
void CSMWorld::Data::loadFallbackEntries()
|
||||
{
|
||||
// Load default marker definitions, if game files do not have them for some reason
|
||||
std::pair<std::string, std::string> markers[] = {
|
||||
std::make_pair("divinemarker", "marker_divine.nif"),
|
||||
std::make_pair("doormarker", "marker_arrow.nif"),
|
||||
std::make_pair("northmarker", "marker_north.nif"),
|
||||
std::make_pair("templemarker", "marker_temple.nif"),
|
||||
std::make_pair("travelmarker", "marker_travel.nif")
|
||||
std::pair<std::string, std::string> staticMarkers[] = {
|
||||
std::make_pair("DivineMarker", "marker_divine.nif"),
|
||||
std::make_pair("DoorMarker", "marker_arrow.nif"),
|
||||
std::make_pair("NorthMarker", "marker_north.nif"),
|
||||
std::make_pair("TempleMarker", "marker_temple.nif"),
|
||||
std::make_pair("TravelMarker", "marker_travel.nif")
|
||||
};
|
||||
|
||||
for (const std::pair<std::string, std::string> marker : markers)
|
||||
std::pair<std::string, std::string> doorMarkers[] = {
|
||||
std::make_pair("PrisonMarker", "marker_prison.nif")
|
||||
};
|
||||
|
||||
for (const std::pair<std::string, std::string> marker : staticMarkers)
|
||||
{
|
||||
if (mReferenceables.searchId (marker.first)==-1)
|
||||
{
|
||||
|
@ -995,6 +999,17 @@ void CSMWorld::Data::loadFallbackEntries()
|
|||
mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Static);
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::pair<std::string, std::string> marker : doorMarkers)
|
||||
{
|
||||
if (mReferenceables.searchId (marker.first)==-1)
|
||||
{
|
||||
CSMWorld::Record<ESM::Door> record;
|
||||
record.mBase = ESM::Door(marker.first, std::string(), marker.second, std::string(), std::string(), std::string());
|
||||
record.mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Door);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
|
||||
|
|
|
@ -520,7 +520,6 @@ std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getConditionFloatRange
|
|||
const float FloatMax = std::numeric_limits<float>::infinity();
|
||||
const float FloatMin = -std::numeric_limits<float>::infinity();
|
||||
const float Epsilon = std::numeric_limits<float>::epsilon();
|
||||
const std::pair<float, float> InvalidRange(FloatMax, FloatMin);
|
||||
|
||||
float value = mConstSelect.mValue.getFloat();
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <QStackedWidget>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include "../../model/prefs/state.hpp"
|
||||
|
||||
#include "page.hpp"
|
||||
|
@ -77,8 +79,15 @@ CSVPrefs::Dialogue::Dialogue()
|
|||
|
||||
CSVPrefs::Dialogue::~Dialogue()
|
||||
{
|
||||
if (isVisible())
|
||||
CSMPrefs::State::get().save();
|
||||
try
|
||||
{
|
||||
if (isVisible())
|
||||
CSMPrefs::State::get().save();
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
void CSVPrefs::Dialogue::closeEvent (QCloseEvent *event)
|
||||
|
|
|
@ -463,6 +463,7 @@ namespace CSVRender
|
|||
, mDistance(0)
|
||||
, mOrbitSpeed(osg::PI / 4)
|
||||
, mOrbitSpeedMult(4)
|
||||
, mConstRoll(false)
|
||||
{
|
||||
CSMPrefs::Shortcut* naviPrimaryShortcut = new CSMPrefs::Shortcut("scene-navi-primary", widget);
|
||||
naviPrimaryShortcut->enable(false);
|
||||
|
|
|
@ -224,8 +224,7 @@ namespace CSVRender
|
|||
|
||||
void Pathgrid::applyPoint(CSMWorld::CommandMacro& commands, const osg::Vec3d& worldPos)
|
||||
{
|
||||
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(
|
||||
CSMWorld::UniversalId::Type_Pathgrids));
|
||||
CSMWorld::IdTree* model = &dynamic_cast<CSMWorld::IdTree&>(*mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
|
||||
|
||||
const CSMWorld::Pathgrid* source = getPathgridSource();
|
||||
if (source)
|
||||
|
@ -357,8 +356,7 @@ namespace CSVRender
|
|||
const CSMWorld::Pathgrid* source = getPathgridSource();
|
||||
if (source)
|
||||
{
|
||||
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(
|
||||
CSMWorld::UniversalId::Type_Pathgrids));
|
||||
CSMWorld::IdTree* model = &dynamic_cast<CSMWorld::IdTree&>(*mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
|
||||
|
||||
// Want to remove nodes from end of list first
|
||||
std::sort(mSelected.begin(), mSelected.end(), std::greater<int>());
|
||||
|
@ -458,9 +456,7 @@ namespace CSVRender
|
|||
}
|
||||
}
|
||||
|
||||
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(
|
||||
CSMWorld::UniversalId::Type_Pathgrids));
|
||||
|
||||
CSMWorld::IdTree* model = &dynamic_cast<CSMWorld::IdTree&>(*mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
|
||||
int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges);
|
||||
|
||||
std::set<int, std::greater<int> >::iterator row;
|
||||
|
@ -633,8 +629,7 @@ namespace CSVRender
|
|||
void Pathgrid::addEdge(CSMWorld::CommandMacro& commands, const CSMWorld::Pathgrid& source, unsigned short node1,
|
||||
unsigned short node2)
|
||||
{
|
||||
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(
|
||||
CSMWorld::UniversalId::Type_Pathgrids));
|
||||
CSMWorld::IdTree* model = &dynamic_cast<CSMWorld::IdTree&>(*mData.getTableModel(CSMWorld::UniversalId::Type_Pathgrids));
|
||||
|
||||
int recordIndex = mPathgridCollection.getIndex(mId);
|
||||
int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <osg/Material>
|
||||
#include <osg/Version>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/resource/scenemanager.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
|
@ -96,7 +97,14 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
|
||||
RenderWidget::~RenderWidget()
|
||||
{
|
||||
CompositeViewer::get().removeView(mView);
|
||||
try
|
||||
{
|
||||
CompositeViewer::get().removeView(mView);
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
Log(Debug::Error) << "Error in the destructor: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderWidget::flagAsModified()
|
||||
|
|
|
@ -256,9 +256,9 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
|||
std::string mBrushTextureInt = mBrushTexture.substr (hashlocation+1);
|
||||
int brushInt = stoi(mBrushTexture.substr (hashlocation+1))+1; // All indices are offset by +1
|
||||
|
||||
float rf = mBrushSize/2;
|
||||
int r = (mBrushSize/2)+1;
|
||||
float distance = 0;
|
||||
int rf = mBrushSize / 2;
|
||||
int r = mBrushSize / 2 + 1;
|
||||
int distance = 0;
|
||||
|
||||
if (mBrushShape == 0)
|
||||
{
|
||||
|
|
|
@ -24,8 +24,8 @@ std::string CSVWorld::CellCreator::getId() const
|
|||
|
||||
void CSVWorld::CellCreator::configureCreateCommand(CSMWorld::CreateCommand& command) const
|
||||
{
|
||||
CSMWorld::IdTree *model = dynamic_cast<CSMWorld::IdTree *>(getData().getTableModel(getCollectionId()));
|
||||
Q_ASSERT(model != nullptr);
|
||||
CSMWorld::IdTree* model = &dynamic_cast<CSMWorld::IdTree&>(*getData().getTableModel(getCollectionId()));
|
||||
|
||||
int parentIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Cell);
|
||||
int index = model->findNestedColumnIndex(parentIndex, CSMWorld::Columns::ColumnId_Interior);
|
||||
command.addNestedValue(parentIndex, index, mType->currentIndex() == 0);
|
||||
|
|
|
@ -555,8 +555,8 @@ void CSVWorld::EditWidget::remake(int row)
|
|||
if (mTable->hasChildren(mTable->index(row, i)) &&
|
||||
!(flags & CSMWorld::ColumnBase::Flag_Dialogue_List))
|
||||
{
|
||||
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel (
|
||||
mTable->index(row, i), display, dynamic_cast<CSMWorld::IdTree*>(mTable)));
|
||||
CSMWorld::IdTree* innerTable = &dynamic_cast<CSMWorld::IdTree&>(*mTable);
|
||||
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel (mTable->index(row, i), display, innerTable));
|
||||
|
||||
int idColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
||||
int typeColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_RecordType);
|
||||
|
|
|
@ -81,8 +81,11 @@ void CSVWorld::ScriptHighlighter::highlight (const Compiler::TokenLoc& loc, Type
|
|||
|
||||
CSVWorld::ScriptHighlighter::ScriptHighlighter (const CSMWorld::Data& data, Mode mode,
|
||||
QTextDocument *parent)
|
||||
: QSyntaxHighlighter (parent), Compiler::Parser (mErrorHandler, mContext), mContext (data),
|
||||
mMode (mode)
|
||||
: QSyntaxHighlighter (parent)
|
||||
, Compiler::Parser (mErrorHandler, mContext)
|
||||
, mContext (data)
|
||||
, mMode (mode)
|
||||
, mMarkOccurrences (false)
|
||||
{
|
||||
QColor color ("black");
|
||||
QTextCharFormat format;
|
||||
|
|
|
@ -4,6 +4,7 @@ set(GAME
|
|||
engine.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/files/windows/openmw.rc
|
||||
${CMAKE_SOURCE_DIR}/files/windows/openmw.exe.manifest
|
||||
)
|
||||
|
||||
if (ANDROID)
|
||||
|
|
|
@ -607,6 +607,8 @@ namespace MWBase
|
|||
virtual void updateActorPath(const MWWorld::ConstPtr& actor, const std::deque<osg::Vec3f>& path,
|
||||
const osg::Vec3f& halfExtents, const osg::Vec3f& start, const osg::Vec3f& end) const = 0;
|
||||
|
||||
virtual void removeActorPath(const MWWorld::ConstPtr& actor) const = 0;
|
||||
|
||||
virtual void setNavMeshNumberToRender(const std::size_t value) = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace MWClass
|
|||
getContainerStore(ptr).fill(ref->mBase->mInventory, ptr.getCellRef().getRefId());
|
||||
|
||||
if (hasInventory)
|
||||
getInventoryStore(ptr).autoEquipShield(ptr);
|
||||
getInventoryStore(ptr).autoEquip(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -743,6 +743,7 @@ namespace
|
|||
mVertices (vertices),
|
||||
mRenderXform (renderXform)
|
||||
{
|
||||
assert(font != nullptr);
|
||||
mVertexColourType = MyGUI::RenderManager::getInstance().getVertexFormat();
|
||||
}
|
||||
|
||||
|
|
|
@ -740,6 +740,9 @@ namespace MWGui
|
|||
|
||||
bool DialogueWindow::isCompanion(const MWWorld::Ptr& actor)
|
||||
{
|
||||
if (actor.isEmpty())
|
||||
return false;
|
||||
|
||||
return !actor.getClass().getScript(actor).empty()
|
||||
&& actor.getRefData().getLocals().getIntVar(actor.getClass().getScript(actor), "companion");
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ bool shouldAcceptKeyFocus(MyGUI::Widget* w)
|
|||
/// Recursively get all child widgets that accept keyboard input
|
||||
void getKeyFocusWidgets(MyGUI::Widget* parent, std::vector<MyGUI::Widget*>& results)
|
||||
{
|
||||
assert(parent != nullptr);
|
||||
|
||||
if (!parent->getVisible() || !parent->getEnabled())
|
||||
return;
|
||||
|
||||
|
|
|
@ -330,6 +330,21 @@ namespace MWGui
|
|||
}
|
||||
}
|
||||
|
||||
void ToolTips::clear()
|
||||
{
|
||||
mFocusObject = MWWorld::Ptr();
|
||||
|
||||
while (mDynamicToolTipBox->getChildCount())
|
||||
{
|
||||
MyGUI::Gui::getInstance().destroyWidget(mDynamicToolTipBox->getChildAt(0));
|
||||
}
|
||||
|
||||
for (unsigned int i=0; i < mMainWidget->getChildCount(); ++i)
|
||||
{
|
||||
mMainWidget->getChildAt(i)->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ToolTips::setFocusObject(const MWWorld::Ptr& focus)
|
||||
{
|
||||
mFocusObject = focus;
|
||||
|
|
|
@ -59,6 +59,8 @@ namespace MWGui
|
|||
|
||||
void setDelay(float delay);
|
||||
|
||||
void clear();
|
||||
|
||||
void setFocusObject(const MWWorld::Ptr& focus);
|
||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||
///< set the screen-space position of the tooltip for focused object
|
||||
|
|
|
@ -1728,7 +1728,7 @@ namespace MWGui
|
|||
|
||||
mMessageBoxManager->clear();
|
||||
|
||||
mToolTips->setFocusObject(MWWorld::Ptr());
|
||||
mToolTips->clear();
|
||||
|
||||
mSelectedSpell.clear();
|
||||
mCustomMarkers.clear();
|
||||
|
|
|
@ -309,6 +309,12 @@ namespace MWMechanics
|
|||
void Actors::updateHeadTracking(const MWWorld::Ptr& actor, const MWWorld::Ptr& targetActor,
|
||||
MWWorld::Ptr& headTrackTarget, float& sqrHeadTrackDistance)
|
||||
{
|
||||
if (!actor.getRefData().getBaseNode())
|
||||
return;
|
||||
|
||||
if (targetActor.getClass().getCreatureStats(targetActor).isDead())
|
||||
return;
|
||||
|
||||
static const float fMaxHeadTrackDistance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||
.find("fMaxHeadTrackDistance")->mValue.getFloat();
|
||||
static const float fInteriorHeadTrackMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||
|
@ -318,22 +324,16 @@ namespace MWMechanics
|
|||
if (!currentCell->isExterior() && !(currentCell->mData.mFlags & ESM::Cell::QuasiEx))
|
||||
maxDistance *= fInteriorHeadTrackMult;
|
||||
|
||||
const ESM::Position& actor1Pos = actor.getRefData().getPosition();
|
||||
const ESM::Position& actor2Pos = targetActor.getRefData().getPosition();
|
||||
float sqrDist = (actor1Pos.asVec3() - actor2Pos.asVec3()).length2();
|
||||
const osg::Vec3f actor1Pos(actor.getRefData().getPosition().asVec3());
|
||||
const osg::Vec3f actor2Pos(targetActor.getRefData().getPosition().asVec3());
|
||||
float sqrDist = (actor1Pos - actor2Pos).length2();
|
||||
|
||||
if (sqrDist > maxDistance*maxDistance)
|
||||
return;
|
||||
|
||||
if (targetActor.getClass().getCreatureStats(targetActor).isDead())
|
||||
return;
|
||||
|
||||
if (!actor.getRefData().getBaseNode())
|
||||
return;
|
||||
|
||||
// stop tracking when target is behind the actor
|
||||
osg::Vec3f actorDirection = actor.getRefData().getBaseNode()->getAttitude() * osg::Vec3f(0,1,0);
|
||||
osg::Vec3f targetDirection (actor2Pos.asVec3() - actor1Pos.asVec3());
|
||||
osg::Vec3f targetDirection(actor2Pos - actor1Pos);
|
||||
actorDirection.z() = 0;
|
||||
targetDirection.z() = 0;
|
||||
actorDirection.normalize();
|
||||
|
@ -350,25 +350,25 @@ namespace MWMechanics
|
|||
|
||||
void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> >& cachedAllies, bool againstPlayer)
|
||||
{
|
||||
// No combat for totally static creatures
|
||||
if (!actor1.getClass().isMobile(actor1))
|
||||
return;
|
||||
|
||||
CreatureStats& creatureStats1 = actor1.getClass().getCreatureStats(actor1);
|
||||
if (creatureStats1.getAiSequence().isInCombat(actor2))
|
||||
if (creatureStats1.isDead() || creatureStats1.getAiSequence().isInCombat(actor2))
|
||||
return;
|
||||
|
||||
const CreatureStats& creatureStats2 = actor2.getClass().getCreatureStats(actor2);
|
||||
if (creatureStats1.isDead() || creatureStats2.isDead())
|
||||
if (creatureStats2.isDead())
|
||||
return;
|
||||
|
||||
const ESM::Position& actor1Pos = actor1.getRefData().getPosition();
|
||||
const ESM::Position& actor2Pos = actor2.getRefData().getPosition();
|
||||
float sqrDist = (actor1Pos.asVec3() - actor2Pos.asVec3()).length2();
|
||||
const osg::Vec3f actor1Pos(actor1.getRefData().getPosition().asVec3());
|
||||
const osg::Vec3f actor2Pos(actor2.getRefData().getPosition().asVec3());
|
||||
float sqrDist = (actor1Pos - actor2Pos).length2();
|
||||
|
||||
if (sqrDist > mActorsProcessingRange*mActorsProcessingRange)
|
||||
return;
|
||||
|
||||
// No combat for totally static creatures
|
||||
if (!actor1.getClass().isMobile(actor1))
|
||||
return;
|
||||
|
||||
// If this is set to true, actor1 will start combat with actor2 if the awareness check at the end of the method returns true
|
||||
bool aggressive = false;
|
||||
|
||||
|
@ -379,22 +379,22 @@ namespace MWMechanics
|
|||
getActorsSidingWith(actor1, allies1, cachedAllies);
|
||||
|
||||
// If an ally of actor1 has been attacked by actor2 or has attacked actor2, start combat between actor1 and actor2
|
||||
for (std::set<MWWorld::Ptr>::const_iterator it = allies1.begin(); it != allies1.end(); ++it)
|
||||
for (const MWWorld::Ptr &ally : allies1)
|
||||
{
|
||||
if (creatureStats1.getAiSequence().isInCombat(*it))
|
||||
if (creatureStats1.getAiSequence().isInCombat(ally))
|
||||
continue;
|
||||
|
||||
if (creatureStats2.matchesActorId(it->getClass().getCreatureStats(*it).getHitAttemptActorId()))
|
||||
if (creatureStats2.matchesActorId(ally.getClass().getCreatureStats(ally).getHitAttemptActorId()))
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->startCombat(actor1, actor2);
|
||||
// Also set the same hit attempt actor. Otherwise, if fighting the player, they may stop combat
|
||||
// if the player gets out of reach, while the ally would continue combat with the player
|
||||
creatureStats1.setHitAttemptActorId(it->getClass().getCreatureStats(*it).getHitAttemptActorId());
|
||||
return;
|
||||
creatureStats1.setHitAttemptActorId(ally.getClass().getCreatureStats(ally).getHitAttemptActorId());
|
||||
return;
|
||||
}
|
||||
|
||||
// If there's been no attack attempt yet but an ally of actor1 is in combat with actor2, become aggressive to actor2
|
||||
if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(actor2))
|
||||
if (ally.getClass().getCreatureStats(ally).getAiSequence().isInCombat(actor2))
|
||||
aggressive = true;
|
||||
}
|
||||
|
||||
|
@ -415,20 +415,24 @@ namespace MWMechanics
|
|||
getActorsSidingWith(actor2, allies2, cachedAllies);
|
||||
|
||||
// Check that an ally of actor2 is also in combat with actor1
|
||||
for (std::set<MWWorld::Ptr>::const_iterator it = allies2.begin(); it != allies2.end(); ++it)
|
||||
for (const MWWorld::Ptr &ally2 : allies2)
|
||||
{
|
||||
if ((it)->getClass().getCreatureStats(*it).getAiSequence().isInCombat(actor1))
|
||||
if (ally2.getClass().getCreatureStats(ally2).getAiSequence().isInCombat(actor1))
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->startCombat(actor1, actor2);
|
||||
// Also have actor1's allies start combat
|
||||
for (std::set<MWWorld::Ptr>::const_iterator it2 = allies1.begin(); it2 != allies1.end(); ++it2)
|
||||
MWBase::Environment::get().getMechanicsManager()->startCombat(*it2, actor2);
|
||||
for (const MWWorld::Ptr ally1 : allies1)
|
||||
MWBase::Environment::get().getMechanicsManager()->startCombat(ally1, actor2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stop here if target is unreachable
|
||||
if (!canFight(actor1, actor2))
|
||||
return;
|
||||
|
||||
// If set in the settings file, player followers and escorters will become aggressive toward enemies in combat with them or the player
|
||||
static const bool followersAttackOnSight = Settings::Manager::getBool("followers attack on sight", "Game");
|
||||
if (!aggressive && isPlayerFollowerOrEscorter && followersAttackOnSight)
|
||||
|
@ -437,9 +441,9 @@ namespace MWMechanics
|
|||
aggressive = true;
|
||||
else
|
||||
{
|
||||
for (std::set<MWWorld::Ptr>::const_iterator it = allies1.begin(); it != allies1.end(); ++it)
|
||||
for (const MWWorld::Ptr &ally : allies1)
|
||||
{
|
||||
if (actor2.getClass().getCreatureStats(actor2).getAiSequence().isInCombat(*it))
|
||||
if (actor2.getClass().getCreatureStats(actor2).getAiSequence().isInCombat(ally))
|
||||
{
|
||||
aggressive = true;
|
||||
break;
|
||||
|
@ -448,10 +452,6 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
// Stop here if target is unreachable
|
||||
if (!MWMechanics::canFight(actor1, actor2))
|
||||
return;
|
||||
|
||||
// Do aggression check if actor2 is the player or a player follower or escorter
|
||||
if (!aggressive)
|
||||
{
|
||||
|
@ -465,7 +465,7 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
// Make guards go aggressive with creatures that are in combat, unless the creature is a follower or escorter
|
||||
if (actor1.getClass().isClass(actor1, "Guard") && !actor2.getClass().isNpc())
|
||||
if (!aggressive && actor1.getClass().isClass(actor1, "Guard") && !actor2.getClass().isNpc() && creatureStats2.getAiSequence().isInCombat())
|
||||
{
|
||||
// Check if the creature is too far
|
||||
static const float fAlarmRadius = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fAlarmRadius")->mValue.getFloat();
|
||||
|
@ -473,26 +473,26 @@ namespace MWMechanics
|
|||
return;
|
||||
|
||||
bool followerOrEscorter = false;
|
||||
for (std::list<MWMechanics::AiPackage*>::const_iterator it = creatureStats2.getAiSequence().begin(); it != creatureStats2.getAiSequence().end(); ++it)
|
||||
for (const AiPackage* package : creatureStats2.getAiSequence())
|
||||
{
|
||||
// The follow package must be first or have nothing but combat before it
|
||||
if ((*it)->sideWithTarget())
|
||||
if (package->sideWithTarget())
|
||||
{
|
||||
followerOrEscorter = true;
|
||||
break;
|
||||
}
|
||||
else if ((*it)->getTypeId() != MWMechanics::AiPackage::TypeIdCombat)
|
||||
else if (package->getTypeId() != MWMechanics::AiPackage::TypeIdCombat)
|
||||
break;
|
||||
}
|
||||
if (!followerOrEscorter && creatureStats2.getAiSequence().isInCombat())
|
||||
if (!followerOrEscorter)
|
||||
aggressive = true;
|
||||
}
|
||||
|
||||
// If any of the above conditions turned actor1 aggressive towards actor2, do an awareness check. If it passes, start combat with actor2.
|
||||
if (aggressive)
|
||||
{
|
||||
bool LOS = MWBase::Environment::get().getWorld()->getLOS(actor1, actor2);
|
||||
LOS &= MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor2, actor1);
|
||||
bool LOS = MWBase::Environment::get().getWorld()->getLOS(actor1, actor2)
|
||||
&& MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor2, actor1);
|
||||
|
||||
if (LOS)
|
||||
MWBase::Environment::get().getMechanicsManager()->startCombat(actor1, actor2);
|
||||
|
@ -927,14 +927,11 @@ namespace MWMechanics
|
|||
if (stats.getTimeToStartDrowning() == -1.f)
|
||||
stats.setTimeToStartDrowning(fHoldBreathTime);
|
||||
|
||||
if (stats.getTimeToStartDrowning() < fHoldBreathTime / 2)
|
||||
if (!isPlayer && stats.getTimeToStartDrowning() < fHoldBreathTime / 2)
|
||||
{
|
||||
if(!isPlayer)
|
||||
{
|
||||
MWMechanics::AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||
if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdBreathe) //Only add it once
|
||||
seq.stack(MWMechanics::AiBreathe(), ptr);
|
||||
}
|
||||
AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||
if (seq.getTypeId() != AiPackage::TypeIdBreathe) //Only add it once
|
||||
seq.stack(AiBreathe(), ptr);
|
||||
}
|
||||
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
@ -1200,17 +1197,16 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
// Otherwise check if any actor in AI processing range sees the target actor
|
||||
std::vector<MWWorld::Ptr> actors;
|
||||
std::vector<MWWorld::Ptr> neighbors;
|
||||
osg::Vec3f position (actor.getRefData().getPosition().asVec3());
|
||||
getObjectsInRange(position, mActorsProcessingRange, actors);
|
||||
for(std::vector<MWWorld::Ptr>::iterator it = actors.begin(); it != actors.end(); ++it)
|
||||
getObjectsInRange(position, mActorsProcessingRange, neighbors);
|
||||
for (const MWWorld::Ptr &neighbor : neighbors)
|
||||
{
|
||||
if (*it == actor)
|
||||
if (neighbor == actor)
|
||||
continue;
|
||||
|
||||
bool result =
|
||||
MWBase::Environment::get().getWorld()->getLOS(*it, actor) &&
|
||||
MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor, *it);
|
||||
bool result = MWBase::Environment::get().getWorld()->getLOS(neighbor, actor)
|
||||
&& MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor, neighbor);
|
||||
|
||||
if (result)
|
||||
return true;
|
||||
|
@ -1603,6 +1599,7 @@ namespace MWMechanics
|
|||
continue;
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWorld()->removeActorPath(iter->first);
|
||||
CharacterController::KillResult killResult = iter->second->getCharacterController()->kill();
|
||||
if (killResult == CharacterController::Result_DeathAnimStarted)
|
||||
{
|
||||
|
@ -1829,21 +1826,21 @@ namespace MWMechanics
|
|||
|
||||
// An actor counts as siding with this actor if Follow or Escort is the current AI package, or there are only Combat and Wander packages before the Follow/Escort package
|
||||
// Actors that are targeted by this actor's Follow or Escort packages also side with them
|
||||
for (auto package = stats.getAiSequence().begin(); package != stats.getAiSequence().end(); ++package)
|
||||
for (const AiPackage* package : stats.getAiSequence())
|
||||
{
|
||||
if ((*package)->sideWithTarget() && !(*package)->getTarget().isEmpty())
|
||||
if (package->sideWithTarget() && !package->getTarget().isEmpty())
|
||||
{
|
||||
if (sameActor)
|
||||
{
|
||||
list.push_back((*package)->getTarget());
|
||||
list.push_back(package->getTarget());
|
||||
}
|
||||
else if ((*package)->getTarget() == actor)
|
||||
else if (package->getTarget() == actor)
|
||||
{
|
||||
list.push_back(iteratedActor);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if ((*package)->getTypeId() != AiPackage::TypeIdCombat && (*package)->getTypeId() != AiPackage::TypeIdWander)
|
||||
else if (package->getTypeId() != AiPackage::TypeIdCombat && package->getTypeId() != AiPackage::TypeIdWander)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1865,11 +1862,11 @@ namespace MWMechanics
|
|||
|
||||
// An actor counts as following if AiFollow is the current AiPackage,
|
||||
// or there are only Combat and Wander packages before the AiFollow package
|
||||
for (auto package = stats.getAiSequence().begin(); package != stats.getAiSequence().end(); ++package)
|
||||
for (const AiPackage* package : stats.getAiSequence())
|
||||
{
|
||||
if ((*package)->followTargetThroughDoors() && (*package)->getTarget() == actor)
|
||||
if (package->followTargetThroughDoors() && package->getTarget() == actor)
|
||||
list.push_back(iteratedActor);
|
||||
else if ((*package)->getTypeId() != AiPackage::TypeIdCombat && (*package)->getTypeId() != AiPackage::TypeIdWander)
|
||||
else if (package->getTypeId() != AiPackage::TypeIdCombat && package->getTypeId() != AiPackage::TypeIdWander)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1878,16 +1875,16 @@ namespace MWMechanics
|
|||
|
||||
void Actors::getActorsFollowing(const MWWorld::Ptr &actor, std::set<MWWorld::Ptr>& out) {
|
||||
std::list<MWWorld::Ptr> followers = getActorsFollowing(actor);
|
||||
for(std::list<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
|
||||
if (out.insert(*it).second)
|
||||
getActorsFollowing(*it, out);
|
||||
for(const MWWorld::Ptr &follower : followers)
|
||||
if (out.insert(follower).second)
|
||||
getActorsFollowing(follower, out);
|
||||
}
|
||||
|
||||
void Actors::getActorsSidingWith(const MWWorld::Ptr &actor, std::set<MWWorld::Ptr>& out) {
|
||||
std::list<MWWorld::Ptr> followers = getActorsSidingWith(actor);
|
||||
for(std::list<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
|
||||
if (out.insert(*it).second)
|
||||
getActorsSidingWith(*it, out);
|
||||
for(const MWWorld::Ptr &follower : followers)
|
||||
if (out.insert(follower).second)
|
||||
getActorsSidingWith(follower, out);
|
||||
}
|
||||
|
||||
void Actors::getActorsSidingWith(const MWWorld::Ptr &actor, std::set<MWWorld::Ptr>& out, std::map<const MWWorld::Ptr, const std::set<MWWorld::Ptr> >& cachedAllies) {
|
||||
|
@ -1898,17 +1895,17 @@ namespace MWMechanics
|
|||
else
|
||||
{
|
||||
std::list<MWWorld::Ptr> followers = getActorsSidingWith(actor);
|
||||
for (std::list<MWWorld::Ptr>::iterator it = followers.begin(); it != followers.end(); ++it)
|
||||
if (out.insert(*it).second)
|
||||
getActorsSidingWith(*it, out, cachedAllies);
|
||||
for (const MWWorld::Ptr &follower : followers)
|
||||
if (out.insert(follower).second)
|
||||
getActorsSidingWith(follower, out, cachedAllies);
|
||||
|
||||
// Cache ptrs and their sets of allies
|
||||
cachedAllies.insert(std::make_pair(actor, out));
|
||||
for (std::set<MWWorld::Ptr>::const_iterator it = out.begin(); it != out.end(); ++it)
|
||||
for (const MWWorld::Ptr &iter : out)
|
||||
{
|
||||
search = cachedAllies.find(*it);
|
||||
search = cachedAllies.find(iter);
|
||||
if (search == cachedAllies.end())
|
||||
cachedAllies.insert(std::make_pair(*it, out));
|
||||
cachedAllies.insert(std::make_pair(iter, out));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1928,14 +1925,14 @@ namespace MWMechanics
|
|||
|
||||
// An actor counts as following if AiFollow is the current AiPackage,
|
||||
// or there are only Combat and Wander packages before the AiFollow package
|
||||
for (auto package = stats.getAiSequence().begin(); package != stats.getAiSequence().end(); ++package)
|
||||
for (AiPackage* package : stats.getAiSequence())
|
||||
{
|
||||
if ((*package)->followTargetThroughDoors() && (*package)->getTarget() == actor)
|
||||
if (package->followTargetThroughDoors() && package->getTarget() == actor)
|
||||
{
|
||||
list.push_back(static_cast<AiFollow*>(*package)->getFollowIndex());
|
||||
list.push_back(static_cast<AiFollow*>(package)->getFollowIndex());
|
||||
break;
|
||||
}
|
||||
else if ((*package)->getTypeId() != AiPackage::TypeIdCombat && (*package)->getTypeId() != AiPackage::TypeIdWander)
|
||||
else if (package->getTypeId() != AiPackage::TypeIdCombat && package->getTypeId() != AiPackage::TypeIdWander)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1947,17 +1944,17 @@ namespace MWMechanics
|
|||
std::vector<MWWorld::Ptr> neighbors;
|
||||
osg::Vec3f position (actor.getRefData().getPosition().asVec3());
|
||||
getObjectsInRange(position, mActorsProcessingRange, neighbors);
|
||||
for(auto neighbor = neighbors.begin(); neighbor != neighbors.end(); ++neighbor)
|
||||
for(const MWWorld::Ptr neighbor : neighbors)
|
||||
{
|
||||
if (*neighbor == actor)
|
||||
if (neighbor == actor)
|
||||
continue;
|
||||
|
||||
const CreatureStats &stats = neighbor->getClass().getCreatureStats(*neighbor);
|
||||
const CreatureStats &stats = neighbor.getClass().getCreatureStats(neighbor);
|
||||
if (stats.isDead())
|
||||
continue;
|
||||
|
||||
if (stats.getAiSequence().isInCombat(actor))
|
||||
list.push_front(*neighbor);
|
||||
list.push_front(neighbor);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -104,10 +104,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
|||
const osg::Vec3f position = actor.getRefData().getPosition().asVec3(); //position of the actor
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
|
||||
{
|
||||
const osg::Vec3f halfExtents = world->getHalfExtents(actor);
|
||||
world->updateActorPath(actor, mPathFinder.getPath(), halfExtents, position, dest);
|
||||
}
|
||||
const osg::Vec3f halfExtents = world->getHalfExtents(actor);
|
||||
|
||||
/// Stops the actor when it gets too close to a unloaded cell
|
||||
//... At current time, this test is unnecessary. AI shuts down when actor is more than "actors processing range" setting value
|
||||
|
@ -116,6 +113,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
|||
if (isNearInactiveCell(position))
|
||||
{
|
||||
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
|
||||
world->updateActorPath(actor, mPathFinder.getPath(), halfExtents, position, dest);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -180,9 +178,12 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
|||
// turn to destination point
|
||||
zTurn(actor, getZAngleToPoint(position, dest));
|
||||
smoothTurn(actor, getXAngleToPoint(position, dest), 0);
|
||||
world->removeActorPath(actor);
|
||||
return true;
|
||||
}
|
||||
|
||||
world->updateActorPath(actor, mPathFinder.getPath(), halfExtents, position, dest);
|
||||
|
||||
if (mRotateOnTheRunChecks == 0
|
||||
|| isReachableRotatingOnTheRun(actor, *mPathFinder.getPath().begin())) // to prevent circling around a path point
|
||||
{
|
||||
|
|
|
@ -955,6 +955,7 @@ namespace MWMechanics
|
|||
, mStoredInitialActorPosition(wander->mStoredInitialActorPosition)
|
||||
, mHasDestination(false)
|
||||
, mDestination(osg::Vec3f(0, 0, 0))
|
||||
, mUsePathgrid(false)
|
||||
{
|
||||
if (mStoredInitialActorPosition)
|
||||
mInitialActorPosition = wander->mInitialActorPosition;
|
||||
|
|
|
@ -129,10 +129,9 @@ namespace MWMechanics
|
|||
npcStats.getSkill (i).setBase (5 + bonus);
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter (race->mPowers.mList.begin());
|
||||
iter!=race->mPowers.mList.end(); ++iter)
|
||||
for (const std::string &power : race->mPowers.mList)
|
||||
{
|
||||
creatureStats.getSpells().add (*iter);
|
||||
creatureStats.getSpells().add(power);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,10 +144,9 @@ namespace MWMechanics
|
|||
const ESM::BirthSign *sign =
|
||||
esmStore.get<ESM::BirthSign>().find(signId);
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
|
||||
iter!=sign->mPowers.mList.end(); ++iter)
|
||||
for (const std::string &power : sign->mPowers.mList)
|
||||
{
|
||||
creatureStats.getSpells().add (*iter);
|
||||
creatureStats.getSpells().add(power);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,8 +216,8 @@ namespace MWMechanics
|
|||
|
||||
std::vector<std::string> selectedSpells = autoCalcPlayerSpells(skills, attributes, race);
|
||||
|
||||
for (std::vector<std::string>::iterator it = selectedSpells.begin(); it != selectedSpells.end(); ++it)
|
||||
creatureStats.getSpells().add(*it);
|
||||
for (const std::string &spell : selectedSpells)
|
||||
creatureStats.getSpells().add(spell);
|
||||
|
||||
// forced update and current value adjustments
|
||||
mActors.updateActor (ptr, 0);
|
||||
|
@ -887,9 +885,8 @@ namespace MWMechanics
|
|||
// Build a list of known bound item ID's
|
||||
const MWWorld::Store<ESM::GameSetting> &gameSettings = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
for (MWWorld::Store<ESM::GameSetting>::iterator currentIteration = gameSettings.begin(); currentIteration != gameSettings.end(); ++currentIteration)
|
||||
for (const ESM::GameSetting ¤tSetting : gameSettings)
|
||||
{
|
||||
const ESM::GameSetting ¤tSetting = *currentIteration;
|
||||
std::string currentGMSTID = currentSetting.mId;
|
||||
Misc::StringUtils::lowerCaseInPlace(currentGMSTID);
|
||||
|
||||
|
@ -1209,36 +1206,20 @@ namespace MWMechanics
|
|||
|
||||
// Did anyone see it?
|
||||
bool crimeSeen = false;
|
||||
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
||||
for (const MWWorld::Ptr &neighbor : neighbors)
|
||||
{
|
||||
if (*it == player)
|
||||
continue; // skip player
|
||||
if (it->getClass().getCreatureStats(*it).isDead())
|
||||
if (!canReportCrime(neighbor, victim, playerFollowers))
|
||||
continue;
|
||||
|
||||
// Unconsious actor can not report about crime
|
||||
if (it->getClass().getCreatureStats(*it).getKnockedDown())
|
||||
continue;
|
||||
|
||||
if ((*it == victim && victimAware)
|
||||
|| (MWBase::Environment::get().getWorld()->getLOS(player, *it) && awarenessCheck(player, *it) )
|
||||
if ((neighbor == victim && victimAware)
|
||||
// Murder crime can be reported even if no one saw it (hearing is enough, I guess).
|
||||
// TODO: Add mod support for stealth executions!
|
||||
|| (type == OT_Murder && *it != victim))
|
||||
|| (type == OT_Murder && neighbor != victim)
|
||||
|| (MWBase::Environment::get().getWorld()->getLOS(player, neighbor) && awarenessCheck(player, neighbor)))
|
||||
{
|
||||
// Crime reporting only applies to NPCs
|
||||
if (!it->getClass().isNpc())
|
||||
continue;
|
||||
|
||||
if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(victim))
|
||||
continue;
|
||||
|
||||
if (playerFollowers.find(*it) != playerFollowers.end())
|
||||
continue;
|
||||
|
||||
// NPC will complain about theft even if he will do nothing about it
|
||||
if (type == OT_Theft || type == OT_Pickpocket)
|
||||
MWBase::Environment::get().getDialogueManager()->say(*it, "thief");
|
||||
MWBase::Environment::get().getDialogueManager()->say(neighbor, "thief");
|
||||
|
||||
crimeSeen = true;
|
||||
}
|
||||
|
@ -1361,66 +1342,66 @@ namespace MWMechanics
|
|||
getActorsSidingWith(player, playerFollowers);
|
||||
|
||||
// Tell everyone (including the original reporter) in alarm range
|
||||
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
||||
for (const MWWorld::Ptr &actor : neighbors)
|
||||
{
|
||||
if (!canReportCrime(*it, victim, playerFollowers))
|
||||
if (!canReportCrime(actor, victim, playerFollowers))
|
||||
continue;
|
||||
|
||||
// Will the witness report the crime?
|
||||
if (it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Alarm).getBase() >= 100)
|
||||
if (actor.getClass().getCreatureStats(actor).getAiSetting(CreatureStats::AI_Alarm).getBase() >= 100)
|
||||
{
|
||||
reported = true;
|
||||
|
||||
if (type == OT_Trespassing)
|
||||
MWBase::Environment::get().getDialogueManager()->say(*it, "intruder");
|
||||
MWBase::Environment::get().getDialogueManager()->say(actor, "intruder");
|
||||
}
|
||||
}
|
||||
|
||||
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
||||
for (const MWWorld::Ptr &actor : neighbors)
|
||||
{
|
||||
if (!canReportCrime(*it, victim, playerFollowers))
|
||||
if (!canReportCrime(actor, victim, playerFollowers))
|
||||
continue;
|
||||
|
||||
if (it->getClass().isClass(*it, "guard") && reported)
|
||||
if (reported && actor.getClass().isClass(actor, "guard"))
|
||||
{
|
||||
// Mark as Alarmed for dialogue
|
||||
it->getClass().getCreatureStats(*it).setAlarmed(true);
|
||||
actor.getClass().getCreatureStats(actor).setAlarmed(true);
|
||||
|
||||
// Set the crime ID, which we will use to calm down participants
|
||||
// once the bounty has been paid.
|
||||
it->getClass().getNpcStats(*it).setCrimeId(id);
|
||||
actor.getClass().getNpcStats(actor).setCrimeId(id);
|
||||
|
||||
if (!it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdPursue))
|
||||
if (!actor.getClass().getCreatureStats(actor).getAiSequence().hasPackage(AiPackage::TypeIdPursue))
|
||||
{
|
||||
it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it);
|
||||
actor.getClass().getCreatureStats(actor).getAiSequence().stack(AiPursue(player), actor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float dispTerm = (*it == victim) ? dispVictim : disp;
|
||||
float dispTerm = (actor == victim) ? dispVictim : disp;
|
||||
|
||||
float alarmTerm = 0.01f * it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Alarm).getBase();
|
||||
float alarmTerm = 0.01f * actor.getClass().getCreatureStats(actor).getAiSetting(CreatureStats::AI_Alarm).getBase();
|
||||
if (type == OT_Pickpocket && alarmTerm <= 0)
|
||||
alarmTerm = 1.0;
|
||||
|
||||
if (*it != victim)
|
||||
if (actor != victim)
|
||||
dispTerm *= alarmTerm;
|
||||
|
||||
float fightTerm = static_cast<float>((*it == victim) ? fightVictim : fight);
|
||||
float fightTerm = static_cast<float>((actor == victim) ? fightVictim : fight);
|
||||
fightTerm += getFightDispositionBias(dispTerm);
|
||||
fightTerm += getFightDistanceBias(*it, player);
|
||||
fightTerm += getFightDistanceBias(actor, player);
|
||||
fightTerm *= alarmTerm;
|
||||
|
||||
int observerFightRating = it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Fight).getBase();
|
||||
int observerFightRating = actor.getClass().getCreatureStats(actor).getAiSetting(CreatureStats::AI_Fight).getBase();
|
||||
if (observerFightRating + fightTerm > 100)
|
||||
fightTerm = static_cast<float>(100 - observerFightRating);
|
||||
fightTerm = std::max(0.f, fightTerm);
|
||||
|
||||
if (observerFightRating + fightTerm >= 100)
|
||||
{
|
||||
startCombat(*it, player);
|
||||
startCombat(actor, player);
|
||||
|
||||
NpcStats& observerStats = it->getClass().getNpcStats(*it);
|
||||
NpcStats& observerStats = actor.getClass().getNpcStats(actor);
|
||||
// Apply aggression value to the base Fight rating, so that the actor can continue fighting
|
||||
// after a Calm spell wears off
|
||||
observerStats.setAiSetting(CreatureStats::AI_Fight, observerFightRating + static_cast<int>(fightTerm));
|
||||
|
@ -1527,7 +1508,7 @@ namespace MWMechanics
|
|||
|
||||
bool MechanicsManager::canCommitCrimeAgainst(const MWWorld::Ptr &target, const MWWorld::Ptr &attacker)
|
||||
{
|
||||
MWMechanics::AiSequence seq = target.getClass().getCreatureStats(target).getAiSequence();
|
||||
const MWMechanics::AiSequence& seq = target.getClass().getCreatureStats(target).getAiSequence();
|
||||
return target.getClass().isNpc() && !attacker.isEmpty() && !seq.isInCombat(attacker)
|
||||
&& !isAggressive(target, attacker) && !seq.isEngagedWithActor()
|
||||
&& !target.getClass().getCreatureStats(target).getAiSequence().hasPackage(AiPackage::TypeIdPursue);
|
||||
|
@ -1871,23 +1852,25 @@ namespace MWMechanics
|
|||
windowManager->setWerewolfOverlay(werewolf);
|
||||
|
||||
// Witnesses of the player's transformation will make them a globally known werewolf
|
||||
std::vector<MWWorld::Ptr> closeActors;
|
||||
std::vector<MWWorld::Ptr> neighbors;
|
||||
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
getActorsInRange(actor.getRefData().getPosition().asVec3(), gmst.find("fAlarmRadius")->mValue.getFloat(), closeActors);
|
||||
getActorsInRange(actor.getRefData().getPosition().asVec3(), gmst.find("fAlarmRadius")->mValue.getFloat(), neighbors);
|
||||
|
||||
bool detected = false, reported = false;
|
||||
for (std::vector<MWWorld::Ptr>::const_iterator it = closeActors.begin(); it != closeActors.end(); ++it)
|
||||
for (const MWWorld::Ptr& neighbor : neighbors)
|
||||
{
|
||||
if (*it == actor)
|
||||
if (neighbor == actor || !neighbor.getClass().isNpc())
|
||||
continue;
|
||||
|
||||
if (!it->getClass().isNpc())
|
||||
continue;
|
||||
|
||||
if (MWBase::Environment::get().getWorld()->getLOS(*it, actor) && awarenessCheck(actor, *it))
|
||||
if (MWBase::Environment::get().getWorld()->getLOS(neighbor, actor) && awarenessCheck(actor, neighbor))
|
||||
{
|
||||
detected = true;
|
||||
if (it->getClass().getCreatureStats(*it).getAiSetting(MWMechanics::CreatureStats::AI_Alarm).getModified() > 0)
|
||||
reported = true;
|
||||
if (neighbor.getClass().getCreatureStats(neighbor).getAiSetting(MWMechanics::CreatureStats::AI_Alarm).getModified() > 0)
|
||||
{
|
||||
reported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (detected)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "actoranimation.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <osg/Node>
|
||||
|
@ -9,11 +8,22 @@
|
|||
#include <components/esm/loadligh.hpp>
|
||||
#include <components/esm/loadcell.hpp>
|
||||
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/resource/scenemanager.hpp>
|
||||
|
||||
#include <components/sceneutil/attach.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
#include <components/sceneutil/lightutil.hpp>
|
||||
#include <components/sceneutil/visitor.hpp>
|
||||
|
||||
#include <components/fallback/fallback.hpp>
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include <components/vfs/manager.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -43,6 +53,8 @@ ActorAnimation::ActorAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group>
|
|||
|
||||
// Make sure we cleaned object from effects, just in cast if we re-use node
|
||||
removeEffects();
|
||||
|
||||
mWeaponSheathing = Settings::Manager::getBool("weapon sheathing", "Game");
|
||||
}
|
||||
|
||||
ActorAnimation::~ActorAnimation()
|
||||
|
@ -51,6 +63,298 @@ ActorAnimation::~ActorAnimation()
|
|||
{
|
||||
mInsert->removeChild(iter->second);
|
||||
}
|
||||
|
||||
mScabbard.reset();
|
||||
}
|
||||
|
||||
PartHolderPtr ActorAnimation::getWeaponPart(const std::string& model, const std::string& bonename, bool enchantedGlow, osg::Vec4f* glowColor)
|
||||
{
|
||||
osg::Group* parent = getBoneByName(bonename);
|
||||
if (!parent)
|
||||
return nullptr;
|
||||
|
||||
osg::ref_ptr<osg::Node> instance = mResourceSystem->getSceneManager()->getInstance(model, parent);
|
||||
|
||||
const NodeMap& nodeMap = getNodeMap();
|
||||
NodeMap::const_iterator found = nodeMap.find(Misc::StringUtils::lowerCase(bonename));
|
||||
if (found == nodeMap.end())
|
||||
return PartHolderPtr();
|
||||
|
||||
if (enchantedGlow)
|
||||
addGlow(instance, *glowColor);
|
||||
|
||||
return PartHolderPtr(new PartHolder(instance));
|
||||
}
|
||||
|
||||
osg::Group* ActorAnimation::getBoneByName(std::string boneName)
|
||||
{
|
||||
if (!mObjectRoot)
|
||||
return nullptr;
|
||||
|
||||
SceneUtil::FindByNameVisitor findVisitor (boneName);
|
||||
mObjectRoot->accept(findVisitor);
|
||||
|
||||
return findVisitor.mFoundNode;
|
||||
}
|
||||
|
||||
std::string ActorAnimation::getHolsteredWeaponBoneName(const MWWorld::ConstPtr& weapon)
|
||||
{
|
||||
std::string boneName;
|
||||
if(weapon.isEmpty())
|
||||
return boneName;
|
||||
|
||||
const std::string &type = weapon.getClass().getTypeName();
|
||||
if(type == typeid(ESM::Weapon).name())
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Weapon> *ref = weapon.get<ESM::Weapon>();
|
||||
ESM::Weapon::Type weaponType = (ESM::Weapon::Type)ref->mBase->mData.mType;
|
||||
return getHolsteredWeaponBoneName(weaponType);
|
||||
}
|
||||
|
||||
return boneName;
|
||||
}
|
||||
|
||||
std::string ActorAnimation::getHolsteredWeaponBoneName(const unsigned int weaponType)
|
||||
{
|
||||
std::string boneName;
|
||||
|
||||
switch(weaponType)
|
||||
{
|
||||
case ESM::Weapon::ShortBladeOneHand:
|
||||
boneName = "Bip01 ShortBladeOneHand";
|
||||
break;
|
||||
case ESM::Weapon::LongBladeOneHand:
|
||||
boneName = "Bip01 LongBladeOneHand";
|
||||
break;
|
||||
case ESM::Weapon::BluntOneHand:
|
||||
boneName = "Bip01 BluntOneHand";
|
||||
break;
|
||||
case ESM::Weapon::AxeOneHand:
|
||||
boneName = "Bip01 LongBladeOneHand";
|
||||
break;
|
||||
case ESM::Weapon::LongBladeTwoHand:
|
||||
boneName = "Bip01 LongBladeTwoClose";
|
||||
break;
|
||||
case ESM::Weapon::BluntTwoClose:
|
||||
boneName = "Bip01 BluntTwoClose";
|
||||
break;
|
||||
case ESM::Weapon::AxeTwoHand:
|
||||
boneName = "Bip01 AxeTwoClose";
|
||||
break;
|
||||
case ESM::Weapon::BluntTwoWide:
|
||||
boneName = "Bip01 BluntTwoWide";
|
||||
break;
|
||||
case ESM::Weapon::SpearTwoWide:
|
||||
boneName = "Bip01 SpearTwoWide";
|
||||
break;
|
||||
case ESM::Weapon::MarksmanBow:
|
||||
boneName = "Bip01 MarksmanBow";
|
||||
break;
|
||||
case ESM::Weapon::MarksmanCrossbow:
|
||||
boneName = "Bip01 MarksmanCrossbow";
|
||||
break;
|
||||
case ESM::Weapon::MarksmanThrown:
|
||||
boneName = "Bip01 MarksmanThrown";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return boneName;
|
||||
}
|
||||
|
||||
void ActorAnimation::injectWeaponBones()
|
||||
{
|
||||
if (!mResourceSystem->getVFS()->exists("meshes\\xbase_anim_sh.nif"))
|
||||
{
|
||||
mWeaponSheathing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> sheathSkeleton = mResourceSystem->getSceneManager()->getInstance("meshes\\xbase_anim_sh.nif");
|
||||
|
||||
for (unsigned int type=0; type<=ESM::Weapon::MarksmanThrown; ++type)
|
||||
{
|
||||
const std::string holsteredBoneName = getHolsteredWeaponBoneName(type);
|
||||
|
||||
SceneUtil::FindByNameVisitor findVisitor (holsteredBoneName);
|
||||
sheathSkeleton->accept(findVisitor);
|
||||
osg::ref_ptr<osg::Node> sheathNode = findVisitor.mFoundNode;
|
||||
|
||||
if (sheathNode && sheathNode.get()->getNumParents())
|
||||
{
|
||||
osg::Group* sheathParent = getBoneByName(sheathNode.get()->getParent(0)->getName());
|
||||
|
||||
if (sheathParent)
|
||||
{
|
||||
sheathNode.get()->getParent(0)->removeChild(sheathNode);
|
||||
sheathParent->addChild(sheathNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// To make sure we do not run morph controllers for weapons, i.e. bows
|
||||
class EmptyCallback : public osg::NodeCallback
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
|
||||
{
|
||||
if (!mWeaponSheathing)
|
||||
return;
|
||||
|
||||
if (!mPtr.getClass().hasInventoryStore(mPtr))
|
||||
return;
|
||||
|
||||
mScabbard.reset();
|
||||
|
||||
const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
||||
MWWorld::ConstContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
if (weapon == inv.end() || weapon->getTypeName() != typeid(ESM::Weapon).name())
|
||||
return;
|
||||
|
||||
// Since throwing weapons stack themselves, do not show such weapon itself
|
||||
if (weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanThrown)
|
||||
showHolsteredWeapons = false;
|
||||
|
||||
std::string mesh = weapon->getClass().getModel(*weapon);
|
||||
std::string scabbardName = mesh;
|
||||
|
||||
std::string boneName = getHolsteredWeaponBoneName(*weapon);
|
||||
if (mesh.empty() || boneName.empty())
|
||||
return;
|
||||
|
||||
// If the scabbard is not found, use a weapon mesh as fallback
|
||||
scabbardName = scabbardName.replace(scabbardName.size()-4, 4, "_sh.nif");
|
||||
bool isEnchanted = !weapon->getClass().getEnchantment(*weapon).empty();
|
||||
if(!mResourceSystem->getVFS()->exists(scabbardName))
|
||||
{
|
||||
if (showHolsteredWeapons)
|
||||
{
|
||||
osg::Vec4f glowColor = getEnchantmentColor(*weapon);
|
||||
mScabbard = getWeaponPart(mesh, boneName, isEnchanted, &glowColor);
|
||||
if (mScabbard)
|
||||
mScabbard->getNode()->setUpdateCallback(new EmptyCallback);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mScabbard = getWeaponPart(scabbardName, boneName);
|
||||
|
||||
osg::Group* weaponNode = getBoneByName("Bip01 Weapon");
|
||||
if (!weaponNode)
|
||||
return;
|
||||
|
||||
// When we draw weapon, hide the Weapon node from sheath model.
|
||||
// Otherwise add the enchanted glow to it.
|
||||
if (!showHolsteredWeapons)
|
||||
{
|
||||
weaponNode->setNodeMask(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If mesh author declared empty weapon node, use transformation from this node, but use the common weapon mesh.
|
||||
// This approach allows to tweak weapon position without need to store the whole weapon mesh in the _sh file.
|
||||
if (!weaponNode->getNumChildren())
|
||||
{
|
||||
osg::ref_ptr<osg::Node> fallbackNode = mResourceSystem->getSceneManager()->getInstance(mesh, weaponNode);
|
||||
fallbackNode->setUpdateCallback(new EmptyCallback);
|
||||
}
|
||||
|
||||
if (isEnchanted)
|
||||
{
|
||||
osg::Vec4f glowColor = getEnchantmentColor(*weapon);
|
||||
addGlow(weaponNode, glowColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActorAnimation::updateQuiver()
|
||||
{
|
||||
if (!mWeaponSheathing)
|
||||
return;
|
||||
|
||||
if (!mPtr.getClass().hasInventoryStore(mPtr))
|
||||
return;
|
||||
|
||||
const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
||||
MWWorld::ConstContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
if(weapon == inv.end() || weapon->getTypeName() != typeid(ESM::Weapon).name())
|
||||
return;
|
||||
|
||||
std::string mesh = weapon->getClass().getModel(*weapon);
|
||||
std::string boneName = getHolsteredWeaponBoneName(*weapon);
|
||||
if (mesh.empty() || boneName.empty())
|
||||
return;
|
||||
|
||||
osg::Group* ammoNode = getBoneByName("Bip01 Ammo");
|
||||
if (!ammoNode)
|
||||
return;
|
||||
|
||||
// Special case for throwing weapons - they do not use ammo, but they stack themselves
|
||||
bool suitableAmmo = false;
|
||||
MWWorld::ConstContainerStoreIterator ammo = weapon;
|
||||
unsigned int ammoCount = 0;
|
||||
if (weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanThrown)
|
||||
{
|
||||
ammoCount = ammo->getRefData().getCount();
|
||||
osg::Group* throwingWeaponNode = getBoneByName("Weapon Bone");
|
||||
if (throwingWeaponNode && throwingWeaponNode->getNumChildren())
|
||||
ammoCount--;
|
||||
|
||||
suitableAmmo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition);
|
||||
if (ammo == inv.end())
|
||||
return;
|
||||
|
||||
ammoCount = ammo->getRefData().getCount();
|
||||
bool arrowAttached = isArrowAttached();
|
||||
if (arrowAttached)
|
||||
ammoCount--;
|
||||
|
||||
if (weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
|
||||
suitableAmmo = ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Bolt;
|
||||
else if (weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow)
|
||||
suitableAmmo = ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Arrow;
|
||||
}
|
||||
|
||||
if (ammoNode && suitableAmmo)
|
||||
{
|
||||
// We should not show more ammo than equipped and more than quiver mesh has
|
||||
ammoCount = std::min(ammoCount, ammoNode->getNumChildren());
|
||||
|
||||
// Remove existing ammo nodes
|
||||
for (unsigned int i=0; i<ammoNode->getNumChildren(); ++i)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||
if (!arrowNode->getNumChildren())
|
||||
continue;
|
||||
|
||||
osg::ref_ptr<osg::Node> arrowChildNode = arrowNode->getChild(0);
|
||||
arrowNode->removeChild(arrowChildNode);
|
||||
}
|
||||
|
||||
// Add new ones
|
||||
osg::Vec4f glowColor = getEnchantmentColor(*ammo);
|
||||
std::string model = ammo->getClass().getModel(*ammo);
|
||||
for (unsigned int i=0; i<ammoCount; ++i)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||
osg::ref_ptr<osg::Node> arrow = mResourceSystem->getSceneManager()->getInstance(model, arrowNode);
|
||||
if (!ammo->getClass().getEnchantment(*ammo).empty())
|
||||
addGlow(arrow, glowColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActorAnimation::itemAdded(const MWWorld::ConstPtr& item, int /*count*/)
|
||||
|
@ -63,6 +367,24 @@ void ActorAnimation::itemAdded(const MWWorld::ConstPtr& item, int /*count*/)
|
|||
addHiddenItemLight(item, light);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mPtr.getClass().hasInventoryStore(mPtr))
|
||||
return;
|
||||
|
||||
// If the count of equipped ammo or throwing weapon was changed, we should update quiver
|
||||
const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
||||
MWWorld::ConstContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
if(weapon == inv.end() || weapon->getTypeName() != typeid(ESM::Weapon).name())
|
||||
return;
|
||||
|
||||
MWWorld::ConstContainerStoreIterator ammo = inv.end();
|
||||
if (weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanThrown)
|
||||
ammo = weapon;
|
||||
else
|
||||
ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition);
|
||||
|
||||
if(ammo != inv.end() && item.getCellRef().getRefId() == ammo->getCellRef().getRefId())
|
||||
updateQuiver();
|
||||
}
|
||||
|
||||
void ActorAnimation::itemRemoved(const MWWorld::ConstPtr& item, int /*count*/)
|
||||
|
@ -78,6 +400,24 @@ void ActorAnimation::itemRemoved(const MWWorld::ConstPtr& item, int /*count*/)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mPtr.getClass().hasInventoryStore(mPtr))
|
||||
return;
|
||||
|
||||
// If the count of equipped ammo or throwing weapon was changed, we should update quiver
|
||||
const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
||||
MWWorld::ConstContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
if(weapon == inv.end() || weapon->getTypeName() != typeid(ESM::Weapon).name())
|
||||
return;
|
||||
|
||||
MWWorld::ConstContainerStoreIterator ammo = inv.end();
|
||||
if (weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanThrown)
|
||||
ammo = weapon;
|
||||
else
|
||||
ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition);
|
||||
|
||||
if(ammo != inv.end() && item.getCellRef().getRefId() == ammo->getCellRef().getRefId())
|
||||
updateQuiver();
|
||||
}
|
||||
|
||||
void ActorAnimation::addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM::Light* esmLight)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <osg/ref_ptr>
|
||||
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "animation.hpp"
|
||||
|
||||
|
@ -36,6 +37,24 @@ class ActorAnimation : public Animation, public MWWorld::ContainerStoreListener
|
|||
|
||||
virtual void itemAdded(const MWWorld::ConstPtr& item, int count);
|
||||
virtual void itemRemoved(const MWWorld::ConstPtr& item, int count);
|
||||
virtual bool isArrowAttached() const { return false; }
|
||||
|
||||
protected:
|
||||
bool mWeaponSheathing;
|
||||
osg::Group* getBoneByName(std::string boneName);
|
||||
virtual void updateHolsteredWeapon(bool showHolsteredWeapons);
|
||||
virtual void injectWeaponBones();
|
||||
virtual void updateQuiver();
|
||||
virtual std::string getHolsteredWeaponBoneName(const MWWorld::ConstPtr& weapon);
|
||||
virtual std::string getHolsteredWeaponBoneName(const unsigned int weaponType);
|
||||
virtual PartHolderPtr getWeaponPart(const std::string& model, const std::string& bonename, bool enchantedGlow, osg::Vec4f* glowColor);
|
||||
virtual PartHolderPtr getWeaponPart(const std::string& model, const std::string& bonename)
|
||||
{
|
||||
osg::Vec4f stubColor = osg::Vec4f(0,0,0,0);
|
||||
return getWeaponPart(model, bonename, false, &stubColor);
|
||||
};
|
||||
|
||||
PartHolderPtr mScabbard;
|
||||
|
||||
private:
|
||||
void addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM::Light* esmLight);
|
||||
|
|
|
@ -1748,8 +1748,6 @@ namespace MWRender
|
|||
}
|
||||
else
|
||||
{
|
||||
osg::StateSet* stateset (new osg::StateSet);
|
||||
|
||||
osg::BlendFunc* blendfunc (new osg::BlendFunc);
|
||||
stateset->setAttributeAndModes(blendfunc, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
||||
|
||||
|
|
|
@ -308,24 +308,37 @@ namespace MWRender
|
|||
type == ESM::Weapon::LongBladeOneHand ||
|
||||
type == ESM::Weapon::BluntOneHand ||
|
||||
type == ESM::Weapon::AxeOneHand ||
|
||||
type == ESM::Weapon::MarksmanThrown ||
|
||||
type == ESM::Weapon::MarksmanCrossbow ||
|
||||
type == ESM::Weapon::MarksmanBow)
|
||||
type == ESM::Weapon::MarksmanThrown)
|
||||
{
|
||||
groupname = "inventoryweapononehand";
|
||||
}
|
||||
else if(type == ESM::Weapon::MarksmanCrossbow ||
|
||||
type == ESM::Weapon::MarksmanBow)
|
||||
{
|
||||
groupname = "inventoryweapononehand";
|
||||
showCarriedLeft = false;
|
||||
}
|
||||
else if(type == ESM::Weapon::LongBladeTwoHand ||
|
||||
type == ESM::Weapon::BluntTwoClose ||
|
||||
type == ESM::Weapon::AxeTwoHand)
|
||||
{
|
||||
groupname = "inventoryweapontwohand";
|
||||
showCarriedLeft = false;
|
||||
}
|
||||
else if(type == ESM::Weapon::BluntTwoWide ||
|
||||
type == ESM::Weapon::SpearTwoWide)
|
||||
{
|
||||
groupname = "inventoryweapontwowide";
|
||||
showCarriedLeft = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
groupname = "inventoryhandtohand";
|
||||
|
||||
showCarriedLeft = (iter->getClass().canBeEquipped(*iter, mCharacter).first != 2);
|
||||
showCarriedLeft = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
groupname = "inventoryhandtohand";
|
||||
else
|
||||
groupname = "inventoryhandtohand";
|
||||
}
|
||||
|
||||
mAnimation->showCarriedLeft(showCarriedLeft);
|
||||
|
|
|
@ -49,7 +49,12 @@ CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const
|
|||
setObjectRoot(model, true, false, true);
|
||||
|
||||
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
||||
{
|
||||
if (mWeaponSheathing)
|
||||
injectWeaponBones();
|
||||
|
||||
addAnimSource("meshes\\xbase_anim.nif", model);
|
||||
}
|
||||
addAnimSource(model, model);
|
||||
|
||||
mPtr.getClass().getInventoryStore(mPtr).setInvListener(this, mPtr);
|
||||
|
@ -84,6 +89,9 @@ void CreatureWeaponAnimation::updateParts()
|
|||
mWeapon.reset();
|
||||
mShield.reset();
|
||||
|
||||
updateHolsteredWeapon(!mShowWeapons);
|
||||
updateQuiver();
|
||||
|
||||
if (mShowWeapons)
|
||||
updatePart(mWeapon, MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
if (mShowCarriedLeft)
|
||||
|
@ -157,14 +165,21 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
|
|||
}
|
||||
}
|
||||
|
||||
bool CreatureWeaponAnimation::isArrowAttached() const
|
||||
{
|
||||
return mAmmunition != nullptr;
|
||||
}
|
||||
|
||||
void CreatureWeaponAnimation::attachArrow()
|
||||
{
|
||||
WeaponAnimation::attachArrow(mPtr);
|
||||
updateQuiver();
|
||||
}
|
||||
|
||||
void CreatureWeaponAnimation::releaseArrow(float attackStrength)
|
||||
{
|
||||
WeaponAnimation::releaseArrow(mPtr, attackStrength);
|
||||
updateQuiver();
|
||||
}
|
||||
|
||||
osg::Group *CreatureWeaponAnimation::getArrowBone()
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace MWRender
|
|||
/// to indicate the facing orientation of the character.
|
||||
virtual void setPitchFactor(float factor) { mPitchFactor = factor; }
|
||||
|
||||
protected:
|
||||
virtual bool isArrowAttached() const;
|
||||
|
||||
private:
|
||||
PartHolderPtr mWeapon;
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <components/sceneutil/skeleton.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include <components/nifosg/nifloader.hpp> // TextKeyMapHolder
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
@ -308,6 +310,12 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
|||
if(mViewMode == viewMode)
|
||||
return;
|
||||
|
||||
// Disable weapon sheathing in the 1st-person mode
|
||||
if (viewMode == VM_FirstPerson)
|
||||
mWeaponSheathing = false;
|
||||
else
|
||||
mWeaponSheathing = Settings::Manager::getBool("weapon sheathing", "Game");
|
||||
|
||||
mViewMode = viewMode;
|
||||
rebuild();
|
||||
|
||||
|
@ -394,6 +402,7 @@ void NpcAnimation::setRenderBin()
|
|||
|
||||
void NpcAnimation::rebuild()
|
||||
{
|
||||
mScabbard.reset();
|
||||
updateNpcBase();
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
||||
|
@ -465,6 +474,11 @@ void NpcAnimation::updateNpcBase()
|
|||
|
||||
setObjectRoot(smodel, true, true, false);
|
||||
|
||||
if (mWeaponSheathing)
|
||||
injectWeaponBones();
|
||||
|
||||
updateParts();
|
||||
|
||||
if(!is1stPerson)
|
||||
{
|
||||
const std::string base = "meshes\\xbase_anim.nif";
|
||||
|
@ -493,8 +507,6 @@ void NpcAnimation::updateNpcBase()
|
|||
mObjectRoot->addCullCallback(new OverrideFieldOfViewCallback(mFirstPersonFieldOfView));
|
||||
}
|
||||
|
||||
updateParts();
|
||||
|
||||
mWeaponAnimationTime->updateStartTime();
|
||||
}
|
||||
|
||||
|
@ -904,7 +916,8 @@ void NpcAnimation::showWeapons(bool showWeapon)
|
|||
attachArrow();
|
||||
}
|
||||
}
|
||||
if (mAlpha != 1.f)
|
||||
// Note: we will need to recreate shaders later if we use weapon sheathing anyway, so there is no point to update them here
|
||||
if (mAlpha != 1.f && !mWeaponSheathing)
|
||||
mResourceSystem->getSceneManager()->recreateShaders(mObjectRoot);
|
||||
}
|
||||
else
|
||||
|
@ -914,6 +927,13 @@ void NpcAnimation::showWeapons(bool showWeapon)
|
|||
if (mPtr == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setAttackingOrSpell(false);
|
||||
}
|
||||
|
||||
updateHolsteredWeapon(!mShowWeapons);
|
||||
updateQuiver();
|
||||
|
||||
// Recreate shaders for invisible actors, otherwise sheath nodes will be visible
|
||||
if (mAlpha != 1.f && mWeaponSheathing)
|
||||
mResourceSystem->getSceneManager()->recreateShaders(mObjectRoot);
|
||||
}
|
||||
|
||||
void NpcAnimation::showCarriedLeft(bool show)
|
||||
|
@ -941,11 +961,13 @@ void NpcAnimation::showCarriedLeft(bool show)
|
|||
void NpcAnimation::attachArrow()
|
||||
{
|
||||
WeaponAnimation::attachArrow(mPtr);
|
||||
updateQuiver();
|
||||
}
|
||||
|
||||
void NpcAnimation::releaseArrow(float attackStrength)
|
||||
{
|
||||
WeaponAnimation::releaseArrow(mPtr, attackStrength);
|
||||
updateQuiver();
|
||||
}
|
||||
|
||||
osg::Group* NpcAnimation::getArrowBone()
|
||||
|
@ -1190,4 +1212,9 @@ void NpcAnimation::setAccurateAiming(bool enabled)
|
|||
mAccurateAiming = enabled;
|
||||
}
|
||||
|
||||
bool NpcAnimation::isArrowAttached() const
|
||||
{
|
||||
return mAmmunition != nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ private:
|
|||
|
||||
protected:
|
||||
virtual void addControllers();
|
||||
virtual bool isArrowAttached() const;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -402,11 +402,15 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
bool isUnderwater()
|
||||
{
|
||||
osg::Vec3f eyePoint = mCameraRelativeTransform->getLastEyePoint();
|
||||
return mEnabled && eyePoint.z() < mWaterLevel;
|
||||
}
|
||||
|
||||
if (mEnabled && eyePoint.z() < mWaterLevel)
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
{
|
||||
if (isUnderwater())
|
||||
return;
|
||||
|
||||
traverse(node, nv);
|
||||
|
@ -1577,6 +1581,8 @@ void SkyManager::update(float duration)
|
|||
mRainIntensityUniform->set((float) mWeatherAlpha);
|
||||
}
|
||||
|
||||
switchUnderwaterRain();
|
||||
|
||||
if (mIsStorm)
|
||||
{
|
||||
osg::Quat quat;
|
||||
|
@ -1628,6 +1634,15 @@ void SkyManager::updateRainParameters()
|
|||
}
|
||||
}
|
||||
|
||||
void SkyManager::switchUnderwaterRain()
|
||||
{
|
||||
if (!mRainParticleSystem)
|
||||
return;
|
||||
|
||||
bool freeze = mUnderwaterSwitch->isUnderwater();
|
||||
mRainParticleSystem->setFrozen(freeze);
|
||||
}
|
||||
|
||||
void SkyManager::setWeather(const WeatherResult& weather)
|
||||
{
|
||||
if (!mCreated) return;
|
||||
|
|
|
@ -180,6 +180,7 @@ namespace MWRender
|
|||
|
||||
void createRain();
|
||||
void destroyRain();
|
||||
void switchUnderwaterRain();
|
||||
void updateRainParameters();
|
||||
|
||||
Resource::SceneManager* mSceneManager;
|
||||
|
|
|
@ -82,7 +82,7 @@ bool FFmpeg_Decoder::getNextPacket()
|
|||
}
|
||||
|
||||
/* Free the packet and look for another */
|
||||
av_free_packet(&mPacket);
|
||||
av_packet_unref(&mPacket);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -90,9 +90,9 @@ bool FFmpeg_Decoder::getNextPacket()
|
|||
|
||||
bool FFmpeg_Decoder::getAVAudioData()
|
||||
{
|
||||
int got_frame;
|
||||
bool got_frame = false;
|
||||
|
||||
if((*mStream)->codec->codec_type != AVMEDIA_TYPE_AUDIO)
|
||||
if(mCodecCtx->codec_type != AVMEDIA_TYPE_AUDIO)
|
||||
return false;
|
||||
|
||||
do {
|
||||
|
@ -100,19 +100,18 @@ bool FFmpeg_Decoder::getAVAudioData()
|
|||
return false;
|
||||
|
||||
/* Decode some data, and check for errors */
|
||||
int len = 0;
|
||||
if((len=avcodec_decode_audio4((*mStream)->codec, mFrame, &got_frame, &mPacket)) < 0)
|
||||
int ret = 0;
|
||||
ret = avcodec_receive_frame(mCodecCtx, mFrame);
|
||||
if (ret == 0)
|
||||
got_frame = true;
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
ret = 0;
|
||||
if (ret == 0)
|
||||
ret = avcodec_send_packet(mCodecCtx, &mPacket);
|
||||
if (ret < 0 && ret != AVERROR(EAGAIN))
|
||||
return false;
|
||||
|
||||
/* Move the unread data to the front and clear the end bits */
|
||||
int remaining = mPacket.size - len;
|
||||
if(remaining <= 0)
|
||||
av_free_packet(&mPacket);
|
||||
else
|
||||
{
|
||||
memmove(mPacket.data, &mPacket.data[len], remaining);
|
||||
av_shrink_packet(&mPacket, remaining);
|
||||
}
|
||||
av_packet_unref(&mPacket);
|
||||
|
||||
if (!got_frame || mFrame->nb_samples == 0)
|
||||
continue;
|
||||
|
@ -139,8 +138,8 @@ bool FFmpeg_Decoder::getAVAudioData()
|
|||
else
|
||||
mFrameData = &mFrame->data[0];
|
||||
|
||||
} while(got_frame == 0 || mFrame->nb_samples == 0);
|
||||
mNextPts += (double)mFrame->nb_samples / (double)(*mStream)->codec->sample_rate;
|
||||
} while(!got_frame || mFrame->nb_samples == 0);
|
||||
mNextPts += (double)mFrame->nb_samples / mCodecCtx->sample_rate;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -213,7 +212,7 @@ void FFmpeg_Decoder::open(const std::string &fname)
|
|||
|
||||
for(size_t j = 0;j < mFormatCtx->nb_streams;j++)
|
||||
{
|
||||
if(mFormatCtx->streams[j]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
if(mFormatCtx->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
{
|
||||
mStream = &mFormatCtx->streams[j];
|
||||
break;
|
||||
|
@ -222,39 +221,48 @@ void FFmpeg_Decoder::open(const std::string &fname)
|
|||
if(!mStream)
|
||||
throw std::runtime_error("No audio streams in "+fname);
|
||||
|
||||
(*mStream)->codec->request_sample_fmt = (*mStream)->codec->sample_fmt;
|
||||
|
||||
AVCodec *codec = avcodec_find_decoder((*mStream)->codec->codec_id);
|
||||
AVCodec *codec = avcodec_find_decoder((*mStream)->codecpar->codec_id);
|
||||
if(!codec)
|
||||
{
|
||||
std::string ss = "No codec found for id " +
|
||||
std::to_string((*mStream)->codec->codec_id);
|
||||
std::to_string((*mStream)->codecpar->codec_id);
|
||||
throw std::runtime_error(ss);
|
||||
}
|
||||
if(avcodec_open2((*mStream)->codec, codec, nullptr) < 0)
|
||||
throw std::runtime_error(std::string("Failed to open audio codec ") +
|
||||
codec->long_name);
|
||||
|
||||
AVCodecContext *avctx = avcodec_alloc_context3(codec);
|
||||
avcodec_parameters_to_context(avctx, (*mStream)->codecpar);
|
||||
|
||||
// This is not needed anymore above FFMpeg version 4.0
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
av_codec_set_pkt_timebase(avctx, (*mStream)->time_base);
|
||||
#endif
|
||||
|
||||
mCodecCtx = avctx;
|
||||
|
||||
if(avcodec_open2(mCodecCtx, codec, nullptr) < 0)
|
||||
throw std::runtime_error(std::string("Failed to open audio codec ") + codec->long_name);
|
||||
|
||||
mFrame = av_frame_alloc();
|
||||
|
||||
if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_FLT ||
|
||||
(*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
if(mCodecCtx->sample_fmt == AV_SAMPLE_FMT_FLT || mCodecCtx->sample_fmt == AV_SAMPLE_FMT_FLTP)
|
||||
mOutputSampleFormat = AV_SAMPLE_FMT_S16; // FIXME: Check for AL_EXT_FLOAT32 support
|
||||
else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_U8P)
|
||||
else if(mCodecCtx->sample_fmt == AV_SAMPLE_FMT_U8P)
|
||||
mOutputSampleFormat = AV_SAMPLE_FMT_U8;
|
||||
else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_S16P)
|
||||
else if(mCodecCtx->sample_fmt == AV_SAMPLE_FMT_S16P)
|
||||
mOutputSampleFormat = AV_SAMPLE_FMT_S16;
|
||||
else
|
||||
mOutputSampleFormat = AV_SAMPLE_FMT_S16;
|
||||
|
||||
mOutputChannelLayout = (*mStream)->codec->channel_layout;
|
||||
mOutputChannelLayout = (*mStream)->codecpar->channel_layout;
|
||||
if(mOutputChannelLayout == 0)
|
||||
mOutputChannelLayout = av_get_default_channel_layout((*mStream)->codec->channels);
|
||||
mOutputChannelLayout = av_get_default_channel_layout(mCodecCtx->channels);
|
||||
|
||||
mCodecCtx->channel_layout = mOutputChannelLayout;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
if(mStream)
|
||||
avcodec_close((*mStream)->codec);
|
||||
avcodec_free_context(&mCodecCtx);
|
||||
mStream = nullptr;
|
||||
|
||||
if (mFormatCtx != nullptr)
|
||||
|
@ -275,10 +283,10 @@ void FFmpeg_Decoder::open(const std::string &fname)
|
|||
void FFmpeg_Decoder::close()
|
||||
{
|
||||
if(mStream)
|
||||
avcodec_close((*mStream)->codec);
|
||||
avcodec_free_context(&mCodecCtx);
|
||||
mStream = nullptr;
|
||||
|
||||
av_free_packet(&mPacket);
|
||||
av_packet_unref(&mPacket);
|
||||
av_freep(&mFrame);
|
||||
swr_free(&mSwr);
|
||||
av_freep(&mDataBuf);
|
||||
|
@ -308,7 +316,12 @@ void FFmpeg_Decoder::close()
|
|||
|
||||
std::string FFmpeg_Decoder::getName()
|
||||
{
|
||||
// In the FFMpeg 4.0 a "filename" field was replaced by "url"
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
return mFormatCtx->filename;
|
||||
#else
|
||||
return mFormatCtx->url;
|
||||
#endif
|
||||
}
|
||||
|
||||
void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
||||
|
@ -341,11 +354,10 @@ void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *
|
|||
else
|
||||
{
|
||||
char str[1024];
|
||||
av_get_channel_layout_string(str, sizeof(str), (*mStream)->codec->channels,
|
||||
(*mStream)->codec->channel_layout);
|
||||
av_get_channel_layout_string(str, sizeof(str), mCodecCtx->channels, mCodecCtx->channel_layout);
|
||||
Log(Debug::Error) << "Unsupported channel layout: "<< str;
|
||||
|
||||
if((*mStream)->codec->channels == 1)
|
||||
if(mCodecCtx->channels == 1)
|
||||
{
|
||||
mOutputChannelLayout = AV_CH_LAYOUT_MONO;
|
||||
*chans = ChannelConfig_Mono;
|
||||
|
@ -357,27 +369,28 @@ void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *
|
|||
}
|
||||
}
|
||||
|
||||
*samplerate = (*mStream)->codec->sample_rate;
|
||||
int64_t ch_layout = (*mStream)->codec->channel_layout;
|
||||
*samplerate = mCodecCtx->sample_rate;
|
||||
int64_t ch_layout = mCodecCtx->channel_layout;
|
||||
if(ch_layout == 0)
|
||||
ch_layout = av_get_default_channel_layout((*mStream)->codec->channels);
|
||||
ch_layout = av_get_default_channel_layout(mCodecCtx->channels);
|
||||
|
||||
if(mOutputSampleFormat != (*mStream)->codec->sample_fmt ||
|
||||
if(mOutputSampleFormat != mCodecCtx->sample_fmt ||
|
||||
mOutputChannelLayout != ch_layout)
|
||||
{
|
||||
mSwr = swr_alloc_set_opts(mSwr, // SwrContext
|
||||
mOutputChannelLayout, // output ch layout
|
||||
mOutputSampleFormat, // output sample format
|
||||
(*mStream)->codec->sample_rate, // output sample rate
|
||||
mCodecCtx->sample_rate, // output sample rate
|
||||
ch_layout, // input ch layout
|
||||
(*mStream)->codec->sample_fmt, // input sample format
|
||||
(*mStream)->codec->sample_rate, // input sample rate
|
||||
mCodecCtx->sample_fmt, // input sample format
|
||||
mCodecCtx->sample_rate, // input sample rate
|
||||
0, // logging level offset
|
||||
nullptr); // log context
|
||||
if(!mSwr)
|
||||
throw std::runtime_error("Couldn't allocate SwrContext");
|
||||
if(swr_init(mSwr) < 0)
|
||||
throw std::runtime_error("Couldn't initialize SwrContext");
|
||||
int init=swr_init(mSwr);
|
||||
if(init < 0)
|
||||
throw std::runtime_error("Couldn't initialize SwrContext: "+std::to_string(init));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,12 +425,13 @@ size_t FFmpeg_Decoder::getSampleOffset()
|
|||
{
|
||||
int delay = (mFrameSize-mFramePos) / av_get_channel_layout_nb_channels(mOutputChannelLayout) /
|
||||
av_get_bytes_per_sample(mOutputSampleFormat);
|
||||
return (int)(mNextPts*(*mStream)->codec->sample_rate) - delay;
|
||||
return (int)(mNextPts*mCodecCtx->sample_rate) - delay;
|
||||
}
|
||||
|
||||
FFmpeg_Decoder::FFmpeg_Decoder(const VFS::Manager* vfs)
|
||||
: Sound_Decoder(vfs)
|
||||
, mFormatCtx(nullptr)
|
||||
, mCodecCtx(nullptr)
|
||||
, mStream(nullptr)
|
||||
, mFrame(nullptr)
|
||||
, mFrameSize(0)
|
||||
|
@ -437,7 +451,10 @@ FFmpeg_Decoder::FFmpeg_Decoder(const VFS::Manager* vfs)
|
|||
static bool done_init = false;
|
||||
if(!done_init)
|
||||
{
|
||||
// This is not needed anymore above FFMpeg version 4.0
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
av_register_all();
|
||||
#endif
|
||||
av_log_set_level(AV_LOG_ERROR);
|
||||
done_init = true;
|
||||
}
|
||||
|
|
|
@ -6,18 +6,7 @@ extern "C"
|
|||
{
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
|
||||
// From libavutil version 52.2.0 and onward the declaration of
|
||||
// AV_CH_LAYOUT_* is removed from libavcodec/avcodec.h and moved to
|
||||
// libavutil/channel_layout.h
|
||||
#if AV_VERSION_INT(52, 2, 0) <= AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO)
|
||||
#include <libavutil/channel_layout.h>
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
|
||||
#define av_frame_alloc avcodec_alloc_frame
|
||||
#endif
|
||||
#include <libavutil/channel_layout.h>
|
||||
|
||||
// From version 54.56 binkaudio encoding format changed from S16 to FLTP. See:
|
||||
// https://gitorious.org/ffmpeg/ffmpeg/commit/7bfd1766d1c18f07b0a2dd042418a874d49ea60d
|
||||
|
@ -38,6 +27,7 @@ namespace MWSound
|
|||
class FFmpeg_Decoder final : public Sound_Decoder
|
||||
{
|
||||
AVFormatContext *mFormatCtx;
|
||||
AVCodecContext *mCodecCtx;
|
||||
AVStream **mStream;
|
||||
|
||||
AVPacket mPacket;
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace MWSound
|
|||
{
|
||||
ssize_t clock_delay = (mFrameSize-mFramePos) / av_get_channel_layout_nb_channels(mOutputChannelLayout) /
|
||||
av_get_bytes_per_sample(mOutputSampleFormat);
|
||||
return (size_t)(mAudioClock*mAVStream->codec->sample_rate) - clock_delay;
|
||||
return (size_t)(mAudioClock*mAudioContext->sample_rate) - clock_delay;
|
||||
}
|
||||
|
||||
std::string getStreamName()
|
||||
|
@ -61,7 +61,7 @@ namespace MWSound
|
|||
|
||||
virtual double getAudioClock()
|
||||
{
|
||||
return (double)getSampleOffset()/(double)mAVStream->codec->sample_rate -
|
||||
return (double)getSampleOffset()/(double)mAudioContext->sample_rate -
|
||||
MWBase::Environment::get().getSoundManager()->getTrackTimeDelay(mAudioTrack);
|
||||
}
|
||||
|
||||
|
|
|
@ -330,6 +330,17 @@ namespace MWWorld
|
|||
visitor.merge();
|
||||
}
|
||||
|
||||
bool CellStore::movedHere(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
if (ptr.isEmpty())
|
||||
return false;
|
||||
|
||||
if (mMovedHere.find(ptr.getBase()) != mMovedHere.end())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CellStore::CellStore (const ESM::Cell *cell, const MWWorld::ESMStore& esmStore, std::vector<ESM::ESMReader>& readerList)
|
||||
: mStore(esmStore), mReader(readerList), mCell (cell), mState (State_Unloaded), mHasState (false), mLastRespawn(0,0)
|
||||
{
|
||||
|
|
|
@ -233,6 +233,8 @@ namespace MWWorld
|
|||
|
||||
float getWaterLevel() const;
|
||||
|
||||
bool movedHere(const MWWorld::Ptr& ptr) const;
|
||||
|
||||
void setWaterLevel (float level);
|
||||
|
||||
void setFog (ESM::FogState* fog);
|
||||
|
|
|
@ -330,7 +330,8 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr
|
|||
item.getRefData().getLocals().setVarByInt(script, "onpcadd", 1);
|
||||
}
|
||||
|
||||
if (mListener)
|
||||
// we should not fire event for InventoryStore yet - it has some custom logic
|
||||
if (mListener && !actorPtr.getClass().hasInventoryStore(actorPtr))
|
||||
mListener->itemAdded(item, count);
|
||||
|
||||
return it;
|
||||
|
@ -439,7 +440,8 @@ int MWWorld::ContainerStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||
|
||||
flagAsModified();
|
||||
|
||||
if (mListener)
|
||||
// we should not fire event for InventoryStore yet - it has some custom logic
|
||||
if (mListener && !actor.getClass().hasInventoryStore(actor))
|
||||
mListener->itemRemoved(item, count - toRemove);
|
||||
|
||||
// number of removed items
|
||||
|
|
|
@ -68,6 +68,9 @@ namespace MWWorld
|
|||
|
||||
static const std::string sGoldId;
|
||||
|
||||
protected:
|
||||
ContainerStoreListener* mListener;
|
||||
|
||||
private:
|
||||
|
||||
MWWorld::CellRefList<ESM::Potion> potions;
|
||||
|
@ -87,8 +90,6 @@ namespace MWWorld
|
|||
///< Stores result of levelled item spawns. <(refId, spawningGroup), count>
|
||||
/// This is used to restock levelled items(s) if the old item was sold.
|
||||
|
||||
ContainerStoreListener* mListener;
|
||||
|
||||
mutable float mCachedWeight;
|
||||
mutable bool mWeightUpToDate;
|
||||
ContainerStoreIterator addImp (const Ptr& ptr, int count);
|
||||
|
|
|
@ -141,6 +141,7 @@ void ESMStore::setUp(bool validateRecords)
|
|||
mAttributes.setUp();
|
||||
mDialogs.setUp();
|
||||
mStatics.setUp();
|
||||
mDoors.setUp();
|
||||
|
||||
if (validateRecords)
|
||||
validate();
|
||||
|
|
|
@ -99,7 +99,8 @@ void MWWorld::InventoryStore::readEquipmentState(const MWWorld::ContainerStoreIt
|
|||
}
|
||||
|
||||
MWWorld::InventoryStore::InventoryStore()
|
||||
: mListener(nullptr)
|
||||
: ContainerStore()
|
||||
, mInventoryListener(nullptr)
|
||||
, mUpdatesEnabled (true)
|
||||
, mFirstAutoEquip(true)
|
||||
, mSelectedEnchantItem(end())
|
||||
|
@ -111,7 +112,7 @@ MWWorld::InventoryStore::InventoryStore()
|
|||
MWWorld::InventoryStore::InventoryStore (const InventoryStore& store)
|
||||
: ContainerStore (store)
|
||||
, mMagicEffects(store.mMagicEffects)
|
||||
, mListener(store.mListener)
|
||||
, mInventoryListener(store.mInventoryListener)
|
||||
, mUpdatesEnabled(store.mUpdatesEnabled)
|
||||
, mFirstAutoEquip(store.mFirstAutoEquip)
|
||||
, mPermanentMagicEffectMagnitudes(store.mPermanentMagicEffectMagnitudes)
|
||||
|
@ -124,6 +125,7 @@ MWWorld::InventoryStore::InventoryStore (const InventoryStore& store)
|
|||
MWWorld::InventoryStore& MWWorld::InventoryStore::operator= (const InventoryStore& store)
|
||||
{
|
||||
mListener = store.mListener;
|
||||
mInventoryListener = store.mInventoryListener;
|
||||
mMagicEffects = store.mMagicEffects;
|
||||
mFirstAutoEquip = store.mFirstAutoEquip;
|
||||
mPermanentMagicEffectMagnitudes = store.mPermanentMagicEffectMagnitudes;
|
||||
|
@ -147,6 +149,9 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr,
|
|||
autoEquip(actorPtr);
|
||||
}
|
||||
|
||||
if (mListener)
|
||||
mListener->itemAdded(itemPtr, count);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
@ -246,25 +251,195 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::findSlot (int slot) con
|
|||
return mSlots[slot];
|
||||
}
|
||||
|
||||
void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
||||
void MWWorld::InventoryStore::autoEquipWeapon (const MWWorld::Ptr& actor, TSlots& slots_)
|
||||
{
|
||||
if (!actor.getClass().isNpc())
|
||||
{
|
||||
// In original game creatures do not autoequip weapon, but we need it for weapon sheathing.
|
||||
// The only case when the difference is noticable - when this creature sells weapon.
|
||||
// So just disable weapon autoequipping for creatures which sells weapon.
|
||||
int services = actor.getClass().getServices(actor);
|
||||
bool sellsWeapon = services & (ESM::NPC::Weapon|ESM::NPC::MagicItems);
|
||||
if (sellsWeapon)
|
||||
return;
|
||||
}
|
||||
|
||||
static const ESM::Skill::SkillEnum weaponSkills[] =
|
||||
{
|
||||
ESM::Skill::LongBlade,
|
||||
ESM::Skill::Axe,
|
||||
ESM::Skill::Spear,
|
||||
ESM::Skill::ShortBlade,
|
||||
ESM::Skill::Marksman,
|
||||
ESM::Skill::BluntWeapon
|
||||
};
|
||||
const size_t weaponSkillsLength = sizeof(weaponSkills) / sizeof(weaponSkills[0]);
|
||||
|
||||
bool weaponSkillVisited[weaponSkillsLength] = { false };
|
||||
|
||||
// give arrows/bolt with max damage by default
|
||||
int arrowMax = 0;
|
||||
int boltMax = 0;
|
||||
ContainerStoreIterator arrow(end());
|
||||
ContainerStoreIterator bolt(end());
|
||||
|
||||
// rate ammo
|
||||
for (ContainerStoreIterator iter(begin(ContainerStore::Type_Weapon)); iter!=end(); ++iter)
|
||||
{
|
||||
const ESM::Weapon* esmWeapon = iter->get<ESM::Weapon>()->mBase;
|
||||
|
||||
if (esmWeapon->mData.mType == ESM::Weapon::Arrow)
|
||||
{
|
||||
if (esmWeapon->mData.mChop[1] >= arrowMax)
|
||||
{
|
||||
arrowMax = esmWeapon->mData.mChop[1];
|
||||
arrow = iter;
|
||||
}
|
||||
}
|
||||
else if (esmWeapon->mData.mType == ESM::Weapon::Bolt)
|
||||
{
|
||||
if (esmWeapon->mData.mChop[1] >= boltMax)
|
||||
{
|
||||
boltMax = esmWeapon->mData.mChop[1];
|
||||
bolt = iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rate weapon
|
||||
for (int i = 0; i < static_cast<int>(weaponSkillsLength); ++i)
|
||||
{
|
||||
int max = 0;
|
||||
int maxWeaponSkill = -1;
|
||||
|
||||
for (int j = 0; j < static_cast<int>(weaponSkillsLength); ++j)
|
||||
{
|
||||
int skillValue = actor.getClass().getSkill(actor, static_cast<int>(weaponSkills[j]));
|
||||
if (skillValue > max && !weaponSkillVisited[j])
|
||||
{
|
||||
max = skillValue;
|
||||
maxWeaponSkill = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxWeaponSkill == -1)
|
||||
break;
|
||||
|
||||
max = 0;
|
||||
ContainerStoreIterator weapon(end());
|
||||
|
||||
for (ContainerStoreIterator iter(begin(ContainerStore::Type_Weapon)); iter!=end(); ++iter)
|
||||
{
|
||||
if (!canActorAutoEquip(actor, *iter))
|
||||
continue;
|
||||
|
||||
const ESM::Weapon* esmWeapon = iter->get<ESM::Weapon>()->mBase;
|
||||
|
||||
if (esmWeapon->mData.mType == ESM::Weapon::Arrow || esmWeapon->mData.mType == ESM::Weapon::Bolt)
|
||||
continue;
|
||||
|
||||
if (iter->getClass().getEquipmentSkill(*iter) == weaponSkills[maxWeaponSkill])
|
||||
{
|
||||
if (esmWeapon->mData.mChop[1] >= max)
|
||||
{
|
||||
max = esmWeapon->mData.mChop[1];
|
||||
weapon = iter;
|
||||
}
|
||||
|
||||
if (esmWeapon->mData.mSlash[1] >= max)
|
||||
{
|
||||
max = esmWeapon->mData.mSlash[1];
|
||||
weapon = iter;
|
||||
}
|
||||
|
||||
if (esmWeapon->mData.mThrust[1] >= max)
|
||||
{
|
||||
max = esmWeapon->mData.mThrust[1];
|
||||
weapon = iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isBow = false;
|
||||
bool isCrossbow = false;
|
||||
if (weapon != end())
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Weapon> *ref = weapon->get<ESM::Weapon>();
|
||||
ESM::Weapon::Type type = (ESM::Weapon::Type)ref->mBase->mData.mType;
|
||||
|
||||
if (type == ESM::Weapon::MarksmanBow)
|
||||
isBow = true;
|
||||
else if (type == ESM::Weapon::MarksmanCrossbow)
|
||||
isCrossbow = true;
|
||||
}
|
||||
|
||||
if (weapon != end() && weapon->getClass().canBeEquipped(*weapon, actor).first)
|
||||
{
|
||||
// Do not equip ranged weapons, if there is no suitable ammo
|
||||
bool hasAmmo = true;
|
||||
if (isBow == true)
|
||||
{
|
||||
if (arrow == end())
|
||||
hasAmmo = false;
|
||||
else
|
||||
slots_[Slot_Ammunition] = arrow;
|
||||
}
|
||||
if (isCrossbow == true)
|
||||
{
|
||||
if (bolt == end())
|
||||
hasAmmo = false;
|
||||
else
|
||||
slots_[Slot_Ammunition] = bolt;
|
||||
}
|
||||
|
||||
if (hasAmmo)
|
||||
{
|
||||
std::pair<std::vector<int>, bool> itemsSlots = weapon->getClass().getEquipmentSlots (*weapon);
|
||||
|
||||
if (!itemsSlots.first.empty())
|
||||
{
|
||||
if (!itemsSlots.second)
|
||||
{
|
||||
if (weapon->getRefData().getCount() > 1)
|
||||
{
|
||||
unstack(*weapon, actor);
|
||||
}
|
||||
}
|
||||
|
||||
int slot = itemsSlots.first.front();
|
||||
slots_[slot] = weapon;
|
||||
|
||||
if (!isBow && !isCrossbow)
|
||||
slots_[Slot_Ammunition] = end();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
weaponSkillVisited[maxWeaponSkill] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MWWorld::InventoryStore::autoEquipArmor (const MWWorld::Ptr& actor, TSlots& slots_)
|
||||
{
|
||||
// Only NPCs can wear armor for now.
|
||||
// For creatures we equip only shields.
|
||||
if (!actor.getClass().isNpc())
|
||||
{
|
||||
autoEquipShield(actor, slots_);
|
||||
return;
|
||||
}
|
||||
|
||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting> &store = world->getStore().get<ESM::GameSetting>();
|
||||
|
||||
static float fUnarmoredBase1 = store.find("fUnarmoredBase1")->mValue.getFloat();
|
||||
static float fUnarmoredBase2 = store.find("fUnarmoredBase2")->mValue.getFloat();
|
||||
int unarmoredSkill = actor.getClass().getSkill(actor, ESM::Skill::Unarmored);
|
||||
|
||||
int unarmoredSkill = actor.getClass().getSkill(actor, ESM::Skill::Unarmored);
|
||||
float unarmoredRating = (fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill);
|
||||
|
||||
TSlots slots_;
|
||||
initSlots (slots_);
|
||||
|
||||
// Disable model update during auto-equip
|
||||
mUpdatesEnabled = false;
|
||||
|
||||
// Autoequip clothing, armor and weapons.
|
||||
// Equipping lights is handled in Actors::updateEquippedLight based on environment light.
|
||||
for (ContainerStoreIterator iter (begin(ContainerStore::Type_Clothing | ContainerStore::Type_Armor)); iter!=end(); ++iter)
|
||||
{
|
||||
Ptr test = *iter;
|
||||
|
@ -289,12 +464,12 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
|||
std::pair<std::vector<int>, bool> itemsSlots =
|
||||
iter->getClass().getEquipmentSlots (*iter);
|
||||
|
||||
// checking if current item poited by iter can be equipped
|
||||
// checking if current item pointed by iter can be equipped
|
||||
for (std::vector<int>::const_iterator iter2 (itemsSlots.first.begin());
|
||||
iter2!=itemsSlots.first.end(); ++iter2)
|
||||
{
|
||||
// if true then it means slot is equipped already
|
||||
// check if slot may require swapping if current item is more valueable
|
||||
// check if slot may require swapping if current item is more valuable
|
||||
if (slots_.at (*iter2)!=end())
|
||||
{
|
||||
Ptr old = *slots_.at (*iter2);
|
||||
|
@ -362,98 +537,48 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const ESM::Skill::SkillEnum weaponSkills[] =
|
||||
void MWWorld::InventoryStore::autoEquipShield(const MWWorld::Ptr& actor, TSlots& slots_)
|
||||
{
|
||||
for (ContainerStoreIterator iter(begin(ContainerStore::Type_Armor)); iter != end(); ++iter)
|
||||
{
|
||||
ESM::Skill::LongBlade,
|
||||
ESM::Skill::Axe,
|
||||
ESM::Skill::Spear,
|
||||
ESM::Skill::ShortBlade,
|
||||
ESM::Skill::Marksman,
|
||||
ESM::Skill::BluntWeapon
|
||||
};
|
||||
const size_t weaponSkillsLength = sizeof(weaponSkills) / sizeof(weaponSkills[0]);
|
||||
|
||||
bool weaponSkillVisited[weaponSkillsLength] = { false };
|
||||
|
||||
for (int i = 0; i < static_cast<int>(weaponSkillsLength); ++i)
|
||||
{
|
||||
int max = 0;
|
||||
int maxWeaponSkill = -1;
|
||||
|
||||
for (int j = 0; j < static_cast<int>(weaponSkillsLength); ++j)
|
||||
if (iter->get<ESM::Armor>()->mBase->mData.mType != ESM::Armor::Shield)
|
||||
continue;
|
||||
if (iter->getClass().canBeEquipped(*iter, actor).first != 1)
|
||||
continue;
|
||||
if (iter->getClass().getItemHealth(*iter) <= 0)
|
||||
continue;
|
||||
std::pair<std::vector<int>, bool> shieldSlots =
|
||||
iter->getClass().getEquipmentSlots(*iter);
|
||||
if (shieldSlots.first.empty())
|
||||
continue;
|
||||
int slot = shieldSlots.first[0];
|
||||
const ContainerStoreIterator& shield = mSlots[slot];
|
||||
if (shield != end()
|
||||
&& shield.getType() == Type_Armor && shield->get<ESM::Armor>()->mBase->mData.mType == ESM::Armor::Shield)
|
||||
{
|
||||
int skillValue = actor.getClass().getSkill(actor, static_cast<int>(weaponSkills[j]));
|
||||
|
||||
if (skillValue > max && !weaponSkillVisited[j])
|
||||
{
|
||||
max = skillValue;
|
||||
maxWeaponSkill = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxWeaponSkill == -1)
|
||||
break;
|
||||
|
||||
max = 0;
|
||||
ContainerStoreIterator weapon(end());
|
||||
|
||||
for (ContainerStoreIterator iter(begin(ContainerStore::Type_Weapon)); iter!=end(); ++iter)
|
||||
{
|
||||
if (!canActorAutoEquip(actor, *iter))
|
||||
if (shield->getClass().getItemHealth(*shield) >= iter->getClass().getItemHealth(*iter))
|
||||
continue;
|
||||
|
||||
const ESM::Weapon* esmWeapon = iter->get<ESM::Weapon>()->mBase;
|
||||
|
||||
if (esmWeapon->mData.mType == ESM::Weapon::Arrow || esmWeapon->mData.mType == ESM::Weapon::Bolt)
|
||||
continue;
|
||||
|
||||
if (iter->getClass().getEquipmentSkill(*iter) == weaponSkills[maxWeaponSkill])
|
||||
{
|
||||
if (esmWeapon->mData.mChop[1] >= max)
|
||||
{
|
||||
max = esmWeapon->mData.mChop[1];
|
||||
weapon = iter;
|
||||
}
|
||||
|
||||
if (esmWeapon->mData.mSlash[1] >= max)
|
||||
{
|
||||
max = esmWeapon->mData.mSlash[1];
|
||||
weapon = iter;
|
||||
}
|
||||
|
||||
if (esmWeapon->mData.mThrust[1] >= max)
|
||||
{
|
||||
max = esmWeapon->mData.mThrust[1];
|
||||
weapon = iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (weapon != end() && weapon->getClass().canBeEquipped(*weapon, actor).first)
|
||||
{
|
||||
std::pair<std::vector<int>, bool> itemsSlots =
|
||||
weapon->getClass().getEquipmentSlots (*weapon);
|
||||
|
||||
if (!itemsSlots.first.empty())
|
||||
{
|
||||
if (!itemsSlots.second)
|
||||
{
|
||||
if (weapon->getRefData().getCount() > 1)
|
||||
{
|
||||
unstack(*weapon, actor);
|
||||
}
|
||||
}
|
||||
|
||||
int slot = itemsSlots.first.front();
|
||||
slots_[slot] = weapon;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
weaponSkillVisited[maxWeaponSkill] = true;
|
||||
slots_[slot] = iter;
|
||||
}
|
||||
}
|
||||
|
||||
void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
||||
{
|
||||
TSlots slots_;
|
||||
initSlots (slots_);
|
||||
|
||||
// Disable model update during auto-equip
|
||||
mUpdatesEnabled = false;
|
||||
|
||||
// Autoequip clothing, armor and weapons.
|
||||
// Equipping lights is handled in Actors::updateEquippedLight based on environment light.
|
||||
// Note: creatures do not use the armor mitigation and can equip only shields
|
||||
// Use a custom logic for them - select shield based on its health instead of armor rating (since it useless for creatures)
|
||||
autoEquipWeapon(actor, slots_);
|
||||
autoEquipArmor(actor, slots_);
|
||||
|
||||
bool changed = false;
|
||||
|
||||
|
@ -476,50 +601,6 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
|||
}
|
||||
}
|
||||
|
||||
void MWWorld::InventoryStore::autoEquipShield(const MWWorld::Ptr& actor)
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
mUpdatesEnabled = false;
|
||||
for (ContainerStoreIterator iter(begin(ContainerStore::Type_Armor)); iter != end(); ++iter)
|
||||
{
|
||||
if (iter->get<ESM::Armor>()->mBase->mData.mType != ESM::Armor::Shield)
|
||||
continue;
|
||||
|
||||
if (iter->getClass().canBeEquipped(*iter, actor).first != 1)
|
||||
continue;
|
||||
|
||||
if (iter->getClass().getItemHealth(*iter) <= 0)
|
||||
continue;
|
||||
|
||||
std::pair<std::vector<int>, bool> shieldSlots =
|
||||
iter->getClass().getEquipmentSlots(*iter);
|
||||
|
||||
if (shieldSlots.first.empty())
|
||||
continue;
|
||||
|
||||
int slot = shieldSlots.first[0];
|
||||
const ContainerStoreIterator& shield = mSlots[slot];
|
||||
|
||||
if (shield != end()
|
||||
&& shield.getType() == Type_Armor && shield->get<ESM::Armor>()->mBase->mData.mType == ESM::Armor::Shield)
|
||||
{
|
||||
if (shield->getClass().getItemHealth(*shield) >= iter->getClass().getItemHealth(*iter))
|
||||
continue;
|
||||
}
|
||||
|
||||
equip(slot, iter, actor);
|
||||
updated = true;
|
||||
}
|
||||
mUpdatesEnabled = true;
|
||||
|
||||
if (updated)
|
||||
{
|
||||
fireEquipmentChangedEvent(actor);
|
||||
updateMagicEffects(actor);
|
||||
}
|
||||
}
|
||||
|
||||
const MWMechanics::MagicEffects& MWWorld::InventoryStore::getMagicEffects() const
|
||||
{
|
||||
return mMagicEffects;
|
||||
|
@ -532,7 +613,7 @@ void MWWorld::InventoryStore::updateMagicEffects(const Ptr& actor)
|
|||
return;
|
||||
|
||||
// Delay update until the listener is set up
|
||||
if (!mListener)
|
||||
if (!mInventoryListener)
|
||||
return;
|
||||
|
||||
mMagicEffects = MWMechanics::MagicEffects();
|
||||
|
@ -603,7 +684,7 @@ void MWWorld::InventoryStore::updateMagicEffects(const Ptr& actor)
|
|||
// During first auto equip, we don't play any sounds.
|
||||
// Basically we don't want sounds when the actor is first loaded,
|
||||
// the items should appear as if they'd always been equipped.
|
||||
mListener->permanentEffectAdded(magicEffect, !mFirstAutoEquip);
|
||||
mInventoryListener->permanentEffectAdded(magicEffect, !mFirstAutoEquip);
|
||||
}
|
||||
|
||||
if (magnitude)
|
||||
|
@ -737,6 +818,9 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||
mSelectedEnchantItem = end();
|
||||
}
|
||||
|
||||
if (mListener)
|
||||
mListener->itemRemoved(item, retCount);
|
||||
|
||||
return retCount;
|
||||
}
|
||||
|
||||
|
@ -822,12 +906,12 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipItemQuantity(con
|
|||
|
||||
MWWorld::InventoryStoreListener* MWWorld::InventoryStore::getInvListener()
|
||||
{
|
||||
return mListener;
|
||||
return mInventoryListener;
|
||||
}
|
||||
|
||||
void MWWorld::InventoryStore::setInvListener(InventoryStoreListener *listener, const Ptr& actor)
|
||||
{
|
||||
mListener = listener;
|
||||
mInventoryListener = listener;
|
||||
updateMagicEffects(actor);
|
||||
}
|
||||
|
||||
|
@ -835,8 +919,8 @@ void MWWorld::InventoryStore::fireEquipmentChangedEvent(const Ptr& actor)
|
|||
{
|
||||
if (!mUpdatesEnabled)
|
||||
return;
|
||||
if (mListener)
|
||||
mListener->equipmentChanged();
|
||||
if (mInventoryListener)
|
||||
mInventoryListener->equipmentChanged();
|
||||
|
||||
// if player, update inventory window
|
||||
/*
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace MWWorld
|
|||
|
||||
MWMechanics::MagicEffects mMagicEffects;
|
||||
|
||||
InventoryStoreListener* mListener;
|
||||
InventoryStoreListener* mInventoryListener;
|
||||
|
||||
// Enables updates of magic effects and actor model whenever items are equipped or unequipped.
|
||||
// This is disabled during autoequip to avoid excessive updates
|
||||
|
@ -94,6 +94,10 @@ namespace MWWorld
|
|||
|
||||
TSlots mSlots;
|
||||
|
||||
void autoEquipWeapon(const MWWorld::Ptr& actor, TSlots& slots_);
|
||||
void autoEquipArmor(const MWWorld::Ptr& actor, TSlots& slots_);
|
||||
void autoEquipShield(const MWWorld::Ptr& actor, TSlots& slots_);
|
||||
|
||||
// selected magic item (for using enchantments of type "Cast once" or "Cast when used")
|
||||
ContainerStoreIterator mSelectedEnchantItem;
|
||||
|
||||
|
@ -164,9 +168,6 @@ namespace MWWorld
|
|||
void autoEquip (const MWWorld::Ptr& actor);
|
||||
///< Auto equip items according to stats and item value.
|
||||
|
||||
void autoEquipShield(const MWWorld::Ptr& actor);
|
||||
///< Auto-equip the shield with most health.
|
||||
|
||||
const MWMechanics::MagicEffects& getMagicEffects() const;
|
||||
///< Return magic effects from worn items.
|
||||
|
||||
|
|
|
@ -1059,11 +1059,11 @@ namespace MWWorld
|
|||
{
|
||||
// Load default marker definitions, if game files do not have them for some reason
|
||||
std::pair<std::string, std::string> markers[] = {
|
||||
std::make_pair("divinemarker", "marker_divine.nif"),
|
||||
std::make_pair("doormarker", "marker_arrow.nif"),
|
||||
std::make_pair("northmarker", "marker_north.nif"),
|
||||
std::make_pair("templemarker", "marker_temple.nif"),
|
||||
std::make_pair("travelmarker", "marker_travel.nif")
|
||||
std::make_pair("DivineMarker", "marker_divine.nif"),
|
||||
std::make_pair("DoorMarker", "marker_arrow.nif"),
|
||||
std::make_pair("NorthMarker", "marker_north.nif"),
|
||||
std::make_pair("TempleMarker", "marker_temple.nif"),
|
||||
std::make_pair("TravelMarker", "marker_travel.nif")
|
||||
};
|
||||
|
||||
for (const std::pair<std::string, std::string> marker : markers)
|
||||
|
@ -1080,6 +1080,28 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
void Store<ESM::Door>::setUp()
|
||||
{
|
||||
// Load default Door type marker definitions
|
||||
std::pair<std::string, std::string> markers[] = {
|
||||
std::make_pair("PrisonMarker", "marker_prison.nif")
|
||||
};
|
||||
|
||||
for (const std::pair<std::string, std::string> marker : markers)
|
||||
{
|
||||
if (search(marker.first) == 0)
|
||||
{
|
||||
ESM::Door newMarker = ESM::Door(marker.first, std::string(), marker.second, std::string(), std::string(), std::string());
|
||||
std::pair<typename Static::iterator, bool> ret = mStatic.insert(std::make_pair(marker.first, newMarker));
|
||||
if (ret.first != mStatic.end())
|
||||
{
|
||||
mShared.push_back(&ret.first->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
inline RecordId Store<ESM::Dialogue>::load(ESM::ESMReader &esm) {
|
||||
// The original letter case of a dialogue ID is saved, because it's printed
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <components/detournavigator/debug.hpp>
|
||||
#include <components/detournavigator/navigator.hpp>
|
||||
#include <components/detournavigator/debug.hpp>
|
||||
#include <components/detournavigator/recastglobalallocator.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
@ -230,6 +230,7 @@ namespace MWWorld
|
|||
if (Settings::Manager::getBool("enable log", "Navigator"))
|
||||
DetourNavigator::Log::instance().setSink(std::unique_ptr<DetourNavigator::FileSink>(
|
||||
new DetourNavigator::FileSink(Settings::Manager::getString("log path", "Navigator"))));
|
||||
DetourNavigator::RecastGlobalAllocator::init();
|
||||
mNavigator.reset(new DetourNavigator::Navigator(navigatorSettings));
|
||||
|
||||
mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath, *mNavigator));
|
||||
|
@ -3697,10 +3698,13 @@ namespace MWWorld
|
|||
{
|
||||
if (ptr.getClass().isActor() && ptr.getCellRef().hasContentFile())
|
||||
{
|
||||
if (ptr.getCell()->movedHere(ptr))
|
||||
return true;
|
||||
|
||||
const ESM::Position& origPos = ptr.getCellRef().getPosition();
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptr, origPos.pos[0], origPos.pos[1], origPos.pos[2]);
|
||||
MWBase::Environment::get().getWorld()->rotateObject(ptr, origPos.rot[0], origPos.rot[1], origPos.rot[2]);
|
||||
ptr.getClass().adjustPosition(ptr, false);
|
||||
ptr.getClass().adjustPosition(ptr, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3790,6 +3794,11 @@ namespace MWWorld
|
|||
mRendering->updateActorPath(actor, path, halfExtents, start, end);
|
||||
}
|
||||
|
||||
void World::removeActorPath(const MWWorld::ConstPtr& actor) const
|
||||
{
|
||||
mRendering->removeActorPath(actor);
|
||||
}
|
||||
|
||||
void World::setNavMeshNumberToRender(const std::size_t value)
|
||||
{
|
||||
mRendering->setNavMeshNumber(value);
|
||||
|
|
|
@ -709,6 +709,8 @@ namespace MWWorld
|
|||
void updateActorPath(const MWWorld::ConstPtr& actor, const std::deque<osg::Vec3f>& path,
|
||||
const osg::Vec3f& halfExtents, const osg::Vec3f& start, const osg::Vec3f& end) const override;
|
||||
|
||||
void removeActorPath(const MWWorld::ConstPtr& actor) const override;
|
||||
|
||||
void setNavMeshNumberToRender(const std::size_t value) override;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -55,17 +55,22 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_should_return_cached_value)
|
||||
{
|
||||
const std::size_t maxSize = 1;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 49;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const auto result = cache.set(mAgentHalfExtents, mTilePosition, mRecastMesh, mOffMeshConnections,
|
||||
std::move(mNavMeshData));
|
||||
ASSERT_TRUE(result);
|
||||
EXPECT_EQ(result.get(), (NavMeshDataRef {mData, 1}));
|
||||
}
|
||||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_existing_element_should_throw_exception)
|
||||
{
|
||||
const std::size_t maxSize = 2;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 49;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
const auto anotherData = reinterpret_cast<unsigned char*>(dtAlloc(1, DT_ALLOC_PERM));
|
||||
NavMeshData anotherNavMeshData {anotherData, 1};
|
||||
|
@ -79,7 +84,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, get_should_return_cached_value)
|
||||
{
|
||||
const std::size_t maxSize = 1;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 49;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
cache.set(mAgentHalfExtents, mTilePosition, mRecastMesh, mOffMeshConnections, std::move(mNavMeshData));
|
||||
|
@ -121,7 +128,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_should_replace_unused_value)
|
||||
{
|
||||
const std::size_t maxSize = 1;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 117;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -139,7 +148,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_should_not_replace_used_value)
|
||||
{
|
||||
const std::size_t maxSize = 1;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 49;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -155,7 +166,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_should_replace_unused_least_recently_set_value)
|
||||
{
|
||||
const std::size_t maxSize = 2;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 117;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> leastRecentlySetWater {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -185,7 +198,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_should_replace_unused_least_recently_used_value)
|
||||
{
|
||||
const std::size_t maxSize = 2;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 117;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> leastRecentlyUsedWater {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -227,7 +242,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_should_not_replace_unused_least_recently_used_value_when_item_does_not_not_fit_cache_max_size)
|
||||
{
|
||||
const std::size_t maxSize = 1;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 49;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -243,7 +260,10 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, set_should_not_replace_unused_least_recently_used_value_when_item_does_not_not_fit_size_of_unused_items)
|
||||
{
|
||||
const std::size_t maxSize = 2;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize1 = 49;
|
||||
const std::size_t navMeshKeySize2 = 117;
|
||||
const std::size_t maxSize = 2 * navMeshDataSize + 2 * navMeshKeySize1 + 2 * navMeshKeySize2;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> anotherWater {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -269,7 +289,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, release_used_after_set_then_used_by_get_item_should_left_this_item_available)
|
||||
{
|
||||
const std::size_t maxSize = 1;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 49;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -290,7 +312,9 @@ namespace
|
|||
|
||||
TEST_F(DetourNavigatorNavMeshTilesCacheTest, release_twice_used_item_should_left_this_item_available)
|
||||
{
|
||||
const std::size_t maxSize = 1;
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = 49;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
|
|
@ -267,8 +267,6 @@ namespace
|
|||
|
||||
struct NifFileMock : Nif::File
|
||||
{
|
||||
MOCK_CONST_METHOD1(fail, void (const std::string&));
|
||||
MOCK_CONST_METHOD1(warn, void (const std::string&));
|
||||
MOCK_CONST_METHOD1(getRecord, Nif::Record* (std::size_t));
|
||||
MOCK_CONST_METHOD0(numRecords, std::size_t ());
|
||||
MOCK_CONST_METHOD1(getRoot, Nif::Record* (std::size_t));
|
||||
|
|
|
@ -31,11 +31,13 @@ void Wizard::ExistingInstallationPage::initializePage()
|
|||
// Hide the default item if there are installations to choose from
|
||||
installationsList->item(0)->setHidden(!paths.isEmpty());
|
||||
|
||||
foreach (const QString &path, paths) {
|
||||
QListWidgetItem *item = new QListWidgetItem(path);
|
||||
|
||||
foreach (const QString &path, paths)
|
||||
{
|
||||
if (installationsList->findItems(path, Qt::MatchExactly).isEmpty())
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(path);
|
||||
installationsList->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
connect(installationsList, SIGNAL(currentTextChanged(QString)),
|
||||
|
|
|
@ -321,6 +321,7 @@ namespace Compiler
|
|||
extensions.registerInstruction ("tb", "", opcodeToggleBorders);
|
||||
extensions.registerInstruction ("toggleborders", "", opcodeToggleBorders);
|
||||
extensions.registerInstruction ("togglenavmesh", "", opcodeToggleNavMesh);
|
||||
extensions.registerInstruction ("tap", "", opcodeToggleActorsPaths);
|
||||
extensions.registerInstruction ("toggleactorspaths", "", opcodeToggleActorsPaths);
|
||||
extensions.registerInstruction ("setnavmeshnumber", "l", opcodeSetNavMeshNumberToRender);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
|||
case Qt::DisplayRole:
|
||||
{
|
||||
if (column >=0 && column <=EsmFile::FileProperty_GameFile)
|
||||
return file->fileProperty(static_cast<const EsmFile::FileProperty>(column));
|
||||
return file->fileProperty(static_cast<EsmFile::FileProperty>(column));
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace DetourNavigator
|
|||
remove = 0,
|
||||
mixed = 1,
|
||||
add = 2,
|
||||
update = 3,
|
||||
};
|
||||
|
||||
class AsyncNavMeshUpdater
|
||||
|
|
|
@ -50,8 +50,8 @@ namespace DetourNavigator
|
|||
ChunkyTriMesh& operator=(const ChunkyTriMesh&) = delete;
|
||||
|
||||
/// Returns the chunk indices which overlap the input rectable.
|
||||
template <class OutputIterator>
|
||||
void getChunksOverlappingRect(const Rect& rect, OutputIterator out) const
|
||||
template <class Function>
|
||||
void forEachChunksOverlappingRect(const Rect& rect, Function&& function) const
|
||||
{
|
||||
// Traverse tree
|
||||
for (std::size_t i = 0; i < mNodes.size(); )
|
||||
|
@ -61,7 +61,7 @@ namespace DetourNavigator
|
|||
const bool isLeafNode = node->mOffset >= 0;
|
||||
|
||||
if (isLeafNode && overlap)
|
||||
*out++ = i;
|
||||
function(i);
|
||||
|
||||
if (overlap || isLeafNode)
|
||||
i++;
|
||||
|
|
|
@ -129,6 +129,7 @@ namespace
|
|||
config.bmin[2] -= getBorderSize(settings);
|
||||
config.bmax[0] += getBorderSize(settings);
|
||||
config.bmax[2] += getBorderSize(settings);
|
||||
config.tileSize = settings.mTileSize;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
@ -149,62 +150,61 @@ namespace
|
|||
std::vector<unsigned char> areas(chunkyMesh.getMaxTrisPerChunk(), AreaType_null);
|
||||
const osg::Vec2f tileBoundsMin(config.bmin[0], config.bmin[2]);
|
||||
const osg::Vec2f tileBoundsMax(config.bmax[0], config.bmax[2]);
|
||||
std::vector<std::size_t> cids;
|
||||
chunkyMesh.getChunksOverlappingRect(Rect {tileBoundsMin, tileBoundsMax}, std::back_inserter(cids));
|
||||
bool result = false;
|
||||
|
||||
if (cids.empty())
|
||||
return false;
|
||||
chunkyMesh.forEachChunksOverlappingRect(Rect {tileBoundsMin, tileBoundsMax},
|
||||
[&] (const std::size_t cid)
|
||||
{
|
||||
const auto chunk = chunkyMesh.getChunk(cid);
|
||||
|
||||
for (const auto cid : cids)
|
||||
{
|
||||
const auto chunk = chunkyMesh.getChunk(cid);
|
||||
std::fill(
|
||||
areas.begin(),
|
||||
std::min(areas.begin() + static_cast<std::ptrdiff_t>(chunk.mSize),
|
||||
areas.end()),
|
||||
AreaType_null
|
||||
);
|
||||
|
||||
std::fill(
|
||||
areas.begin(),
|
||||
std::min(areas.begin() + static_cast<std::ptrdiff_t>(chunk.mSize),
|
||||
areas.end()),
|
||||
AreaType_null
|
||||
);
|
||||
rcMarkWalkableTriangles(
|
||||
&context,
|
||||
config.walkableSlopeAngle,
|
||||
recastMesh.getVertices().data(),
|
||||
static_cast<int>(recastMesh.getVerticesCount()),
|
||||
chunk.mIndices,
|
||||
static_cast<int>(chunk.mSize),
|
||||
areas.data()
|
||||
);
|
||||
|
||||
rcMarkWalkableTriangles(
|
||||
&context,
|
||||
config.walkableSlopeAngle,
|
||||
recastMesh.getVertices().data(),
|
||||
static_cast<int>(recastMesh.getVerticesCount()),
|
||||
chunk.mIndices,
|
||||
static_cast<int>(chunk.mSize),
|
||||
areas.data()
|
||||
);
|
||||
for (std::size_t i = 0; i < chunk.mSize; ++i)
|
||||
areas[i] = chunk.mAreaTypes[i];
|
||||
|
||||
for (std::size_t i = 0; i < chunk.mSize; ++i)
|
||||
areas[i] = chunk.mAreaTypes[i];
|
||||
rcClearUnwalkableTriangles(
|
||||
&context,
|
||||
config.walkableSlopeAngle,
|
||||
recastMesh.getVertices().data(),
|
||||
static_cast<int>(recastMesh.getVerticesCount()),
|
||||
chunk.mIndices,
|
||||
static_cast<int>(chunk.mSize),
|
||||
areas.data()
|
||||
);
|
||||
|
||||
rcClearUnwalkableTriangles(
|
||||
&context,
|
||||
config.walkableSlopeAngle,
|
||||
recastMesh.getVertices().data(),
|
||||
static_cast<int>(recastMesh.getVerticesCount()),
|
||||
chunk.mIndices,
|
||||
static_cast<int>(chunk.mSize),
|
||||
areas.data()
|
||||
);
|
||||
const auto trianglesRasterized = rcRasterizeTriangles(
|
||||
&context,
|
||||
recastMesh.getVertices().data(),
|
||||
static_cast<int>(recastMesh.getVerticesCount()),
|
||||
chunk.mIndices,
|
||||
areas.data(),
|
||||
static_cast<int>(chunk.mSize),
|
||||
solid,
|
||||
config.walkableClimb
|
||||
);
|
||||
|
||||
const auto trianglesRasterized = rcRasterizeTriangles(
|
||||
&context,
|
||||
recastMesh.getVertices().data(),
|
||||
static_cast<int>(recastMesh.getVerticesCount()),
|
||||
chunk.mIndices,
|
||||
areas.data(),
|
||||
static_cast<int>(chunk.mSize),
|
||||
solid,
|
||||
config.walkableClimb
|
||||
);
|
||||
if (!trianglesRasterized)
|
||||
throw NavigatorException("Failed to create rasterize triangles from recast mesh for navmesh");
|
||||
|
||||
if (!trianglesRasterized)
|
||||
throw NavigatorException("Failed to create rasterize triangles from recast mesh for navmesh");
|
||||
}
|
||||
result = true;
|
||||
});
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
void rasterizeWaterTriangles(rcContext& context, const osg::Vec3f& agentHalfExtents, const RecastMesh& recastMesh,
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace DetourNavigator
|
|||
{
|
||||
if (!mRecastMeshManager.updateObject(id, transform, areaType))
|
||||
return false;
|
||||
addChangedTiles(shape, transform, ChangeType::mixed);
|
||||
addChangedTiles(shape, transform, ChangeType::update);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "navmeshtilescache.hpp"
|
||||
#include "exceptions.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
namespace
|
||||
|
@ -61,8 +63,9 @@ namespace DetourNavigator
|
|||
if (tileValues == agentValues->second.end())
|
||||
return Value();
|
||||
|
||||
const auto tile = tileValues->second.find(makeNavMeshKey(recastMesh, offMeshConnections));
|
||||
if (tile == tileValues->second.end())
|
||||
// TODO: use different function to make key to avoid unnecessary std::string allocation
|
||||
const auto tile = tileValues->second.Map.find(makeNavMeshKey(recastMesh, offMeshConnections));
|
||||
if (tile == tileValues->second.Map.end())
|
||||
return Value();
|
||||
|
||||
acquireItemUnsafe(tile->second);
|
||||
|
@ -84,12 +87,18 @@ namespace DetourNavigator
|
|||
if (navMeshSize > mFreeNavMeshDataSize + (mMaxNavMeshDataSize - mUsedNavMeshDataSize))
|
||||
return Value();
|
||||
|
||||
while (!mFreeItems.empty() && mUsedNavMeshDataSize + navMeshSize > mMaxNavMeshDataSize)
|
||||
const auto navMeshKey = makeNavMeshKey(recastMesh, offMeshConnections);
|
||||
const auto itemSize = navMeshSize + 2 * navMeshKey.size();
|
||||
|
||||
if (itemSize > mFreeNavMeshDataSize + (mMaxNavMeshDataSize - mUsedNavMeshDataSize))
|
||||
return Value();
|
||||
|
||||
while (!mFreeItems.empty() && mUsedNavMeshDataSize + itemSize > mMaxNavMeshDataSize)
|
||||
removeLeastRecentlyUsed();
|
||||
|
||||
const auto navMeshKey = makeNavMeshKey(recastMesh, offMeshConnections);
|
||||
const auto iterator = mFreeItems.emplace(mFreeItems.end(), agentHalfExtents, changedTile, navMeshKey);
|
||||
const auto emplaced = mValues[agentHalfExtents][changedTile].emplace(navMeshKey, iterator);
|
||||
// TODO: use std::string_view or some alternative to avoid navMeshKey copy into both mFreeItems and mValues
|
||||
const auto emplaced = mValues[agentHalfExtents][changedTile].Map.emplace(navMeshKey, iterator);
|
||||
|
||||
if (!emplaced.second)
|
||||
{
|
||||
|
@ -98,8 +107,8 @@ namespace DetourNavigator
|
|||
}
|
||||
|
||||
iterator->mNavMeshData = std::move(value);
|
||||
mUsedNavMeshDataSize += navMeshSize;
|
||||
mFreeNavMeshDataSize += navMeshSize;
|
||||
mUsedNavMeshDataSize += itemSize;
|
||||
mFreeNavMeshDataSize += itemSize;
|
||||
|
||||
acquireItemUnsafe(iterator);
|
||||
|
||||
|
@ -118,15 +127,16 @@ namespace DetourNavigator
|
|||
if (tileValues == agentValues->second.end())
|
||||
return;
|
||||
|
||||
const auto value = tileValues->second.find(item.mNavMeshKey);
|
||||
if (value == tileValues->second.end())
|
||||
const auto value = tileValues->second.Map.find(item.mNavMeshKey);
|
||||
if (value == tileValues->second.Map.end())
|
||||
return;
|
||||
|
||||
mUsedNavMeshDataSize -= static_cast<std::size_t>(item.mNavMeshData.mSize);
|
||||
mUsedNavMeshDataSize -= getSize(item);
|
||||
mFreeNavMeshDataSize -= getSize(item);
|
||||
mFreeItems.pop_back();
|
||||
|
||||
tileValues->second.erase(value);
|
||||
if (!tileValues->second.empty())
|
||||
tileValues->second.Map.erase(value);
|
||||
if (!tileValues->second.Map.empty())
|
||||
return;
|
||||
|
||||
agentValues->second.erase(tileValues);
|
||||
|
@ -142,7 +152,7 @@ namespace DetourNavigator
|
|||
return;
|
||||
|
||||
mBusyItems.splice(mBusyItems.end(), mFreeItems, iterator);
|
||||
mFreeNavMeshDataSize -= static_cast<std::size_t>(iterator->mNavMeshData.mSize);
|
||||
mFreeNavMeshDataSize -= getSize(*iterator);
|
||||
}
|
||||
|
||||
void NavMeshTilesCache::releaseItem(ItemIterator iterator)
|
||||
|
@ -153,6 +163,6 @@ namespace DetourNavigator
|
|||
const std::lock_guard<std::mutex> lock(mMutex);
|
||||
|
||||
mFreeItems.splice(mFreeItems.begin(), mBusyItems, iterator);
|
||||
mFreeNavMeshDataSize += static_cast<std::size_t>(iterator->mNavMeshData.mSize);
|
||||
mFreeNavMeshDataSize += getSize(*iterator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,19 +108,30 @@ namespace DetourNavigator
|
|||
NavMeshData&& value);
|
||||
|
||||
private:
|
||||
|
||||
struct TileMap
|
||||
{
|
||||
std::map<std::string, ItemIterator> Map;
|
||||
};
|
||||
|
||||
std::mutex mMutex;
|
||||
std::size_t mMaxNavMeshDataSize;
|
||||
std::size_t mUsedNavMeshDataSize;
|
||||
std::size_t mFreeNavMeshDataSize;
|
||||
std::list<Item> mBusyItems;
|
||||
std::list<Item> mFreeItems;
|
||||
std::map<osg::Vec3f, std::map<TilePosition, std::map<std::string, ItemIterator>>> mValues;
|
||||
std::map<osg::Vec3f, std::map<TilePosition, TileMap>> mValues;
|
||||
|
||||
void removeLeastRecentlyUsed();
|
||||
|
||||
void acquireItemUnsafe(ItemIterator iterator);
|
||||
|
||||
void releaseItem(ItemIterator iterator);
|
||||
|
||||
static std::size_t getSize(const Item& item)
|
||||
{
|
||||
return static_cast<std::size_t>(item.mNavMeshData.mSize) + 2 * item.mNavMeshKey.size();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
91
components/detournavigator/recastallocutils.hpp
Normal file
91
components/detournavigator/recastallocutils.hpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTALLOCUTILS_H
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTALLOCUTILS_H
|
||||
|
||||
#include <RecastAlloc.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
static_assert(sizeof(std::size_t) == sizeof(void*), "");
|
||||
|
||||
enum BufferType : std::size_t
|
||||
{
|
||||
BufferType_perm,
|
||||
BufferType_temp,
|
||||
BufferType_unused,
|
||||
};
|
||||
|
||||
inline BufferType* tempPtrBufferType(void* ptr)
|
||||
{
|
||||
return reinterpret_cast<BufferType*>(static_cast<std::size_t*>(ptr) + 1);
|
||||
}
|
||||
|
||||
inline BufferType getTempPtrBufferType(void* ptr)
|
||||
{
|
||||
return *tempPtrBufferType(ptr);
|
||||
}
|
||||
|
||||
inline void setTempPtrBufferType(void* ptr, BufferType value)
|
||||
{
|
||||
*tempPtrBufferType(ptr) = value;
|
||||
}
|
||||
|
||||
inline void** tempPtrPrev(void* ptr)
|
||||
{
|
||||
return static_cast<void**>(ptr);
|
||||
}
|
||||
|
||||
inline void* getTempPtrPrev(void* ptr)
|
||||
{
|
||||
return *tempPtrPrev(ptr);
|
||||
}
|
||||
|
||||
inline void setTempPtrPrev(void* ptr, void* value)
|
||||
{
|
||||
*tempPtrPrev(ptr) = value;
|
||||
}
|
||||
|
||||
inline void* getTempPtrDataPtr(void* ptr)
|
||||
{
|
||||
return reinterpret_cast<void*>(static_cast<std::size_t*>(ptr) + 2);
|
||||
}
|
||||
|
||||
inline BufferType* dataPtrBufferType(void* dataPtr)
|
||||
{
|
||||
return reinterpret_cast<BufferType*>(static_cast<std::size_t*>(dataPtr) - 1);
|
||||
}
|
||||
|
||||
inline BufferType getDataPtrBufferType(void* dataPtr)
|
||||
{
|
||||
return *dataPtrBufferType(dataPtr);
|
||||
}
|
||||
|
||||
inline void setDataPtrBufferType(void* dataPtr, BufferType value)
|
||||
{
|
||||
*dataPtrBufferType(dataPtr) = value;
|
||||
}
|
||||
|
||||
inline void* getTempDataPtrStackPtr(void* dataPtr)
|
||||
{
|
||||
return static_cast<std::size_t*>(dataPtr) - 2;
|
||||
}
|
||||
|
||||
inline void* getPermDataPtrHeapPtr(void* dataPtr)
|
||||
{
|
||||
return static_cast<std::size_t*>(dataPtr) - 1;
|
||||
}
|
||||
|
||||
inline void setPermPtrBufferType(void* ptr, BufferType value)
|
||||
{
|
||||
*static_cast<BufferType*>(ptr) = value;
|
||||
}
|
||||
|
||||
inline void* getPermPtrDataPtr(void* ptr)
|
||||
{
|
||||
return static_cast<std::size_t*>(ptr) + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
68
components/detournavigator/recastglobalallocator.hpp
Normal file
68
components/detournavigator/recastglobalallocator.hpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTGLOBALALLOCATOR_H
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTGLOBALALLOCATOR_H
|
||||
|
||||
#include "recasttempallocator.hpp"
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
class RecastGlobalAllocator
|
||||
{
|
||||
public:
|
||||
static void init()
|
||||
{
|
||||
instance();
|
||||
}
|
||||
|
||||
static void* alloc(size_t size, rcAllocHint hint)
|
||||
{
|
||||
void* result = nullptr;
|
||||
if (rcLikely(hint == RC_ALLOC_TEMP))
|
||||
result = tempAllocator().alloc(size);
|
||||
if (rcUnlikely(!result))
|
||||
result = allocPerm(size);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void free(void* ptr)
|
||||
{
|
||||
if (rcUnlikely(!ptr))
|
||||
return;
|
||||
if (rcLikely(BufferType_temp == getDataPtrBufferType(ptr)))
|
||||
tempAllocator().free(ptr);
|
||||
else
|
||||
{
|
||||
assert(BufferType_perm == getDataPtrBufferType(ptr));
|
||||
::free(getPermDataPtrHeapPtr(ptr));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
RecastGlobalAllocator()
|
||||
{
|
||||
rcAllocSetCustom(&RecastGlobalAllocator::alloc, &RecastGlobalAllocator::free);
|
||||
}
|
||||
|
||||
static RecastGlobalAllocator& instance()
|
||||
{
|
||||
static RecastGlobalAllocator value;
|
||||
return value;
|
||||
}
|
||||
|
||||
static RecastTempAllocator& tempAllocator()
|
||||
{
|
||||
static thread_local RecastTempAllocator value(1024ul * 1024ul);
|
||||
return value;
|
||||
}
|
||||
|
||||
static void* allocPerm(size_t size)
|
||||
{
|
||||
const auto ptr = ::malloc(size + sizeof(std::size_t));
|
||||
if (rcUnlikely(!ptr))
|
||||
return ptr;
|
||||
setPermPtrBufferType(ptr, BufferType_perm);
|
||||
return getPermPtrDataPtr(ptr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
65
components/detournavigator/recasttempallocator.hpp
Normal file
65
components/detournavigator/recasttempallocator.hpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTTEMPALLOCATOR_H
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTTEMPALLOCATOR_H
|
||||
|
||||
#include "recastallocutils.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
class RecastTempAllocator
|
||||
{
|
||||
public:
|
||||
RecastTempAllocator(std::size_t capacity)
|
||||
: mStack(capacity), mTop(mStack.data()), mPrev(nullptr)
|
||||
{}
|
||||
|
||||
void* alloc(std::size_t size)
|
||||
{
|
||||
std::size_t space = mStack.size() - getUsedSize();
|
||||
void* top = mTop;
|
||||
const auto itemSize = 2 * sizeof(std::size_t) + size;
|
||||
if (rcUnlikely(!std::align(sizeof(std::size_t), itemSize, top, space)))
|
||||
return nullptr;
|
||||
setTempPtrBufferType(top, BufferType_temp);
|
||||
setTempPtrPrev(top, mPrev);
|
||||
mTop = static_cast<char*>(top) + itemSize;
|
||||
mPrev = static_cast<char*>(top);
|
||||
return getTempPtrDataPtr(top);
|
||||
}
|
||||
|
||||
void free(void* ptr)
|
||||
{
|
||||
if (rcUnlikely(!ptr))
|
||||
return;
|
||||
assert(BufferType_temp == getDataPtrBufferType(ptr));
|
||||
if (!mPrev || getTempDataPtrStackPtr(ptr) != mPrev)
|
||||
{
|
||||
setDataPtrBufferType(ptr, BufferType_unused);
|
||||
return;
|
||||
}
|
||||
mTop = getTempDataPtrStackPtr(ptr);
|
||||
mPrev = getTempPtrPrev(mTop);
|
||||
while (mPrev && BufferType_unused == getTempPtrBufferType(mPrev))
|
||||
{
|
||||
mTop = mPrev;
|
||||
mPrev = getTempPtrPrev(mTop);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<char> mStack;
|
||||
void* mTop;
|
||||
void* mPrev;
|
||||
|
||||
std::size_t getUsedSize() const
|
||||
{
|
||||
return static_cast<std::size_t>(static_cast<char*>(mTop) - mStack.data());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -22,6 +22,21 @@ struct Door
|
|||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
|
||||
Door(const std::string id, const std::string name, const std::string &model,
|
||||
const std::string script, const std::string opensound, const std::string closesound)
|
||||
: mId(id)
|
||||
, mName(name)
|
||||
, mModel(model)
|
||||
, mScript(script)
|
||||
, mOpenSound(opensound)
|
||||
, mCloseSound(closesound)
|
||||
{
|
||||
}
|
||||
|
||||
Door()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -134,9 +134,9 @@ public:
|
|||
{
|
||||
state->bindVertexBufferObject(bufferobject);
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(MyGUI::Vertex), (char*)nullptr);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyGUI::Vertex), (char*)nullptr + 12);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(MyGUI::Vertex), (char*)nullptr + 16);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(MyGUI::Vertex), reinterpret_cast<char*>(0));
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyGUI::Vertex), reinterpret_cast<char*>(12));
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(MyGUI::Vertex), reinterpret_cast<char*>(16));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,10 +18,6 @@ struct File
|
|||
{
|
||||
virtual ~File() = default;
|
||||
|
||||
virtual void fail(const std::string &msg) const = 0;
|
||||
|
||||
virtual void warn(const std::string &msg) const = 0;
|
||||
|
||||
virtual Record *getRecord(size_t index) const = 0;
|
||||
|
||||
virtual size_t numRecords() const = 0;
|
||||
|
@ -71,14 +67,14 @@ class NIFFile final : public File
|
|||
|
||||
public:
|
||||
/// Used if file parsing fails
|
||||
void fail(const std::string &msg) const override
|
||||
void fail(const std::string &msg) const
|
||||
{
|
||||
std::string err = " NIFFile Error: " + msg;
|
||||
err += "\nFile: " + filename;
|
||||
throw std::runtime_error(err);
|
||||
}
|
||||
/// Used when something goes wrong, but not catastrophically so
|
||||
void warn(const std::string &msg) const override
|
||||
void warn(const std::string &msg) const
|
||||
{
|
||||
Log(Debug::Warning) << " NIFFile Warning: " << msg << "\nFile: " << filename;
|
||||
}
|
||||
|
|
|
@ -396,7 +396,8 @@ namespace Resource
|
|||
{
|
||||
const char* reserved[] = {"Head", "Neck", "Chest", "Groin", "Right Hand", "Left Hand", "Right Wrist", "Left Wrist", "Shield Bone", "Right Forearm", "Left Forearm", "Right Upper Arm",
|
||||
"Left Upper Arm", "Right Foot", "Left Foot", "Right Ankle", "Left Ankle", "Right Knee", "Left Knee", "Right Upper Leg", "Left Upper Leg", "Right Clavicle",
|
||||
"Left Clavicle", "Weapon Bone", "Tail", "Bip01", "Root Bone", "BoneOffset", "AttachLight", "ArrowBone", "Camera"};
|
||||
"Left Clavicle", "Weapon Bone", "Tail", "Bip01", "Root Bone", "BoneOffset", "AttachLight", "Arrow", "Camera"};
|
||||
|
||||
reservedNames = std::vector<std::string>(reserved, reserved + sizeof(reserved)/sizeof(reserved[0]));
|
||||
|
||||
for (unsigned int i=0; i<sizeof(reserved)/sizeof(reserved[0]); ++i)
|
||||
|
|
|
@ -171,9 +171,20 @@ followers attack on sight
|
|||
Make player followers and escorters start combat with enemies who have started combat with them or the player.
|
||||
Otherwise they wait for the enemies or the player to do an attack first.
|
||||
Please note this setting has not been extensively tested and could have side effects with certain quests.
|
||||
|
||||
This setting can be toggled in Advanced tab of the launcher.
|
||||
|
||||
weapon sheathing
|
||||
----------------
|
||||
|
||||
:Type: boolean
|
||||
:Range: True/False
|
||||
:Default: False
|
||||
|
||||
If this setting is true, OpenMW will utilize weapon sheathing-compatible assets to display holstered weapons.
|
||||
|
||||
To make use of this, you need to have an xbase_anim_sh.nif file with weapon bones that will be injected into the skeleton.
|
||||
Additional _sh suffix models are not essential for weapon sheathing to work but will act as quivers or scabbards for the weapons they correspond to.
|
||||
|
||||
use additional anim sources
|
||||
---------------------------
|
||||
|
||||
|
|
91
extern/osg-ffmpeg-videoplayer/audiodecoder.cpp
vendored
91
extern/osg-ffmpeg-videoplayer/audiodecoder.cpp
vendored
|
@ -6,15 +6,9 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
||||
#include <libswresample/swresample.h>
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
|
||||
#define av_frame_alloc avcodec_alloc_frame
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#include "videostate.hpp"
|
||||
|
@ -61,6 +55,7 @@ MovieAudioDecoder::MovieAudioDecoder(VideoState* videoState)
|
|||
, mFrameData(NULL)
|
||||
, mDataBufLen(0)
|
||||
, mFrame(av_frame_alloc())
|
||||
, mGetNextPacket(true)
|
||||
, mAudioDiffAccum(0.0)
|
||||
, mAudioDiffAvgCoef(exp(log(0.01 / AUDIO_DIFF_AVG_NB)))
|
||||
/* Correct audio only if larger error than this */
|
||||
|
@ -68,10 +63,34 @@ MovieAudioDecoder::MovieAudioDecoder(VideoState* videoState)
|
|||
, mAudioDiffAvgCount(0)
|
||||
{
|
||||
mAudioResampler.reset(new AudioResampler());
|
||||
|
||||
AVCodec *codec = avcodec_find_decoder(mAVStream->codecpar->codec_id);
|
||||
if(!codec)
|
||||
{
|
||||
std::string ss = "No codec found for id " +
|
||||
std::to_string(mAVStream->codecpar->codec_id);
|
||||
throw std::runtime_error(ss);
|
||||
}
|
||||
|
||||
AVCodecContext *avctx = avcodec_alloc_context3(codec);
|
||||
avcodec_parameters_to_context(avctx, mAVStream->codecpar);
|
||||
|
||||
// This is not needed anymore above FFMpeg version 4.0
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
av_codec_set_pkt_timebase(avctx, mAVStream->time_base);
|
||||
#endif
|
||||
|
||||
mAudioContext = avctx;
|
||||
|
||||
if(avcodec_open2(mAudioContext, codec, nullptr) < 0)
|
||||
throw std::runtime_error(std::string("Failed to open audio codec ") + codec->long_name);
|
||||
}
|
||||
|
||||
MovieAudioDecoder::~MovieAudioDecoder()
|
||||
{
|
||||
if(mAudioContext)
|
||||
avcodec_free_context(&mAudioContext);
|
||||
|
||||
av_freep(&mFrame);
|
||||
av_freep(&mDataBuf);
|
||||
}
|
||||
|
@ -81,13 +100,13 @@ void MovieAudioDecoder::setupFormat()
|
|||
if (mAudioResampler->mSwr)
|
||||
return; // already set up
|
||||
|
||||
AVSampleFormat inputSampleFormat = mAVStream->codec->sample_fmt;
|
||||
AVSampleFormat inputSampleFormat = mAudioContext->sample_fmt;
|
||||
|
||||
uint64_t inputChannelLayout = mAVStream->codec->channel_layout;
|
||||
uint64_t inputChannelLayout = mAudioContext->channel_layout;
|
||||
if (inputChannelLayout == 0)
|
||||
inputChannelLayout = av_get_default_channel_layout(mAVStream->codec->channels);
|
||||
inputChannelLayout = av_get_default_channel_layout(mAudioContext->channels);
|
||||
|
||||
int inputSampleRate = mAVStream->codec->sample_rate;
|
||||
int inputSampleRate = mAudioContext->sample_rate;
|
||||
|
||||
mOutputSampleRate = inputSampleRate;
|
||||
mOutputSampleFormat = inputSampleFormat;
|
||||
|
@ -133,7 +152,7 @@ int MovieAudioDecoder::synchronize_audio()
|
|||
{
|
||||
int n = av_get_bytes_per_sample(mOutputSampleFormat) *
|
||||
av_get_channel_layout_nb_channels(mOutputChannelLayout);
|
||||
sample_skip = ((int)(diff * mAVStream->codec->sample_rate) * n);
|
||||
sample_skip = ((int)(diff * mAudioContext->sample_rate) * n);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,23 +165,31 @@ int MovieAudioDecoder::audio_decode_frame(AVFrame *frame, int &sample_skip)
|
|||
|
||||
for(;;)
|
||||
{
|
||||
while(pkt->size > 0)
|
||||
/* send the packet with the compressed data to the decoder */
|
||||
int ret = 0;
|
||||
if (mGetNextPacket)
|
||||
ret = avcodec_send_packet(mAudioContext, pkt);
|
||||
|
||||
/* read all the output frames (in general there may be any number of them */
|
||||
while (ret >= 0)
|
||||
{
|
||||
int len1, got_frame;
|
||||
|
||||
len1 = avcodec_decode_audio4(mAVStream->codec, frame, &got_frame, pkt);
|
||||
if(len1 < 0) break;
|
||||
|
||||
if(len1 <= pkt->size)
|
||||
ret = avcodec_receive_frame(mAudioContext, frame);
|
||||
if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN))
|
||||
{
|
||||
/* Move the unread data to the front and clear the end bits */
|
||||
int remaining = pkt->size - len1;
|
||||
memmove(pkt->data, &pkt->data[len1], remaining);
|
||||
av_shrink_packet(pkt, remaining);
|
||||
// EAGAIN means that we need additional packages to decode this frame.
|
||||
// AVERROR_EOF means the end of package.
|
||||
mGetNextPacket = true;
|
||||
break;
|
||||
}
|
||||
else if (ret < 0)
|
||||
{
|
||||
// Error encountered. Stop to decode audio stream.
|
||||
av_packet_unref(&mPacket);
|
||||
mGetNextPacket = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* No data yet? Look for more frames */
|
||||
if(!got_frame || frame->nb_samples <= 0)
|
||||
if(frame->nb_samples <= 0)
|
||||
continue;
|
||||
|
||||
if(mAudioResampler->mSwr)
|
||||
|
@ -170,7 +197,7 @@ int MovieAudioDecoder::audio_decode_frame(AVFrame *frame, int &sample_skip)
|
|||
if(!mDataBuf || mDataBufLen < frame->nb_samples)
|
||||
{
|
||||
av_freep(&mDataBuf);
|
||||
if(av_samples_alloc(&mDataBuf, NULL, av_get_channel_layout_nb_channels(mOutputChannelLayout),
|
||||
if(av_samples_alloc(&mDataBuf, nullptr, av_get_channel_layout_nb_channels(mOutputChannelLayout),
|
||||
frame->nb_samples, mOutputSampleFormat, 0) < 0)
|
||||
break;
|
||||
else
|
||||
|
@ -187,14 +214,16 @@ int MovieAudioDecoder::audio_decode_frame(AVFrame *frame, int &sample_skip)
|
|||
else
|
||||
mFrameData = &frame->data[0];
|
||||
|
||||
mAudioClock += (double)frame->nb_samples /
|
||||
(double)mAVStream->codec->sample_rate;
|
||||
int result = frame->nb_samples * av_get_channel_layout_nb_channels(mOutputChannelLayout) *
|
||||
av_get_bytes_per_sample(mOutputSampleFormat);
|
||||
|
||||
/* We have data, return it and come back for more later */
|
||||
return frame->nb_samples * av_get_channel_layout_nb_channels(mOutputChannelLayout) *
|
||||
av_get_bytes_per_sample(mOutputSampleFormat);
|
||||
mGetNextPacket = false;
|
||||
return result;
|
||||
}
|
||||
av_free_packet(pkt);
|
||||
|
||||
av_packet_unref(&mPacket);
|
||||
mGetNextPacket = true;
|
||||
|
||||
/* next packet */
|
||||
if(mVideoState->audioq.get(pkt, mVideoState) < 0)
|
||||
|
@ -202,7 +231,7 @@ int MovieAudioDecoder::audio_decode_frame(AVFrame *frame, int &sample_skip)
|
|||
|
||||
if(pkt->data == mVideoState->mFlushPktData)
|
||||
{
|
||||
avcodec_flush_buffers(mAVStream->codec);
|
||||
avcodec_flush_buffers(mAudioContext);
|
||||
mAudioDiffAccum = 0.0;
|
||||
mAudioDiffAvgCount = 0;
|
||||
mAudioClock = av_q2d(mAVStream->time_base)*pkt->pts;
|
||||
|
|
10
extern/osg-ffmpeg-videoplayer/audiodecoder.hpp
vendored
10
extern/osg-ffmpeg-videoplayer/audiodecoder.hpp
vendored
|
@ -11,11 +11,7 @@ extern "C"
|
|||
#include <libavutil/avutil.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
|
||||
#if AV_VERSION_INT(52, 2, 0) <= AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO)
|
||||
#include <libavutil/channel_layout.h>
|
||||
#endif
|
||||
#include <libavutil/channel_layout.h>
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
|
@ -35,6 +31,7 @@ class MovieAudioDecoder
|
|||
{
|
||||
protected:
|
||||
VideoState *mVideoState;
|
||||
AVCodecContext* mAudioContext;
|
||||
AVStream *mAVStream;
|
||||
enum AVSampleFormat mOutputSampleFormat;
|
||||
uint64_t mOutputChannelLayout;
|
||||
|
@ -51,7 +48,7 @@ private:
|
|||
throw std::bad_alloc();
|
||||
}
|
||||
~AutoAVPacket()
|
||||
{ av_free_packet(this); }
|
||||
{ av_packet_unref(this); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -63,6 +60,7 @@ private:
|
|||
|
||||
AutoAVPacket mPacket;
|
||||
AVFrame *mFrame;
|
||||
bool mGetNextPacket;
|
||||
|
||||
/* averaging filter for audio sync */
|
||||
double mAudioDiffAccum;
|
||||
|
|
177
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
177
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -11,19 +11,7 @@ extern "C"
|
|||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswscale/swscale.h>
|
||||
|
||||
// From libavformat version 55.0.100 and onward the declaration of av_gettime() is
|
||||
// removed from libavformat/avformat.h and moved to libavutil/time.h
|
||||
// https://github.com/FFmpeg/FFmpeg/commit/06a83505992d5f49846c18507a6c3eb8a47c650e
|
||||
#if AV_VERSION_INT(55, 0, 100) <= AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO)
|
||||
#include <libavutil/time.h>
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
|
||||
#define av_frame_alloc avcodec_alloc_frame
|
||||
#endif
|
||||
|
||||
#include <libavutil/time.h>
|
||||
}
|
||||
|
||||
static const char* flushString = "FLUSH";
|
||||
|
@ -54,6 +42,8 @@ namespace Video
|
|||
VideoState::VideoState()
|
||||
: mAudioFactory(NULL)
|
||||
, format_ctx(NULL)
|
||||
, video_ctx(NULL)
|
||||
, audio_ctx(NULL)
|
||||
, av_sync_type(AV_SYNC_DEFAULT)
|
||||
, audio_st(NULL)
|
||||
, video_st(NULL), frame_last_pts(0.0)
|
||||
|
@ -67,8 +57,10 @@ VideoState::VideoState()
|
|||
{
|
||||
mFlushPktData = flush_pkt.data;
|
||||
|
||||
// Register all formats and codecs
|
||||
// This is not needed anymore above FFMpeg version 4.0
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
av_register_all();
|
||||
#endif
|
||||
}
|
||||
|
||||
VideoState::~VideoState()
|
||||
|
@ -85,11 +77,12 @@ void VideoState::setAudioFactory(MovieAudioFactory *factory)
|
|||
void PacketQueue::put(AVPacket *pkt)
|
||||
{
|
||||
AVPacketList *pkt1;
|
||||
if(pkt != &flush_pkt && !pkt->buf && av_dup_packet(pkt) < 0)
|
||||
throw std::runtime_error("Failed to duplicate packet");
|
||||
|
||||
pkt1 = (AVPacketList*)av_malloc(sizeof(AVPacketList));
|
||||
if(!pkt1) throw std::bad_alloc();
|
||||
|
||||
if(pkt != &flush_pkt && !pkt->buf && av_packet_ref(&pkt1->pkt, pkt) < 0)
|
||||
throw std::runtime_error("Failed to duplicate packet");
|
||||
|
||||
pkt1->pkt = *pkt;
|
||||
pkt1->next = NULL;
|
||||
|
||||
|
@ -150,7 +143,7 @@ void PacketQueue::clear()
|
|||
{
|
||||
pkt1 = pkt->next;
|
||||
if (pkt->pkt.data != flush_pkt.data)
|
||||
av_free_packet(&pkt->pkt);
|
||||
av_packet_unref(&pkt->pkt);
|
||||
av_freep(&pkt);
|
||||
}
|
||||
this->last_pkt = NULL;
|
||||
|
@ -211,7 +204,7 @@ int64_t VideoState::istream_seek(void *user_data, int64_t offset, int whence)
|
|||
|
||||
void VideoState::video_display(VideoPicture *vp)
|
||||
{
|
||||
if((*this->video_st)->codec->width != 0 && (*this->video_st)->codec->height != 0)
|
||||
if(this->video_ctx->width != 0 && this->video_ctx->height != 0)
|
||||
{
|
||||
if (!mTexture.get())
|
||||
{
|
||||
|
@ -224,7 +217,7 @@ void VideoState::video_display(VideoPicture *vp)
|
|||
|
||||
osg::ref_ptr<osg::Image> image = new osg::Image;
|
||||
|
||||
image->setImage((*this->video_st)->codec->width, (*this->video_st)->codec->height,
|
||||
image->setImage(this->video_ctx->width, this->video_ctx->height,
|
||||
1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, &vp->data[0], osg::Image::NO_DELETE);
|
||||
|
||||
mTexture->setImage(image);
|
||||
|
@ -303,9 +296,9 @@ int VideoState::queue_picture(AVFrame *pFrame, double pts)
|
|||
// matches a commonly used format (ie YUV420P)
|
||||
if(this->sws_context == NULL)
|
||||
{
|
||||
int w = (*this->video_st)->codec->width;
|
||||
int h = (*this->video_st)->codec->height;
|
||||
this->sws_context = sws_getContext(w, h, (*this->video_st)->codec->pix_fmt,
|
||||
int w = this->video_ctx->width;
|
||||
int h = this->video_ctx->height;
|
||||
this->sws_context = sws_getContext(w, h, this->video_ctx->pix_fmt,
|
||||
w, h, AV_PIX_FMT_RGBA, SWS_BICUBIC,
|
||||
NULL, NULL, NULL);
|
||||
if(this->sws_context == NULL)
|
||||
|
@ -313,11 +306,11 @@ int VideoState::queue_picture(AVFrame *pFrame, double pts)
|
|||
}
|
||||
|
||||
vp->pts = pts;
|
||||
vp->data.resize((*this->video_st)->codec->width * (*this->video_st)->codec->height * 4);
|
||||
vp->data.resize(this->video_ctx->width * this->video_ctx->height * 4);
|
||||
|
||||
uint8_t *dst[4] = { &vp->data[0], nullptr, nullptr, nullptr };
|
||||
sws_scale(this->sws_context, pFrame->data, pFrame->linesize,
|
||||
0, (*this->video_st)->codec->height, dst, this->rgbaFrame->linesize);
|
||||
0, this->video_ctx->height, dst, this->rgbaFrame->linesize);
|
||||
|
||||
// now we inform our display thread that we have a pic ready
|
||||
this->pictq_windex = (this->pictq_windex+1) % VIDEO_PICTURE_ARRAY_SIZE;
|
||||
|
@ -338,7 +331,7 @@ double VideoState::synchronize_video(AVFrame *src_frame, double pts)
|
|||
pts = this->video_clock;
|
||||
|
||||
/* update the video clock */
|
||||
frame_delay = av_q2d((*this->video_st)->codec->time_base);
|
||||
frame_delay = av_q2d(this->video_ctx->pkt_timebase);
|
||||
|
||||
/* if we are repeating a frame, adjust clock accordingly */
|
||||
frame_delay += src_frame->repeat_pict * (frame_delay * 0.5);
|
||||
|
@ -347,30 +340,6 @@ double VideoState::synchronize_video(AVFrame *src_frame, double pts)
|
|||
return pts;
|
||||
}
|
||||
|
||||
static void our_free_buffer(void *opaque, uint8_t *data);
|
||||
/* These are called whenever we allocate a frame
|
||||
* buffer. We use this to store the global_pts in
|
||||
* a frame at the time it is allocated.
|
||||
*/
|
||||
static int64_t global_video_pkt_pts = AV_NOPTS_VALUE;
|
||||
static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic, int flags)
|
||||
{
|
||||
AVBufferRef *ref;
|
||||
int ret = avcodec_default_get_buffer2(c, pic, flags);
|
||||
int64_t *pts = (int64_t*)av_malloc(sizeof(int64_t));
|
||||
*pts = global_video_pkt_pts;
|
||||
pic->opaque = pts;
|
||||
ref = av_buffer_create((uint8_t *)pic->opaque, sizeof(int64_t), our_free_buffer, pic->buf[0], flags);
|
||||
pic->buf[0] = ref;
|
||||
return ret;
|
||||
}
|
||||
static void our_free_buffer(void *opaque, uint8_t *data)
|
||||
{
|
||||
AVBufferRef *ref = (AVBufferRef *)opaque;
|
||||
av_buffer_unref(&ref);
|
||||
av_free(data);
|
||||
}
|
||||
|
||||
class VideoThread : public OpenThreads::Thread
|
||||
{
|
||||
public:
|
||||
|
@ -384,19 +353,18 @@ public:
|
|||
{
|
||||
VideoState* self = mVideoState;
|
||||
AVPacket pkt1, *packet = &pkt1;
|
||||
int frameFinished;
|
||||
AVFrame *pFrame;
|
||||
|
||||
pFrame = av_frame_alloc();
|
||||
|
||||
self->rgbaFrame = av_frame_alloc();
|
||||
avpicture_alloc((AVPicture*)self->rgbaFrame, AV_PIX_FMT_RGBA, (*self->video_st)->codec->width, (*self->video_st)->codec->height);
|
||||
av_image_alloc(self->rgbaFrame->data, self->rgbaFrame->linesize, self->video_ctx->width, self->video_ctx->height, AV_PIX_FMT_RGBA, 1);
|
||||
|
||||
while(self->videoq.get(packet, self) >= 0)
|
||||
{
|
||||
if(packet->data == flush_pkt.data)
|
||||
{
|
||||
avcodec_flush_buffers((*self->video_st)->codec);
|
||||
avcodec_flush_buffers(self->video_ctx);
|
||||
|
||||
self->pictq_mutex.lock();
|
||||
self->pictq_size = 0;
|
||||
|
@ -405,37 +373,36 @@ public:
|
|||
self->pictq_mutex.unlock();
|
||||
|
||||
self->frame_last_pts = packet->pts * av_q2d((*self->video_st)->time_base);
|
||||
global_video_pkt_pts = static_cast<int64_t>(self->frame_last_pts);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Save global pts to be stored in pFrame
|
||||
global_video_pkt_pts = packet->pts;
|
||||
// Decode video frame
|
||||
if(avcodec_decode_video2((*self->video_st)->codec, pFrame, &frameFinished, packet) < 0)
|
||||
int ret = avcodec_send_packet(self->video_ctx, packet);
|
||||
// EAGAIN is not expected
|
||||
if (ret < 0)
|
||||
throw std::runtime_error("Error decoding video frame");
|
||||
|
||||
double pts = 0;
|
||||
if(packet->dts != AV_NOPTS_VALUE)
|
||||
pts = static_cast<double>(packet->dts);
|
||||
else if(pFrame->opaque && *(int64_t*)pFrame->opaque != AV_NOPTS_VALUE)
|
||||
pts = static_cast<double>(*(int64_t*)pFrame->opaque);
|
||||
pts *= av_q2d((*self->video_st)->time_base);
|
||||
|
||||
av_free_packet(packet);
|
||||
|
||||
// Did we get a video frame?
|
||||
if(frameFinished)
|
||||
while (!ret)
|
||||
{
|
||||
pts = self->synchronize_video(pFrame, pts);
|
||||
if(self->queue_picture(pFrame, pts) < 0)
|
||||
break;
|
||||
ret = avcodec_receive_frame(self->video_ctx, pFrame);
|
||||
if (!ret)
|
||||
{
|
||||
double pts = pFrame->best_effort_timestamp;
|
||||
pts *= av_q2d((*self->video_st)->time_base);
|
||||
|
||||
pts = self->synchronize_video(pFrame, pts);
|
||||
|
||||
if(self->queue_picture(pFrame, pts) < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
av_packet_unref(packet);
|
||||
|
||||
av_free(pFrame);
|
||||
|
||||
avpicture_free((AVPicture*)self->rgbaFrame);
|
||||
av_freep(&self->rgbaFrame->data[0]);
|
||||
av_free(self->rgbaFrame);
|
||||
}
|
||||
|
||||
|
@ -497,7 +464,14 @@ public:
|
|||
// AVSEEK_FLAG_BACKWARD appears to be needed, otherwise ffmpeg may seek to a keyframe *after* the given time
|
||||
// we want to seek to any keyframe *before* the given time, so we can continue decoding as normal from there on
|
||||
if(av_seek_frame(self->format_ctx, streamIndex, timestamp, AVSEEK_FLAG_BACKWARD) < 0)
|
||||
{
|
||||
// In the FFMpeg 4.0 a "filename" field was replaced by "url"
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
std::cerr << "Error seeking " << self->format_ctx->filename << std::endl;
|
||||
#else
|
||||
std::cerr << "Error seeking " << self->format_ctx->url << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the packet queues and put a special packet with the new clock time
|
||||
|
@ -548,7 +522,7 @@ public:
|
|||
else if(self->audio_st && packet->stream_index == self->audio_st-pFormatCtx->streams)
|
||||
self->audioq.put(packet);
|
||||
else
|
||||
av_free_packet(packet);
|
||||
av_packet_unref(packet);
|
||||
}
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
|
@ -572,30 +546,43 @@ bool VideoState::update()
|
|||
|
||||
int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
||||
{
|
||||
AVCodecContext *codecCtx;
|
||||
AVCodec *codec;
|
||||
|
||||
if(stream_index < 0 || stream_index >= static_cast<int>(pFormatCtx->nb_streams))
|
||||
return -1;
|
||||
|
||||
// Get a pointer to the codec context for the video stream
|
||||
codecCtx = pFormatCtx->streams[stream_index]->codec;
|
||||
codec = avcodec_find_decoder(codecCtx->codec_id);
|
||||
if(!codec || (avcodec_open2(codecCtx, codec, NULL) < 0))
|
||||
codec = avcodec_find_decoder(pFormatCtx->streams[stream_index]->codecpar->codec_id);
|
||||
if(!codec)
|
||||
{
|
||||
fprintf(stderr, "Unsupported codec!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(codecCtx->codec_type)
|
||||
switch(pFormatCtx->streams[stream_index]->codecpar->codec_type)
|
||||
{
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
this->audio_st = pFormatCtx->streams + stream_index;
|
||||
|
||||
// Get a pointer to the codec context for the video stream
|
||||
this->audio_ctx = avcodec_alloc_context3(codec);
|
||||
avcodec_parameters_to_context(this->audio_ctx, pFormatCtx->streams[stream_index]->codecpar);
|
||||
|
||||
// This is not needed anymore above FFMpeg version 4.0
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
av_codec_set_pkt_timebase(this->audio_ctx, pFormatCtx->streams[stream_index]->time_base);
|
||||
#endif
|
||||
|
||||
if (avcodec_open2(this->audio_ctx, codec, NULL) < 0)
|
||||
{
|
||||
fprintf(stderr, "Unsupported codec!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!mAudioFactory)
|
||||
{
|
||||
std::cerr << "No audio factory registered, can not play audio stream" << std::endl;
|
||||
avcodec_close((*this->audio_st)->codec);
|
||||
avcodec_free_context(&this->audio_ctx);
|
||||
this->audio_st = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -604,7 +591,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
|||
if (!mAudioDecoder.get())
|
||||
{
|
||||
std::cerr << "Failed to create audio decoder, can not play audio stream" << std::endl;
|
||||
avcodec_close((*this->audio_st)->codec);
|
||||
avcodec_free_context(&this->audio_ctx);
|
||||
this->audio_st = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -614,7 +601,21 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
|||
case AVMEDIA_TYPE_VIDEO:
|
||||
this->video_st = pFormatCtx->streams + stream_index;
|
||||
|
||||
codecCtx->get_buffer2 = our_get_buffer;
|
||||
// Get a pointer to the codec context for the video stream
|
||||
this->video_ctx = avcodec_alloc_context3(codec);
|
||||
avcodec_parameters_to_context(this->video_ctx, pFormatCtx->streams[stream_index]->codecpar);
|
||||
|
||||
// This is not needed anymore above FFMpeg version 4.0
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
av_codec_set_pkt_timebase(this->video_ctx, pFormatCtx->streams[stream_index]->time_base);
|
||||
#endif
|
||||
|
||||
if (avcodec_open2(this->video_ctx, codec, NULL) < 0)
|
||||
{
|
||||
fprintf(stderr, "Unsupported codec!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
this->video_thread.reset(new VideoThread(this));
|
||||
break;
|
||||
|
||||
|
@ -680,9 +681,9 @@ void VideoState::init(std::shared_ptr<std::istream> inputstream, const std::stri
|
|||
|
||||
for(i = 0;i < this->format_ctx->nb_streams;i++)
|
||||
{
|
||||
if(this->format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO && video_index < 0)
|
||||
if(this->format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && video_index < 0)
|
||||
video_index = i;
|
||||
if(this->format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO && audio_index < 0)
|
||||
if(this->format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_index < 0)
|
||||
audio_index = i;
|
||||
}
|
||||
|
||||
|
@ -720,12 +721,14 @@ void VideoState::deinit()
|
|||
this->video_thread.reset();
|
||||
}
|
||||
|
||||
if(this->audio_st)
|
||||
avcodec_close((*this->audio_st)->codec);
|
||||
if(this->audio_ctx)
|
||||
avcodec_free_context(&this->audio_ctx);
|
||||
this->audio_st = NULL;
|
||||
if(this->video_st)
|
||||
avcodec_close((*this->video_st)->codec);
|
||||
this->audio_ctx = NULL;
|
||||
if(this->video_ctx)
|
||||
avcodec_free_context(&this->video_ctx);
|
||||
this->video_st = NULL;
|
||||
this->video_ctx = NULL;
|
||||
|
||||
if(this->sws_context)
|
||||
sws_freeContext(this->sws_context);
|
||||
|
|
15
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
15
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
|
@ -15,6 +15,19 @@ namespace osg
|
|||
class Texture2D;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
#include <libavutil/channel_layout.h>
|
||||
|
||||
// From version 54.56 binkaudio encoding format changed from S16 to FLTP. See:
|
||||
// https://gitorious.org/ffmpeg/ffmpeg/commit/7bfd1766d1c18f07b0a2dd042418a874d49ea60d
|
||||
// https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=872
|
||||
#include <libswresample/swresample.h>
|
||||
}
|
||||
|
||||
#include "videodefs.hpp"
|
||||
|
||||
#define VIDEO_PICTURE_QUEUE_SIZE 50
|
||||
|
@ -131,6 +144,8 @@ struct VideoState {
|
|||
|
||||
std::shared_ptr<std::istream> stream;
|
||||
AVFormatContext* format_ctx;
|
||||
AVCodecContext* video_ctx;
|
||||
AVCodecContext* audio_ctx;
|
||||
|
||||
int av_sync_type;
|
||||
|
||||
|
|
2
extern/recastnavigation/.id
vendored
2
extern/recastnavigation/.id
vendored
|
@ -1 +1 @@
|
|||
7bfd9a1d4caccf61e0485b2b05b29966348a8b39
|
||||
3087e805b02d5eb8fff7851234fa2b3f71290eba
|
||||
|
|
|
@ -66,6 +66,7 @@ void rcFree(void* ptr);
|
|||
/// and STL.
|
||||
struct rcNewTag {};
|
||||
inline void* operator new(size_t, const rcNewTag&, void* p) { return p; }
|
||||
inline void operator delete(void*, const rcNewTag&, void*) {}
|
||||
|
||||
/// Signed to avoid warnnings when comparing to int loop indexes, and common error with comparing to zero.
|
||||
/// MSVC2010 has a bug where ssize_t is unsigned (!!!).
|
||||
|
|
|
@ -41,8 +41,7 @@ solution "recastnavigation"
|
|||
-- warnings "Extra" uses /W4 which is too aggressive for us, so use W3 instead.
|
||||
-- Disable:
|
||||
-- * C4351: new behavior for array initialization
|
||||
-- * C4291: no matching operator delete found; we don't use exceptions, so doesn't matter
|
||||
buildoptions { "/W3", "/wd4351", "/wd4291" }
|
||||
buildoptions { "/W3", "/wd4351" }
|
||||
|
||||
filter "platforms:Win32"
|
||||
architecture "x32"
|
||||
|
@ -170,7 +169,7 @@ project "RecastDemo"
|
|||
}
|
||||
postbuildcommands {
|
||||
-- Copy the SDL2 dll to the Bin folder.
|
||||
'{COPY} "%{wks.location}../../Contrib/SDL/lib/%{cfg.architecture:gsub("x86_64", "x64")}/SDL2.dll" "%{cfg.targetdir}"'
|
||||
'{COPY} "%{path.getabsolute("Contrib/SDL/lib/" .. cfg.architecture:gsub("x86_64", "x64") .. "/SDL2.dll")}" "%{cfg.targetdir}"'
|
||||
}
|
||||
|
||||
-- mac includes and libs
|
||||
|
|
|
@ -43,7 +43,7 @@ Copyright 2017 Bret Curtis <psi29a@gmail.com>
|
|||
<category>RolePlaying</category>
|
||||
</categories>
|
||||
<releases>
|
||||
<release version="0.43.0" date="2017-12-05"/>
|
||||
<release version="0.46.0" date="2017-12-05"/>
|
||||
</releases>
|
||||
<url type="homepage">https://openmw.org</url>
|
||||
<url type="bugtracker">https://bugs.openmw.org/</url>
|
||||
|
|
|
@ -117,69 +117,69 @@ fallback=FontColor_color_negative,200,60,30
|
|||
fallback=FontColor_color_count,223,201,159
|
||||
|
||||
# leveling
|
||||
fallback=Level_Up_Level2,You've just realized that there is more to the life than you thought, the last few days have opened your eyes. An uncertain future awaits you.
|
||||
fallback=Level_Up_Level3,Hard work and determination have served you well, keep this up and you'll be bound for great things.
|
||||
fallback=Level_Up_Level4,It's as clear as day to you now, all that time you pissed away in your youth. This... this is life and all the experience you've gained giving you the tools you need to succeed in life.
|
||||
fallback=Level_Up_Level5,Things seem to be working out for you, the world is opening up as you become more capable.
|
||||
fallback=Level_Up_Level6,There is so much more to learn but with every push you gain more knowledge, only increasing your thirst for it.
|
||||
fallback=Level_Up_Level7,You've dug deep within yourself, thinking you'll finally be who you thought you would be... but there is more and you keep digging.
|
||||
fallback=Level_Up_Level2,The last few days have opened your eyes: you realize now that there is more to the life than you thought. An uncertain future awaits you.
|
||||
fallback=Level_Up_Level3,You finally come to understand that great doings start from hard work and determination.
|
||||
fallback=Level_Up_Level4,After reminiscing upon all that time you lost in your youth, it's as clear as day to you now: this - this is the life, and all the experience you gain gives you the tools you need to succeed in it.
|
||||
fallback=Level_Up_Level5,Things seem to be working out for you. As you become more capable, the world is opening up.
|
||||
fallback=Level_Up_Level6,With every push you did to gain knowledge, and yet your thirst for it increased, you realize there is so much more to learn still.
|
||||
fallback=Level_Up_Level7,You dig deep within yourself, trying to finally become the one who you thought you would be... but there's much to keep digging through.
|
||||
fallback=Level_Up_Level8,Success doesn't come easily, but you make it appear that way to others.
|
||||
fallback=Level_Up_Level9,Everything is becoming second nature to you but also just a bit more dangerous.
|
||||
fallback=Level_Up_Level10,Nothing in life is easy or it wouldn't be worth the blood, sweat and tears.
|
||||
fallback=Level_Up_Level9,Everything may slowly become a second nature to you, but it also can turn just a bit more dangerous.
|
||||
fallback=Level_Up_Level10,Nothing in life is easy, or it wouldn't have been worth the blood, sweat and tears.
|
||||
fallback=Level_Up_Level11,Working smarter, not harder is something even a barbarian could benefit from.
|
||||
fallback=Level_Up_Level12,Some would call you crazy for keeping at it, but you know better. It'll all pay off, it already has.
|
||||
fallback=Level_Up_Level13,One nights sleep was all the difference between between something being difficult and then it being easy.
|
||||
fallback=Level_Up_Level14,Waking up today was the best day ever for you, you await more days like these in your future.
|
||||
fallback=Level_Up_Level15,Ouch! You lean back feeling your whole body for what seems the first time. You'll be more mindful in the future, you only have by one life.
|
||||
fallback=Level_Up_Level16,Trusting your instincts have gotten you this far, but you'll need to be smarter to keep from being dead.
|
||||
fallback=Level_Up_Level12,Perhaps some would call you delusional for keeping at it, but you know better. Your dilegence has already paid off, after all.
|
||||
fallback=Level_Up_Level13,One night's sleep is all the difference between something being difficult and something being easy.
|
||||
fallback=Level_Up_Level14,After waking up, you wonder: could today be the best day in your life? You never know.
|
||||
fallback=Level_Up_Level15,Ouch! You lean back feeling your whole body for what seems the first time. You'll be more mindful in the future -- you can only live once.
|
||||
fallback=Level_Up_Level16,Trusting your instincts has gotten you this far, but now it's clear to you that you need to be smarter to survive.
|
||||
fallback=Level_Up_Level17,You're forging your spirit in the crucible that is experience. Be ever vigilant.
|
||||
fallback=Level_Up_Level18,The frustrations of the day before melt away as you wake up, today is a new day.
|
||||
fallback=Level_Up_Level19,Today isn't yesterday, you feel it deep inside but you know that there is still more to this life.
|
||||
fallback=Level_Up_Level20,Luck has never been a factor in your success, just look at the scars on your body and the trails you've endured.
|
||||
fallback=Level_Up_Default,Through sheer force of will, you push onwards and upwards. The toil of your persistence has paid off.
|
||||
fallback=Level_Up_Level18,The frustrations of the day before vanish as you wake up. Today is a new day.
|
||||
fallback=Level_Up_Level19,Today isn't yesterday, you feel that deep inside. You know that there is still more to this life.
|
||||
fallback=Level_Up_Level20,Luck has never been a factor in your success -- that's obvious from the scars on your body and from the number of trails you've endured.
|
||||
fallback=Level_Up_Default,Through sheer force of will, you push onwards and upwards. The toil of your persistence is paying off.
|
||||
|
||||
# character creation
|
||||
fallback=Question_1_Question,Before you lies some kind of creation you never seen before, it's hind leg caught in a hunter's trap. You can tell that its leg is broken.
|
||||
fallback=Question_1_Question,Before you lies a creature you have never seen before. Its hind leg is caught in a hunter's trap, and you can tell that the leg is broken. What will you do?
|
||||
fallback=Question_1_AnswerOne,Pull out you knife for a short and merciful kill.
|
||||
fallback=Question_1_AnswerTwo,Reach into your herbal pouch to find something to ease its suffering before putting it to sleep.
|
||||
fallback=Question_1_AnswerThree,Leave it alone but take the time to observe and learn from this new creation
|
||||
fallback=Question_1_AnswerThree,Leave the leg alone, but take the time to observe and learn from this odd creature.
|
||||
fallback=Question_1_Sound,Voice\CharGen\QA1.mp3
|
||||
fallback=Question_2_Question,Your mother has given everyone a list of choice, pick one.
|
||||
fallback=Question_2_AnswerOne,The fence posts need replacing, help your father?
|
||||
fallback=Question_2_AnswerTwo,Tonight's supper needs a few herbs, head out into the forest to collect them?
|
||||
fallback=Question_2_AnswerThree,Fish aren't going find their way into the kitchen without your help. Go fishing?
|
||||
fallback=Question_2_Question,Your mother suggests you to help with work around your family household. Do you decide to...
|
||||
fallback=Question_2_AnswerOne,Help your father with fence post replacement?
|
||||
fallback=Question_2_AnswerTwo,Collect a few herbs in the forest for tonight's supper?
|
||||
fallback=Question_2_AnswerThree,Help the fish to find their way into the kitchen?
|
||||
fallback=Question_2_Sound,Voice\CharGen\QA2.mp3
|
||||
fallback=Question_3_Question,One of your brother teases you mercilessly in front of everyone about embarrassing details you would rather be forgotten.
|
||||
fallback=Question_3_AnswerOne,Give him a black-eye and dare him to keep it up?
|
||||
fallback=Question_3_AnswerTwo,Beat him to the punch and play it up, if you can control the negative then he can't embarrass you?
|
||||
fallback=Question_3_AnswerThree,Wait until he sleeps, put his hand in a bowl of water and call everyone around the next day to see the results?
|
||||
fallback=Question_3_Question,Your brother teases you mercilessly in front of everyone with embarrassing details you would rather have forgotten.
|
||||
fallback=Question_3_AnswerOne,Give him a black-eye and dare him to keep it up.
|
||||
fallback=Question_3_AnswerTwo,Beat him to the punch and play it up -- if you can control the negative, then he can't embarrass you.
|
||||
fallback=Question_3_AnswerThree,Wait until he sleeps, put his hand in a bowl of water and call everyone around the next day to see the results.
|
||||
fallback=Question_3_Sound,Voice\CharGen\QA3.mp3
|
||||
fallback=Question_4_Question,Rumor has it that the King's security console has a new tool at their disposal for sniffing out the truth, people able to read minds.
|
||||
fallback=Question_4_AnswerOne,You recoil at the thought of someone being able to read your thoughts. It's not that you think something that you'll ever act on it?
|
||||
fallback=Question_4_AnswerTwo,For those who have done nothing, there is nothing to fear. This is just yet another tool for sniffing out thieves, murderers and plots against the crown?
|
||||
fallback=Question_4_AnswerThree,While you loath the idea of someone reading your mind, you accept that it does have its uses if tempered by law and common sense. You wouldn't believe the mind of a madman for example?
|
||||
fallback=Question_4_Question,Rumor has it that the King's security console has a new tool at their disposal for sniffing out the truth, which could be used for reading minds.
|
||||
fallback=Question_4_AnswerOne,You recoil at the thought of someone being able to read your thoughts. It's not that you think something that you'll ever act on it.
|
||||
fallback=Question_4_AnswerTwo,For those who have done nothing, there is nothing to fear. This is just yet another utility for catching thieves, murderers and plots against the crown.
|
||||
fallback=Question_4_AnswerThree,While you loath the idea of someone reading your mind, you accept that it does have its uses if tempered by law and common sense. You wouldn't believe the mind of a madman.
|
||||
fallback=Question_4_Sound,Voice\CharGen\QA4.mp3
|
||||
fallback=Question_5_Question,You're off to market for supplies. You notice that one of the merchants had given you too much back in change.
|
||||
fallback=Question_5_AnswerOne,How dreadful, what if it was you. You head back to the merchant?
|
||||
fallback=Question_5_AnswerTwo,Happy days indeed, you put that extra money towards the needs of your family?
|
||||
fallback=Question_5_AnswerThree,You win some and you lose some. In this case you won and they lost, the oversight is the merchant's problem, not yours?
|
||||
fallback=Question_5_Question,You are returning home from the market after acquiring supplies, and notice that one of the merchants had given you too much back in change.
|
||||
fallback=Question_5_AnswerOne,How dreadful, what if it was you? You head back to the merchant.
|
||||
fallback=Question_5_AnswerTwo,Happy days indeed. Put that extra money towards the needs of your family?
|
||||
fallback=Question_5_AnswerThree,You win some and you lose some. In this case you have won and they have lost, and the oversight is the merchant's problem, not yours, right?
|
||||
fallback=Question_5_Sound,Voice\CharGen\QA5.mp3
|
||||
fallback=Question_6_Question,While at market, a noble yells out to the city watch about a theft. As you turn around a man bumps into you and drops a sack, startled he darts into the crowd.
|
||||
fallback=Question_6_AnswerOne,You pick up the sack and head over to the noble to return his property?
|
||||
fallback=Question_6_AnswerTwo,Just walk away, the last thing you need is someone thinking you had anything to do with it?
|
||||
fallback=Question_6_AnswerThree,Finders, keepers... you whistle as you walk away?
|
||||
fallback=Question_6_AnswerThree,Finders, keepers... you whistle as you walk away with the bag hidden?
|
||||
fallback=Question_6_Sound,Voice\CharGen\QA6.mp3
|
||||
fallback=Question_7_Question,If it's one thing you hate, it's cleaning out the stalls. It has to be done before sunset before the critters return. On your way there an old friend greets you and offers to help if you promise to help them in the future.
|
||||
fallback=Question_7_AnswerOne,You thank him for the offer but would rather get it over with and not make promises you can't keep?
|
||||
fallback=Question_7_AnswerTwo,You reason that two pairs of hands are better than one regardless of the task?
|
||||
fallback=Question_7_AnswerThree,Sounds great, anything is better than cleaning the stalls.
|
||||
fallback=Question_7_AnswerThree,You say that it sounds great and anything is better than cleaning the stalls?
|
||||
fallback=Question_7_Sound,Voice\CharGen\QA7.mp3
|
||||
fallback=Question_8_Question,You just climbed down ladder from working on the roof. You're mother thanks you for the hard work but just at the moment you notice the hammer about to fall down on her head.
|
||||
fallback=Question_8_Question,You just climbed down the ladder after working on the roof. Your mother thanks you for the hard work but just at the moment you notice that a hammer is about to fall down on her head.
|
||||
fallback=Question_8_AnswerOne,You lunge at your mother, pushing her out the way while the hammer falls on top of you?
|
||||
fallback=Question_8_AnswerTwo,Use the ladder to intercept the hammer before it lands on her?
|
||||
fallback=Question_8_AnswerTwo,Try to use the ladder to intercept the hammer before it lands on her?
|
||||
fallback=Question_8_AnswerThree,Warn her to take a step back?
|
||||
fallback=Question_8_Sound,Voice\CharGen\QA8.mp3
|
||||
fallback=Question_9_Question,It's the end of the week and you just got your wages for your hard work. You decide to take the quick way back home, darting into a alley only to be confronted by ruffians who demand that you empty your pockets.
|
||||
fallback=Question_9_Question,It's the end of the week, and you have just got your wages for your hard work. You decide to take the quick way back home, darting into a alley only to be confronted by ruffians who demand that you empty your pockets.
|
||||
fallback=Question_9_AnswerOne,You tell them to go pack sand, planting your feet and raising your fists?
|
||||
fallback=Question_9_AnswerTwo,Acting dejected, you turn your wages over. You know that you can count on your friends to help you track these brigands down and recover what's yours?
|
||||
fallback=Question_9_AnswerThree,Tossing the sack into the air, you charge the leader who's attention is squarely focused on the coins in flight?
|
||||
|
|
|
@ -239,6 +239,9 @@ barter disposition change is permanent = false
|
|||
# 2 means werewolves are ignored)
|
||||
strength influences hand to hand = 0
|
||||
|
||||
# Render holstered weapons (with quivers and scabbards), requires modded assets
|
||||
weapon sheathing = false
|
||||
|
||||
[General]
|
||||
|
||||
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
|
||||
|
|
18
files/windows/openmw.exe.manifest
Normal file
18
files/windows/openmw.exe.manifest
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity type="win32" name="openmw" version="1.0.0.0"/>
|
||||
<description>openmw</description>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings xmlns:ws="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<ws:dpiAware>True</ws:dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
|
|
@ -1 +1,2 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "openmw.ico"
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "openmw.exe.manifest"
|
||||
|
|
Loading…
Reference in a new issue