mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 03:44:05 +00:00
Merge remote-tracking branch 'scrawl/master' into columns
This commit is contained in:
commit
501753c01b
133 changed files with 869 additions and 1105 deletions
145
CMakeLists.txt
145
CMakeLists.txt
|
@ -19,7 +19,7 @@ include (OpenMWMacros)
|
||||||
# Version
|
# Version
|
||||||
|
|
||||||
set (OPENMW_VERSION_MAJOR 0)
|
set (OPENMW_VERSION_MAJOR 0)
|
||||||
set (OPENMW_VERSION_MINOR 24)
|
set (OPENMW_VERSION_MINOR 25)
|
||||||
set (OPENMW_VERSION_RELEASE 0)
|
set (OPENMW_VERSION_RELEASE 0)
|
||||||
|
|
||||||
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||||
|
@ -53,18 +53,16 @@ option(OPENMW_OSX_DEPLOYMENT OFF)
|
||||||
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
||||||
|
|
||||||
# Location of morrowind data files
|
# Location of morrowind data files
|
||||||
if(DPKG_PROGRAM)
|
|
||||||
set(MORROWIND_DATA_FILES "/usr/share/games/openmw/data/" CACHE PATH "location of Morrowind data files")
|
|
||||||
set(MORROWIND_RESOURCE_FILES "/usr/share/games/openmw/resources/" CACHE PATH "location of OpenMW resources files")
|
|
||||||
else()
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(MORROWIND_DATA_FILES "./data" CACHE PATH "location of Morrowind data files")
|
set(MORROWIND_DATA_FILES "./data" CACHE PATH "location of Morrowind data files")
|
||||||
set(MORROWIND_RESOURCE_FILES "./resources" CACHE PATH "location of OpenMW resources files")
|
set(MORROWIND_RESOURCE_FILES "./resources" CACHE PATH "location of OpenMW resources files")
|
||||||
|
elseif(UNIX)
|
||||||
|
set(MORROWIND_DATA_FILES "/usr/share/games/openmw/data/" CACHE PATH "location of Morrowind data files")
|
||||||
|
set(MORROWIND_RESOURCE_FILES "/usr/share/games/openmw/resources/" CACHE PATH "location of OpenMW resources files")
|
||||||
else()
|
else()
|
||||||
set(MORROWIND_DATA_FILES "data" CACHE PATH "location of Morrowind data files")
|
set(MORROWIND_DATA_FILES "data" CACHE PATH "location of Morrowind data files")
|
||||||
set(MORROWIND_RESOURCE_FILES "resources" CACHE PATH "location of OpenMW resources files")
|
set(MORROWIND_RESOURCE_FILES "resources" CACHE PATH "location of OpenMW resources files")
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
endif(DPKG_PROGRAM)
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
option(USE_DEBUG_CONSOLE "whether a debug console should be enabled for debug builds, if false debug output is redirected to Visual Studio output" ON)
|
option(USE_DEBUG_CONSOLE "whether a debug console should be enabled for debug builds, if false debug output is redirected to Visual Studio output" ON)
|
||||||
|
@ -85,10 +83,6 @@ set(OENGINE_OGRE
|
||||||
${LIBDIR}/openengine/ogre/imagerotate.cpp
|
${LIBDIR}/openengine/ogre/imagerotate.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (APPLE)
|
|
||||||
set(OENGINE_OGRE ${OENGINE_OGRE} ${LIBDIR}/openengine/ogre/osx_utils.mm)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(OENGINE_GUI
|
set(OENGINE_GUI
|
||||||
${LIBDIR}/openengine/gui/manager.cpp
|
${LIBDIR}/openengine/gui/manager.cpp
|
||||||
)
|
)
|
||||||
|
@ -333,34 +327,77 @@ if (CMAKE_COMPILER_IS_GNUCC)
|
||||||
endif("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
endif("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||||
endif (CMAKE_COMPILER_IS_GNUCC)
|
endif (CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
if(DPKG_PROGRAM)
|
IF(NOT WIN32 AND NOT APPLE)
|
||||||
|
## Debian and non debian Linux building
|
||||||
|
# Paths
|
||||||
|
IF (DPKG_PROGRAM)
|
||||||
|
## Debian specific
|
||||||
SET(CMAKE_INSTALL_PREFIX "/usr")
|
SET(CMAKE_INSTALL_PREFIX "/usr")
|
||||||
|
SET(SYSCONFDIR "../etc/openmw" CACHE PATH "Set config dir")
|
||||||
|
ELSE ()
|
||||||
|
## Non debian specific
|
||||||
|
SET(SYSCONFDIR "/etc/openmw" CACHE PATH "Set config dir")
|
||||||
|
SET(BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Where to install binaries")
|
||||||
|
SET(LICDIR "${CMAKE_INSTALL_PREFIX}/share/licenses/openmw" CACHE PATH "Sets the openmw license directory to a non-default location.")
|
||||||
|
|
||||||
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
# Install binaries
|
||||||
exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "describe" OUTPUT_VARIABLE GIT_VERSION )
|
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/openmw" DESTINATION "${BINDIR}" )
|
||||||
STRING(REGEX REPLACE "openmw-" "" VERSION_STRING "${GIT_VERSION}")
|
IF(BUILD_LAUNCHER)
|
||||||
exec_program("git" ARGS "config --get user.name" OUTPUT_VARIABLE GIT_NAME )
|
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/omwlauncher" DESTINATION "${BINDIR}" )
|
||||||
exec_program("git" ARGS "config --get user.email" OUTPUT_VARIABLE GIT_EMAIL)
|
ENDIF(BUILD_LAUNCHER)
|
||||||
set(PACKAGE_MAINTAINER "${GIT_NAME} <${GIT_EMAIL}>")
|
IF(BUILD_BSATOOL)
|
||||||
else()
|
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/bsatool" DESTINATION "${BINDIR}" )
|
||||||
set(VERSION_STRING "${OPENMW_VERSION}")
|
ENDIF(BUILD_BSATOOL)
|
||||||
set(PACKAGE_MAINTAINER "unknown")
|
IF(BUILD_ESMTOOL)
|
||||||
endif()
|
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/esmtool" DESTINATION "${BINDIR}" )
|
||||||
|
ENDIF(BUILD_ESMTOOL)
|
||||||
|
IF(BUILD_MWINIIMPORTER)
|
||||||
|
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/mwiniimport" DESTINATION "${BINDIR}" )
|
||||||
|
ENDIF(BUILD_MWINIIMPORTER)
|
||||||
|
IF(BUILD_OPENCS)
|
||||||
|
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/opencs" DESTINATION "${BINDIR}" )
|
||||||
|
ENDIF(BUILD_OPENCS)
|
||||||
|
|
||||||
|
# Install licenses
|
||||||
|
INSTALL(FILES "DejaVu Font License.txt" DESTINATION "${LICDIR}" )
|
||||||
|
INSTALL(FILES "Daedric Font License.txt" DESTINATION "${LICDIR}" )
|
||||||
|
INSTALL(FILES "OFL.txt" DESTINATION "${LICDIR}" )
|
||||||
|
INSTALL(FILES "extern/shiny/License.txt" DESTINATION "${LICDIR}" RENAME "Shiny License.txt" )
|
||||||
|
ENDIF (DPKG_PROGRAM)
|
||||||
|
|
||||||
# Install icon and desktop file
|
# Install icon and desktop file
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||||
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "share/pixmaps/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "share/pixmaps/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||||
|
IF(BUILD_OPENCS)
|
||||||
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/opencs.desktop" DESTINATION "share/applications/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "opencs")
|
||||||
|
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/opencs/opencs.png" DESTINATION "share/pixmaps/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "opencs")
|
||||||
|
ENDIF(BUILD_OPENCS)
|
||||||
|
|
||||||
# Install global configuration files
|
# Install global configuration files
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "${SYSCONFDIR}" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/transparency-overrides.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/transparency-overrides.cfg" DESTINATION "${SYSCONFDIR}" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "../etc/openmw/" RENAME "openmw.cfg" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "${SYSCONFDIR}" RENAME "openmw.cfg" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/opencs.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
IF(BUILD_OPENCS)
|
||||||
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/opencs.cfg" DESTINATION "${SYSCONFDIR}" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "opencs")
|
||||||
|
ENDIF(BUILD_OPENCS)
|
||||||
|
|
||||||
# Install resources
|
# Install resources
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "share/games/openmw/" FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT "Resources")
|
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "share/games/openmw/" FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT "Resources")
|
||||||
INSTALL(DIRECTORY DESTINATION "share/games/openmw/data/" COMPONENT "Resources")
|
INSTALL(DIRECTORY DESTINATION "share/games/openmw/data/" COMPONENT "Resources")
|
||||||
|
|
||||||
|
IF (DPKG_PROGRAM)
|
||||||
|
## Debian Specific
|
||||||
|
IF(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
|
EXEC_PROGRAM("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "describe" OUTPUT_VARIABLE GIT_VERSION )
|
||||||
|
STRING(REGEX REPLACE "openmw-" "" VERSION_STRING "${GIT_VERSION}")
|
||||||
|
EXEC_PROGRAM("git" ARGS "config --get user.name" OUTPUT_VARIABLE GIT_NAME )
|
||||||
|
EXEC_PROGRAM("git" ARGS "config --get user.email" OUTPUT_VARIABLE GIT_EMAIL)
|
||||||
|
SET(PACKAGE_MAINTAINER "${GIT_NAME} <${GIT_EMAIL}>")
|
||||||
|
ELSE()
|
||||||
|
SET(VERSION_STRING "${OPENMW_VERSION}")
|
||||||
|
SET(PACKAGE_MAINTAINER "unknown")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
SET(CPACK_GENERATOR "DEB")
|
SET(CPACK_GENERATOR "DEB")
|
||||||
SET(CPACK_PACKAGE_NAME "openmw")
|
SET(CPACK_PACKAGE_NAME "openmw")
|
||||||
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://openmw.org")
|
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://openmw.org")
|
||||||
|
@ -376,17 +413,18 @@ if(DPKG_PROGRAM)
|
||||||
|
|
||||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games")
|
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games")
|
||||||
|
|
||||||
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
||||||
execute_process(
|
EXECUTE_PROCESS(
|
||||||
COMMAND ${DPKG_PROGRAM} --print-architecture
|
COMMAND ${DPKG_PROGRAM} --print-architecture
|
||||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||||
|
|
||||||
|
|
||||||
include(CPack)
|
INCLUDE(CPack)
|
||||||
endif(DPKG_PROGRAM)
|
ENDIF(DPKG_PROGRAM)
|
||||||
|
ENDIF(NOT WIN32 AND NOT APPLE)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
FILE(GLOB dll_files "${OpenMW_BINARY_DIR}/Release/*.dll")
|
FILE(GLOB dll_files "${OpenMW_BINARY_DIR}/Release/*.dll")
|
||||||
|
@ -669,50 +707,3 @@ if (APPLE)
|
||||||
include(CPack)
|
include(CPack)
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
if (NOT WIN32 AND NOT DPKG_PROGRAM AND NOT APPLE)
|
|
||||||
## Non Debian based Linux building
|
|
||||||
# paths
|
|
||||||
set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Where to install binaries")
|
|
||||||
set(DATAROOTDIR "${CMAKE_INSTALL_PREFIX}/share" CACHE PATH "Sets the root of data directories to a non-default location")
|
|
||||||
set(DATADIR "${DATAROOTDIR}/games/openmw" CACHE PATH "Sets the openmw data directories to a non-default location")
|
|
||||||
set(DOCDIR "${DATAROOTDIR}/doc/openmw" CACHE PATH "Sets the doc directory to a non-default location.")
|
|
||||||
set(MANDIR "${DATAROOTDIR}/man" CACHE PATH "Where to install manpages")
|
|
||||||
set(SYSCONFDIR "/etc/openmw" CACHE PATH "Set config dir")
|
|
||||||
set(ICONDIR "${DATAROOTDIR}/pixmaps" CACHE PATH "Set icon dir")
|
|
||||||
|
|
||||||
# Install binaries
|
|
||||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/openmw" DESTINATION "${BINDIR}" )
|
|
||||||
IF(BUILD_LAUNCHER)
|
|
||||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/omwlauncher" DESTINATION "${BINDIR}" )
|
|
||||||
ENDIF(BUILD_LAUNCHER)
|
|
||||||
IF(BUILD_BSATOOL)
|
|
||||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/bsatool" DESTINATION "${BINDIR}" )
|
|
||||||
ENDIF(BUILD_BSATOOL)
|
|
||||||
IF(BUILD_ESMTOOL)
|
|
||||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/esmtool" DESTINATION "${BINDIR}" )
|
|
||||||
ENDIF(BUILD_ESMTOOL)
|
|
||||||
IF(BUILD_MWINIIMPORTER)
|
|
||||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/mwiniimport" DESTINATION "${BINDIR}" )
|
|
||||||
ENDIF(BUILD_MWINIIMPORTER)
|
|
||||||
IF(BUILD_OPENCS)
|
|
||||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/opencs" DESTINATION "${BINDIR}" )
|
|
||||||
ENDIF(BUILD_OPENCS)
|
|
||||||
|
|
||||||
# Install icon and .desktop
|
|
||||||
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "${ICONDIR}")
|
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "${DATAROOTDIR}/applications")
|
|
||||||
IF(BUILD_OPENCS)
|
|
||||||
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/opencs/opencs.png" DESTINATION "${ICONDIR}")
|
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/opencs.desktop" DESTINATION "${DATAROOTDIR}/applications")
|
|
||||||
ENDIF(BUILD_OPENCS)
|
|
||||||
|
|
||||||
# Install global configuration files
|
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "${SYSCONFDIR}" RENAME "openmw.cfg" )
|
|
||||||
#INSTALL(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "${SYSCONFDIR}" )
|
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "${SYSCONFDIR}" )
|
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/transparency-overrides.cfg" DESTINATION "${SYSCONFDIR}" )
|
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/opencs.cfg" DESTINATION "${SYSCONFDIR}" )
|
|
||||||
|
|
||||||
# Install resources
|
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "${DATADIR}" )
|
|
||||||
endif(NOT WIN32 AND NOT DPKG_PROGRAM AND NOT APPLE)
|
|
||||||
|
|
|
@ -690,6 +690,10 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
|
||||||
|
|
||||||
std::string key(section + ":" + line.substr(0,pos));
|
std::string key(section + ":" + line.substr(0,pos));
|
||||||
std::string value(line.substr(pos+1));
|
std::string value(line.substr(pos+1));
|
||||||
|
if(value.empty()) {
|
||||||
|
std::cout << "Warning: ignored empty value for key '" << key << "'." << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
multistrmap::iterator it;
|
multistrmap::iterator it;
|
||||||
if((it = map.find(key)) == map.end()) {
|
if((it = map.find(key)) == map.end()) {
|
||||||
|
|
|
@ -141,6 +141,10 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||||
, mFSStrict (false)
|
, mFSStrict (false)
|
||||||
, mScriptConsoleMode (false)
|
, mScriptConsoleMode (false)
|
||||||
, mCfgMgr(configurationManager)
|
, mCfgMgr(configurationManager)
|
||||||
|
, mEncoding(ToUTF8::WINDOWS_1252)
|
||||||
|
, mEncoder(NULL)
|
||||||
|
, mActivationDistanceOverride(-1)
|
||||||
|
|
||||||
{
|
{
|
||||||
std::srand ( std::time(NULL) );
|
std::srand ( std::time(NULL) );
|
||||||
MWClass::registerClasses();
|
MWClass::registerClasses();
|
||||||
|
|
|
@ -54,7 +54,7 @@ void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap
|
||||||
FallbackMap *map = boost::any_cast<FallbackMap>(&v);
|
FallbackMap *map = boost::any_cast<FallbackMap>(&v);
|
||||||
|
|
||||||
std::map<std::string,std::string>::iterator mapIt;
|
std::map<std::string,std::string>::iterator mapIt;
|
||||||
for(std::vector<std::string>::const_iterator it=tokens.begin(); it != tokens.end(); it++)
|
for(std::vector<std::string>::const_iterator it=tokens.begin(); it != tokens.end(); ++it)
|
||||||
{
|
{
|
||||||
int sep = it->find(",");
|
int sep = it->find(",");
|
||||||
if(sep < 1 || sep == (int)it->length()-1)
|
if(sep < 1 || sep == (int)it->length()-1)
|
||||||
|
@ -204,7 +204,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
|
|
||||||
// fallback archives
|
// fallback archives
|
||||||
StringsVector archives = variables["fallback-archive"].as<StringsVector>();
|
StringsVector archives = variables["fallback-archive"].as<StringsVector>();
|
||||||
for (StringsVector::const_iterator it = archives.begin(); it != archives.end(); it++)
|
for (StringsVector::const_iterator it = archives.begin(); it != archives.end(); ++it)
|
||||||
{
|
{
|
||||||
engine.addArchive(*it);
|
engine.addArchive(*it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,13 +103,16 @@ namespace MWBase
|
||||||
///< Play a 2D audio track, using a custom decoder
|
///< Play a 2D audio track, using a custom decoder
|
||||||
|
|
||||||
virtual SoundPtr playSound(const std::string& soundId, float volume, float pitch,
|
virtual SoundPtr playSound(const std::string& soundId, float volume, float pitch,
|
||||||
PlayType type=Play_TypeSfx, PlayMode mode=Play_Normal) = 0;
|
PlayType type=Play_TypeSfx, PlayMode mode=Play_Normal,
|
||||||
|
float offset=0) = 0;
|
||||||
///< Play a sound, independently of 3D-position
|
///< Play a sound, independently of 3D-position
|
||||||
|
///< @param offset Value from [0,1] meaning from which fraction the sound the playback starts.
|
||||||
|
|
||||||
virtual SoundPtr playSound3D(const MWWorld::Ptr &reference, const std::string& soundId,
|
virtual SoundPtr playSound3D(const MWWorld::Ptr &reference, const std::string& soundId,
|
||||||
float volume, float pitch, PlayType type=Play_TypeSfx,
|
float volume, float pitch, PlayType type=Play_TypeSfx,
|
||||||
PlayMode mode=Play_Normal) = 0;
|
PlayMode mode=Play_Normal, float offset=0) = 0;
|
||||||
///< Play a sound from an object
|
///< Play a sound from an object
|
||||||
|
///< @param offset Value from [0,1] meaning from which fraction the sound the playback starts.
|
||||||
|
|
||||||
virtual void stopSound3D(const MWWorld::Ptr &reference, const std::string& soundId) = 0;
|
virtual void stopSound3D(const MWWorld::Ptr &reference, const std::string& soundId) = 0;
|
||||||
///< Stop the given object from playing the given sound,
|
///< Stop the given object from playing the given sound,
|
||||||
|
@ -123,6 +126,12 @@ namespace MWBase
|
||||||
virtual void stopSound(const std::string& soundId) = 0;
|
virtual void stopSound(const std::string& soundId) = 0;
|
||||||
///< Stop a non-3d looping sound
|
///< Stop a non-3d looping sound
|
||||||
|
|
||||||
|
virtual void fadeOutSound3D(const MWWorld::Ptr &reference, const std::string& soundId, float duration) = 0;
|
||||||
|
///< Fade out given sound (that is already playing) of given object
|
||||||
|
///< @param reference Reference to object, whose sound is faded out
|
||||||
|
///< @param soundId ID of the sound to fade out.
|
||||||
|
///< @param duration Time until volume reaches 0.
|
||||||
|
|
||||||
virtual bool getSoundPlaying(const MWWorld::Ptr &reference, const std::string& soundId) const = 0;
|
virtual bool getSoundPlaying(const MWWorld::Ptr &reference, const std::string& soundId) const = 0;
|
||||||
///< Is the given sound currently playing on the given object?
|
///< Is the given sound currently playing on the given object?
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,7 @@ namespace MWBase
|
||||||
virtual void setMinimapVisibility(bool visible) = 0;
|
virtual void setMinimapVisibility(bool visible) = 0;
|
||||||
virtual void setWeaponVisibility(bool visible) = 0;
|
virtual void setWeaponVisibility(bool visible) = 0;
|
||||||
virtual void setSpellVisibility(bool visible) = 0;
|
virtual void setSpellVisibility(bool visible) = 0;
|
||||||
|
virtual void setSneakVisibility(bool visible) = 0;
|
||||||
|
|
||||||
virtual void activateQuickKey (int index) = 0;
|
virtual void activateQuickKey (int index) = 0;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,11 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
std::auto_ptr<CustomData> data (new CustomData);
|
std::auto_ptr<CustomData> data (new CustomData);
|
||||||
|
|
||||||
// \todo add initial container content
|
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||||
|
ptr.get<ESM::Container>();
|
||||||
|
|
||||||
|
data->mContainerStore.fill(
|
||||||
|
ref->mBase->mInventory, ptr.getCellRef().mOwner, MWBase::Environment::get().getWorld()->getStore());
|
||||||
|
|
||||||
// store
|
// store
|
||||||
ptr.getRefData().setCustomData (data.release());
|
ptr.getRefData().setCustomData (data.release());
|
||||||
|
|
|
@ -79,6 +79,8 @@ namespace MWClass
|
||||||
|
|
||||||
data->mCreatureStats.setLevel(ref->mBase->mData.mLevel);
|
data->mCreatureStats.setLevel(ref->mBase->mData.mLevel);
|
||||||
|
|
||||||
|
data->mCreatureStats.getAiSequence().fill(ref->mBase->mAiPackage);
|
||||||
|
|
||||||
data->mCreatureStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
data->mCreatureStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
||||||
data->mCreatureStats.setAiSetting (1, ref->mBase->mAiData.mFight);
|
data->mCreatureStats.setAiSetting (1, ref->mBase->mAiData.mFight);
|
||||||
data->mCreatureStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
data->mCreatureStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
||||||
|
@ -89,6 +91,10 @@ namespace MWClass
|
||||||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||||
data->mCreatureStats.getSpells().add (*iter);
|
data->mCreatureStats.getSpells().add (*iter);
|
||||||
|
|
||||||
|
// inventory
|
||||||
|
data->mContainerStore.fill(ref->mBase->mInventory, getId(ptr),
|
||||||
|
MWBase::Environment::get().getWorld()->getStore());
|
||||||
|
|
||||||
// store
|
// store
|
||||||
ptr.getRefData().setCustomData (data.release());
|
ptr.getRefData().setCustomData (data.release());
|
||||||
}
|
}
|
||||||
|
@ -370,13 +376,13 @@ namespace MWClass
|
||||||
MWWorld::Store<ESM::SoundGenerator>::iterator sound = store.begin();
|
MWWorld::Store<ESM::SoundGenerator>::iterator sound = store.begin();
|
||||||
while(sound != store.end())
|
while(sound != store.end())
|
||||||
{
|
{
|
||||||
if(type == sound->mType && sound->mCreature.size() > 0 &&
|
if(type == sound->mType && !sound->mCreature.empty() &&
|
||||||
Misc::StringUtils::ciEqual(ptrid.substr(0, sound->mCreature.size()),
|
Misc::StringUtils::ciEqual(ptrid.substr(0, sound->mCreature.size()),
|
||||||
sound->mCreature))
|
sound->mCreature))
|
||||||
sounds.push_back(&*sound);
|
sounds.push_back(&*sound);
|
||||||
sound++;
|
++sound;
|
||||||
}
|
}
|
||||||
if(sounds.size() > 0)
|
if(!sounds.empty())
|
||||||
return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound;
|
return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
@ -142,9 +143,23 @@ namespace MWClass
|
||||||
// animated door
|
// animated door
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionDoor(ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionDoor(ptr));
|
||||||
if (MWBase::Environment::get().getWorld()->getOpenOrCloseDoor(ptr))
|
if (MWBase::Environment::get().getWorld()->getOpenOrCloseDoor(ptr))
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
||||||
|
closeSound, 0.5);
|
||||||
|
float offset = ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
|
||||||
|
action->setSoundOffset(offset);
|
||||||
action->setSound(openSound);
|
action->setSound(openSound);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
||||||
|
openSound, 0.5);
|
||||||
|
float offset = 1.0 - ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
|
||||||
|
//most if not all door have closing bang somewhere in the middle of the sound,
|
||||||
|
//so we divide offset by two
|
||||||
|
action->setSoundOffset(offset * 0.5);
|
||||||
action->setSound(closeSound);
|
action->setSound(closeSound);
|
||||||
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,8 @@ namespace MWClass
|
||||||
autoCalculateAttributes(ref->mBase, data->mCreatureStats);
|
autoCalculateAttributes(ref->mBase, data->mCreatureStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->mCreatureStats.getAiSequence().fill(ref->mBase->mAiPackage);
|
||||||
|
|
||||||
data->mCreatureStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
data->mCreatureStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
||||||
data->mCreatureStats.setAiSetting (1, ref->mBase->mAiData.mFight);
|
data->mCreatureStats.setAiSetting (1, ref->mBase->mAiData.mFight);
|
||||||
data->mCreatureStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
data->mCreatureStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
||||||
|
@ -225,8 +227,14 @@ namespace MWClass
|
||||||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||||
data->mCreatureStats.getSpells().add (*iter);
|
data->mCreatureStats.getSpells().add (*iter);
|
||||||
|
|
||||||
|
// inventory
|
||||||
|
data->mInventoryStore.fill(ref->mBase->mInventory, getId(ptr),
|
||||||
|
MWBase::Environment::get().getWorld()->getStore());
|
||||||
|
|
||||||
// store
|
// store
|
||||||
ptr.getRefData().setCustomData (data.release());
|
ptr.getRefData().setCustomData (data.release());
|
||||||
|
|
||||||
|
getInventoryStore(ptr).autoEquip(ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,10 +274,10 @@ namespace MWClass
|
||||||
ptr.get<ESM::NPC>();
|
ptr.get<ESM::NPC>();
|
||||||
assert(ref->mBase != NULL);
|
assert(ref->mBase != NULL);
|
||||||
|
|
||||||
std::string headID = ref->mBase->mHead;
|
//std::string headID = ref->mBase->mHead;
|
||||||
|
|
||||||
int end = headID.find_last_of("head_") - 4;
|
//int end = headID.find_last_of("head_") - 4;
|
||||||
std::string bodyRaceID = headID.substr(0, end);
|
//std::string bodyRaceID = headID.substr(0, end);
|
||||||
|
|
||||||
std::string model = "meshes\\base_anim.nif";
|
std::string model = "meshes\\base_anim.nif";
|
||||||
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
|
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
|
||||||
|
@ -323,18 +331,18 @@ namespace MWClass
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MWWorld::Class &othercls = MWWorld::Class::get(victim);
|
const MWWorld::Class &othercls = MWWorld::Class::get(victim);
|
||||||
if(!othercls.isActor() || othercls.getCreatureStats(victim).isDead())
|
if(!othercls.isActor()) // Can't hit non-actors
|
||||||
{
|
return;
|
||||||
// Can't hit non-actors, or dead actors
|
MWMechanics::CreatureStats &otherstats = getCreatureStats(victim);
|
||||||
|
if(otherstats.isDead()) // Can't hit dead actors
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if(ptr.getRefData().getHandle() == "player")
|
if(ptr.getRefData().getHandle() == "player")
|
||||||
MWBase::Environment::get().getWindowManager()->setEnemy(ptr);
|
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||||
|
|
||||||
int weapskill = ESM::Skill::HandToHand;
|
int weapskill = ESM::Skill::HandToHand;
|
||||||
if(!weapon.isEmpty())
|
if(!weapon.isEmpty())
|
||||||
weapskill = MWWorld::Class::get(weapon).getEquipmentSkill(weapon);
|
weapskill = get(weapon).getEquipmentSkill(weapon);
|
||||||
|
|
||||||
MWMechanics::CreatureStats &crstats = getCreatureStats(ptr);
|
MWMechanics::CreatureStats &crstats = getCreatureStats(ptr);
|
||||||
MWMechanics::NpcStats &npcstats = getNpcStats(ptr);
|
MWMechanics::NpcStats &npcstats = getNpcStats(ptr);
|
||||||
|
@ -345,7 +353,7 @@ namespace MWClass
|
||||||
hitchance *= crstats.getFatigueTerm();
|
hitchance *= crstats.getFatigueTerm();
|
||||||
hitchance += mageffects.get(MWMechanics::EffectKey(ESM::MagicEffect::FortifyAttack)).mMagnitude -
|
hitchance += mageffects.get(MWMechanics::EffectKey(ESM::MagicEffect::FortifyAttack)).mMagnitude -
|
||||||
mageffects.get(MWMechanics::EffectKey(ESM::MagicEffect::Blind)).mMagnitude;
|
mageffects.get(MWMechanics::EffectKey(ESM::MagicEffect::Blind)).mMagnitude;
|
||||||
hitchance -= othercls.getEvasion(victim);
|
hitchance -= otherstats.getEvasion();
|
||||||
|
|
||||||
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f)
|
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f)
|
||||||
{
|
{
|
||||||
|
@ -404,8 +412,7 @@ namespace MWClass
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D(victim, "critical damage", 1.0f, 1.0f);
|
MWBase::Environment::get().getSoundManager()->playSound3D(victim, "critical damage", 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
healthdmg = (othercls.getCreatureStats(victim).getFatigue().getCurrent() < 1.0f ||
|
healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f || npcstats.isWerewolf());
|
||||||
npcstats.isWerewolf());
|
|
||||||
if(healthdmg)
|
if(healthdmg)
|
||||||
damage *= gmst.find("fHandtoHandHealthPer")->getFloat();
|
damage *= gmst.find("fHandtoHandHealthPer")->getFloat();
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,6 @@ namespace MWDialogue
|
||||||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
||||||
executeScript (info->mResultScript);
|
executeScript (info->mResultScript);
|
||||||
mLastTopic = Misc::StringUtils::lowerCase(it->mId);
|
mLastTopic = Misc::StringUtils::lowerCase(it->mId);
|
||||||
mLastDialogue = *info;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +292,6 @@ namespace MWDialogue
|
||||||
executeScript (info->mResultScript);
|
executeScript (info->mResultScript);
|
||||||
|
|
||||||
mLastTopic = topic;
|
mLastTopic = topic;
|
||||||
mLastDialogue = *info;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -455,7 +453,6 @@ namespace MWDialogue
|
||||||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse (Interpreter::fixDefinesDialog(text, interpreterContext));
|
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse (Interpreter::fixDefinesDialog(text, interpreterContext));
|
||||||
MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId);
|
MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId);
|
||||||
executeScript (info->mResultScript);
|
executeScript (info->mResultScript);
|
||||||
mLastDialogue = *info;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ namespace MWDialogue
|
||||||
|
|
||||||
int mChoice;
|
int mChoice;
|
||||||
std::string mLastTopic;
|
std::string mLastTopic;
|
||||||
ESM::DialInfo mLastDialogue;
|
|
||||||
bool mIsInChoice;
|
bool mIsInChoice;
|
||||||
|
|
||||||
float mTemporaryDispositionChange;
|
float mTemporaryDispositionChange;
|
||||||
|
|
|
@ -47,6 +47,8 @@ namespace MWGui
|
||||||
, mIngredients (4)
|
, mIngredients (4)
|
||||||
, mSortModel(NULL)
|
, mSortModel(NULL)
|
||||||
{
|
{
|
||||||
|
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
|
||||||
getWidget(mCreateButton, "CreateButton");
|
getWidget(mCreateButton, "CreateButton");
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
getWidget(mIngredients[0], "Ingredient1");
|
getWidget(mIngredients[0], "Ingredient1");
|
||||||
|
@ -150,10 +152,10 @@ namespace MWGui
|
||||||
|
|
||||||
mNameEdit->setCaption("");
|
mNameEdit->setCaption("");
|
||||||
|
|
||||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
|
||||||
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools());
|
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools());
|
||||||
iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
|
iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,7 +108,7 @@ struct TypesetBookImpl : TypesetBook
|
||||||
{
|
{
|
||||||
Contents::iterator i = mContents.insert (mContents.end (), Content (text.first, text.second));
|
Contents::iterator i = mContents.insert (mContents.end (), Content (text.first, text.second));
|
||||||
|
|
||||||
if (i->size () == 0)
|
if (i->empty())
|
||||||
return Range (Utf8Point (NULL), Utf8Point (NULL));
|
return Range (Utf8Point (NULL), Utf8Point (NULL));
|
||||||
|
|
||||||
Utf8Point begin = &i->front ();
|
Utf8Point begin = &i->front ();
|
||||||
|
@ -768,6 +768,11 @@ public:
|
||||||
PageDisplay ()
|
PageDisplay ()
|
||||||
{
|
{
|
||||||
mPage = -1;
|
mPage = -1;
|
||||||
|
mViewTop = 0;
|
||||||
|
mViewBottom = 0;
|
||||||
|
mFocusItem = NULL;
|
||||||
|
mItemActive = false;
|
||||||
|
mNode = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dirtyFocusItem ()
|
void dirtyFocusItem ()
|
||||||
|
@ -1093,7 +1098,6 @@ class BookPageImpl : public BookPage
|
||||||
MYGUI_RTTI_DERIVED(BookPage)
|
MYGUI_RTTI_DERIVED(BookPage)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
void showPage (TypesetBook::Ptr book, size_t page)
|
void showPage (TypesetBook::Ptr book, size_t page)
|
||||||
{
|
{
|
||||||
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace MWGui
|
||||||
: WindowBase("openmw_book.layout")
|
: WindowBase("openmw_book.layout")
|
||||||
, mTakeButtonShow(true)
|
, mTakeButtonShow(true)
|
||||||
, mTakeButtonAllowed(true)
|
, mTakeButtonAllowed(true)
|
||||||
|
, mCurrentPage(0)
|
||||||
{
|
{
|
||||||
getWidget(mCloseButton, "CloseButton");
|
getWidget(mCloseButton, "CloseButton");
|
||||||
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
|
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
|
||||||
|
|
|
@ -70,6 +70,9 @@ namespace MWGui
|
||||||
, mGenerateClassStep(0)
|
, mGenerateClassStep(0)
|
||||||
{
|
{
|
||||||
mCreationStage = CSE_NotStarted;
|
mCreationStage = CSE_NotStarted;
|
||||||
|
mGenerateClassSpecializations[0] = 0;
|
||||||
|
mGenerateClassSpecializations[1] = 0;
|
||||||
|
mGenerateClassSpecializations[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
void CharacterCreation::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
||||||
|
|
|
@ -372,6 +372,8 @@ namespace MWGui
|
||||||
, mAttribDialog(NULL)
|
, mAttribDialog(NULL)
|
||||||
, mSkillDialog(NULL)
|
, mSkillDialog(NULL)
|
||||||
, mDescDialog(NULL)
|
, mDescDialog(NULL)
|
||||||
|
, mAffectedAttribute(NULL)
|
||||||
|
, mAffectedSkill(NULL)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -718,6 +720,7 @@ namespace MWGui
|
||||||
|
|
||||||
SelectAttributeDialog::SelectAttributeDialog()
|
SelectAttributeDialog::SelectAttributeDialog()
|
||||||
: WindowModal("openmw_chargen_select_attribute.layout")
|
: WindowModal("openmw_chargen_select_attribute.layout")
|
||||||
|
, mAttributeId(ESM::Attribute::Strength)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
|
|
@ -217,7 +217,7 @@ namespace MWGui
|
||||||
mCommandLine->setCaption(complete( mCommandLine->getCaption(), matches ));
|
mCommandLine->setCaption(complete( mCommandLine->getCaption(), matches ));
|
||||||
#if 0
|
#if 0
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end(); it++,i++ )
|
for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end(); ++it,++i )
|
||||||
{
|
{
|
||||||
printOK( *it );
|
printOK( *it );
|
||||||
if( i == 50 )
|
if( i == 50 )
|
||||||
|
@ -237,7 +237,7 @@ namespace MWGui
|
||||||
|
|
||||||
if(mCurrent != mCommandHistory.begin())
|
if(mCurrent != mCommandHistory.begin())
|
||||||
{
|
{
|
||||||
mCurrent--;
|
--mCurrent;
|
||||||
mCommandLine->setCaption(*mCurrent);
|
mCommandLine->setCaption(*mCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if(mCurrent != mCommandHistory.end())
|
if(mCurrent != mCommandHistory.end())
|
||||||
{
|
{
|
||||||
mCurrent++;
|
--mCurrent;
|
||||||
|
|
||||||
if(mCurrent != mCommandHistory.end())
|
if(mCurrent != mCommandHistory.end())
|
||||||
mCommandLine->setCaption(*mCurrent);
|
mCommandLine->setCaption(*mCurrent);
|
||||||
|
@ -333,7 +333,7 @@ namespace MWGui
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Is the beginning of the string different from the input string? If yes skip it. */
|
/* Is the beginning of the string different from the input string? If yes skip it. */
|
||||||
for( std::string::iterator iter=tmp.begin(), iter2=(*it).begin(); iter < tmp.end();iter++, iter2++) {
|
for( std::string::iterator iter=tmp.begin(), iter2=(*it).begin(); iter < tmp.end();++iter, ++iter2) {
|
||||||
if( tolower(*iter) != tolower(*iter2) ) {
|
if( tolower(*iter) != tolower(*iter2) ) {
|
||||||
string_different=true;
|
string_different=true;
|
||||||
break;
|
break;
|
||||||
|
@ -372,7 +372,7 @@ namespace MWGui
|
||||||
/* Check if all matching strings match further than input. If yes complete to this match. */
|
/* Check if all matching strings match further than input. If yes complete to this match. */
|
||||||
int i = tmp.length();
|
int i = tmp.length();
|
||||||
|
|
||||||
for(std::string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) {
|
for(std::string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); ++iter, ++i) {
|
||||||
for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end();++it) {
|
for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end();++it) {
|
||||||
if( tolower((*it)[i]) != tolower(*iter) ) {
|
if( tolower((*it)[i]) != tolower(*iter) ) {
|
||||||
/* Append the longest match to the end of the output string*/
|
/* Append the longest match to the end of the output string*/
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace
|
||||||
return string.getChar(0);
|
return string.getChar(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_not_empty(const std::string s) {
|
bool is_not_empty(const std::string& s) {
|
||||||
std::string temp = s;
|
std::string temp = s;
|
||||||
boost::algorithm::trim(temp);
|
boost::algorithm::trim(temp);
|
||||||
return !temp.empty();
|
return !temp.empty();
|
||||||
|
|
|
@ -84,6 +84,9 @@ namespace MWGui
|
||||||
mSpellBoxBaseLeft = mSpellBox->getLeft();
|
mSpellBoxBaseLeft = mSpellBox->getLeft();
|
||||||
mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||||
|
|
||||||
|
getWidget(mSneakBox, "SneakBox");
|
||||||
|
mSneakBoxBaseLeft = mSneakBox->getLeft();
|
||||||
|
|
||||||
getWidget(mEffectBox, "EffectBox");
|
getWidget(mEffectBox, "EffectBox");
|
||||||
mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();
|
mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();
|
||||||
|
|
||||||
|
@ -503,6 +506,12 @@ namespace MWGui
|
||||||
updatePositions();
|
updatePositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HUD::setSneakVisible(bool visible)
|
||||||
|
{
|
||||||
|
mSneakBox->setVisible(visible);
|
||||||
|
updatePositions();
|
||||||
|
}
|
||||||
|
|
||||||
void HUD::setEffectVisible(bool visible)
|
void HUD::setEffectVisible(bool visible)
|
||||||
{
|
{
|
||||||
mEffectBox->setVisible (visible);
|
mEffectBox->setVisible (visible);
|
||||||
|
@ -517,12 +526,18 @@ namespace MWGui
|
||||||
|
|
||||||
void HUD::updatePositions()
|
void HUD::updatePositions()
|
||||||
{
|
{
|
||||||
int weapDx = 0, spellDx = 0;
|
int weapDx = 0, spellDx = 0, sneakDx = 0;
|
||||||
if (!mHealth->getVisible())
|
if (!mHealth->getVisible())
|
||||||
spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
|
sneakDx = spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
|
||||||
|
|
||||||
if (!mWeapBox->getVisible())
|
if (!mWeapBox->getVisible())
|
||||||
|
{
|
||||||
spellDx += mSpellBoxBaseLeft - mWeapBoxBaseLeft;
|
spellDx += mSpellBoxBaseLeft - mWeapBoxBaseLeft;
|
||||||
|
sneakDx = spellDx;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mSpellBox->getVisible())
|
||||||
|
sneakDx += mSneakBoxBaseLeft - mSpellBoxBaseLeft;
|
||||||
|
|
||||||
mWeaponVisible = mWeapBox->getVisible();
|
mWeaponVisible = mWeapBox->getVisible();
|
||||||
mSpellVisible = mSpellBox->getVisible();
|
mSpellVisible = mSpellBox->getVisible();
|
||||||
|
@ -531,6 +546,7 @@ namespace MWGui
|
||||||
|
|
||||||
mWeapBox->setPosition(mWeapBoxBaseLeft - weapDx, mWeapBox->getTop());
|
mWeapBox->setPosition(mWeapBoxBaseLeft - weapDx, mWeapBox->getTop());
|
||||||
mSpellBox->setPosition(mSpellBoxBaseLeft - spellDx, mSpellBox->getTop());
|
mSpellBox->setPosition(mSpellBoxBaseLeft - spellDx, mSpellBox->getTop());
|
||||||
|
mSneakBox->setPosition(mSneakBoxBaseLeft - sneakDx, mSneakBox->getTop());
|
||||||
|
|
||||||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace MWGui
|
||||||
void setHmsVisible(bool visible);
|
void setHmsVisible(bool visible);
|
||||||
void setWeapVisible(bool visible);
|
void setWeapVisible(bool visible);
|
||||||
void setSpellVisible(bool visible);
|
void setSpellVisible(bool visible);
|
||||||
|
void setSneakVisible(bool visible);
|
||||||
|
|
||||||
void setEffectVisible(bool visible);
|
void setEffectVisible(bool visible);
|
||||||
void setMinimapVisible(bool visible);
|
void setMinimapVisible(bool visible);
|
||||||
|
@ -51,7 +52,7 @@ namespace MWGui
|
||||||
private:
|
private:
|
||||||
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth;
|
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth;
|
||||||
MyGUI::Widget* mHealthFrame;
|
MyGUI::Widget* mHealthFrame;
|
||||||
MyGUI::Widget *mWeapBox, *mSpellBox;
|
MyGUI::Widget *mWeapBox, *mSpellBox, *mSneakBox;
|
||||||
MyGUI::ImageBox *mWeapImage, *mSpellImage;
|
MyGUI::ImageBox *mWeapImage, *mSpellImage;
|
||||||
MyGUI::ProgressBar *mWeapStatus, *mSpellStatus;
|
MyGUI::ProgressBar *mWeapStatus, *mSpellStatus;
|
||||||
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
||||||
|
@ -70,7 +71,7 @@ namespace MWGui
|
||||||
MyGUI::TextBox* mBatchCounter;
|
MyGUI::TextBox* mBatchCounter;
|
||||||
|
|
||||||
// bottom left elements
|
// bottom left elements
|
||||||
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft;
|
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft, mSneakBoxBaseLeft;
|
||||||
// bottom right elements
|
// bottom right elements
|
||||||
int mMinimapBoxBaseRight, mEffectBoxBaseRight;
|
int mMinimapBoxBaseRight, mEffectBoxBaseRight;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,12 @@ namespace MWGui
|
||||||
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
||||||
, mPreviewDirty(true)
|
, mPreviewDirty(true)
|
||||||
, mDragAndDrop(dragAndDrop)
|
, mDragAndDrop(dragAndDrop)
|
||||||
|
, mSelectedItem(-1)
|
||||||
|
, mPositionInventory(0, 342, 498, 258)
|
||||||
|
, mPositionContainer(0, 342, 498, 258)
|
||||||
|
, mPositionCompanion(0, 342, 498, 258)
|
||||||
|
, mPositionBarter(0, 342, 498, 258)
|
||||||
|
, mGuiMode(GM_Inventory)
|
||||||
{
|
{
|
||||||
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);
|
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);
|
||||||
|
|
||||||
|
@ -67,7 +73,7 @@ namespace MWGui
|
||||||
|
|
||||||
mFilterAll->setStateSelected(true);
|
mFilterAll->setStateSelected(true);
|
||||||
|
|
||||||
setCoord(0, 342, 498, 258);
|
setCoord(mPositionInventory.left, mPositionInventory.top, mPositionInventory.width, mPositionInventory.height);
|
||||||
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
||||||
|
|
||||||
mPreview.setup();
|
mPreview.setup();
|
||||||
|
@ -83,6 +89,27 @@ namespace MWGui
|
||||||
mPreview.setup();
|
mPreview.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InventoryWindow::setGuiMode(GuiMode mode)
|
||||||
|
{
|
||||||
|
mGuiMode = mode;
|
||||||
|
switch(mode) {
|
||||||
|
case GM_Container:
|
||||||
|
mMainWidget->setCoord(mPositionContainer);
|
||||||
|
break;
|
||||||
|
case GM_Companion:
|
||||||
|
mMainWidget->setCoord(mPositionCompanion);
|
||||||
|
break;
|
||||||
|
case GM_Barter:
|
||||||
|
mMainWidget->setCoord(mPositionBarter);
|
||||||
|
break;
|
||||||
|
case GM_Inventory:
|
||||||
|
default:
|
||||||
|
mMainWidget->setCoord(mPositionInventory);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
||||||
|
}
|
||||||
|
|
||||||
TradeItemModel* InventoryWindow::getTradeModel()
|
TradeItemModel* InventoryWindow::getTradeModel()
|
||||||
{
|
{
|
||||||
return mTradeModel;
|
return mTradeModel;
|
||||||
|
@ -210,6 +237,21 @@ namespace MWGui
|
||||||
_sender->getSize().width - 12 - (_sender->getSize().height-44) * aspect - 15,
|
_sender->getSize().width - 12 - (_sender->getSize().height-44) * aspect - 15,
|
||||||
_sender->getSize().height-44 );
|
_sender->getSize().height-44 );
|
||||||
|
|
||||||
|
switch(mGuiMode) {
|
||||||
|
case GM_Container:
|
||||||
|
mPositionContainer = _sender->getCoord();
|
||||||
|
break;
|
||||||
|
case GM_Companion:
|
||||||
|
mPositionCompanion = _sender->getCoord();
|
||||||
|
break;
|
||||||
|
case GM_Barter:
|
||||||
|
mPositionBarter = _sender->getCoord();
|
||||||
|
break;
|
||||||
|
case GM_Inventory:
|
||||||
|
default:
|
||||||
|
mPositionInventory = _sender->getCoord();
|
||||||
|
}
|
||||||
|
|
||||||
if (mMainWidget->getSize().width != mLastXSize || mMainWidget->getSize().height != mLastYSize)
|
if (mMainWidget->getSize().width != mLastXSize || mMainWidget->getSize().height != mLastYSize)
|
||||||
{
|
{
|
||||||
mLastXSize = mMainWidget->getSize().width;
|
mLastXSize = mMainWidget->getSize().width;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "windowpinnablebase.hpp"
|
#include "windowpinnablebase.hpp"
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
|
#include "mode.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -47,6 +48,8 @@ namespace MWGui
|
||||||
|
|
||||||
void updatePlayer();
|
void updatePlayer();
|
||||||
|
|
||||||
|
void setGuiMode(GuiMode mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DragAndDrop* mDragAndDrop;
|
DragAndDrop* mDragAndDrop;
|
||||||
|
|
||||||
|
@ -73,6 +76,13 @@ namespace MWGui
|
||||||
MyGUI::Button* mFilterMagic;
|
MyGUI::Button* mFilterMagic;
|
||||||
MyGUI::Button* mFilterMisc;
|
MyGUI::Button* mFilterMisc;
|
||||||
|
|
||||||
|
MyGUI::IntCoord mPositionInventory;
|
||||||
|
MyGUI::IntCoord mPositionContainer;
|
||||||
|
MyGUI::IntCoord mPositionCompanion;
|
||||||
|
MyGUI::IntCoord mPositionBarter;
|
||||||
|
|
||||||
|
GuiMode mGuiMode;
|
||||||
|
|
||||||
int mLastXSize;
|
int mLastXSize;
|
||||||
int mLastYSize;
|
int mLastYSize;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace MWGui
|
||||||
|
|
||||||
ItemSelectionDialog::ItemSelectionDialog(const std::string &label)
|
ItemSelectionDialog::ItemSelectionDialog(const std::string &label)
|
||||||
: WindowModal("openmw_itemselection_dialog.layout")
|
: WindowModal("openmw_itemselection_dialog.layout")
|
||||||
|
, mSortModel(NULL)
|
||||||
|
, mModel(NULL)
|
||||||
{
|
{
|
||||||
getWidget(mItemView, "ItemView");
|
getWidget(mItemView, "ItemView");
|
||||||
mItemView->eventItemClicked += MyGUI::newDelegate(this, &ItemSelectionDialog::onSelectedItem);
|
mItemView->eventItemClicked += MyGUI::newDelegate(this, &ItemSelectionDialog::onSelectedItem);
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace MWGui
|
||||||
|
|
||||||
ItemView::ItemView()
|
ItemView::ItemView()
|
||||||
: mModel(NULL)
|
: mModel(NULL)
|
||||||
|
, mScrollView(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
candidates.push_back(std::make_pair((j-i), candidate));
|
candidates.push_back(std::make_pair((j-i), candidate));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!candidates.size())
|
if (candidates.empty())
|
||||||
continue; // didn't match enough to disambiguate, on to next character
|
continue; // didn't match enough to disambiguate, on to next character
|
||||||
|
|
||||||
// shorter candidates will be added to the vector first. however, we want to check against longer candidates first
|
// shorter candidates will be added to the vector first. however, we want to check against longer candidates first
|
||||||
|
|
|
@ -24,6 +24,10 @@ namespace MWGui
|
||||||
, mLastWallpaperChangeTime(0.f)
|
, mLastWallpaperChangeTime(0.f)
|
||||||
, mFirstLoad(true)
|
, mFirstLoad(true)
|
||||||
, mTotalRefsLoading(0)
|
, mTotalRefsLoading(0)
|
||||||
|
, mCurrentCellLoading(0)
|
||||||
|
, mTotalCellsLoading(0)
|
||||||
|
, mCurrentRefLoading(0)
|
||||||
|
, mCurrentRefList(0)
|
||||||
{
|
{
|
||||||
getWidget(mLoadingText, "LoadingText");
|
getWidget(mLoadingText, "LoadingText");
|
||||||
getWidget(mProgressBar, "ProgressBar");
|
getWidget(mProgressBar, "ProgressBar");
|
||||||
|
|
|
@ -89,9 +89,6 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
for (int my=0; my<3; ++my)
|
for (int my=0; my<3; ++my)
|
||||||
{
|
{
|
||||||
std::string name = "Map_" + boost::lexical_cast<std::string>(mx) + "_"
|
|
||||||
+ boost::lexical_cast<std::string>(my);
|
|
||||||
|
|
||||||
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(mCurX + (mx-1)) + "_"
|
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(mCurX + (mx-1)) + "_"
|
||||||
+ boost::lexical_cast<std::string>(mCurY + (-1*(my-1)));
|
+ boost::lexical_cast<std::string>(mCurY + (-1*(my-1)));
|
||||||
MyGUI::ImageBox* fog = mFogWidgets[my + 3*mx];
|
MyGUI::ImageBox* fog = mFogWidgets[my + 3*mx];
|
||||||
|
@ -135,9 +132,6 @@ namespace MWGui
|
||||||
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(x + (mx-1)) + "_"
|
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(x + (mx-1)) + "_"
|
||||||
+ boost::lexical_cast<std::string>(y + (-1*(my-1)));
|
+ boost::lexical_cast<std::string>(y + (-1*(my-1)));
|
||||||
|
|
||||||
std::string name = "Map_" + boost::lexical_cast<std::string>(mx) + "_"
|
|
||||||
+ boost::lexical_cast<std::string>(my);
|
|
||||||
|
|
||||||
MyGUI::ImageBox* box = mMapWidgets[my + 3*mx];
|
MyGUI::ImageBox* box = mMapWidgets[my + 3*mx];
|
||||||
|
|
||||||
if (MyGUI::RenderManager::getInstance().getTexture(image) != 0)
|
if (MyGUI::RenderManager::getInstance().getTexture(image) != 0)
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace MWGui
|
||||||
else {
|
else {
|
||||||
(*it2)->update(height);
|
(*it2)->update(height);
|
||||||
height += (*it2)->getHeight();
|
height += (*it2)->getHeight();
|
||||||
it2++;
|
++it2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
it++;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +226,7 @@ namespace MWGui
|
||||||
: WindowModal("openmw_interactive_messagebox.layout")
|
: WindowModal("openmw_interactive_messagebox.layout")
|
||||||
, mMessageBoxManager(parMessageBoxManager)
|
, mMessageBoxManager(parMessageBoxManager)
|
||||||
, mButtonPressed(-1)
|
, mButtonPressed(-1)
|
||||||
|
, mTextButtonPadding(0)
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::open();
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace MWGui
|
||||||
, mAssignDialog(0)
|
, mAssignDialog(0)
|
||||||
, mItemSelectionDialog(0)
|
, mItemSelectionDialog(0)
|
||||||
, mMagicSelectionDialog(0)
|
, mMagicSelectionDialog(0)
|
||||||
|
, mSelectedIndex(-1)
|
||||||
{
|
{
|
||||||
getWidget(mOkButton, "OKButton");
|
getWidget(mOkButton, "OKButton");
|
||||||
getWidget(mInstructionLabel, "InstructionLabel");
|
getWidget(mInstructionLabel, "InstructionLabel");
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace MWGui
|
||||||
, mHairIndex(0)
|
, mHairIndex(0)
|
||||||
, mCurrentAngle(0)
|
, mCurrentAngle(0)
|
||||||
, mPreviewDirty(true)
|
, mPreviewDirty(true)
|
||||||
|
, mPreview(NULL)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
|
|
@ -18,7 +18,6 @@ namespace MWGui
|
||||||
|
|
||||||
ReviewDialog::ReviewDialog()
|
ReviewDialog::ReviewDialog()
|
||||||
: WindowModal("openmw_chargen_review.layout")
|
: WindowModal("openmw_chargen_review.layout")
|
||||||
, mLastPos(0)
|
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -321,9 +320,7 @@ namespace MWGui
|
||||||
if (!mMiscSkills.empty())
|
if (!mMiscSkills.empty())
|
||||||
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
|
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
|
||||||
|
|
||||||
mClientHeight = coord1.top;
|
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top));
|
||||||
|
|
||||||
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
|
|
@ -79,7 +79,6 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::TextBox *mNameWidget, *mRaceWidget, *mClassWidget, *mBirthSignWidget;
|
MyGUI::TextBox *mNameWidget, *mRaceWidget, *mClassWidget, *mBirthSignWidget;
|
||||||
MyGUI::ScrollView* mSkillView;
|
MyGUI::ScrollView* mSkillView;
|
||||||
int mLastPos, mClientHeight;
|
|
||||||
|
|
||||||
Widgets::MWDynamicStatPtr mHealth, mMagicka, mFatigue;
|
Widgets::MWDynamicStatPtr mHealth, mMagicka, mFatigue;
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,15 @@ namespace MWGui
|
||||||
mDeleteButton->setVisible (false);
|
mDeleteButton->setVisible (false);
|
||||||
|
|
||||||
mEffect.mRange = ESM::RT_Self;
|
mEffect.mRange = ESM::RT_Self;
|
||||||
|
if (!(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastSelf))
|
||||||
|
mEffect.mRange = ESM::RT_Touch;
|
||||||
|
if (!(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch))
|
||||||
|
mEffect.mRange = ESM::RT_Target;
|
||||||
|
mEffect.mMagnMin = 1;
|
||||||
|
mEffect.mMagnMax = 1;
|
||||||
|
mEffect.mDuration = 1;
|
||||||
|
mEffect.mArea = 0;
|
||||||
|
eventEffectAdded(mEffect);
|
||||||
|
|
||||||
onRangeButtonClicked(mRangeButton);
|
onRangeButtonClicked(mRangeButton);
|
||||||
|
|
||||||
|
@ -93,11 +102,6 @@ namespace MWGui
|
||||||
mMagnitudeMinValue->setCaption("1");
|
mMagnitudeMinValue->setCaption("1");
|
||||||
mMagnitudeMaxValue->setCaption("- 1");
|
mMagnitudeMaxValue->setCaption("- 1");
|
||||||
mAreaValue->setCaption("0");
|
mAreaValue->setCaption("0");
|
||||||
|
|
||||||
mEffect.mMagnMin = 1;
|
|
||||||
mEffect.mMagnMax = 1;
|
|
||||||
mEffect.mDuration = 1;
|
|
||||||
mEffect.mArea = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::editEffect (ESM::ENAMstruct effect)
|
void EditEffectDialog::editEffect (ESM::ENAMstruct effect)
|
||||||
|
@ -106,7 +110,7 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
|
||||||
|
|
||||||
setMagicEffect(magicEffect);
|
setMagicEffect(magicEffect);
|
||||||
|
mOldEffect = effect;
|
||||||
mEffect = effect;
|
mEffect = effect;
|
||||||
mEditing = true;
|
mEditing = true;
|
||||||
|
|
||||||
|
@ -121,6 +125,7 @@ namespace MWGui
|
||||||
onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1);
|
onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1);
|
||||||
onAreaChanged (mAreaSlider, effect.mArea);
|
onAreaChanged (mAreaSlider, effect.mArea);
|
||||||
onDurationChanged (mDurationSlider, effect.mDuration-1);
|
onDurationChanged (mDurationSlider, effect.mDuration-1);
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect)
|
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect)
|
||||||
|
@ -163,7 +168,7 @@ namespace MWGui
|
||||||
mDurationBox->setVisible (true);
|
mDurationBox->setVisible (true);
|
||||||
curY += mDurationBox->getSize().height;
|
curY += mDurationBox->getSize().height;
|
||||||
}
|
}
|
||||||
if (mEffect.mRange == ESM::RT_Target)
|
if (mEffect.mRange != ESM::RT_Self)
|
||||||
{
|
{
|
||||||
mAreaBox->setPosition(mAreaBox->getPosition().left, curY);
|
mAreaBox->setPosition(mAreaBox->getPosition().left, curY);
|
||||||
mAreaBox->setVisible (true);
|
mAreaBox->setVisible (true);
|
||||||
|
@ -182,9 +187,6 @@ namespace MWGui
|
||||||
else if (mEffect.mRange == ESM::RT_Touch)
|
else if (mEffect.mRange == ESM::RT_Touch)
|
||||||
mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}");
|
mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}");
|
||||||
|
|
||||||
mAreaSlider->setVisible (mEffect.mRange != ESM::RT_Self);
|
|
||||||
mAreaText->setVisible (mEffect.mRange != ESM::RT_Self);
|
|
||||||
|
|
||||||
// cycle through range types until we find something that's allowed
|
// cycle through range types until we find something that's allowed
|
||||||
if (mEffect.mRange == ESM::RT_Target && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTarget))
|
if (mEffect.mRange == ESM::RT_Target && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTarget))
|
||||||
onRangeButtonClicked(sender);
|
onRangeButtonClicked(sender);
|
||||||
|
@ -193,7 +195,13 @@ namespace MWGui
|
||||||
if (mEffect.mRange == ESM::RT_Touch && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch))
|
if (mEffect.mRange == ESM::RT_Touch && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch))
|
||||||
onRangeButtonClicked(sender);
|
onRangeButtonClicked(sender);
|
||||||
|
|
||||||
|
if(mEffect.mRange == ESM::RT_Self)
|
||||||
|
{
|
||||||
|
mAreaSlider->setScrollPosition(0);
|
||||||
|
onAreaChanged(mAreaSlider,0);
|
||||||
|
}
|
||||||
updateBoxes();
|
updateBoxes();
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender)
|
void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender)
|
||||||
|
@ -206,26 +214,27 @@ namespace MWGui
|
||||||
void EditEffectDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
void EditEffectDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
||||||
if (mEditing)
|
|
||||||
eventEffectModified(mEffect);
|
|
||||||
else
|
|
||||||
eventEffectAdded(mEffect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
|
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
if(mEditing)
|
||||||
|
eventEffectModified(mOldEffect);
|
||||||
|
else
|
||||||
|
eventEffectRemoved(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::setSkill (int skill)
|
void EditEffectDialog::setSkill (int skill)
|
||||||
{
|
{
|
||||||
mEffect.mSkill = skill;
|
mEffect.mSkill = skill;
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::setAttribute (int attribute)
|
void EditEffectDialog::setAttribute (int attribute)
|
||||||
{
|
{
|
||||||
mEffect.mAttribute = attribute;
|
mEffect.mAttribute = attribute;
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos)
|
void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||||
|
@ -235,6 +244,7 @@ namespace MWGui
|
||||||
|
|
||||||
// trigger the check again (see below)
|
// trigger the check again (see below)
|
||||||
onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition ());
|
onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition ());
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos)
|
void EditEffectDialog::onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||||
|
@ -250,18 +260,22 @@ namespace MWGui
|
||||||
mEffect.mMagnMax = pos+1;
|
mEffect.mMagnMax = pos+1;
|
||||||
|
|
||||||
mMagnitudeMaxValue->setCaption("- " + boost::lexical_cast<std::string>(pos+1));
|
mMagnitudeMaxValue->setCaption("- " + boost::lexical_cast<std::string>(pos+1));
|
||||||
|
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos)
|
void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||||
{
|
{
|
||||||
mDurationValue->setCaption(boost::lexical_cast<std::string>(pos+1));
|
mDurationValue->setCaption(boost::lexical_cast<std::string>(pos+1));
|
||||||
mEffect.mDuration = pos+1;
|
mEffect.mDuration = pos+1;
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos)
|
void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||||
{
|
{
|
||||||
mAreaValue->setCaption(boost::lexical_cast<std::string>(pos));
|
mAreaValue->setCaption(boost::lexical_cast<std::string>(pos));
|
||||||
mEffect.mArea = pos;
|
mEffect.mArea = pos;
|
||||||
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -615,6 +629,7 @@ namespace MWGui
|
||||||
void EffectEditorBase::onEffectAdded (ESM::ENAMstruct effect)
|
void EffectEditorBase::onEffectAdded (ESM::ENAMstruct effect)
|
||||||
{
|
{
|
||||||
mEffects.push_back(effect);
|
mEffects.push_back(effect);
|
||||||
|
mSelectedEffect=mEffects.size()-1;
|
||||||
|
|
||||||
updateEffectsView();
|
updateEffectsView();
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ namespace MWGui
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ESM::ENAMstruct mEffect;
|
ESM::ENAMstruct mEffect;
|
||||||
|
ESM::ENAMstruct mOldEffect;
|
||||||
|
|
||||||
const ESM::MagicEffect* mMagicEffect;
|
const ESM::MagicEffect* mMagicEffect;
|
||||||
};
|
};
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace MWGui
|
||||||
if (adjustSize)
|
if (adjustSize)
|
||||||
{
|
{
|
||||||
int s = effects.size() * 16+4;
|
int s = effects.size() * 16+4;
|
||||||
if (!effects.size())
|
if (effects.empty())
|
||||||
s = 0;
|
s = 0;
|
||||||
int diff = parent->getWidth() - s;
|
int diff = parent->getWidth() - s;
|
||||||
parent->setSize(s, parent->getHeight());
|
parent->setSize(s, parent->getHeight());
|
||||||
|
|
|
@ -22,7 +22,11 @@ namespace MWGui
|
||||||
// information about a single magic effect source as required for display in the tooltip
|
// information about a single magic effect source as required for display in the tooltip
|
||||||
struct MagicEffectInfo
|
struct MagicEffectInfo
|
||||||
{
|
{
|
||||||
MagicEffectInfo() : mPermanent(false) {}
|
MagicEffectInfo()
|
||||||
|
: mPermanent(false)
|
||||||
|
, mMagnitude(0)
|
||||||
|
, mRemainingTime(0)
|
||||||
|
{}
|
||||||
std::string mSource; // display name for effect source (e.g. potion name)
|
std::string mSource; // display name for effect source (e.g. potion name)
|
||||||
MWMechanics::EffectKey mKey;
|
MWMechanics::EffectKey mKey;
|
||||||
int mMagnitude;
|
int mMagnitude;
|
||||||
|
|
|
@ -21,7 +21,6 @@ namespace MWGui
|
||||||
StatsWindow::StatsWindow ()
|
StatsWindow::StatsWindow ()
|
||||||
: WindowPinnableBase("openmw_stats_window.layout")
|
: WindowPinnableBase("openmw_stats_window.layout")
|
||||||
, mSkillView(NULL)
|
, mSkillView(NULL)
|
||||||
, mClientHeight(0)
|
|
||||||
, mMajorSkills()
|
, mMajorSkills()
|
||||||
, mMinorSkills()
|
, mMinorSkills()
|
||||||
, mMiscSkills()
|
, mMiscSkills()
|
||||||
|
@ -82,7 +81,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mLeftPane->setCoord( MyGUI::IntCoord(0, 0, 0.44*window->getSize().width, window->getSize().height) );
|
mLeftPane->setCoord( MyGUI::IntCoord(0, 0, 0.44*window->getSize().width, window->getSize().height) );
|
||||||
mRightPane->setCoord( MyGUI::IntCoord(0.44*window->getSize().width, 0, 0.56*window->getSize().width, window->getSize().height) );
|
mRightPane->setCoord( MyGUI::IntCoord(0.44*window->getSize().width, 0, 0.56*window->getSize().width, window->getSize().height) );
|
||||||
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight));
|
mSkillView->setCanvasSize (mSkillView->getWidth(), mSkillView->getCanvasSize().height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsWindow::setBar(const std::string& name, const std::string& tname, int val, int max)
|
void StatsWindow::setBar(const std::string& name, const std::string& tname, int val, int max)
|
||||||
|
@ -422,7 +421,6 @@ namespace MWGui
|
||||||
mSkillWidgets.clear();
|
mSkillWidgets.clear();
|
||||||
|
|
||||||
mSkillView->setViewOffset (MyGUI::IntPoint(0,0));
|
mSkillView->setViewOffset (MyGUI::IntPoint(0,0));
|
||||||
mClientHeight = 0;
|
|
||||||
|
|
||||||
const int valueSize = 40;
|
const int valueSize = 40;
|
||||||
MyGUI::IntCoord coord1(10, 0, mSkillView->getWidth() - (10 + valueSize) - 24, 18);
|
MyGUI::IntCoord coord1(10, 0, mSkillView->getWidth() - (10 + valueSize) - 24, 18);
|
||||||
|
@ -565,9 +563,7 @@ namespace MWGui
|
||||||
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sCrimeHelp}");
|
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sCrimeHelp}");
|
||||||
}
|
}
|
||||||
|
|
||||||
mClientHeight = coord1.top;
|
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top));
|
||||||
|
|
||||||
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsWindow::onPinToggled()
|
void StatsWindow::onPinToggled()
|
||||||
|
|
|
@ -57,7 +57,6 @@ namespace MWGui
|
||||||
MyGUI::Widget* mRightPane;
|
MyGUI::Widget* mRightPane;
|
||||||
|
|
||||||
MyGUI::ScrollView* mSkillView;
|
MyGUI::ScrollView* mSkillView;
|
||||||
int mLastPos, mClientHeight;
|
|
||||||
|
|
||||||
SkillList mMajorSkills, mMinorSkills, mMiscSkills;
|
SkillList mMajorSkills, mMinorSkills, mMiscSkills;
|
||||||
std::map<int, MWMechanics::Stat<float> > mSkillValues;
|
std::map<int, MWMechanics::Stat<float> > mSkillValues;
|
||||||
|
|
|
@ -149,7 +149,6 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string type = focus->getUserString("ToolTipType");
|
std::string type = focus->getUserString("ToolTipType");
|
||||||
std::string text = focus->getUserString("ToolTipText");
|
|
||||||
|
|
||||||
if (type == "")
|
if (type == "")
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,9 @@ namespace MWGui
|
||||||
, mBalanceButtonsState(BBS_None)
|
, mBalanceButtonsState(BBS_None)
|
||||||
, mBalanceChangePause(0.0)
|
, mBalanceChangePause(0.0)
|
||||||
, mItemToSell(-1)
|
, mItemToSell(-1)
|
||||||
|
, mTradeModel(NULL)
|
||||||
|
, mSortModel(NULL)
|
||||||
|
, mCurrentMerchantOffer(0)
|
||||||
{
|
{
|
||||||
getWidget(mFilterAll, "AllButton");
|
getWidget(mFilterAll, "AllButton");
|
||||||
getWidget(mFilterWeapon, "WeaponButton");
|
getWidget(mFilterWeapon, "WeaponButton");
|
||||||
|
|
|
@ -47,6 +47,8 @@ namespace MWGui
|
||||||
, mSleeping(false)
|
, mSleeping(false)
|
||||||
, mHours(1)
|
, mHours(1)
|
||||||
, mRemainingTime(0.05)
|
, mRemainingTime(0.05)
|
||||||
|
, mCurHour(0)
|
||||||
|
, mManualHours(1)
|
||||||
{
|
{
|
||||||
getWidget(mDateTimeText, "DateTimeText");
|
getWidget(mDateTimeText, "DateTimeText");
|
||||||
getWidget(mRestText, "RestText");
|
getWidget(mRestText, "RestText");
|
||||||
|
@ -216,7 +218,13 @@ namespace MWGui
|
||||||
|
|
||||||
void WaitDialog::setCanRest (bool canRest)
|
void WaitDialog::setCanRest (bool canRest)
|
||||||
{
|
{
|
||||||
mUntilHealedButton->setVisible(canRest);
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||||
|
bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified())
|
||||||
|
&& (stats.getHealth().getCurrent() >= stats.getHealth().getModified())
|
||||||
|
&& (stats.getMagicka().getCurrent() >= stats.getMagicka().getModified());
|
||||||
|
|
||||||
|
mUntilHealedButton->setVisible(canRest && !full);
|
||||||
mWaitButton->setCaptionWithReplacing (canRest ? "#{sRest}" : "#{sWait}");
|
mWaitButton->setCaptionWithReplacing (canRest ? "#{sRest}" : "#{sWait}");
|
||||||
mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}");
|
mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}");
|
||||||
|
|
||||||
|
|
|
@ -899,6 +899,7 @@ namespace MWGui
|
||||||
: mEnableRepeat(true)
|
: mEnableRepeat(true)
|
||||||
, mRepeatTriggerTime(0.5)
|
, mRepeatTriggerTime(0.5)
|
||||||
, mRepeatStepTime(0.1)
|
, mRepeatStepTime(0.1)
|
||||||
|
, mIsIncreasing(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -441,16 +441,19 @@ namespace MWGui
|
||||||
mMap ->setVisible(eff & GW_Map);
|
mMap ->setVisible(eff & GW_Map);
|
||||||
mStatsWindow ->setVisible(eff & GW_Stats);
|
mStatsWindow ->setVisible(eff & GW_Stats);
|
||||||
mInventoryWindow->setVisible(eff & GW_Inventory);
|
mInventoryWindow->setVisible(eff & GW_Inventory);
|
||||||
|
mInventoryWindow->setGuiMode(mode);
|
||||||
mSpellWindow ->setVisible(eff & GW_Magic);
|
mSpellWindow ->setVisible(eff & GW_Magic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GM_Container:
|
case GM_Container:
|
||||||
mContainerWindow->setVisible(true);
|
mContainerWindow->setVisible(true);
|
||||||
mInventoryWindow->setVisible(true);
|
mInventoryWindow->setVisible(true);
|
||||||
|
mInventoryWindow->setGuiMode(mode);
|
||||||
break;
|
break;
|
||||||
case GM_Companion:
|
case GM_Companion:
|
||||||
mCompanionWindow->setVisible(true);
|
mCompanionWindow->setVisible(true);
|
||||||
mInventoryWindow->setVisible(true);
|
mInventoryWindow->setVisible(true);
|
||||||
|
mInventoryWindow->setGuiMode(mode);
|
||||||
break;
|
break;
|
||||||
case GM_Dialogue:
|
case GM_Dialogue:
|
||||||
mDialogueWindow->setVisible(true);
|
mDialogueWindow->setVisible(true);
|
||||||
|
@ -458,6 +461,7 @@ namespace MWGui
|
||||||
case GM_Barter:
|
case GM_Barter:
|
||||||
mInventoryWindow->setVisible(true);
|
mInventoryWindow->setVisible(true);
|
||||||
mInventoryWindow->setTrading(true);
|
mInventoryWindow->setTrading(true);
|
||||||
|
mInventoryWindow->setGuiMode(mode);
|
||||||
mTradeWindow->setVisible(true);
|
mTradeWindow->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case GM_SpellBuying:
|
case GM_SpellBuying:
|
||||||
|
@ -830,6 +834,11 @@ namespace MWGui
|
||||||
mHud->setEffectVisible (visible);
|
mHud->setEffectVisible (visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::setSneakVisibility(bool visible)
|
||||||
|
{
|
||||||
|
mHud->setSneakVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::setDragDrop(bool dragDrop)
|
void WindowManager::setDragDrop(bool dragDrop)
|
||||||
{
|
{
|
||||||
mToolTips->setEnabled(!dragDrop);
|
mToolTips->setEnabled(!dragDrop);
|
||||||
|
|
|
@ -179,6 +179,7 @@ namespace MWGui
|
||||||
virtual void setMinimapVisibility(bool visible);
|
virtual void setMinimapVisibility(bool visible);
|
||||||
virtual void setWeaponVisibility(bool visible);
|
virtual void setWeaponVisibility(bool visible);
|
||||||
virtual void setSpellVisibility(bool visible);
|
virtual void setSpellVisibility(bool visible);
|
||||||
|
virtual void setSneakVisibility(bool visible);
|
||||||
|
|
||||||
virtual void activateQuickKey (int index);
|
virtual void activateQuickKey (int index);
|
||||||
|
|
||||||
|
|
|
@ -844,8 +844,8 @@ namespace MWInput
|
||||||
defaultKeyBindings[A_QuickKey8] = SDLK_8;
|
defaultKeyBindings[A_QuickKey8] = SDLK_8;
|
||||||
defaultKeyBindings[A_QuickKey9] = SDLK_9;
|
defaultKeyBindings[A_QuickKey9] = SDLK_9;
|
||||||
defaultKeyBindings[A_QuickKey10] = SDLK_0;
|
defaultKeyBindings[A_QuickKey10] = SDLK_0;
|
||||||
defaultKeyBindings[A_Screenshot] = SDLK_PRINTSCREEN;
|
defaultKeyBindings[A_Screenshot] = SDLK_F12;
|
||||||
defaultKeyBindings[A_ToggleHUD] = SDLK_F12;
|
defaultKeyBindings[A_ToggleHUD] = SDLK_F11;
|
||||||
defaultKeyBindings[A_AlwaysRun] = SDLK_y;
|
defaultKeyBindings[A_AlwaysRun] = SDLK_y;
|
||||||
|
|
||||||
std::map<int, int> defaultMouseButtonBindings;
|
std::map<int, int> defaultMouseButtonBindings;
|
||||||
|
@ -880,12 +880,20 @@ namespace MWInput
|
||||||
mInputBinder->addMouseButtonBinding (control, defaultMouseButtonBindings[i], ICS::Control::INCREASE);
|
mInputBinder->addMouseButtonBinding (control, defaultMouseButtonBindings[i], ICS::Control::INCREASE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Printscreen key should not be allowed because it's captured by system screenshot function
|
||||||
|
// We check this explicitely here to fix up pre-0.26 config files. Can be removed after a few versions
|
||||||
|
if (mInputBinder->getKeyBinding(mInputBinder->getControl(A_Screenshot), ICS::Control::INCREASE) == SDLK_PRINTSCREEN)
|
||||||
|
mInputBinder->addKeyBinding(mInputBinder->getControl(A_Screenshot), SDLK_F12, ICS::Control::INCREASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string InputManager::getActionDescription (int action)
|
std::string InputManager::getActionDescription (int action)
|
||||||
{
|
{
|
||||||
std::map<int, std::string> descriptions;
|
std::map<int, std::string> descriptions;
|
||||||
|
|
||||||
|
if (action == A_Screenshot)
|
||||||
|
return "Screenshot";
|
||||||
|
|
||||||
descriptions[A_Use] = "sUse";
|
descriptions[A_Use] = "sUse";
|
||||||
descriptions[A_Activate] = "sActivate";
|
descriptions[A_Activate] = "sActivate";
|
||||||
descriptions[A_MoveBackward] = "sBack";
|
descriptions[A_MoveBackward] = "sBack";
|
||||||
|
@ -958,6 +966,7 @@ namespace MWInput
|
||||||
ret.push_back(A_Journal);
|
ret.push_back(A_Journal);
|
||||||
ret.push_back(A_Rest);
|
ret.push_back(A_Rest);
|
||||||
ret.push_back(A_Console);
|
ret.push_back(A_Console);
|
||||||
|
ret.push_back(A_Screenshot);
|
||||||
ret.push_back(A_QuickKeysMenu);
|
ret.push_back(A_QuickKeysMenu);
|
||||||
ret.push_back(A_QuickKey1);
|
ret.push_back(A_QuickKey1);
|
||||||
ret.push_back(A_QuickKey2);
|
ret.push_back(A_QuickKey2);
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
AiEscort::AiEscort(const std::string &actorId, int duration, float x, float y, float z)
|
AiEscort::AiEscort(const std::string &actorId, int duration, float x, float y, float z)
|
||||||
: mActorId(actorId), mX(x), mY(y), mZ(z), mDuration(duration)
|
: mActorId(actorId), mX(x), mY(y), mZ(z), mDuration(duration)
|
||||||
|
, cellX(std::numeric_limits<int>::max())
|
||||||
|
, cellY(std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
mMaxDist = 470;
|
mMaxDist = 470;
|
||||||
|
|
||||||
|
@ -46,6 +48,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
AiEscort::AiEscort(const std::string &actorId, const std::string &cellId,int duration, float x, float y, float z)
|
AiEscort::AiEscort(const std::string &actorId, const std::string &cellId,int duration, float x, float y, float z)
|
||||||
: mActorId(actorId), mCellId(cellId), mX(x), mY(y), mZ(z), mDuration(duration)
|
: mActorId(actorId), mCellId(cellId), mX(x), mY(y), mZ(z), mDuration(duration)
|
||||||
|
, cellX(std::numeric_limits<int>::max())
|
||||||
|
, cellY(std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
mMaxDist = 470;
|
mMaxDist = 470;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#include "aipackage.hpp"
|
#include "aipackage.hpp"
|
||||||
|
|
||||||
|
#include "aiwander.hpp"
|
||||||
|
#include "aiescort.hpp"
|
||||||
|
#include "aitravel.hpp"
|
||||||
|
#include "aifollow.hpp"
|
||||||
|
#include "aiactivate.hpp"
|
||||||
|
|
||||||
void MWMechanics::AiSequence::copy (const AiSequence& sequence)
|
void MWMechanics::AiSequence::copy (const AiSequence& sequence)
|
||||||
{
|
{
|
||||||
for (std::list<AiPackage *>::const_iterator iter (sequence.mPackages.begin());
|
for (std::list<AiPackage *>::const_iterator iter (sequence.mPackages.begin());
|
||||||
|
@ -77,3 +83,40 @@ void MWMechanics::AiSequence::queue (const AiPackage& package)
|
||||||
{
|
{
|
||||||
mPackages.push_back (package.clone());
|
mPackages.push_back (package.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MWMechanics::AiSequence::fill(const ESM::AIPackageList &list)
|
||||||
|
{
|
||||||
|
for (std::vector<ESM::AIPackage>::const_iterator it = list.mList.begin(); it != list.mList.end(); ++it)
|
||||||
|
{
|
||||||
|
MWMechanics::AiPackage* package;
|
||||||
|
if (it->mType == ESM::AI_Wander)
|
||||||
|
{
|
||||||
|
ESM::AIWander data = it->mWander;
|
||||||
|
std::vector<int> idles;
|
||||||
|
for (int i=0; i<8; ++i)
|
||||||
|
idles.push_back(data.mIdle[i]);
|
||||||
|
package = new MWMechanics::AiWander(data.mDistance, data.mDuration, data.mTimeOfDay, idles, data.mUnk);
|
||||||
|
}
|
||||||
|
else if (it->mType == ESM::AI_Escort)
|
||||||
|
{
|
||||||
|
ESM::AITarget data = it->mTarget;
|
||||||
|
package = new MWMechanics::AiEscort(data.mId.toString(), data.mDuration, data.mX, data.mY, data.mZ);
|
||||||
|
}
|
||||||
|
else if (it->mType == ESM::AI_Travel)
|
||||||
|
{
|
||||||
|
ESM::AITravel data = it->mTravel;
|
||||||
|
package = new MWMechanics::AiTravel(data.mX, data.mY, data.mZ);
|
||||||
|
}
|
||||||
|
else if (it->mType == ESM::AI_Activate)
|
||||||
|
{
|
||||||
|
ESM::AIActivate data = it->mActivate;
|
||||||
|
package = new MWMechanics::AiActivate(data.mName.toString());
|
||||||
|
}
|
||||||
|
else //if (it->mType == ESM::AI_Follow)
|
||||||
|
{
|
||||||
|
ESM::AITarget data = it->mTarget;
|
||||||
|
package = new MWMechanics::AiFollow(data.mId.toString(), data.mDuration, data.mX, data.mY, data.mZ);
|
||||||
|
}
|
||||||
|
mPackages.push_back(package);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
#include <components/esm/loadnpc.hpp>
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Ptr;
|
class Ptr;
|
||||||
|
@ -48,6 +50,8 @@ namespace MWMechanics
|
||||||
void queue (const AiPackage& package);
|
void queue (const AiPackage& package);
|
||||||
///< Add \a package to the end of the sequence (executed after all other packages have been
|
///< Add \a package to the end of the sequence (executed after all other packages have been
|
||||||
/// completed)
|
/// completed)
|
||||||
|
|
||||||
|
void fill (const ESM::AIPackageList& list);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
AiTravel::AiTravel(float x, float y, float z)
|
AiTravel::AiTravel(float x, float y, float z)
|
||||||
: mX(x),mY(y),mZ(z),mPathFinder()
|
: mX(x),mY(y),mZ(z),mPathFinder()
|
||||||
|
, cellX(std::numeric_limits<int>::max())
|
||||||
|
, cellY(std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,13 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
AiWander::AiWander(int distance, int duration, int timeOfDay, const std::vector<int>& idle, bool repeat):
|
AiWander::AiWander(int distance, int duration, int timeOfDay, const std::vector<int>& idle, bool repeat):
|
||||||
mDistance(distance), mDuration(duration), mTimeOfDay(timeOfDay), mIdle(idle), mRepeat(repeat)
|
mDistance(distance), mDuration(duration), mTimeOfDay(timeOfDay), mIdle(idle), mRepeat(repeat)
|
||||||
|
, mCellX(std::numeric_limits<int>::max())
|
||||||
|
, mCellY(std::numeric_limits<int>::max())
|
||||||
|
, mXCell(0)
|
||||||
|
, mYCell(0)
|
||||||
|
, mX(0)
|
||||||
|
, mY(0)
|
||||||
|
, mZ(0)
|
||||||
{
|
{
|
||||||
for(unsigned short counter = 0; counter < mIdle.size(); counter++)
|
for(unsigned short counter = 0; counter < mIdle.size(); counter++)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +45,6 @@ namespace MWMechanics
|
||||||
if(mDuration == 0)
|
if(mDuration == 0)
|
||||||
mTimeOfDay = 0;
|
mTimeOfDay = 0;
|
||||||
|
|
||||||
srand(time(NULL));
|
|
||||||
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
||||||
mPlayedIdle = 0;
|
mPlayedIdle = 0;
|
||||||
mPathgrid = NULL;
|
mPathgrid = NULL;
|
||||||
|
@ -182,13 +188,13 @@ namespace MWMechanics
|
||||||
mPlayedIdle = 0;
|
mPlayedIdle = 0;
|
||||||
unsigned short idleRoll = 0;
|
unsigned short idleRoll = 0;
|
||||||
|
|
||||||
for(unsigned int counter = 1; counter < mIdle.size(); counter++)
|
for(unsigned int counter = 0; counter < mIdle.size(); counter++)
|
||||||
{
|
{
|
||||||
unsigned short idleChance = mIdleChanceMultiplier * mIdle[counter];
|
unsigned short idleChance = mIdleChanceMultiplier * mIdle[counter];
|
||||||
unsigned short randSelect = (int)(rand() / ((double)RAND_MAX + 1) * int(100 / mIdleChanceMultiplier));
|
unsigned short randSelect = (int)(rand() / ((double)RAND_MAX + 1) * int(100 / mIdleChanceMultiplier));
|
||||||
if(randSelect < idleChance && randSelect > idleRoll)
|
if(randSelect < idleChance && randSelect > idleRoll)
|
||||||
{
|
{
|
||||||
mPlayedIdle = counter;
|
mPlayedIdle = counter+2;
|
||||||
idleRoll = randSelect;
|
idleRoll = randSelect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +209,7 @@ namespace MWMechanics
|
||||||
// Play idle animation and recreate vanilla (broken?) behavior of resetting start time of AIWander:
|
// Play idle animation and recreate vanilla (broken?) behavior of resetting start time of AIWander:
|
||||||
MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
||||||
mStartTime = currentTime;
|
mStartTime = currentTime;
|
||||||
playIdle(actor, mPlayedIdle + 1);
|
playIdle(actor, mPlayedIdle);
|
||||||
mChooseAction = false;
|
mChooseAction = false;
|
||||||
mIdleNow = true;
|
mIdleNow = true;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +217,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
if(mIdleNow)
|
if(mIdleNow)
|
||||||
{
|
{
|
||||||
if(!checkIdle(actor, mPlayedIdle + 1))
|
if(!checkIdle(actor, mPlayedIdle))
|
||||||
{
|
{
|
||||||
mPlayedIdle = 0;
|
mPlayedIdle = 0;
|
||||||
mIdleNow = false;
|
mIdleNow = false;
|
||||||
|
|
|
@ -501,9 +501,12 @@ bool CharacterController::updateNpcState()
|
||||||
if(mAttackType != "shoot")
|
if(mAttackType != "shoot")
|
||||||
{
|
{
|
||||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
// NOTE: SwishL, SwishM, SwishS - large, medium, small.
|
if(complete < 0.5f)
|
||||||
// Based on weapon weight, speed, or attack strength?
|
sndMgr->playSound3D(mPtr, "SwishM", 1.0f, 0.8f); //Weak attack
|
||||||
sndMgr->playSound3D(mPtr, "SwishL", 1.0f, 1.0f);
|
else if(complete < 1.0f)
|
||||||
|
sndMgr->playSound3D(mPtr, "SwishM", 1.0f, 1.0f); //Medium attack
|
||||||
|
else
|
||||||
|
sndMgr->playSound3D(mPtr, "SwishM", 1.0f, 1.2f); //Strong attack
|
||||||
}
|
}
|
||||||
stats.setAttackStrength(complete);
|
stats.setAttackStrength(complete);
|
||||||
|
|
||||||
|
@ -560,10 +563,18 @@ bool CharacterController::updateNpcState()
|
||||||
weapSpeed, mAttackType+" follow start", mAttackType+" follow stop",
|
weapSpeed, mAttackType+" follow start", mAttackType+" follow stop",
|
||||||
0.0f, 0);
|
0.0f, 0);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
float str = stats.getAttackStrength();
|
||||||
|
std::string start = mAttackType+((str < 0.5f) ? " small follow start"
|
||||||
|
: (str < 1.0f) ? " medium follow start"
|
||||||
|
: " large follow start");
|
||||||
|
std::string stop = mAttackType+((str < 0.5f) ? " small follow stop"
|
||||||
|
: (str < 1.0f) ? " medium follow stop"
|
||||||
|
: " large follow stop");
|
||||||
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
MWRender::Animation::Group_UpperBody, true,
|
MWRender::Animation::Group_UpperBody, true,
|
||||||
weapSpeed, mAttackType+" large follow start", mAttackType+" large follow stop",
|
weapSpeed, start, stop, 0.0f, 0);
|
||||||
0.0f, 0);
|
}
|
||||||
mUpperBodyState = UpperCharState_FollowStartToFollowStop;
|
mUpperBodyState = UpperCharState_FollowStartToFollowStop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,7 +710,7 @@ void CharacterController::update(float duration, Movement &movement)
|
||||||
if(movestate != CharState_None)
|
if(movestate != CharState_None)
|
||||||
clearAnimQueue();
|
clearAnimQueue();
|
||||||
|
|
||||||
if(mAnimQueue.size() == 0)
|
if(mAnimQueue.empty())
|
||||||
idlestate = (inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle));
|
idlestate = (inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle));
|
||||||
else if(mAnimQueue.size() > 1)
|
else if(mAnimQueue.size() > 1)
|
||||||
{
|
{
|
||||||
|
@ -765,7 +776,7 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
count = std::max(count, 1);
|
count = std::max(count, 1);
|
||||||
if(mode != 0 || mAnimQueue.size() == 0)
|
if(mode != 0 || mAnimQueue.empty())
|
||||||
{
|
{
|
||||||
clearAnimQueue();
|
clearAnimQueue();
|
||||||
mAnimQueue.push_back(std::make_pair(groupname, count-1));
|
mAnimQueue.push_back(std::make_pair(groupname, count-1));
|
||||||
|
@ -801,7 +812,7 @@ bool CharacterController::isAnimPlaying(const std::string &groupName)
|
||||||
|
|
||||||
void CharacterController::clearAnimQueue()
|
void CharacterController::clearAnimQueue()
|
||||||
{
|
{
|
||||||
if(mAnimQueue.size() > 0)
|
if(!mAnimQueue.empty())
|
||||||
mAnimation->disable(mAnimQueue.front().first);
|
mAnimation->disable(mAnimQueue.front().first);
|
||||||
mAnimQueue.clear();
|
mAnimQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace MWMechanics
|
||||||
: mLevel (0), mLevelHealthBonus(0.f), mDead (false), mDied (false), mFriendlyHits (0),
|
: mLevel (0), mLevelHealthBonus(0.f), mDead (false), mDied (false), mFriendlyHits (0),
|
||||||
mTalkedTo (false), mAlarmed (false),
|
mTalkedTo (false), mAlarmed (false),
|
||||||
mAttacked (false), mHostile (false),
|
mAttacked (false), mHostile (false),
|
||||||
mAttackingOrSpell(false)
|
mAttackingOrSpell(false), mAttackType(AT_Chop)
|
||||||
{
|
{
|
||||||
for (int i=0; i<4; ++i)
|
for (int i=0; i<4; ++i)
|
||||||
mAiSettings[i] = 0;
|
mAiSettings[i] = 0;
|
||||||
|
@ -319,6 +319,16 @@ namespace MWMechanics
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CreatureStats::getEvasion() const
|
||||||
|
{
|
||||||
|
float evasion = (getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
|
||||||
|
(getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
|
||||||
|
evasion *= getFatigueTerm();
|
||||||
|
evasion += mMagicEffects.get(EffectKey(ESM::MagicEffect::Sanctuary)).mMagnitude;
|
||||||
|
|
||||||
|
return evasion;
|
||||||
|
}
|
||||||
|
|
||||||
void CreatureStats::setLastHitObject(const std::string& objectid)
|
void CreatureStats::setLastHitObject(const std::string& objectid)
|
||||||
{
|
{
|
||||||
mLastHitObject = objectid;
|
mLastHitObject = objectid;
|
||||||
|
|
|
@ -158,6 +158,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool getCreatureTargetted() const;
|
bool getCreatureTargetted() const;
|
||||||
|
|
||||||
|
float getEvasion() const;
|
||||||
|
|
||||||
void setLastHitObject(const std::string &objectid);
|
void setLastHitObject(const std::string &objectid);
|
||||||
const std::string &getLastHitObject() const;
|
const std::string &getLastHitObject() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,10 @@
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
Enchanting::Enchanting():
|
Enchanting::Enchanting()
|
||||||
mCastStyle(ESM::Enchantment::CastOnce)
|
: mCastStyle(ESM::Enchantment::CastOnce)
|
||||||
|
, mSelfEnchanting(false)
|
||||||
|
, mOldItemCount(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
||||||
|
|
|
@ -416,7 +416,7 @@ namespace MWMechanics
|
||||||
if (playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction)) != playerNpcStats.getFactionRanks().end())
|
if (playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction)) != playerNpcStats.getFactionRanks().end())
|
||||||
{
|
{
|
||||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin();
|
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin();
|
||||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); it++)
|
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); ++it)
|
||||||
{
|
{
|
||||||
if(Misc::StringUtils::lowerCase(it->mFaction) == Misc::StringUtils::lowerCase(npcFaction)) reaction = it->mReaction;
|
if(Misc::StringUtils::lowerCase(it->mFaction) == Misc::StringUtils::lowerCase(npcFaction)) reaction = it->mReaction;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ namespace MWMechanics
|
||||||
else if (npcFaction != "")
|
else if (npcFaction != "")
|
||||||
{
|
{
|
||||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin();
|
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin();
|
||||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end();it++)
|
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end();++it)
|
||||||
{
|
{
|
||||||
if(playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(it->mFaction)) != playerNpcStats.getFactionRanks().end() )
|
if(playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(it->mFaction)) != playerNpcStats.getFactionRanks().end() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace
|
||||||
boost::predecessor_map(&p[0]).distance_map(&d[0]).visitor(goalVisited(end)));
|
boost::predecessor_map(&p[0]).distance_map(&d[0]).visitor(goalVisited(end)));
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(found_path fg)
|
catch(found_path& fg)
|
||||||
{
|
{
|
||||||
for(PointID v = end; ; v = p[v])
|
for(PointID v = end; ; v = p[v])
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace MWRender
|
||||||
Actors(OEngine::Render::OgreRenderer& _rend, MWRender::RenderingManager* rendering)
|
Actors(OEngine::Render::OgreRenderer& _rend, MWRender::RenderingManager* rendering)
|
||||||
: mRend(_rend)
|
: mRend(_rend)
|
||||||
, mRendering(rendering)
|
, mRendering(rendering)
|
||||||
|
, mRootNode(NULL)
|
||||||
{}
|
{}
|
||||||
~Actors();
|
~Actors();
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ Animation::~Animation()
|
||||||
|
|
||||||
void Animation::setObjectRoot(Ogre::SceneNode *node, const std::string &model, bool baseonly)
|
void Animation::setObjectRoot(Ogre::SceneNode *node, const std::string &model, bool baseonly)
|
||||||
{
|
{
|
||||||
OgreAssert(mAnimSources.size() == 0, "Setting object root while animation sources are set!");
|
OgreAssert(mAnimSources.empty(), "Setting object root while animation sources are set!");
|
||||||
if(!mInsert)
|
if(!mInsert)
|
||||||
mInsert = node->createChildSceneNode();
|
mInsert = node->createChildSceneNode();
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void Animation::setObjectRoot(Ogre::SceneNode *node, const std::string &model, b
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mSkelBase->attachObjectToBone(iter->second, iter->first);
|
mSkelBase->attachObjectToBone(iter->second, iter->first);
|
||||||
iter++;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void Animation::addAnimSource(const std::string &model)
|
||||||
std::vector<Ogre::Controller<Ogre::Real> > ctrls;
|
std::vector<Ogre::Controller<Ogre::Real> > ctrls;
|
||||||
Ogre::SharedPtr<AnimSource> animsrc(OGRE_NEW AnimSource);
|
Ogre::SharedPtr<AnimSource> animsrc(OGRE_NEW AnimSource);
|
||||||
NifOgre::Loader::createKfControllers(mSkelBase, kfname, animsrc->mTextKeys, ctrls);
|
NifOgre::Loader::createKfControllers(mSkelBase, kfname, animsrc->mTextKeys, ctrls);
|
||||||
if(animsrc->mTextKeys.size() == 0 || ctrls.size() == 0)
|
if(animsrc->mTextKeys.empty() || ctrls.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mAnimSources.push_back(animsrc);
|
mAnimSources.push_back(animsrc);
|
||||||
|
@ -497,7 +497,7 @@ bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const s
|
||||||
|
|
||||||
void Animation::handleTextKey(AnimState &state, const std::string &groupname, const NifOgre::TextKeyMap::const_iterator &key)
|
void Animation::handleTextKey(AnimState &state, const std::string &groupname, const NifOgre::TextKeyMap::const_iterator &key)
|
||||||
{
|
{
|
||||||
float time = key->first;
|
//float time = key->first;
|
||||||
const std::string &evt = key->second;
|
const std::string &evt = key->second;
|
||||||
|
|
||||||
if(evt.compare(0, 7, "sound: ") == 0)
|
if(evt.compare(0, 7, "sound: ") == 0)
|
||||||
|
@ -550,7 +550,7 @@ void Animation::handleTextKey(AnimState &state, const std::string &groupname, co
|
||||||
|
|
||||||
void Animation::play(const std::string &groupname, int priority, int groups, bool autodisable, float speedmult, const std::string &start, const std::string &stop, float startpoint, size_t loops)
|
void Animation::play(const std::string &groupname, int priority, int groups, bool autodisable, float speedmult, const std::string &start, const std::string &stop, float startpoint, size_t loops)
|
||||||
{
|
{
|
||||||
if(!mSkelBase || mAnimSources.size() == 0)
|
if(!mSkelBase || mAnimSources.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(groupname.empty())
|
if(groupname.empty())
|
||||||
|
@ -567,7 +567,7 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo
|
||||||
if(stateiter->second.mPriority == priority)
|
if(stateiter->second.mPriority == priority)
|
||||||
mStates.erase(stateiter++);
|
mStates.erase(stateiter++);
|
||||||
else
|
else
|
||||||
stateiter++;
|
++stateiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
stateiter = mStates.find(groupname);
|
stateiter = mStates.find(groupname);
|
||||||
|
@ -642,7 +642,7 @@ void Animation::resetActiveGroups()
|
||||||
AnimStateMap::const_iterator active = mStates.end();
|
AnimStateMap::const_iterator active = mStates.end();
|
||||||
|
|
||||||
AnimStateMap::const_iterator state = mStates.begin();
|
AnimStateMap::const_iterator state = mStates.begin();
|
||||||
for(;state != mStates.end();state++)
|
for(;state != mStates.end();++state)
|
||||||
{
|
{
|
||||||
if(!(state->second.mGroups&(1<<grp)))
|
if(!(state->second.mGroups&(1<<grp)))
|
||||||
continue;
|
continue;
|
||||||
|
@ -773,7 +773,7 @@ Ogre::Vector3 Animation::runAnimation(float duration)
|
||||||
resetActiveGroups();
|
resetActiveGroups();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stateiter++;
|
++stateiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i = 0;i < mObjectRoot.mControllers.size();i++)
|
for(size_t i = 0;i < mObjectRoot.mControllers.size();i++)
|
||||||
|
|
|
@ -36,6 +36,8 @@ namespace MWRender
|
||||||
|
|
||||||
mPreviewCam.yaw = 0.f;
|
mPreviewCam.yaw = 0.f;
|
||||||
mPreviewCam.offset = 400.f;
|
mPreviewCam.offset = 400.f;
|
||||||
|
mMainCam.yaw = 0.f;
|
||||||
|
mMainCam.offset = 400.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera::~Camera()
|
Camera::~Camera()
|
||||||
|
@ -99,9 +101,11 @@ namespace MWRender
|
||||||
MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir, up);
|
MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir, up);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::update(float duration)
|
void Camera::update(float duration, bool paused)
|
||||||
{
|
{
|
||||||
updateListener();
|
updateListener();
|
||||||
|
if (paused)
|
||||||
|
return;
|
||||||
|
|
||||||
// only show the crosshair in game mode and in first person mode.
|
// only show the crosshair in game mode and in first person mode.
|
||||||
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace MWRender
|
||||||
|
|
||||||
void processViewChange();
|
void processViewChange();
|
||||||
|
|
||||||
void update(float duration);
|
void update(float duration, bool paused=false);
|
||||||
|
|
||||||
/// Set camera distance for current mode. Don't work on 1st person view.
|
/// Set camera distance for current mode. Don't work on 1st person view.
|
||||||
/// \param adjust Indicates should distance be adjusted or set.
|
/// \param adjust Indicates should distance be adjusted or set.
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace MWRender
|
||||||
|
|
||||||
CharacterPreview::CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name,
|
CharacterPreview::CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name,
|
||||||
Ogre::Vector3 position, Ogre::Vector3 lookAt)
|
Ogre::Vector3 position, Ogre::Vector3 lookAt)
|
||||||
|
|
||||||
: mSceneMgr (0)
|
: mSceneMgr (0)
|
||||||
, mPosition(position)
|
, mPosition(position)
|
||||||
, mLookAt(lookAt)
|
, mLookAt(lookAt)
|
||||||
|
@ -31,6 +30,10 @@ namespace MWRender
|
||||||
, mName(name)
|
, mName(name)
|
||||||
, mSizeX(sizeX)
|
, mSizeX(sizeX)
|
||||||
, mSizeY(sizeY)
|
, mSizeY(sizeY)
|
||||||
|
, mRenderTarget(NULL)
|
||||||
|
, mViewport(NULL)
|
||||||
|
, mCamera(NULL)
|
||||||
|
, mNode(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace MWRender
|
||||||
: mCacheDir(cacheDir)
|
: mCacheDir(cacheDir)
|
||||||
, mMinX(0), mMaxX(0)
|
, mMinX(0), mMaxX(0)
|
||||||
, mMinY(0), mMaxY(0)
|
, mMinY(0), mMaxY(0)
|
||||||
|
, mWidth(0)
|
||||||
|
, mHeight(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,15 +93,13 @@ namespace MWRender
|
||||||
Ogre::ColourValue mountainColour(0.05, 0.05, 0.05);
|
Ogre::ColourValue mountainColour(0.05, 0.05, 0.05);
|
||||||
Ogre::ColourValue hillColour(0.16, 0.12, 0.08);
|
Ogre::ColourValue hillColour(0.16, 0.12, 0.08);
|
||||||
|
|
||||||
float mountainHeight = 15000.f;
|
|
||||||
float hillHeight = 2500.f;
|
|
||||||
|
|
||||||
unsigned char r,g,b;
|
unsigned char r,g,b;
|
||||||
|
|
||||||
if (land)
|
if (land)
|
||||||
{
|
{
|
||||||
float landHeight = land->mLandData->mHeights[vertexY * ESM::Land::LAND_SIZE + vertexX];
|
const float landHeight = land->mLandData->mHeights[vertexY * ESM::Land::LAND_SIZE + vertexX];
|
||||||
|
const float mountainHeight = 15000.f;
|
||||||
|
const float hillHeight = 2500.f;
|
||||||
|
|
||||||
if (landHeight >= 0)
|
if (landHeight >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -286,7 +286,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||||
{
|
{
|
||||||
typedef std::multimap<ESM::BodyPart::MeshPart,ESM::PartReferenceType> BodyPartMapType;
|
typedef std::multimap<ESM::BodyPart::MeshPart,ESM::PartReferenceType> BodyPartMapType;
|
||||||
static BodyPartMapType sBodyPartMap;
|
static BodyPartMapType sBodyPartMap;
|
||||||
if(sBodyPartMap.size() == 0)
|
if(sBodyPartMap.empty())
|
||||||
{
|
{
|
||||||
sBodyPartMap.insert(std::make_pair(ESM::BodyPart::MP_Neck, ESM::PRT_Neck));
|
sBodyPartMap.insert(std::make_pair(ESM::BodyPart::MP_Neck, ESM::PRT_Neck));
|
||||||
sBodyPartMap.insert(std::make_pair(ESM::BodyPart::MP_Chest, ESM::PRT_Cuirass));
|
sBodyPartMap.insert(std::make_pair(ESM::BodyPart::MP_Chest, ESM::PRT_Cuirass));
|
||||||
|
@ -345,7 +345,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||||
{
|
{
|
||||||
if(!parts[bIt->second])
|
if(!parts[bIt->second])
|
||||||
parts[bIt->second] = &*it;
|
parts[bIt->second] = &*it;
|
||||||
bIt++;
|
++bIt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -354,7 +354,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||||
while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart)
|
while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart)
|
||||||
{
|
{
|
||||||
parts[bIt->second] = &*it;
|
parts[bIt->second] = &*it;
|
||||||
bIt++;
|
++bIt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") ||
|
if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") ||
|
||||||
anyTransparency || objects.mParticles.size() > 0)
|
anyTransparency || !objects.mParticles.empty())
|
||||||
{
|
{
|
||||||
for(size_t i = 0;i < objects.mEntities.size();i++)
|
for(size_t i = 0;i < objects.mEntities.size();i++)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool
|
||||||
|
|
||||||
(*iter)->detachFromParent();
|
(*iter)->detachFromParent();
|
||||||
mRenderer.getScene()->destroyEntity(*iter);
|
mRenderer.getScene()->destroyEntity(*iter);
|
||||||
iter++;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,12 @@ class Objects{
|
||||||
///< Remove all movable objects from \a node.
|
///< Remove all movable objects from \a node.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Objects(OEngine::Render::OgreRenderer& renderer, MWWorld::Fallback* fallback): mRenderer (renderer), mIsStatic(false), mFallback(fallback) {}
|
Objects(OEngine::Render::OgreRenderer& renderer, MWWorld::Fallback* fallback)
|
||||||
|
: mRenderer (renderer)
|
||||||
|
, mIsStatic(false)
|
||||||
|
, mFallback(fallback)
|
||||||
|
, mRootNode(NULL)
|
||||||
|
{}
|
||||||
~Objects(){}
|
~Objects(){}
|
||||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||||
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool light=false);
|
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool light=false);
|
||||||
|
|
|
@ -32,7 +32,7 @@ OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNod
|
||||||
|
|
||||||
mSupported = (mSunTotalAreaQuery != 0) && (mSunVisibleAreaQuery != 0);
|
mSupported = (mSunTotalAreaQuery != 0) && (mSunVisibleAreaQuery != 0);
|
||||||
}
|
}
|
||||||
catch (Ogre::Exception e)
|
catch (Ogre::Exception& e)
|
||||||
{
|
{
|
||||||
mSupported = false;
|
mSupported = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,11 +351,11 @@ void RenderingManager::update (float duration, bool paused)
|
||||||
|
|
||||||
applyFog(world->isUnderwater(player.getCell(), cam));
|
applyFog(world->isUnderwater(player.getCell(), cam));
|
||||||
|
|
||||||
|
mCamera->update(duration, paused);
|
||||||
|
|
||||||
if(paused)
|
if(paused)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mCamera->update(duration);
|
|
||||||
|
|
||||||
mActors.update (duration);
|
mActors.update (duration);
|
||||||
mObjects.update (duration);
|
mObjects.update (duration);
|
||||||
|
|
||||||
|
|
|
@ -1042,6 +1042,8 @@ VideoPlayer::VideoPlayer(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* windo
|
||||||
, mNode(NULL)
|
, mNode(NULL)
|
||||||
, mAllowSkipping(false)
|
, mAllowSkipping(false)
|
||||||
, mWindow(window)
|
, mWindow(window)
|
||||||
|
, mWidth(0)
|
||||||
|
, mHeight(0)
|
||||||
{
|
{
|
||||||
mVideoMaterial = Ogre::MaterialManager::getSingleton().getByName("VideoMaterial", "General");
|
mVideoMaterial = Ogre::MaterialManager::getSingleton().getByName("VideoMaterial", "General");
|
||||||
if (mVideoMaterial.isNull ())
|
if (mVideoMaterial.isNull ())
|
||||||
|
|
|
@ -43,6 +43,8 @@ namespace MWRender {
|
||||||
Reflection(Ogre::SceneManager* sceneManager)
|
Reflection(Ogre::SceneManager* sceneManager)
|
||||||
: mSceneMgr(sceneManager)
|
: mSceneMgr(sceneManager)
|
||||||
, mIsUnderwater(false)
|
, mIsUnderwater(false)
|
||||||
|
, mCamera(NULL)
|
||||||
|
, mParentCamera(NULL)
|
||||||
{}
|
{}
|
||||||
virtual ~Reflection() {}
|
virtual ~Reflection() {}
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ namespace MWScript
|
||||||
|
|
||||||
std::map<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
|
std::map<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
|
||||||
|
|
||||||
if (ranks.size())
|
if (!ranks.empty())
|
||||||
{
|
{
|
||||||
std::map<std::string, int>::const_iterator it = ranks.begin();
|
std::map<std::string, int>::const_iterator it = ranks.begin();
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ struct OpenAL_Output::StreamThread {
|
||||||
if((*iter)->process() == false)
|
if((*iter)->process() == false)
|
||||||
iter = mStreams.erase(iter);
|
iter = mStreams.erase(iter);
|
||||||
else
|
else
|
||||||
iter++;
|
++iter;
|
||||||
}
|
}
|
||||||
mMutex.unlock();
|
mMutex.unlock();
|
||||||
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
||||||
|
@ -491,6 +491,7 @@ public:
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
virtual bool isPlaying();
|
virtual bool isPlaying();
|
||||||
virtual double getTimeOffset();
|
virtual double getTimeOffset();
|
||||||
|
virtual double getLength();
|
||||||
virtual void update();
|
virtual void update();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -554,6 +555,17 @@ double OpenAL_Sound::getTimeOffset()
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double OpenAL_Sound::getLength()
|
||||||
|
{
|
||||||
|
ALint bufferSize, frequency, channels, bitsPerSample;
|
||||||
|
alGetBufferi(mBuffer, AL_SIZE, &bufferSize);
|
||||||
|
alGetBufferi(mBuffer, AL_FREQUENCY, &frequency);
|
||||||
|
alGetBufferi(mBuffer, AL_CHANNELS, &channels);
|
||||||
|
alGetBufferi(mBuffer, AL_BITS, &bitsPerSample);
|
||||||
|
|
||||||
|
return (8.0*bufferSize)/(frequency*channels*bitsPerSample);
|
||||||
|
}
|
||||||
|
|
||||||
void OpenAL_Sound::updateAll(bool local)
|
void OpenAL_Sound::updateAll(bool local)
|
||||||
{
|
{
|
||||||
alSourcef(mSource, AL_REFERENCE_DISTANCE, mMinDistance);
|
alSourcef(mSource, AL_REFERENCE_DISTANCE, mMinDistance);
|
||||||
|
@ -797,7 +809,7 @@ ALuint OpenAL_Output::getBuffer(const std::string &fname)
|
||||||
if(nameiter->second == oldbuf)
|
if(nameiter->second == oldbuf)
|
||||||
mBufferCache.erase(nameiter++);
|
mBufferCache.erase(nameiter++);
|
||||||
else
|
else
|
||||||
nameiter++;
|
++nameiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
bufsize = 0;
|
bufsize = 0;
|
||||||
|
@ -817,8 +829,7 @@ void OpenAL_Output::bufferFinished(ALuint buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWBase::SoundPtr OpenAL_Output::playSound(const std::string &fname, float vol, float basevol, float pitch, int flags,float offset)
|
||||||
MWBase::SoundPtr OpenAL_Output::playSound(const std::string &fname, float vol, float basevol, float pitch, int flags)
|
|
||||||
{
|
{
|
||||||
boost::shared_ptr<OpenAL_Sound> sound;
|
boost::shared_ptr<OpenAL_Sound> sound;
|
||||||
ALuint src=0, buf=0;
|
ALuint src=0, buf=0;
|
||||||
|
@ -843,8 +854,13 @@ MWBase::SoundPtr OpenAL_Output::playSound(const std::string &fname, float vol, f
|
||||||
}
|
}
|
||||||
|
|
||||||
sound->updateAll(true);
|
sound->updateAll(true);
|
||||||
|
if(offset<0)
|
||||||
|
offset=0;
|
||||||
|
if(offset>1)
|
||||||
|
offset=1;
|
||||||
|
|
||||||
alSourcei(src, AL_BUFFER, buf);
|
alSourcei(src, AL_BUFFER, buf);
|
||||||
|
alSourcef(src, AL_SEC_OFFSET, sound->getLength()*offset/pitch);
|
||||||
alSourcePlay(src);
|
alSourcePlay(src);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
|
@ -852,7 +868,7 @@ MWBase::SoundPtr OpenAL_Output::playSound(const std::string &fname, float vol, f
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::SoundPtr OpenAL_Output::playSound3D(const std::string &fname, const Ogre::Vector3 &pos, float vol, float basevol, float pitch,
|
MWBase::SoundPtr OpenAL_Output::playSound3D(const std::string &fname, const Ogre::Vector3 &pos, float vol, float basevol, float pitch,
|
||||||
float min, float max, int flags)
|
float min, float max, int flags, float offset)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<OpenAL_Sound> sound;
|
boost::shared_ptr<OpenAL_Sound> sound;
|
||||||
ALuint src=0, buf=0;
|
ALuint src=0, buf=0;
|
||||||
|
@ -878,7 +894,14 @@ MWBase::SoundPtr OpenAL_Output::playSound3D(const std::string &fname, const Ogre
|
||||||
|
|
||||||
sound->updateAll(false);
|
sound->updateAll(false);
|
||||||
|
|
||||||
|
if(offset<0)
|
||||||
|
offset=0;
|
||||||
|
if(offset>1)
|
||||||
|
offset=1;
|
||||||
|
|
||||||
alSourcei(src, AL_BUFFER, buf);
|
alSourcei(src, AL_BUFFER, buf);
|
||||||
|
alSourcef(src, AL_SEC_OFFSET, sound->getLength()*offset/pitch);
|
||||||
|
|
||||||
alSourcePlay(src);
|
alSourcePlay(src);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
|
@ -951,9 +974,9 @@ void OpenAL_Output::pauseSounds(int types)
|
||||||
if(sound && sound->mSource && (sound->getPlayType()&types))
|
if(sound && sound->mSource && (sound->getPlayType()&types))
|
||||||
sources.push_back(sound->mSource);
|
sources.push_back(sound->mSource);
|
||||||
}
|
}
|
||||||
iter++;
|
++iter;
|
||||||
}
|
}
|
||||||
if(sources.size() > 0)
|
if(!sources.empty())
|
||||||
{
|
{
|
||||||
alSourcePausev(sources.size(), &sources[0]);
|
alSourcePausev(sources.size(), &sources[0]);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
@ -978,9 +1001,9 @@ void OpenAL_Output::resumeSounds(int types)
|
||||||
if(sound && sound->mSource && (sound->getPlayType()&types))
|
if(sound && sound->mSource && (sound->getPlayType()&types))
|
||||||
sources.push_back(sound->mSource);
|
sources.push_back(sound->mSource);
|
||||||
}
|
}
|
||||||
iter++;
|
++iter;
|
||||||
}
|
}
|
||||||
if(sources.size() > 0)
|
if(!sources.empty())
|
||||||
{
|
{
|
||||||
alSourcePlayv(sources.size(), &sources[0]);
|
alSourcePlayv(sources.size(), &sources[0]);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
|
@ -45,9 +45,11 @@ namespace MWSound
|
||||||
virtual void init(const std::string &devname="");
|
virtual void init(const std::string &devname="");
|
||||||
virtual void deinit();
|
virtual void deinit();
|
||||||
|
|
||||||
virtual MWBase::SoundPtr playSound(const std::string &fname, float vol, float basevol, float pitch, int flags);
|
/// @param offset Value from [0,1] meaning from which fraction the sound the playback starts.
|
||||||
|
virtual MWBase::SoundPtr playSound(const std::string &fname, float vol, float basevol, float pitch, int flags, float offset);
|
||||||
|
/// @param offset Value from [0,1] meaning from which fraction the sound the playback starts.
|
||||||
virtual MWBase::SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
virtual MWBase::SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
||||||
float vol, float basevol, float pitch, float min, float max, int flags);
|
float vol, float basevol, float pitch, float min, float max, int flags, float offset);
|
||||||
virtual MWBase::SoundPtr streamSound(DecoderPtr decoder, float volume, float pitch, int flags);
|
virtual MWBase::SoundPtr streamSound(DecoderPtr decoder, float volume, float pitch, int flags);
|
||||||
|
|
||||||
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir, Environment env);
|
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir, Environment env);
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace MWSound
|
||||||
float mMinDistance;
|
float mMinDistance;
|
||||||
float mMaxDistance;
|
float mMaxDistance;
|
||||||
int mFlags;
|
int mFlags;
|
||||||
|
float mFadeOutTime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void stop() = 0;
|
virtual void stop() = 0;
|
||||||
|
@ -29,7 +30,7 @@ namespace MWSound
|
||||||
virtual double getTimeOffset() = 0;
|
virtual double getTimeOffset() = 0;
|
||||||
void setPosition(const Ogre::Vector3 &pos) { mPos = pos; }
|
void setPosition(const Ogre::Vector3 &pos) { mPos = pos; }
|
||||||
void setVolume(float volume) { mVolume = volume; }
|
void setVolume(float volume) { mVolume = volume; }
|
||||||
|
void setFadeout(float duration) { mFadeOutTime=duration; }
|
||||||
MWBase::SoundManager::PlayType getPlayType() const
|
MWBase::SoundManager::PlayType getPlayType() const
|
||||||
{ return (MWBase::SoundManager::PlayType)(mFlags&MWBase::SoundManager::Play_TypeMask); }
|
{ return (MWBase::SoundManager::PlayType)(mFlags&MWBase::SoundManager::Play_TypeMask); }
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ namespace MWSound
|
||||||
, mMinDistance(mindist)
|
, mMinDistance(mindist)
|
||||||
, mMaxDistance(maxdist)
|
, mMaxDistance(maxdist)
|
||||||
, mFlags(flags)
|
, mFlags(flags)
|
||||||
|
, mFadeOutTime(0)
|
||||||
{ }
|
{ }
|
||||||
virtual ~Sound() { }
|
virtual ~Sound() { }
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,11 @@ namespace MWSound
|
||||||
virtual void init(const std::string &devname="") = 0;
|
virtual void init(const std::string &devname="") = 0;
|
||||||
virtual void deinit() = 0;
|
virtual void deinit() = 0;
|
||||||
|
|
||||||
virtual MWBase::SoundPtr playSound(const std::string &fname, float vol, float basevol, float pitch, int flags) = 0;
|
/// @param offset Value from [0,1] meaning from which fraction the sound the playback starts.
|
||||||
|
virtual MWBase::SoundPtr playSound(const std::string &fname, float vol, float basevol, float pitch, int flags, float offset) = 0;
|
||||||
|
/// @param offset Value from [0,1] meaning from which fraction the sound the playback starts.
|
||||||
virtual MWBase::SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
virtual MWBase::SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
||||||
float vol, float basevol, float pitch, float min, float max, int flags) = 0;
|
float vol, float basevol, float pitch, float min, float max, int flags, float offset) = 0;
|
||||||
virtual MWBase::SoundPtr streamSound(DecoderPtr decoder, float volume, float pitch, int flags) = 0;
|
virtual MWBase::SoundPtr streamSound(DecoderPtr decoder, float volume, float pitch, int flags) = 0;
|
||||||
|
|
||||||
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir, Environment env) = 0;
|
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir, Environment env) = 0;
|
||||||
|
|
|
@ -53,6 +53,9 @@ namespace MWSound
|
||||||
, mFootstepsVolume(1.0f)
|
, mFootstepsVolume(1.0f)
|
||||||
, mVoiceVolume(1.0f)
|
, mVoiceVolume(1.0f)
|
||||||
, mPausedSoundTypes(0)
|
, mPausedSoundTypes(0)
|
||||||
|
, mListenerPos(0,0,0)
|
||||||
|
, mListenerDir(1,0,0)
|
||||||
|
, mListenerUp(0,0,1)
|
||||||
{
|
{
|
||||||
if(!useSound)
|
if(!useSound)
|
||||||
return;
|
return;
|
||||||
|
@ -170,7 +173,7 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
if(snditer->second.first == ptr && snditer->second.second == id)
|
if(snditer->second.first == ptr && snditer->second.second == id)
|
||||||
return snditer->first->isPlaying();
|
return snditer->first->isPlaying();
|
||||||
snditer++;
|
++snditer;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +255,7 @@ namespace MWSound
|
||||||
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
||||||
|
|
||||||
MWBase::SoundPtr sound = mOutput->playSound3D(filePath, objpos, 1.0f, basevol, 1.0f,
|
MWBase::SoundPtr sound = mOutput->playSound3D(filePath, objpos, 1.0f, basevol, 1.0f,
|
||||||
20.0f, 12750.0f, Play_Normal|Play_TypeVoice);
|
20.0f, 12750.0f, Play_Normal|Play_TypeVoice, 0);
|
||||||
mActiveSounds[sound] = std::make_pair(ptr, std::string("_say_sound"));
|
mActiveSounds[sound] = std::make_pair(ptr, std::string("_say_sound"));
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
|
@ -270,7 +273,7 @@ namespace MWSound
|
||||||
float basevol = volumeFromType(Play_TypeVoice);
|
float basevol = volumeFromType(Play_TypeVoice);
|
||||||
std::string filePath = "Sound/"+filename;
|
std::string filePath = "Sound/"+filename;
|
||||||
|
|
||||||
MWBase::SoundPtr sound = mOutput->playSound(filePath, 1.0f, basevol, 1.0f, Play_Normal|Play_TypeVoice);
|
MWBase::SoundPtr sound = mOutput->playSound(filePath, 1.0f, basevol, 1.0f, Play_Normal|Play_TypeVoice, 0);
|
||||||
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), std::string("_say_sound"));
|
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), std::string("_say_sound"));
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
|
@ -295,7 +298,7 @@ namespace MWSound
|
||||||
mActiveSounds.erase(snditer++);
|
mActiveSounds.erase(snditer++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
snditer++;
|
++snditer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +320,7 @@ namespace MWSound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MWBase::SoundPtr SoundManager::playSound(const std::string& soundId, float volume, float pitch, PlayType type, PlayMode mode)
|
MWBase::SoundPtr SoundManager::playSound(const std::string& soundId, float volume, float pitch, PlayType type, PlayMode mode, float offset)
|
||||||
{
|
{
|
||||||
MWBase::SoundPtr sound;
|
MWBase::SoundPtr sound;
|
||||||
if(!mOutput->isInitialized())
|
if(!mOutput->isInitialized())
|
||||||
|
@ -328,7 +331,7 @@ namespace MWSound
|
||||||
float min, max;
|
float min, max;
|
||||||
std::string file = lookup(soundId, volume, min, max);
|
std::string file = lookup(soundId, volume, min, max);
|
||||||
|
|
||||||
sound = mOutput->playSound(file, volume, basevol, pitch, mode|type);
|
sound = mOutput->playSound(file, volume, basevol, pitch, mode|type, offset);
|
||||||
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
|
@ -339,7 +342,7 @@ namespace MWSound
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::SoundPtr SoundManager::playSound3D(const MWWorld::Ptr &ptr, const std::string& soundId,
|
MWBase::SoundPtr SoundManager::playSound3D(const MWWorld::Ptr &ptr, const std::string& soundId,
|
||||||
float volume, float pitch, PlayType type, PlayMode mode)
|
float volume, float pitch, PlayType type, PlayMode mode, float offset)
|
||||||
{
|
{
|
||||||
MWBase::SoundPtr sound;
|
MWBase::SoundPtr sound;
|
||||||
if(!mOutput->isInitialized())
|
if(!mOutput->isInitialized())
|
||||||
|
@ -350,10 +353,10 @@ namespace MWSound
|
||||||
float basevol = volumeFromType(type);
|
float basevol = volumeFromType(type);
|
||||||
float min, max;
|
float min, max;
|
||||||
std::string file = lookup(soundId, volume, min, max);
|
std::string file = lookup(soundId, volume, min, max);
|
||||||
const ESM::Position &pos = ptr.getRefData().getPosition();;
|
const ESM::Position &pos = ptr.getRefData().getPosition();
|
||||||
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
||||||
|
|
||||||
sound = mOutput->playSound3D(file, objpos, volume, basevol, pitch, min, max, mode|type);
|
sound = mOutput->playSound3D(file, objpos, volume, basevol, pitch, min, max, mode|type, offset);
|
||||||
if((mode&Play_NoTrack))
|
if((mode&Play_NoTrack))
|
||||||
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
||||||
else
|
else
|
||||||
|
@ -377,7 +380,7 @@ namespace MWSound
|
||||||
mActiveSounds.erase(snditer++);
|
mActiveSounds.erase(snditer++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
snditer++;
|
++snditer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +395,7 @@ namespace MWSound
|
||||||
mActiveSounds.erase(snditer++);
|
mActiveSounds.erase(snditer++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
snditer++;
|
++snditer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +411,7 @@ namespace MWSound
|
||||||
mActiveSounds.erase(snditer++);
|
mActiveSounds.erase(snditer++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
snditer++;
|
++snditer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,6 +427,20 @@ namespace MWSound
|
||||||
mActiveSounds.erase(snditer++);
|
mActiveSounds.erase(snditer++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
++snditer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SoundManager::fadeOutSound3D(const MWWorld::Ptr &ptr,
|
||||||
|
const std::string& soundId, float duration)
|
||||||
|
{
|
||||||
|
SoundMap::iterator snditer = mActiveSounds.begin();
|
||||||
|
while(snditer != mActiveSounds.end())
|
||||||
|
{
|
||||||
|
if(snditer->second.first == ptr && snditer->second.second == soundId)
|
||||||
|
{
|
||||||
|
snditer->first->setFadeout(duration);
|
||||||
|
}
|
||||||
snditer++;
|
snditer++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -487,7 +504,7 @@ namespace MWSound
|
||||||
while(soundIter != regn->mSoundList.end())
|
while(soundIter != regn->mSoundList.end())
|
||||||
{
|
{
|
||||||
total += (int)soundIter->mChance;
|
total += (int)soundIter->mChance;
|
||||||
soundIter++;
|
++soundIter;
|
||||||
}
|
}
|
||||||
if(total == 0)
|
if(total == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -506,7 +523,7 @@ namespace MWSound
|
||||||
}
|
}
|
||||||
pos += soundIter->mChance;
|
pos += soundIter->mChance;
|
||||||
|
|
||||||
soundIter++;
|
++soundIter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,6 +534,7 @@ namespace MWSound
|
||||||
timePassed += duration;
|
timePassed += duration;
|
||||||
if(timePassed < (1.0f/30.0f))
|
if(timePassed < (1.0f/30.0f))
|
||||||
return;
|
return;
|
||||||
|
duration = timePassed;
|
||||||
timePassed = 0.0f;
|
timePassed = 0.0f;
|
||||||
|
|
||||||
// Make sure music is still playing
|
// Make sure music is still playing
|
||||||
|
@ -539,6 +557,7 @@ namespace MWSound
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check if any sounds are finished playing, and trash them
|
// Check if any sounds are finished playing, and trash them
|
||||||
|
// Lower volume on fading out sounds
|
||||||
SoundMap::iterator snditer = mActiveSounds.begin();
|
SoundMap::iterator snditer = mActiveSounds.begin();
|
||||||
while(snditer != mActiveSounds.end())
|
while(snditer != mActiveSounds.end())
|
||||||
{
|
{
|
||||||
|
@ -553,8 +572,18 @@ namespace MWSound
|
||||||
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
||||||
snditer->first->setPosition(objpos);
|
snditer->first->setPosition(objpos);
|
||||||
}
|
}
|
||||||
|
//update fade out
|
||||||
|
if(snditer->first->mFadeOutTime>0)
|
||||||
|
{
|
||||||
|
float soundDuration=duration;
|
||||||
|
if(soundDuration>snditer->first->mFadeOutTime)
|
||||||
|
soundDuration=snditer->first->mFadeOutTime;
|
||||||
|
snditer->first->setVolume(snditer->first->mVolume
|
||||||
|
- soundDuration / snditer->first->mFadeOutTime * snditer->first->mVolume);
|
||||||
|
snditer->first->mFadeOutTime -= soundDuration;
|
||||||
|
}
|
||||||
snditer->first->update();
|
snditer->first->update();
|
||||||
snditer++;
|
++snditer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -581,7 +610,7 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
snditer->first->mBaseVolume = volumeFromType(snditer->first->getPlayType());
|
snditer->first->mBaseVolume = volumeFromType(snditer->first->getPlayType());
|
||||||
snditer->first->update();
|
snditer->first->update();
|
||||||
snditer++;
|
++snditer;
|
||||||
}
|
}
|
||||||
if(mMusic)
|
if(mMusic)
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,13 +106,15 @@ namespace MWSound
|
||||||
virtual MWBase::SoundPtr playTrack(const DecoderPtr& decoder, PlayType type);
|
virtual MWBase::SoundPtr playTrack(const DecoderPtr& decoder, PlayType type);
|
||||||
///< Play a 2D audio track, using a custom decoder
|
///< Play a 2D audio track, using a custom decoder
|
||||||
|
|
||||||
virtual MWBase::SoundPtr playSound(const std::string& soundId, float volume, float pitch, PlayType type=Play_TypeSfx, PlayMode mode=Play_Normal);
|
virtual MWBase::SoundPtr playSound(const std::string& soundId, float volume, float pitch, PlayType type=Play_TypeSfx, PlayMode mode=Play_Normal, float offset=0);
|
||||||
///< Play a sound, independently of 3D-position
|
///< Play a sound, independently of 3D-position
|
||||||
|
///< @param offset value from [0,1], when to start playback. 0 is beginning, 1 is end.
|
||||||
|
|
||||||
virtual MWBase::SoundPtr playSound3D(const MWWorld::Ptr &reference, const std::string& soundId,
|
virtual MWBase::SoundPtr playSound3D(const MWWorld::Ptr &reference, const std::string& soundId,
|
||||||
float volume, float pitch, PlayType type=Play_TypeSfx,
|
float volume, float pitch, PlayType type=Play_TypeSfx,
|
||||||
PlayMode mode=Play_Normal);
|
PlayMode mode=Play_Normal, float offset=0);
|
||||||
///< Play a sound from an object
|
///< Play a sound from an object
|
||||||
|
///< @param offset value from [0,1], when to start playback. 0 is beginning, 1 is end.
|
||||||
|
|
||||||
virtual void stopSound3D(const MWWorld::Ptr &reference, const std::string& soundId);
|
virtual void stopSound3D(const MWWorld::Ptr &reference, const std::string& soundId);
|
||||||
///< Stop the given object from playing the given sound,
|
///< Stop the given object from playing the given sound,
|
||||||
|
@ -126,6 +128,12 @@ namespace MWSound
|
||||||
virtual void stopSound(const std::string& soundId);
|
virtual void stopSound(const std::string& soundId);
|
||||||
///< Stop a non-3d looping sound
|
///< Stop a non-3d looping sound
|
||||||
|
|
||||||
|
virtual void fadeOutSound3D(const MWWorld::Ptr &reference, const std::string& soundId, float duration);
|
||||||
|
///< Fade out given sound (that is already playing) of given object
|
||||||
|
///< @param reference Reference to object, whose sound is faded out
|
||||||
|
///< @param soundId ID of the sound to fade out.
|
||||||
|
///< @param duration Time until volume reaches 0.
|
||||||
|
|
||||||
virtual bool getSoundPlaying(const MWWorld::Ptr &reference, const std::string& soundId) const;
|
virtual bool getSoundPlaying(const MWWorld::Ptr &reference, const std::string& soundId) const;
|
||||||
///< Is the given sound currently playing on the given object?
|
///< Is the given sound currently playing on the given object?
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ const MWWorld::Ptr& MWWorld::Action::getTarget() const
|
||||||
return mTarget;
|
return mTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Action::Action (bool keepSound, const Ptr& target) : mKeepSound (keepSound), mTarget (target)
|
MWWorld::Action::Action (bool keepSound, const Ptr& target) : mKeepSound (keepSound), mTarget (target), mSoundOffset(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
MWWorld::Action::~Action() {}
|
MWWorld::Action::~Action() {}
|
||||||
|
@ -21,14 +21,16 @@ void MWWorld::Action::execute (const Ptr& actor)
|
||||||
if (!mSoundId.empty())
|
if (!mSoundId.empty())
|
||||||
{
|
{
|
||||||
if (mKeepSound && actor.getRefData().getHandle()=="player")
|
if (mKeepSound && actor.getRefData().getHandle()=="player")
|
||||||
MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0,
|
||||||
|
MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal,mSoundOffset);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool local = mTarget.isEmpty() || !mTarget.isInCell(); // no usable target
|
bool local = mTarget.isEmpty() || !mTarget.isInCell(); // no usable target
|
||||||
|
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D(local ? actor : mTarget,
|
MWBase::Environment::get().getSoundManager()->playSound3D(local ? actor : mTarget,
|
||||||
mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx,
|
mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx,
|
||||||
mKeepSound ? MWBase::SoundManager::Play_NoTrack : MWBase::SoundManager::Play_Normal);
|
mKeepSound ? MWBase::SoundManager::Play_NoTrack : MWBase::SoundManager::Play_Normal,
|
||||||
|
mSoundOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,3 +41,8 @@ void MWWorld::Action::setSound (const std::string& id)
|
||||||
{
|
{
|
||||||
mSoundId = id;
|
mSoundId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MWWorld::Action::setSoundOffset(float offset)
|
||||||
|
{
|
||||||
|
mSoundOffset=offset;
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
std::string mSoundId;
|
std::string mSoundId;
|
||||||
bool mKeepSound;
|
bool mKeepSound;
|
||||||
|
float mSoundOffset;
|
||||||
Ptr mTarget;
|
Ptr mTarget;
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
|
@ -34,6 +35,7 @@ namespace MWWorld
|
||||||
void execute (const Ptr& actor);
|
void execute (const Ptr& actor);
|
||||||
|
|
||||||
void setSound (const std::string& id);
|
void setSound (const std::string& id);
|
||||||
|
void setSoundOffset(float offset);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,39 +44,6 @@ void MWWorld::Cells::clear()
|
||||||
mIdCacheIndex = 0;
|
mIdCacheIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
|
|
||||||
{
|
|
||||||
for (CellRefList<ESM::Container>::List::iterator iter (
|
|
||||||
cellStore.mContainers.mList.begin());
|
|
||||||
iter!=cellStore.mContainers.mList.end(); ++iter)
|
|
||||||
{
|
|
||||||
Ptr container (&*iter, &cellStore);
|
|
||||||
|
|
||||||
Class::get (container).getContainerStore (container).fill (
|
|
||||||
iter->mBase->mInventory, container.getCellRef().mOwner, mStore);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (CellRefList<ESM::Creature>::List::iterator iter (
|
|
||||||
cellStore.mCreatures.mList.begin());
|
|
||||||
iter!=cellStore.mCreatures.mList.end(); ++iter)
|
|
||||||
{
|
|
||||||
Ptr container (&*iter, &cellStore);
|
|
||||||
|
|
||||||
Class::get (container).getContainerStore (container).fill (
|
|
||||||
iter->mBase->mInventory, Class::get(container).getId(container), mStore);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (CellRefList<ESM::NPC>::List::iterator iter (
|
|
||||||
cellStore.mNpcs.mList.begin());
|
|
||||||
iter!=cellStore.mNpcs.mList.end(); ++iter)
|
|
||||||
{
|
|
||||||
Ptr container (&*iter, &cellStore);
|
|
||||||
|
|
||||||
Class::get (container).getContainerStore (container).fill (
|
|
||||||
iter->mBase->mInventory, Class::get(container).getId(container), mStore);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellStore& cellStore)
|
MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellStore& cellStore)
|
||||||
{
|
{
|
||||||
Ptr ptr = getPtr (name, cellStore);
|
Ptr ptr = getPtr (name, cellStore);
|
||||||
|
@ -129,7 +96,6 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
|
||||||
{
|
{
|
||||||
// Multiple plugin support for landscape data is much easier than for references. The last plugin wins.
|
// Multiple plugin support for landscape data is much easier than for references. The last plugin wins.
|
||||||
result->second.load (mStore, mReader);
|
result->second.load (mStore, mReader);
|
||||||
fillContainers (result->second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &result->second;
|
return &result->second;
|
||||||
|
@ -150,7 +116,6 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getInterior (const std::string& name)
|
||||||
if (result->second.mState!=Ptr::CellStore::State_Loaded)
|
if (result->second.mState!=Ptr::CellStore::State_Loaded)
|
||||||
{
|
{
|
||||||
result->second.load (mStore, mReader);
|
result->second.load (mStore, mReader);
|
||||||
fillContainers (result->second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &result->second;
|
return &result->second;
|
||||||
|
@ -168,7 +133,6 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name, Ptr::CellStore& ce
|
||||||
if (std::binary_search (cell.mIds.begin(), cell.mIds.end(), lowerCase))
|
if (std::binary_search (cell.mIds.begin(), cell.mIds.end(), lowerCase))
|
||||||
{
|
{
|
||||||
cell.load (mStore, mReader);
|
cell.load (mStore, mReader);
|
||||||
fillContainers (cell);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Ptr();
|
return Ptr();
|
||||||
|
|
|
@ -31,8 +31,6 @@ namespace MWWorld
|
||||||
|
|
||||||
CellStore *getCellStore (const ESM::Cell *cell);
|
CellStore *getCellStore (const ESM::Cell *cell);
|
||||||
|
|
||||||
void fillContainers (CellStore& cellStore);
|
|
||||||
|
|
||||||
Ptr getPtrAndCache (const std::string& name, CellStore& cellStore);
|
Ptr getPtrAndCache (const std::string& name, CellStore& cellStore);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
assert (mCell);
|
assert (mCell);
|
||||||
|
|
||||||
if (mCell->mContextList.size() == 0)
|
if (mCell->mContextList.empty())
|
||||||
return; // this is a dynamically generated cell -> skipping.
|
return; // this is a dynamically generated cell -> skipping.
|
||||||
|
|
||||||
// Load references from all plugins that do something with this cell.
|
// Load references from all plugins that do something with this cell.
|
||||||
|
@ -113,7 +113,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
assert (mCell);
|
assert (mCell);
|
||||||
|
|
||||||
if (mCell->mContextList.size() == 0)
|
if (mCell->mContextList.empty())
|
||||||
return; // this is a dynamically generated cell -> skipping.
|
return; // this is a dynamically generated cell -> skipping.
|
||||||
|
|
||||||
// Load references from all plugins that do something with this cell.
|
// Load references from all plugins that do something with this cell.
|
||||||
|
@ -174,7 +174,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load moved references, from separately tracked list.
|
// Load moved references, from separately tracked list.
|
||||||
for (ESM::CellRefTracker::const_iterator it = mCell->mLeasedRefs.begin(); it != mCell->mLeasedRefs.end(); it++)
|
for (ESM::CellRefTracker::const_iterator it = mCell->mLeasedRefs.begin(); it != mCell->mLeasedRefs.end(); ++it)
|
||||||
{
|
{
|
||||||
// Doesn't seem to work in one line... huh? Too sleepy to check...
|
// Doesn't seem to work in one line... huh? Too sleepy to check...
|
||||||
ESM::CellRef &ref = const_cast<ESM::CellRef&>(*it);
|
ESM::CellRef &ref = const_cast<ESM::CellRef&>(*it);
|
||||||
|
|
|
@ -79,18 +79,6 @@ namespace MWWorld
|
||||||
throw std::runtime_error ("class does not have item health");
|
throw std::runtime_error ("class does not have item health");
|
||||||
}
|
}
|
||||||
|
|
||||||
float Class::getEvasion(const Ptr& ptr) const
|
|
||||||
{
|
|
||||||
MWMechanics::CreatureStats &crstats = getCreatureStats(ptr);
|
|
||||||
const MWMechanics::MagicEffects &mageffects = crstats.getMagicEffects();
|
|
||||||
float evasion = (crstats.getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
|
|
||||||
(crstats.getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
|
|
||||||
evasion *= crstats.getFatigueTerm();
|
|
||||||
evasion += mageffects.get(MWMechanics::EffectKey(ESM::MagicEffect::Sanctuary)).mMagnitude;
|
|
||||||
|
|
||||||
return evasion;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Class::hit(const Ptr& ptr, int type) const
|
void Class::hit(const Ptr& ptr, int type) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("class cannot hit");
|
throw std::runtime_error("class cannot hit");
|
||||||
|
@ -244,11 +232,6 @@ namespace MWWorld
|
||||||
return *iter->second;
|
return *iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Class& Class::get (const Ptr& ptr)
|
|
||||||
{
|
|
||||||
return get (ptr.getTypeName());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Class::isPersistent(const Ptr &ptr) const
|
bool Class::isPersistent(const Ptr &ptr) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error ("class does not support persistence");
|
throw std::runtime_error ("class does not support persistence");
|
||||||
|
|
|
@ -105,9 +105,6 @@ namespace MWWorld
|
||||||
///< Return item max health or throw an exception, if class does not have item health
|
///< Return item max health or throw an exception, if class does not have item health
|
||||||
/// (default implementation: throw an exceoption)
|
/// (default implementation: throw an exceoption)
|
||||||
|
|
||||||
virtual float getEvasion(const Ptr& ptr) const;
|
|
||||||
///< Gets the chance the given object can evade an attack
|
|
||||||
|
|
||||||
virtual void hit(const Ptr& ptr, int type=-1) const;
|
virtual void hit(const Ptr& ptr, int type=-1) const;
|
||||||
///< Execute a melee hit, using the current weapon. This will check the relevant skills
|
///< Execute a melee hit, using the current weapon. This will check the relevant skills
|
||||||
/// of the given attacker, and whoever is hit.
|
/// of the given attacker, and whoever is hit.
|
||||||
|
@ -230,7 +227,10 @@ namespace MWWorld
|
||||||
static const Class& get (const std::string& key);
|
static const Class& get (const std::string& key);
|
||||||
///< If there is no class for this \a key, an exception is thrown.
|
///< If there is no class for this \a key, an exception is thrown.
|
||||||
|
|
||||||
static const Class& get (const Ptr& ptr);
|
static const Class& get (const Ptr& ptr)
|
||||||
|
{
|
||||||
|
return get (ptr.getTypeName());
|
||||||
|
}
|
||||||
///< 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);
|
||||||
|
|
|
@ -237,7 +237,7 @@ void MWWorld::ContainerStore::addInitialItem (const std::string& id, const std::
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!candidates.size())
|
if (candidates.empty())
|
||||||
return;
|
return;
|
||||||
std::string item = candidates[std::rand()%candidates.size()];
|
std::string item = candidates[std::rand()%candidates.size()];
|
||||||
addInitialItem(item, owner, count, failChance, false);
|
addInitialItem(item, owner, count, failChance, false);
|
||||||
|
|
|
@ -118,7 +118,8 @@ namespace MWWorld
|
||||||
newPosition = trace.endpos;
|
newPosition = trace.endpos;
|
||||||
|
|
||||||
physicActor->setOnGround(hit && getSlope(trace.planenormal) <= sMaxSlope);
|
physicActor->setOnGround(hit && getSlope(trace.planenormal) <= sMaxSlope);
|
||||||
physicActor->enableCollisions(wasCollisionMode);
|
if (wasCollisionMode)
|
||||||
|
physicActor->enableCollisions(true);
|
||||||
|
|
||||||
if (hit)
|
if (hit)
|
||||||
return newPosition+Ogre::Vector3(0,0,4);
|
return newPosition+Ogre::Vector3(0,0,4);
|
||||||
|
@ -148,6 +149,7 @@ namespace MWWorld
|
||||||
float remainingTime = time;
|
float remainingTime = time;
|
||||||
bool isInterior = !ptr.getCell()->isExterior();
|
bool isInterior = !ptr.getCell()->isExterior();
|
||||||
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
||||||
|
bool wasCollisionMode = physicActor->getCollisionMode();
|
||||||
physicActor->enableCollisions(false);
|
physicActor->enableCollisions(false);
|
||||||
Ogre::Quaternion orient = Ogre::Quaternion(Ogre::Radian(ptr.getRefData().getPosition().rot[2]), Ogre::Vector3::UNIT_Z);
|
Ogre::Quaternion orient = Ogre::Quaternion(Ogre::Radian(ptr.getRefData().getPosition().rot[2]), Ogre::Vector3::UNIT_Z);
|
||||||
Ogre::Vector3 velocity;
|
Ogre::Vector3 velocity;
|
||||||
|
@ -228,6 +230,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
physicActor->setOnGround(onground);
|
physicActor->setOnGround(onground);
|
||||||
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
||||||
|
if (wasCollisionMode)
|
||||||
physicActor->enableCollisions(true);
|
physicActor->enableCollisions(true);
|
||||||
return newPosition;
|
return newPosition;
|
||||||
}
|
}
|
||||||
|
@ -507,7 +510,7 @@ namespace MWWorld
|
||||||
|
|
||||||
bool PhysicsSystem::toggleCollisionMode()
|
bool PhysicsSystem::toggleCollisionMode()
|
||||||
{
|
{
|
||||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->mActorMap.begin(); it != mEngine->mActorMap.end();it++)
|
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->mActorMap.begin(); it != mEngine->mActorMap.end();++it)
|
||||||
{
|
{
|
||||||
if (it->first=="player")
|
if (it->first=="player")
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,6 +123,9 @@ namespace MWWorld
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).setStance (ptr, MWWorld::Class::Sneak, sneak);
|
MWWorld::Class::get (ptr).setStance (ptr, MWWorld::Class::Sneak, sneak);
|
||||||
|
|
||||||
|
// TODO show sneak indicator only when the player is not detected by any actor
|
||||||
|
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::yaw(float yaw)
|
void Player::yaw(float yaw)
|
||||||
|
|
|
@ -74,7 +74,7 @@ void Store<ESM::Cell>::load(ESM::ESMReader &esm, const std::string &id)
|
||||||
// copy list into new cell
|
// copy list into new cell
|
||||||
cell->mContextList = oldcell->mContextList;
|
cell->mContextList = oldcell->mContextList;
|
||||||
// merge lists of leased references, use newer data in case of conflict
|
// merge lists of leased references, use newer data in case of conflict
|
||||||
for (ESM::MovedCellRefTracker::const_iterator it = cell->mMovedRefs.begin(); it != cell->mMovedRefs.end(); it++) {
|
for (ESM::MovedCellRefTracker::const_iterator it = cell->mMovedRefs.begin(); it != cell->mMovedRefs.end(); ++it) {
|
||||||
// remove reference from current leased ref tracker and add it to new cell
|
// remove reference from current leased ref tracker and add it to new cell
|
||||||
ESM::MovedCellRefTracker::iterator itold = std::find(oldcell->mMovedRefs.begin(), oldcell->mMovedRefs.end(), it->mRefnum);
|
ESM::MovedCellRefTracker::iterator itold = std::find(oldcell->mMovedRefs.begin(), oldcell->mMovedRefs.end(), it->mRefnum);
|
||||||
if (itold != oldcell->mMovedRefs.end()) {
|
if (itold != oldcell->mMovedRefs.end()) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace MWWorld
|
||||||
|
|
||||||
SharedIterator operator++(int) {
|
SharedIterator operator++(int) {
|
||||||
SharedIterator iter = *this;
|
SharedIterator iter = *this;
|
||||||
mIter++;
|
++mIter;
|
||||||
|
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ namespace MWWorld
|
||||||
|
|
||||||
SharedIterator operator--(int) {
|
SharedIterator operator--(int) {
|
||||||
SharedIterator iter = *this;
|
SharedIterator iter = *this;
|
||||||
mIter--;
|
--mIter;
|
||||||
|
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,9 @@ namespace MWWorld
|
||||||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
||||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||||
mSky (true), mCells (mStore, mEsm),
|
mSky (true), mCells (mStore, mEsm),
|
||||||
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),
|
mActivationDistanceOverride (mActivationDistanceOverride),
|
||||||
mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true)
|
mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true),
|
||||||
|
mFacedDistance(FLT_MAX)
|
||||||
{
|
{
|
||||||
mPhysics = new PhysicsSystem(renderer);
|
mPhysics = new PhysicsSystem(renderer);
|
||||||
mPhysEngine = mPhysics->getEngine();
|
mPhysEngine = mPhysics->getEngine();
|
||||||
|
@ -235,7 +236,6 @@ namespace MWWorld
|
||||||
|
|
||||||
// Rebuild player
|
// Rebuild player
|
||||||
setupPlayer();
|
setupPlayer();
|
||||||
const ESM::NPC* playerNpc = mStore.get<ESM::NPC>().find("player");
|
|
||||||
MWWorld::Ptr player = mPlayer->getPlayer();
|
MWWorld::Ptr player = mPlayer->getPlayer();
|
||||||
renderPlayer();
|
renderPlayer();
|
||||||
mRendering->resetCamera();
|
mRendering->resetCamera();
|
||||||
|
@ -246,9 +246,6 @@ namespace MWWorld
|
||||||
// make sure to do this so that local scripts from items that were in the players inventory are removed
|
// make sure to do this so that local scripts from items that were in the players inventory are removed
|
||||||
mLocalScripts.clear();
|
mLocalScripts.clear();
|
||||||
|
|
||||||
MWWorld::Class::get(player).getContainerStore(player).fill(playerNpc->mInventory, "", mStore);
|
|
||||||
MWWorld::Class::get(player).getInventoryStore(player).autoEquip(player);
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->updatePlayer();
|
MWBase::Environment::get().getWindowManager()->updatePlayer();
|
||||||
|
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
|
@ -1117,7 +1114,7 @@ namespace MWWorld
|
||||||
|
|
||||||
bool World::castRay (float x1, float y1, float z1, float x2, float y2, float z2)
|
bool World::castRay (float x1, float y1, float z1, float x2, float y2, float z2)
|
||||||
{
|
{
|
||||||
Ogre::Vector3 a(x1,y1,z1);std::cout << x1 << " " << x2;
|
Ogre::Vector3 a(x1,y1,z1);
|
||||||
Ogre::Vector3 b(x2,y2,z2);
|
Ogre::Vector3 b(x2,y2,z2);
|
||||||
return mPhysics->castRay(a,b,false,true);
|
return mPhysics->castRay(a,b,false,true);
|
||||||
}
|
}
|
||||||
|
@ -1329,7 +1326,7 @@ namespace MWWorld
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.size() == 0)
|
if (results.empty())
|
||||||
{
|
{
|
||||||
mFacedHandle = "";
|
mFacedHandle = "";
|
||||||
mFacedDistance = FLT_MAX;
|
mFacedDistance = FLT_MAX;
|
||||||
|
@ -1717,8 +1714,6 @@ namespace MWWorld
|
||||||
|
|
||||||
void World::getContainersOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out)
|
void World::getContainersOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out)
|
||||||
{
|
{
|
||||||
std::string refId = npc.getCellRef().mRefID;
|
|
||||||
|
|
||||||
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
||||||
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
||||||
{
|
{
|
||||||
|
@ -1764,14 +1759,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
|
OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle());
|
||||||
|
|
||||||
if (enable)
|
physicActor->enableCollisions(enable);
|
||||||
{
|
|
||||||
physicActor->enableCollisionBody();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
physicActor->disableCollisionBody();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)
|
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)
|
||||||
|
|
|
@ -77,13 +77,6 @@ namespace MWWorld
|
||||||
int mActivationDistanceOverride;
|
int mActivationDistanceOverride;
|
||||||
std::string mFacedHandle;
|
std::string mFacedHandle;
|
||||||
float mFacedDistance;
|
float mFacedDistance;
|
||||||
Ptr mFaced1;
|
|
||||||
Ptr mFaced2;
|
|
||||||
std::string mFaced1Name;
|
|
||||||
std::string mFaced2Name;
|
|
||||||
float mFaced1Distance;
|
|
||||||
float mFaced2Distance;
|
|
||||||
int mNumFacing;
|
|
||||||
|
|
||||||
std::map<MWWorld::Ptr, int> mDoorStates;
|
std::map<MWWorld::Ptr, int> mDoorStates;
|
||||||
///< only holds doors that are currently moving. 0 means closing, 1 opening
|
///< only holds doors that are currently moving. 0 means closing, 1 opening
|
||||||
|
|
|
@ -130,7 +130,7 @@ public:
|
||||||
{
|
{
|
||||||
std::string normalizedPattern = normalize_path(pattern.begin(), pattern.end());
|
std::string normalizedPattern = normalize_path(pattern.begin(), pattern.end());
|
||||||
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
||||||
for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();iter++)
|
for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();++iter)
|
||||||
{
|
{
|
||||||
if(Ogre::StringUtil::match(iter->first, normalizedPattern) ||
|
if(Ogre::StringUtil::match(iter->first, normalizedPattern) ||
|
||||||
(recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern)))
|
(recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern)))
|
||||||
|
@ -169,7 +169,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();iter++)
|
for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();++iter)
|
||||||
{
|
{
|
||||||
if(Ogre::StringUtil::match(iter->first, normalizedPattern) ||
|
if(Ogre::StringUtil::match(iter->first, normalizedPattern) ||
|
||||||
(recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern)))
|
(recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern)))
|
||||||
|
@ -249,7 +249,7 @@ public:
|
||||||
std::string normalizedPattern = normalize_path(pattern.begin(), pattern.end());
|
std::string normalizedPattern = normalize_path(pattern.begin(), pattern.end());
|
||||||
const Bsa::BSAFile::FileList &filelist = arc.getList();
|
const Bsa::BSAFile::FileList &filelist = arc.getList();
|
||||||
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
||||||
for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();iter++)
|
for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();++iter)
|
||||||
{
|
{
|
||||||
std::string ent = normalize_path(iter->name, iter->name+std::strlen(iter->name));
|
std::string ent = normalize_path(iter->name, iter->name+std::strlen(iter->name));
|
||||||
if(Ogre::StringUtil::match(ent, normalizedPattern) ||
|
if(Ogre::StringUtil::match(ent, normalizedPattern) ||
|
||||||
|
@ -266,7 +266,7 @@ public:
|
||||||
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
||||||
const Bsa::BSAFile::FileList &filelist = arc.getList();
|
const Bsa::BSAFile::FileList &filelist = arc.getList();
|
||||||
|
|
||||||
for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();iter++)
|
for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();++iter)
|
||||||
{
|
{
|
||||||
std::string ent = normalize_path(iter->name, iter->name+std::strlen(iter->name));
|
std::string ent = normalize_path(iter->name, iter->name+std::strlen(iter->name));
|
||||||
if(Ogre::StringUtil::match(ent, normalizedPattern) ||
|
if(Ogre::StringUtil::match(ent, normalizedPattern) ||
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace Compiler
|
||||||
Literals& literals, std::vector<Interpreter::Type_Code>& code, bool allowExpression)
|
Literals& literals, std::vector<Interpreter::Type_Code>& code, bool allowExpression)
|
||||||
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code),
|
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code),
|
||||||
mState (BeginState), mExprParser (errorHandler, context, locals, literals),
|
mState (BeginState), mExprParser (errorHandler, context, locals, literals),
|
||||||
mAllowExpression (allowExpression)
|
mAllowExpression (allowExpression), mButtons(0), mType(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool LineParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner)
|
bool LineParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner)
|
||||||
|
|
|
@ -509,7 +509,7 @@ namespace Compiler
|
||||||
Scanner::Scanner (ErrorHandler& errorHandler, std::istream& inputStream,
|
Scanner::Scanner (ErrorHandler& errorHandler, std::istream& inputStream,
|
||||||
const Extensions *extensions)
|
const Extensions *extensions)
|
||||||
: mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions),
|
: mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions),
|
||||||
mPutback (Putback_None)
|
mPutback (Putback_None), mPutbackCode(0), mPutbackInteger(0), mPutbackFloat(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ ESM_Context ESMReader::getContext()
|
||||||
ESMReader::ESMReader()
|
ESMReader::ESMReader()
|
||||||
: mBuffer(50*1024)
|
: mBuffer(50*1024)
|
||||||
, mRecordFlags(0)
|
, mRecordFlags(0)
|
||||||
|
, mIdx(0)
|
||||||
|
, mGlobalReaderList(NULL)
|
||||||
|
, mEncoder(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,11 @@ Land::Land()
|
||||||
, mX(0)
|
, mX(0)
|
||||||
, mY(0)
|
, mY(0)
|
||||||
, mEsm(NULL)
|
, mEsm(NULL)
|
||||||
// , hasData(false)
|
|
||||||
, mDataTypes(0)
|
, mDataTypes(0)
|
||||||
, mDataLoaded(false)
|
, mDataLoaded(false)
|
||||||
, mLandData(NULL)
|
, mLandData(NULL)
|
||||||
|
, mPlugin(0)
|
||||||
|
, mHasData(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,14 +56,14 @@ void Pathgrid::load(ESMReader &esm)
|
||||||
std::vector<int>::const_iterator rawIt = rawConnections.begin();
|
std::vector<int>::const_iterator rawIt = rawConnections.begin();
|
||||||
int pointIndex = 0;
|
int pointIndex = 0;
|
||||||
mEdges.reserve(edgeCount);
|
mEdges.reserve(edgeCount);
|
||||||
for(PointList::const_iterator it = mPoints.begin(); it != mPoints.end(); it++, pointIndex++)
|
for(PointList::const_iterator it = mPoints.begin(); it != mPoints.end(); ++it, ++pointIndex)
|
||||||
{
|
{
|
||||||
unsigned char connectionNum = (*it).mConnectionNum;
|
unsigned char connectionNum = (*it).mConnectionNum;
|
||||||
for (int i = 0; i < connectionNum; ++i) {
|
for (int i = 0; i < connectionNum; ++i) {
|
||||||
Edge edge;
|
Edge edge;
|
||||||
edge.mV0 = pointIndex;
|
edge.mV0 = pointIndex;
|
||||||
edge.mV1 = *rawIt;
|
edge.mV1 = *rawIt;
|
||||||
rawIt++;
|
++rawIt;
|
||||||
mEdges.push_back(edge);
|
mEdges.push_back(edge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
namespace Interpreter{
|
namespace Interpreter{
|
||||||
|
|
||||||
bool Check(const std::string str, const std::string escword, unsigned int* i, unsigned int* start){
|
bool Check(const std::string& str, const std::string& escword, unsigned int* i, unsigned int* start){
|
||||||
bool retval = str.find(escword) == 0;
|
bool retval = str.find(escword) == 0;
|
||||||
if(retval){
|
if(retval){
|
||||||
(*i) += escword.length();
|
(*i) += escword.length();
|
||||||
|
@ -18,7 +18,7 @@ namespace Interpreter{
|
||||||
|
|
||||||
std::vector<std::string> globals;
|
std::vector<std::string> globals;
|
||||||
|
|
||||||
bool longerStr(const std::string a, const std::string b){
|
bool longerStr(const std::string& a, const std::string& b){
|
||||||
return a.length() > b.length();
|
return a.length() > b.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
namespace Interpreter
|
namespace Interpreter
|
||||||
{
|
{
|
||||||
Runtime::Runtime() : mContext (0), mCode (0), mPC (0) {}
|
Runtime::Runtime() : mContext (0), mCode (0), mPC (0), mCodeSize(0) {}
|
||||||
|
|
||||||
int Runtime::getPC() const
|
int Runtime::getPC() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,12 +75,12 @@ btVector3 ManualBulletShapeLoader::getbtVector(Ogre::Vector3 const &v)
|
||||||
|
|
||||||
void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
{
|
{
|
||||||
cShape = static_cast<OEngine::Physic::BulletShape *>(resource);
|
mShape = static_cast<OEngine::Physic::BulletShape *>(resource);
|
||||||
resourceName = cShape->getName();
|
mResourceName = mShape->getName();
|
||||||
cShape->mCollide = false;
|
mShape->mCollide = false;
|
||||||
mBoundingBox = NULL;
|
mBoundingBox = NULL;
|
||||||
cShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
mShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
||||||
cShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
mShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
||||||
mHasShape = false;
|
mHasShape = false;
|
||||||
|
|
||||||
btTriangleMesh* mesh1 = new btTriangleMesh();
|
btTriangleMesh* mesh1 = new btTriangleMesh();
|
||||||
|
@ -89,7 +89,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
// of the early stages of development. Right now we WANT to catch
|
// of the early stages of development. Right now we WANT to catch
|
||||||
// every error as early and intrusively as possible, as it's most
|
// every error as early and intrusively as possible, as it's most
|
||||||
// likely a sign of incomplete code rather than faulty input.
|
// likely a sign of incomplete code rather than faulty input.
|
||||||
Nif::NIFFile::ptr pnif (Nif::NIFFile::create (resourceName.substr(0, resourceName.length()-7)));
|
Nif::NIFFile::ptr pnif (Nif::NIFFile::create (mResourceName.substr(0, mResourceName.length()-7)));
|
||||||
Nif::NIFFile & nif = *pnif.get ();
|
Nif::NIFFile & nif = *pnif.get ();
|
||||||
if (nif.numRoots() < 1)
|
if (nif.numRoots() < 1)
|
||||||
{
|
{
|
||||||
|
@ -108,29 +108,29 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cShape->mHasCollisionNode = hasRootCollisionNode(node);
|
mShape->mHasCollisionNode = hasRootCollisionNode(node);
|
||||||
|
|
||||||
//do a first pass
|
//do a first pass
|
||||||
handleNode(mesh1, node,0,false,false,false);
|
handleNode(mesh1, node,0,false,false,false);
|
||||||
|
|
||||||
if(mBoundingBox != NULL)
|
if(mBoundingBox != NULL)
|
||||||
{
|
{
|
||||||
cShape->mCollisionShape = mBoundingBox;
|
mShape->mCollisionShape = mBoundingBox;
|
||||||
delete mesh1;
|
delete mesh1;
|
||||||
}
|
}
|
||||||
else if (mHasShape && cShape->mCollide)
|
else if (mHasShape && mShape->mCollide)
|
||||||
{
|
{
|
||||||
cShape->mCollisionShape = new TriangleMeshShape(mesh1,true);
|
mShape->mCollisionShape = new TriangleMeshShape(mesh1,true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete mesh1;
|
delete mesh1;
|
||||||
|
|
||||||
//second pass which create a shape for raycasting.
|
//second pass which create a shape for raycasting.
|
||||||
resourceName = cShape->getName();
|
mResourceName = mShape->getName();
|
||||||
cShape->mCollide = false;
|
mShape->mCollide = false;
|
||||||
mBoundingBox = NULL;
|
mBoundingBox = NULL;
|
||||||
cShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
mShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
||||||
cShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
mShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
||||||
mHasShape = false;
|
mHasShape = false;
|
||||||
|
|
||||||
btTriangleMesh* mesh2 = new btTriangleMesh();
|
btTriangleMesh* mesh2 = new btTriangleMesh();
|
||||||
|
@ -139,12 +139,12 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||||
|
|
||||||
if(mBoundingBox != NULL)
|
if(mBoundingBox != NULL)
|
||||||
{
|
{
|
||||||
cShape->mRaycastingShape = mBoundingBox;
|
mShape->mRaycastingShape = mBoundingBox;
|
||||||
delete mesh2;
|
delete mesh2;
|
||||||
}
|
}
|
||||||
else if (mHasShape)
|
else if (mHasShape)
|
||||||
{
|
{
|
||||||
cShape->mRaycastingShape = new TriangleMeshShape(mesh2,true);
|
mShape->mRaycastingShape = new TriangleMeshShape(mesh2,true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete mesh2;
|
delete mesh2;
|
||||||
|
@ -224,18 +224,18 @@ void ManualBulletShapeLoader::handleNode(btTriangleMesh* mesh, const Nif::Node *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (isCollisionNode || (!cShape->mHasCollisionNode && !raycasting))
|
if ( (isCollisionNode || (!mShape->mHasCollisionNode && !raycasting))
|
||||||
&& (!isMarker || (cShape->mHasCollisionNode && !raycasting)))
|
&& (!isMarker || (mShape->mHasCollisionNode && !raycasting)))
|
||||||
{
|
{
|
||||||
if(node->hasBounds)
|
if(node->hasBounds)
|
||||||
{
|
{
|
||||||
cShape->mBoxTranslation = node->boundPos;
|
mShape->mBoxTranslation = node->boundPos;
|
||||||
cShape->mBoxRotation = node->boundRot;
|
mShape->mBoxRotation = node->boundRot;
|
||||||
mBoundingBox = new btBoxShape(getbtVector(node->boundXYZ));
|
mBoundingBox = new btBoxShape(getbtVector(node->boundXYZ));
|
||||||
}
|
}
|
||||||
else if(node->recType == Nif::RC_NiTriShape)
|
else if(node->recType == Nif::RC_NiTriShape)
|
||||||
{
|
{
|
||||||
cShape->mCollide = !(flags&0x800);
|
mShape->mCollide = !(flags&0x800);
|
||||||
handleNiTriShape(mesh, static_cast<const Nif::NiTriShape*>(node), flags, node->getWorldTransform(), raycasting);
|
handleNiTriShape(mesh, static_cast<const Nif::NiTriShape*>(node), flags, node->getWorldTransform(), raycasting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue