mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 17:53:53 +00:00
Merge branch 'master' into minimap
This commit is contained in:
commit
c885ec1bd1
58 changed files with 873 additions and 198 deletions
|
@ -255,14 +255,8 @@ if (APPLE)
|
||||||
"${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY)
|
"${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY)
|
||||||
|
|
||||||
# prepare plugins
|
# prepare plugins
|
||||||
if (${CMAKE_BUILD_TYPE} MATCHES "Release")
|
if (${CMAKE_BUILD_TYPE} MATCHES "Release" OR
|
||||||
set(OPENMW_RELEASE_BUILD 1)
|
${CMAKE_BUILD_TYPE} MATCHES "RelWithDebugInfo")
|
||||||
endif()
|
|
||||||
if (${CMAKE_BUILD_TYPE} MATCHES "RelWithDebugInfo")
|
|
||||||
set(OPENMW_RELEASE_BUILD 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (${OPENMW_RELEASE_BUILD})
|
|
||||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL})
|
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL})
|
||||||
else()
|
else()
|
||||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG})
|
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG})
|
||||||
|
@ -278,8 +272,7 @@ endif (APPLE)
|
||||||
|
|
||||||
# Compiler settings
|
# Compiler settings
|
||||||
if (CMAKE_COMPILER_IS_GNUCC)
|
if (CMAKE_COMPILER_IS_GNUCC)
|
||||||
#add_definitions (-Wall -Werror)
|
add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-reorder)
|
||||||
add_definitions (-Wall)
|
|
||||||
endif (CMAKE_COMPILER_IS_GNUCC)
|
endif (CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
if(DPKG_PROGRAM)
|
if(DPKG_PROGRAM)
|
||||||
|
@ -418,6 +411,45 @@ if (WIN32)
|
||||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE")
|
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE")
|
||||||
set_target_properties(openmw PROPERTIES COMPILE_DEFINITIONS_RELEASE "_CONSOLE")
|
set_target_properties(openmw PROPERTIES COMPILE_DEFINITIONS_RELEASE "_CONSOLE")
|
||||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:CONSOLE")
|
set_target_properties(openmw PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:CONSOLE")
|
||||||
|
|
||||||
|
# Play a bit with the warning levels
|
||||||
|
|
||||||
|
set(WARNINGS "/Wall") # Since windows can only disable specific warnings, not enable them
|
||||||
|
|
||||||
|
set(WARNINGS_DISABLE
|
||||||
|
# Warnings that aren't enabled normally and don't need to be enabled
|
||||||
|
# They're unneeded and sometimes completely retarded warnings that /Wall enables
|
||||||
|
# Not going to bother commenting them as they tend to warn on every standard library files
|
||||||
|
4061 4263 4264 4266 4350 4514 4548 4571 4610 4619 4623 4625 4626 4628 4640 4668 4710 4711 4820 4826 4917 4946
|
||||||
|
|
||||||
|
# Warnings that are thrown on standard libraries and not OpenMW
|
||||||
|
4347 # Non-template function with same name and parameter count as template function
|
||||||
|
4365 # Variable signed/unsigned mismatch
|
||||||
|
4510 4512 # Unable to generate copy constructor/assignment operator as it's not public in the base
|
||||||
|
4706 # Assignment in conditional expression
|
||||||
|
4738 # Storing 32-bit float result in memory, possible loss of performance
|
||||||
|
4986 # Undocumented warning that occurs in the crtdbg.h file
|
||||||
|
4996 # Function was declared deprecated
|
||||||
|
|
||||||
|
# OpenMW specific warnings
|
||||||
|
4099 # Type mismatch, declared class or struct is defined with other type
|
||||||
|
4100 # Unreferenced formal parameter (-Wunused-parameter)
|
||||||
|
4127 # Conditional expression is constant
|
||||||
|
4242 # Storing value in a variable of a smaller type, possible loss of data
|
||||||
|
4244 # Storing value of one type in variable of another (size_t in int, for example)
|
||||||
|
4305 # Truncating value (double to float, for example)
|
||||||
|
4309 # Variable overflow, trying to store 128 in a signed char for example
|
||||||
|
4355 # Using 'this' in member initialization list
|
||||||
|
4701 # Potentially uninitialized local variable used
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(d ${WARNINGS_DISABLE})
|
||||||
|
set(WARNINGS "${WARNINGS} /wd${d}")
|
||||||
|
endforeach(d)
|
||||||
|
|
||||||
|
set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS})
|
||||||
|
set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS})
|
||||||
|
set_target_properties(openmw PROPERTIES COMPILE_FLAGS ${WARNINGS})
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
# Same for MinGW
|
# Same for MinGW
|
||||||
|
|
140
README_Mac.md
140
README_Mac.md
|
@ -1,46 +1,30 @@
|
||||||
NOTE: This README is for ardekantur's Mac branch of OpenMW. A README
|
#Getting OpenMW Working on OS X
|
||||||
for the main branch has yet to be written. If you want to submit one,
|
|
||||||
please send me a message!
|
|
||||||
|
|
||||||
OpenMW
|
## Initial setup
|
||||||
======
|
First of all, clone OpenMW repo.
|
||||||
|
|
||||||
From the [official website][]:
|
$ git clone github.com/zinnschlag/openmw
|
||||||
|
|
||||||
> OpenMW is an attempt to reimplement the popular role playing game
|
Or use your github url if you forked.
|
||||||
Morrowind. It aims to be a fully playable, open source
|
|
||||||
implementation of the game. You must own Morrowind to use OpenMW.
|
|
||||||
|
|
||||||
|
About dependencies: I prefer not to install them globally (i. e. in /usr/local/), so I'm installing them in directory in my home directory. If OpenMW sources is in $HOME/path/openmw, I'm using $HOME/path/libs/root as prefix for boost and other libs.
|
||||||
|
|
||||||
About This Project
|
It's useful to create env var for lib install prefix:
|
||||||
------------------
|
|
||||||
|
|
||||||
This specific repository is a branch of OpenMW intended to keep pace
|
$ export OMW_LIB_PREFIX=$HOME/path/libs/root`
|
||||||
with development of the project in order to provide a Mac build for
|
|
||||||
interested parties to contribute. This is not an official, sanctioned
|
|
||||||
branch of the OpenMW project. I will only be able to answer specific
|
|
||||||
questions about getting this project running on Mac OS X, **no other
|
|
||||||
platform**. I will not even be able to guarantee my changes maintain
|
|
||||||
backwards compatibility against builds in other operating systems. You
|
|
||||||
have been warned.
|
|
||||||
|
|
||||||
|
Most of libs can be installed from [Homebrew][homebrew]. Only mpg123 needs to be installed from source (due to lack of universal compilation support). I think that some of libs can be installed from MacPorts or Fink too.
|
||||||
|
|
||||||
Getting OpenMW Working
|
As OpenMW currently only supports i386 architecture on OS X, denendencies also should support it. Set some env vars in current terminal:
|
||||||
----------------------
|
|
||||||
|
|
||||||
1. Clone this repository.
|
|
||||||
2. Note about libs: I prefer not to install them globally (i. e. in /usr/local/), so I installing them in directory in my home directory. If OpenMW sources is in $HOME/path/openmw, I'm using $HOME/path/libs/root as prefix for boost and other libs.
|
|
||||||
It's useful to create env var for lib install prefix:
|
|
||||||
$ export OMW_LIB_PREFIX=$HOME/path/libs/root
|
|
||||||
|
|
||||||
3. First of all, set for current terminal some env vars:
|
|
||||||
$ export CFLAGS="-arch i386"
|
$ export CFLAGS="-arch i386"
|
||||||
$ export CXXFLAGS="-arch i386"
|
$ export CXXFLAGS="-arch i386"
|
||||||
$ export LDFLAGS="-arch i386"
|
$ export LDFLAGS="-arch i386"
|
||||||
All libs will build with correct architecture.
|
|
||||||
If you close your terminal, you should set env vars again before pcoceeding to next steps!
|
|
||||||
|
|
||||||
4. Download [boost][] (tested with 1.45) and install it with the following command:
|
If you close your terminal, you should set env vars again before pcoceeding to next steps!
|
||||||
|
|
||||||
|
## Boost
|
||||||
|
Download [boost][boost] and install it with the following command:
|
||||||
|
|
||||||
$ cd /path/to/boost/source
|
$ cd /path/to/boost/source
|
||||||
$ ./bootstrap.sh --prefix=$OMW_LIB_PREFIX
|
$ ./bootstrap.sh --prefix=$OMW_LIB_PREFIX
|
||||||
|
@ -49,32 +33,47 @@ Getting OpenMW Working
|
||||||
--link-shared,static --prefix=$OMW_LIB_PREFIX install
|
--link-shared,static --prefix=$OMW_LIB_PREFIX install
|
||||||
|
|
||||||
|
|
||||||
5. Download [Ogre][] SDK (tested with 1.7.2), unpack it and move
|
Alternatively you can install boost with homebrew:
|
||||||
`lib/Release/Ogre.framework` into `Library/Frameworks`.
|
|
||||||
|
|
||||||
6. Download [OIS][] and use the XCode project provided in
|
$ brew install boost --universal
|
||||||
`ois/Mac/XCode-2.2`. Be sure to set your build architecture to
|
|
||||||
`i386` and your SDK platform to either 10.5 or 10.6. Once it
|
I think MacPorts also should support universal build for boost.
|
||||||
builds, move `ois/Mac/XCode-2.2/build/Debug/OIS.framework` to
|
|
||||||
`/Library/Frameworks`.
|
## Ogre
|
||||||
|
Download [Ogre][] SDK (tested with 1.7.3), unpack it somewhere and move
|
||||||
|
`lib/Release/Ogre.framework` into `/Library/Frameworks`.
|
||||||
|
|
||||||
|
## OIS
|
||||||
|
Download patched [OIS][] and use the XCode project provided. Be sure to set your build architecture to
|
||||||
|
`i386`. Once it built, locate built OIS.framework with Xcode and move it to `/Library/Frameworks`.
|
||||||
|
|
||||||
|
## mpg123
|
||||||
|
Download [MPG 123][mpg123] and build it:
|
||||||
|
|
||||||
7. Download [mpg123][] and build it:
|
|
||||||
$ cd /path/to/mpg123/source
|
$ cd /path/to/mpg123/source
|
||||||
$ ./configure --prefix=$OMW_LIB_PREFIX --disable-debug \
|
$ ./configure --prefix=$OMW_LIB_PREFIX --disable-debug \
|
||||||
--disable-dependency-tracking \
|
--disable-dependency-tracking \
|
||||||
--with-optimization=4 \
|
--with-optimization=4 \
|
||||||
--with-audio=coreaudio \
|
--with-audio=dummy \
|
||||||
--with-default-audio=coreaudio \
|
--with-default-audio=dummy \
|
||||||
--with-cpu=sse_alone \
|
--with-cpu=sse_alone \
|
||||||
$ make install
|
$ make install
|
||||||
|
|
||||||
8. Download [libsndfile][] and build it:
|
## libsndfile
|
||||||
|
Download [libsndfile][] and build it:
|
||||||
|
|
||||||
$ cd /path/to/libsndfile/source
|
$ cd /path/to/libsndfile/source
|
||||||
$ ./configure --prefix=$OMW_LIB_PREFIX \
|
$ ./configure --prefix=$OMW_LIB_PREFIX \
|
||||||
--disable-dependency-tracking
|
--disable-dependency-tracking
|
||||||
$ make install
|
$ make install
|
||||||
|
|
||||||
9. Download [Bullet][] and build it:
|
or install with homebrew:
|
||||||
|
|
||||||
|
$ brew install libsndfile --universal
|
||||||
|
|
||||||
|
## Bullet
|
||||||
|
Download [Bullet][] and build it:
|
||||||
|
|
||||||
$ cd /path/to/bullet/source
|
$ cd /path/to/bullet/source
|
||||||
$ mkdir build
|
$ mkdir build
|
||||||
$ cd build
|
$ cd build
|
||||||
|
@ -87,12 +86,25 @@ Getting OpenMW Working
|
||||||
-G"Unix Makefiles" ../
|
-G"Unix Makefiles" ../
|
||||||
$ make install
|
$ make install
|
||||||
|
|
||||||
10. Generate the Makefile for OpenMW as follows and build OpenMW:
|
or install with homebrew:
|
||||||
|
|
||||||
|
$ brew install bullet --HEAD --universal
|
||||||
|
|
||||||
|
I prefer head because 2.79 has some issue which causes OpenMW to lag. Also you can edit formula and install 2.77, which is stable and haven't mentioned issue.
|
||||||
|
|
||||||
|
## Qt
|
||||||
|
Install [Qt][qt]. Qt SDK distributed by Nokia is not an option because it's 64 bit only, and OpenMW currently doesn't build for 64 bit on OS X. I'm installing it from Homebrew:
|
||||||
|
|
||||||
|
$ brew install qt --universal
|
||||||
|
|
||||||
|
## Run CMake
|
||||||
|
Generate the Makefile for OpenMW as follows and build OpenMW:
|
||||||
|
|
||||||
$ mkdir /path/to/openmw/build/dir
|
$ mkdir /path/to/openmw/build/dir
|
||||||
$ cd /path/to/open/build/dir
|
$ cd /path/to/open/build/dir
|
||||||
$ cmake \
|
$ cmake \
|
||||||
-D CMAKE_OSX_ARCHITECTURES=i386 \
|
-D CMAKE_OSX_ARCHITECTURES=i386 \
|
||||||
-D OGRESDK=/path/to/ogre/sdk \
|
-D OGRE_SDK=/path/to/ogre/sdk \
|
||||||
-D BOOST_INCLUDEDIR=$OMW_LIB_PREFIX/include/boost-1_45 \
|
-D BOOST_INCLUDEDIR=$OMW_LIB_PREFIX/include/boost-1_45 \
|
||||||
-D BOOST_LIBRARYDIR=$OMW_LIB_PREFIX/lib \
|
-D BOOST_LIBRARYDIR=$OMW_LIB_PREFIX/lib \
|
||||||
-D SNDFILE_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
|
-D SNDFILE_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
|
||||||
|
@ -106,27 +118,43 @@ Getting OpenMW Working
|
||||||
-D BULLET_INCLUDE_DIR=$OMW_LIB_PREFIX/include/bullet/ \
|
-D BULLET_INCLUDE_DIR=$OMW_LIB_PREFIX/include/bullet/ \
|
||||||
-G "Unix Makefiles" /path/to/openmw/source/dir
|
-G "Unix Makefiles" /path/to/openmw/source/dir
|
||||||
$ make
|
$ make
|
||||||
You can use -G"Xcode" if you prefer Xcode, or -G"Eclipse CDT4 - Unix Makefiles"
|
|
||||||
if you prefer Eclipse. You also can specify -D CMAKE_BUILD_TYPE=Debug for debug
|
|
||||||
build.
|
|
||||||
|
|
||||||
11. Copy your Morrowind `Data Files` directory into the OpenMW build dir
|
You can use `-G"Xcode"` if you prefer Xcode, or -G"Eclipse CDT4 - Unix Makefiles"
|
||||||
with the name `data` or create symlink:
|
if you prefer Eclipse. You also can specify `-D CMAKE_BUILD_TYPE=Debug` for debug
|
||||||
$ ln -s /path/to/morrowind/data/files /path/to/openmw/build/dir/data
|
build. As for CMake 2.8.7 and Xcode 4.3, Xcode generator is broken. Sadly Eclipse CDT also cannot import generated project at least on my machine.
|
||||||
|
|
||||||
|
If all libs installed via homebrew (excluding mpg123), then command would be even simplier:
|
||||||
|
|
||||||
|
$ cmake \
|
||||||
|
-D CMAKE_OSX_ARCHITECTURES="i386" \
|
||||||
|
-D OGRE_SDK=/path/to/ogre/sdk \
|
||||||
|
-D MPG123_LIBRARY=$OMW_LIB_PREFIX/lib/libmpg123.a \
|
||||||
|
-D MPG123_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
|
||||||
|
-G "Unix Makefiles" /path/to/openmw/source/dir
|
||||||
|
$ make
|
||||||
|
|
||||||
|
Note for users with recent Xcode versions: you must explicitly specify what set of compilers do you use! If not, gcc will be used for C and Clang for C++. Just add this two -D's to command: `-D CMAKE_C_COMPILER=/usr/bin/clang` and `-D CMAKE_CXX_COMPILER=/usr/bin/clang`
|
||||||
|
|
||||||
|
Note for Xcode 4.3 users: you should specify full path to used SDK, because current CMake (2.8.7) couldn't find SDKs inside Xcode app bundle:
|
||||||
|
|
||||||
|
-D CMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
|
||||||
|
|
||||||
|
# Run
|
||||||
|
From your build directory run:
|
||||||
|
|
||||||
12. From your build directory run:
|
|
||||||
$ OpenMW.app/Contents/MacOS/openmw
|
$ OpenMW.app/Contents/MacOS/openmw
|
||||||
or:
|
or:
|
||||||
|
|
||||||
$ open OpenMW.app
|
$ open OpenMW.app
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[homebrew]: https://github.com/mxcl/homebrew
|
||||||
[boost]: http://www.boost.org
|
[boost]: http://www.boost.org
|
||||||
[Ogre]: http://www.ogre3d.org
|
[Ogre]: http://www.ogre3d.org
|
||||||
[Bullet]: http://bulletphysics.org
|
[Bullet]: http://bulletphysics.org
|
||||||
[OIS]: http://wgois.sf.net
|
[OIS]: https://github.com/corristo/ois-fork
|
||||||
[mpg123]: http://www.mpg123.de
|
[mpg123]: http://www.mpg123.de
|
||||||
[libsndfile]: http://www.mega-nerd.com/libsndfile
|
[libsndfile]: http://www.mega-nerd.com/libsndfile
|
||||||
[official website]: http://openmw.com
|
[official website]: http://openmw.com
|
||||||
[Will Thimbleby's Ogre Framework]: http://www.thimbleby.net/ogre/
|
[Will Thimbleby's Ogre Framework]: http://www.thimbleby.net/ogre/
|
||||||
|
[qt]: http://qt.nokia.com/
|
|
@ -7,9 +7,12 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -53,6 +56,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -71,4 +76,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Apparatus).name(), instance);
|
registerClass (typeid (ESM::Apparatus).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Apparatus::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
return std::string("Item Apparatus Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Apparatus::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
return std::string("Item Apparatus Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,15 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -57,6 +60,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -116,7 +121,7 @@ namespace MWClass
|
||||||
return std::make_pair (slots, false);
|
return std::make_pair (slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Armor::getEuqipmentSkill (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
ptr.get<ESM::Armor>();
|
ptr.get<ESM::Armor>();
|
||||||
|
@ -142,13 +147,13 @@ namespace MWClass
|
||||||
if (typeGmst.empty())
|
if (typeGmst.empty())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
float iWeight = environment.mWorld->getStore().gameSettings.find (typeGmst)->f;
|
float iWeight = environment.mWorld->getStore().gameSettings.find (typeGmst)->i;
|
||||||
|
|
||||||
if (iWeight * environment.mWorld->getStore().gameSettings.find ("fLightMaxMod")->f<=
|
if (iWeight * environment.mWorld->getStore().gameSettings.find ("fLightMaxMod")->f>=
|
||||||
ref->base->data.weight)
|
ref->base->data.weight)
|
||||||
return ESM::Skill::LightArmor;
|
return ESM::Skill::LightArmor;
|
||||||
|
|
||||||
if (iWeight * environment.mWorld->getStore().gameSettings.find ("fMedMaxMod")->f<=
|
if (iWeight * environment.mWorld->getStore().gameSettings.find ("fMedMaxMod")->f>=
|
||||||
ref->base->data.weight)
|
ref->base->data.weight)
|
||||||
return ESM::Skill::MediumArmor;
|
return ESM::Skill::MediumArmor;
|
||||||
|
|
||||||
|
@ -161,4 +166,26 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Armor).name(), instance);
|
registerClass (typeid (ESM::Armor).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Armor::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
int es = getEquipmentSkill(ptr, environment);
|
||||||
|
if (es == ESM::Skill::LightArmor)
|
||||||
|
return std::string("Item Armor Light Up");
|
||||||
|
else if (es == ESM::Skill::MediumArmor)
|
||||||
|
return std::string("Item Armor Medium Up");
|
||||||
|
else
|
||||||
|
return std::string("Item Armor Heavy Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Armor::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
int es = getEquipmentSkill(ptr, environment);
|
||||||
|
if (es == ESM::Skill::LightArmor)
|
||||||
|
return std::string("Item Armor Light Down");
|
||||||
|
else if (es == ESM::Skill::MediumArmor)
|
||||||
|
return std::string("Item Armor Medium Down");
|
||||||
|
else
|
||||||
|
return std::string("Item Armor Heavy Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,12 +35,18 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
virtual int getEuqipmentSkill (const MWWorld::Ptr& ptr,
|
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Environment& environment) const;
|
const MWWorld::Environment& environment) const;
|
||||||
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
||||||
/// no such skill.
|
/// no such skill.
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -55,6 +58,8 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// TODO implement reading
|
// TODO implement reading
|
||||||
|
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -73,4 +78,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Book).name(), instance);
|
registerClass (typeid (ESM::Book).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Book::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Book Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Book::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Book Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -54,6 +57,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -106,7 +111,7 @@ namespace MWClass
|
||||||
return std::make_pair (slots, false);
|
return std::make_pair (slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clothing::getEuqipmentSkill (const MWWorld::Ptr& ptr,
|
int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Environment& environment) const
|
const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
|
@ -124,4 +129,28 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Clothing).name(), instance);
|
registerClass (typeid (ESM::Clothing).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Clothing>();
|
||||||
|
|
||||||
|
if (ref->base->data.type == 8)
|
||||||
|
{
|
||||||
|
return std::string("Item Ring Up");
|
||||||
|
}
|
||||||
|
return std::string("Item Clothes Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Clothing>();
|
||||||
|
|
||||||
|
if (ref->base->data.type == 8)
|
||||||
|
{
|
||||||
|
return std::string("Item Ring Down");
|
||||||
|
}
|
||||||
|
return std::string("Item Clothes Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,18 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
virtual int getEuqipmentSkill (const MWWorld::Ptr& ptr,
|
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Environment& environment) const;
|
const MWWorld::Environment& environment) const;
|
||||||
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
||||||
/// no such skill.
|
/// no such skill.
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// TODO check for key
|
// TODO check for key
|
||||||
std::cout << "Locked container" << std::endl;
|
std::cout << "Locked container" << std::endl;
|
||||||
environment.mSoundManager->playSound(lockedSound, 1.0, 1.0);
|
environment.mSoundManager->playSound3D (ptr, lockedSound, 1.0, 1.0, false);
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -100,7 +100,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// Trap activation goes here
|
// Trap activation goes here
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
||||||
environment.mSoundManager->playSound(trapActivationSound, 1.0, 1.0);
|
environment.mSoundManager->playSound3D (ptr, trapActivationSound, 1.0, 1.0, false);
|
||||||
ptr.getCellRef().trap = "";
|
ptr.getCellRef().trap = "";
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace MWClass
|
||||||
// TODO check for key
|
// TODO check for key
|
||||||
// TODO report failure to player (message, sound?). Look up behaviour of original MW.
|
// TODO report failure to player (message, sound?). Look up behaviour of original MW.
|
||||||
std::cout << "Locked!" << std::endl;
|
std::cout << "Locked!" << std::endl;
|
||||||
environment.mSoundManager->playSound(lockedSound, 1.0, 1.0);
|
environment.mSoundManager->playSound3D (ptr, lockedSound, 1.0, 1.0, false);
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// Trap activation
|
// Trap activation
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
|
||||||
environment.mSoundManager->playSound(trapActivationSound, 1.0, 1.0);
|
environment.mSoundManager->playSound3D(ptr, trapActivationSound, 1.0, 1.0, false);
|
||||||
ptr.getCellRef().trap = "";
|
ptr.getCellRef().trap = "";
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ namespace MWClass
|
||||||
if (environment.mWorld->getPlayer().getPlayer()==actor)
|
if (environment.mWorld->getPlayer().getPlayer()==actor)
|
||||||
{
|
{
|
||||||
// the player is using the door
|
// the player is using the door
|
||||||
|
// The reason this is not 3D is that it would get interrupted when you teleport
|
||||||
environment.mSoundManager->playSound(openSound, 1.0, 1.0);
|
environment.mSoundManager->playSound(openSound, 1.0, 1.0);
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTeleportPlayer (ref->ref.destCell, ref->ref.doorDest));
|
new MWWorld::ActionTeleportPlayer (ref->ref.destCell, ref->ref.doorDest));
|
||||||
|
@ -109,7 +110,7 @@ namespace MWClass
|
||||||
// TODO return action for rotating the door
|
// TODO return action for rotating the door
|
||||||
|
|
||||||
// This is a little pointless, but helps with testing
|
// This is a little pointless, but helps with testing
|
||||||
environment.mSoundManager->playSound(openSound, 1.0, 1.0);
|
environment.mSoundManager->playSound3D (ptr, openSound, 1.0, 1.0, false);
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -51,6 +54,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -69,4 +74,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Ingredient).name(), instance);
|
registerClass (typeid (ESM::Ingredient).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Ingredient::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Ingredient Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Ingredient::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Ingredient Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,8 @@ namespace MWClass
|
||||||
if (!(ref->base->data.flags & ESM::Light::Carry))
|
if (!(ref->base->data.flags & ESM::Light::Carry))
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
|
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -114,4 +116,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Light).name(), instance);
|
registerClass (typeid (ESM::Light).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Light::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Misc Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Light::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Misc Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,12 @@ namespace MWClass
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -55,6 +58,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -82,4 +87,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Tool).name(), instance);
|
registerClass (typeid (ESM::Tool).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Lockpick::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Lockpick Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Lockpick::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Lockpick Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,12 @@ namespace MWClass
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -53,6 +56,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -71,4 +76,28 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Miscellaneous).name(), instance);
|
registerClass (typeid (ESM::Miscellaneous).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
|
||||||
|
if (ref->base->name =="Gold")
|
||||||
|
{
|
||||||
|
return std::string("Item Gold Up");
|
||||||
|
}
|
||||||
|
return std::string("Item Misc Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
|
||||||
|
if (ref->base->name =="Gold")
|
||||||
|
{
|
||||||
|
return std::string("Item Gold Down");
|
||||||
|
}
|
||||||
|
return std::string("Item Misc Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -53,6 +56,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -71,4 +76,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Potion).name(), instance);
|
registerClass (typeid (ESM::Potion).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Potion::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Potion Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Potion::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Potion Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -54,6 +57,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -81,4 +86,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Probe).name(), instance);
|
registerClass (typeid (ESM::Probe).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Probe::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Probe Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Probe::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Probe Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,12 @@ namespace MWClass
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -53,6 +56,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -71,4 +76,14 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Repair).name(), instance);
|
registerClass (typeid (ESM::Repair).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Repair::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Repair Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Repair::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return std::string("Item Repair Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
||||||
///< Return name of the script attached to ptr
|
///< Return name of the script attached to ptr
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -54,6 +57,8 @@ namespace MWClass
|
||||||
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr, environment), 1.0, 1.0, false, true);
|
||||||
|
|
||||||
return boost::shared_ptr<MWWorld::Action> (
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
new MWWorld::ActionTake (ptr));
|
new MWWorld::ActionTake (ptr));
|
||||||
}
|
}
|
||||||
|
@ -103,7 +108,7 @@ namespace MWClass
|
||||||
return std::make_pair (slots, stack);
|
return std::make_pair (slots, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Weapon::getEuqipmentSkill (const MWWorld::Ptr& ptr,
|
int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Environment& environment) const
|
const MWWorld::Environment& environment) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
|
@ -140,4 +145,96 @@ namespace MWClass
|
||||||
|
|
||||||
registerClass (typeid (ESM::Weapon).name(), instance);
|
registerClass (typeid (ESM::Weapon).name(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Weapon::getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Weapon>();
|
||||||
|
|
||||||
|
int type = ref->base->data.type;
|
||||||
|
// Ammo
|
||||||
|
if (type == 12 || type == 13)
|
||||||
|
{
|
||||||
|
return std::string("Item Ammo Up");
|
||||||
|
}
|
||||||
|
// Bow
|
||||||
|
if (type == 9)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Bow Up");
|
||||||
|
}
|
||||||
|
// Crossbow
|
||||||
|
if (type == 10)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Crossbow Up");
|
||||||
|
}
|
||||||
|
// Longblades, One hand and Two
|
||||||
|
if (type == 1 || type == 2)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Longblade Up");
|
||||||
|
}
|
||||||
|
// Shortblade and thrown weapons
|
||||||
|
// thrown weapons may not be entirely correct
|
||||||
|
if (type == 0 || type == 11)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Shortblade Up");
|
||||||
|
}
|
||||||
|
// Spear
|
||||||
|
if (type == 6)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Spear Up");
|
||||||
|
}
|
||||||
|
// Blunts and Axes
|
||||||
|
if (type == 3 || type == 4 || type == 5 || type == 7 || type == 8)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Blunt Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string("Item Misc Up");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Weapon::getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Weapon>();
|
||||||
|
|
||||||
|
int type = ref->base->data.type;
|
||||||
|
// Ammo
|
||||||
|
if (type == 12 || type == 13)
|
||||||
|
{
|
||||||
|
return std::string("Item Ammo Down");
|
||||||
|
}
|
||||||
|
// Bow
|
||||||
|
if (type == 9)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Bow Down");
|
||||||
|
}
|
||||||
|
// Crossbow
|
||||||
|
if (type == 10)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Crossbow Down");
|
||||||
|
}
|
||||||
|
// Longblades, One hand and Two
|
||||||
|
if (type == 1 || type == 2)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Longblade Down");
|
||||||
|
}
|
||||||
|
// Shortblade and thrown weapons
|
||||||
|
// thrown weapons may not be entirely correct
|
||||||
|
if (type == 0 || type == 11)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Shortblade Down");
|
||||||
|
}
|
||||||
|
// Spear
|
||||||
|
if (type == 6)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Spear Down");
|
||||||
|
}
|
||||||
|
// Blunts and Axes
|
||||||
|
if (type == 3 || type == 4 || type == 5 || type == 7 || type == 8)
|
||||||
|
{
|
||||||
|
return std::string("Item Weapon Blunt Down");
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string("Item Misc Down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,12 +35,18 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
virtual int getEuqipmentSkill (const MWWorld::Ptr& ptr,
|
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr,
|
||||||
const MWWorld::Environment& environment) const;
|
const MWWorld::Environment& environment) const;
|
||||||
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
||||||
/// no such skill.
|
/// no such skill.
|
||||||
|
|
||||||
static void registerSelf();
|
static void registerSelf();
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the pick up sound Id
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the put down sound Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace MWGui
|
||||||
|
|
||||||
return isGood();
|
return isGood();
|
||||||
}
|
}
|
||||||
catch (const Compiler::SourceException& error)
|
catch (const Compiler::SourceException&)
|
||||||
{
|
{
|
||||||
// error has already been reported via error handler
|
// error has already been reported via error handler
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,6 @@ namespace MWRender{
|
||||||
|
|
||||||
Nif::NiTriShapeCopy& copy = *allshapesiter;
|
Nif::NiTriShapeCopy& copy = *allshapesiter;
|
||||||
std::vector<Ogre::Vector3>* allvertices = ©.vertices;
|
std::vector<Ogre::Vector3>* allvertices = ©.vertices;
|
||||||
std::vector<Ogre::Vector3>* allnormals = ©.normals;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,7 +181,6 @@ namespace MWRender{
|
||||||
std::vector<Nif::NiSkinData::IndividualWeight> inds = iter->second;
|
std::vector<Nif::NiSkinData::IndividualWeight> inds = iter->second;
|
||||||
int verIndex = iter->first;
|
int verIndex = iter->first;
|
||||||
Ogre::Vector3 currentVertex = (*allvertices)[verIndex];
|
Ogre::Vector3 currentVertex = (*allvertices)[verIndex];
|
||||||
Ogre::Vector3 currentNormal = (*allnormals)[verIndex];
|
|
||||||
Nif::NiSkinData::BoneInfoCopy* boneinfocopy = &(allshapesiter->boneinfo[inds[0].boneinfocopyindex]);
|
Nif::NiSkinData::BoneInfoCopy* boneinfocopy = &(allshapesiter->boneinfo[inds[0].boneinfocopyindex]);
|
||||||
Ogre::Bone *bonePtr = 0;
|
Ogre::Bone *bonePtr = 0;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Animation{
|
||||||
void stopScript();
|
void stopScript();
|
||||||
|
|
||||||
|
|
||||||
~Animation();
|
virtual ~Animation();
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MWRender{
|
||||||
class CreatureAnimation: public Animation{
|
class CreatureAnimation: public Animation{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~CreatureAnimation();
|
virtual ~CreatureAnimation();
|
||||||
CreatureAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend);
|
CreatureAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend);
|
||||||
virtual void runAnimation(float timepassed);
|
virtual void runAnimation(float timepassed);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class NpcAnimation: public Animation{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend);
|
NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend);
|
||||||
~NpcAnimation();
|
virtual ~NpcAnimation();
|
||||||
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
||||||
void insertFreePart(const std::string &mesh, const std::string suffix, Ogre::SceneNode* insert);
|
void insertFreePart(const std::string &mesh, const std::string suffix, Ogre::SceneNode* insert);
|
||||||
virtual void runAnimation(float timepassed);
|
virtual void runAnimation(float timepassed);
|
||||||
|
|
|
@ -215,8 +215,13 @@ void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell)
|
||||||
void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour)
|
void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour)
|
||||||
{
|
{
|
||||||
/// \todo make the viewing distance and fog start/end configurable
|
/// \todo make the viewing distance and fog start/end configurable
|
||||||
float low = 3000 / density;
|
|
||||||
float high = 6200 / density;
|
// right now we load 3x3 cells, so the maximum viewing distance we
|
||||||
|
// can allow (to prevent objects suddenly popping up) equals:
|
||||||
|
// 8192 * 0.69
|
||||||
|
// ^ cell size ^ minimum density value used (clear weather)
|
||||||
|
float low = 5652.48 / density / 2.f;
|
||||||
|
float high = 5652.48 / density;
|
||||||
|
|
||||||
mRendering.getScene()->setFog (FOG_LINEAR, colour, 0, low, high);
|
mRendering.getScene()->setFog (FOG_LINEAR, colour, 0, low, high);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,8 @@ void BillboardObject::setPosition(const Vector3& pPosition)
|
||||||
|
|
||||||
Vector3 BillboardObject::getPosition() const
|
Vector3 BillboardObject::getPosition() const
|
||||||
{
|
{
|
||||||
return mNode->getPosition();
|
Vector3 p = mNode->_getDerivedPosition() - mNode->getParentSceneNode()->_getDerivedPosition();
|
||||||
|
return Vector3(p.x, -p.z, p.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BillboardObject::setColour(const ColourValue& pColour)
|
void BillboardObject::setColour(const ColourValue& pColour)
|
||||||
|
@ -161,14 +162,20 @@ Moon::Moon( const String& textureName,
|
||||||
" in float2 uv : TEXCOORD0, \n"
|
" in float2 uv : TEXCOORD0, \n"
|
||||||
" out float4 oColor : COLOR, \n"
|
" out float4 oColor : COLOR, \n"
|
||||||
" uniform sampler2D texture : TEXUNIT0, \n"
|
" uniform sampler2D texture : TEXUNIT0, \n"
|
||||||
|
" uniform float4 skyColour, \n"
|
||||||
" uniform float4 diffuse, \n"
|
" uniform float4 diffuse, \n"
|
||||||
" uniform float4 emissive \n"
|
" uniform float4 emissive \n"
|
||||||
") \n"
|
") \n"
|
||||||
"{ \n"
|
"{ \n"
|
||||||
" float4 tex = tex2D(texture, uv); \n"
|
" float4 tex = tex2D(texture, uv); \n"
|
||||||
" oColor = float4(emissive.xyz,1) * tex2D(texture, uv) * float4(1,1,1,diffuse.a); \n"
|
" oColor = float4(emissive.xyz,1) * tex; \n"
|
||||||
" float bump = pow((1-diffuse.a),4); \n"
|
// use a circle for the alpha (compute UV distance to center)
|
||||||
" oColor.rgb += float3(bump, bump, bump)*0.5; \n"
|
// looks a bit bad because its not filtered on the edges,
|
||||||
|
// but it's cheaper than a seperate alpha texture.
|
||||||
|
" float sqrUVdist = pow(uv.x-0.5,2) + pow(uv.y-0.5, 2); \n"
|
||||||
|
" oColor.a = diffuse.a * (sqrUVdist >= 0.24 ? 0 : 1); \n"
|
||||||
|
" oColor.rgb += (1-tex.a) * oColor.a * skyColour.rgb; \n"//fill dark side of moon with skycolour
|
||||||
|
" oColor.rgb += (1-diffuse.a) * skyColour.rgb; \n"//fade bump
|
||||||
"}";
|
"}";
|
||||||
fshader->setSource(outStream2.str());
|
fshader->setSource(outStream2.str());
|
||||||
fshader->load();
|
fshader->load();
|
||||||
|
@ -186,10 +193,14 @@ void Moon::setType(const Moon::Type& type)
|
||||||
mType = type;
|
mType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Moon::setSkyColour(const Ogre::ColourValue& colour)
|
||||||
|
{
|
||||||
|
mMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("skyColour", colour);
|
||||||
|
}
|
||||||
|
|
||||||
/// \todo the moon phase rendering is not correct - the dark part of the moon does not occlude the stars
|
|
||||||
void Moon::setPhase(const Moon::Phase& phase)
|
void Moon::setPhase(const Moon::Phase& phase)
|
||||||
{
|
{
|
||||||
|
// Colour texture
|
||||||
Ogre::String textureName = "textures\\tx_";
|
Ogre::String textureName = "textures\\tx_";
|
||||||
|
|
||||||
if (mType == Moon::Type_Secunda) textureName += "secunda_";
|
if (mType == Moon::Type_Secunda) textureName += "secunda_";
|
||||||
|
@ -338,24 +349,11 @@ SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) :
|
||||||
mAtmosphereNight = mRootNode->createChildSceneNode();
|
mAtmosphereNight = mRootNode->createChildSceneNode();
|
||||||
mAtmosphereNight->attachObject(night1_ent);
|
mAtmosphereNight->attachObject(night1_ent);
|
||||||
|
|
||||||
for (unsigned int i=0; i<night1_ent->getNumSubEntities(); ++i)
|
|
||||||
{
|
|
||||||
MaterialPtr mp = night1_ent->getSubEntity(i)->getMaterial();
|
|
||||||
mp->getTechnique(0)->getPass(0)->setSelfIllumination(1.0, 1.0, 1.0);
|
|
||||||
mp->getTechnique(0)->getPass(0)->setAmbient(0.0, 0.0, 0.0);
|
|
||||||
mp->getTechnique(0)->getPass(0)->setDiffuse(0.0, 0.0, 0.0, 1.0);
|
|
||||||
mp->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
|
|
||||||
mp->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
|
|
||||||
mp->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
|
|
||||||
|
|
||||||
mStarsMaterials[i] = mp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stars vertex shader
|
// Stars vertex shader
|
||||||
HighLevelGpuProgramPtr vshader3 = mgr.createProgram("Stars_VP", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
HighLevelGpuProgramPtr stars_vp = mgr.createProgram("Stars_VP", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
||||||
"cg", GPT_VERTEX_PROGRAM);
|
"cg", GPT_VERTEX_PROGRAM);
|
||||||
vshader3->setParameter("profiles", "vs_2_x arbvp1");
|
stars_vp->setParameter("profiles", "vs_2_x arbvp1");
|
||||||
vshader3->setParameter("entry_point", "main_vp");
|
stars_vp->setParameter("entry_point", "main_vp");
|
||||||
StringUtil::StrStreamType outStream4;
|
StringUtil::StrStreamType outStream4;
|
||||||
outStream4 <<
|
outStream4 <<
|
||||||
"void main_vp( \n"
|
"void main_vp( \n"
|
||||||
|
@ -371,10 +369,9 @@ SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) :
|
||||||
" oFade = (position.z > 50) ? 1.f : 0.f; \n"
|
" oFade = (position.z > 50) ? 1.f : 0.f; \n"
|
||||||
" oPosition = mul( worldViewProj, position ); \n"
|
" oPosition = mul( worldViewProj, position ); \n"
|
||||||
"}";
|
"}";
|
||||||
vshader3->setSource(outStream4.str());
|
stars_vp->setSource(outStream4.str());
|
||||||
vshader3->load();
|
stars_vp->load();
|
||||||
vshader3->getDefaultParameters()->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
|
stars_vp->getDefaultParameters()->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
|
||||||
night1_ent->getSubEntity(3)->getMaterial()->getTechnique(0)->getPass(0)->setVertexProgram(vshader3->getName());
|
|
||||||
|
|
||||||
// Stars fragment shader
|
// Stars fragment shader
|
||||||
HighLevelGpuProgramPtr stars_fp = mgr.createProgram("Stars_FP", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
HighLevelGpuProgramPtr stars_fp = mgr.createProgram("Stars_FP", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
||||||
|
@ -399,7 +396,20 @@ SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) :
|
||||||
stars_fp->load();
|
stars_fp->load();
|
||||||
stars_fp->getDefaultParameters()->setNamedAutoConstant("emissive", GpuProgramParameters::ACT_SURFACE_EMISSIVE_COLOUR);
|
stars_fp->getDefaultParameters()->setNamedAutoConstant("emissive", GpuProgramParameters::ACT_SURFACE_EMISSIVE_COLOUR);
|
||||||
stars_fp->getDefaultParameters()->setNamedAutoConstant("diffuse", GpuProgramParameters::ACT_SURFACE_DIFFUSE_COLOUR);
|
stars_fp->getDefaultParameters()->setNamedAutoConstant("diffuse", GpuProgramParameters::ACT_SURFACE_DIFFUSE_COLOUR);
|
||||||
night1_ent->getSubEntity(3)->getMaterial()->getTechnique(0)->getPass(0)->setFragmentProgram(stars_fp->getName());
|
|
||||||
|
for (unsigned int i=0; i<night1_ent->getNumSubEntities(); ++i)
|
||||||
|
{
|
||||||
|
MaterialPtr mp = night1_ent->getSubEntity(i)->getMaterial();
|
||||||
|
mp->getTechnique(0)->getPass(0)->setSelfIllumination(1.0, 1.0, 1.0);
|
||||||
|
mp->getTechnique(0)->getPass(0)->setAmbient(0.0, 0.0, 0.0);
|
||||||
|
mp->getTechnique(0)->getPass(0)->setDiffuse(0.0, 0.0, 0.0, 1.0);
|
||||||
|
mp->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
|
||||||
|
mp->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
|
||||||
|
mp->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
|
||||||
|
mp->getTechnique(0)->getPass(0)->setVertexProgram(stars_vp->getName());
|
||||||
|
mp->getTechnique(0)->getPass(0)->setFragmentProgram(stars_fp->getName());
|
||||||
|
mStarsMaterials[i] = mp;
|
||||||
|
}
|
||||||
|
|
||||||
// Atmosphere (day)
|
// Atmosphere (day)
|
||||||
mesh = NifOgre::NIFLoader::load("meshes\\sky_atmosphere.nif");
|
mesh = NifOgre::NIFLoader::load("meshes\\sky_atmosphere.nif");
|
||||||
|
@ -583,6 +593,9 @@ void SkyManager::update(float duration)
|
||||||
mSun->setVisible(mSunEnabled);
|
mSun->setVisible(mSunEnabled);
|
||||||
mMasser->setVisible(mMasserEnabled);
|
mMasser->setVisible(mMasserEnabled);
|
||||||
mSecunda->setVisible(mSecundaEnabled);
|
mSecunda->setVisible(mSecundaEnabled);
|
||||||
|
|
||||||
|
// rotate the whole sky by 360 degrees every 4 days
|
||||||
|
mRootNode->roll(Degree(mHourDiff*360/96.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyManager::enable()
|
void SkyManager::enable()
|
||||||
|
@ -647,6 +660,8 @@ void SkyManager::setWeather(const MWWorld::WeatherResult& weather)
|
||||||
if (mSkyColour != weather.mSkyColor)
|
if (mSkyColour != weather.mSkyColor)
|
||||||
{
|
{
|
||||||
mAtmosphereMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(weather.mSkyColor);
|
mAtmosphereMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(weather.mSkyColor);
|
||||||
|
mMasser->setSkyColour(weather.mSkyColor);
|
||||||
|
mSecunda->setSkyColour(weather.mSkyColor);
|
||||||
mSkyColour = weather.mSkyColor;
|
mSkyColour = weather.mSkyColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,6 +775,9 @@ void SkyManager::setSecundaFade(const float fade)
|
||||||
|
|
||||||
void SkyManager::setHour(double hour)
|
void SkyManager::setHour(double hour)
|
||||||
{
|
{
|
||||||
|
mHourDiff = mHour - hour;
|
||||||
|
if (mHourDiff > 0) mHourDiff -= 24;
|
||||||
|
|
||||||
mHour = hour;
|
mHour = hour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace MWRender
|
||||||
);
|
);
|
||||||
BillboardObject();
|
BillboardObject();
|
||||||
|
|
||||||
|
virtual ~BillboardObject() {}
|
||||||
|
|
||||||
void setColour(const Ogre::ColourValue& pColour);
|
void setColour(const Ogre::ColourValue& pColour);
|
||||||
void setPosition(const Ogre::Vector3& pPosition);
|
void setPosition(const Ogre::Vector3& pPosition);
|
||||||
void setVisible(const bool visible);
|
void setVisible(const bool visible);
|
||||||
|
@ -70,6 +72,8 @@ namespace MWRender
|
||||||
Ogre::SceneNode* rootNode
|
Ogre::SceneNode* rootNode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
virtual ~Moon() {}
|
||||||
|
|
||||||
enum Phase
|
enum Phase
|
||||||
{
|
{
|
||||||
Phase_New = 0,
|
Phase_New = 0,
|
||||||
|
@ -90,6 +94,7 @@ namespace MWRender
|
||||||
|
|
||||||
void setPhase(const Phase& phase);
|
void setPhase(const Phase& phase);
|
||||||
void setType(const Type& type);
|
void setType(const Type& type);
|
||||||
|
void setSkyColour(const Ogre::ColourValue& colour);
|
||||||
|
|
||||||
Phase getPhase() const;
|
Phase getPhase() const;
|
||||||
unsigned int getPhaseInt() const;
|
unsigned int getPhaseInt() const;
|
||||||
|
@ -163,6 +168,8 @@ namespace MWRender
|
||||||
int mDay;
|
int mDay;
|
||||||
int mMonth;
|
int mMonth;
|
||||||
|
|
||||||
|
float mHourDiff;
|
||||||
|
|
||||||
BillboardObject* mSun;
|
BillboardObject* mSun;
|
||||||
BillboardObject* mSunGlare;
|
BillboardObject* mSunGlare;
|
||||||
Moon* mMasser;
|
Moon* mMasser;
|
||||||
|
|
|
@ -136,7 +136,7 @@ namespace MWSound
|
||||||
max = std::max(min, max);
|
max = std::max(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Files::FileListLocator(mSoundFiles, snd->sound, mFSStrict);
|
return Files::FileListLocator(mSoundFiles, snd->sound, mFSStrict, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a sound to the list and play it
|
// Add a sound to the list and play it
|
||||||
|
@ -145,7 +145,7 @@ namespace MWSound
|
||||||
const std::string &id,
|
const std::string &id,
|
||||||
float volume, float pitch,
|
float volume, float pitch,
|
||||||
float min, float max,
|
float min, float max,
|
||||||
bool loop)
|
bool loop, bool untracked)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,10 @@ namespace MWSound
|
||||||
setPos(snd, ptr);
|
setPos(snd, ptr);
|
||||||
snd->play();
|
snd->play();
|
||||||
|
|
||||||
sounds[ptr][id] = WSoundPtr(snd);
|
if (!untracked)
|
||||||
|
{
|
||||||
|
sounds[ptr][id] = WSoundPtr(snd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
@ -290,7 +293,7 @@ namespace MWSound
|
||||||
|
|
||||||
void SoundManager::streamMusic(const std::string& filename)
|
void SoundManager::streamMusic(const std::string& filename)
|
||||||
{
|
{
|
||||||
std::string filePath = mMusicLibrary.locate(filename, mFSStrict).string();
|
std::string filePath = mMusicLibrary.locate(filename, mFSStrict, true).string();
|
||||||
if(!filePath.empty())
|
if(!filePath.empty())
|
||||||
{
|
{
|
||||||
streamMusicFull(filePath);
|
streamMusicFull(filePath);
|
||||||
|
@ -373,7 +376,7 @@ namespace MWSound
|
||||||
void SoundManager::say (MWWorld::Ptr ptr, const std::string& filename)
|
void SoundManager::say (MWWorld::Ptr ptr, const std::string& filename)
|
||||||
{
|
{
|
||||||
// The range values are not tested
|
// The range values are not tested
|
||||||
std::string filePath = Files::FileListLocator(mSoundFiles, filename, mFSStrict);
|
std::string filePath = Files::FileListLocator(mSoundFiles, filename, mFSStrict, true);
|
||||||
if(!filePath.empty())
|
if(!filePath.empty())
|
||||||
add(filePath, ptr, "_say_sound", 1, 1, 100, 20000, false);
|
add(filePath, ptr, "_say_sound", 1, 1, 100, 20000, false);
|
||||||
else
|
else
|
||||||
|
@ -397,6 +400,7 @@ namespace MWSound
|
||||||
snd->setVolume(volume);
|
snd->setVolume(volume);
|
||||||
snd->setRange(min,max);
|
snd->setRange(min,max);
|
||||||
snd->setPitch(pitch);
|
snd->setPitch(pitch);
|
||||||
|
snd->setRelative(true);
|
||||||
snd->play();
|
snd->play();
|
||||||
|
|
||||||
if (loop)
|
if (loop)
|
||||||
|
@ -412,13 +416,13 @@ namespace MWSound
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::playSound3D (MWWorld::Ptr ptr, const std::string& soundId,
|
void SoundManager::playSound3D (MWWorld::Ptr ptr, const std::string& soundId,
|
||||||
float volume, float pitch, bool loop)
|
float volume, float pitch, bool loop, bool untracked)
|
||||||
{
|
{
|
||||||
// Look up the sound in the ESM data
|
// Look up the sound in the ESM data
|
||||||
float min, max;
|
float min, max;
|
||||||
const std::string &file = lookup(soundId, volume, min, max);
|
const std::string &file = lookup(soundId, volume, min, max);
|
||||||
if (file != "")
|
if (file != "")
|
||||||
add(file, ptr, soundId, volume, pitch, min, max, loop);
|
add(file, ptr, soundId, volume, pitch, min, max, loop, untracked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::stopSound3D (MWWorld::Ptr ptr, const std::string& soundId)
|
void SoundManager::stopSound3D (MWWorld::Ptr ptr, const std::string& soundId)
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace MWSound
|
||||||
void add(const std::string &file,
|
void add(const std::string &file,
|
||||||
MWWorld::Ptr ptr, const std::string &id,
|
MWWorld::Ptr ptr, const std::string &id,
|
||||||
float volume, float pitch, float min, float max,
|
float volume, float pitch, float min, float max,
|
||||||
bool loop);
|
bool loop, bool untracked=false);
|
||||||
void clearAll(PtrMap::iterator& it);
|
void clearAll(PtrMap::iterator& it);
|
||||||
void remove(MWWorld::Ptr ptr, const std::string &id = "");
|
void remove(MWWorld::Ptr ptr, const std::string &id = "");
|
||||||
bool isPlaying(MWWorld::Ptr ptr, const std::string &id) const;
|
bool isPlaying(MWWorld::Ptr ptr, const std::string &id) const;
|
||||||
|
@ -136,7 +136,7 @@ namespace MWSound
|
||||||
///< Play a sound, independently of 3D-position
|
///< Play a sound, independently of 3D-position
|
||||||
|
|
||||||
void playSound3D (MWWorld::Ptr reference, const std::string& soundId,
|
void playSound3D (MWWorld::Ptr reference, const std::string& soundId,
|
||||||
float volume, float pitch, bool loop);
|
float volume, float pitch, bool loop, bool untracked=false);
|
||||||
///< Play a sound from an object
|
///< Play a sound from an object
|
||||||
|
|
||||||
void stopSound3D (MWWorld::Ptr reference, const std::string& soundId = "");
|
void stopSound3D (MWWorld::Ptr reference, const std::string& soundId = "");
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace MWWorld
|
||||||
return std::make_pair (std::vector<int>(), false);
|
return std::make_pair (std::vector<int>(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Class::getEuqipmentSkill (const Ptr& ptr, const Environment& environment) const
|
int Class::getEquipmentSkill (const Ptr& ptr, const Environment& environment) const
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -156,4 +156,14 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
sClasses.insert (std::make_pair (key, instance));
|
sClasses.insert (std::make_pair (key, instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Class::getUpSoundId (const Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
throw std::runtime_error ("class does not have an up sound");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Class::getDownSoundId (const Ptr& ptr, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
throw std::runtime_error ("class does not have an down sound");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace MWWorld
|
||||||
///
|
///
|
||||||
/// Default implementation: return (empty vector, false).
|
/// Default implementation: return (empty vector, false).
|
||||||
|
|
||||||
virtual int getEuqipmentSkill (const Ptr& ptr, const Environment& environment)
|
virtual int getEquipmentSkill (const Ptr& ptr, const Environment& environment)
|
||||||
const;
|
const;
|
||||||
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
|
||||||
/// no such skill.
|
/// no such skill.
|
||||||
|
@ -162,6 +162,14 @@ namespace MWWorld
|
||||||
///< If there is no class for this pointer, an exception is thrown.
|
///< If there is no class for this pointer, an exception is thrown.
|
||||||
|
|
||||||
static void registerClass (const std::string& key, boost::shared_ptr<Class> instance);
|
static void registerClass (const std::string& key, boost::shared_ptr<Class> instance);
|
||||||
|
|
||||||
|
virtual std::string getUpSoundId (const Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the up sound ID of \a ptr or throw an exception, if class does not support ID retrieval
|
||||||
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
|
virtual std::string getDownSoundId (const Ptr& ptr, const MWWorld::Environment& environment) const;
|
||||||
|
///< Return the down sound ID of \a ptr or throw an exception, if class does not support ID retrieval
|
||||||
|
/// (default implementation: throw an exception)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,10 @@ WeatherResult WeatherManager::transition(float factor)
|
||||||
void WeatherManager::update(float duration)
|
void WeatherManager::update(float duration)
|
||||||
{
|
{
|
||||||
mWeatherUpdateTime -= duration;
|
mWeatherUpdateTime -= duration;
|
||||||
if (mEnvironment->mWorld->isCellExterior() || mEnvironment->mWorld->isCellQuasiExterior())
|
|
||||||
|
bool exterior = (mEnvironment->mWorld->isCellExterior() || mEnvironment->mWorld->isCellQuasiExterior());
|
||||||
|
|
||||||
|
if (exterior)
|
||||||
{
|
{
|
||||||
std::string regionstr = mEnvironment->mWorld->getPlayer().getPlayer().getCell()->cell->region;
|
std::string regionstr = mEnvironment->mWorld->getPlayer().getPlayer().getCell()->cell->region;
|
||||||
boost::algorithm::to_lower(regionstr);
|
boost::algorithm::to_lower(regionstr);
|
||||||
|
@ -663,7 +666,7 @@ void WeatherManager::update(float duration)
|
||||||
mRendering->getSkyManager()->secundaDisable();
|
mRendering->getSkyManager()->secundaDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCurrentWeather == "thunderstorm" && mNextWeather == "")
|
if (mCurrentWeather == "thunderstorm" && mNextWeather == "" && exterior)
|
||||||
{
|
{
|
||||||
if (mThunderFlash > 0)
|
if (mThunderFlash > 0)
|
||||||
{
|
{
|
||||||
|
@ -725,6 +728,7 @@ void WeatherManager::update(float duration)
|
||||||
|
|
||||||
// play sounds
|
// play sounds
|
||||||
std::string ambientSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mAmbientLoopSoundID : "");
|
std::string ambientSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mAmbientLoopSoundID : "");
|
||||||
|
if (!exterior) ambientSnd = "";
|
||||||
if (ambientSnd != "")
|
if (ambientSnd != "")
|
||||||
{
|
{
|
||||||
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), ambientSnd) == mSoundsPlaying.end())
|
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), ambientSnd) == mSoundsPlaying.end())
|
||||||
|
@ -735,6 +739,7 @@ void WeatherManager::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rainSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mRainLoopSoundID : "");
|
std::string rainSnd = (mNextWeather == "" ? mWeatherSettings[mCurrentWeather].mRainLoopSoundID : "");
|
||||||
|
if (!exterior) rainSnd = "";
|
||||||
if (rainSnd != "")
|
if (rainSnd != "")
|
||||||
{
|
{
|
||||||
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), rainSnd) == mSoundsPlaying.end())
|
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), rainSnd) == mSoundsPlaying.end())
|
||||||
|
|
|
@ -95,8 +95,6 @@ namespace Compiler
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ControlParser::parseWhileBody (int keyword, const TokenLoc& loc, Scanner& scanner)
|
bool ControlParser::parseWhileBody (int keyword, const TokenLoc& loc, Scanner& scanner)
|
||||||
|
@ -108,7 +106,7 @@ namespace Compiler
|
||||||
Codes expr;
|
Codes expr;
|
||||||
mExprParser.append (expr);
|
mExprParser.append (expr);
|
||||||
|
|
||||||
Generator::jump (loop, -mCodeBlock.size()-expr.size());
|
Generator::jump (loop, -static_cast<int> (mCodeBlock.size()-expr.size()));
|
||||||
|
|
||||||
std::copy (expr.begin(), expr.end(), std::back_inserter (mCode));
|
std::copy (expr.begin(), expr.end(), std::back_inserter (mCode));
|
||||||
|
|
||||||
|
@ -122,7 +120,7 @@ namespace Compiler
|
||||||
|
|
||||||
Codes loop2;
|
Codes loop2;
|
||||||
|
|
||||||
Generator::jump (loop2, -mCodeBlock.size()-expr.size()-skip.size());
|
Generator::jump (loop2, -static_cast<int> (mCodeBlock.size()-expr.size()-skip.size()));
|
||||||
|
|
||||||
if (loop.size()!=loop2.size())
|
if (loop.size()!=loop2.size())
|
||||||
throw std::logic_error (
|
throw std::logic_error (
|
||||||
|
@ -153,8 +151,6 @@ namespace Compiler
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlParser::ControlParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
|
ControlParser::ControlParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
|
||||||
|
|
|
@ -3,32 +3,68 @@
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
|
||||||
void PathGrid::load(ESMReader &esm)
|
void Pathgrid::load(ESMReader &esm)
|
||||||
{
|
{
|
||||||
esm.getHNT(data, "DATA", 12);
|
esm.getHNT(data, "DATA", 12);
|
||||||
cell = esm.getHNString("NAME");
|
cell = esm.getHNString("NAME");
|
||||||
|
|
||||||
// Remember this file position
|
// keep track of total connections so we can reserve edge vector size
|
||||||
context = esm.getContext();
|
int edgeCount = 0;
|
||||||
|
|
||||||
// Check that the sizes match up. Size = 16 * s2 (path points?)
|
|
||||||
if (esm.isNextSub("PGRP"))
|
if (esm.isNextSub("PGRP"))
|
||||||
{
|
{
|
||||||
esm.skipHSub();
|
esm.getSubHeader();
|
||||||
int size = esm.getSubSize();
|
int size = esm.getSubSize();
|
||||||
if (size != 16 * data.s2)
|
// Check that the sizes match up. Size = 16 * s2 (path points)
|
||||||
esm.fail("Path grid table size mismatch");
|
if (size != static_cast<int> (sizeof(Point) * data.s2))
|
||||||
|
esm.fail("Path point subrecord size mismatch");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int pointCount = data.s2;
|
||||||
|
points.reserve(pointCount);
|
||||||
|
for (int i = 0; i < pointCount; ++i)
|
||||||
|
{
|
||||||
|
Point p;
|
||||||
|
esm.getExact(&p, sizeof(Point));
|
||||||
|
points.push_back(p);
|
||||||
|
edgeCount += p.connectionNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size varies. Path grid chances? Connections? Multiples of 4
|
|
||||||
// suggest either int or two shorts, or perhaps a float. Study
|
|
||||||
// it later.
|
|
||||||
if (esm.isNextSub("PGRC"))
|
if (esm.isNextSub("PGRC"))
|
||||||
{
|
{
|
||||||
esm.skipHSub();
|
esm.getSubHeader();
|
||||||
int size = esm.getSubSize();
|
int size = esm.getSubSize();
|
||||||
if (size % 4 != 0)
|
if (size % sizeof(int) != 0)
|
||||||
esm.fail("PGRC size not a multiple of 4");
|
esm.fail("PGRC size not a multiple of 4");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int rawConnNum = size / sizeof(int);
|
||||||
|
std::vector<int> rawConnections;
|
||||||
|
rawConnections.reserve(rawConnNum);
|
||||||
|
for (int i = 0; i < rawConnNum; ++i)
|
||||||
|
{
|
||||||
|
int currentValue;
|
||||||
|
esm.getT(currentValue);
|
||||||
|
rawConnections.push_back(currentValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int>::const_iterator rawIt = rawConnections.begin();
|
||||||
|
int pointIndex = 0;
|
||||||
|
edges.reserve(edgeCount);
|
||||||
|
for(PointList::const_iterator it = points.begin(); it != points.end(); it++, pointIndex++)
|
||||||
|
{
|
||||||
|
unsigned char connectionNum = (*it).connectionNum;
|
||||||
|
for (int i = 0; i < connectionNum; ++i) {
|
||||||
|
Edge edge;
|
||||||
|
edge.v0 = pointIndex;
|
||||||
|
edge.v1 = *rawIt;
|
||||||
|
rawIt++;
|
||||||
|
edges.push_back(edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,37 @@ namespace ESM
|
||||||
/*
|
/*
|
||||||
* Path grid.
|
* Path grid.
|
||||||
*/
|
*/
|
||||||
struct PathGrid
|
struct Pathgrid
|
||||||
{
|
{
|
||||||
struct DATAstruct
|
struct DATAstruct
|
||||||
{
|
{
|
||||||
int x, y; // Grid location, matches cell for exterior cells
|
int x, y; // Grid location, matches cell for exterior cells
|
||||||
short s1; // ?? Usually but not always a power of 2. Doesn't seem
|
short s1; // ?? Usually but not always a power of 2. Doesn't seem
|
||||||
// to have any relation to the size of PGRC.
|
// to have any relation to the size of PGRC.
|
||||||
short s2; // Number of path points? Size of PGRP block is always 16 * s2;
|
short s2; // Number of path points.
|
||||||
}; // 12 bytes
|
}; // 12 bytes
|
||||||
|
|
||||||
|
struct Point // path grid point
|
||||||
|
{
|
||||||
|
int x, y, z; // Location of point
|
||||||
|
unsigned char autogenerated; // autogenerated vs. user coloring flag?
|
||||||
|
unsigned char connectionNum; // number of connections for this point
|
||||||
|
short unknown;
|
||||||
|
}; // 16 bytes
|
||||||
|
|
||||||
|
struct Edge // path grid edge
|
||||||
|
{
|
||||||
|
int v0, v1; // index of points connected with this edge
|
||||||
|
}; // 8 bytes
|
||||||
|
|
||||||
std::string cell; // Cell name
|
std::string cell; // Cell name
|
||||||
DATAstruct data;
|
DATAstruct data;
|
||||||
ESM_Context context; // Context so we can return here later and
|
|
||||||
// finish the job
|
typedef std::vector<Point> PointList;
|
||||||
|
PointList points;
|
||||||
|
|
||||||
|
typedef std::vector<Edge> EdgeList;
|
||||||
|
EdgeList edges;
|
||||||
|
|
||||||
void load(ESMReader &esm);
|
void load(ESMReader &esm);
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace ESMS
|
||||||
|
|
||||||
struct RecList
|
struct RecList
|
||||||
{
|
{
|
||||||
|
virtual ~RecList() {}
|
||||||
|
|
||||||
virtual void load(ESMReader &esm, const std::string &id) = 0;
|
virtual void load(ESMReader &esm, const std::string &id) = 0;
|
||||||
virtual int getSize() = 0;
|
virtual int getSize() = 0;
|
||||||
virtual void listIdentifier (std::vector<std::string>& identifier) const = 0;
|
virtual void listIdentifier (std::vector<std::string>& identifier) const = 0;
|
||||||
|
@ -42,6 +44,8 @@ namespace ESMS
|
||||||
template <typename X>
|
template <typename X>
|
||||||
struct RecListT : RecList
|
struct RecListT : RecList
|
||||||
{
|
{
|
||||||
|
virtual ~RecListT() {}
|
||||||
|
|
||||||
typedef std::map<std::string,X> MapType;
|
typedef std::map<std::string,X> MapType;
|
||||||
|
|
||||||
MapType list;
|
MapType list;
|
||||||
|
@ -90,6 +94,8 @@ namespace ESMS
|
||||||
template <typename X>
|
template <typename X>
|
||||||
struct RecListWithIDT : RecList
|
struct RecListWithIDT : RecList
|
||||||
{
|
{
|
||||||
|
virtual ~RecListWithIDT() {}
|
||||||
|
|
||||||
typedef std::map<std::string,X> MapType;
|
typedef std::map<std::string,X> MapType;
|
||||||
|
|
||||||
MapType list;
|
MapType list;
|
||||||
|
@ -139,6 +145,8 @@ namespace ESMS
|
||||||
template <typename X>
|
template <typename X>
|
||||||
struct RecIDListT : RecList
|
struct RecIDListT : RecList
|
||||||
{
|
{
|
||||||
|
virtual ~RecIDListT() {}
|
||||||
|
|
||||||
typedef std::map<std::string,X> MapType;
|
typedef std::map<std::string,X> MapType;
|
||||||
|
|
||||||
MapType list;
|
MapType list;
|
||||||
|
@ -189,6 +197,8 @@ namespace ESMS
|
||||||
*/
|
*/
|
||||||
struct LTexList : RecList
|
struct LTexList : RecList
|
||||||
{
|
{
|
||||||
|
virtual ~LTexList() {}
|
||||||
|
|
||||||
// TODO: For multiple ESM/ESP files we need one list per file.
|
// TODO: For multiple ESM/ESP files we need one list per file.
|
||||||
std::vector<LandTexture> ltex;
|
std::vector<LandTexture> ltex;
|
||||||
int count;
|
int count;
|
||||||
|
@ -223,6 +233,8 @@ namespace ESMS
|
||||||
*/
|
*/
|
||||||
struct LandList : RecList
|
struct LandList : RecList
|
||||||
{
|
{
|
||||||
|
virtual ~LandList() {}
|
||||||
|
|
||||||
// Map containing all landscapes
|
// Map containing all landscapes
|
||||||
typedef std::map<int, Land*> LandsCol;
|
typedef std::map<int, Land*> LandsCol;
|
||||||
typedef std::map<int, LandsCol> Lands;
|
typedef std::map<int, LandsCol> Lands;
|
||||||
|
@ -296,7 +308,7 @@ namespace ESMS
|
||||||
identifier.push_back (iter->first);
|
identifier.push_back (iter->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
~CellList()
|
virtual ~CellList()
|
||||||
{
|
{
|
||||||
for (IntCells::iterator it = intCells.begin(); it!=intCells.end(); ++it)
|
for (IntCells::iterator it = intCells.begin(); it!=intCells.end(); ++it)
|
||||||
delete it->second;
|
delete it->second;
|
||||||
|
@ -390,9 +402,100 @@ namespace ESMS
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PathgridList : RecList
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
|
||||||
|
// List of grids for interior cells. Indexed by cell name.
|
||||||
|
typedef std::map<std::string,ESM::Pathgrid*, ciLessBoost> IntGrids;
|
||||||
|
IntGrids intGrids;
|
||||||
|
|
||||||
|
// List of grids for exterior cells. Indexed as extCells[gridX][gridY].
|
||||||
|
typedef std::map<std::pair<int, int>, ESM::Pathgrid*> ExtGrids;
|
||||||
|
ExtGrids extGrids;
|
||||||
|
|
||||||
|
PathgridList() : count(0) {}
|
||||||
|
|
||||||
|
virtual ~PathgridList()
|
||||||
|
{
|
||||||
|
for (IntGrids::iterator it = intGrids.begin(); it!=intGrids.end(); ++it)
|
||||||
|
delete it->second;
|
||||||
|
|
||||||
|
for (ExtGrids::iterator it = extGrids.begin(); it!=extGrids.end(); ++it)
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSize() { return count; }
|
||||||
|
|
||||||
|
virtual void listIdentifier (std::vector<std::string>& identifier) const
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(ESMReader &esm, const std::string &id)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
ESM::Pathgrid *grid = new ESM::Pathgrid;
|
||||||
|
grid->load(esm);
|
||||||
|
if (grid->data.x == 0 && grid->data.y == 0)
|
||||||
|
{
|
||||||
|
intGrids[grid->cell] = grid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extGrids[std::make_pair(grid->data.x, grid->data.y)] = grid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pathgrid *find(int cellX, int cellY, std::string cellName) const
|
||||||
|
{
|
||||||
|
Pathgrid *result = search(cellX, cellY, cellName);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("no pathgrid found for cell " + cellName);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pathgrid *search(int cellX, int cellY, std::string cellName) const
|
||||||
|
{
|
||||||
|
Pathgrid *result = NULL;
|
||||||
|
if (cellX == 0 && cellY == 0) // possibly interior
|
||||||
|
{
|
||||||
|
IntGrids::const_iterator it = intGrids.find(cellName);
|
||||||
|
if (it != intGrids.end())
|
||||||
|
result = it->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExtGrids::const_iterator it = extGrids.find(std::make_pair(cellX, cellY));
|
||||||
|
if (it != extGrids.end())
|
||||||
|
result = it->second;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pathgrid *search(const ESM::Cell &cell) const
|
||||||
|
{
|
||||||
|
int cellX, cellY;
|
||||||
|
if (cell.data.flags & ESM::Cell::Interior)
|
||||||
|
{
|
||||||
|
cellX = cellY = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cellX = cell.data.gridX;
|
||||||
|
cellY = cell.data.gridY;
|
||||||
|
}
|
||||||
|
return search(cellX, cellY, cell.name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <typename X>
|
template <typename X>
|
||||||
struct ScriptListT : RecList
|
struct ScriptListT : RecList
|
||||||
{
|
{
|
||||||
|
virtual ~ScriptListT() {}
|
||||||
|
|
||||||
typedef std::map<std::string,X> MapType;
|
typedef std::map<std::string,X> MapType;
|
||||||
|
|
||||||
MapType list;
|
MapType list;
|
||||||
|
@ -444,6 +547,8 @@ namespace ESMS
|
||||||
template <typename X>
|
template <typename X>
|
||||||
struct IndexListT
|
struct IndexListT
|
||||||
{
|
{
|
||||||
|
virtual ~IndexListT() {}
|
||||||
|
|
||||||
typedef std::map<int, X> MapType;
|
typedef std::map<int, X> MapType;
|
||||||
|
|
||||||
MapType list;
|
MapType list;
|
||||||
|
|
|
@ -74,7 +74,8 @@ namespace ESMS
|
||||||
ScriptListT<Script> scripts;
|
ScriptListT<Script> scripts;
|
||||||
IndexListT<MagicEffect> magicEffects;
|
IndexListT<MagicEffect> magicEffects;
|
||||||
IndexListT<Skill> skills;
|
IndexListT<Skill> skills;
|
||||||
//RecListT<PathGrid> pathgrids;
|
//RecListT<Pathgrid> pathgrids;
|
||||||
|
PathgridList pathgrids;
|
||||||
|
|
||||||
// Special entry which is hardcoded and not loaded from an ESM
|
// Special entry which is hardcoded and not loaded from an ESM
|
||||||
IndexListT<Attribute> attributes;
|
IndexListT<Attribute> attributes;
|
||||||
|
@ -124,7 +125,7 @@ namespace ESMS
|
||||||
recLists[REC_MISC] = &miscItems;
|
recLists[REC_MISC] = &miscItems;
|
||||||
recLists[REC_NPC_] = &npcs;
|
recLists[REC_NPC_] = &npcs;
|
||||||
recLists[REC_NPCC] = &npcChange;
|
recLists[REC_NPCC] = &npcChange;
|
||||||
//recLists[REC_PGRD] = &pathgrids;
|
recLists[REC_PGRD] = &pathgrids;
|
||||||
recLists[REC_PROB] = &probes;
|
recLists[REC_PROB] = &probes;
|
||||||
recLists[REC_RACE] = &races;
|
recLists[REC_RACE] = &races;
|
||||||
recLists[REC_REGN] = ®ions;
|
recLists[REC_REGN] = ®ions;
|
||||||
|
|
|
@ -89,12 +89,12 @@ namespace Files
|
||||||
}
|
}
|
||||||
|
|
||||||
// Searches the library for an item and returns a boost path to it
|
// Searches the library for an item and returns a boost path to it
|
||||||
boost::filesystem::path FileLibrary::locate(std::string item, bool strict, std::string sectionName)
|
boost::filesystem::path FileLibrary::locate(std::string item, bool strict, bool ignoreExtensions, std::string sectionName)
|
||||||
{
|
{
|
||||||
boost::filesystem::path result("");
|
boost::filesystem::path result("");
|
||||||
if (sectionName == "")
|
if (sectionName == "")
|
||||||
{
|
{
|
||||||
return FileListLocator(mPriorityList, boost::filesystem::path(item), strict);
|
return FileListLocator(mPriorityList, boost::filesystem::path(item), strict, ignoreExtensions);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ namespace Files
|
||||||
std::cout << "Warning: There is no section named " << sectionName << "\n";
|
std::cout << "Warning: There is no section named " << sectionName << "\n";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = FileListLocator(mMap[sectionName], boost::filesystem::path(item), strict);
|
result = FileListLocator(mMap[sectionName], boost::filesystem::path(item), strict, ignoreExtensions);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Files
|
||||||
/// Optionally you can provide a specific section
|
/// Optionally you can provide a specific section
|
||||||
/// The result is the first that comes up according to alphabetical
|
/// The result is the first that comes up according to alphabetical
|
||||||
/// section naming
|
/// section naming
|
||||||
boost::filesystem::path locate(std::string item, bool strict, std::string sectionName="");
|
boost::filesystem::path locate(std::string item, bool strict, bool ignoreExtensions, std::string sectionName="");
|
||||||
|
|
||||||
/// Prints all the available sections, used for debugging
|
/// Prints all the available sections, used for debugging
|
||||||
void printSections();
|
void printSections();
|
||||||
|
|
|
@ -13,6 +13,14 @@ bool isFile(const char *name)
|
||||||
return boost::filesystem::exists(boost::filesystem::path(name));
|
return boost::filesystem::exists(boost::filesystem::path(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if the last part of the superset matches the subset
|
||||||
|
bool endingMatches(const std::string& superset, const std::string& subset)
|
||||||
|
{
|
||||||
|
if (subset.length() > superset.length())
|
||||||
|
return false;
|
||||||
|
return superset.substr(superset.length() - subset.length()) == subset;
|
||||||
|
}
|
||||||
|
|
||||||
// Makes a list of files from a directory
|
// Makes a list of files from a directory
|
||||||
void FileLister( boost::filesystem::path currentPath, Files::PathContainer& list, bool recursive)
|
void FileLister( boost::filesystem::path currentPath, Files::PathContainer& list, bool recursive)
|
||||||
{
|
{
|
||||||
|
@ -42,13 +50,18 @@ bool isFile(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locates path in path container
|
// Locates path in path container
|
||||||
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind, bool strict)
|
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind,
|
||||||
|
bool strict, bool ignoreExtensions)
|
||||||
{
|
{
|
||||||
boost::filesystem::path result("");
|
boost::filesystem::path result("");
|
||||||
if (list.empty())
|
if (list.empty())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
std::string toFindStr = toFind.string();
|
std::string toFindStr;
|
||||||
|
if (ignoreExtensions)
|
||||||
|
toFindStr = boost::filesystem::basename(toFind);
|
||||||
|
else
|
||||||
|
toFindStr = toFind.string();
|
||||||
|
|
||||||
std::string fullPath;
|
std::string fullPath;
|
||||||
|
|
||||||
|
@ -80,11 +93,15 @@ bool isFile(const char *name)
|
||||||
for (Files::PathContainer::const_iterator it = list.begin(); it != list.end(); ++it)
|
for (Files::PathContainer::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||||
{
|
{
|
||||||
fullPath = it->string();
|
fullPath = it->string();
|
||||||
|
if (ignoreExtensions)
|
||||||
|
fullPath.erase(fullPath.length() -
|
||||||
|
boost::filesystem::path (it->extension()).string().length());
|
||||||
|
|
||||||
if (!strict)
|
if (!strict)
|
||||||
{
|
{
|
||||||
boost::algorithm::to_lower(fullPath);
|
boost::algorithm::to_lower(fullPath);
|
||||||
}
|
}
|
||||||
if(fullPath.find(toFindStr) != std::string::npos)
|
if(endingMatches(fullPath, toFindStr))
|
||||||
{
|
{
|
||||||
result = *it;
|
result = *it;
|
||||||
break;
|
break;
|
||||||
|
@ -94,9 +111,9 @@ bool isFile(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overloaded form of the locator that takes a string and returns a string
|
// Overloaded form of the locator that takes a string and returns a string
|
||||||
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict)
|
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict, bool ignoreExtensions)
|
||||||
{
|
{
|
||||||
return FileListLocator(list, boost::filesystem::path(toFind), strict).string();
|
return FileListLocator(list, boost::filesystem::path(toFind), strict, ignoreExtensions).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,11 @@ bool isFile(const char *name);
|
||||||
/// that contains the searched path.
|
/// that contains the searched path.
|
||||||
/// If it's not found it returns and empty path
|
/// If it's not found it returns and empty path
|
||||||
/// Takes care of slashes, backslashes and it has a strict option.
|
/// Takes care of slashes, backslashes and it has a strict option.
|
||||||
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind, bool strict);
|
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind,
|
||||||
|
bool strict, bool ignoreExtensions);
|
||||||
|
|
||||||
/// Overloaded form of the locator that takes a string and returns a string
|
/// Overloaded form of the locator that takes a string and returns a string
|
||||||
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict);
|
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict, bool ignoreExtensions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,8 @@ void NIFFile::parse()
|
||||||
records[i]->post(this);
|
records[i]->post(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \todo move to the write cpp file
|
||||||
|
|
||||||
void NiSkinInstance::post(NIFFile *nif)
|
void NiSkinInstance::post(NIFFile *nif)
|
||||||
{
|
{
|
||||||
int bnum = bones.length();
|
int bnum = bones.length();
|
||||||
|
|
|
@ -100,6 +100,8 @@ struct Record
|
||||||
/// Does post-processing, after the entire tree is loaded
|
/// Does post-processing, after the entire tree is loaded
|
||||||
virtual void post(NIFFile *nif) {}
|
virtual void post(NIFFile *nif) {}
|
||||||
|
|
||||||
|
virtual ~Record() {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use these later if you want custom allocation of all NIF objects
|
Use these later if you want custom allocation of all NIF objects
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ namespace Sound {
|
||||||
|
|
||||||
Ogre::Vector3 nPos, nDir, nUp;
|
Ogre::Vector3 nPos, nDir, nUp;
|
||||||
|
|
||||||
nPos = camera->getPosition();
|
nPos = camera->getRealPosition();
|
||||||
nDir = camera->getDirection();
|
nDir = camera->getRealDirection();
|
||||||
nUp = camera->getUp();
|
nUp = camera->getRealUp();
|
||||||
|
|
||||||
// Don't bother the sound system needlessly
|
// Don't bother the sound system needlessly
|
||||||
if(nDir != dir || nPos != pos || nUp != up)
|
if(nDir != dir || nPos != pos || nUp != up)
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace Mangle
|
||||||
void setRange(float a, float b=0, float c=0)
|
void setRange(float a, float b=0, float c=0)
|
||||||
{ client->setRange(a,b,c); }
|
{ client->setRange(a,b,c); }
|
||||||
void setStreaming(bool b) { client->setStreaming(b); }
|
void setStreaming(bool b) { client->setStreaming(b); }
|
||||||
|
void setRelative(bool b) { client->setRelative(b); }
|
||||||
|
|
||||||
// The clone() function is not implemented here, as you will
|
// The clone() function is not implemented here, as you will
|
||||||
// almost certainly want to override it yourself
|
// almost certainly want to override it yourself
|
||||||
|
|
|
@ -62,6 +62,9 @@ class Sound
|
||||||
/// Set loop mode
|
/// Set loop mode
|
||||||
virtual void setRepeat(bool) = 0;
|
virtual void setRepeat(bool) = 0;
|
||||||
|
|
||||||
|
/// If set to true the sound will not be affected by player movement
|
||||||
|
virtual void setRelative(bool) = 0;
|
||||||
|
|
||||||
/// Set streaming mode.
|
/// Set streaming mode.
|
||||||
/** This may be used by implementations to optimize for very large
|
/** This may be used by implementations to optimize for very large
|
||||||
files. If streaming mode is off (default), most implementations
|
files. If streaming mode is off (default), most implementations
|
||||||
|
|
|
@ -197,6 +197,7 @@ class Mangle::Sound::OpenAL_Sound : public Sound
|
||||||
void setPos(float x, float y, float z);
|
void setPos(float x, float y, float z);
|
||||||
void setPitch(float);
|
void setPitch(float);
|
||||||
void setRepeat(bool);
|
void setRepeat(bool);
|
||||||
|
void setRelative(bool);
|
||||||
|
|
||||||
void notifyOwnerDeath()
|
void notifyOwnerDeath()
|
||||||
{ ownerAlive = false; }
|
{ ownerAlive = false; }
|
||||||
|
@ -263,6 +264,7 @@ OpenAL_Factory::OpenAL_Factory(bool doSetup)
|
||||||
|
|
||||||
device = Device;
|
device = Device;
|
||||||
context = Context;
|
context = Context;
|
||||||
|
alDistanceModel(AL_LINEAR_DISTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,6 +365,12 @@ void OpenAL_Sound::setRepeat(bool rep)
|
||||||
alSourcei(inst, AL_LOOPING, rep?AL_TRUE:AL_FALSE);
|
alSourcei(inst, AL_LOOPING, rep?AL_TRUE:AL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenAL_Sound::setRelative(bool rel)
|
||||||
|
{
|
||||||
|
alSourcei(inst, AL_SOURCE_RELATIVE, rel?AL_TRUE:AL_FALSE);
|
||||||
|
checkALError("setting relative");
|
||||||
|
}
|
||||||
|
|
||||||
SoundPtr OpenAL_Sound::clone()
|
SoundPtr OpenAL_Sound::clone()
|
||||||
{
|
{
|
||||||
setupBuffer();
|
setupBuffer();
|
||||||
|
|
|
@ -25,8 +25,7 @@ There's an OpenMW package available in the AUR Repository:
|
||||||
http://aur.archlinux.org/packages.php?ID=21419
|
http://aur.archlinux.org/packages.php?ID=21419
|
||||||
|
|
||||||
OS X:
|
OS X:
|
||||||
TODO add description for OS X
|
Open DMG file, copy OpenMW folder anywhere, for example in /Applications
|
||||||
|
|
||||||
|
|
||||||
BUILD FROM SOURCE
|
BUILD FROM SOURCE
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue